From cb415813de667096290d6bd0f924f5b523104117 Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期一, 10 十一月 2025 17:41:04 +0800
Subject: [PATCH] 报备工单bug修改,定时任务在线问题修改新增导出扣分明细功能

---
 ycl-server/src/main/java/com/ycl/platform/service/impl/TMonitorServiceImpl.java |   30 +++++++++++++++++++++++++-----
 1 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/ycl-server/src/main/java/com/ycl/platform/service/impl/TMonitorServiceImpl.java b/ycl-server/src/main/java/com/ycl/platform/service/impl/TMonitorServiceImpl.java
index d837e1a..d5a28ce 100644
--- a/ycl-server/src/main/java/com/ycl/platform/service/impl/TMonitorServiceImpl.java
+++ b/ycl-server/src/main/java/com/ycl/platform/service/impl/TMonitorServiceImpl.java
@@ -28,10 +28,7 @@
 import com.ycl.platform.domain.vo.home.HomeVideoVO;
 import com.ycl.platform.domain.vo.screen.MonitorRateVO;
 import com.ycl.platform.domain.vo.screen.MonitorTotalVO;
-import com.ycl.platform.mapper.DynamicColumnMapper;
-import com.ycl.platform.mapper.TMonitorMapper;
-import com.ycl.platform.mapper.WorkOrderMapper;
-import com.ycl.platform.mapper.YwPointMapper;
+import com.ycl.platform.mapper.*;
 import com.ycl.platform.service.IMonitorConstructionService;
 import com.ycl.platform.service.ITMonitorService;
 import com.ycl.system.Result;
@@ -1366,18 +1363,38 @@
         calendar.set(Calendar.DAY_OF_MONTH, 1);
         // 鑾峰彇鏈堜唤绗竴澶╃殑Date
         Date startDate = calendar.getTime();
+        log.info("棣栭〉鏌ヨ寮�濮嬫棩鏈�:{}",startDate);
         // 璁剧疆Calendar涓烘湀浠界殑鏈�鍚庝竴澶╋紙閫氳繃澧炲姞涓�涓湀浠界劧鍚庡噺鍘讳竴澶╋級
         calendar.add(Calendar.MONTH, 1);
         calendar.add(Calendar.DAY_OF_MONTH, -1);
         // 鑾峰彇鏈堜唤鏈�鍚庝竴澶╃殑Date
         Date endDate = calendar.getTime();
-
+        log.info("棣栭〉鏌ヨ缁撴潫鏃ユ湡:{}",endDate);
+        String constructionType = monitorQuery.getConstructionType();
+        List<String> deviceNoList = new ArrayList<>();
+        if (StringUtils.isNotBlank(constructionType)){
+            List<MonitorConstruction> serialNumberListByConstructionType = monitorConstructionService.getSerialNumberListByConstructionType(constructionType);
+            if (!CollectionUtils.isEmpty(serialNumberListByConstructionType)){
+                deviceNoList = serialNumberListByConstructionType.stream().map(MonitorConstruction::getSerialNumber).collect(Collectors.toList());
+            }
+        }
+        if (StringUtils.isNotBlank(constructionType) && deviceNoList.isEmpty()) {
+            // 褰揷onstructionType鏈夊�间絾鏃犲搴旇澶囨椂锛岃繑鍥炲寘鍚┖鍒楄〃鐨凪ap
+            Map<String, Object> emptyResult = new HashMap<>();
+            emptyResult.put("list", results); // results姝ゆ椂涓虹┖鍒楄〃
+            emptyResult.put("baseLine", 0); // 鍙牴鎹笟鍔¢粯璁ゅ熀鍑嗙嚎鍊艰皟鏁�
+            return emptyResult;
+        }
         //mongo鏌ュ綍鍍忕姸鎬�
         MongoDatabase database = mongoTemplate.getDb();
         MongoCollection<Document> collection = database.getCollection("uy_record_meta_d_sum");
         Integer examineTag = monitorQuery.getExamineTag();
         String arealayerno = monitorQuery.getArea();
         Document matchConditions = new Document("statTime", new Document("$gte", startDate).append("$lte", endDate));
+        if (!deviceNoList.isEmpty()) {
+            log.info("鎵撳嵃鍒嗗缓绫诲瀷no闆嗗悎:{}",deviceNoList);
+            matchConditions.append("no", new Document("$in", deviceNoList));
+        }
         // 鏍规嵁examineTag鐨勫�煎姩鎬佹坊鍔犻澶栫殑鏉′欢
         if (examineTag != null && examineTag.equals(1)) {
             matchConditions.append("provinceTag", true);
@@ -1445,6 +1462,9 @@
         List<Document> onlineMatch = new ArrayList<>();
         onlineMatch.add(new Document("mongoCreateTime", new Document("$gte", startDate).append("$lte", endDate)));
         onlineMatch.add(new Document("monitorType", new Document("$regex", "1")));
+        if (!deviceNoList.isEmpty()) {
+            onlineMatch.add(new Document("no", new Document("$in", deviceNoList)));
+        }
         if (examineTag != null && examineTag.equals(1)) {
             onlineMatch.add(new Document("provinceTag", true));
         } else if (examineTag != null && examineTag.equals(2)) {

--
Gitblit v1.8.0