From 23fc1a4a8de125d8bee6fc602e767a5310b89f3e Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期一, 07 四月 2025 17:34:08 +0800
Subject: [PATCH] 新设备品牌名,通道问题,
---
ycl-server/src/main/java/com/ycl/platform/service/impl/TMonitorServiceImpl.java | 22 ++++++++++++++++++----
1 files changed, 18 insertions(+), 4 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 3cc7abe..3865624 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
@@ -67,6 +67,7 @@
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.math.BigDecimal;
+import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@@ -372,16 +373,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);
@@ -965,6 +971,13 @@
))
.append("loseCount", new Document("$sum",
new Document("$cond", Arrays.asList(
+ 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 +992,7 @@
homeVideoVO.setCreateDate(doc.getDate("_id"));
homeVideoVO.setIntegrityNum(doc.getInteger("normalCount"));
homeVideoVO.setLoseNum(doc.getInteger("loseCount"));
+ homeVideoVO.setErrNum(doc.getInteger("errCount"));
results.add(homeVideoVO);
}
@@ -1414,13 +1428,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