From 8f83a63bc5f046e34a1a06bcf6f1a8241c7277ac Mon Sep 17 00:00:00 2001 From: fuliqi <fuliqi@qq.com> Date: 星期二, 24 九月 2024 12:14:11 +0800 Subject: [PATCH] 增加部级考核标签 --- ycl-common/src/main/java/constant/CheckConstants.java | 2 + ycl-server/src/main/java/com/ycl/platform/service/impl/PlatformServiceImpl.java | 17 ++++++-- ycl-server/src/main/java/com/ycl/calculate/MonitorRegistrationCalculation.java | 9 +++- ycl-server/src/main/java/com/ycl/calculate/PlatformOnlineCalculation.java | 1 ycl-server/src/main/java/com/ycl/calculate/IndexCalculationUtils.java | 8 +++- ycl-pojo/src/main/java/com/ycl/platform/domain/vo/TMonitorVO.java | 3 + ycl-common/src/main/java/constant/ApiConstants.java | 4 ++ ycl-server/src/main/java/com/ycl/task/CheckScoreTask.java | 14 ++++-- ycl-pojo/src/main/java/com/ycl/platform/base/CheckIndex.java | 4 + ycl-server/src/main/java/com/ycl/platform/controller/CheckScoreController.java | 8 +--- ycl-server/src/main/java/com/ycl/platform/service/impl/CheckScoreServiceImpl.java | 13 ++++-- ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml | 8 +++- ycl-server/src/main/java/com/ycl/calculate/IndexCalculationServe.java | 5 ++ 13 files changed, 68 insertions(+), 28 deletions(-) diff --git a/ycl-common/src/main/java/constant/ApiConstants.java b/ycl-common/src/main/java/constant/ApiConstants.java index 9164012..272bef7 100644 --- a/ycl-common/src/main/java/constant/ApiConstants.java +++ b/ycl-common/src/main/java/constant/ApiConstants.java @@ -69,7 +69,11 @@ //鐪佸巺鍓嶇紑 public final static String Province = "Province_"; + //鍖哄幙鍓嶇紑 public final static String County = "County_"; + //鍏畨閮ㄥ墠缂� + public final static String Dept = "Dept_"; + //娴峰悍璁块棶OSD璺緞 public final static String HK_OSD_PATH = "/ISAPI/System/Video/inputs/channels/1/overlays"; //娴峰悍璁块棶鏃堕棿璺緞 diff --git a/ycl-common/src/main/java/constant/CheckConstants.java b/ycl-common/src/main/java/constant/CheckConstants.java index 3b4ab05..ff9e13a 100644 --- a/ycl-common/src/main/java/constant/CheckConstants.java +++ b/ycl-common/src/main/java/constant/CheckConstants.java @@ -15,6 +15,8 @@ public static final Short Examine_Tag_Province = 0; //鍖哄幙 public static final Short Examine_Tag_County = 1; + //鍏畨閮� + public static final Short Examine_Tag_Dept = 2; public static final String Delete = "1"; diff --git a/ycl-pojo/src/main/java/com/ycl/platform/base/CheckIndex.java b/ycl-pojo/src/main/java/com/ycl/platform/base/CheckIndex.java index b5394be..1cc37c8 100644 --- a/ycl-pojo/src/main/java/com/ycl/platform/base/CheckIndex.java +++ b/ycl-pojo/src/main/java/com/ycl/platform/base/CheckIndex.java @@ -24,11 +24,13 @@ public String day; @TableField("dept_id") public Long deptId; - /** 鑰冩牳鏍囩锛堢渷鍘�/甯傚眬锛� */ + /** 鑰冩牳鏍囩锛堢渷鍘�/甯傚眬/鍏畨閮級 */ @TableField("examine_tag") public Short examineTag; @TableField("create_time") public Date createTime; + @TableField("publish") + public String publish; @Excel(name = "鏃ユ湡") @TableField(exist = false) diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/vo/TMonitorVO.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/vo/TMonitorVO.java index 39da4e5..d8f4e47 100644 --- a/ycl-pojo/src/main/java/com/ycl/platform/domain/vo/TMonitorVO.java +++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/vo/TMonitorVO.java @@ -222,7 +222,8 @@ private Long deptId; private String deptName; - private Integer provinceTag; + private Boolean provinceTag; + private Boolean deptTag; private String area; private String error; private String unitName; diff --git a/ycl-server/src/main/java/com/ycl/calculate/IndexCalculationServe.java b/ycl-server/src/main/java/com/ycl/calculate/IndexCalculationServe.java index 402ce11..0724007 100644 --- a/ycl-server/src/main/java/com/ycl/calculate/IndexCalculationServe.java +++ b/ycl-server/src/main/java/com/ycl/calculate/IndexCalculationServe.java @@ -48,6 +48,11 @@ String provinceKey = ApiConstants.Province + deptId; updateAreaStats(areaStatsMap, provinceKey, result); } + // 澶勭悊鍏畨閮ㄦ暟鎹� + if (result.getDeptTag()!=null && result.getDeptTag()) { + String deptKey = ApiConstants.Dept + deptId; + updateAreaStats(areaStatsMap, deptKey, result); + } } return areaStatsMap; } diff --git a/ycl-server/src/main/java/com/ycl/calculate/IndexCalculationUtils.java b/ycl-server/src/main/java/com/ycl/calculate/IndexCalculationUtils.java index 8869870..8cc3fb2 100644 --- a/ycl-server/src/main/java/com/ycl/calculate/IndexCalculationUtils.java +++ b/ycl-server/src/main/java/com/ycl/calculate/IndexCalculationUtils.java @@ -3,6 +3,7 @@ import com.ycl.platform.base.CheckIndex; import constant.ApiConstants; import constant.CheckConstants; +import enumeration.general.PublishType; import lombok.extern.slf4j.Slf4j; import java.math.BigDecimal; @@ -23,6 +24,7 @@ Optional<T> existingIndex = checkIndexList.stream() .filter(index -> key.startsWith(ApiConstants.Province) ? CheckConstants.Examine_Tag_Province.equals(index.getExamineTag()) && key.split("_")[1].equals(index.getDeptId().toString()) + : key.startsWith(ApiConstants.Dept) ? CheckConstants.Examine_Tag_Dept.equals(index.getExamineTag()) && key.split("_")[1].equals(index.getDeptId().toString()) : CheckConstants.Examine_Tag_County.equals(index.getExamineTag()) && key.equals(index.getDeptId().toString())) .findFirst(); @@ -31,9 +33,11 @@ } else { try { checkIndex = clazz.getDeclaredConstructor().newInstance(); - checkIndex.setDeptId(key.startsWith(ApiConstants.Province) ? Long.parseLong(key.split("_")[1]) : Long.parseLong(key)); - checkIndex.setExamineTag(key.startsWith(ApiConstants.Province) ? CheckConstants.Examine_Tag_Province : CheckConstants.Examine_Tag_County); + checkIndex.setDeptId(key.startsWith(ApiConstants.Province) || key.startsWith(ApiConstants.Dept) ? Long.parseLong(key.split("_")[1]) : Long.parseLong(key)); + checkIndex.setExamineTag(key.startsWith(ApiConstants.Province) ? CheckConstants.Examine_Tag_Province : key.startsWith(ApiConstants.Dept) ? CheckConstants.Examine_Tag_Dept : CheckConstants.Examine_Tag_County); checkIndex.setCreateTime(new Date()); + //榛樿鍙戝竷 + checkIndex.setPublish(PublishType.PUBLISHED.getCode()); } catch (Exception e) { checkIndex = null; log.error("鏃犳硶鍒涘缓 checkIndex 瀹炰緥", e); 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 bbcbb18..2e5d86c 100644 --- a/ycl-server/src/main/java/com/ycl/calculate/MonitorRegistrationCalculation.java +++ b/ycl-server/src/main/java/com/ycl/calculate/MonitorRegistrationCalculation.java @@ -53,10 +53,15 @@ 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())) + long count = monitorVOS.stream().filter(TMonitorVO::getProvinceTag) .filter(vo -> key.split("_")[1].equals(vo.getDeptId() + "")).count(); areaStats.allFiles = Integer.parseInt(count+""); - }else { + }else if(key.startsWith(ApiConstants.Dept)){ + long count = monitorVOS.stream().filter(TMonitorVO::getDeptTag) + .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+""); } diff --git a/ycl-server/src/main/java/com/ycl/calculate/PlatformOnlineCalculation.java b/ycl-server/src/main/java/com/ycl/calculate/PlatformOnlineCalculation.java index c2f7e18..549028c 100644 --- a/ycl-server/src/main/java/com/ycl/calculate/PlatformOnlineCalculation.java +++ b/ycl-server/src/main/java/com/ycl/calculate/PlatformOnlineCalculation.java @@ -54,6 +54,7 @@ double score = Math.max(1 - num * 0.1, 0); map.put(deptId+"",score); map.put(ApiConstants.Province + deptId,score); + map.put(ApiConstants.Dept + deptId,score); } } diff --git a/ycl-server/src/main/java/com/ycl/platform/controller/CheckScoreController.java b/ycl-server/src/main/java/com/ycl/platform/controller/CheckScoreController.java index f73d7a5..1a53890 100644 --- a/ycl-server/src/main/java/com/ycl/platform/controller/CheckScoreController.java +++ b/ycl-server/src/main/java/com/ycl/platform/controller/CheckScoreController.java @@ -95,12 +95,8 @@ @Log(title = "璇︽儏椤靛鍑鸿�冩牳绉垎", businessType = BusinessType.EXPORT) @PostMapping("/detailExport") @PreAuthorize("@ss.hasPermi('check:result:detail:export')") - public void detailExport(HttpServletResponse response, CheckScore checkScore) throws IOException { - CheckResultExportDTO exportDTO = new CheckResultExportDTO(); - exportDTO.setDate(checkScore.getDate()); - exportDTO.setQuarter(checkScore.getQuarter()); - exportDTO.setDeptId(checkScore.getDeptId()); - exportDTO.setId(checkScore.getId()); + //TODO:妫�鏌ユ潈闄� + public void detailExport(HttpServletResponse response, CheckResultExportDTO exportDTO) throws IOException { checkScoreService.exportIndex(response,exportDTO); } /** diff --git a/ycl-server/src/main/java/com/ycl/platform/service/impl/CheckScoreServiceImpl.java b/ycl-server/src/main/java/com/ycl/platform/service/impl/CheckScoreServiceImpl.java index c48bde7..93cfca3 100644 --- a/ycl-server/src/main/java/com/ycl/platform/service/impl/CheckScoreServiceImpl.java +++ b/ycl-server/src/main/java/com/ycl/platform/service/impl/CheckScoreServiceImpl.java @@ -181,17 +181,22 @@ } private void getCheckScore(CheckScore checkScore, Calendar calendar) { - // 0 鐪佸巺鏈堝害 1 甯傚眬鏈堝害 2 鐪佸巺瀛e害 3 甯傚眬瀛e害 + // 0.鐪佸巺鏈堝害 1.鐪佸巺瀛e害 2.甯傚眬鏈堝害 3.甯傚眬瀛e害 4.鍏畨閮ㄦ湀搴� 5.鍏畨閮ㄥ搴� switch (checkScore.getExamineTag()) { - case 0, 1: + case 0, 2 ,4: checkScore.setEndDate(calendar.getTime()); calendar.set(Calendar.DAY_OF_MONTH, 1); checkScore.setStartDate(calendar.getTime()); + if(checkScore.getExamineTag() == 0) checkScore.setExamineTag(Integer.valueOf(CheckConstants.Examine_Tag_Province+"")); + if(checkScore.getExamineTag() == 2) checkScore.setExamineTag(Integer.valueOf(CheckConstants.Examine_Tag_County+"")); + if(checkScore.getExamineTag() == 4) checkScore.setExamineTag(Integer.valueOf(CheckConstants.Examine_Tag_Dept+"")); break; - case 2, 3: + case 1, 3, 5: checkScore.setStartDate(DateUtils.getQuarterStart(calendar).getTime()); checkScore.setEndDate(DateUtils.getQuarterEnd(calendar).getTime()); - checkScore.setExamineTag(checkScore.getExamineTag() == 2 ? 0 : 1); + if(checkScore.getExamineTag() == 1) checkScore.setExamineTag(Integer.valueOf(CheckConstants.Examine_Tag_Province+"")); + if(checkScore.getExamineTag() == 3) checkScore.setExamineTag(Integer.valueOf(CheckConstants.Examine_Tag_County+"")); + if(checkScore.getExamineTag() == 5) checkScore.setExamineTag(Integer.valueOf(CheckConstants.Examine_Tag_Dept+"")); break; } } diff --git a/ycl-server/src/main/java/com/ycl/platform/service/impl/PlatformServiceImpl.java b/ycl-server/src/main/java/com/ycl/platform/service/impl/PlatformServiceImpl.java index 50a8d45..306d388 100644 --- a/ycl-server/src/main/java/com/ycl/platform/service/impl/PlatformServiceImpl.java +++ b/ycl-server/src/main/java/com/ycl/platform/service/impl/PlatformServiceImpl.java @@ -47,6 +47,7 @@ /** * 娣诲姞 + * * @param form * @return */ @@ -78,6 +79,7 @@ /** * 淇敼 + * * @param form * @return */ @@ -96,6 +98,7 @@ /** * 鎵归噺鍒犻櫎 + * * @param ids * @return */ @@ -107,6 +110,7 @@ /** * id鍒犻櫎 + * * @param id * @return */ @@ -118,6 +122,7 @@ /** * 鍒嗛〉鏌ヨ + * * @param query * @return */ @@ -150,6 +155,7 @@ /** * 鏍规嵁id鏌ユ壘 + * * @param id * @return */ @@ -162,6 +168,7 @@ /** * 鍒楄〃 + * * @return */ @Override @@ -179,8 +186,8 @@ Map<String, Map<String, Object>> resultMap = new HashMap<>(); for (AreaDeptEnum value : AreaDeptEnum.values()) { Map<String, Object> map = new HashMap<>(); - map.put("platformOnline",Boolean.TRUE); - resultMap.put(value.getName(),map); + map.put("platformOnline", Boolean.TRUE); + resultMap.put(value.getName(), map); } //骞冲彴鍦ㄧ嚎鐘舵�� 榛樿鍦ㄧ嚎锛屽鏋滀竴涓笉鍦ㄧ嚎鏀逛负false銆� List<Platform> platformList = new LambdaQueryChainWrapper<>(platformMapper) @@ -191,12 +198,12 @@ for (Platform platform : platformList) { reachable = InetAddress.getByName(platform.getPlatformIP()).isReachable(3000); //涓嶅湪绾� - if(!reachable) { + if (!reachable) { //鑾峰彇骞冲彴绠$悊鐨勫尯鍩熺紪鐮侀泦鍚� List<String> areaCodes = Arrays.asList(com.ycl.utils.StringUtils.split(platform.getArea(), ",")); resultMap.forEach((deptName, map) -> { - if(areaCodes.contains(AreaDeptEnum.fromName(deptName).getCode())){ - map.put("platformOnline",Boolean.FALSE); + if (areaCodes.contains(AreaDeptEnum.fromName(deptName).getCode())) { + map.put("platformOnline", Boolean.FALSE); } }); } diff --git a/ycl-server/src/main/java/com/ycl/task/CheckScoreTask.java b/ycl-server/src/main/java/com/ycl/task/CheckScoreTask.java index 43a2824..3581a1d 100644 --- a/ycl-server/src/main/java/com/ycl/task/CheckScoreTask.java +++ b/ycl-server/src/main/java/com/ycl/task/CheckScoreTask.java @@ -7,6 +7,7 @@ import com.ycl.platform.mapper.*; import com.ycl.platform.service.*; import constant.CheckConstants; +import enumeration.general.PublishType; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.mongodb.core.MongoTemplate; @@ -24,6 +25,9 @@ @Slf4j @Component("checkScoreTask") +//TODO:澧炲姞鑰冩牳鏍囩瀛楀吀锛氬叕瀹夐儴 +//TODO:淇敼鐐逛綅鐘舵�佸瓧鍏革細鍦ㄧ嚎銆佺绾� +//TODO锛氫慨鏀箂core銆乮ndex榛樿鍙戝竷 public class CheckScoreTask { @Autowired private CheckTemplateMapper templateMapper; @@ -41,7 +45,6 @@ public void executeTemplate(Integer templateId) { CheckTemplate checkTemplate = templateMapper.selectCheckTemplateById(templateId); if (checkTemplate != null) { - log.info("鎵ц鑰冩牳妯℃澘---------->{}", checkTemplate.getTemplateName()); Short examineCategory = checkTemplate.getExamineCategory(); Short examineTag = checkTemplate.getExamineTag(); //鏌ユ潈閲� @@ -60,7 +63,7 @@ checkIndexVideo.setExamineTag(examineTag); checkIndexVideo.setDay(day); checkIndexVideo.setDeptIds(JSONArray.parseArray(checkTemplate.getDeptId(), Integer.class)); - //鏍规嵁妯℃澘鐨勮�冩牳鏍囩鏌ュ悇鍖哄幙瀵瑰簲鐪佸巺鎴栧競灞�瑙嗛鏁版嵁 + //鏍规嵁妯℃澘鐨勮�冩牳鏍囩鏌ュ悇鍖哄幙瀵瑰簲鐪佸巺鎴栧競灞�鎴栧叕瀹夐儴瑙嗛鏁版嵁 List<CheckIndexVideo> checkIndexVideos = videoMapper.getCheckIndexVideoList(checkIndexVideo); for (CheckIndexVideo indexVideo : checkIndexVideos) { addToList(templateId, checkTemplate, examineTag, templateRuleList, scoreList, indexVideo, CheckConstants.Rule_Category_Video); @@ -70,7 +73,7 @@ checkIndexCar.setDay(day); checkIndexCar.setExamineTag(examineTag); checkIndexCar.setDeptIds(JSONArray.parseArray(checkTemplate.getDeptId(), Integer.class)); - //鏍规嵁妯℃澘鐨勮�冩牳鏍囩鏌ュ悇鍖哄幙瀵瑰簲鐪佸巺鎴栧競灞�杞﹁締鏁版嵁 + //鏍规嵁妯℃澘鐨勮�冩牳鏍囩鏌ュ悇鍖哄幙瀵瑰簲鐪佸巺鎴栧競灞�鎴栧叕瀹夐儴杞﹁締鏁版嵁 List<CheckIndexCar> checkIndexCars = carMapper.getCheckIndexCarList(checkIndexCar); for (CheckIndexCar indexCar : checkIndexCars) { addToList(templateId, checkTemplate, examineTag, templateRuleList, scoreList, indexCar, CheckConstants.Rule_Category_Car); @@ -80,7 +83,7 @@ checkIndexFace.setDay(day); checkIndexFace.setExamineTag(examineTag); checkIndexFace.setDeptIds(JSONArray.parseArray(checkTemplate.getDeptId(), Integer.class)); - //鏍规嵁妯℃澘鐨勮�冩牳鏍囩鏌ュ悇鍖哄幙瀵瑰簲鐪佸巺鎴栧競灞�浜鸿劯鏁版嵁 + //鏍规嵁妯℃澘鐨勮�冩牳鏍囩鏌ュ悇鍖哄幙瀵瑰簲鐪佸巺鎴栧競灞�鎴栧叕瀹夐儴浜鸿劯鏁版嵁 List<CheckIndexFace> checkIndexFaces = faceMapper.getCheckIndexFaceList(checkIndexFace); for (CheckIndexFace indexFace : checkIndexFaces) { addToList(templateId, checkTemplate, examineTag, templateRuleList, scoreList, indexFace, CheckConstants.Rule_Category_Face); @@ -120,7 +123,7 @@ BigDecimal score = index.multiply(templateRule.getWeight()); scoreFinal = scoreFinal.add(score); } catch (Exception e) { - log.info("鍙嶅皠寮傚父", e.getMessage()); + log.error("鍙嶅皠寮傚父", e.getMessage()); } return scoreFinal; } @@ -142,5 +145,6 @@ checkScore.setDeptId(checkIndex.getDeptId()); checkScore.setTemplateId(templateId); checkScore.setScore(scoreFinal); + checkScore.setPublish(PublishType.PUBLISHED.getCode()); } } diff --git a/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml index b18b4d7..b6c5b25 100644 --- a/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml +++ b/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml @@ -98,7 +98,7 @@ <select id="selectTMonitorList" resultType="com.ycl.platform.domain.vo.TMonitorVO"> select m.id, m.serial_number, name, site_type, mac_addr, ip, camera_fun_type, longitude, latitude, - camera_capture_area, p.online as onState, civil_code, d.dept_id, d.dept_name, d.area, p.province_tag, + camera_capture_area, p.online as onState, civil_code, d.dept_id, d.dept_name, d.area, p.province_tag,p.dept_tag, IF(COUNT(w.id) OVER() > 0, '鏄�', '鍚�') AS error, u.unit_name,p.recovery_time,p.reason,p.start_time,p.end_time,w.work_order_no from t_monitor m left join t_yw_point p on m.serial_number = p.serial_number and p.deleted = 0 @@ -119,6 +119,7 @@ or u.unit_name like concat('%', #{name}, '%')) </if> <if test="provinceTag != null ">and p.province_tag = #{provinceTag}</if> + <if test="deptTag != null ">and p.dept_tag = #{deptTag}</if> <if test="siteType != null ">and site_type = #{siteType}</if> <if test="macAddr != null and macAddr != ''">and mac_addr = #{macAddr}</if> <if test="ip != null and ip != ''">and ip = #{ip}</if> @@ -162,7 +163,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,p.province_tag from t_monitor m + camera_dept, hybm, lxbm,d.dept_id, d.dept_name,p.province_tag,p.dept_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> @@ -348,6 +349,9 @@ <if test="provinceTag!=null"> and p.province_tag = #{provinceTag} </if> + <if test="deptTag!=null"> + and p.dept_tag = #{deptTag} + </if> ${params.dataScope} </where> </select> -- Gitblit v1.8.0