From 71e6dc7824780c223e594add97c09773335e8af1 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期三, 31 七月 2024 18:20:27 +0800
Subject: [PATCH] 车辆、人脸 点位在线率、视图库对接稳定性 任务

---
 ycl-server/src/main/java/com/ycl/calculate/CarSiteOnlineCalculation.java |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/ycl-server/src/main/java/com/ycl/calculate/CarSiteOnlineCalculation.java b/ycl-server/src/main/java/com/ycl/calculate/CarSiteOnlineCalculation.java
index 9cf047a..fa6cffc 100644
--- a/ycl-server/src/main/java/com/ycl/calculate/CarSiteOnlineCalculation.java
+++ b/ycl-server/src/main/java/com/ycl/calculate/CarSiteOnlineCalculation.java
@@ -18,6 +18,7 @@
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
+import java.time.LocalDate;
 import java.util.*;
 import java.util.function.Function;
 import java.util.stream.Collectors;
@@ -77,7 +78,7 @@
         BigDecimal cityCountAvg = getAverageCount(CheckSnapCountConstants.City);
         BigDecimal countyCountAvg = getAverageCount(CheckSnapCountConstants.County);
 
-        // 鏌ヨ浠婃棩鏁版嵁
+        // 鏌ヨ鏄惁index琛ㄥ凡缁忓瓨鍦ㄤ粖鏃ユ暟鎹�
         List<CheckIndexCar> checkIndexCarList = checkIndexCarMapper.selectToday(DateUtils.getDate());
         List<CheckIndexCar> checkIndexCars = new ArrayList<>();
         areaStatsMap.forEach((deptId, stats) -> {
@@ -90,7 +91,7 @@
         checkIndexCarService.saveOrUpdateBatch(checkIndexCars);
     }
 
-    //绱鎬荤偣浣嶆暟銆佺绾挎暟銆佹�绘姄鎷嶉噺
+    /** 绱鎬荤偣浣嶆暟銆佺绾挎暟銆佹�绘姄鎷嶉噺 */
     private void updateAreaStats(Map<String, AreaStats> areaStatsMap, String key, SnapshotDataMonitorResult result) {
         //杩斿洖瀵硅薄鐨勫紩鐢紝濡傛灉涓嶅瓨鍦ㄤ細鏀惧叆鏂扮殑key,value
         AreaStats stats = areaStatsMap.computeIfAbsent(key, k -> new AreaStats());
@@ -102,14 +103,16 @@
         }
     }
 
-    //鑾峰彇2022鍚屾湡鎶撴媿骞冲潎鍊�
+    /** 鑾峰彇2022鍚屾湡鎶撴媿骞冲潎鍊� */
     private BigDecimal getAverageCount(String configKey) {
         String count = sysConfigMapper.checkConfigKeyUnique(configKey).getConfigValue();
-        return new BigDecimal(count).multiply(new BigDecimal(CheckSnapCountConstants.Multiply))
-                .divide(new BigDecimal(CheckSnapCountConstants.CountyNum), 0, RoundingMode.HALF_UP);
+        return new BigDecimal(count)
+                .multiply(new BigDecimal(CheckSnapCountConstants.Multiply))
+                .divide(new BigDecimal(CheckSnapCountConstants.CountyNum), 10, RoundingMode.HALF_UP)
+                .divide(new BigDecimal(LocalDate.now().getDayOfMonth()), 0, RoundingMode.HALF_UP);
     }
 
-    //杞﹁締鐐逛綅鍦ㄧ嚎鐜囧拰瑙嗗浘搴撳鎺ョǔ瀹氭��
+    /** 杞﹁締鐐逛綅鍦ㄧ嚎鐜囧拰瑙嗗浘搴撳鎺ョǔ瀹氭�� */
     private CheckIndexCar createOrUpdateCheckIndexCar(String key, AreaStats stats, BigDecimal cityCountAvg, BigDecimal countyCountAvg, List<CheckIndexCar> checkIndexCarList) {
         CheckIndexCar checkIndexCar;
 

--
Gitblit v1.8.0