ycl-common/src/main/java/constant/ApiConstants.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
ycl-common/src/main/java/constant/CheckThreadConstants.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
ycl-server/src/main/java/com/ycl/calculate/CarSnapshopDataCalculation.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
ycl-server/src/main/java/com/ycl/calculate/FaceSnapshotDataCalculation.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
ycl-server/src/main/java/com/ycl/calculate/MonitorRegistrationCalculation.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
ycl-server/src/main/java/com/ycl/calculate/VideoOnlineCalculation.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
ycl-common/src/main/java/constant/ApiConstants.java
@@ -72,11 +72,5 @@ /** 考核指标 条件参数 */ //车辆考核,点位在线率,区县不少于40路 public final static Integer Check_Car_SiteOnline = 40; public final static Integer Check_Face_SiteOnline = 40; //车辆在线率 Redis 每月数据中断次数 Hash key public final static String Check_Car_ViewConnect = "CarViewConnectNoData"; public final static String Check_Face_ViewConnect = "FaceViewConnectNoData"; } ycl-common/src/main/java/constant/CheckThreadConstants.java
New file @@ -0,0 +1,19 @@ package constant; /** * 考核指标计算阈值 */ public class CheckThreadConstants { //视频档案考核比不低于90% public final static String Check_Video_Archive ="0.9"; //视频点位在线率,区县不少于100路 public final static Integer Check_Video_SiteOnline =100; public final static Integer Check_Video_ImportantSite =10; //车辆、人脸考核,点位在线率,区县不少于40路 public final static Integer Check_Car_SiteOnline = 40; public final static Integer Check_Face_SiteOnline = 40; //车辆、人脸在线率 Redis 每月数据中断次数 Hash key public final static String Check_Car_ViewConnect = "CarViewConnectNoData"; public final static String Check_Face_ViewConnect = "FaceViewConnectNoData"; } ycl-server/src/main/java/com/ycl/calculate/CarSnapshopDataCalculation.java
@@ -10,6 +10,7 @@ import com.ycl.utils.DateUtils; import constant.ApiConstants; import constant.CheckSnapCountConstants; import constant.CheckThreadConstants; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; @@ -73,7 +74,7 @@ // 判断今天是否是本月的第一天 if (today.equals(firstDayOfMonth)) { // 如果是,则清除Redis中记录中断次数的数据 redisTemplate.delete(ApiConstants.Check_Car_ViewConnect); redisTemplate.delete(CheckThreadConstants.Check_Car_ViewConnect); } for (SnapshotDataMonitorResult result : list) { TMonitorVO monitor = monitorMap.get(result.getExternalIndexCode()); @@ -144,7 +145,7 @@ } //调用点位在线计算方法 if (stats.totalSites >= ApiConstants.Check_Car_SiteOnline) { if (stats.totalSites >= CheckThreadConstants.Check_Car_SiteOnline) { Map<String, Object> siteOnlineParam = new HashMap<>(); siteOnlineParam.put("totalSites", stats.totalSites); siteOnlineParam.put("onlineSites", stats.onlineSites); @@ -155,7 +156,7 @@ } //视图库对接稳定性 //Redis记录该区县当月无数据上传次数 Integer noDateCount = (Integer) redisTemplate.opsForHash().get(ApiConstants.Check_Car_ViewConnect, key); Integer noDateCount = (Integer) redisTemplate.opsForHash().get(CheckThreadConstants.Check_Car_ViewConnect, key); // 如果值为null,则初始化为0 if (noDateCount == null) { noDateCount = 0; @@ -173,7 +174,7 @@ noDateCount++; } // 将新的值放回Hash中 redisTemplate.opsForHash().put(ApiConstants.Check_Car_ViewConnect, key, noDateCount); redisTemplate.opsForHash().put(CheckThreadConstants.Check_Car_ViewConnect, key, noDateCount); return checkIndexCar; } } ycl-server/src/main/java/com/ycl/calculate/FaceSnapshotDataCalculation.java
@@ -14,6 +14,7 @@ import constant.ApiConstants; import constant.CheckConstants; import constant.CheckSnapCountConstants; import constant.CheckThreadConstants; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; @@ -78,7 +79,7 @@ // 判断今天是否是本月的第一天 if (today.equals(firstDayOfMonth)) { // 如果是,则清除Redis中记录中断次数的数据 redisTemplate.delete(ApiConstants.Check_Face_ViewConnect); redisTemplate.delete(CheckThreadConstants.Check_Face_ViewConnect); } for (SnapshotDataMonitorResult result : list) { TMonitorVO monitor = monitorMap.get(result.getExternalIndexCode()); @@ -141,7 +142,7 @@ return null; } //调用点位在线计算方法 if (stats.totalSites >= ApiConstants.Check_Face_SiteOnline) { if (stats.totalSites >= CheckThreadConstants.Check_Face_SiteOnline) { Map<String, Object> siteOnlineParam = new HashMap<>(); siteOnlineParam.put("totalSites", stats.totalSites); siteOnlineParam.put("onlineSites", stats.onlineSites); @@ -152,7 +153,7 @@ } //视图库对接稳定性 //Redis记录该区县当月无数据上传次数 Integer noDateCount = (Integer) redisTemplate.opsForHash().get(ApiConstants.Check_Face_ViewConnect, key); Integer noDateCount = (Integer) redisTemplate.opsForHash().get(CheckThreadConstants.Check_Face_ViewConnect, key); // 如果值为null,则初始化为0 if (noDateCount == null) { noDateCount = 0; @@ -170,7 +171,7 @@ noDateCount++; } // 将新的值放回Hash中 redisTemplate.opsForHash().put(ApiConstants.Check_Face_ViewConnect, key, noDateCount); redisTemplate.opsForHash().put(CheckThreadConstants.Check_Face_ViewConnect, key, noDateCount); return checkIndexFace; } } ycl-server/src/main/java/com/ycl/calculate/MonitorRegistrationCalculation.java
@@ -10,6 +10,7 @@ import com.ycl.platform.mapper.TMonitorMapper; import com.ycl.platform.service.ICheckIndexVideoService; import constant.ApiConstants; import constant.CheckThreadConstants; import constant.RedisConstant; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -59,18 +60,18 @@ } //获得国标码为key的设备map Map<String, TMonitorVO> monitorMap = new HashMap<>(); if(!CollectionUtils.isEmpty(list)){ if (!CollectionUtils.isEmpty(list)) { monitorMap = list.stream().collect(Collectors.toMap(TMonitorVO::getSerialNumber, Function.identity())); } //获取省厅国标码集合 List<String> provinceIds = getProvince(); //未注册设备 Map<String,TMonitor> newMonitorMap = new HashMap<>(); Map<String, TMonitor> newMonitorMap = new HashMap<>(); //Mongo一机一档同步Mysql时放入Redis String json = (String) redisTemplate.opsForValue().get(RedisConstant.New_Monitor_Set); if (!StringUtils.isEmpty(json)) { List<TMonitor> newMonitors = JSONArray.parseArray(json, TMonitor.class); if(!CollectionUtils.isEmpty(newMonitors)){ if (!CollectionUtils.isEmpty(newMonitors)) { newMonitorMap = newMonitors.stream().collect(Collectors.toMap(TMonitor::getSerialNumber, Function.identity())); } } @@ -83,11 +84,11 @@ if (monitor == null) continue; String deptId = monitor.getDeptId().toString(); updateAreaStats(areaStatsMap, deptId, result,newMonitorMap,todayMonitor); updateAreaStats(areaStatsMap, deptId, result, newMonitorMap, todayMonitor); // 处理省厅数据 if (!CollectionUtils.isEmpty(provinceIds) && provinceIds.contains(monitor.getSerialNumber())) { String provinceKey = ApiConstants.Province + deptId; updateAreaStats(areaStatsMap, provinceKey, result,newMonitorMap,todayMonitor); updateAreaStats(areaStatsMap, provinceKey, result, newMonitorMap, todayMonitor); } } @@ -109,15 +110,15 @@ /** * 累计总点位数、在线点位数、重点点位数、重点点位在线数、指挥图像数、指挥图像在线数 */ private void updateAreaStats(Map<String, AreaStats> areaStatsMap, String key, TMonitorVO result,Map<String,TMonitor> newMonitors,List<String> todayMonitor) { private void updateAreaStats(Map<String, AreaStats> areaStatsMap, String key, TMonitorVO result, Map<String, TMonitor> newMonitors, List<String> todayMonitor) { //返回对象的引用,如果不存在会放入新的key,value AreaStats stats = areaStatsMap.computeIfAbsent(key, k -> new AreaStats()); stats.totalSites++; stats.allFiles++; if(newMonitors.containsKey(result.getSerialNumber())){ if (newMonitors.containsKey(result.getSerialNumber())) { stats.newSites++; } if(todayMonitor.contains(result.getSerialNumber())){ if (todayMonitor.contains(result.getSerialNumber())) { stats.todayFiles++; } } @@ -141,7 +142,12 @@ archiveParam.put("allFiles", stats.allFiles); archiveParam.put("todayFiles", stats.todayFiles); BigDecimal archivesRate = archivesRate(archiveParam); checkIndexVideo.setArchivesRate(archivesRate); //如果档案考核比低于0.9不得分 if (new BigDecimal(CheckThreadConstants.Check_Video_Archive).compareTo(archivesRate) <= 0) { checkIndexVideo.setArchivesRate(archivesRate); } else { checkIndexVideo.setArchivesRate(BigDecimal.ZERO); } return checkIndexVideo; } ycl-server/src/main/java/com/ycl/calculate/VideoOnlineCalculation.java
@@ -13,6 +13,7 @@ import com.ycl.platform.service.ICheckIndexVideoService; import com.ycl.platform.service.ITMonitorService; import constant.ApiConstants; import constant.CheckThreadConstants; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -141,6 +142,10 @@ param.put("onlineSites", stats.onlineSites); BigDecimal siteOnline = siteOnline(param); checkIndexVideo.setSiteOnline(siteOnline); //区县不少于100路 if(stats.totalSites < CheckThreadConstants.Check_Video_SiteOnline){ checkIndexVideo.setSiteOnline(BigDecimal.ZERO); } //调用点位在线率计算方法 计算重点点位在线率 if(stats.importantSites!=0) { Map<String, Object> importantParam = new HashMap<>(); @@ -151,6 +156,12 @@ }else { log.info("重点点位数为0"); } //区县视频重点点位数不少于10路 if(stats.importantSites<CheckThreadConstants.Check_Video_ImportantSite){ checkIndexVideo.setKeySiteOnline(BigDecimal.ZERO); } //调用点位在线率计算方法 计算指挥图像在线率 if(stats.commandSites!=0) { Map<String, Object> commandParam = new HashMap<>();