From 1f11310ba04770a4efe4657d39872590575828f1 Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期四, 10 四月 2025 17:17:24 +0800
Subject: [PATCH] 设备未知状态,新增,导出页新增统计一个月的离线数,与在线率
---
ycl-server/src/main/java/com/ycl/platform/service/impl/TMonitorServiceImpl.java | 300 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 283 insertions(+), 17 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 c17d4ee..3127208 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
@@ -3,14 +3,11 @@
import annotation.DataScope;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.mongodb.ExplainVerbosity;
import com.mongodb.client.AggregateIterable;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import com.ycl.platform.domain.entity.TMonitor;
-import com.ycl.platform.domain.excel.TMonitorExp;
-import com.ycl.platform.domain.excel.VideoDailyExp;
-import com.ycl.platform.domain.excel.VideoTotalExp;
+import com.ycl.platform.domain.excel.*;
import com.ycl.platform.domain.form.VideoExportForm;
import com.ycl.platform.domain.query.DashboardQuery;
import com.ycl.platform.domain.query.DataCenterQuery;
@@ -37,7 +34,6 @@
import com.ycl.platform.service.ITMonitorService;
import com.ycl.system.Result;
import com.ycl.system.entity.SysDictData;
-import com.ycl.system.mapper.SysConfigMapper;
import com.ycl.system.mapper.SysDictDataMapper;
import com.ycl.system.page.PageUtil;
import com.ycl.system.service.ISysConfigService;
@@ -45,13 +41,12 @@
import com.ycl.utils.StringUtils;
import com.ycl.utils.poi.ExcelUtil;
import constant.ApiConstants;
-import constant.CheckConstants;
import enumeration.general.AreaDeptEnum;
import jakarta.servlet.http.HttpServletResponse;
-import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
+import org.apache.commons.lang3.Validate;
import org.bson.Document;
-import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
@@ -67,17 +62,14 @@
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.math.BigDecimal;
-import java.text.DecimalFormat;
+import java.math.RoundingMode;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.YearMonth;
-import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
-import java.time.temporal.TemporalAdjusters;
import java.util.*;
import java.util.concurrent.*;
-import java.util.function.BinaryOperator;
import java.util.function.Function;
import java.util.stream.Collectors;
@@ -88,6 +80,7 @@
* @date 2024-03-04
*/
@Service
+@Slf4j
public class TMonitorServiceImpl extends ServiceImpl<TMonitorMapper, TMonitor> implements ITMonitorService {
@Autowired
private TMonitorMapper tMonitorMapper;
@@ -372,16 +365,21 @@
*/
@Override
public Map<String, Object> home(HomeQuery monitorQuery) {
-
+ System.out.println(monitorQuery + "~~~~~~~~~~~~~鎵撳嵃");
Map<String, Object> dataMap = new HashMap<>();
Map<String, Object> monthMap1 = new HashMap<>();
Map<String, Object> monthMap2 = new HashMap<>();
List<Map<String, Object>> home = baseMapper.home(monitorQuery);
if (ObjectUtils.isNotEmpty(home)) {
+ //鎷垮埌鏁版嵁搴� 寰幆鏌ヨ
+ System.out.println(home + "~~~~~~~~~~~~~鎵撳嵃");
for (Map<String, Object> map : home) {
+ //寰楀埌map鐨� months閿殑鍊� num1閿殑鍊� 缁勮涓烘柊瀵硅薄
monthMap1.put(map.get("months").toString(), map.get("num1"));
+ //寰楀埌map鐨� months閿殑鍊� num2閿殑鍊� 缁勮涓烘柊瀵硅薄
monthMap2.put(map.get("months").toString(), map.get("num2"));
}
+ //home 鐨勪笅鏍�0鐨� map鐨� name閿殑鍊�
dataMap.put("name", home.get(0).get("name"));
dataMap.put("state", monthMap1);
dataMap.put("state2", monthMap2);
@@ -564,6 +562,8 @@
*/
@Override
public void exportVideoOnline(HttpServletResponse response, VideoExportForm exportForm) throws IOException, NoSuchFieldException, IllegalAccessException {
+ log.error("寮�濮嬪鍑烘暟鎹�");
+ log.error("浼犲叆鐨勬湀浠�:{}",exportForm.getMonth());
//榛樿鏌ユ墍鏈夐儴闂�
if (CollectionUtils.isEmpty(exportForm.getDeptIds())) {
List<Integer> deptIds = new ArrayList<>();
@@ -579,6 +579,7 @@
Query query = getQuery(exportForm);
//鏈堜唤姣忔棩鍦ㄧ嚎鏁版嵁
List<TMonitorResult> onlineResult = mongoTemplate.find(query, TMonitorResult.class);
+ log.error("鏈堜唤鍦ㄧ嚎鏁版嵁:{}鏉℃暟",onlineResult.size());
// 浣跨敤 Collectors.toMap 鍘婚噸锛屼繚鐣欐瘡涓� No 鐨勭涓�涓亣鍒扮殑鍏冪礌
Map<String, TMonitorResult> uniqueResultsMap = onlineResult.stream()
.collect(Collectors.toMap(
@@ -588,6 +589,7 @@
));
// 灏� Map 杞崲涓� List
List<TMonitorResult> tMonitorResults = new ArrayList<>(uniqueResultsMap.values());
+ log.error("鍘婚噸鍚庡ぇ灏�:{}",tMonitorResults.size());
//鑾峰彇鍔ㄦ�佸垪鏁版嵁
List<Integer> pointIds = tMonitorResults.stream().map(TMonitorResult::getPointId).collect(Collectors.toList());
List<DynamicColumnVO> dynamics = dynamicColumnMapper.getDynamicsByIds("t_yw_point", pointIds);
@@ -599,6 +601,8 @@
tMonitorResult.setDynamicColumnList(map.get(pointId));
}
}
+ //瀛樻斁鍖哄煙 涓� 璁惧鍒楄〃 map key涓� 鍖哄煙
+ Map<Integer, List<VideoDailyExp>> map = new HashMap<>();
List<CompletableFuture<List<VideoDailyExp>>> futures = new ArrayList<>();
for (Integer deptId : exportForm.getDeptIds()) {
CompletableFuture<List<VideoDailyExp>> future = CompletableFuture.supplyAsync(() -> {
@@ -622,6 +626,8 @@
VideoDailyExp videoDailyExp = new VideoDailyExp();
videoDailyExp.setSerialNumber(result.getNo());
videoDailyExp.setDeviceName(result.getName());
+ videoDailyExp.setType(result.getMonitorType());
+
videoDailyExp.setArea(areaDeptEnum == null ? "鏈煡" : areaDeptEnum.getName());
StringBuilder tag = new StringBuilder("" +
@@ -657,19 +663,267 @@
);
mysheet.add(excelExp);
+
return videoDailyExps;
}, threadPoolTaskExecutor);
futures.add(future);
+ map.put(deptId,future.join());
}
// 鑾峰彇鍏ㄩ噺鏁版嵁
List<VideoDailyExp> totalExps = futures.stream()
.map(CompletableFuture::join)
.flatMap(List::stream)
.collect(Collectors.toList());
+ log.error("鎵撳嵃鍏ㄩ噺鏁版嵁:{}",totalExps);
ExcelExp excelExp = new ExcelExp("鍏ㄩ噺", totalExps, VideoDailyExp.class);
mysheet.add(excelExp);
+ //娣诲姞鏂扮殑sheet 绂荤嚎鏁扮粺璁¤〃
+ List<VideoTypeOffOnlineExp> videoTypeOffOnlineExps = new ArrayList<>();
+ //鎻掑叆excel鏃剁‘淇濇暟鎹嚭鐜板湪鏈�鍚�
+ List<VideoTypeOffOnlineExp> allVideoTypeOffOnlineExps = new ArrayList<>();
+
+ //鍦ㄧ嚎鐜囩粺璁¤〃
+ List<VideoOnlineRateExp> videoOnlineRateExps = new ArrayList<>();
+ //鎻掑叆excel鏃剁‘淇濇暟鎹嚭鐜板湪鏈�鍚�
+ List<VideoOnlineRateExp> allVideoOnlineRateExps = new ArrayList<>();
+
+ for (Integer deptId : map.keySet()){
+ List<VideoDailyExp> list = map.get(deptId);
+ AreaDeptEnum areaDeptEnum = AreaDeptEnum.fromDept(deptId);
+ // 娣诲姞绂荤嚎琛ㄨ褰�
+ //璁惧绫诲瀷 1浜鸿劯 2杞﹁締 3瑙嗛
+ //浜鸿劯
+ log.error("浼犲叆閮ㄩ棬闆嗗悎澶у皬:{} + 閮ㄩ棬id:{}" ,list.size(),deptId);
+ VideoTypeOffOnlineExp faceVideoTypeOffOnlineExp = this.getListOfflineCountInfo(list,"1",areaDeptEnum,false);
+ //鍗″彛
+ VideoTypeOffOnlineExp carVideoTypeOffOnlineExp =this.getListOfflineCountInfo(list,"2",areaDeptEnum,false);
+ //瑙嗛
+ VideoTypeOffOnlineExp videoTypeOffOnlineExp = this.getListOfflineCountInfo(list,"3",areaDeptEnum,false);
+
+ VideoOnlineRateExp faceVideoOnlineRateExp = this.getListOnLineCountInfo(list,"1",areaDeptEnum,false);
+ //鍗″彛
+ VideoOnlineRateExp carVideoOnlineRateExp =this.getListOnLineCountInfo(list,"2",areaDeptEnum,false);
+ //瑙嗛
+ VideoOnlineRateExp VideoOnlineRateExp = this.getListOnLineCountInfo(list,"3",areaDeptEnum,false);
+
+
+ //灏嗚鍖哄煙绫讳笁绉嶈澶囩被鍨嬬殑 淇℃伅 鏀惧叆 excel瀵硅薄鍐�
+ //鏀惧叆褰撳墠鍖哄煙鐨勪汉鑴歌澶囩浉鍏宠缁�
+ videoTypeOffOnlineExps.add(faceVideoTypeOffOnlineExp);
+ //鏀惧叆褰撳墠鍖哄煙鐨勮溅杈嗚澶囩浉鍏宠缁�
+ videoTypeOffOnlineExps.add(carVideoTypeOffOnlineExp);
+ //鏀惧叆褰撳墠鍖哄煙鐨勮棰戣澶囩浉鍏宠缁�
+ videoTypeOffOnlineExps.add(videoTypeOffOnlineExp);
+
+ videoOnlineRateExps.add(faceVideoOnlineRateExp);
+ videoOnlineRateExps.add(carVideoOnlineRateExp);
+ videoOnlineRateExps.add(VideoOnlineRateExp);
+
+
+ VideoTypeOffOnlineExp ALLfaceVideoTypeOffOnlineExp = this.getListOfflineCountInfo(list,"1",areaDeptEnum,true);
+ //鍗″彛
+ VideoTypeOffOnlineExp ALLcarVideoTypeOffOnlineExp =this.getListOfflineCountInfo(list,"2",areaDeptEnum,true);
+ //瑙嗛
+ VideoTypeOffOnlineExp ALLvideoTypeOffOnlineExp = this.getListOfflineCountInfo(list,"3",areaDeptEnum,true);
+
+ VideoOnlineRateExp ALLfaceVideoOnlineRateExp = this.getListOnLineCountInfo(list,"1",areaDeptEnum,true);
+ //鍗″彛
+ VideoOnlineRateExp ALLcarVideoOnlineRateExp =this.getListOnLineCountInfo(list,"2",areaDeptEnum,true);
+ //瑙嗛
+ VideoOnlineRateExp ALLVideoOnlineRateExp = this.getListOnLineCountInfo(list,"3",areaDeptEnum,true);
+
+ //娣诲姞鍚堣鏁版嵁
+ allVideoTypeOffOnlineExps.add(ALLfaceVideoTypeOffOnlineExp);
+ //鏀惧叆褰撳墠鍖哄煙鐨勮溅杈嗚澶囩浉鍏宠缁�
+ allVideoTypeOffOnlineExps.add(ALLcarVideoTypeOffOnlineExp);
+ //鏀惧叆褰撳墠鍖哄煙鐨勮棰戣澶囩浉鍏宠缁�
+ allVideoTypeOffOnlineExps.add(ALLvideoTypeOffOnlineExp);
+
+ allVideoOnlineRateExps.add(ALLfaceVideoOnlineRateExp);
+ allVideoOnlineRateExps.add(ALLcarVideoOnlineRateExp);
+ allVideoOnlineRateExps.add(ALLVideoOnlineRateExp);
+
+ }
+ videoTypeOffOnlineExps.addAll(allVideoTypeOffOnlineExps);
+ videoOnlineRateExps.addAll(allVideoOnlineRateExps);
+ log.error("鎵撳嵃璁$畻绂荤嚎鐨勪俊鎭�:{}" ,videoTypeOffOnlineExps );
+ log.error("鎵撳嵃璁″湪绾跨殑淇℃伅:{}" ,videoOnlineRateExps );
+ //娣诲姞鍚堣鏁版嵁
+
+ ExcelExp excelTypeOffLineExp = new ExcelExp("绂荤嚎鏁扮粺璁�", videoTypeOffOnlineExps, VideoTypeOffOnlineExp.class);
+ mysheet.add(excelTypeOffLineExp);
+
+ //娣诲姞鍦ㄧ嚎鐜囪〃
+ ExcelExp excelOnlineRateExp = new ExcelExp("鍦ㄧ嚎鐜囩粺璁�",videoOnlineRateExps, VideoOnlineRateExp.class);
+ mysheet.add(excelOnlineRateExp);
+
ExcelUtilManySheet<List<ExcelExp>> util = new ExcelUtilManySheet<>(mysheet);
util.exportExcelManySheet(response, mysheet);
+ log.error("瀵煎嚭缁撴潫");
+ }
+
+ /**
+ * 璁$畻绂荤嚎璁惧excel瀵硅薄淇℃伅
+ * @param videoDailyExps 浼犲叆鐨勮澶囬泦鍚堜俊鎭�
+ * @param type 璁惧绫诲瀷 1浜鸿劯 2杞﹁締 3瑙嗛
+ * @param areaDeptEnum 鍖哄煙
+ * @return
+ */
+ public VideoTypeOffOnlineExp getListOfflineCountInfo(List<VideoDailyExp> videoDailyExps,
+ String type,
+ AreaDeptEnum areaDeptEnum,
+ boolean isTotal){
+ VideoTypeOffOnlineExp videoTypeOffOnlineExp = new VideoTypeOffOnlineExp();
+
+ List<VideoDailyExp> list = videoDailyExps.stream()
+ .filter(device ->device.getType() != null && device.getType().contains(type)).collect(Collectors.toList());
+ log.error("绛涢�夊畬璁惧绫诲瀷 锛歿} 鍚庨泦鍚堢殑澶у皬锛歿}",type,list.size());
+ //绂荤嚎鏁伴噺
+ try {
+ //璁剧疆绂荤嚎鏁伴噺 浠ュ強姣忔棩绂荤嚎鏁伴噺
+ setVideoTypeOffOnlineExpCountAndDays(list,videoTypeOffOnlineExp,isTotal);
+ } catch (Exception e) {
+ log.error(e.getMessage());
+ }
+ //璁惧绫诲瀷
+ if(isTotal){
+ if ("1".equals(type)){
+ videoTypeOffOnlineExp.setType("浜鸿劯鍚堣");
+ }else if ("2".equals(type)){
+ videoTypeOffOnlineExp.setType("鍗″彛鍚堣");
+ }else if ("3".equals(type)){
+ videoTypeOffOnlineExp.setType("瑙嗛鍚堣");
+ }
+ }else {
+ if ("1".equals(type)){
+ videoTypeOffOnlineExp.setType("浜鸿劯");
+ }else if ("2".equals(type)){
+ videoTypeOffOnlineExp.setType("鍗″彛");
+ }else if ("3".equals(type)){
+ videoTypeOffOnlineExp.setType("瑙嗛");
+ }
+ }
+ //淇敼鍖哄煙
+ videoTypeOffOnlineExp.setArea(areaDeptEnum == null ? "鏈煡" : areaDeptEnum.getName());
+ return videoTypeOffOnlineExp;
+ }
+
+ private void setVideoTypeOffOnlineExpCountAndDays(List<VideoDailyExp> videoDailyExps,VideoTypeOffOnlineExp videoTypeOffOnlineExp,boolean isTotal)throws NoSuchFieldException, IllegalAccessException {
+ //寰幆涓�涓湀
+ //绂荤嚎鎬绘暟
+ long AllOffLineCount = 0;
+ log.error("浼犲叆闆嗗悎澶у皬:{}", videoDailyExps.size());
+ for (VideoDailyExp videoDailyExp : videoDailyExps) {
+ if (videoDailyExp.isAllOfflineByMonth()) {
+ AllOffLineCount++;
+ }
+ }
+ //鏄悎璁℃暟鎹笉闇�瑕佷笅鏂规暟鎹�
+// if (!isTotal) {
+ for (int i = 1; i <= 31; i++) {
+ //姣忔棩绂荤嚎鏁�
+ long count = 0;
+ String fieldName = "day" + i;
+ for (VideoDailyExp videoDailyExp : videoDailyExps) {
+ // 鏋勯�犲瓧娈靛悕
+ Field field = videoDailyExp.getClass().getDeclaredField(fieldName);
+ // 纭繚瀛楁鏄鏈夌殑鍙互璁块棶
+ field.setAccessible(true);
+ // 鑾峰彇瀛楁鍊�
+ String value = (String) field.get(videoDailyExp);
+ if ("绂荤嚎".equals(value)) {
+ count++;
+ }
+ }
+ //鍙嶅皠娣诲姞鍒板璞″睘鎬т腑
+ Field field = videoTypeOffOnlineExp.getClass().getDeclaredField(fieldName);
+ field.setAccessible(true);
+ String rateStr = count + "";
+ if (!"0".equals(rateStr)) {
+ field.set(videoTypeOffOnlineExp, rateStr);
+ }
+
+ }
+// }
+ videoTypeOffOnlineExp.setOfflineCount(String.valueOf(AllOffLineCount));
+ }
+
+ /**
+ * 璁$畻鍦ㄧ嚎璁惧excel瀵硅薄淇℃伅
+ * @param videoDailyExps 浼犲叆鐨勮澶囬泦鍚堜俊鎭�
+ * @param type 璁惧绫诲瀷 1浜鸿劯 2杞﹁締 3瑙嗛
+ * @param areaDeptEnum 鍖哄煙
+ * @return
+ */
+ public VideoOnlineRateExp getListOnLineCountInfo(List<VideoDailyExp> videoDailyExps,
+ String type,
+ AreaDeptEnum areaDeptEnum,
+ boolean isTotal){
+ VideoOnlineRateExp videoOnlineRateExp = new VideoOnlineRateExp();
+
+ List<VideoDailyExp> list = videoDailyExps.stream()
+ .filter(device ->device.getType() != null && device.getType().contains(type)).collect(Collectors.toList());
+ log.error("绛涢�夊畬璁惧绫诲瀷 锛歿} 鍚庨泦鍚堢殑澶у皬锛歿}",type,list.size());
+ //绂荤嚎鏁伴噺
+ try {
+ //璁剧疆绂荤嚎鏁伴噺 浠ュ強姣忔棩绂荤嚎鏁伴噺
+ setVideoOnlineRateExpCountAndDays(list,videoOnlineRateExp,isTotal);
+ } catch (Exception e) {
+ log.error(e.getMessage());
+ }
+ //璁惧绫诲瀷
+ if(isTotal) {
+ if ("1".equals(type)) {
+ videoOnlineRateExp.setType("浜鸿劯鍚堣");
+ } else if ("2".equals(type)) {
+ videoOnlineRateExp.setType("鍗″彛鍚堣");
+ } else if ("3".equals(type)) {
+ videoOnlineRateExp.setType("瑙嗛鍚堣");
+ }
+ }else {
+ if ("1".equals(type)) {
+ videoOnlineRateExp.setType("浜鸿劯");
+ } else if ("2".equals(type)) {
+ videoOnlineRateExp.setType("鍗″彛");
+ } else if ("3".equals(type)) {
+ videoOnlineRateExp.setType("瑙嗛");
+ }
+ }
+ //淇敼鍖哄煙
+ videoOnlineRateExp.setArea(areaDeptEnum == null ? "鏈煡" : areaDeptEnum.getName());
+ return videoOnlineRateExp;
+ }
+
+
+ private void setVideoOnlineRateExpCountAndDays(List<VideoDailyExp> videoDailyExps,VideoOnlineRateExp videoOnlineRateExp,boolean isTotal)throws NoSuchFieldException, IllegalAccessException {
+
+ //寰幆涓�涓湀
+ for (int i = 1;i <= 31 ;i++){
+ //鍦ㄧ嚎鐜囪绠�
+ long count = 0;
+ String fieldName = "day" + i;
+ for(VideoDailyExp videoDailyExp: videoDailyExps){
+ // 鏋勯�犲瓧娈靛悕
+ Field field = videoDailyExp.getClass().getDeclaredField(fieldName);
+ // 纭繚瀛楁鏄鏈夌殑鍙互璁块棶
+ field.setAccessible(true);
+ // 鑾峰彇瀛楁鍊�
+ String value = (String) field.get(videoDailyExp);
+ if ("鍦ㄧ嚎".equals(value)) {
+ count ++;
+ }
+ }
+ //姣忔棩鍦ㄧ嚎鐜�
+ double rate = (double) count / videoDailyExps.size();
+ //鍙嶅皠娣诲姞鍒板璞″睘鎬т腑
+ Field field = videoOnlineRateExp.getClass().getDeclaredField(fieldName);
+ field.setAccessible(true);
+ String rateStr = String.format("%.2f", rate * 100) +"%";
+ if (!"0.00%".equals(rateStr)){
+ field.set(videoOnlineRateExp, rateStr);
+ }
+
+ }
}
@@ -820,6 +1074,7 @@
Function.identity(), // valueMapper锛岀洿鎺ヤ娇鐢ㄥ璞℃湰韬�
(existing, replacement) -> existing // mergeFunction锛屽鏋滄湁閲嶅锛屼繚鐣欑涓�涓�
));
+
// 灏� Map 杞崲涓� List
List<TMonitorResult> tMonitorResults = new ArrayList<>(uniqueResultsMap.values());
//鑾峰彇鍔ㄦ�佸垪鏁版嵁
@@ -965,7 +1220,14 @@
))
.append("loseCount", new Document("$sum",
new Document("$cond", Arrays.asList(
- new Document("$in", Arrays.asList("$recordStatus", Arrays.asList(-1, 0))),
+ new Document("$eq", Arrays.asList("$recordStatus", 0)),
+ 1,
+ 0
+ ))
+ ))
+ .append("errCount", new Document("$sum",
+ new Document("$cond", Arrays.asList(
+ new Document("$eq", Arrays.asList("$recordStatus", -1)),
1,
0
))
@@ -979,6 +1241,7 @@
homeVideoVO.setCreateDate(doc.getDate("_id"));
homeVideoVO.setIntegrityNum(doc.getInteger("normalCount"));
homeVideoVO.setLoseNum(doc.getInteger("loseCount"));
+ homeVideoVO.setErrNum(doc.getInteger("errCount"));
results.add(homeVideoVO);
}
@@ -1373,6 +1636,7 @@
private void setOnlineDaily(VideoDailyExp videoDailyExp, TMonitorResult result, List<TMonitorResult> onlines) throws NoSuchFieldException, IllegalAccessException {
//涓�涓澶囧綋鏈堝湪绾挎儏鍐�
List<TMonitorResult> onlineResult = onlines.stream().filter(online -> online.getNo().equals(result.getNo())).collect(Collectors.toList());
+ videoDailyExp.setOnlineStateList(onlineResult);
for (TMonitorResult monitorResult : onlineResult) {
int dayOfMonth = monitorResult.getMongoCreateTime().getDayOfMonth();
String online = "";
@@ -1388,6 +1652,8 @@
field.setAccessible(true);
field.set(videoDailyExp, online);
}
+
+
}
//璁剧疆姣忔棩褰曞儚鏁版嵁
@@ -1414,13 +1680,13 @@
private void setLoseDaily(VideoDailyExp videoDailyExp, List<RecordMetaDSumResult> recordResults) throws NoSuchFieldException, IllegalAccessException {
//涓�涓澶囧綋鏈堝湪绾挎儏鍐�
for (RecordMetaDSumResult recordResult : recordResults) {
- int dayOfMonth = DateUtils.getDayOfMonth(recordResult.getStatTime());
+ int dayOfMonth = DateUtils.getDayOfMonth(recordResult.getStatTime()); //鑾峰彇鍚姩鏃ユ湡鏄綋鏈堢鍑犲ぉ
//鍙嶅皠璧嬪�硷紝瀛楁缁熶竴瀹氫箟涓篸ay+1锛�2锛�3...
Field field = videoDailyExp.getClass().getDeclaredField("day" + dayOfMonth);
field.setAccessible(true);
//闃叉杞崲涓虹瀛﹁鏁版硶
- BigDecimal bigDecimal = BigDecimal.valueOf(recordResult.getMissDuration() == null ? 0 : recordResult.getMissDuration());
- field.set(videoDailyExp, bigDecimal.toString());
+ BigDecimal bigDecimal = BigDecimal.valueOf(recordResult.getMissDuration() == null ? 0 : (recordResult.getMissDuration()) * 60);
+ field.set(videoDailyExp, bigDecimal.setScale(2, RoundingMode.HALF_UP).toString());
}
}
}
--
Gitblit v1.8.0