From d6f915ecc8ee7efd5fcd3a205b57ef490b918fa5 Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期三, 21 八月 2024 14:27:59 +0800
Subject: [PATCH] feat:数据中心数字增加中文字段
---
ycl-server/src/main/java/com/ycl/calculate/VideoUsabilityCalculation.java | 37 +++++++++++++++++++++----------------
1 files changed, 21 insertions(+), 16 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..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,10 +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;
@@ -30,11 +34,12 @@
* 鏇存柊鎴栨柊澧�
*/
@Component
-public class VideoUsabilityCalculation extends IndexCalculationServe implements CalculationStrategy<RecordMetaDSumParam> {
+@Slf4j
+public class VideoUsabilityCalculation extends IndexCalculationServe implements CalculationStrategy<RecordMetaDSumResult> {
@Autowired
private CheckIndexVideoMapper checkIndexVideoMapper;
@Autowired
- private ITMonitorService monitorService;
+ private TMonitorMapper monitorMapper;
@Autowired
private ICheckIndexVideoService checkIndexVideoService;
@@ -47,23 +52,23 @@
}
@Override
- public void calculate(List<RecordMetaDSumParam> list) {
+ public void calculate(List<RecordMetaDSumResult> list) {
if (CollectionUtils.isEmpty(list)) {
+ log.info("鏁版嵁涓虹┖");
return;
}
//鑾峰緱鍥芥爣鐮佷负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(RecordMetaDSumResult::getDeviceId).collect(Collectors.toList()))
+ .stream().collect(Collectors.toMap(TMonitorVO::getSerialNumber, Function.identity()));
//鑾峰彇鐪佸巺鍥芥爣鐮侀泦鍚�
List<String> provinceIds = getProvince();
//閲嶇偣鐐逛綅闆嗗悎
List<String> important = getImportant();
Map<String, AreaStats> areaStatsMap = new HashMap<>();
- for (RecordMetaDSumParam result : list) {
- TMonitor monitor = monitorMap.get(result.getDeviceId());
+ for (RecordMetaDSumResult result : list) {
+ TMonitorVO monitor = monitorMap.get(result.getDeviceId());
if (monitor == null) continue;
String deptId = monitor.getDeptId().toString();
@@ -71,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);
}
}
@@ -81,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);
}
}
});
@@ -94,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++;
@@ -113,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;
@@ -126,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