From 87a7362709ac249c3965a392842cf24bc402b6c1 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期一, 28 十月 2024 11:49:09 +0800
Subject: [PATCH] 档案考核比、一机一档合格、注册率。数据中心视频类优化完
---
ycl-pojo/src/main/java/com/ycl/platform/domain/result/UY/MonitorQualifyResult.java | 43 ++++++
ycl-server/src/main/java/com/ycl/platform/service/impl/DataCenterServiceImpl.java | 228 ++++++++++++++++++++++++++-----------
ycl-pojo/src/main/java/com/ycl/platform/domain/vo/DataCenter/MonitorQualifyResultVO.java | 71 +++++++++++
3 files changed, 270 insertions(+), 72 deletions(-)
diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/result/UY/MonitorQualifyResult.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/result/UY/MonitorQualifyResult.java
index eee213c..9f5c032 100644
--- a/ycl-pojo/src/main/java/com/ycl/platform/domain/result/UY/MonitorQualifyResult.java
+++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/result/UY/MonitorQualifyResult.java
@@ -1,6 +1,7 @@
package com.ycl.platform.domain.result.UY;
import com.ycl.platform.domain.result.BaseResult;
+import com.ycl.platform.domain.vo.DataCenter.MonitorQualifyResultVO;
import lombok.Data;
import org.springframework.data.mongodb.core.index.TextIndexed;
import org.springframework.data.mongodb.core.mapping.Document;
@@ -68,12 +69,12 @@
public static class QualifyResult {
/**
* 鏄惁閿欒 姝e父鏄痜alse锛宼ure琛ㄧず鏈夐棶棰�
- * */
+ */
private Boolean error;
private String errorMessage;
/**
* 灞曠ず鍊�
- * */
+ */
@TextIndexed
private String showValue;
/**
@@ -85,7 +86,7 @@
//鍏ㄥ杩攖ure
public static boolean correct(MonitorQualifyResult result) {
- return checkError(result.getName()) &&
+ return checkError(result.getName()) &&
checkError(result.getCivilCode()) &&
checkError(result.getIp()) &&
checkError(result.getSerialNumber()) &&
@@ -102,6 +103,40 @@
//妫�鏌ユ寚鏍囷紝姝e父杩斿洖true
public static boolean checkError(MonitorQualifyResult.QualifyResult result) {
- return result.getError() != null && !result.getError();
+ return result.getError() != null && !result.getError();
+ }
+
+ public static MonitorQualifyResultVO getVO(MonitorQualifyResult result) {
+ MonitorQualifyResultVO vo = new MonitorQualifyResultVO();
+ vo.setCivilCode(result.getCivilCode().getShowValue());
+ vo.setCivilCodeError(result.getCivilCode().getError());
+ vo.setIp(result.getIp().getShowValue());
+ vo.setIpError(result.getIp().getError());
+ vo.setIntegratedDevice(result.getIntegrated_device().getShowValue());
+ vo.setIntegratedDeviceError(result.getIntegrated_device().getError());
+ vo.setJkdwlx(result.getJkdwlx().getShowValue());
+ vo.setJkdwlxError(result.getJkdwlx().getError());
+ vo.setLatitude(result.getLatitude().getShowValue());
+ vo.setLatitudeError(result.getLatitude().getError());
+ vo.setLongitude(result.getLongitude().getShowValue());
+ vo.setLongitudeError(result.getLongitude().getError());
+ vo.setMacdz(result.getMacdz().getShowValue());
+ vo.setMacdzError(result.getMacdz().getError());
+ vo.setName(result.getName().getShowValue());
+ vo.setNameError(result.getName().getError());
+ vo.setSbzt(result.getSbzt().getShowValue());
+ vo.setSbztError(result.getSbzt().getError());
+ vo.setSerialNumber(result.getSerialNumber().getShowValue());
+ vo.setSerialNumberError(result.getSerialNumber().getError());
+ vo.setSxjcjqy(result.getSxjcjqy().getShowValue());
+ vo.setSxjcjqyError(result.getSxjcjqy().getError());
+ vo.setSxjgnlx(result.getSxjgnlx().getShowValue());
+ vo.setSxjgnlxError(result.getSxjgnlx().getError());
+ if (result.getNewDevice()) {
+ vo.setNewDevice("鏄�");
+ } else {
+ vo.setNewDevice("鍚�");
+ }
+ return vo;
}
}
diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/vo/DataCenter/MonitorQualifyResultVO.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/vo/DataCenter/MonitorQualifyResultVO.java
new file mode 100644
index 0000000..7386064
--- /dev/null
+++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/vo/DataCenter/MonitorQualifyResultVO.java
@@ -0,0 +1,71 @@
+package com.ycl.platform.domain.vo.DataCenter;
+
+import com.ycl.platform.domain.result.UY.MonitorQualifyResult;
+import lombok.Data;
+import org.springframework.data.mongodb.core.index.TextIndexed;
+
+@Data
+public class MonitorQualifyResultVO {
+ /**
+ * 琛屾斂缂栫爜
+ */
+ private String civilCode;
+ private Boolean civilCodeError;
+ /**
+ * 鏄惁闆嗘垚璁惧
+ */
+ private String integratedDevice;
+ private Boolean integratedDeviceError;
+ /**
+ * IP鍦板潃
+ */
+ private String ip;
+ private Boolean ipError;
+ /**
+ * 鐩戞帶鐐逛綅绫诲瀷
+ */
+ private String jkdwlx;
+ private Boolean jkdwlxError;
+ /**
+ * 绾害
+ */
+ private String latitude;
+ private Boolean latitudeError;
+ /**
+ * 缁忓害
+ */
+ private String longitude;
+ private Boolean longitudeError;
+ /**
+ * mac鍦板潃
+ */
+ private String macdz;
+ private Boolean macdzError;
+ /**
+ * 璁惧鍚�
+ */
+ private String name;
+ private Boolean nameError;
+ /**
+ * 璁惧鐘舵��
+ */
+ private String sbzt;
+ private Boolean sbztError;
+ /**
+ * 璁惧缂栫爜
+ */
+ private String serialNumber;
+ private Boolean serialNumberError;
+ /**
+ * 鎽勫儚鏈洪噰闆嗗尯鍩�
+ */
+ private String sxjcjqy;
+ private Boolean sxjcjqyError;
+ /**
+ * 鎽勫儚鏈哄姛鑳界被鍨�
+ */
+ private String sxjgnlx;
+ private Boolean sxjgnlxError;
+
+ private String newDevice;
+}
diff --git a/ycl-server/src/main/java/com/ycl/platform/service/impl/DataCenterServiceImpl.java b/ycl-server/src/main/java/com/ycl/platform/service/impl/DataCenterServiceImpl.java
index c3a37f7..28abd57 100644
--- a/ycl-server/src/main/java/com/ycl/platform/service/impl/DataCenterServiceImpl.java
+++ b/ycl-server/src/main/java/com/ycl/platform/service/impl/DataCenterServiceImpl.java
@@ -13,6 +13,7 @@
import com.ycl.platform.domain.result.HK.*;
import com.ycl.platform.domain.result.SYS.TMonitorResult;
import com.ycl.platform.domain.result.UY.*;
+import com.ycl.platform.domain.vo.DataCenter.MonitorQualifyResultVO;
import com.ycl.platform.domain.vo.PointDetailVO;
import com.ycl.platform.mapper.ImageResourceSecurityDetailMapper;
import com.ycl.platform.mapper.YwPointMapper;
@@ -21,6 +22,7 @@
import com.ycl.system.page.PageUtil;
import com.ycl.utils.DateUtils;
import com.ycl.utils.MongoUtil;
+import com.ycl.utils.bean.BeanUtils;
import constant.ApiConstants;
import constant.CheckConstants;
import lombok.RequiredArgsConstructor;
@@ -453,34 +455,40 @@
@Override
public Result videoOneMachineDocumentRegister(DataCenterQuery params) {
List<String> likeFileds = Arrays.asList("ip.showValue", "name.showValue", "serialNumber.showValue");
- Query query = MongoUtil.getQuery(params, TIME_FIELD, likeFileds, null);
-
+ List<Criteria> andCriteria = MongoUtil.getAndCriteria(params, TIME_FIELD, likeFileds, null);
+ Query query = new Query();
+ Criteria and = new Criteria();
+ if(params.getOption()!=null){
+ if(params.getOption() ==1){
+ andCriteria.add(Criteria.where("newDevice").is(Boolean.TRUE));
+ }else if(params.getOption() ==-1){
+ andCriteria.add(Criteria.where("newDevice").is(Boolean.FALSE));
+ }
+ }
+ and.andOperator(andCriteria);
+ query = Query.query(and);
long total = mongoTemplate.count(query, MonitorQualifyResult.class);
MongoUtil.setPage(query, params, TIME_FIELD);
List<MonitorQualifyResult> resultList = mongoTemplate.find(query, MonitorQualifyResult.class);
-
+ List<MonitorQualifyResultVO> resultVOS = new ArrayList<>();
+ for (MonitorQualifyResult result : resultList) {
+ MonitorQualifyResultVO vo = MonitorQualifyResult.getVO(result);
+ resultVOS.add(vo);
+ }
// 缁熻鏁伴噺
MongoDatabase database = mongoTemplate.getDb();
MongoCollection<Document> collection = database.getCollection("uy_monitor_qualify");
-
+ //鎬绘暟
List<Document> dList1 = new ArrayList<>(2);
- dList1.add(new Document("ip.error", new Document("$eq", Boolean.TRUE)));
setTag(params, dList1);
+ Document totalFilter = new Document("$and",dList1);
+ //鏂拌澶囨暟
List<Document> dList2 = new ArrayList<>(2);
- dList2.add(new Document("macdz.error", new Document("$eq", Boolean.TRUE)));
setTag(params, dList2);
- List<Document> dList3 = new ArrayList<>(2);
- dList3.add(new Document("latitude.error", new Document("$eq", Boolean.TRUE)));
- setTag(params, dList3);
- List<Document> dList4 = new ArrayList<>(2);
- dList4.add(new Document("longitude.error", new Document("$eq", Boolean.TRUE)));
- setTag(params, dList4);
- Document ipErrFilter = new Document("$and", dList1);
- Document macdzErrFilter = new Document("$and", dList2);
- Document latitudeErrFilter = new Document("$and", dList3);
- Document longitudeErrFilter = new Document("$and", dList4);
+ dList2.add(new Document("newDevice",Boolean.TRUE));
+ Document newFilter = new Document("$and",dList2);
- List<Document> lists = Arrays.asList(ipErrFilter, macdzErrFilter, latitudeErrFilter, longitudeErrFilter);
+ List<Document> lists = Arrays.asList(totalFilter, newFilter);
List<String> rList = lists.stream().map(filter -> {
// 鏋勫缓鑱氬悎绠¢亾
List<Document> pipeline = Arrays.asList(
@@ -499,11 +507,11 @@
return uniqueDeviceIdCount + "";
}).collect(Collectors.toList());
- Date now = new Date();
List<CheckIndexVideo> videoList = new LambdaQueryChainWrapper<>(checkIndexVideoService.getBaseMapper())
.select(CheckIndexVideo::getMonitorRegistration)
.eq(params.getDataType().equals(1), CheckIndexVideo::getExamineTag, CheckConstants.Examine_Tag_Province)
- .between(CheckIndexVideo::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now))
+ .eq(params.getDataType().equals(2), CheckIndexVideo::getExamineTag, CheckConstants.Examine_Tag_Dept)
+ .between(CheckIndexVideo::getCreateTime, DateUtils.getDayStart(params.getStartTime()), DateUtils.getDayEnd(params.getEndTime()))
.list();
BigDecimal onlineRate = BigDecimal.ZERO;
if (CollectionUtils.isNotEmpty(videoList)) {
@@ -514,7 +522,7 @@
rList.add(this.remove0(onlineRate));
HashMap<String, Object> map = new HashMap<>();
map.put("count", rList);
- map.put("list", resultList);
+ map.put("list", resultVOS);
return Result.ok().data(map).total(total);
}
@@ -527,34 +535,100 @@
@Override
public Result videoOneMachineDocumentQualified(DataCenterQuery params) {
List<String> likeFileds = Arrays.asList("ip.showValue", "name.showValue", "serialNumber.showValue");
- Query query = MongoUtil.getQuery(params, TIME_FIELD, likeFileds, null);
+ List<Criteria> andCriteria = MongoUtil.getAndCriteria(params, TIME_FIELD, likeFileds, null);
+ Query query = new Query();
+ Criteria and = new Criteria();
+ and.andOperator(andCriteria);
+ query = Query.query(and);
+ if(params.getOption()!=null){
+ if(params.getOption() ==1){
+ andCriteria.add(Criteria.where("serialNumber.error").is(Boolean.FALSE));
+ andCriteria.add(Criteria.where("name.error").is(Boolean.FALSE));
+ andCriteria.add(Criteria.where("civilCode.error").is(Boolean.FALSE));
+ andCriteria.add(Criteria.where("integrated_device.error").is(Boolean.FALSE));
+ andCriteria.add(Criteria.where("jkdwlx.error").is(Boolean.FALSE));
+ andCriteria.add(Criteria.where("latitude.error").is(Boolean.FALSE));
+ andCriteria.add(Criteria.where("longitude.error").is(Boolean.FALSE));
+ andCriteria.add(Criteria.where("macdz.error").is(Boolean.FALSE));
+ andCriteria.add(Criteria.where("name.error").is(Boolean.FALSE));
+ andCriteria.add(Criteria.where("sbzt.error").is(Boolean.FALSE));
+ andCriteria.add(Criteria.where("sxjcjqy.error").is(Boolean.FALSE));
+ andCriteria.add(Criteria.where("sxjgnlx.error").is(Boolean.FALSE));
+ Criteria and2 = new Criteria();
+ and2.andOperator(andCriteria);
+ query = Query.query(and2);
+ }else if(params.getOption() ==-1){
+ Criteria c1 = Criteria.where("serialNumber.error").is(Boolean.TRUE);
+ Criteria c2 = Criteria.where("name.error").is(Boolean.TRUE);
+ Criteria c3 = Criteria.where("civilCode.error").is(Boolean.TRUE);
+ Criteria c4 = Criteria.where("integrated_device.error").is(Boolean.TRUE);
+ Criteria c5 = Criteria.where("jkdwlx.error").is(Boolean.TRUE);
+ Criteria c6 = Criteria.where("latitude.error").is(Boolean.TRUE);
+ Criteria c7 = Criteria.where("longitude.error").is(Boolean.TRUE);
+ Criteria c8 = Criteria.where("macdz.error").is(Boolean.TRUE);
+ Criteria c9 = Criteria.where("name.error").is(Boolean.TRUE);
+ Criteria c10 = Criteria.where("sbzt.error").is(Boolean.TRUE);
+ Criteria c11 = Criteria.where("sxjcjqy.error").is(Boolean.TRUE);
+ Criteria c12 = Criteria.where("sxjgnlx.error").is(Boolean.TRUE);
+ Criteria orOperator = new Criteria().orOperator(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12);
+ orOperator.andOperator(andCriteria);
+ query = Query.query(orOperator);
+ }
+ }
long total = mongoTemplate.count(query, MonitorQualifyResult.class);
MongoUtil.setPage(query, params, TIME_FIELD);
List<MonitorQualifyResult> resultList = mongoTemplate.find(query, MonitorQualifyResult.class);
-
+ List<MonitorQualifyResultVO> resultVOS = new ArrayList<>();
+ for (MonitorQualifyResult result : resultList) {
+ MonitorQualifyResultVO vo = MonitorQualifyResult.getVO(result);
+ resultVOS.add(vo);
+ }
// 缁熻鏁伴噺
MongoDatabase database = mongoTemplate.getDb();
MongoCollection<Document> collection = database.getCollection("uy_monitor_qualify");
-
+ //鎬绘暟
List<Document> dList1 = new ArrayList<>(2);
- dList1.add(new Document("ip.error", new Document("$eq", Boolean.TRUE)));
setTag(params, dList1);
+ Document totalFilter = new Document("$and",dList1);
+ //鍚堟牸鏁�
List<Document> dList2 = new ArrayList<>(2);
- dList2.add(new Document("macdz.error", new Document("$eq", Boolean.TRUE)));
- setTag(params, dList2);
- List<Document> dList3 = new ArrayList<>(2);
- dList3.add(new Document("latitude.error", new Document("$eq", Boolean.TRUE)));
- setTag(params, dList3);
- List<Document> dList4 = new ArrayList<>(2);
- dList4.add(new Document("longitude.error", new Document("$eq", Boolean.TRUE)));
- setTag(params, dList4);
- Document ipErrFilter = new Document("$and", dList1);
- Document macdzErrFilter = new Document("$and", dList2);
- Document latitudeErrFilter = new Document("$and", dList3);
- Document longitudeErrFilter = new Document("$and", dList4);
+ dList2.add(new Document("serialNumber.error",Boolean.FALSE));
+ dList2.add(new Document("name.error",Boolean.FALSE));
+ dList2.add(new Document("civilCode.error",Boolean.FALSE));
+ dList2.add(new Document("integrated_device.error",Boolean.FALSE));
+ dList2.add(new Document("jkdwlx.error",Boolean.FALSE));
+ dList2.add(new Document("latitude.error",Boolean.FALSE));
+ dList2.add(new Document("longitude.error",Boolean.FALSE));
+ dList2.add(new Document("macdz.error",Boolean.FALSE));
+ dList2.add(new Document("name.error",Boolean.FALSE));
+ dList2.add(new Document("sbzt.error",Boolean.FALSE));
+ dList2.add(new Document("sxjcjqy.error",Boolean.FALSE));
+ dList2.add(new Document("sxjgnlx.error",Boolean.FALSE));
+ setTag(params,dList2);
+ Document qualifyFilter = new Document("$and",dList2);
+ //涓嶅悎鏍兼暟
+ Document mongoCreateTimeRange = new Document()
+ .append("$gte", params.getStartTime())
+ .append("$lt", params.getEndTime());
+ Document mongoCreateTime = new Document("mongoCreateTime", mongoCreateTimeRange);
+ List<Document> errorConditions = new ArrayList<>();
+ errorConditions.add(new Document("serialNumber.error", new Document("$eq", Boolean.TRUE)));
+ errorConditions.add(new Document("name.error", new Document("$eq", Boolean.TRUE)));
+ errorConditions.add(new Document("civilCode.error", new Document("$eq", Boolean.TRUE)));
+ errorConditions.add(new Document("integrated_device.error", new Document("$eq", Boolean.TRUE)));
+ errorConditions.add(new Document("jkdwlx.error", new Document("$eq", Boolean.TRUE)));
+ errorConditions.add(new Document("latitude.error", new Document("$eq", Boolean.TRUE)));
+ errorConditions.add(new Document("longitude.error", new Document("$eq", Boolean.TRUE)));
+ errorConditions.add(new Document("macdz.error", new Document("$eq", Boolean.TRUE)));
+ errorConditions.add(new Document("name.error", new Document("$eq", Boolean.TRUE)));
+ errorConditions.add(new Document("sbzt.error", new Document("$eq", Boolean.TRUE)));
+ errorConditions.add(new Document("sxjcjqy.error", new Document("$eq", Boolean.TRUE)));
+ errorConditions.add(new Document("sxjgnlx.error", new Document("$eq", Boolean.TRUE)));
+ Document errorFilter = new Document("$or", errorConditions);
+ Document unQualifyFilter = new Document("$and", Arrays.asList(mongoCreateTime, errorFilter));
- List<Document> lists = Arrays.asList(ipErrFilter, macdzErrFilter, latitudeErrFilter, longitudeErrFilter);
+ List<Document> lists = Arrays.asList(totalFilter, qualifyFilter, unQualifyFilter);
List<String> rList = lists.stream().map(filter -> {
// 鏋勫缓鑱氬悎绠¢亾
List<Document> pipeline = Arrays.asList(
@@ -573,11 +647,11 @@
return uniqueDeviceIdCount + "";
}).collect(Collectors.toList());
- Date now = new Date();
List<CheckIndexVideo> videoList = new LambdaQueryChainWrapper<>(checkIndexVideoService.getBaseMapper())
.select(CheckIndexVideo::getMonitorQualification)
.eq(params.getDataType().equals(1), CheckIndexVideo::getExamineTag, CheckConstants.Examine_Tag_Province)
- .between(CheckIndexVideo::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now))
+ .eq(params.getDataType().equals(2), CheckIndexVideo::getExamineTag, CheckConstants.Examine_Tag_Dept)
+ .between(CheckIndexVideo::getCreateTime, DateUtils.getDayStart(params.getStartTime()), DateUtils.getDayEnd(params.getEndTime()))
.list();
BigDecimal onlineRate = BigDecimal.ZERO;
if (CollectionUtils.isNotEmpty(videoList)) {
@@ -588,47 +662,50 @@
rList.add(this.remove0(onlineRate));
HashMap<String, Object> map = new HashMap<>();
map.put("count", rList);
- map.put("list", resultList);
+ map.put("list", resultVOS);
return Result.ok().data(map).total(total);
}
/**
* 瑙嗛锛氭。妗堣�冩牳姣�
- *
+ * 妗f鐣欏瓨鎬婚噺锛歮ongo瀛樼殑鎵�鏈夊幓閲嶅悗鐨勬。妗�
+ * 褰撴棩妗f锛氬綋鏃ョ殑妗f
+ * 妗f鑰冩牳姣� = 褰撴棩妗f/妗f鐣欏瓨鎬婚噺
* @param params
- * @return
+ * @return1
*/
@Override
public Result videoAssessmentFileRatio(DataCenterQuery params) {
List<String> likeFileds = Arrays.asList("ip.showValue", "name.showValue", "serialNumber.showValue");
- Query query = MongoUtil.getQuery(params, TIME_FIELD, likeFileds, null);
-
+ List<Criteria> andCriteria = MongoUtil.getAndCriteria(params, TIME_FIELD, likeFileds, null);
+ Query query = new Query();
+ Criteria and = new Criteria();
+ and.andOperator(andCriteria);
+ query = Query.query(and);
long total = mongoTemplate.count(query, MonitorQualifyResult.class);
MongoUtil.setPage(query, params, TIME_FIELD);
List<MonitorQualifyResult> resultList = mongoTemplate.find(query, MonitorQualifyResult.class);
-
+ List<MonitorQualifyResultVO> resultVOS = new ArrayList<>();
+ for (MonitorQualifyResult result : resultList) {
+ MonitorQualifyResultVO vo = MonitorQualifyResult.getVO(result);
+ resultVOS.add(vo);
+ }
// 缁熻鏁伴噺
MongoDatabase database = mongoTemplate.getDb();
MongoCollection<Document> collection = database.getCollection("uy_monitor_qualify");
-
+ //鎬绘暟
List<Document> dList1 = new ArrayList<>(2);
- dList1.add(new Document("ip.error", new Document("$eq", Boolean.TRUE)));
- setTag(params, dList1);
+ DataCenterQuery totalParams = new DataCenterQuery();
+ BeanUtils.copyProperties(params,totalParams);
+ totalParams.setStartTime(null);
+ setTag(totalParams, dList1);
+ Document totalFilter = new Document("$and",dList1);
+ //褰撴棩妗f鏁�
List<Document> dList2 = new ArrayList<>(2);
- dList2.add(new Document("macdz.error", new Document("$eq", Boolean.TRUE)));
setTag(params, dList2);
- List<Document> dList3 = new ArrayList<>(2);
- dList3.add(new Document("latitude.error", new Document("$eq", Boolean.TRUE)));
- setTag(params, dList3);
- List<Document> dList4 = new ArrayList<>(2);
- dList4.add(new Document("longitude.error", new Document("$eq", Boolean.TRUE)));
- setTag(params, dList4);
- Document ipErrFilter = new Document("$and", dList1);
- Document macdzErrFilter = new Document("$and", dList2);
- Document latitudeErrFilter = new Document("$and", dList3);
- Document longitudeErrFilter = new Document("$and", dList4);
+ Document newFilter = new Document("$and",dList2);
- List<Document> lists = Arrays.asList(ipErrFilter, macdzErrFilter, latitudeErrFilter, longitudeErrFilter);
+ List<Document> lists = Arrays.asList(totalFilter, newFilter);
List<String> rList = lists.stream().map(filter -> {
// 鏋勫缓鑱氬悎绠¢亾
List<Document> pipeline = Arrays.asList(
@@ -647,10 +724,22 @@
return uniqueDeviceIdCount + "";
}).collect(Collectors.toList());
- rList.add("0%");
+ List<CheckIndexVideo> videoList = new LambdaQueryChainWrapper<>(checkIndexVideoService.getBaseMapper())
+ .select(CheckIndexVideo::getArchivesRate)
+ .eq(params.getDataType().equals(1), CheckIndexVideo::getExamineTag, CheckConstants.Examine_Tag_Province)
+ .eq(params.getDataType().equals(2), CheckIndexVideo::getExamineTag, CheckConstants.Examine_Tag_Dept)
+ .between(CheckIndexVideo::getCreateTime, DateUtils.getDayStart(params.getStartTime()), DateUtils.getDayEnd(params.getEndTime()))
+ .list();
+ BigDecimal onlineRate = BigDecimal.ZERO;
+ if (CollectionUtils.isNotEmpty(videoList)) {
+ BigDecimal sum = videoList.stream().map(CheckIndexVideo::getArchivesRate).reduce(BigDecimal.ZERO, BigDecimal::add);
+ BigDecimal count = BigDecimal.valueOf(videoList.size());
+ onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
+ }
+ rList.add(this.remove0(onlineRate));
HashMap<String, Object> map = new HashMap<>();
map.put("count", rList);
- map.put("list", resultList);
+ map.put("list", resultVOS);
return Result.ok().data(map).total(total);
}
@@ -900,6 +989,9 @@
List<String> likeFileds = Arrays.asList("deviceNo", "osdName");
List<Criteria> andCriteria = MongoUtil.getAndCriteria(params, "checkTime", likeFileds, 3);
Query query = new Query();
+ Criteria and = new Criteria();
+ and.andOperator(andCriteria);
+ query = Query.query(and);
//涓嬫媺妗嗘爣娉ㄦ纭煡璇㈡潯浠�
if (params.getOption() != null) {
if(params.getOption()==1) {
@@ -908,9 +1000,9 @@
andCriteria.add(Criteria.where("osdProvinceCorrect").is(1));
andCriteria.add(Criteria.where("osdCityCorrect").is(1));
andCriteria.add(Criteria.where("osdPartCorrect").is(1));
- Criteria and = new Criteria();
- and.andOperator(andCriteria);
- query = Query.query(and);
+ Criteria and2 = new Criteria();
+ and2.andOperator(andCriteria);
+ query = Query.query(and2);
}else if(params.getOption()==-1){
// 浣跨敤$or鏉′欢杩炴帴澶氫釜瀛楁妫�鏌ワ紝姣忎釜瀛楁妫�鏌ユ槸鍚︾瓑浜�-1
Criteria c1 = Criteria.where("osdNameCorrect").is(-1);
@@ -2324,9 +2416,9 @@
} else if (params.getDataType().equals(2)) {
dList.add(new Document("deptTag", new Document("$eq", Boolean.TRUE)));
}
- Document mongoCreateTimeRange = new Document()
- .append("$gte", params.getStartTime())
- .append("$lt", params.getEndTime());
+ Document mongoCreateTimeRange = new Document();
+ if (params.getStartTime()!=null) mongoCreateTimeRange.append("$gte", params.getStartTime());
+ if (params.getEndTime()!=null) mongoCreateTimeRange .append("$lt", params.getEndTime());
dList.add(new Document("mongoCreateTime", mongoCreateTimeRange));
}
}
--
Gitblit v1.8.0