From 9de954bafc2cfe186eaefc0e99fa5fc292a8d45b Mon Sep 17 00:00:00 2001 From: fuliqi <fuliqi@qq.com> Date: 星期一, 09 九月 2024 18:13:04 +0800 Subject: [PATCH] 一机一档注册率档案考核比优化 --- ycl-common/src/main/java/constant/ApiConstants.java | 4 +++- ycl-server/src/main/java/com/ycl/calculate/MonitorRegistrationCalculation.java | 30 +++++++++++++++++++++--------- ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml | 2 +- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/ycl-common/src/main/java/constant/ApiConstants.java b/ycl-common/src/main/java/constant/ApiConstants.java index 7ecdf3f..9164012 100644 --- a/ycl-common/src/main/java/constant/ApiConstants.java +++ b/ycl-common/src/main/java/constant/ApiConstants.java @@ -75,5 +75,7 @@ //娴峰悍璁块棶鏃堕棿璺緞 public final static String HK_OSD_TIME = "/ISAPI/System/time"; - + //鏍囩甯搁噺 + public final static Integer TRUE = 1; + public final static Integer FALSE = 0; } diff --git a/ycl-server/src/main/java/com/ycl/calculate/MonitorRegistrationCalculation.java b/ycl-server/src/main/java/com/ycl/calculate/MonitorRegistrationCalculation.java index 77353f2..cf0a2d3 100644 --- a/ycl-server/src/main/java/com/ycl/calculate/MonitorRegistrationCalculation.java +++ b/ycl-server/src/main/java/com/ycl/calculate/MonitorRegistrationCalculation.java @@ -2,9 +2,11 @@ import com.ycl.platform.domain.entity.CheckIndexVideo; import com.ycl.platform.domain.result.UY.MonitorQualifyResult; +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 constant.ApiConstants; import constant.CheckThreadConstants; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -34,27 +36,38 @@ //鍖哄煙瑙嗛鍦ㄧ嚎鐜囩殑鍐呴儴绫� protected static class AreaStats { - //璧勪骇搴撶櫥璁板湪鐢ㄦ暟 - int totalSites = 0; + //褰撴棩妗f鏁� + int todayFiles = 0; //鏈敞鍐岀殑鏁伴噺 int newSites = 0; //鍏ㄥ勾鐣欏瓨鏁� int allFiles = 0; - //褰撴棩妗f鏁帮紙鍑屾櫒璁$畻鐨勶紝瀹為檯鍙栧緱鏄槰鏃ョ殑涓�鏈轰竴妗f暟閲忥級 - int todayFiles = 0; } - //TODO:鏀逛负MonitorQualifyResult锛岀畻娉曚紭鍖� + //TODO:鏀逛负MonitorQualifyResult @Override public void calculate(List<MonitorQualifyResult> list) { //鑾峰彇鍒嗗尯鍩熺殑鎸囨爣鏁伴噺 Map<String, MonitorRegistrationCalculation.AreaStats> areaStatsMap = getAreaStatsMap(list); if (areaStatsMap == null) return; + //鏌ユ暟鎹簱琛ュ厖鍏ㄥ勾鐣欏瓨鏁� + List<TMonitorVO> monitorVOS = monitorMapper.selectMonitorVOList(); + areaStatsMap.forEach((key,areaStats)->{ + if(key.startsWith(ApiConstants.Province)){ + long count = monitorVOS.stream().filter(vo -> ApiConstants.TRUE.equals(vo.getProvinceTag())) + .filter(vo -> key.split("_")[1].equals(vo.getDeptId() + "")).count(); + areaStats.allFiles = Integer.parseInt(count+""); + }else { + long count = monitorVOS.stream().filter(vo -> key.equals(vo.getDeptId() + "")).count(); + areaStats.allFiles = Integer.parseInt(count+""); + } + }); + // 鏌ヨ鏄惁index琛ㄥ凡缁忓瓨鍦ㄤ粖鏃ユ暟鎹� List<CheckIndexVideo> checkIndexVideoList = checkIndexVideoMapper.selectToday(DateUtils.getDate()); List<CheckIndexVideo> checkIndexVideos = new ArrayList<>(); areaStatsMap.forEach((key, stats) -> { - if (stats.totalSites > 0) { + if (stats.todayFiles > 0) { CheckIndexVideo checkIndexVideo = createOrUpdateCheckIndexVideo(key, stats, checkIndexVideoList); if (checkIndexVideo != null) { checkIndexVideos.add(checkIndexVideo); @@ -72,8 +85,7 @@ public void updateAreaStats(Map<String, AreaStats> areaStatsMap, String key, MonitorQualifyResult result) { //杩斿洖瀵硅薄鐨勫紩鐢紝濡傛灉涓嶅瓨鍦ㄤ細鏀惧叆鏂扮殑key,value AreaStats stats = areaStatsMap.computeIfAbsent(key, k -> new AreaStats()); - stats.totalSites++; - stats.allFiles++; + stats.todayFiles++; if (result.getNewDevice()!=null && result.getNewDevice()) { stats.newSites++; } @@ -89,7 +101,7 @@ } //璋冪敤涓�鏈轰竴妗f敞鍐岀巼 Map<String, Object> param = new HashMap<>(); - param.put("totalSites", stats.totalSites); + param.put("totalSites", stats.todayFiles); param.put("newSites", stats.newSites); BigDecimal monitorRegistration = monitorRegistration(param); checkIndexVideo.setMonitorRegistration(monitorRegistration); diff --git a/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml index 22d1360..7c7aef2 100644 --- a/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml +++ b/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml @@ -149,7 +149,7 @@ camera_capture_area, on_state, civil_code, integrated_device, camera_brand, address, net_working, public_security, installed_time, management_unit, mu_contact_info, storage_days , monitor_azimuth, scene_photo_addr, model, site_vulgo, camera_type, camera_light_type, encoded_format, - camera_dept, hybm, lxbm,d.dept_id, d.dept_name from t_monitor m + camera_dept, hybm, lxbm,d.dept_id, d.dept_name,p.province_tag from t_monitor m left join t_yw_point p on m.serial_number = p.serial_number left join sys_dept d on p.dept_id = d.dept_id </select> -- Gitblit v1.8.0