From be9f869e46e9e2adc43766d8f9d8bd8725a8d421 Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Thu, 30 May 2024 18:38:31 +0800 Subject: [PATCH 01/16] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=EF=BC=9A=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E6=9C=88=E6=8A=A5=E5=8F=91=E7=94=B5=E9=87=8F=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=EF=BC=8C=E6=97=A5=E5=B8=B8=E7=BB=B4=E6=8A=A4=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/basic/mapper/PersonManagemetMapper.java | 6 +- .../report/controller/MonthReportController.java | 3 +- .../service/IOperStationMonthReportService.java | 2 +- .../impl/OperStationMonthReportServiceImpl.java | 356 +++++++++++---------- 4 files changed, 186 insertions(+), 181 deletions(-) diff --git a/hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/mapper/PersonManagemetMapper.java b/hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/mapper/PersonManagemetMapper.java index fdbaf20..c2f6819 100644 --- a/hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/mapper/PersonManagemetMapper.java +++ b/hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/mapper/PersonManagemetMapper.java @@ -6,6 +6,7 @@ import com.hnac.hzims.basic.vo.PersonManagemetExportVo; import com.hnac.hzims.basic.vo.PersonManagemetVo; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import org.springblade.core.datascope.annotation.UserDataAuth; import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; import java.util.Date; @@ -18,16 +19,17 @@ import java.util.List; */ @Mapper public interface PersonManagemetMapper extends UserDataScopeBaseMapper { - + @UserDataAuth List getPersonManagemetEntity( @Param(value = "type")String type, @Param(value = "deadStartTime") Date deadStartTime, @Param(value = "deadTime")Date deadTime, @Param(value = "name")String name, @Param(value = "unitName")String unitName, @Param(value = "sex")String sex, @Param(value = "job")String job, @Param(value = "academicTitle")String academicTitle, @Param(value = "status")Integer status, @Param(value = "current")Integer current, @Param(value = "size")Integer size) ; + Integer getCountByPersonManagemetEntity( @Param(value = "type")String type, @Param(value = "deadStartTime") Date deadStartTime, @Param(value = "deadTime")Date deadTime, @Param(value = "name")String name, @Param(value = "unitName")String unitName, @Param(value = "sex")String sex, @Param(value = "job")String job, @Param(value = "academicTitle")String academicTitle, @Param(value = "status")Integer status, @Param(value = "current")Integer current, @Param(value = "size")Integer size) ; - + @UserDataAuth List exportPersonManagemet( @Param(value = "type")String type, @Param(value = "deadStartTime") Date deadStartTime, @Param(value = "deadTime")Date deadTime, @Param(value = "name")String name, @Param(value = "unitName")String unitName, @Param(value = "sex")String sex, @Param(value = "job")String job, diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/MonthReportController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/MonthReportController.java index 01bd8fb..7ed52aa 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/MonthReportController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/MonthReportController.java @@ -129,7 +129,8 @@ public class MonthReportController { // LocalDate endDate = DateUtil.getLastDayByYearMonth(yearAndMonth); // return R.data(taskMonthService.getStationMonthReport(startDate,endDate,deptId.toString())); R deptR = sysClient.getDept(deptId); - return R.data(operStationMonthReportService.getStationMonthReport(yearAndMonth, BeanUtil.copy(deptR.getData(),DeptVO.class))); +// return R.data(operStationMonthReportService.getStationMonthReport(yearAndMonth, BeanUtil.copy(deptR.getData(),DeptVO.class))); + return R.success("月报测试"); } @GetMapping("/test") diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/IOperStationMonthReportService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/IOperStationMonthReportService.java index 33f9805..7dbd987 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/IOperStationMonthReportService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/IOperStationMonthReportService.java @@ -14,7 +14,7 @@ public interface IOperStationMonthReportService { * @param yearAndMonth * @return */ - StationReportAllVO getStationMonthReport(String yearAndMonth, DeptVO deptVO); +// StationReportAllVO getStationMonthReport(String yearAndMonth, DeptVO deptVO); /** * 获取电站月报 * @param yearAndMonth diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/OperStationMonthReportServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/OperStationMonthReportServiceImpl.java index 3983c33..416a1d9 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/OperStationMonthReportServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/OperStationMonthReportServiceImpl.java @@ -128,181 +128,181 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor **/ private static final String STATION_REPORT_OUTSIDE = "1"; - @Override - public StationReportAllVO getStationMonthReport(String yearAndMonth, DeptVO deptVO) { - StationReportAllVO stationReportAllVo = new StationReportAllVO(); - stationReportAllVo.setStationName(deptVO.getDeptName()); - stationReportAllVo.setYearMonth(YearMonth.parse(yearAndMonth).format(DateTimeFormatter.ofPattern("yyyy年MM月"))); - //处理请求参数 - Map params = new HashMap<>(); - //使用预定义实例来转换 - DateTimeFormatter fmt = DateTimeFormatter.ISO_LOCAL_DATE; - LocalDate startDate = DateUtil.getFirstDayByYearMonth(yearAndMonth); - LocalDate endDate = DateUtil.getLastDayByYearMonth(yearAndMonth); - params.put("startDate", fmt.format(startDate)); - params.put("endDate", fmt.format(endDate)); - - List deptIdList = new ArrayList<>(); - deptIdList.add(deptVO.getId()); - //获取下属机构 - R> childDeptListR = sysClient.getDeptChild(deptVO.getId()); - if (childDeptListR.isSuccess() && CollectionUtil.isNotEmpty(childDeptListR.getData())) { - deptIdList.addAll(childDeptListR.getData().stream().map(Dept::getId).collect(Collectors.toList())); - } - params.put("deptId", deptIdList); - - //获取机构及子机构下的站点 - List stationEntityList = stationService.list(new LambdaQueryWrapper() {{ - in(StationEntity::getRefDept, deptIdList); - }}); - - //监控线程执行完后返回结果 - CountDownLatch countDownLatch = new CountDownLatch(POOL_QUANTITY); - long startMillis = System.currentTimeMillis(); - //电站发电情况 - pool.execute(() -> { - try { - List powerList = new ArrayList<>(); - stationEntityList.forEach(stationEntity -> { - List stationReportVOList = mainSystemMonitoringService.getElectricSituation(yearAndMonth, stationEntity.getCode()); - powerList.addAll(stationReportVOList); - }); - stationReportAllVo.setStationReportVOList(powerList); - } finally { - countDownLatch.countDown(); - log.info("电站发电耗时:"+(System.currentTimeMillis()-startMillis)+"ms"); - System.out.print("电站发电耗时:"+(System.currentTimeMillis()-startMillis)+"ms"); - } - }); - //值班情况 - pool.execute(() -> { - try { -// List dutyReportVOList = iImsDutyMainService.getDutyMainStatisticsByClassId(params); -// stationReportAllVo.setDutyReportVOList(dutyReportVOList); - } finally { - countDownLatch.countDown(); - log.info("值班情况耗时:"+(System.currentTimeMillis()-startMillis)+"ms"); - System.out.print("值班情况耗时:"+(System.currentTimeMillis()-startMillis)+"ms"); - } - }); - //日常维护 - pool.execute(() -> { - try { - List maintenanceList = operMaintenanceTaskService.getMaintenanceStatisticsByDisposer(params); - stationReportAllVo.setMaintenanceReportVOList(maintenanceList); - } finally { - countDownLatch.countDown(); - log.info("日常维护:"+(System.currentTimeMillis()-startMillis)+"ms"); - System.out.print("日常维护:"+(System.currentTimeMillis()-startMillis)+"ms"); - } - }); - //检修 - pool.execute(() -> { - try { -// List accessList = operAccessTaskService.getAccessTaskByName(params); -// stationReportAllVo.setAccessReportVOList(accessList); - } finally { - countDownLatch.countDown(); - log.info("检修:"+(System.currentTimeMillis()-startMillis)+"ms"); - System.out.print("检修:"+(System.currentTimeMillis()-startMillis)+"ms"); - } - }); - //缺陷 - pool.execute(() -> { - try { - List defectList = operDefectService.getFaultByFaultCode(params); - stationReportAllVo.setDefectReportsVOList(defectList); - } finally { - countDownLatch.countDown(); - log.info("缺陷:"+(System.currentTimeMillis()-startMillis)+"ms"); - System.out.print("缺陷:"+(System.currentTimeMillis()-startMillis)+"ms"); - } - }); - //两票统计 - pool.execute(() -> { - try { - String deptIds = deptIdList.stream().map(deptId -> deptId.toString()).collect(Collectors.joining(",")); - TicketStatisticDTO ticketStatisticDTO = new TicketStatisticDTO(); - ticketStatisticDTO.setStartDate(fmt.format(startDate)); - ticketStatisticDTO.setEndDate(fmt.format(endDate)); - ticketStatisticDTO.setDeptIds(deptIds); - List ticketVOS = ticketInfoAllClient.getTicketReportStatistic(ticketStatisticDTO); - stationReportAllVo.setTicketInfoStatisticVOList(ticketVOS); - } finally { - countDownLatch.countDown(); - log.info("两票统计:"+(System.currentTimeMillis()-startMillis)+"ms"); - System.out.print("两票统计:"+(System.currentTimeMillis()-startMillis)+"ms"); - } - }); - //巡检 - pool.execute(() -> { - try { - List taskReportVOS = taskReportClient.getInspectTaskReport(params); - this.fillInspectProblem(startDate, endDate, deptIdList, taskReportVOS); - stationReportAllVo.setInspectReportVOList(taskReportVOS); - } finally { - countDownLatch.countDown(); - log.info("巡检:"+(System.currentTimeMillis()-startMillis)+"ms"); - System.out.print("巡检:"+(System.currentTimeMillis()-startMillis)+"ms"); - } - }); - //智能诊断 - pool.execute(() -> { - if (CollectionUtil.isNotEmpty(stationEntityList)) { - StatisticStatusDTO statisticStatusDTO = new StatisticStatusDTO(); - List stationIds = stationEntityList.stream().map(StationEntity::getCode).collect(Collectors.toList()); - String[] stationIdArray = new String[stationIds.size()]; - stationIds.toArray(stationIdArray); - statisticStatusDTO.setStationIds(stationIdArray); - statisticStatusDTO.setThreshold(0.3f); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); - statisticStatusDTO.setStart(formatter.format(LocalDateTime.of(startDate, LocalTime.MIN))); - statisticStatusDTO.setEnd(formatter.format(LocalDateTime.of(endDate, LocalTime.MAX))); - R>> diagnoseResult = diagnoseClient.getStatisticStatus(statisticStatusDTO); - List diagnoseConclusionList = new ArrayList<>(); - if (diagnoseResult.isSuccess()) { - Map> statisticStatusVOList = diagnoseResult.getData(); - statisticStatusVOList.forEach((k, v) -> { - if (v.size() > 5) { - v = v.subList(0, 5); - } - String diagnoseConclusion = v.stream().map(s -> { - String riskLevel = ""; - if (s.getSeverity() >= 3) { - riskLevel = "高风险"; - } else if (s.getSeverity() == 2) { - riskLevel = "一般"; - } else if (s.getSeverity() == 1) { - riskLevel = "低风险"; - } - String c = "发生在" + s.getOrd() + "的" + s.getName() + ",风险等级:" + riskLevel + ",最后一次出现的时间:" + s.getLastBeginTime() + ";";//,持续时长:"+s.getLongTime()+" - return c; - }).collect(Collectors.joining("\n")); - if (StringUtil.isNotBlank(diagnoseConclusion)) { - StationEntity stationEntity = stationService.getById(k); - if (ObjectUtil.isNotEmpty(stationEntity)) { - diagnoseConclusion = stationEntity.getName() + "本月智能诊断服务预警前五位的可能存在风险的故障信息:\n" + diagnoseConclusion; - diagnoseConclusionList.add(diagnoseConclusion); - } - } - }); - stationReportAllVo.setDiagnoseConclusion(diagnoseConclusionList.stream().collect(Collectors.joining("\n"))); - stationReportAllVo.setStatisticStatusVOList(statisticStatusVOList); - } - } - countDownLatch.countDown(); - }); - //所有模板数据获取完成后释放锁 - try { - countDownLatch.await(); - } catch (InterruptedException e) { - e.printStackTrace(); - Thread.currentThread().interrupt(); - } - //小结 - this.getStationReportConclusion(stationReportAllVo, params); - return stationReportAllVo; - } +// @Override +// public StationReportAllVO getStationMonthReport(String yearAndMonth, DeptVO deptVO) { +// StationReportAllVO stationReportAllVo = new StationReportAllVO(); +// stationReportAllVo.setStationName(deptVO.getDeptName()); +// stationReportAllVo.setYearMonth(YearMonth.parse(yearAndMonth).format(DateTimeFormatter.ofPattern("yyyy年MM月"))); +// //处理请求参数 +// Map params = new HashMap<>(); +// //使用预定义实例来转换 +// DateTimeFormatter fmt = DateTimeFormatter.ISO_LOCAL_DATE; +// LocalDate startDate = DateUtil.getFirstDayByYearMonth(yearAndMonth); +// LocalDate endDate = DateUtil.getLastDayByYearMonth(yearAndMonth); +// params.put("startDate", fmt.format(startDate)); +// params.put("endDate", fmt.format(endDate)); +// +// List deptIdList = new ArrayList<>(); +// deptIdList.add(deptVO.getId()); +// //获取下属机构 +// R> childDeptListR = sysClient.getDeptChild(deptVO.getId()); +// if (childDeptListR.isSuccess() && CollectionUtil.isNotEmpty(childDeptListR.getData())) { +// deptIdList.addAll(childDeptListR.getData().stream().map(Dept::getId).collect(Collectors.toList())); +// } +// params.put("deptId", deptIdList); +// +// //获取机构及子机构下的站点 +// List stationEntityList = stationService.list(new LambdaQueryWrapper() {{ +// in(StationEntity::getRefDept, deptIdList); +// }}); +// +// //监控线程执行完后返回结果 +// CountDownLatch countDownLatch = new CountDownLatch(POOL_QUANTITY); +// long startMillis = System.currentTimeMillis(); +// //电站发电情况 +// pool.execute(() -> { +// try { +// List powerList = new ArrayList<>(); +// stationEntityList.forEach(stationEntity -> { +// List stationReportVOList = mainSystemMonitoringService.getElectricSituation(yearAndMonth, stationEntity.getCode()); +// powerList.addAll(stationReportVOList); +// }); +// stationReportAllVo.setStationReportVOList(powerList); +// } finally { +// countDownLatch.countDown(); +// log.info("电站发电耗时:"+(System.currentTimeMillis()-startMillis)+"ms"); +// System.out.print("电站发电耗时:"+(System.currentTimeMillis()-startMillis)+"ms"); +// } +// }); +// //值班情况 +// pool.execute(() -> { +// try { +//// List dutyReportVOList = iImsDutyMainService.getDutyMainStatisticsByClassId(params); +//// stationReportAllVo.setDutyReportVOList(dutyReportVOList); +// } finally { +// countDownLatch.countDown(); +// log.info("值班情况耗时:"+(System.currentTimeMillis()-startMillis)+"ms"); +// System.out.print("值班情况耗时:"+(System.currentTimeMillis()-startMillis)+"ms"); +// } +// }); +// //日常维护 +// pool.execute(() -> { +// try { +// List maintenanceList = operMaintenanceTaskService.getMaintenanceStatisticsByDisposer(params); +// stationReportAllVo.setMaintenanceReportVOList(maintenanceList); +// } finally { +// countDownLatch.countDown(); +// log.info("日常维护:"+(System.currentTimeMillis()-startMillis)+"ms"); +// System.out.print("日常维护:"+(System.currentTimeMillis()-startMillis)+"ms"); +// } +// }); +// //检修 +// pool.execute(() -> { +// try { +//// List accessList = operAccessTaskService.getAccessTaskByName(params); +//// stationReportAllVo.setAccessReportVOList(accessList); +// } finally { +// countDownLatch.countDown(); +// log.info("检修:"+(System.currentTimeMillis()-startMillis)+"ms"); +// System.out.print("检修:"+(System.currentTimeMillis()-startMillis)+"ms"); +// } +// }); +// //缺陷 +// pool.execute(() -> { +// try { +// List defectList = operDefectService.getFaultByFaultCode(params); +// stationReportAllVo.setDefectReportsVOList(defectList); +// } finally { +// countDownLatch.countDown(); +// log.info("缺陷:"+(System.currentTimeMillis()-startMillis)+"ms"); +// System.out.print("缺陷:"+(System.currentTimeMillis()-startMillis)+"ms"); +// } +// }); +// //两票统计 +// pool.execute(() -> { +// try { +// String deptIds = deptIdList.stream().map(deptId -> deptId.toString()).collect(Collectors.joining(",")); +// TicketStatisticDTO ticketStatisticDTO = new TicketStatisticDTO(); +// ticketStatisticDTO.setStartDate(fmt.format(startDate)); +// ticketStatisticDTO.setEndDate(fmt.format(endDate)); +// ticketStatisticDTO.setDeptIds(deptIds); +// List ticketVOS = ticketInfoAllClient.getTicketReportStatistic(ticketStatisticDTO); +// stationReportAllVo.setTicketInfoStatisticVOList(ticketVOS); +// } finally { +// countDownLatch.countDown(); +// log.info("两票统计:"+(System.currentTimeMillis()-startMillis)+"ms"); +// System.out.print("两票统计:"+(System.currentTimeMillis()-startMillis)+"ms"); +// } +// }); +// //巡检 +// pool.execute(() -> { +// try { +// List taskReportVOS = taskReportClient.getInspectTaskReport(params); +// this.fillInspectProblem(startDate, endDate, deptIdList, taskReportVOS); +// stationReportAllVo.setInspectReportVOList(taskReportVOS); +// } finally { +// countDownLatch.countDown(); +// log.info("巡检:"+(System.currentTimeMillis()-startMillis)+"ms"); +// System.out.print("巡检:"+(System.currentTimeMillis()-startMillis)+"ms"); +// } +// }); +// //智能诊断 +// pool.execute(() -> { +// if (CollectionUtil.isNotEmpty(stationEntityList)) { +// StatisticStatusDTO statisticStatusDTO = new StatisticStatusDTO(); +// List stationIds = stationEntityList.stream().map(StationEntity::getCode).collect(Collectors.toList()); +// String[] stationIdArray = new String[stationIds.size()]; +// stationIds.toArray(stationIdArray); +// statisticStatusDTO.setStationIds(stationIdArray); +// statisticStatusDTO.setThreshold(0.3f); +// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); +// statisticStatusDTO.setStart(formatter.format(LocalDateTime.of(startDate, LocalTime.MIN))); +// statisticStatusDTO.setEnd(formatter.format(LocalDateTime.of(endDate, LocalTime.MAX))); +// R>> diagnoseResult = diagnoseClient.getStatisticStatus(statisticStatusDTO); +// List diagnoseConclusionList = new ArrayList<>(); +// if (diagnoseResult.isSuccess()) { +// Map> statisticStatusVOList = diagnoseResult.getData(); +// statisticStatusVOList.forEach((k, v) -> { +// if (v.size() > 5) { +// v = v.subList(0, 5); +// } +// String diagnoseConclusion = v.stream().map(s -> { +// String riskLevel = ""; +// if (s.getSeverity() >= 3) { +// riskLevel = "高风险"; +// } else if (s.getSeverity() == 2) { +// riskLevel = "一般"; +// } else if (s.getSeverity() == 1) { +// riskLevel = "低风险"; +// } +// String c = "发生在" + s.getOrd() + "的" + s.getName() + ",风险等级:" + riskLevel + ",最后一次出现的时间:" + s.getLastBeginTime() + ";";//,持续时长:"+s.getLongTime()+" +// return c; +// }).collect(Collectors.joining("\n")); +// if (StringUtil.isNotBlank(diagnoseConclusion)) { +// StationEntity stationEntity = stationService.getById(k); +// if (ObjectUtil.isNotEmpty(stationEntity)) { +// diagnoseConclusion = stationEntity.getName() + "本月智能诊断服务预警前五位的可能存在风险的故障信息:\n" + diagnoseConclusion; +// diagnoseConclusionList.add(diagnoseConclusion); +// } +// } +// }); +// stationReportAllVo.setDiagnoseConclusion(diagnoseConclusionList.stream().collect(Collectors.joining("\n"))); +// stationReportAllVo.setStatisticStatusVOList(statisticStatusVOList); +// } +// } +// countDownLatch.countDown(); +// }); +// //所有模板数据获取完成后释放锁 +// try { +// countDownLatch.await(); +// } catch (InterruptedException e) { +// e.printStackTrace(); +// Thread.currentThread().interrupt(); +// } +// //小结 +// this.getStationReportConclusion(stationReportAllVo, params); +// return stationReportAllVo; +// } @Override public StationRunReportAllVO getStationMonthReportV2(String yearAndMonth, DeptVO deptVO) { StationRunReportAllVO stationReportAllVo = new StationRunReportAllVO(); @@ -1217,8 +1217,10 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor //日常维护任务统计 if (CollectionUtil.isNotEmpty(stationReportAllVo.getMaintenanceReportVOList())) { List maintenanceReportVOList = stationReportAllVo.getMaintenanceReportVOList(); - int completeTaskNum = maintenanceReportVOList.stream().filter(vo -> Func.isNotEmpty(vo.getCompleteNum())).mapToInt(RunReportVO::getCompleteNum).sum(); - int incompleteTaskNum = maintenanceReportVOList.stream().filter(vo -> Func.isNotEmpty(vo.getIncompleteNum())).mapToInt(RunReportVO::getIncompleteNum).sum(); + int completeTaskNum = maintenanceReportVOList.stream().filter(vo ->"合计".equals(vo.getUserName())) + .filter(vo -> Func.isNotEmpty(vo.getCompleteNum())).mapToInt(RunReportVO::getCompleteNum).sum(); + int incompleteTaskNum = maintenanceReportVOList.stream().filter(vo ->"合计".equals(vo.getUserName())) + .filter(vo -> Func.isNotEmpty(vo.getIncompleteNum())).mapToInt(RunReportVO::getIncompleteNum).sum(); if (completeTaskNum == 0 && incompleteTaskNum == 0) { conclusion.append("2、无日常维护任务;\r\n"); } else { From f5014ae61cb7a268b6bbb7ace8f8d4a164db3d14 Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Thu, 30 May 2024 18:52:15 +0800 Subject: [PATCH 02/16] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=EF=BC=9A=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E5=85=AC=E4=BC=97=E5=8F=B7=E5=91=8A=E8=AD=A6=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E6=9E=9A=E4=B8=BE=E7=B1=BB=E6=9B=B4=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hnac/hzims/alarm/source/service/impl/MessageServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/MessageServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/MessageServiceImpl.java index 084cf4f..9f7040f 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/MessageServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/MessageServiceImpl.java @@ -207,7 +207,7 @@ public class MessageServiceImpl implements MessageService { // map.put("thing5",Optional.ofNullable(entity.getDeviceCode()).orElse("未知设备")); map.put("thing11",getTruncateString(entity.getAlarmContext(), 20)); map.put("time2",entity.getAlarmTime()); - map.put("thing14", DictCache.getValue("alarm_source", entity.getAlarmSource())); + map.put("thing14", DictCache.getValue("alarm_type", entity.getAlarmType())); message.setMap(map); // 消息内容 message.setContent(entity.getAlarmContext()); From 2b44d23ad1472ae8954729218d14908af2bdbe93 Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Thu, 30 May 2024 19:18:32 +0800 Subject: [PATCH 03/16] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=EF=BC=9A=E5=91=8A?= =?UTF-8?q?=E8=AD=A6=E5=A4=84=E7=90=86=E8=AE=B0=E5=BD=95=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E5=A4=84=E7=90=86=E4=BA=BA=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/hnac/hzims/alarm/show/wrapper/HandleWrapper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/wrapper/HandleWrapper.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/wrapper/HandleWrapper.java index bbb9c23..22bf245 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/wrapper/HandleWrapper.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/wrapper/HandleWrapper.java @@ -18,7 +18,7 @@ public class HandleWrapper extends BaseEntityWrapper Date: Wed, 5 Jun 2024 14:37:29 +0800 Subject: [PATCH 04/16] =?UTF-8?q?#=E7=94=A8=E6=88=B7=E5=8F=8D=E9=A6=88?= =?UTF-8?q?=E6=9B=B4=E6=96=B0sql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scheduled/RealTargetScheduledTask.java | 13 ---- .../service/operation/home/RealTargetService.java | 2 - .../operation/home/impl/RealTargetServiceImpl.java | 71 ++-------------------- .../service/impl/InspectOfflineServiceImpl.java | 35 ++++++----- .../main/service/impl/HydropowerServiceImpl.java | 17 ++++-- 5 files changed, 39 insertions(+), 99 deletions(-) diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java index f71d9d3..9591c87 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java @@ -157,19 +157,6 @@ public class RealTargetScheduledTask { return new ReturnT<>("SUCCESS"); } - /** - * 获取站点近3年发电量数据 - */ - @XxlJob(LOAD_POWER_DATA_NEW) - //@Scheduled(cron = "0/40 * * * * ? ") - public ReturnT loadPowerDataNew(String param) { - if (Func.isBlank(param)) { - param = DateUtil.format(new Date(), "yyyy-MM"); - } - service.loadPowerDataNew(param, Arrays.asList(HomePageConstant.HYDROPOWER,HomePageConstant.PHOTOVOLTAIC),2,3); - return new ReturnT<>("SUCCESS"); - } - @XxlJob(WIND_POWER_GENERATION_RECENT_YEAR) //@Scheduled(cron = "0/40 * * * * ? ") diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/RealTargetService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/RealTargetService.java index 7ea1a7d..485fe48 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/RealTargetService.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/RealTargetService.java @@ -28,7 +28,5 @@ public interface RealTargetService { void loadPowerData(String param, List types, Integer serveType, int year); - void loadPowerDataNew(String param, List types, Integer serveType, int year); - void loadPowerDataByWindEnergy(String param, List types, Integer serveType, int year,String key); } diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java index dfca1da..5536da7 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java @@ -127,7 +127,7 @@ public class RealTargetServiceImpl implements RealTargetService { private final static String load_photovoltaic_target_key = "hzims:operation:photovoltaic:target:key"; // 创建线程池 - private static final ExecutorService pool = new ThreadPoolExecutor(10, 10, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1024), new ThreadFactoryBuilder().setNameFormat("load-power-data-pool-%d").build() , new ThreadPoolExecutor.CallerRunsPolicy()); + //private static final ExecutorService pool = new ThreadPoolExecutor(10, 10, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1024), new ThreadFactoryBuilder().setNameFormat("load-power-data-pool-%d").build() , new ThreadPoolExecutor.CallerRunsPolicy()); @Override public void loadEmInfo(String param) { @@ -1250,9 +1250,8 @@ public class RealTargetServiceImpl implements RealTargetService { // 将站点切割 int limit = countStep(stations.size()); List> limits = Stream.iterate(0, n -> n + 1).limit(limit).parallel().map(a -> stations.stream().skip((long) a * 3).limit(3).parallel().collect(Collectors.toList())).collect(Collectors.toList()); - CountDownLatch countDownLatch = new CountDownLatch(limits.size()); for(List item : limits){ - pool.submit(()->{ + try{ item.forEach(station->{ // 站点设备集合 List stationDevices = devices.stream().filter(device -> device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList()); @@ -1260,74 +1259,16 @@ public class RealTargetServiceImpl implements RealTargetService { if(MapUtils.isEmpty(generateMap)){ return; } + log.error("pool_item_execute_complete: {}" ,JSONObject.toJSONString(generateMap)); powerMap.put(station.getId(),generateMap); }); - countDownLatch.countDown(); - log.error("pool_item_execute_complete: {}" ,item.stream().map(StationEntity::getName).collect(Collectors.toList())); - }); - - } - //所有模板数据获取完成后释放锁 - try { - countDownLatch.await(); - } catch (InterruptedException e) { - e.printStackTrace(); - Thread.currentThread().interrupt(); + }catch (Exception exception){ + log.error("pool_item_execute_complete_error: {}" ,exception.getMessage()); + } } redisTemplate.opsForValue().set(recent_year_power_data, powerMap); } - @Override - public void loadPowerDataNew(String param, List types, Integer serveType, int year) { - // 站点查询 - List stations = stationService.list(new LambdaQueryWrapper() {{ - if (CollectionUtil.isNotEmpty(types)) { - in(StationEntity::getType, types); - } - }}); - // 设备信息 - List devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_cofig_final).toString(), new TypeReference>() { - }); - // 开始时间 - Calendar calendar = Calendar.getInstance(); - calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH) + 12); - calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1); - String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00"; - // 结束日期 - calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) - year); - calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH)); - String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00"; - // 存储数据map :<站点id,<月份,发电量>> - Map> powerMap = new CopyOnWriteMap<>(); - // 将站点切割 - int limit = countStep(stations.size()); - List> limits = Stream.iterate(0, n -> n + 1).limit(limit).parallel().map(a -> stations.stream().skip((long) a * 3).limit(3).parallel().collect(Collectors.toList())).collect(Collectors.toList()); - CountDownLatch countDownLatch = new CountDownLatch(limits.size()); - for(List item : limits){ - pool.submit(()->{ - item.forEach(station->{ - // 站点设备集合 - List stationDevices = devices.stream().filter(device -> device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList()); - Map generateMap = this.lastReduceFirst(station,stationDevices,start,end); - if(MapUtils.isEmpty(generateMap)){ - return; - } - powerMap.put(station.getId(),generateMap); - }); - countDownLatch.countDown(); - log.error("pool_item_execute_complete: {}" ,item.stream().map(StationEntity::getName).collect(Collectors.toList())); - }); - - } - //所有模板数据获取完成后释放锁 - try { - countDownLatch.await(); - } catch (InterruptedException e) { - e.printStackTrace(); - Thread.currentThread().interrupt(); - } - redisTemplate.opsForValue().set(recent_year_power_data_test, JSONObject.toJSONString(powerMap)); - } private Map lastReduceFirst(StationEntity station, List devices, String start, String end) { List datas = new ArrayList<>(); diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/service/impl/InspectOfflineServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/service/impl/InspectOfflineServiceImpl.java index 378ce44..959ac38 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/service/impl/InspectOfflineServiceImpl.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/service/impl/InspectOfflineServiceImpl.java @@ -855,22 +855,27 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { */ @Transactional(rollbackFor = Exception.class) public void updateData(BaseService service, List data) { - if (CollectionUtil.isEmpty(data)) { - return; - } - Map> dataList = data.stream().collect(Collectors.groupingBy(o -> o.getOfflineFlag() != null ? o.getOfflineFlag() : 0)); - //新增 - if (CollectionUtil.isNotEmpty(dataList.get(1))) { - service.saveBatch(dataList.get(1)); - } - //修改 - if (CollectionUtil.isNotEmpty(dataList.get(2))) { - service.updateBatchById(dataList.get(2)); - } - //删除 - if (CollectionUtil.isNotEmpty(dataList.get(3))) { - service.deleteLogic(dataList.get(3).stream().map(SyncBO::getPrimaryKey).collect(Collectors.toList())); + try{ + if (CollectionUtil.isEmpty(data)) { + return; + } + Map> dataList = data.stream().collect(Collectors.groupingBy(o -> o.getOfflineFlag() != null ? o.getOfflineFlag() : 0)); + //新增 + if (CollectionUtil.isNotEmpty(dataList.get(1))) { + service.saveBatch(dataList.get(1)); + } + //修改 + if (CollectionUtil.isNotEmpty(dataList.get(2))) { + service.updateBatchById(dataList.get(2)); + } + //删除 + if (CollectionUtil.isNotEmpty(dataList.get(3))) { + service.deleteLogic(dataList.get(3).stream().map(SyncBO::getPrimaryKey).collect(Collectors.toList())); + } + }catch (Exception exception){ + log.error("offline_update_data : {}",exception.getMessage()); } + } /** diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java index cba31a3..1d72374 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java @@ -403,6 +403,9 @@ public class HydropowerServiceImpl implements HydropowerService { if(CollectionUtil.isEmpty(targetList)){ return; } + // 月发电量 + float powerMon = (float) targetList.stream().filter(o-> deptId.equals(o.getDeptId())).mapToDouble(HydropowerUnitTargetVo::getPowerMon).sum(); + response.setPowerYear(powerMon); // 年发电量 float powerYear = (float) targetList.stream().filter(o-> deptId.equals(o.getDeptId())).mapToDouble(HydropowerUnitTargetVo::getPowerYear).sum(); response.setPowerYear(powerYear); @@ -428,7 +431,10 @@ public class HydropowerServiceImpl implements HydropowerService { return; } String month = DateUtil.format(new Date(),"yyyy-MM") + "-01"; - response.setPowerMon(map.get(id).getOrDefault(month, 0f)); + float powerMon = map.get(id).getOrDefault(month, 0f); + if(powerMon > 0){ + response.setPowerMon(powerMon); + } } @@ -650,14 +656,17 @@ public class HydropowerServiceImpl implements HydropowerService { if (MapUtils.isEmpty(map)) { return kpi; } - String month = DateUtil.format(new Date(),"yyyy-MM") + "-01"; // 当月发电量 - kpi.setGenerateMon(map.entrySet().stream().filter(o->stations.stream().map(StationEntity::getId).collect(Collectors.toList()).contains(o.getKey())).mapToDouble(entry->{ + String month = DateUtil.format(new Date(),"yyyy-MM") + "-01"; + double generateMon = map.entrySet().stream().filter(o->stations.stream().map(StationEntity::getId).collect(Collectors.toList()).contains(o.getKey())).mapToDouble(entry->{ if(entry.getValue().containsKey(month)){ return Double.valueOf(entry.getValue().get(month)); } return 0.0; - }).sum()); + }).sum(); + if(generateMon > 0){ + kpi.setGenerateMon(generateMon); + } // 今年发电趋势 kpi.setPowerMonthVoList(this.handlePowerFinish(stations,map)); // 近3年发电量 From f645f1e98a86dea36c5802ea0028173dd79b5e14 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Thu, 6 Jun 2024 16:36:19 +0800 Subject: [PATCH 05/16] =?UTF-8?q?#=E7=AB=99=E7=82=B9=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E3=80=81=E9=9B=86=E4=B8=AD=E7=9B=91=E6=8E=A7=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E4=B8=8B=E9=99=90=E6=B0=B4=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/operational/main/vo/RealStationVo.java | 3 +++ .../monitor/service/impl/AlarmSaveServiceImpl.java | 10 ++++---- .../operation/home/impl/RealTargetServiceImpl.java | 28 ++++++++++++---------- .../operation/monitor/impl/MonitorServiceImpl.java | 1 + .../service/impl/RealMonitorServiceImpl.java | 6 ++--- 5 files changed, 29 insertions(+), 19 deletions(-) diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/RealStationVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/RealStationVo.java index 326fb58..7943bcb 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/RealStationVo.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/RealStationVo.java @@ -34,6 +34,9 @@ public class RealStationVo implements Serializable { @ApiModelProperty("最大前池水位") private Double waterLevelMax; + @ApiModelProperty("下限前池水位") + private Double downWaterLevel; + @ApiModelProperty("前池水位") private Double waterLevel; diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java index 97633b9..649e154 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java @@ -18,6 +18,8 @@ import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.core.tool.utils.StringUtil; +import org.springblade.server.domain.Sys; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Service; @@ -88,9 +90,10 @@ public class AlarmSaveServiceImpl implements AlarmSaveService { } } } - // fpd告警拼接 - if(AlarmConstants.EARLY_WARNING.equals(alarm.getAlarmSource())){ - alarm.setAlarmContext(optional.get().getName() + "." + alarm.getAlarmContext()); + // 告警站点名称截取 + if(StringUtil.isNotBlank(alarm.getAlarmContext()) && !AlarmConstants.CONDITION_ALARM.equals(alarm.getAlarmSource())){ + String[] countext = alarm.getAlarmContext().split("\\."); + alarm.setAlarmContext(countext[countext.length - 1]); } // 步骤3.站点参数设置 alarm.setCreateDept(optional.get().getCreateDept()); @@ -126,5 +129,4 @@ public class AlarmSaveServiceImpl implements AlarmSaveService { }); return true; } - } \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java index 5536da7..847fd19 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java @@ -127,7 +127,7 @@ public class RealTargetServiceImpl implements RealTargetService { private final static String load_photovoltaic_target_key = "hzims:operation:photovoltaic:target:key"; // 创建线程池 - //private static final ExecutorService pool = new ThreadPoolExecutor(10, 10, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1024), new ThreadFactoryBuilder().setNameFormat("load-power-data-pool-%d").build() , new ThreadPoolExecutor.CallerRunsPolicy()); + private static final ExecutorService pool = new ThreadPoolExecutor(10, 10, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1024), new ThreadFactoryBuilder().setNameFormat("load-power-data-pool-%d").build() , new ThreadPoolExecutor.CallerRunsPolicy()); @Override public void loadEmInfo(String param) { @@ -1250,20 +1250,24 @@ public class RealTargetServiceImpl implements RealTargetService { // 将站点切割 int limit = countStep(stations.size()); List> limits = Stream.iterate(0, n -> n + 1).limit(limit).parallel().map(a -> stations.stream().skip((long) a * 3).limit(3).parallel().collect(Collectors.toList())).collect(Collectors.toList()); + CountDownLatch countDownLatch = new CountDownLatch(limits.size()); for(List item : limits){ try{ - item.forEach(station->{ - // 站点设备集合 - List stationDevices = devices.stream().filter(device -> device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList()); - Map generateMap = this.getGenerateYear(station,stationDevices,start,end); - if(MapUtils.isEmpty(generateMap)){ - return; - } - log.error("pool_item_execute_complete: {}" ,JSONObject.toJSONString(generateMap)); - powerMap.put(station.getId(),generateMap); + pool.submit(()->{ + item.forEach(station->{ + // 站点设备集合 + List stationDevices = devices.stream().filter(device -> device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList()); + Map generateMap = this.getGenerateYear(station,stationDevices,start,end); + if(MapUtils.isEmpty(generateMap)){ + return; + } + powerMap.put(station.getId(),generateMap); + }); + countDownLatch.countDown(); + log.error("pool_item_execute_complete: {}" ,item.stream().map(StationEntity::getName).collect(Collectors.toList())); }); - }catch (Exception exception){ - log.error("pool_item_execute_complete_error: {}" ,exception.getMessage()); + }catch (Exception e){ + log.error("pool_item_execute_complete_error : {}" ,e.getMessage()); } } redisTemplate.opsForValue().set(recent_year_power_data, powerMap); diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java index 13b41ce..0547edb 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java @@ -500,6 +500,7 @@ public class MonitorServiceImpl implements MonitorService { } realStation.setStationCode(optional.get().getCode()); realStation.setStationName(optional.get().getName()); + realStation.setDownWaterLevel(Optional.ofNullable(optional.get().getDownWaterLevel()).orElse(0.0)); realStation.setWaterLevelMax(Optional.ofNullable(optional.get().getLimitWaterLevel()).orElse(0.0)); realStation.setServerType(optional.get().getServeType()); realStation.setStationDeptId(optional.get().getRefDept()); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java index 251a618..1d7b99e 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java @@ -336,12 +336,12 @@ public class RealMonitorServiceImpl implements IRealMonitorService { return; } station.setWaterLevel(levelList.get(0)); - if(ObjectUtil.isEmpty(station.getWaterLevelMax()) || ObjectUtil.isEmpty(station.getWaterLevel()) || station.getWaterLevelMax() <= 0 || station.getWaterLevel() <= 0){ + if(station.getWaterLevel() <= 0){ return; } - if(station.getWaterLevelMax() < station.getWaterLevel()){ + if(station.getWaterLevelMax() < station.getWaterLevel() || station.getDownWaterLevel() > station.getWaterLevel()){ station.setWaterColor(2); - }else if((station.getWaterLevel() / station.getWaterLevelMax()) > 0.9){ + }else if((station.getWaterLevelMax() > 0 && (station.getWaterLevel() / station.getWaterLevelMax()) > 0.8) || (station.getDownWaterLevel() > 0 && (station.getWaterLevel() / station.getDownWaterLevel()) < 1.2)){ station.setWaterColor(1); } } From 9faf4865e9a66029d062be7e34fdcef7cf4f4065 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Thu, 6 Jun 2024 16:36:36 +0800 Subject: [PATCH 06/16] =?UTF-8?q?#=E7=AB=99=E7=82=B9=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E3=80=81=E9=9B=86=E4=B8=AD=E7=9B=91=E6=8E=A7=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E4=B8=8B=E9=99=90=E6=B0=B4=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hnac/hzims/alarm/source/service/impl/MessageServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/MessageServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/MessageServiceImpl.java index 9f7040f..0156355 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/MessageServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/MessageServiceImpl.java @@ -86,7 +86,7 @@ public class MessageServiceImpl implements MessageService { message.setSubject(MessageConstants.BusinessClassifyEnum.WARNING.getDescription()); message.setTaskId(entity.getId()); message.setTenantId(stationByCode.getData().getTenantId()); - message.setContent(entity.getAlarmContext()); + message.setContent(entity.getStationName() + "." +entity.getAlarmContext()); message.setDeptId(dept); R deptName = sysClient.getDeptName(dept); if (deptName.isSuccess()) { From 5bfe349416c086606c3206eff1f9a738f51e8ab8 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Thu, 6 Jun 2024 16:37:03 +0800 Subject: [PATCH 07/16] =?UTF-8?q?#=E7=AB=99=E7=82=B9=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E3=80=81=E9=9B=86=E4=B8=AD=E7=9B=91=E6=8E=A7=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E4=B8=8B=E9=99=90=E6=B0=B4=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hnac/hzims/operational/station/entity/StationEntity.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java index 4d93882..34e6b42 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java @@ -99,6 +99,11 @@ public class StationEntity extends TenantEntity implements Serializable { @TableField(updateStrategy = FieldStrategy.IGNORED) private Double waterLevelMax; + @ApiModelProperty("前池下限水位") + @JsonSerialize(nullsUsing = NullSerializer.class) + @TableField(updateStrategy = FieldStrategy.IGNORED) + private Double downWaterLevel; + @ApiModelProperty("经度(东经)") @JsonSerialize(nullsUsing = NullSerializer.class) private Float lgtd; From a0645f08a583e75b556c4f00c5a481f1d326a3b7 Mon Sep 17 00:00:00 2001 From: liwen Date: Thu, 30 May 2024 13:53:09 +0800 Subject: [PATCH 08/16] =?UTF-8?q?add:=20=E8=BD=A6=E6=A3=80=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/safeproduct/dto/CarCheckTemplateDTO.java | 25 ++++ .../entity/CarCheckTemplateDetailEntity.java | 39 +++++ .../safeproduct/entity/CarCheckTemplateEntity.java | 26 ++++ .../safeproduct/vo/CarCheckTemplateDetailVO.java | 25 ++++ .../feedback/mapper/UserFeedbackMapper.xml | 13 ++ .../safeproduct/controller/CarController.java | 69 +++++---- .../mapper/CarCheckTemplateDetailMapper.java | 15 ++ .../mapper/CarCheckTemplateDetailMapper.xml | 5 + .../safeproduct/mapper/CarCheckTemplateMapper.java | 20 +++ .../service/ICarCheckTemplateService.java | 61 ++++++++ .../service/impl/CarCheckRecordServiceImpl.java | 67 +++++---- .../impl/CarCheckTemplateDetailServiceImpl.java | 37 +++++ .../service/impl/CarCheckTemplateServiceImpl.java | 161 +++++++++++++++++++++ .../impl/ICarCheckTemplateDetailService.java | 28 ++++ .../safeproduct/src/main/resources/db/2.0.1.sql | 32 +++- 15 files changed, 572 insertions(+), 51 deletions(-) create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/CarCheckTemplateDTO.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarCheckTemplateDetailEntity.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarCheckTemplateEntity.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarCheckTemplateDetailVO.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckTemplateDetailMapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckTemplateDetailMapper.xml create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckTemplateMapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarCheckTemplateService.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckTemplateDetailServiceImpl.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckTemplateServiceImpl.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ICarCheckTemplateDetailService.java diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/CarCheckTemplateDTO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/CarCheckTemplateDTO.java new file mode 100644 index 0000000..6e3dbff --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/CarCheckTemplateDTO.java @@ -0,0 +1,25 @@ +package com.hnac.hzims.safeproduct.dto; + +import com.hnac.hzims.safeproduct.entity.CarCheckTemplateDetailEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @date 2024-05-30 + */ +@Data +@ApiModel(value = "车检记录模板DTO类") +public class CarCheckTemplateDTO { + + @ApiModelProperty("模板id") + private Long id; + + @ApiModelProperty("模板名称") + private String templateName; + + @ApiModelProperty("模板详情列表") + private List detailList; +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarCheckTemplateDetailEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarCheckTemplateDetailEntity.java new file mode 100644 index 0000000..97c666c --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarCheckTemplateDetailEntity.java @@ -0,0 +1,39 @@ +package com.hnac.hzims.safeproduct.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.mp.base.BaseEntity; + +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +/** + * 车检模板详情服务类 + * + * @date 2024-05-30 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("hzims_car_check_template_detail") +@ApiModel(value = "车检模板详情实体类") +public class CarCheckTemplateDetailEntity extends BaseEntity { + + @ApiModelProperty("车检记录id") + private Long templateId; + + @NotNull + @Size(max = 500, message = "检查项目长度不能超过50") + @ApiModelProperty("检查项目") + private String checkItem; + + @NotNull + @ApiModelProperty("检查内容") + private String checkContent; + + @NotNull + @ApiModelProperty("检查结果") + private String checkResult; +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarCheckTemplateEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarCheckTemplateEntity.java new file mode 100644 index 0000000..f761d43 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarCheckTemplateEntity.java @@ -0,0 +1,26 @@ +package com.hnac.hzims.safeproduct.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.mp.base.BaseEntity; + +/** + * @date 2024-05-28 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("hzims_car_check_template") +@ApiModel(value = "车检模板实体类") +public class CarCheckTemplateEntity extends BaseEntity { + + @ApiModelProperty("模板名称") + private String templateName; + + @TableField(exist = false) + @ApiModelProperty("创建机构名称") + private String createDeptName; +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarCheckTemplateDetailVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarCheckTemplateDetailVO.java new file mode 100644 index 0000000..ef217f4 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarCheckTemplateDetailVO.java @@ -0,0 +1,25 @@ +package com.hnac.hzims.safeproduct.vo; + +import com.hnac.hzims.safeproduct.entity.CarCheckTemplateDetailEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @date 2024-05-30 + */ +@Data +@ApiModel(value = "车检模板详情VO类") +public class CarCheckTemplateDetailVO { + + @ApiModelProperty("模板id") + private Long id; + + @ApiModelProperty("模板名称") + private String templateName; + + @ApiModelProperty("模板详情列表") + private List templateDetailList; +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/feedback/mapper/UserFeedbackMapper.xml b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/feedback/mapper/UserFeedbackMapper.xml index 31cee66..418022c 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/feedback/mapper/UserFeedbackMapper.xml +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/feedback/mapper/UserFeedbackMapper.xml @@ -2,4 +2,17 @@ + \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/CarController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/CarController.java index 2f1c8c8..d88ca90 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/CarController.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/CarController.java @@ -5,6 +5,7 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.hnac.hzims.common.utils.Condition; import com.hnac.hzims.safeproduct.Constants; import com.hnac.hzims.safeproduct.dto.CarCheckRecordDTO; +import com.hnac.hzims.safeproduct.dto.CarCheckTemplateDTO; import com.hnac.hzims.safeproduct.dto.CarMaintenanceConfirmationDTO; import com.hnac.hzims.safeproduct.dto.CarUsedRecordConfirmationDTO; import com.hnac.hzims.safeproduct.entity.*; @@ -54,6 +55,8 @@ public class CarController extends BladeController { private final ICarInsuranceService carInsuranceService; + private final ICarCheckTemplateService carCheckTemplateService; + @PostMapping("/saveCar") @ApiOperation(value = "新增车辆") @ApiOperationSupport(order = 1) @@ -269,31 +272,47 @@ public class CarController extends BladeController { return R.data(page); } -// @ApiOperation(value = "新增车检记录模板") -// @ApiOperationSupport(order = 39) -// public R saveCarCheckRecordTemplate() { -// -// } -// -// @ApiOperationSupport(order = 40) -// public R updateCarCheckRecordTemplate() { -// -// } -// -// @ApiOperationSupport(order = 41) -// public R removeCarCheckRecordTemplate() { -// -// } -// -// @ApiOperationSupport(order = 42) -// public R carCheckRecordTemplateDetail() { -// -// } -// -// @ApiOperationSupport(order = 43) -// public R carCheckRecordTemplatePage() { -// -// } + @PostMapping("/saveCarCheckTemplate") + @ApiOperation(value = "新增车检模板") + @ApiOperationSupport(order = 39) + @Operate(label = "新增车检模板", type = BusinessType.INSERT, ignore = false) + public R saveCarCheckTemplate(@RequestBody CarCheckTemplateDTO dto) { + return R.status(carCheckTemplateService.saveCarCheckTemplate(dto)); + } + + @PostMapping("/updateCarCheckTemplate") + @ApiOperation(value = "修改车检模板") + @ApiOperationSupport(order = 40) + @Operate(label = "修改车检模板", type = BusinessType.UPDATE, ignore = false) + public R updateCarCheckTemplate(@RequestBody CarCheckTemplateDTO dto) { + return R.status(carCheckTemplateService.updateCarCheckTemplate(dto)); + } + + @GetMapping("/removeCarCheckTemplate") + @ApiOperation(value = "删除车检模板") + @ApiOperationSupport(order = 41) + @Operate(label = "删除车检模板", type = BusinessType.DELETE, ignore = false) + public R removeCarCheckTemplate(@RequestParam Long id) { + return R.status(carCheckTemplateService.removeCarCheckTemplate(id)); + } + + @GetMapping("/carCheckTemplateDetail") + @ApiOperation(value = "车检模板详情") + @ApiOperationSupport(order = 42) + @Operate(label = "车检模板详情", type = BusinessType.QUERY, ignore = false) + public R carCheckTemplateDetail(@RequestParam Long id) { + CarCheckTemplateDetailVO vo = carCheckTemplateService.getCarCheckTemplateDetail(id); + return R.data(vo); + } + + @GetMapping("/carCheckTemplatePage") + @ApiOperation(value = "车检模板分页") + @ApiOperationSupport(order = 43) + @Operate(label = "车检模板分页", type = BusinessType.QUERY, ignore = false) + public R> carCheckTemplatePage(@ApiIgnore @RequestParam Map param, Query query) { + IPage page = carCheckTemplateService.getCarCheckTemplatePage(query, param); + return R.data(page); + } @GetMapping("/exportCarMaintenanceData") @ApiOperation(value = "导出车辆维保记录单") diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckTemplateDetailMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckTemplateDetailMapper.java new file mode 100644 index 0000000..5c01a05 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckTemplateDetailMapper.java @@ -0,0 +1,15 @@ +package com.hnac.hzims.safeproduct.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzims.safeproduct.entity.CarCheckTemplateDetailEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 车检模板详情Mapper类 + * + * @date 2024-05-30 + */ +@Mapper +public interface CarCheckTemplateDetailMapper extends BaseMapper { + +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckTemplateDetailMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckTemplateDetailMapper.xml new file mode 100644 index 0000000..1c367c4 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckTemplateDetailMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckTemplateMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckTemplateMapper.java new file mode 100644 index 0000000..ccf72f9 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckTemplateMapper.java @@ -0,0 +1,20 @@ +package com.hnac.hzims.safeproduct.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.hnac.hzims.safeproduct.entity.CarCheckTemplateEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.Map; + +@Mapper +public interface CarCheckTemplateMapper extends BaseMapper { + + /** + * 车检分页 + * @param page 分页类 + * @param param 参数 + * @return 分页 + */ + IPage getCarCheckTemplatePage(IPage page, Map param); +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarCheckTemplateService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarCheckTemplateService.java new file mode 100644 index 0000000..58dc07e --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarCheckTemplateService.java @@ -0,0 +1,61 @@ +package com.hnac.hzims.safeproduct.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.hnac.hzims.safeproduct.dto.CarCheckTemplateDTO; +import com.hnac.hzims.safeproduct.entity.CarCheckTemplateEntity; +import com.hnac.hzims.safeproduct.vo.CarCheckTemplateDetailVO; +import org.springblade.core.mp.support.Query; + +import java.util.Map; + +/** + * 车检模板服务类 + * + * @date 2024-05-28 + */ +public interface ICarCheckTemplateService extends IService { + + /** + * 新增车检模板 + * @param dto 车检模板dto类 + * @return true-成功,false-失败 + */ + boolean saveCarCheckTemplate(CarCheckTemplateDTO dto); + + /** + * 根据名称获取车检模板 + * @param name 模板名称 + * @return 车检模板实体类 + */ + CarCheckTemplateEntity getCarCheckTemplateByName(String name); + + /** + * 修改车检模板 + * @param dto 车检模板dto类 + * @return true-成功,false-失败 + */ + boolean updateCarCheckTemplate(CarCheckTemplateDTO dto); + + /** + * 删除车检模板 + * @param id 模板id + * @return true-成功,false-失败 + */ + boolean removeCarCheckTemplate(Long id); + + /** + * 车检模板详情 + * @param id 模板id + * @return 模板详情VO类 + */ + CarCheckTemplateDetailVO getCarCheckTemplateDetail(Long id); + + /** + * 车检分页 + * @param query 分页类 + * @param param 参数 + * @return 分页 + */ + IPage getCarCheckTemplatePage(Query query, Map param); +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java index 864dd53..69ae394 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java @@ -18,6 +18,7 @@ import com.hnac.hzims.safeproduct.service.ICarCheckRecordService; import com.hnac.hzims.safeproduct.utils.BaseUtil; import com.hnac.hzims.safeproduct.vo.CarCheckRecordDetailVO; import com.hnac.hzims.safeproduct.vo.CarCheckRecordPageVO; +import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.utils.BeanUtil; import org.springframework.beans.factory.annotation.Autowired; @@ -68,15 +69,16 @@ public class CarCheckRecordServiceImpl extends ServiceImpl itemList = carCheckRecordDTO.getItemList(); - itemList.forEach(x -> x.setCarCheckRecordId(recordEntity.getId())); - return carCheckItemService.saveBatch(itemList); + if (!saveRecord) { + throw new ServiceException("车检记录新增失败"); } - return false; + // 新增车检项 + CarCheckRecordEntity recordEntity = getCarCheckRecordByCode(code); + List itemList = carCheckRecordDTO.getItemList(); + itemList.forEach(x -> x.setCarCheckRecordId(recordEntity.getId())); + return carCheckItemService.saveBatch(itemList); } /** @@ -104,7 +106,19 @@ public class CarCheckRecordServiceImpl extends ServiceImpl itemList = carCheckItemService.getListByCarCheckRecordId(id); - carCheckRecordDetailVO.setCheckItemList(itemList); + List checkItemList = new ArrayList<>(); + itemList.forEach(item -> { + String[] contents = item.getCheckContent().split(",|,"); + String[] results = item.getCheckResult().split(",|,"); + for (int i = 0; i < contents.length; i++) { + CarCheckItemEntity carCheckItemEntity = new CarCheckItemEntity(); + carCheckItemEntity.setCheckItem(item.getCheckItem()); + carCheckItemEntity.setCheckContent(contents[i]); + carCheckItemEntity.setCheckResult(results[i]); + checkItemList.add(carCheckItemEntity); + } + }); + carCheckRecordDetailVO.setCheckItemList(checkItemList); return carCheckRecordDetailVO; } return null; @@ -157,22 +171,25 @@ public class CarCheckRecordServiceImpl extends ServiceImpl itemList = carCheckRecordDTO.getItemList(); - itemList.forEach(x -> {x.setCarCheckRecordId(carCheckRecordDTO.getId()); - x.setId(null);}); - boolean b = carCheckItemService.saveBatch(itemList); - if (b) { - // 若更新检查项成功,则更新车检记录 - CarCheckRecordEntity carCheckRecordEntity = new CarCheckRecordEntity(); - BeanUtil.copyProperties(carCheckRecordDTO, carCheckRecordEntity); - return this.updateById(carCheckRecordEntity); + // 删除旧的检查项 + boolean deleteItem = carCheckItemService.removeRelativeCarCheckItem(carCheckRecordDTO.getId()); + if (!deleteItem) { + throw new ServiceException("旧的车检记录检查项删除失败"); } - return false; + // 新增新的检查项 + List itemList = carCheckRecordDTO.getItemList(); + itemList.forEach(x -> { + x.setCarCheckRecordId(carCheckRecordDTO.getId()); +// x.setId(null); + }); + return carCheckItemService.saveBatch(itemList); } /** @@ -182,10 +199,10 @@ public class CarCheckRecordServiceImpl extends ServiceImpl + implements ICarCheckTemplateDetailService { + + /** + * 删除关联的模板详情数据 + */ + @Override + public boolean removeReferenceDetail(Long templateId) { + List list = this.getReferenceDetail(templateId); + List ids = list.stream().map(CarCheckTemplateDetailEntity::getId).collect(Collectors.toList()); + return this.removeByIds(ids); + } + + @Override + public List getReferenceDetail(Long templateId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(CarCheckTemplateDetailEntity::getTemplateId, templateId); + return this.list(queryWrapper); + } +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckTemplateServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckTemplateServiceImpl.java new file mode 100644 index 0000000..fe2c069 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckTemplateServiceImpl.java @@ -0,0 +1,161 @@ +package com.hnac.hzims.safeproduct.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hnac.hzims.safeproduct.dto.CarCheckTemplateDTO; +import com.hnac.hzims.safeproduct.entity.*; +import com.hnac.hzims.safeproduct.mapper.CarCheckTemplateMapper; +import com.hnac.hzims.safeproduct.service.ICarCheckTemplateService; +import com.hnac.hzims.safeproduct.vo.CarCheckTemplateDetailVO; +import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; +import org.springblade.system.feign.ISysClient; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + +/** + * 车检模板服务实现类 + * + * @date 2024-05-28 + */ +@Service +public class CarCheckTemplateServiceImpl extends ServiceImpl implements ICarCheckTemplateService { + + @Autowired + ICarCheckTemplateDetailService carCheckTemplateDetailService; + + @Resource + CarCheckTemplateMapper carCheckTemplateMapper; + + @Autowired + ISysClient sysClient; + + /** + * 新增车检模板 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public boolean saveCarCheckTemplate(CarCheckTemplateDTO dto) { + String templateName = dto.getTemplateName(); + // 重名校验 + CarCheckTemplateEntity template = getCarCheckTemplateByName(templateName); + if (template != null) { + throw new ServiceException("模板名不可重复"); + } + // 新增车检模板 + CarCheckTemplateEntity templateEntity = new CarCheckTemplateEntity(); + templateEntity.setTemplateName(templateName); + boolean saveTemplate = this.save(templateEntity); + if (!saveTemplate) { + throw new ServiceException("车检模板新增失败"); + } + // 新增模板详情 + template = getCarCheckTemplateByName(templateName); + List details = dto.getDetailList(); + for (CarCheckTemplateDetailEntity detail : details) { + detail.setTemplateId(template.getId()); + } + return carCheckTemplateDetailService.saveBatch(details); + } + + /** + * 根据名称获取车检模板 + */ + public CarCheckTemplateEntity getCarCheckTemplateByName(String name) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(CarCheckTemplateEntity::getTemplateName, name); + return this.getOne(queryWrapper); + } + + /** + * 修改车检模板 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public boolean updateCarCheckTemplate(CarCheckTemplateDTO dto) { + String templateName = dto.getTemplateName(); + Long templateId = dto.getId(); + // 重名校验 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(CarCheckTemplateEntity::getTemplateName, templateName); + queryWrapper.lambda().ne(CarCheckTemplateEntity::getId, templateId); + CarCheckTemplateEntity template = this.getOne(queryWrapper); + if (template != null) { + throw new ServiceException("模板名不可重复"); + } + // 更新模板 + CarCheckTemplateEntity templateEntity = new CarCheckTemplateEntity(); + templateEntity.setId(templateId); + templateEntity.setTemplateName(templateName); + boolean updateTemplate = this.updateById(templateEntity); + if (!updateTemplate) { + throw new ServiceException("车检模板更新失败"); + } + // 更新模板详情 + // 删除旧的模板详情数据 + boolean removeDetail = carCheckTemplateDetailService.removeReferenceDetail(templateId); + if (!removeDetail) { + throw new ServiceException("车检模板详情数据删除失败"); + } + // 新增新的模板详情数据 + List detailList = dto.getDetailList(); + for (CarCheckTemplateDetailEntity detail : detailList) { + detail.setTemplateId(templateId); + } + return carCheckTemplateDetailService.saveBatch(detailList); + } + + /** + * 删除车检模板 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public boolean removeCarCheckTemplate(Long id) { + boolean removeTemplate = this.removeById(id); + if (!removeTemplate) { + throw new ServiceException("车检模板删除失败"); + } + return carCheckTemplateDetailService.removeReferenceDetail(id); + } + + /** + * 车检模板详情 + */ + @Override + public CarCheckTemplateDetailVO getCarCheckTemplateDetail(Long id) { + CarCheckTemplateEntity templateEntity = this.getById(id); + CarCheckTemplateDetailVO vo = new CarCheckTemplateDetailVO(); + vo.setId(templateEntity.getId()); + vo.setTemplateName(templateEntity.getTemplateName()); + List list = carCheckTemplateDetailService.getReferenceDetail(id); + vo.setTemplateDetailList(list); + return vo; + } + + /** + * 车检分页 + */ + @Override + public IPage getCarCheckTemplatePage(Query query, Map param) { + IPage page = new Page<>(query.getCurrent(), query.getSize()); + IPage templatePage = carCheckTemplateMapper.getCarCheckTemplatePage(page, param); + List templateList = templatePage.getRecords(); + // 获取机构名 + templateList.forEach(template -> { + R deptName = sysClient.getDeptName(template.getCreateDept()); + if (deptName.isSuccess()) { + template.setCreateDeptName(deptName.getData()); + } + }); + templatePage.setRecords(templateList); + return templatePage; + } +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ICarCheckTemplateDetailService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ICarCheckTemplateDetailService.java new file mode 100644 index 0000000..3a7315a --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ICarCheckTemplateDetailService.java @@ -0,0 +1,28 @@ +package com.hnac.hzims.safeproduct.service.impl; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hnac.hzims.safeproduct.entity.CarCheckTemplateDetailEntity; + +import java.util.List; + +/** + * 车检模板详情服务类 + * + * @date 2024-05-30 + */ +public interface ICarCheckTemplateDetailService extends IService { + + /** + * 删除关联的模板详情数据 + * @param templateId 模板id + * @return true-成功,false-失败 + */ + boolean removeReferenceDetail(Long templateId); + + /** + * 查询关联的模板详情列表 + * @param templateId 模板id + * @return 模板详情列表 + */ + List getReferenceDetail(Long templateId); +} diff --git a/hzims-service/safeproduct/src/main/resources/db/2.0.1.sql b/hzims-service/safeproduct/src/main/resources/db/2.0.1.sql index 516bede..733ffca 100644 --- a/hzims-service/safeproduct/src/main/resources/db/2.0.1.sql +++ b/hzims-service/safeproduct/src/main/resources/db/2.0.1.sql @@ -46,4 +46,34 @@ CREATE TABLE IF NOT EXISTS `hzims_hygiene_template_detail` ( -- 添加考试及格分字段 ALTER TABLE hzims_test - ADD COLUMN passing_score int(10) NOT NULL DEFAULT 60 COMMENT '考试及格分'; \ No newline at end of file + ADD COLUMN passing_score int(10) NOT NULL DEFAULT 60 COMMENT '考试及格分'; + +-- 新增车检模板表 +CREATE TABLE IF NOT EXISTS `hzims_hygiene_template` ( + `id` bigint(20) NOT NULL COMMENT '主键ID', + `template_name` varchar(50) NOT NULL COMMENT '模板名称', + `create_user` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建人', + `create_dept` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建部门', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_user` bigint(20) DEFAULT '-1' COMMENT '更新人', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间', + `status` int(2) NOT NULL DEFAULT '1' COMMENT '状态', + `is_deleted` int(2) NOT NULL DEFAULT '0' COMMENT '逻辑删除状态:0-未删除,1-删除', + PRIMARY KEY (`id`) USING BTREE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='车检模板表'; + +-- 新增车检模板详情表 +CREATE TABLE IF NOT EXISTS `hzims_hygiene_template_detail` ( + `id` bigint(20) NOT NULL COMMENT '主键ID', + `template_id` bigint(20) NOT NULL COMMENT '模板id', + `check_item` varchar(500) NOT NULL COMMENT '检查项目', + `check_content` mediumtext NOT NULL COMMENT '检查内容', + `create_user` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建人', + `create_dept` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建部门', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_user` bigint(20) DEFAULT '-1' COMMENT '更新人', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间', + `status` int(2) NOT NULL DEFAULT '1' COMMENT '状态', + `is_deleted` int(2) NOT NULL DEFAULT '0' COMMENT '逻辑删除状态:0-未删除,1-删除', + PRIMARY KEY (`id`) USING BTREE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='车检模板详情表'; \ No newline at end of file From af6f15604865463a859f348e0c23d4ab00540275 Mon Sep 17 00:00:00 2001 From: liwen Date: Mon, 3 Jun 2024 14:37:09 +0800 Subject: [PATCH 09/16] =?UTF-8?q?update:=20=E8=BD=A6=E6=A3=80=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/CarCheckTemplateDetailEntity.java | 4 ---- .../safeproduct/mapper/CarCheckTemplateMapper.xml | 18 ++++++++++++++++++ .../service/impl/CarCheckRecordServiceImpl.java | 16 +--------------- .../safeproduct/src/main/resources/db/2.0.1.sql | 8 ++++---- 4 files changed, 23 insertions(+), 23 deletions(-) create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckTemplateMapper.xml diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarCheckTemplateDetailEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarCheckTemplateDetailEntity.java index 97c666c..387b8a5 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarCheckTemplateDetailEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarCheckTemplateDetailEntity.java @@ -32,8 +32,4 @@ public class CarCheckTemplateDetailEntity extends BaseEntity { @NotNull @ApiModelProperty("检查内容") private String checkContent; - - @NotNull - @ApiModelProperty("检查结果") - private String checkResult; } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckTemplateMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckTemplateMapper.xml new file mode 100644 index 0000000..cf3e0ba --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckTemplateMapper.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java index 69ae394..ce72167 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java @@ -29,7 +29,6 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.math.BigDecimal; -import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; @@ -106,19 +105,7 @@ public class CarCheckRecordServiceImpl extends ServiceImpl itemList = carCheckItemService.getListByCarCheckRecordId(id); - List checkItemList = new ArrayList<>(); - itemList.forEach(item -> { - String[] contents = item.getCheckContent().split(",|,"); - String[] results = item.getCheckResult().split(",|,"); - for (int i = 0; i < contents.length; i++) { - CarCheckItemEntity carCheckItemEntity = new CarCheckItemEntity(); - carCheckItemEntity.setCheckItem(item.getCheckItem()); - carCheckItemEntity.setCheckContent(contents[i]); - carCheckItemEntity.setCheckResult(results[i]); - checkItemList.add(carCheckItemEntity); - } - }); - carCheckRecordDetailVO.setCheckItemList(checkItemList); + carCheckRecordDetailVO.setCheckItemList(itemList); return carCheckRecordDetailVO; } return null; @@ -187,7 +174,6 @@ public class CarCheckRecordServiceImpl extends ServiceImpl itemList = carCheckRecordDTO.getItemList(); itemList.forEach(x -> { x.setCarCheckRecordId(carCheckRecordDTO.getId()); -// x.setId(null); }); return carCheckItemService.saveBatch(itemList); } diff --git a/hzims-service/safeproduct/src/main/resources/db/2.0.1.sql b/hzims-service/safeproduct/src/main/resources/db/2.0.1.sql index 733ffca..4c2497b 100644 --- a/hzims-service/safeproduct/src/main/resources/db/2.0.1.sql +++ b/hzims-service/safeproduct/src/main/resources/db/2.0.1.sql @@ -49,7 +49,7 @@ ALTER TABLE hzims_test ADD COLUMN passing_score int(10) NOT NULL DEFAULT 60 COMMENT '考试及格分'; -- 新增车检模板表 -CREATE TABLE IF NOT EXISTS `hzims_hygiene_template` ( +CREATE TABLE IF NOT EXISTS `hzims_car_check_template` ( `id` bigint(20) NOT NULL COMMENT '主键ID', `template_name` varchar(50) NOT NULL COMMENT '模板名称', `create_user` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建人', @@ -60,10 +60,10 @@ CREATE TABLE IF NOT EXISTS `hzims_hygiene_template` ( `status` int(2) NOT NULL DEFAULT '1' COMMENT '状态', `is_deleted` int(2) NOT NULL DEFAULT '0' COMMENT '逻辑删除状态:0-未删除,1-删除', PRIMARY KEY (`id`) USING BTREE - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='车检模板表'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='车检模板表'; -- 新增车检模板详情表 -CREATE TABLE IF NOT EXISTS `hzims_hygiene_template_detail` ( +CREATE TABLE IF NOT EXISTS `hzims_car_check_template_detail` ( `id` bigint(20) NOT NULL COMMENT '主键ID', `template_id` bigint(20) NOT NULL COMMENT '模板id', `check_item` varchar(500) NOT NULL COMMENT '检查项目', @@ -76,4 +76,4 @@ CREATE TABLE IF NOT EXISTS `hzims_hygiene_template_detail` ( `status` int(2) NOT NULL DEFAULT '1' COMMENT '状态', `is_deleted` int(2) NOT NULL DEFAULT '0' COMMENT '逻辑删除状态:0-未删除,1-删除', PRIMARY KEY (`id`) USING BTREE - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='车检模板详情表'; \ No newline at end of file +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='车检模板详情表'; \ No newline at end of file From b7e4fb1027028641121be3c71e645e5dbd96cfbe Mon Sep 17 00:00:00 2001 From: liwen Date: Mon, 3 Jun 2024 14:37:31 +0800 Subject: [PATCH 10/16] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E5=8D=AB?= =?UTF-8?q?=E7=94=9F=E6=A8=A1=E6=9D=BF=E6=9F=A5=E8=AF=A2=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hnac/hzims/safeproduct/mapper/HygieneTemplateMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneTemplateMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneTemplateMapper.xml index cdb1378..c4edda8 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneTemplateMapper.xml +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneTemplateMapper.xml @@ -9,7 +9,7 @@ WHERE is_deleted = 0 - AND template_name like concate('%', #{param.templateName}, '%') + AND template_name like concat('%', #{param.templateName}, '%') ORDER BY create_time DESC From 31e98b4a72a21f2df6668e4e7ff36ed650b3da11 Mon Sep 17 00:00:00 2001 From: liwen Date: Mon, 3 Jun 2024 17:34:32 +0800 Subject: [PATCH 11/16] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E6=BC=94?= =?UTF-8?q?=E7=BB=83=E3=80=81=E5=9F=B9=E8=AE=AD=E3=80=81=E5=8D=AB=E7=94=9F?= =?UTF-8?q?=E6=9C=88=E5=BA=A6=E7=BB=9F=E8=AE=A1=E6=95=B0=E6=8D=AE=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../safeproduct/controller/HygieneController.java | 15 ++++++++++ .../controller/RehearsalController.java | 18 ++++++++++-- .../safeproduct/controller/TrainController.java | 18 ++++++++++-- .../hzims/safeproduct/mapper/TrainPlanMapper.xml | 11 +++---- .../safeproduct/service/IHygienePlanService.java | 8 +++++ .../safeproduct/service/IRehearsalPlanService.java | 8 +++++ .../safeproduct/service/ITrainPlanService.java | 8 +++++ .../service/impl/HygienePlanServiceImpl.java | 33 +++++++++++++++++++++ .../service/impl/RehearsalPlanServiceImpl.java | 33 +++++++++++++++++++-- .../service/impl/TrainPlanServiceImpl.java | 34 ++++++++++++++++++++++ 10 files changed, 173 insertions(+), 13 deletions(-) diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java index 8290da9..1c4de51 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java @@ -230,4 +230,19 @@ public class HygieneController extends BladeController { IPage page = hygieneTemplateService.getHygieneTemplatePage(param, query); return R.data(page); } + + @GetMapping("/detailListByMonth") + @ApiImplicitParams({ + @ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "scheduledStartTime", value = "计划开始时间", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "scheduledEndTime", value = "计划结束时间", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "hygienePlanStatus", value = "卫生计划状态", dataType = "query", paramType = "string") + }) + @ApiOperation(value = "卫生月度详情列表") + @ApiOperationSupport(order = 20) + @Operate(label = "卫生月度详情列表", type = BusinessType.QUERY, ignore = false) + public R> detailListByMonth(@ApiIgnore @RequestParam Map param, Query query) { + IPage page = hygienePlanService.getDetailListByMonth(param, query); + return R.data(page); + } } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java index 14cdc89..08d28ce 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java @@ -82,8 +82,7 @@ public class RehearsalController extends BladeController { @ApiImplicitParams({ @ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"), @ApiImplicitParam(name = "scheduledStartTime", value = "计划开始时间", dataType = "query", paramType = "string"), - @ApiImplicitParam(name = "scheduledEndTime", value = "计划结束时间", dataType = "query", paramType = "string"), - @ApiImplicitParam(name = "rehearsalStatus", value = "演练状态", dataType = "query", paramType = "string") + @ApiImplicitParam(name = "scheduledEndTime", value = "计划结束时间", dataType = "query", paramType = "string") }) @ApiOperation(value = "演练计划分页") @ApiOperationSupport(order = 5) @@ -178,4 +177,19 @@ public class RehearsalController extends BladeController { public void exportRehearsalRecordData(@RequestParam Long id, HttpServletResponse response) { rehearsalRecordService.exportRehearsalRecordData(id, response); } + + @GetMapping("/detailListByMonth") + @ApiImplicitParams({ + @ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "scheduledStartTime", value = "计划开始时间", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "scheduledEndTime", value = "计划结束时间", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "rehearsalStatus", value = "演练状态", dataType = "query", paramType = "string") + }) + @ApiOperation(value = "演练月度详情列表") + @ApiOperationSupport(order = 15) + @Operate(label = "演练月度详情列表", type = BusinessType.QUERY, ignore = false) + public R> detailListByMonth(@ApiIgnore @RequestParam Map param, Query query) { + IPage page = rehearsalPlanService.getDetailListByMonth(query, param); + return R.data(page); + } } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java index 7eda44c..ef252f9 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java @@ -91,8 +91,7 @@ public class TrainController extends BladeController { @ApiImplicitParams({ @ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"), @ApiImplicitParam(name = "scheduledStartTime", value = "计划开始时间", dataType = "query", paramType = "string"), - @ApiImplicitParam(name = "scheduledEndTime", value = "计划结束时间", dataType = "query", paramType = "string"), - @ApiImplicitParam(name = "trainStatus", value = "培训计划状态", dataType = "query", paramType = "string") + @ApiImplicitParam(name = "scheduledEndTime", value = "计划结束时间", dataType = "query", paramType = "string") }) @ApiOperation(value = "培训计划分页") @ApiOperationSupport(order = 5) @@ -276,4 +275,19 @@ public class TrainController extends BladeController { public void exportTrainRecordData(@RequestParam Long id, HttpServletResponse response) { trainRecordService.exportTrainRecordData(id, response); } + + @GetMapping("/detailListByMonth") + @ApiImplicitParams({ + @ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "scheduledStartTime", value = "计划开始时间", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "scheduledEndTime", value = "计划结束时间", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "trainStatus", value = "培训计划状态", dataType = "query", paramType = "string") + }) + @ApiOperation(value = "培训月度详情列表") + @ApiOperationSupport(order = 24) + @Operate(label = "培训月度详情列表", type = BusinessType.QUERY, ignore = false) + public R> detailListByMonth(@ApiIgnore @RequestParam Map param, Query query) { + IPage page = trainPlanService.getDetailListByMonth(param, query); + return R.data(page); + } } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainPlanMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainPlanMapper.xml index 19ef188..45cc431 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainPlanMapper.xml +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainPlanMapper.xml @@ -81,14 +81,11 @@ AND unit like concat('%', #{param.unit}, '%') - - AND scheduled_start_time >= #{param.startTime} + + AND scheduled_start_time >= #{param.scheduledStartTime} - - AND scheduled_end_time <= #{param.endTime} - - - AND train_status = #{param.trainStatus} + + AND scheduled_end_time <= #{param.scheduledEndTime} ORDER BY create_time DESC diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygienePlanService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygienePlanService.java index a564531..484cfcf 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygienePlanService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygienePlanService.java @@ -92,4 +92,12 @@ public interface IHygienePlanService extends IService { * @param response 响应类 */ void exportHygienePlanData(Map param, HttpServletResponse response); + + /** + * 查询卫生月度详情列表 + * @param param 参数 + * @param query 分页类 + * @return 月度详情列表 + */ + IPage getDetailListByMonth(Map param, Query query); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IRehearsalPlanService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IRehearsalPlanService.java index d679fc0..7745227 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IRehearsalPlanService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IRehearsalPlanService.java @@ -66,4 +66,12 @@ public interface IRehearsalPlanService extends IService { * @return 演练计划数据 */ IPage rehearsalPlanPage(Map param, Query query); + + /** + * 查询月度详情列表 + * @param query 分页类 + * @param param 参数 + * @return 详情列表 + */ + IPage getDetailListByMonth(Query query, Map param); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITrainPlanService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITrainPlanService.java index 75e86ed..1aa7ad7 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITrainPlanService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITrainPlanService.java @@ -66,4 +66,12 @@ public interface ITrainPlanService extends IService { * @return 培训计划数据 */ IPage trainPlanPage(Map param, Query query); + + /** + * 查询培训月度详情列表 + * @param param 参数 + * @param query 分页类 + * @return 月度详情列表 + */ + IPage getDetailListByMonth(Map param, Query query); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java index d0d3b88..ea4d1a0 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java @@ -371,6 +371,39 @@ public class HygienePlanServiceImpl extends ServiceImpl getDetailListByMonth(Map param, Query query) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + String unit = String.valueOf(param.get("unit")); + String startTime = String.valueOf(param.get("scheduledStartTime")); + String endTime = String.valueOf(param.get("scheduledEndTime")); + String hygieneStatus = String.valueOf(param.get("hygienePlanStatus")); + if (!unit.equals("null") && !unit.equals("")) { + queryWrapper.lambda().like(HygienePlanEntity::getUnit, unit); + } + if (!startTime.equals("null") && !startTime.equals("")) { + queryWrapper.lambda().ge(HygienePlanEntity::getScheduledEndTime, startTime); + } + if (!endTime.equals("null") && !endTime.equals("")) { + queryWrapper.lambda().le(HygienePlanEntity::getScheduledEndTime, endTime); + } + if (!hygieneStatus.equals("null") && !hygieneStatus.equals("")) { + // 未完成计划包括UNFINISHED和WAITING两种状态 + if (hygieneStatus.equals("UNFINISHED+WAITING")) { + queryWrapper.lambda().and(wrapper -> wrapper.eq(HygienePlanEntity::getHygienePlanStatus, HygieneStatusEnum.UNFINISHED.getValue()) + .or() + .eq(HygienePlanEntity::getHygienePlanStatus, HygieneStatusEnum.WAITING.getValue())); + } else { + queryWrapper.lambda().eq(HygienePlanEntity::getHygienePlanStatus, hygieneStatus); + } + } + queryWrapper.lambda().orderByDesc(HygienePlanEntity::getCreateTime); + return this.page(Condition.getPage(query), queryWrapper); + } + + /** * 根据单位、名称、时间查询卫生自查计划 * @param unit 单位 * @param name 名称 diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalPlanServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalPlanServiceImpl.java index 9cd63ef..08c858e 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalPlanServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalPlanServiceImpl.java @@ -276,7 +276,6 @@ public class RehearsalPlanServiceImpl extends ServiceImpl getDetailListByMonth(Query query, Map param) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + String unit = String.valueOf(param.get("unit")); + String startTime = String.valueOf(param.get("scheduledStartTime")); + String endTime = String.valueOf(param.get("scheduledEndTime")); + String rehearsalStatus = String.valueOf(param.get("rehearsalStatus")); + if (!unit.equals("null") && !unit.equals("")) { + queryWrapper.lambda().like(RehearsalPlanEntity::getUnit, unit); + } + if (!startTime.equals("null") && !startTime.equals("")) { + queryWrapper.lambda().ge(RehearsalPlanEntity::getScheduledEndTime, startTime); + } + if (!endTime.equals("null") && !endTime.equals("")) { + queryWrapper.lambda().le(RehearsalPlanEntity::getScheduledEndTime, endTime); + } if (!rehearsalStatus.equals("null") && !rehearsalStatus.equals("")) { - queryWrapper.lambda().eq(RehearsalPlanEntity::getRehearsalStatus, rehearsalStatus); + // 未完成计划包括UNFINISHED和WAITING两种状态 + if (rehearsalStatus.equals("UNFINISHED+WAITING")) { + queryWrapper.lambda().and(wrapper -> wrapper.eq(RehearsalPlanEntity::getRehearsalStatus, RehearsalStatusEnum.UNFINISHED.getValue()) + .or() + .eq(RehearsalPlanEntity::getRehearsalStatus, RehearsalStatusEnum.WAITING.getValue())); + } else { + queryWrapper.lambda().eq(RehearsalPlanEntity::getRehearsalStatus, rehearsalStatus); + } } queryWrapper.lambda().orderByDesc(RehearsalPlanEntity::getCreateTime); return this.page(Condition.getPage(query), queryWrapper); diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainPlanServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainPlanServiceImpl.java index 3f3af95..40fb225 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainPlanServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainPlanServiceImpl.java @@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hnac.hzims.common.utils.Condition; import com.hnac.hzims.safeproduct.constants.SafeProductConstant; import com.hnac.hzims.safeproduct.dto.AnalysisYearDTO; import com.hnac.hzims.safeproduct.entity.TrainPlanEntity; @@ -268,6 +269,39 @@ public class TrainPlanServiceImpl extends ServiceImpl getDetailListByMonth(Map param, Query query) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + String unit = String.valueOf(param.get("unit")); + String startTime = String.valueOf(param.get("scheduledStartTime")); + String endTime = String.valueOf(param.get("scheduledEndTime")); + String trainStatus = String.valueOf(param.get("trainStatus")); + if (!unit.equals("null") && !unit.equals("")) { + queryWrapper.lambda().like(TrainPlanEntity::getUnit, unit); + } + if (!startTime.equals("null") && !startTime.equals("")) { + queryWrapper.lambda().ge(TrainPlanEntity::getScheduledEndTime, startTime); + } + if (!endTime.equals("null") && !endTime.equals("")) { + queryWrapper.lambda().le(TrainPlanEntity::getScheduledEndTime, endTime); + } + if (!trainStatus.equals("null") && !trainStatus.equals("")) { + // 未完成计划包括UNFINISHED和WAITING两种状态 + if (trainStatus.equals("UNFINISHED+WAITING")) { + queryWrapper.lambda().and(wrapper -> wrapper.eq(TrainPlanEntity::getTrainStatus, TrainStatusEnum.UNFINISHED.getValue()) + .or() + .eq(TrainPlanEntity::getTrainStatus, TrainStatusEnum.WAITING.getValue())); + } else { + queryWrapper.lambda().eq(TrainPlanEntity::getTrainStatus, trainStatus); + } + } + queryWrapper.lambda().orderByDesc(TrainPlanEntity::getCreateTime); + return this.page(Condition.getPage(query), queryWrapper); + } + + /** * 根据单位和计划时间查询培训计划数据 * @param unit 单位 * @param startTime 计划开始时间 From fbbe12ced141d8f600355bba3b2f6fe54e05435c Mon Sep 17 00:00:00 2001 From: liwen Date: Thu, 6 Jun 2024 17:30:12 +0800 Subject: [PATCH 12/16] =?UTF-8?q?update:=20=E5=88=A0=E9=99=A4=E6=97=A0?= =?UTF-8?q?=E7=94=A8=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operational/feedback/mapper/UserFeedbackMapper.xml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/feedback/mapper/UserFeedbackMapper.xml b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/feedback/mapper/UserFeedbackMapper.xml index 418022c..31cee66 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/feedback/mapper/UserFeedbackMapper.xml +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/feedback/mapper/UserFeedbackMapper.xml @@ -2,17 +2,4 @@ - \ No newline at end of file From adba838128558829f5cde6c29cfa62f048dfa997 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Fri, 7 Jun 2024 09:01:53 +0800 Subject: [PATCH 13/16] =?UTF-8?q?#=E9=80=9A=E8=AE=AF=E4=B8=AD=E6=96=AD?= =?UTF-8?q?=E5=91=8A=E8=AD=A6=E5=86=85=E5=AE=B9=E6=88=AA=E5=8F=96=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java | 3 ++- .../hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java | 2 +- .../service/operation/home/impl/RealTargetServiceImpl.java | 7 +++++++ .../operational/station/service/impl/RealMonitorServiceImpl.java | 4 ++-- hzims-service/operational/src/main/resources/db/2.0.6.sql | 1 + 5 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 hzims-service/operational/src/main/resources/db/2.0.6.sql diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java index 649e154..f8a7a76 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java @@ -91,7 +91,8 @@ public class AlarmSaveServiceImpl implements AlarmSaveService { } } // 告警站点名称截取 - if(StringUtil.isNotBlank(alarm.getAlarmContext()) && !AlarmConstants.CONDITION_ALARM.equals(alarm.getAlarmSource())){ + if(StringUtil.isNotBlank(alarm.getAlarmContext()) && !AlarmConstants.CONDITION_ALARM.equals(alarm.getAlarmSource()) && !AlarmConstants.INTERRUPT.equals(alarm.getAlarmType()) + && !AlarmConstants.ABNORMAL.equals(alarm.getAlarmType())){ String[] countext = alarm.getAlarmContext().split("\\."); alarm.setAlarmContext(countext[countext.length - 1]); } diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java index 69c643c..c78f300 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java @@ -274,7 +274,7 @@ public class AlarmServiceImpl implements AlarmService { alarm.setType(Integer.parseInt(entity.getType())); alarm.setStation(entity.getStationId()); alarm.setRealId(entity.getRealId()); - alarm.setContext(entity.getStationName() + "." + entity.getSoeExplain()); + alarm.setContext(entity.getSoeExplain()); alarm.setState(entity.getStatus()); log.error("send_interruption_msg : {}",JsonUtil.toJson(alarm)); mqttSender.sendToMqtt(InterruptionConstants.HZ3000_TOPIC_PREFIX + entity.getStationId(), JsonUtil.toJson(alarm)); diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java index 847fd19..106e0aa 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java @@ -1270,6 +1270,13 @@ public class RealTargetServiceImpl implements RealTargetService { log.error("pool_item_execute_complete_error : {}" ,e.getMessage()); } } + // 等待所有线程执行完成 + try { + countDownLatch.await(); + } catch (InterruptedException e) { + e.printStackTrace(); + Thread.currentThread().interrupt(); + } redisTemplate.opsForValue().set(recent_year_power_data, powerMap); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java index 1d7b99e..b83ad0c 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java @@ -339,9 +339,9 @@ public class RealMonitorServiceImpl implements IRealMonitorService { if(station.getWaterLevel() <= 0){ return; } - if(station.getWaterLevelMax() < station.getWaterLevel() || station.getDownWaterLevel() > station.getWaterLevel()){ + if(station.getWaterLevelMax() > 0 && station.getWaterLevel() > station.getWaterLevelMax()){ station.setWaterColor(2); - }else if((station.getWaterLevelMax() > 0 && (station.getWaterLevel() / station.getWaterLevelMax()) > 0.8) || (station.getDownWaterLevel() > 0 && (station.getWaterLevel() / station.getDownWaterLevel()) < 1.2)){ + }else if(station.getDownWaterLevel() > 0 && station.getWaterLevel() < station.getDownWaterLevel()){ station.setWaterColor(1); } } diff --git a/hzims-service/operational/src/main/resources/db/2.0.6.sql b/hzims-service/operational/src/main/resources/db/2.0.6.sql new file mode 100644 index 0000000..bd1a21f --- /dev/null +++ b/hzims-service/operational/src/main/resources/db/2.0.6.sql @@ -0,0 +1 @@ +ALTER TABLE `hzims_station` ADD COLUMN `DOWN_WATER_LEVEL` decimal(6, 2) NULL DEFAULT NULL COMMENT '下限水位' AFTER `LIMIT_WATER_LEVEL`; \ No newline at end of file From ee67e3d33fbd6eb41dfec34ab50431f9c62d306e Mon Sep 17 00:00:00 2001 From: liwen Date: Fri, 7 Jun 2024 10:24:48 +0800 Subject: [PATCH 14/16] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E8=BD=A6?= =?UTF-8?q?=E6=A3=80=E8=AE=B0=E5=BD=95=E5=AF=BC=E5=87=BA=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CarCheckRecordServiceImpl.java | 16 ++++++++++++++++ .../java/com/hnac/hzims/safeproduct/utils/BaseUtil.java | 3 +++ 2 files changed, 19 insertions(+) diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java index ce72167..2ddad1b 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java @@ -29,6 +29,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.math.BigDecimal; +import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; @@ -198,6 +199,21 @@ public class CarCheckRecordServiceImpl extends ServiceImpl checkList = carCheckRecordDetailVO.getCheckItemList(); + List res = new ArrayList<>(); + checkList.forEach(item -> { + String[] checkContent = item.getCheckContent().split(","); + String[] checkResult = item.getCheckResult().split(","); + for (int i = 0; i < checkContent.length; i++) { + CarCheckItemEntity carCheckItemEntity = new CarCheckItemEntity(); + carCheckItemEntity.setCheckItem(item.getCheckItem()); + carCheckItemEntity.setCheckContent(checkContent[i]); + carCheckItemEntity.setCheckResult(checkResult[i]); + res.add(carCheckItemEntity); + } + }); + carCheckRecordDetailVO.setCheckItemList(res); // 表头年月 String code = carCheckRecordDetailVO.getCode(); carCheckRecordDetailVO.setYear(code.substring(4, 8)); diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java index 76aada7..c80b1ba 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java @@ -147,6 +147,9 @@ public class BaseUtil { if (templatePath.equals("template/卫生自查表.docx")) { formatHygieneRecordTable(xwpfDocument); } + if (templatePath.equals("template/车辆检查表.docx")) { + formatCarCheckRecordTable(xwpfDocument); + } } catch (Exception e) { e.printStackTrace(); } From d243dd49f900d11190ce90de1d02c0247fd9bb9d Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Tue, 11 Jun 2024 08:13:09 +0800 Subject: [PATCH 15/16] =?UTF-8?q?#=E9=80=9A=E8=AE=AF=E4=B8=AD=E6=96=AD?= =?UTF-8?q?=E5=91=8A=E8=AD=A6=E5=86=85=E5=AE=B9=E6=88=AA=E5=8F=96=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alarm/monitor/service/impl/AlarmSaveServiceImpl.java | 12 ++++++------ .../hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java index f8a7a76..d044fbf 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java @@ -81,6 +81,12 @@ public class AlarmSaveServiceImpl implements AlarmSaveService { if(CollectionUtil.isNotEmpty(delays) && delays.contains(alarm.getAlarmContext())){ return; } + // 告警站点名称截取 + if(StringUtil.isNotBlank(alarm.getAlarmContext()) && !AlarmConstants.CONDITION_ALARM.equals(alarm.getAlarmSource()) && !AlarmConstants.INTERRUPT.equals(alarm.getAlarmType()) + && !AlarmConstants.ABNORMAL.equals(alarm.getAlarmType())){ + String[] countext = alarm.getAlarmContext().split("\\."); + alarm.setAlarmContext(countext[countext.length - 1]); + } // 近5分钟内告警重复 if(CollectionUtil.isNotEmpty(keys)){ for (String key : keys) { @@ -90,12 +96,6 @@ public class AlarmSaveServiceImpl implements AlarmSaveService { } } } - // 告警站点名称截取 - if(StringUtil.isNotBlank(alarm.getAlarmContext()) && !AlarmConstants.CONDITION_ALARM.equals(alarm.getAlarmSource()) && !AlarmConstants.INTERRUPT.equals(alarm.getAlarmType()) - && !AlarmConstants.ABNORMAL.equals(alarm.getAlarmType())){ - String[] countext = alarm.getAlarmContext().split("\\."); - alarm.setAlarmContext(countext[countext.length - 1]); - } // 步骤3.站点参数设置 alarm.setCreateDept(optional.get().getCreateDept()); alarm.setStationName(optional.get().getName()); diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java index c78f300..f2aba66 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java @@ -247,6 +247,8 @@ public class AlarmServiceImpl implements AlarmService { if(InterruptionConstants.ABNORMAL_STATUS.equals(soe.getSoeAlarmType())){ entity.setStatus(1); } + + return entity; }).collect(Collectors.toList()); if(CollectionUtil.isEmpty(entities)){ From ba58ef17a7e2c0e85f3906058834eb51d455f924 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Tue, 11 Jun 2024 16:14:42 +0800 Subject: [PATCH 16/16] =?UTF-8?q?#=E5=91=8A=E8=AD=A6=E5=A4=84=E7=90=86?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E9=87=8D=E5=A4=8D=E5=91=8A=E8=AD=A6=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E7=AB=99=E7=82=B9=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/equipment/controller/EmAssociationController.java | 2 -- .../alarm/monitor/service/impl/AlarmSaveServiceImpl.java | 4 ++-- .../java/com/hnac/hzims/alarm/mqtt/HZ300MqttConsumer.java | 2 +- .../com/hnac/hzims/alarm/show/mapper/AlarmHandleMapper.java | 4 ++-- .../com/hnac/hzims/alarm/show/mapper/AlarmHandleMapper.xml | 12 ++++++++++++ .../hnac/hzims/alarm/show/service/AlarmHandleService.java | 4 ++-- .../alarm/show/service/impl/AlarmHandleServiceImpl.java | 8 ++++---- 7 files changed, 23 insertions(+), 13 deletions(-) diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmAssociationController.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmAssociationController.java index a8a918a..cb14b0e 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmAssociationController.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmAssociationController.java @@ -76,6 +76,4 @@ public class EmAssociationController extends BladeController { return R.status(emAssociationService.deleteLogic(Func.toLongList(ids))); } - - } diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java index d044fbf..20c2f8a 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java @@ -61,9 +61,9 @@ public class AlarmSaveServiceImpl implements AlarmSaveService { return false; } // 步骤2.查询当天处理的告警 - List handlers = handleService.sameDayContent(); + List handlers = handleService.sameDayContent(stations.getData().stream().map(StationEntity::getCode).collect(Collectors.toList())); // 步骤3.查询延后未完成的告警 - List delays = handleService.incompleteContent(); + List delays = handleService.incompleteContent(stations.getData().stream().map(StationEntity::getCode).collect(Collectors.toList())); // 步骤4.近5分钟内告警 Set keys = stringRedisTemplate.keys("hzims:queue:filter:alarm" + "*"); // 步骤5.遍历保存告警数据 diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/HZ300MqttConsumer.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/HZ300MqttConsumer.java index 97c53b0..82880ad 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/HZ300MqttConsumer.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/HZ300MqttConsumer.java @@ -29,7 +29,7 @@ public class HZ300MqttConsumer implements SubscribeCallBack { private AlarmSaveService alarmSaveService; @Override public void onMessage(Map data) { - log.info("HZ3000队列监听到消息 : {}",data); + log.error("HZ3000队列监听到消息 : {}",data); //消费代码 List alarmEntities = systemAlarmService.receiveMessage(JSONObject.toJSONString(data)); if(CollectionUtil.isEmpty(alarmEntities)){ diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmHandleMapper.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmHandleMapper.java index c80c634..83cc21f 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmHandleMapper.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmHandleMapper.java @@ -22,7 +22,7 @@ public interface AlarmHandleMapper extends UserDataScopeBaseMapper handles(@Param("start") String start,@Param("end") String end); - List sameDayContent(@Param("start") String start,@Param("end") String end); + List sameDayContent(@Param("start") String start,@Param("end") String end,@Param("stations") List stations); - List incompleteContent(@Param("end") String end); + List incompleteContent(@Param("end") String end,@Param("stations") List stations); } diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmHandleMapper.xml b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmHandleMapper.xml index 029edcc..33cd2e4 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmHandleMapper.xml +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmHandleMapper.xml @@ -50,6 +50,12 @@ AND HANDLER.CREATE_TIME BETWEEN #{start} AND #{end} + + and HANDLER.STATION_CODE in + + #{station} + + diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmHandleService.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmHandleService.java index b06840b..8911c3d 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmHandleService.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmHandleService.java @@ -26,7 +26,7 @@ public interface AlarmHandleService extends BaseService { List handles(); - List sameDayContent(); + List sameDayContent(List stations); - List incompleteContent(); + List incompleteContent(List stations); } diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleServiceImpl.java index 0a954e2..849a47e 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleServiceImpl.java @@ -173,12 +173,12 @@ public class AlarmHandleServiceImpl extends BaseServiceImpl sameDayContent() { + public List sameDayContent(List stations) { Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.HOUR_OF_DAY,-1); String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00"; String end = DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME); - return this.baseMapper.sameDayContent(start,end); + return this.baseMapper.sameDayContent(start,end,stations); } /** @@ -186,8 +186,8 @@ public class AlarmHandleServiceImpl extends BaseServiceImpl incompleteContent() { + public List incompleteContent(List stations) { String end = DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME); - return this.baseMapper.incompleteContent(end); + return this.baseMapper.incompleteContent(end,stations); } }