From 29d3c47cc6c903c09b386649fabaebc81cbeca27 Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期四, 05 六月 2025 10:43:39 +0800
Subject: [PATCH] 报错日志添加

---
 ycl-server/src/main/java/com/ycl/platform/service/impl/DataCenterServiceImpl.java |   37 ++++++++++++++++++-------------------
 1 files changed, 18 insertions(+), 19 deletions(-)

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 1397a1e..4db2f09 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
@@ -20,6 +20,7 @@
 import com.ycl.platform.domain.vo.DynamicColumnVO;
 import com.ycl.platform.mapper.DynamicColumnMapper;
 import com.ycl.platform.mapper.ImageResourceSecurityDetailMapper;
+import com.ycl.platform.mapper.TMonitorMapper;
 import com.ycl.platform.mapper.YwPointMapper;
 import com.ycl.platform.service.*;
 import com.ycl.system.Result;
@@ -66,7 +67,6 @@
     private final MongoTemplate mongoTemplate;
     private final ImageResourceSecurityDetailMapper securityDetailMapper;
     private final YwPointMapper pointMapper;
-    private final ICheckIndexVideoService checkIndexVideoService;
     private final ICheckIndexCarService checkIndexCarService;
     private final ICheckIndexFaceService checkIndexFaceService;
     private final DynamicColumnMapper dynamicColumnMapper;
@@ -631,6 +631,8 @@
 
 
     }
+
+
 
     /**
      * 瑙嗛锛氱偣浣嶅湪绾跨巼
@@ -1370,6 +1372,7 @@
 
         return recordingMinTime;
     }
+    private final TMonitorMapper tMonitorMapper;
 
     /**
      * 瑙嗛锛氬綍鍍忓彲鐢ㄧ巼
@@ -1379,15 +1382,20 @@
      */
     @Override
     public Result videoAvailabilityRate(DataCenterQuery params) {
+        List<String> noString = tMonitorMapper.getIdListVideo();
 
         List<String> likeFileds = Arrays.asList("deviceId", "deviceName");
         Query query = MongoUtil.getQuery(params, "createTime", likeFileds, null);
+        if (CollectionUtils.isNotEmpty(noString)) { // 闃叉绌洪泦鍚堝紓甯�
+            query.addCriteria(Criteria.where("no").in(noString));
+        }
         //涓嬫媺妗嗗綍鍍忔儏鍐垫煡璇㈡潯浠�
         if (params.getOption() != null) {
             query.addCriteria(Criteria.where("recordStatus").is(params.getOption()));
         }
         long total = mongoTemplate.count(query, RecordMetaDSumResult.class);
         MongoUtil.setPage(query, params, "createTime");
+
         List<RecordMetaDSumResult> resultList = mongoTemplate.find(query, RecordMetaDSumResult.class);
         //鏌ヨ鍔ㄦ�佸垪鏁版嵁
         //鏌ヨ鍔ㄦ�佸垪鏁版嵁鏇村叿id鏌ヨ
@@ -1403,12 +1411,15 @@
 
         });
         // 缁熻鏁伴噺
+
         MongoDatabase database = mongoTemplate.getDb();
         MongoCollection<Document> collection = database.getCollection("uy_record_meta_d_sum");
         List<Integer> status = Arrays.asList(1, 0, -1);
         List<String> resultCount = status.stream().map(item -> {
             List<Document> dList = new ArrayList<>(2);
+
             dList.add(new Document("recordStatus", new Document("$eq", item)));
+            dList.add(new Document("no", new Document("$in", noString)));
             setTag(params, dList);
             Document filter = new Document("$and", dList);
             // 鏋勫缓鑱氬悎绠¢亾
@@ -1435,8 +1446,9 @@
         double finalRecordingMinTime = getSySMinTime();
 
         List<Document> documentList = new ArrayList<>(2);
+        documentList.add(new Document("no", new Document("$in", noString)));
         setTag(params, documentList);
-        Document recording = new Document("recordDuration",new Document("$gte", finalRecordingMinTime));
+        Document recording = new Document("missDuration",new Document("$lte", finalRecordingMinTime));
         documentList.add(recording);
 
         Document filter = new Document("$and", documentList);
@@ -1448,25 +1460,14 @@
                 new Document("$count", "uniqueDeviceIds")
         );
         AggregateIterable<Document> result = collection2.aggregate(pipeline);
+
+
         Integer uniqueDeviceIdCount = 0;
         for (Document doc : result) {
             uniqueDeviceIdCount = doc.getInteger("uniqueDeviceIds");
             break; // 涓嶉渶瑕佺户缁亶鍘嗭紝鍥犱负 $count 鍙細浜х敓涓�涓粨鏋�
         }
         log.error("褰曞儚鍙敤鐜囨墦鍗帮細{}",uniqueDeviceIdCount);
-//        List<CheckIndexVideo> videoList = new LambdaQueryChainWrapper<>(checkIndexVideoService.getBaseMapper())
-//                .select(CheckIndexVideo::getVideoAvailable)
-//                .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::getVideoAvailable).reduce(BigDecimal.ZERO, BigDecimal::add);
-//            BigDecimal count = BigDecimal.valueOf(videoList.size());
-//            onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
-//        }
-        //鍔犱竴涓�绘暟
         int totalCount = 0;
         for (String s : resultCount) {
             totalCount += Integer.parseInt(s);
@@ -1474,8 +1475,6 @@
         resultCount.add(0, totalCount + "");
 
         BigDecimal onlineRate = BigDecimal.ZERO;
-
-
 //        1锛氬畬鏁� 0锛氶棿姝� -1锛氬紓甯� |
         if (!StringUtils.isEmpty(resultCount.get(0)) && !"0".equals(resultCount.get(0))) {
             //resultCount.get(0)鏄�绘暟 uniqueDeviceIdCount鏄洿鍏风郴缁熷弬鏁版煡璇㈠埌mongodb涓ぇ浜庣瓑浜� recordDuration瀛楁鐨勬�绘暟
@@ -1548,7 +1547,7 @@
         List<Document> documentList = new ArrayList<>(4);
         documentList.add(new Document("deptTag", new Document("$eq", Boolean.TRUE)));
         setTag(params, documentList);
-        Document recording = new Document("recordDuration",new Document("$gte", finalRecordingMinTime));
+        Document recording = new Document("missDuration",new Document("$lte", finalRecordingMinTime));
         documentList.add(recording);
         Document filter = new Document("$and", documentList);
         // 鏋勫缓鑱氬悎绠¢亾
@@ -1655,7 +1654,7 @@
         List<Document> documentList = new ArrayList<>(4);
         documentList.add(new Document("importantTag", new Document("$eq", Boolean.TRUE)));
         setTag(params, documentList);
-        Document recording = new Document("recordDuration",new Document("$gte", finalRecordingMinTime));
+        Document recording = new Document("missDuration",new Document("$lte", finalRecordingMinTime));
         documentList.add(recording);
         Document filter = new Document("$and", documentList);
         // 鏋勫缓鑱氬悎绠¢亾

--
Gitblit v1.8.0