From c739b7a067827a3ea7b9a0ce43a38267759536be Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期五, 16 八月 2024 09:59:53 +0800
Subject: [PATCH] 平台管理添加优化

---
 ycl-server/src/main/java/com/ycl/calculate/VideoUsabilityCalculation.java |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/ycl-server/src/main/java/com/ycl/calculate/VideoUsabilityCalculation.java b/ycl-server/src/main/java/com/ycl/calculate/VideoUsabilityCalculation.java
index 954343f..1b267fc 100644
--- a/ycl-server/src/main/java/com/ycl/calculate/VideoUsabilityCalculation.java
+++ b/ycl-server/src/main/java/com/ycl/calculate/VideoUsabilityCalculation.java
@@ -5,7 +5,9 @@
 import com.ycl.platform.domain.entity.TMonitor;
 import com.ycl.platform.domain.param.UY.RecordMetaDSumParam;
 import com.ycl.platform.domain.result.UY.QueryVqdResult;
+import com.ycl.platform.domain.vo.TMonitorVO;
 import com.ycl.platform.mapper.CheckIndexVideoMapper;
+import com.ycl.platform.mapper.TMonitorMapper;
 import com.ycl.platform.service.ICheckIndexVideoService;
 import com.ycl.platform.service.ITMonitorService;
 import constant.ApiConstants;
@@ -34,7 +36,7 @@
     @Autowired
     private CheckIndexVideoMapper checkIndexVideoMapper;
     @Autowired
-    private ITMonitorService monitorService;
+    private TMonitorMapper monitorMapper;
     @Autowired
     private ICheckIndexVideoService checkIndexVideoService;
 
@@ -53,9 +55,8 @@
         }
 
         //鑾峰緱鍥芥爣鐮佷负key鐨勮澶噈ap
-        Map<String, TMonitor> monitorMap = monitorService.list(new QueryWrapper<TMonitor>()
-                        .in("serial_number", list.stream().map(RecordMetaDSumParam::getDeviceId).collect(Collectors.toList())))
-                .stream().collect(Collectors.toMap(TMonitor::getSerialNumber, Function.identity()));
+        Map<String, TMonitorVO> monitorMap = monitorMapper.selectListByIds(list.stream().map(RecordMetaDSumParam::getDeviceId).collect(Collectors.toList()))
+                .stream().collect(Collectors.toMap(TMonitorVO::getSerialNumber, Function.identity()));
         //鑾峰彇鐪佸巺鍥芥爣鐮侀泦鍚�
         List<String> provinceIds = getProvince();
         //閲嶇偣鐐逛綅闆嗗悎
@@ -63,7 +64,7 @@
 
         Map<String, AreaStats> areaStatsMap = new HashMap<>();
         for (RecordMetaDSumParam result : list) {
-            TMonitor monitor = monitorMap.get(result.getDeviceId());
+            TMonitorVO monitor = monitorMap.get(result.getDeviceId());
             if (monitor == null) continue;
 
             String deptId = monitor.getDeptId().toString();
@@ -71,7 +72,7 @@
 
             // 澶勭悊鐪佸巺鏁版嵁
             if (!CollectionUtils.isEmpty(provinceIds) && provinceIds.contains(monitor.getSerialNumber())) {
-                String provinceKey = "Province_" + deptId;
+                String provinceKey = ApiConstants.Province + deptId;
                 updateAreaStats(areaStatsMap, provinceKey, result, important);
             }
         }
@@ -81,9 +82,9 @@
         List<CheckIndexVideo> checkIndexVideos = new ArrayList<>();
         areaStatsMap.forEach((deptId, stats) -> {
             if (stats.totalSites > 0) {
-                CheckIndexVideo CheckIndexVideo = createOrUpdateCheckIndexFace(deptId, stats, checkIndexVideoList);
-                if (CheckIndexVideo != null) {
-                    checkIndexVideos.add(CheckIndexVideo);
+                CheckIndexVideo checkIndexVideo = createOrUpdateCheckIndexVideo(deptId, stats, checkIndexVideoList);
+                if (checkIndexVideo != null) {
+                    checkIndexVideos.add(checkIndexVideo);
                 }
             }
         });
@@ -113,7 +114,7 @@
     /**
      * 瑙嗛鐐逛綅鍦ㄧ嚎鐜�
      */
-    private CheckIndexVideo createOrUpdateCheckIndexFace(String key, AreaStats stats, List<CheckIndexVideo> checkIndexVideoList) {
+    private CheckIndexVideo createOrUpdateCheckIndexVideo(String key, AreaStats stats, List<CheckIndexVideo> checkIndexVideoList) {
         CheckIndexVideo checkIndexVideo = getCheckIndex(key, checkIndexVideoList, CheckIndexVideo.class);
         if (checkIndexVideo == null) {
             return null;

--
Gitblit v1.8.0