From 74fb0ca8f830e145513cc8e18257c5bac4c5ed62 Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期六, 24 八月 2024 12:09:32 +0800
Subject: [PATCH] refactor:合同考核结果详情调整
---
ycl-server/src/main/java/com/ycl/calculate/VideoUsabilityCalculation.java | 28 ++++++++++++++++------------
1 files changed, 16 insertions(+), 12 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 dac89b9..b169a11 100644
--- a/ycl-server/src/main/java/com/ycl/calculate/VideoUsabilityCalculation.java
+++ b/ycl-server/src/main/java/com/ycl/calculate/VideoUsabilityCalculation.java
@@ -5,12 +5,14 @@
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.result.UY.RecordMetaDSumResult;
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;
+import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
@@ -32,7 +34,8 @@
* 鏇存柊鎴栨柊澧�
*/
@Component
-public class VideoUsabilityCalculation extends IndexCalculationServe implements CalculationStrategy<RecordMetaDSumParam> {
+@Slf4j
+public class VideoUsabilityCalculation extends IndexCalculationServe implements CalculationStrategy<RecordMetaDSumResult> {
@Autowired
private CheckIndexVideoMapper checkIndexVideoMapper;
@Autowired
@@ -49,13 +52,14 @@
}
@Override
- public void calculate(List<RecordMetaDSumParam> list) {
+ public void calculate(List<RecordMetaDSumResult> list) {
if (CollectionUtils.isEmpty(list)) {
+ log.info("鏁版嵁涓虹┖");
return;
}
//鑾峰緱鍥芥爣鐮佷负key鐨勮澶噈ap
- Map<String, TMonitorVO> monitorMap = monitorMapper.selectListByIds(list.stream().map(RecordMetaDSumParam::getDeviceId).collect(Collectors.toList()))
+ Map<String, TMonitorVO> monitorMap = monitorMapper.selectListByIds(list.stream().map(RecordMetaDSumResult::getDeviceId).collect(Collectors.toList()))
.stream().collect(Collectors.toMap(TMonitorVO::getSerialNumber, Function.identity()));
//鑾峰彇鐪佸巺鍥芥爣鐮侀泦鍚�
List<String> provinceIds = getProvince();
@@ -63,7 +67,7 @@
List<String> important = getImportant();
Map<String, AreaStats> areaStatsMap = new HashMap<>();
- for (RecordMetaDSumParam result : list) {
+ for (RecordMetaDSumResult result : list) {
TMonitorVO monitor = monitorMap.get(result.getDeviceId());
if (monitor == null) continue;
@@ -72,7 +76,7 @@
// 澶勭悊鐪佸巺鏁版嵁
if (!CollectionUtils.isEmpty(provinceIds) && provinceIds.contains(monitor.getSerialNumber())) {
- String provinceKey = "Province_" + deptId;
+ String provinceKey = ApiConstants.Province + deptId;
updateAreaStats(areaStatsMap, provinceKey, result, important);
}
}
@@ -82,9 +86,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);
}
}
});
@@ -95,7 +99,7 @@
/**
* 绱鎬荤偣浣嶆暟銆佸湪绾跨偣浣嶆暟銆侀噸鐐圭偣浣嶆暟銆侀噸鐐圭偣浣嶅湪绾挎暟
*/
- private void updateAreaStats(Map<String, AreaStats> areaStatsMap, String key, RecordMetaDSumParam result, List<String> important) {
+ private void updateAreaStats(Map<String, AreaStats> areaStatsMap, String key, RecordMetaDSumResult result, List<String> important) {
//杩斿洖瀵硅薄鐨勫紩鐢紝濡傛灉涓嶅瓨鍦ㄤ細鏀惧叆鏂扮殑key,value
AreaStats stats = areaStatsMap.computeIfAbsent(key, k -> new AreaStats());
stats.totalSites++;
@@ -114,7 +118,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;
@@ -127,8 +131,8 @@
checkIndexVideo.setVideoAvailable(videoUsability);
//璋冪敤褰曞儚鍙敤鐜囪绠楁柟娉� 璁$畻閲嶇偣鐐逛綅褰曞儚鍙敤鐜�
Map<String, Object> importantParam = new HashMap<>();
- param.put("totalSites", stats.importantSites);
- param.put("usabilitySites", stats.importantUsabilitySites);
+ importantParam.put("totalSites", stats.importantSites);
+ importantParam.put("usabilitySites", stats.importantUsabilitySites);
BigDecimal importantVideoUsability = videoUsability(importantParam);
checkIndexVideo.setKeyVideoAvailable(importantVideoUsability);
return checkIndexVideo;
--
Gitblit v1.8.0