From cafd5d6903a1eb7c96c623b11b1972d7a0ed1b33 Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Wed, 8 May 2024 21:53:27 +0800 Subject: [PATCH 01/50] =?UTF-8?q?fix:=E5=91=8A=E8=AD=A6-=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E5=85=AC=E4=BC=97=E5=8F=B7=E6=8E=A8=E9=80=81=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3=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 2453887..105bf73 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 @@ -148,7 +148,7 @@ public class MessageServiceImpl implements MessageService { } Long dept = station.getData().getCreateDept(); // 获取站点用户 - R> result = userClient.userListByDeptId(dept); + R> result = userClient.userList("200000",dept); if (!result.isSuccess() || CollectionUtil.isEmpty(result.getData())) { log.error("微信消息发送失败:用户获取失败 : {}",entity); return; From 5341976f05897ff4b8158caaee53e52c4979b91e Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Thu, 9 May 2024 21:10:30 +0800 Subject: [PATCH 02/50] =?UTF-8?q?=E5=8D=87=E7=BA=A7=EF=BC=9Ablade-common?= =?UTF-8?q?=E5=88=B05.1.1.RELEASE.fix.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 182b612..3315851 100644 --- a/pom.xml +++ b/pom.xml @@ -44,7 +44,7 @@ org.springblade blade-common - 5.1.1.RELEASE.fix.1 + 5.1.1.RELEASE.fix.2 org.springblade From a4cdd0a5d0792c093620696edf91564ca06432b0 Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Fri, 10 May 2024 17:18:00 +0800 Subject: [PATCH 03/50] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=80=BC=E7=8F=AD?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E5=B7=A5=E4=BD=9C=E7=A5=A8=E6=95=B0=E9=87=8F?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java index db48343..3f45160 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java @@ -1591,7 +1591,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl> operateTicketInfo = ticketInfoClient.getOperateTicketInfo(paramMap); From 7b1bea022e557da269530127f5122594b598b2b8 Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Fri, 10 May 2024 20:07:33 +0800 Subject: [PATCH 04/50] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E5=91=8A?= =?UTF-8?q?=E8=AD=A6=E7=9F=AD=E4=BF=A1=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/hnac/hzims/alarm/config/constants/AlarmConstants.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/constants/AlarmConstants.java b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/constants/AlarmConstants.java index b9483a3..0128e39 100644 --- a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/constants/AlarmConstants.java +++ b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/constants/AlarmConstants.java @@ -63,7 +63,7 @@ public interface AlarmConstants { List HZ3000_TYPES = Arrays.asList("0","1","2","3","4","5","6","7","8","9","10","11","12"); - String SMS_MESSAGE_TEMPLATE_CODE = "aliyun-alert-push"; + String SMS_MESSAGE_TEMPLATE_CODE = "aliyun-alarm-sms"; String FDP_INVALID_STATUS = "1.0"; From 725c3fbee2b3f3a34ac90fb505a3fb7ed18b365d Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Sat, 11 May 2024 11:33:30 +0800 Subject: [PATCH 05/50] =?UTF-8?q?#=E4=BA=91=E6=9C=8D=E5=8A=A1=E5=8E=BB?= =?UTF-8?q?=E9=99=A4=E6=95=B0=E6=8D=AE=E4=B8=AD=E6=96=AD=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operation/monitor/impl/MonitorServiceImpl.java | 43 +++------------------- 1 file changed, 5 insertions(+), 38 deletions(-) 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 da76d0d..23c60be 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 @@ -295,8 +295,6 @@ public class MonitorServiceImpl implements MonitorService { List alertList = alertService.list(new LambdaQueryWrapper() {{ orderByDesc(StAlarmRecordEntity::getCreateTime); }}); - // 获取所有故障记录 - List faultList = this.getFdpFaultAll(); // 所有设备分类 Map> deviceClassifyMap = (Map>) redisTemplate.opsForValue().get(device_classify_cache_final); // 所有设备 @@ -309,7 +307,7 @@ public class MonitorServiceImpl implements MonitorService { // 铃铛 List bells = alarmQueryService.bells(stationEntityList.stream().map(StationEntity::getCode).collect(Collectors.toList())); // 数据中断 - List aborts = interruptionAlarmService.aborts(stationEntityList.stream().map(StationEntity::getCode).collect(Collectors.toList())); + List aborts = interruptionAlarmService.aborts(stationEntityList.stream().filter(o->HomePageConstant.HYDROPOWER_SERVETYPE_STR.equals(o.getServeType())).map(StationEntity::getCode).collect(Collectors.toList())); // 隐藏设备列表 List hideList = attrConfigService.getHideList(); // 分割,每个map限制10个长度 @@ -339,7 +337,7 @@ public class MonitorServiceImpl implements MonitorService { deviceVo.setDeviceName(device); deviceVo.setDeviceCode(attbt.get(0).getEmCode()); // 设备处理 - this.handleDevice(attbt, map, deviceVo, alertList, faultList); + this.handleDevice(attbt, map, deviceVo, alertList); deviceList.add(deviceVo); }); // 设备状态 @@ -389,8 +387,7 @@ public class MonitorServiceImpl implements MonitorService { * @param device */ private void handleDevice(List list, Map> map, - RealDeviceVo device, List alertList, - List faultList) { + RealDeviceVo device, List alertList) { if (CollectionUtil.isEmpty(list) || MapUtils.isEmpty(map)) { return; } @@ -410,7 +407,7 @@ public class MonitorServiceImpl implements MonitorService { attbtList.add(realAttributeVo); return; } - realAttributeVo = handleAttbt(item, real, alertList, faultList); + realAttributeVo = handleAttbt(item, real, alertList); if (ObjectUtil.isEmpty(realAttributeVo)) { return; } @@ -536,7 +533,7 @@ public class MonitorServiceImpl implements MonitorService { * @return */ private RealAttributeVo handleAttbt(StationAttributeEntity item, Map real, - List alertList, List faultList) { + List alertList) { RealAttributeVo attest = new RealAttributeVo(); this.setAttbtParam(attest, real); attest.setRealId(item.getMonitorId()); @@ -567,8 +564,6 @@ public class MonitorServiceImpl implements MonitorService { default: throw new IllegalStateException("Unexpected type: " + type); } - // 故障信息设置 - accidentDetails(attest, faultList, value); return attest; } @@ -606,34 +601,6 @@ public class MonitorServiceImpl implements MonitorService { } /** - * 故障信息设置 - * - * @param attest - * @param faultList - * @param value - */ - private void accidentDetails(RealAttributeVo attest, List faultList, String value) { - if (CollectionUtil.isEmpty(faultList) || "-".equals(value)) { - return; - } - List fault = faultList.stream().filter(o -> o.getRealId().equals(attest.getRealId())).collect(Collectors.toList()); - if (CollectionUtil.isEmpty(fault)) { - return; - } - FdpFaultStatusVo fdpFaultStatusVo = fault.get(0); - // 黄色 - if (fdpFaultStatusVo.getValue() > greater_than_cache_final && fdpFaultStatusVo.getValue() < less_than_cache_final) { - attest.setStatus(ConfigStatus.ConfigStatusEnum.YELLOW.getStatus()); - // 橙色 - } else if (fdpFaultStatusVo.getValue() >= be_equa_cache_final) { - attest.setStatus(ConfigStatus.ConfigStatusEnum.ORANGE.getStatus()); - } - attest.setFdpRate(fdpFaultStatusVo.getValue()); - attest.setFdpFaultId(fdpFaultStatusVo.getFaultId()); - attest.setFdpMonitorId(fdpFaultStatusVo.getMonitorId()); - } - - /** * 重点属性类型-遥信 :数据逻辑处理 * * @param attest From 37cafb27799ae291e64d5716875d741a83424cc2 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Sat, 11 May 2024 11:35:18 +0800 Subject: [PATCH 06/50] =?UTF-8?q?#=E4=BA=91=E6=9C=8D=E5=8A=A1=E5=8E=BB?= =?UTF-8?q?=E9=99=A4=E6=95=B0=E6=8D=AE=E4=B8=AD=E6=96=AD=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hnac/hzims/operational/main/constant/HomePageConstant.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java index ce42a8f..af0113b 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java @@ -88,6 +88,8 @@ public interface HomePageConstant { */ Integer HYDROPOWER_SERVETYPE = 2; + String HYDROPOWER_SERVETYPE_STR = "2"; + /** * 站点接入方式 : 数据采集 */ From b53273286915355d81066733f0c5a02da5ed8798 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Sat, 11 May 2024 11:51:45 +0800 Subject: [PATCH 07/50] =?UTF-8?q?#=E4=BA=91=E6=9C=8D=E5=8A=A1=E5=8E=BB?= =?UTF-8?q?=E9=99=A4=E6=95=B0=E6=8D=AE=E4=B8=AD=E6=96=AD=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/operation/monitor/impl/MonitorServiceImpl.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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 23c60be..34ecc71 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 @@ -342,10 +342,10 @@ public class MonitorServiceImpl implements MonitorService { }); // 设备状态 this.getDeviceParam(devices, deviceClassifyMap, deviceList); - // 运行设备状态设置 - this.deviceState(deviceList); // 设置站点状态:数据中断 this.setStationStatus(aborts,station,key,deviceList); + // 运行设备状态设置 + this.deviceState(deviceList,station.getStatus()); // 铃铛 this.stationBell(station,bells); station.setDeviceList(deviceList.stream().sorted(Comparator.comparing((RealDeviceVo::getDeviceName))).collect(Collectors.toList())); @@ -420,14 +420,15 @@ public class MonitorServiceImpl implements MonitorService { * 设备状态 * @param deviceList */ - private void deviceState(List deviceList) { + private void deviceState(List deviceList,Integer status) { deviceList.forEach(device->{ // 设备属性列表 List attbts = device.getAttbtList(); - if(CollectionUtil.isEmpty(attbts)){ + if(CollectionUtil.isEmpty(attbts) || status == 1){ device.setState(-1); return; } + // 功率属性记录 List powers = attbts.stream().filter(att-> HomePageConstant.powerList.contains(att.getName())).collect(Collectors.toList()); if(CollectionUtil.isEmpty(powers)){ From cf74244a66d257133966925d1a48100473f80bff Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Sat, 11 May 2024 13:50:33 +0800 Subject: [PATCH 08/50] =?UTF-8?q?#=E4=BA=91=E6=9C=8D=E5=8A=A1=E5=8E=BB?= =?UTF-8?q?=E9=99=A4=E6=95=B0=E6=8D=AE=E4=B8=AD=E6=96=AD=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/operation/monitor/impl/MonitorServiceImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 34ecc71..dc7af4b 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 @@ -345,7 +345,7 @@ public class MonitorServiceImpl implements MonitorService { // 设置站点状态:数据中断 this.setStationStatus(aborts,station,key,deviceList); // 运行设备状态设置 - this.deviceState(deviceList,station.getStatus()); + this.deviceState(deviceList); // 铃铛 this.stationBell(station,bells); station.setDeviceList(deviceList.stream().sorted(Comparator.comparing((RealDeviceVo::getDeviceName))).collect(Collectors.toList())); @@ -420,11 +420,11 @@ public class MonitorServiceImpl implements MonitorService { * 设备状态 * @param deviceList */ - private void deviceState(List deviceList,Integer status) { + private void deviceState(List deviceList) { deviceList.forEach(device->{ // 设备属性列表 List attbts = device.getAttbtList(); - if(CollectionUtil.isEmpty(attbts) || status == 1){ + if(CollectionUtil.isEmpty(attbts)){ device.setState(-1); return; } From 1f880d68e9e62001dbc8b45d91c797314f881a3f Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Tue, 7 May 2024 11:24:41 +0800 Subject: [PATCH 09/50] =?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=E5=8D=95?= =?UTF-8?q?=E4=BD=8D=E8=BD=AC=E6=8D=A2=E4=B8=BA=E4=B8=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 7ab75635d24b098fe923a3c2917cd4f8440cfa6f) --- .../impl/MainSystemMonitoringServiceImpl.java | 36 +++++++++-------- .../impl/OperStationMonthReportServiceImpl.java | 45 ++++++++++++++++++++++ .../hnac/hzims/operational/util/ObjectUtils.java | 7 ++++ 3 files changed, 71 insertions(+), 17 deletions(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainSystemMonitoringServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainSystemMonitoringServiceImpl.java index afe634e..ea01dee 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainSystemMonitoringServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainSystemMonitoringServiceImpl.java @@ -64,6 +64,8 @@ import java.util.*; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; +import static com.hnac.hzims.operational.util.ObjectUtils.objDivide; + @Service @Slf4j @RequiredArgsConstructor @@ -1369,37 +1371,37 @@ public class MainSystemMonitoringServiceImpl implements IMainSystemMonitoringSer Map value = deviceMap.getValue(); //当月发电量 BigDecimal powerMon = value.entrySet().stream().filter(s -> currentMon.equals(s.getKey())).map(s -> BigDecimal.valueOf(s.getValue()).setScale(1, RoundingMode.UP)).reduce(BigDecimal.ZERO, BigDecimal::add); - stationReportVO.setFinishPowerMon(powerMon.toString()); + stationReportVO.setFinishPowerMon(objDivide(String.valueOf(powerMon)).toString()); //获取计划月发电量 R planPowerMonR = planGenertionClient.planGenerationMonthCount(stationEntity.getCode(), month); double planPowerMon =0; if (planPowerMonR.isSuccess()&&ObjectUtil.isNotEmpty(planPowerMonR.getData())) { planPowerMon = planPowerMonR.getData().doubleValue(); } - stationReportVO.setPowerMonPlan(planPowerMon); + stationReportVO.setPowerMonPlan(objDivide(String.valueOf(planPowerMon)).doubleValue()); //当年发电量 BigDecimal powerYear = value.entrySet().stream().filter(s -> listByYear.contains(s.getKey())).map(s -> BigDecimal.valueOf(s.getValue()).setScale(1, RoundingMode.UP)).reduce(BigDecimal.ZERO, BigDecimal::add); - stationReportVO.setFinishPowerYear(powerYear.toString()); + stationReportVO.setFinishPowerYear(objDivide(String.valueOf(powerYear)).toString()); //获取计划年发电量 - Double planPowerYear = planGenertionClient.getPlanPowerYear(Collections.singletonList(stationEntity.getId().toString()), yearMon[0]); - stationReportVO.setPowerYearPlan(planPowerYear); + Double planPowerYear = planGenertionClient.getPlanPowerYear(Collections.singletonList(stationEntity.getCode()), yearMon[0]); + stationReportVO.setPowerYearPlan(objDivide(String.valueOf(planPowerYear)).doubleValue()); if (ObjectUtil.isNotEmpty(stationReportVO.getPowerMonPlan()) &&ObjectUtil.isNotEmpty(stationReportVO.getFinishPowerMon()) && BigDecimal.valueOf(stationReportVO.getPowerMonPlan()).compareTo(BigDecimal.ZERO)!=0){ BigDecimal monRate = new BigDecimal(stationReportVO.getFinishPowerMon()).multiply(new BigDecimal(100)) .divide(BigDecimal.valueOf(stationReportVO.getPowerMonPlan()), 2, RoundingMode.UP); - stationReportVO.setPowerMonRate(monRate.doubleValue()+"%"); + stationReportVO.setPowerMonRate(String.valueOf(monRate.doubleValue())); }else { - stationReportVO.setPowerMonRate(new Double(0)+"%"); + stationReportVO.setPowerMonRate(new Double(0).toString()); } if (ObjectUtil.isNotEmpty(stationReportVO.getFinishPowerYear()) &&ObjectUtil.isNotEmpty(stationReportVO.getPowerYearPlan()) && BigDecimal.valueOf(stationReportVO.getPowerYearPlan()).compareTo(BigDecimal.ZERO)!=0){ BigDecimal yearRate = new BigDecimal(stationReportVO.getFinishPowerYear()).multiply(new BigDecimal(100)) .divide(BigDecimal.valueOf(stationReportVO.getPowerYearPlan()), 2, RoundingMode.UP); - stationReportVO.setPowerYearRate(yearRate.doubleValue()+"%"); + stationReportVO.setPowerYearRate(String.valueOf(yearRate.doubleValue())); }else { - stationReportVO.setPowerYearRate(new Double(0)+"%"); + stationReportVO.setPowerYearRate(new Double(0).toString()); } reportVOS.add(stationReportVO); } @@ -1474,33 +1476,33 @@ public class MainSystemMonitoringServiceImpl implements IMainSystemMonitoringSer } } Double finishPowerMon = BigDecimal.valueOf(powerCount.get()).doubleValue(); - stationReportVO.setFinishPowerMon(finishPowerMon.toString()); + stationReportVO.setFinishPowerMon(objDivide(String.valueOf(finishPowerMon)).toString()); Double finishPowerYear = BigDecimal.valueOf(powerCountYear.get()).doubleValue(); - stationReportVO.setFinishPowerYear(finishPowerYear.toString()); + stationReportVO.setFinishPowerYear(objDivide(String.valueOf(finishPowerYear)).toString()); //当年的计划发电量 Double planPowerYear = planGenertionClient.getPlanPowerYear(Collections.singletonList(stationId), year); - stationReportVO.setPowerYearPlan(planPowerYear); + stationReportVO.setPowerYearPlan(objDivide(String.valueOf(planPowerYear)).doubleValue()); //当月的计划发电量 R planPowerMonR = planGenertionClient.planGenerationMonthCount(stationId, month); Double planPowerMon = planPowerMonR.getData().doubleValue(); - stationReportVO.setPowerMonPlan(planPowerMon); + stationReportVO.setPowerMonPlan(objDivide(String.valueOf(planPowerMon)).doubleValue()); if (ObjectUtil.isNotEmpty(stationReportVO.getPowerMonPlan()) &&ObjectUtil.isNotEmpty(stationReportVO.getFinishPowerMon()) && BigDecimal.valueOf(stationReportVO.getPowerMonPlan()).compareTo(BigDecimal.ZERO)!=0){ BigDecimal monRate = new BigDecimal(stationReportVO.getFinishPowerMon()).multiply(new BigDecimal(100)) .divide(BigDecimal.valueOf(stationReportVO.getPowerMonPlan()), 2, RoundingMode.UP); - stationReportVO.setPowerMonRate(monRate.doubleValue()+"%"); + stationReportVO.setPowerMonRate(String.valueOf(monRate.doubleValue())); }else { - stationReportVO.setPowerMonRate(new Double(0)+"%"); + stationReportVO.setPowerMonRate(new Double(0).toString()); } if (ObjectUtil.isNotEmpty(stationReportVO.getFinishPowerYear()) &&ObjectUtil.isNotEmpty(stationReportVO.getPowerYearPlan()) && BigDecimal.valueOf(stationReportVO.getPowerYearPlan()).compareTo(BigDecimal.ZERO)!=0){ BigDecimal yearRate = new BigDecimal(stationReportVO.getFinishPowerYear()).multiply(new BigDecimal(100)) .divide(BigDecimal.valueOf(stationReportVO.getPowerYearPlan()), 2, RoundingMode.UP); - stationReportVO.setPowerYearRate(yearRate.doubleValue()+"%"); + stationReportVO.setPowerYearRate(String.valueOf(yearRate.doubleValue())); }else { - stationReportVO.setPowerYearRate(new Double(0)+"%"); + stationReportVO.setPowerYearRate(new Double(0).toString()); } stationReportVOList.add(stationReportVO); return stationReportVOList; 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 95b22cf..1f80b1b 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 @@ -57,6 +57,7 @@ import org.springblade.system.vo.DeptVO; import org.springframework.core.io.ClassPathResource; import org.springframework.stereotype.Service; import org.springframework.util.Assert; +import org.springframework.util.ObjectUtils; import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; @@ -349,6 +350,7 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor reportVOS.addAll(stationReportVOList); }); } + getSumStationRunReport(reportVOS); stationReportAllVo.setStationReportVOList(reportVOS); }catch (Exception e){ log.error("", e); @@ -510,6 +512,49 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor return stationReportAllVo; } + private static void getSumStationRunReport(List reportVOS) { + //合计 + StationRunReportVO stationRunReportVO=new StationRunReportVO(); + stationRunReportVO.setStationName("合计"); + if (CollectionUtil.isNotEmpty(reportVOS)){ + double sumPowerMonPlan = reportVOS.stream().mapToDouble(StationRunReportVO::getPowerMonPlan).sum(); + stationRunReportVO.setPowerMonPlan(sumPowerMonPlan); + double sumFinishPowerMon = reportVOS.stream().map(StationRunReportVO::getFinishPowerMon).mapToDouble(s -> Double.valueOf(s)).sum(); + stationRunReportVO.setFinishPowerMon(String.valueOf(sumFinishPowerMon)); + if (!ObjectUtils.isEmpty(sumPowerMonPlan)) { + BigDecimal powerMonRate = new BigDecimal(sumFinishPowerMon).divide(new BigDecimal(sumPowerMonPlan)).setScale(2, BigDecimal.ROUND_UP); + stationRunReportVO.setPowerMonRate(String.valueOf(powerMonRate)); + }else { + stationRunReportVO.setPowerMonRate("0.0"); + } + double sumPowerYearPlan = reportVOS.stream().mapToDouble(StationRunReportVO::getPowerYearPlan).sum(); + stationRunReportVO.setPowerYearPlan(sumPowerYearPlan); + double sumFinishPowerYear = reportVOS.stream().map(StationRunReportVO::getFinishPowerYear).mapToDouble(s -> Double.valueOf(s)).sum(); + stationRunReportVO.setFinishPowerYear(String.valueOf(sumFinishPowerYear)); + if (!ObjectUtils.isEmpty(sumPowerYearPlan)){ + BigDecimal powerYearRate = new BigDecimal(sumFinishPowerYear).divide(new BigDecimal(sumPowerYearPlan)).setScale(2, BigDecimal.ROUND_UP); + stationRunReportVO.setPowerYearRate(String.valueOf(powerYearRate)); + }else { + stationRunReportVO.setPowerYearRate("0.0"); + } + stationRunReportVO.setIndex(reportVOS.size()+1); + }else { + stationRunReportVO.setPowerMonPlan(0.0d); + stationRunReportVO.setFinishPowerMon("0.0"); + stationRunReportVO.setPowerYearPlan(0.0d); + stationRunReportVO.setFinishPowerYear("0.0"); + stationRunReportVO.setPowerMonRate("0.0"); + stationRunReportVO.setPowerYearRate("0.0"); + stationRunReportVO.setIndex(1); + } + reportVOS.add(stationRunReportVO); + reportVOS = reportVOS.stream().map(s -> { + s.setPowerMonRate(s.getPowerMonRate()+"%"); + s.setPowerYearRate(s.getPowerYearRate()+"%"); + return s; + }).collect(Collectors.toList()); + } + /** * 导出统计月报 * @param response diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/util/ObjectUtils.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/util/ObjectUtils.java index 9feb555..341e2d5 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/util/ObjectUtils.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/util/ObjectUtils.java @@ -10,6 +10,7 @@ import org.springblade.system.user.cache.UserCache; import org.springblade.system.user.entity.User; import java.lang.reflect.Field; +import java.math.BigDecimal; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; @@ -81,4 +82,10 @@ public class ObjectUtils { } return result; } + + public static BigDecimal objDivide(String s){ + BigDecimal bigDecimal = new BigDecimal(s); + BigDecimal res = bigDecimal.divide(new BigDecimal(10000)).setScale(2, BigDecimal.ROUND_UP); + return res; + } } From 55458441b6a28c4a82af01eabe53396554c19b9d Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Mon, 13 May 2024 20:39:55 +0800 Subject: [PATCH 10/50] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=EF=BC=9A=E6=9C=88?= =?UTF-8?q?=E6=8A=A5=E7=BB=9F=E8=AE=A1=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java | 4 ++-- .../report/service/impl/OperStationMonthReportServiceImpl.java | 2 +- .../ticket/twoTicket/service/impl/TicketProcessServiceImpl.java | 7 ++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java index c9d29b8..290ea22 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java @@ -361,9 +361,9 @@ public class TaskServiceImpl extends BaseServiceImpl imp taskReportVO.setUserId(userId); taskReportVO.setHours(list.stream().mapToLong(TaskCountVO::getHours).sum()); //巡检任务完成情况 - String finishSituation = list.stream().filter(vo -> StringUtil.isNotBlank(DictCache.getValue(TaskContants.INSPECT_TASK_TYPE, vo.getAutoVideo()))).map(vo -> DictCache.getValue(TaskContants.INSPECT_TASK_TYPE, vo.getAutoVideo()).concat(":").concat(String.valueOf(Optional.ofNullable(vo.getFinishTask()).orElse(0)))).collect(Collectors.joining("\r\n")); + String finishSituation = list.stream().filter(vo -> StringUtil.isNotBlank(DictCache.getValue(TaskContants.INSPECT_TASK_TYPE, vo.getAutoVideo()))).map(vo -> DictCache.getValue(TaskContants.INSPECT_TASK_TYPE, vo.getAutoVideo()).concat("完成数量:").concat(String.valueOf(Optional.ofNullable(vo.getFinishTask()).orElse(0)))).collect(Collectors.joining("\r\n")); //巡检任务未完成情况 - String undoSituation = list.stream().filter(vo -> StringUtil.isNotBlank(DictCache.getValue(TaskContants.INSPECT_TASK_TYPE, vo.getAutoVideo()))).map(vo -> DictCache.getValue(TaskContants.INSPECT_TASK_TYPE, vo.getAutoVideo()).concat(":").concat(String.valueOf(Optional.ofNullable(vo.getUndoneTask()).orElse(0)))).collect(Collectors.joining("\r\n")); + String undoSituation = list.stream().filter(vo -> StringUtil.isNotBlank(DictCache.getValue(TaskContants.INSPECT_TASK_TYPE, vo.getAutoVideo()))).map(vo -> DictCache.getValue(TaskContants.INSPECT_TASK_TYPE, vo.getAutoVideo()).concat("未完成数量:").concat(String.valueOf(Optional.ofNullable(vo.getUndoneTask()).orElse(0)))).collect(Collectors.joining("\r\n")); taskReportVO.setCompleteNum(list.stream().filter(taskCountVO -> Func.isNotEmpty(taskCountVO.getFinishTask())).collect(Collectors.summingInt(TaskCountVO::getFinishTask))); taskReportVO.setCompleteSituation(finishSituation); taskReportVO.setIncompleteNum(list.stream().filter(taskCountVO -> Func.isNotEmpty(taskCountVO.getUndoneTask())).collect(Collectors.summingInt(TaskCountVO::getUndoneTask))); 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 1f80b1b..1ebf282 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 @@ -1272,7 +1272,7 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor double ticketInfoProportion = sum == 0 ? 0 : new BigDecimal(qualifiedNum).divide(new BigDecimal(sum),2, RoundingMode.HALF_DOWN).multiply(new BigDecimal(100)) .setScale(2,RoundingMode.HALF_DOWN).doubleValue(); - String phenomenonConclusion = "5、本月开票%s张,合格率百分之%s%%"; + String phenomenonConclusion = "5、本月开票%s张,合格率为%s%%"; conclusion.append(String.format(phenomenonConclusion, sum, ticketInfoProportion)).append(";\r\n"); }else { conclusion.append("5、本月未开票;\r\n"); diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java index 69c85ed..743651d 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java @@ -539,7 +539,12 @@ public class TicketProcessServiceImpl implements TicketProcessService { } WorkTicketFinish workTicketFinish = workTicketVo.getWorkTicketFinish(); if(ObjectUtil.isNotEmpty(workTicketFinish)) { - workTicketFinishService.saveOrUpdate(workTicketFinish); + WorkTicketFinish res = workTicketFinishService.selectByTicketId(workTicketFinish.getTicketId()); + if (ObjectUtils.isEmpty(res)){ + workTicketFinishService.save(workTicketFinish); + }else { + workTicketFinishService.updateByTicketId(workTicketFinish); + } } // 推送消息 new Thread(() -> this.sendMessage(workTicket,response.getUserId())).start(); From e260edb9606124d844f11f7c3f4e1bedae79c413 Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Mon, 13 May 2024 23:21:22 +0800 Subject: [PATCH 11/50] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=EF=BC=9A=E6=9C=88?= =?UTF-8?q?=E6=8A=A5=E7=BB=9F=E8=AE=A1=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml | 4 ++-- .../access/service/impl/OperAccessTaskServiceImpl.java | 4 ++-- .../operational/defect/controller/OperDefectController.java | 4 ++++ .../service/impl/OperStationMonthReportServiceImpl.java | 13 +++++++++++-- .../hnac/hzims/operational/report/vo/FDPRunReportVO.java | 5 +++++ 5 files changed, 24 insertions(+), 6 deletions(-) diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml index 554313c..2fd01a6 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml @@ -394,10 +394,10 @@ where t.id = u.task_id and t.is_deleted = 0 and u.is_deleted = 0 and u.user_id is not null - and t.PLAN_START_TIME >= #{startTime} + and t.CREATE_TIME >= #{startTime} - and t.PLAN_END_TIME <= #{endTime} + and t.CREATE_TIME <= #{endTime} AND t.CREATE_DEPT IN diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java index 3242e57..8504ca8 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java @@ -297,8 +297,8 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl deptIdList = (List) params.get("deptId"); List operAccessTaskEntityList = this.list(new LambdaQueryWrapper() {{ - ge(OperAccessTaskEntity::getPlanStartTime, startDate); - le(OperAccessTaskEntity::getPlanStartTime, endDate); + ge(OperAccessTaskEntity::getCreateTime, startDate); + le(OperAccessTaskEntity::getCreateTime, endDate); in(OperAccessTaskEntity::getCreateDept, deptIdList); }}); List res =new ArrayList<>(); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectController.java index c5eba9b..b6a472e 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectController.java @@ -8,6 +8,7 @@ import com.hnac.hzims.common.invalid.ObjectRequiredInvalid; import com.hnac.hzims.common.logs.annotation.OperationAnnotation; import com.hnac.hzims.common.logs.enums.BusinessType; import com.hnac.hzims.common.logs.enums.OperatorType; +import com.hnac.hzims.common.logs.utils.StringUtils; import com.hnac.hzims.operational.defect.entity.OperDefectEntity; import com.hnac.hzims.operational.defect.service.IOperDefectService; import com.hnac.hzims.operational.defect.vo.OperDefectVO; @@ -93,6 +94,9 @@ public class OperDefectController extends BladeController { BusinessType.GENCODE, action = "获取缺陷的统计月报") public R> getDefectStatistics(@ApiParam(value = "month 格式:2021-01", required = true) @RequestParam String month, @RequestParam String deptId) { + if(StringUtils.isEmpty(deptId)){ + return R.data(new HashMap<>()); + } Map defectStatistics = defectService.getDefectStatistics(month,deptId); return R.data(defectStatistics); } 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 1ebf282..0d62ff1 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 @@ -487,6 +487,9 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor fdpRunReportVO.setIndex(index); fdpRunReportVO.setLastBeginTime(fdpFaultHistoryDataEntity.getCreateTime()); fdpRunReportVO.setType("智能预警"); + fdpRunReportVO.setOrd(fdpFaultHistoryDataEntity.getOrd()); + List stationEntities = stationEntityList.stream().filter(s -> s.getCode().equals(fdpFaultHistoryDataEntity.getStation())).collect(Collectors.toList()); + fdpRunReportVO.setStation(stationEntities.get(0).getName()); fdpRunReportVO.setContent(fdpFaultHistoryDataEntity.getName()); fdpRunReportVO.setNum(String.valueOf(fdpFaultHistoryDataEntities.size())); fdpRunReportVO.setReason(fdpFaultHistoryDataEntity.getDiagReason()); @@ -1222,11 +1225,17 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor List inspectReportVOList = stationReportAllVo.getInspectReportVOList(); int completeInspectTaskNum =inspectReportVOList.stream().filter(vo ->"合计".equals(vo.getUserName())).mapToInt(RunReportVO::getCompleteNum).sum(); int incompleteInspectTaskNum =inspectReportVOList.stream().filter(vo ->"合计".equals(vo.getUserName())).mapToInt(RunReportVO::getIncompleteNum).sum(); + int sum=completeInspectTaskNum+incompleteInspectTaskNum; + Double rate =0.0; + if (sum!=0){ + rate=new BigDecimal(completeInspectTaskNum).divide(new BigDecimal(sum),4,BigDecimal.ROUND_UP) + .multiply(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_UP).doubleValue(); + } if (completeInspectTaskNum == 0 && incompleteInspectTaskNum == 0) { conclusion.append("3、无巡检任务;\r\n"); } else { - String inspectTaskConclusion = "3、%s个巡检任务,已执行%s个巡检任务。"; - conclusion.append(String.format(inspectTaskConclusion, (completeInspectTaskNum + incompleteInspectTaskNum), completeInspectTaskNum)).append(";\r\n"); + String inspectTaskConclusion = "3、%s个巡检任务,已执行%s个巡检任务,完成率%s%%"; + conclusion.append(String.format(inspectTaskConclusion, sum, completeInspectTaskNum,rate)).append(";\r\n"); } } else { conclusion.append("3、无巡检任务;\r\n"); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/vo/FDPRunReportVO.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/vo/FDPRunReportVO.java index 0b40dc2..7f59d7f 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/vo/FDPRunReportVO.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/vo/FDPRunReportVO.java @@ -22,6 +22,11 @@ public class FDPRunReportVO implements Serializable { @ApiModelProperty("告警内容") private String content; + @ApiModelProperty("告警位置") + private String ord; + + @ApiModelProperty("站点") + private String station; @ApiModelProperty("告警类型") private String type; From c56363f9023e645fea648de128298ac529167b9a Mon Sep 17 00:00:00 2001 From: liwen Date: Tue, 14 May 2024 11:01:12 +0800 Subject: [PATCH 12/50] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E6=96=87=E4=BB=B6=E7=9A=84=E8=B6=85=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E6=9C=89=E5=A4=9A=E4=B8=AA=E6=97=B6=E6=8A=A5=E9=94=99=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/RehearsalRecordServiceImpl.java | 5 ++++- .../java/com/hnac/hzims/safeproduct/utils/BaseUtil.java | 14 ++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java index 55aaf12..2b9b50c 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java @@ -161,7 +161,10 @@ public class RehearsalRecordServiceImpl extends ServiceImpl iterator = p.getRuns().iterator(); - while (iterator.hasNext()) { - XWPFRun r = iterator.next(); - String text = r.getText(0); + for (int index = 0; index < p.getRuns().size(); index++) { + XWPFRun run = p.getRuns().get(index); + String text = run.getText(0); if (findText.equals(text)) { - r.setText("", 0); // 清除原有文本 - XWPFParagraph paragraph = r.getParagraph(); + run.setText("", 0); // 清除原有文本 + XWPFParagraph paragraph = run.getParagraph(); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); String name = jsonObject.getString("name"); String url = jsonObject.getString("url"); - url = URLEncoder.encode(url, "UTF-8"); String id = paragraph.getDocument().getPackagePart().addExternalRelationship(url, XWPFRelation.HYPERLINK.getRelation()).getId(); CTHyperlink cLink = paragraph.getCTP().addNewHyperlink(); cLink.setId(id); @@ -148,7 +146,7 @@ public class BaseUtil { CTR ctr = CTR.Factory.newInstance(); ctr.setTArray(new CTText[]{ctText}); cLink.setRArray(new CTR[]{ctr}); - if (i Date: Tue, 14 May 2024 11:51:54 +0800 Subject: [PATCH 13/50] =?UTF-8?q?fix:=20=E8=B6=85=E9=93=BE=E6=8E=A5url?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=A0=BC=E5=BC=8F=E5=8C=96=E7=BC=96=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 1340d78..7a4cbca 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 @@ -138,7 +138,12 @@ public class BaseUtil { JSONObject jsonObject = jsonArray.getJSONObject(i); String name = jsonObject.getString("name"); String url = jsonObject.getString("url"); - String id = paragraph.getDocument().getPackagePart().addExternalRelationship(url, XWPFRelation.HYPERLINK.getRelation()).getId(); + // url编码格式化 + String encodeName = URLEncoder.encode(name, "UTF-8").replaceAll("\\+", "%20"); + String prefixString = url.substring(0, url.lastIndexOf("/") + 1); + String encodeUrl = prefixString + encodeName; + String id = paragraph.getDocument().getPackagePart().addExternalRelationship(encodeUrl, + XWPFRelation.HYPERLINK.getRelation()).getId(); CTHyperlink cLink = paragraph.getCTP().addNewHyperlink(); cLink.setId(id); CTText ctText = CTText.Factory.newInstance(); From 29a3490f0c328c51ee5e269a85dc1abec8d2bcaf Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Tue, 14 May 2024 14:55:43 +0800 Subject: [PATCH 14/50] =?UTF-8?q?#=E9=9B=86=E4=B8=AD=E7=9B=91=E6=8E=A7?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=8A=B6=E6=80=81&=E4=B8=8A=E4=B8=8A?= =?UTF-8?q?=E9=99=90=EF=BC=8C=E4=B8=8B=E4=B8=8B=E9=99=90=E8=B6=85=E9=99=90?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/constant/HomePageConstant.java | 2 +- .../operation/monitor/impl/MonitorServiceImpl.java | 522 +++++++++------------ .../service/impl/RealMonitorServiceImpl.java | 2 - 3 files changed, 231 insertions(+), 295 deletions(-) diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java index af0113b..4337c56 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java @@ -88,7 +88,7 @@ public interface HomePageConstant { */ Integer HYDROPOWER_SERVETYPE = 2; - String HYDROPOWER_SERVETYPE_STR = "2"; + String HYDROPOWER_SERVETYPE_STRING = "2"; /** * 站点接入方式 : 数据采集 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 dc7af4b..029080c 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 @@ -8,8 +8,6 @@ import com.google.common.collect.Lists; import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.hnac.hzims.equipment.entity.WorkshopInfoEntity; import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; -import com.hnac.hzims.fdp.vo.FdpFaultStatusVo; -import com.hnac.hzims.operational.config.entity.StAlarmRecordEntity; import com.hnac.hzims.operational.config.enume.ConfigStatus; import com.hnac.hzims.operational.config.vo.StationRealVo; import com.hnac.hzims.operational.main.constant.HomePageConstant; @@ -41,6 +39,8 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; +import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.*; import java.util.concurrent.*; import java.util.function.Function; @@ -207,9 +207,7 @@ public class MonitorServiceImpl implements MonitorService { log.error("real_time_data: {},{}",stationReal.getStation(),realIds); List objects = redisClient.getBatchRealDataByRealId(stationReal.getStation(),realIds); for(int i = 0; i < realIds.size() ;i++){ - if(ObjectUtil.isEmpty(objects.get(i))){ -// log.error(realIds.get(i) + "is null"); - }else{ + if(ObjectUtil.isNotEmpty(objects.get(i))){ Map attribute = (Map) JSONObject.parse(objects.get(i)); attribute.put("realId",attribute.get("k")); attribute.put("value",attribute.get("v")); @@ -272,84 +270,51 @@ public class MonitorServiceImpl implements MonitorService { */ @Override public void loadMonitoring(String param) { - Thread thread = Thread.currentThread(); - Object json = redisTemplate.opsForValue().get(real_data_cache_final); - if (ObjectUtil.isEmpty(json)) { - return; - } - Map> map = JSONObject.parseObject(json.toString(), new TypeReference>>() { - }); - if (MapUtils.isEmpty(map)) { + // 集中监控属性配置 + Map> attributes = this.attributes(); + // realId对应实时数据 + Map> realTimeData = this.realTimeData(); + if(MapUtils.isEmpty(attributes) || MapUtils.isEmpty(realTimeData)){ return; } - // 获取所有设备重点属性 - List list = attbtService.list(new LambdaQueryWrapper() {{ - isNotNull(StationAttributeEntity::getStationId); - eq(StationAttributeEntity::getIsDeleted, "0"); - orderByAsc(StationAttributeEntity::getSort); - }}); - if (CollectionUtil.isEmpty(list)) { + // 集中监控站点 + List stations = this.monitorStations(new ArrayList<>(attributes.keySet())); + if(CollectionUtil.isEmpty(stations)){ return; } - // 获取所有告警记录 - List alertList = alertService.list(new LambdaQueryWrapper() {{ - orderByDesc(StAlarmRecordEntity::getCreateTime); - }}); - // 所有设备分类 + // 机构(取排序字段) + Map sorts = this.monitorDeptSorts(); + List operations = stations.stream().filter(o->HomePageConstant.HYDROPOWER_SERVETYPE_STRING.equals(o.getServeType())).map(StationEntity::getCode).collect(Collectors.toList()); + // 告警铃铛(代运维) + List bells = alarmQueryService.bells(operations); + // 数据中断(代运维) + List aborts = interruptionAlarmService.aborts(operations); + // 设备状态分类 Map> deviceClassifyMap = (Map>) redisTemplate.opsForValue().get(device_classify_cache_final); - // 所有设备 - List devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_final).toString(),new TypeReference>() {}); - // 根据站点分组 - Map> stationAttbtMap = list.stream().collect(Collectors.groupingBy(StationAttributeEntity::getStationId)); - // 获取站点列表 - List stationEntityList = stationService.list(Wrappers.lambdaQuery() - .in(StationEntity::getCode,new ArrayList<>(stationAttbtMap.keySet()))); - // 铃铛 - List bells = alarmQueryService.bells(stationEntityList.stream().map(StationEntity::getCode).collect(Collectors.toList())); - // 数据中断 - List aborts = interruptionAlarmService.aborts(stationEntityList.stream().filter(o->HomePageConstant.HYDROPOWER_SERVETYPE_STR.equals(o.getServeType())).map(StationEntity::getCode).collect(Collectors.toList())); - // 隐藏设备列表 - List hideList = attrConfigService.getHideList(); - // 分割,每个map限制10个长度 - List>> handleList = this.mapChunk(stationAttbtMap); - // 创建线程池 - CountDownLatch countDownLatch = new CountDownLatch(handleList.size()); - // 所有机构 - R> deptAll = sysClient.getDeptList(); + // 按10个站点一组分割属性配置 + List>> limit = this.limitMapChunk(attributes); + // 线程执行次数 + CountDownLatch countDownLatch = new CountDownLatch(limit.size()); // 存储数据节点 - List stationList = new CopyOnWriteArrayList<>(); - // 线程处理数据 - for(Map> item : handleList){ + List realStations = new CopyOnWriteArrayList<>(); + // 切割数据遍历 + for(Map> item : limit){ + // 提交线程任务 pool.submit(()->{ item.forEach((key,value)->{ - RealStationVo station = new RealStationVo(); - // 站点编码 - station.setStationCode(key); - // 名称、限制水位、服务类型、机构、排序 - this.stationParam(stationEntityList,station,deptAll.getData()); - // 根据设备名称分组 - Map> deviceAttbtMap = value.stream().filter(o -> !StringUtil.isEmpty(o.getEmName()) && !hideList.contains(o.getEmName())).collect(Collectors.groupingBy(StationAttributeEntity::getEmName)); - List deviceList = new ArrayList<>(); - // device - 设备,arrbt - 设备重点属性 - deviceAttbtMap.forEach((device, attbt) -> { - RealDeviceVo deviceVo = new RealDeviceVo(); - // 设备名称 - deviceVo.setDeviceName(device); - deviceVo.setDeviceCode(attbt.get(0).getEmCode()); - // 设备处理 - this.handleDevice(attbt, map, deviceVo, alertList); - deviceList.add(deviceVo); - }); + RealStationVo realStation = new RealStationVo(); + // 设备信息 + List devices = this.monitorRealDevice(value,realTimeData); // 设备状态 - this.getDeviceParam(devices, deviceClassifyMap, deviceList); - // 设置站点状态:数据中断 - this.setStationStatus(aborts,station,key,deviceList); - // 运行设备状态设置 - this.deviceState(deviceList); - // 铃铛 - this.stationBell(station,bells); - station.setDeviceList(deviceList.stream().sorted(Comparator.comparing((RealDeviceVo::getDeviceName))).collect(Collectors.toList())); - stationList.add(station); + this.deviceStatus(devices,deviceClassifyMap); + realStation.setDeviceList(devices.stream().sorted(Comparator.comparing(RealDeviceVo::getDeviceName)).collect(Collectors.toList())); + // 站点基础信息: 编码、名称、限制水位、服务类型、机构、排序 + this.stationBaseInfo(stations.stream().filter(station->key.equals(station.getCode())).findFirst(),sorts,realStation); + // 站点总功率计算 + this.stationActivePower(devices,realStation); + // 站点铃铛、数据中断状态 + this.stationStatus(aborts,bells,realStation); + realStations.add(realStation); }); countDownLatch.countDown(); }); @@ -361,169 +326,223 @@ public class MonitorServiceImpl implements MonitorService { e.printStackTrace(); Thread.currentThread().interrupt(); } - redisTemplate.opsForValue().set(moniter_station_cache_final, stationList); + redisTemplate.opsForValue().set(moniter_station_cache_final, realStations); } /** - * 站点铃铛设置 - * @param station - * @param bells + * 设置设备状态 + * @param devices + * @param deviceClassifyMap */ - private void stationBell(RealStationVo station, List bells) { - station.setBell(0); - if(CollectionUtil.isEmpty(bells)){ + private void deviceStatus(List devices, Map> deviceClassifyMap) { + if (CollectionUtil.isEmpty(devices) || MapUtils.isEmpty(deviceClassifyMap)) { return; } - if(bells.contains(station.getStationCode())){ - station.setBell(1); - } + List faults = deviceClassifyMap.get(HomePageConstant.FAULT); + List overhaults = deviceClassifyMap.get(HomePageConstant.OVERHAUL); + devices.forEach(device -> { + int state = -1; + if(StringUtil.isNotBlank(device.getDeviceCode())){ + // 故障 + if (CollectionUtil.isNotEmpty(faults) && faults.contains(device.getDeviceCode())) { + state = 4; + // 检修 + } else if (CollectionUtil.isNotEmpty(overhaults) && overhaults.contains(device.getDeviceCode())) { + state = 0; + } + } + if(state >= 0){ + device.setState(state); + }else{ + List attbts = device.getAttbtList(); + // 功率属性记录 + List powers = attbts.stream().filter(att-> HomePageConstant.powerList.contains(att.getName())).collect(Collectors.toList()); + if(CollectionUtil.isEmpty(powers)){ + device.setState(-1); + return; + } + if("0.000000".equals(powers.get(0).getValue()) || "-".equals(powers.get(0).getValue()) || HomePageConstant.ON.equals(powers.get(0).getValue())){ + device.setState(-1); + return; + } + device.setState(1); + } + }); } /** - * 设备处理 - * - * @param list、 - * @param map - * @param device + * 站点总功率计算 + * @param devices + * @param realStation */ - private void handleDevice(List list, Map> map, - RealDeviceVo device, List alertList) { - if (CollectionUtil.isEmpty(list) || MapUtils.isEmpty(map)) { + private void stationActivePower(List devices, RealStationVo realStation) { + realStation.setPowerSum(0.0); + if (CollectionUtil.isEmpty(devices)) { return; } - List attbtList = new ArrayList<>(); - list.forEach(item -> { - RealAttributeVo realAttributeVo = new RealAttributeVo(); - // 设备重点属性处理 : 单条-item - Map real = map.get(item.getMonitorId()); - if(MapUtils.isEmpty(real)){ - realAttributeVo.setName(item.getAttributes()); - realAttributeVo.setType(item.getAttributeType()); - realAttributeVo.setRealId(item.getMonitorId()); - realAttributeVo.setQuality(-1); - realAttributeVo.setStatus(0); - realAttributeVo.setValue("0"); - realAttributeVo.setUnit(item.getUnit()); - attbtList.add(realAttributeVo); + double powerSum = 0.0; + // 遍历设备 + for (RealDeviceVo item : devices) { + List attributes = item.getAttbtList(); + if (CollectionUtil.isEmpty(attributes)) { return; } - realAttributeVo = handleAttbt(item, real, alertList); - if (ObjectUtil.isEmpty(realAttributeVo)) { + List powerList = attributes.stream().filter(o -> StringUtil.isNoneBlank(o.getValue()) && !"-".equals(o.getValue()) && HomePageConstant.powerList.contains(o.getName())).collect(Collectors.toList()); + if (CollectionUtil.isEmpty(powerList)) { return; } - attbtList.add(realAttributeVo); - }); - device.setAttbtList(attbtList); + // 获取设备中属性为P/p的value值总和 + powerSum += BigDecimal.valueOf(powerList.stream().mapToDouble(m -> Double.parseDouble(m.getValue())).sum()).setScale(2, RoundingMode.HALF_UP).doubleValue(); + } } /** - * 设备状态 - * @param deviceList + * 站点铃铛、数据中断状态 + * @param aborts + * @param bells + * @param realStation */ - private void deviceState(List deviceList) { - deviceList.forEach(device->{ - // 设备属性列表 - List attbts = device.getAttbtList(); - if(CollectionUtil.isEmpty(attbts)){ - device.setState(-1); - return; - } + private void stationStatus(List aborts, List bells, RealStationVo realStation) { + realStation.setBell(0); + realStation.setStatus(0); + // 铃铛 + if(bells.contains(realStation.getStationCode())){ + realStation.setBell(1); + } + // 数据中断 + if(realStation.getPowerSum() <= 0 && aborts.contains(realStation.getStationCode())){ + realStation.setStatus(1); + } + } - // 功率属性记录 - List powers = attbts.stream().filter(att-> HomePageConstant.powerList.contains(att.getName())).collect(Collectors.toList()); - if(CollectionUtil.isEmpty(powers)){ - device.setState(-1); - return; - } - if("0.000000".equals(powers.get(0).getValue()) || "-".equals(powers.get(0).getValue()) || HomePageConstant.ON.equals(powers.get(0).getValue())){ - device.setState(-1); - return; - } - device.setState(1); + /** + * 监控设备实时信息 + * @param attributes + * @param realTimeData + * @return + */ + private List monitorRealDevice(List attributes,Map> realTimeData) { + if(CollectionUtil.isEmpty(attributes)){ + return new ArrayList<>(); + } + // 根据设备名称分组 + return attributes.stream().filter(o -> !StringUtil.isEmpty(o.getEmName())).collect(Collectors.groupingBy(StationAttributeEntity::getEmName)).entrySet().stream().map(entry->{ + RealDeviceVo device = new RealDeviceVo(); + device.setDeviceName(entry.getKey()); + device.setDeviceCode(entry.getValue().get(0).getEmCode()); + // 设备处理 + this.handleDevice(entry.getValue(), realTimeData, device); + return device; + }).collect(Collectors.toList()); + } + + + /** + * 获取缓存中实时数据 + * @return + */ + private Map> realTimeData() { + Object json = redisTemplate.opsForValue().get(real_data_cache_final); + if (ObjectUtil.isEmpty(json)) { + return new HashMap<>(); + } + return JSONObject.parseObject(json.toString(), new TypeReference>>() { }); } /** - * 获取站点属性 - * @param stationEntityList - * @param item + * 查询集中监控属性配置 + * @return */ - private void stationParam(List stationEntityList, RealStationVo item,List deptAll) { - item.setSort(9999); - if(CollectionUtil.isEmpty(stationEntityList)){ - return; + private Map> attributes() { + List attributes = attbtService.list(new LambdaQueryWrapper() {{ + isNotNull(StationAttributeEntity::getStationId); + orderByAsc(StationAttributeEntity::getSort); + }}); + if(CollectionUtil.isEmpty(attributes)){ + return new HashMap<>(); } - List filterList = stationEntityList.stream().filter(o->item.getStationCode().equals(o.getCode())).collect(Collectors.toList()); - if(CollectionUtil.isEmpty(filterList)){ - return; + return attributes.stream().collect(Collectors.groupingBy(StationAttributeEntity::getStationId)); + } + + /** + * 集中监控站点 + * @param codes + * @return + */ + private List monitorStations(ArrayList codes) { + return stationService.list(Wrappers.lambdaQuery() + .in(StationEntity::getCode,codes) + ); + } + + /** + * 机构排序 + * @return + */ + private Map monitorDeptSorts() { + R> depts = sysClient.getDeptList(); + if (!depts.isSuccess() || CollectionUtil.isEmpty(depts.getData())) { + new HashMap<>(); } - StationEntity station = filterList.get(0); - if(ObjectUtil.isEmpty(station)){ + return depts.getData().stream().collect(Collectors.toMap(Dept::getId,Dept::getSort)); + } + + /** + * 站点基础信息 + * @param realStation + */ + private void stationBaseInfo(Optional optional, Map sorts, RealStationVo realStation) { + realStation.setSort(999); + if(!optional.isPresent()){ return; } - item.setStationName(station.getName()); - item.setWaterLevelMax(Optional.ofNullable(station.getLimitWaterLevel()).orElse(0.0)); - item.setServerType(station.getServeType()); - item.setStationDeptId(station.getRefDept()); - // 排序 - List list = deptAll.stream().filter(o-> station.getRefDept().equals(o.getId())).collect(Collectors.toList()); - if(CollectionUtil.isEmpty(list)){ - return; + realStation.setStationCode(optional.get().getCode()); + realStation.setStationName(optional.get().getName()); + realStation.setWaterLevelMax(Optional.ofNullable(optional.get().getLimitWaterLevel()).orElse(0.0)); + realStation.setServerType(optional.get().getServeType()); + realStation.setStationDeptId(optional.get().getRefDept()); + if(sorts.containsKey(optional.get().getRefDept())){ + realStation.setSort(sorts.get(optional.get().getRefDept())); } - item.setSort(list.get(0).getSort()); } + + /** - * 设备参数设置 + * 设备处理 * - * @param devices - * @param deviceClassifyMap - * @param deviceList + * @param list、 + * @param map + * @param device */ - private void getDeviceParam(List devices, Map> deviceClassifyMap, List deviceList) { - if (CollectionUtil.isEmpty(devices) || CollectionUtil.isEmpty(deviceList) || MapUtils.isEmpty(deviceClassifyMap)) { + private void handleDevice(List list, Map> map,RealDeviceVo device) { + if (CollectionUtil.isEmpty(list) || MapUtils.isEmpty(map)) { return; } - List faultList = deviceClassifyMap.get(HomePageConstant.FAULT); - List maintaintList = deviceClassifyMap.get(HomePageConstant.MAINTAIN); - List overhaultList = deviceClassifyMap.get(HomePageConstant.OVERHAUL); - List runtList = deviceClassifyMap.get(HomePageConstant.RUN); - List sparetList = deviceClassifyMap.get(HomePageConstant.SPARE); - deviceList.forEach(device -> { - if (StringUtil.isBlank(device.getDeviceCode())) { - device.setState(-1); - return; - } - List list = devices.stream().filter(o -> null != o.getId() && o.getId().toString().equals(device.getDeviceCode())).collect(Collectors.toList()); - if (CollectionUtil.isEmpty(list)) { - device.setState(-1); + List attbtList = new ArrayList<>(); + list.forEach(item -> { + RealAttributeVo realAttributeVo = new RealAttributeVo(); + // 设备重点属性处理 : 单条-item + Map real = map.get(item.getMonitorId()); + if(MapUtils.isEmpty(real)){ + realAttributeVo.setName(item.getAttributes()); + realAttributeVo.setType(item.getAttributeType()); + realAttributeVo.setRealId(item.getMonitorId()); + realAttributeVo.setQuality(-1); + realAttributeVo.setStatus(0); + realAttributeVo.setValue("0"); + realAttributeVo.setUnit(item.getUnit()); + attbtList.add(realAttributeVo); return; } - String deviceCode = list.get(0).getEmCode(); - if (StringUtil.isBlank(deviceCode)) { - device.setState(-1); + realAttributeVo = handleAttbt(item, real); + if (ObjectUtil.isEmpty(realAttributeVo)) { return; } - // 故障 - if (CollectionUtil.isNotEmpty(faultList) && faultList.contains(deviceCode)) { - device.setState(4); - // 保养 - } else if (CollectionUtil.isNotEmpty(maintaintList) && maintaintList.contains(deviceCode)) { - device.setState(3); - // 备用 - } else if (CollectionUtil.isNotEmpty(sparetList) && sparetList.contains(deviceCode)) { - device.setState(2); - // 运行 - } else if (CollectionUtil.isNotEmpty(runtList) && runtList.contains(deviceCode)) { - device.setState(1); - // 检修 - } else if (CollectionUtil.isNotEmpty(overhaultList) && overhaultList.contains(deviceCode)) { - device.setState(0); - // 未知 - } else { - device.setState(-1); - } + attbtList.add(realAttributeVo); }); + device.setAttbtList(attbtList); } /** @@ -533,8 +552,7 @@ public class MonitorServiceImpl implements MonitorService { * @param real * @return */ - private RealAttributeVo handleAttbt(StationAttributeEntity item, Map real, - List alertList) { + private RealAttributeVo handleAttbt(StationAttributeEntity item, Map real) { RealAttributeVo attest = new RealAttributeVo(); this.setAttbtParam(attest, real); attest.setRealId(item.getMonitorId()); @@ -544,7 +562,7 @@ public class MonitorServiceImpl implements MonitorService { String value = Optional.ofNullable(attest.getValue()).orElse("-"); // 正常状态 attest.setStatus(ConfigStatus.ConfigStatusEnum.NORMAL.getStatus()); - int quality = Optional.ofNullable(attest.getQuality()).orElse(-1); + int quality = Optional.of(attest.getQuality()).orElse(-1); String time = Optional.ofNullable(attest.getTime()).orElse(""); // 延时状态 :质量为空 && 时间为空 if (-1 == quality && StringUtil.isEmpty(time)) { @@ -552,14 +570,16 @@ public class MonitorServiceImpl implements MonitorService { } int type = item.getAttributeType(); switch (type) { - case 1://遥测 + //遥测 + case 1: // 预警状态 :value值为"1" && quality值为0 if ("1".equals(value) && 0 == quality) { attest.setStatus(ConfigStatus.ConfigStatusEnum.RED.getStatus()); } break; - case 2://遥信 - signalyRemote(item, attest, quality, value, alertList); + //遥信 + case 2: + signalyRemote(item, attest, quality, value); //处理 break; default: @@ -606,9 +626,9 @@ public class MonitorServiceImpl implements MonitorService { * * @param attest */ - private void signalyRemote(StationAttributeEntity item, RealAttributeVo attest, int quality, String strValue, List alertList) { - //需要所有值的数据不为null,并且满足条件才会进去添加数据返回id - if (null == item.getUpUpLimit() || null == item.getDownDownLimit() || null == item.getUpLimit() || null == item.getDownLimit()) { + private void signalyRemote(StationAttributeEntity attribute, RealAttributeVo attest, int quality, String strValue) { + // 需要所有限制不为null,并且满足条件才会设置设备状态标识 + if (null == attribute.getUpUpLimit() || null == attribute.getDownDownLimit() || null == attribute.getUpLimit() || null == attribute.getDownLimit()) { return; } if (-1 == quality) { @@ -620,99 +640,17 @@ public class MonitorServiceImpl implements MonitorService { if ("-".equals(strValue)) { return; } - double upup = item.getUpUpLimit(); - double lwlw = item.getDownDownLimit(); - double up = item.getUpLimit(); - double lw = item.getDownLimit(); - //查询出来已处理告警记录 - List handleList = alertList.stream().filter(o -> o.getStationId().equals(item.getStationId()) && o.getRealId().equals(attest.getRealId()) && o.getStatus() == 1).collect(Collectors.toList()); - //查询出来未处理告警记录 - List recordList = alertList.stream().filter(o -> o.getStationId().equals(item.getStationId()) && o.getRealId().equals(attest.getRealId()) && o.getStatus() == 0).collect(Collectors.toList()); + double upup = attribute.getUpUpLimit(); + double lwlw = attribute.getDownDownLimit(); + double up = attribute.getUpLimit(); + double lw = attribute.getDownLimit(); long past = 0L; double value = Double.parseDouble(strValue); if (value > upup || value < lwlw) { - if (CollectionUtil.isNotEmpty(handleList)) { - // 现在时间 - 处理时间 - past = System.currentTimeMillis() - handleList.get(0).getProcessTime().getTime(); - } - boolean isOverrun = ((CollectionUtil.isEmpty(handleList) && CollectionUtil.isEmpty(recordList)) || (past / 1000 / 60 > 30 && CollectionUtil.isEmpty(recordList))); - if (isOverrun) { - Long alertId = alertService.insertAlert(item.getStationId(), item.getMonitorId()); - attest.setId(alertId); - attest.setStatus(ConfigStatus.ConfigStatusEnum.YELLOW.getStatus()); - } else if (CollectionUtil.isNotEmpty(recordList)) { - StAlarmRecordEntity record = recordList.get(0); - attest.setId(record.getId()); - // 告警处理完成 - if (record.getProcessTime() != null && record.getStatus() == (byte) 1) { - attest.setStatus(ConfigStatus.ConfigStatusEnum.NORMAL.getStatus()); - // 告警未处理 - } else if (record.getProcessTime() == null && record.getStatus() == (byte) 0) { - attest.setStatus(ConfigStatus.ConfigStatusEnum.HAND_DELAY_STATUS.getStatus()); - } - } + attest.setStatus(ConfigStatus.ConfigStatusEnum.RED.getStatus()); } else if (value > up && value < upup || value < lw && value > lwlw) { - if (CollectionUtil.isNotEmpty(handleList)) { - // 现在时间 - 处理时间 - past = System.currentTimeMillis() - handleList.get(0).getProcessTime().getTime(); - } - boolean exist = ((CollectionUtil.isEmpty(handleList) && CollectionUtil.isEmpty(recordList)) || (past / 1000 / 60 > 30 && CollectionUtil.isEmpty(recordList))); - if (exist){ - Long alertId = alertService.insertAlert(item.getStationId(), item.getMonitorId()); - attest.setId(alertId); - attest.setStatus(ConfigStatus.ConfigStatusEnum.YELLOW.getStatus()); - // 存在告警记录 - } else if (CollectionUtil.isNotEmpty(recordList)) { - StAlarmRecordEntity record = recordList.get(0); - if (recordList.get(0).getStatus() == (byte) 0 && recordList.get(0).getCreateTime() != null) { - attest.setId(record.getId()); - attest.setStatus(ConfigStatus.ConfigStatusEnum.RED.getStatus()); - } else { - attest.setId(recordList.get(0).getId()); - attest.setStatus(ConfigStatus.ConfigStatusEnum.NORMAL.getStatus()); - } - } - } - } - - /** - * 设置站点状态 - * @param station - * @param key - */ - private void setStationStatus(List aborts,RealStationVo station, String key,List deviceList) { - // 站点功率大于0为正常上送数据 - for(RealDeviceVo item : deviceList){ - if(!CollectionUtil.isEmpty(item.getAttbtList())){ - List powers = item.getAttbtList().stream().filter(att-> HomePageConstant.powerList.contains(att.getName())).collect(Collectors.toList()); - if(!CollectionUtil.isEmpty(powers)){ - for(RealAttributeVo attr : powers){ - if(!"-".equals(attr.getValue())){ - if(attr.getQuality() == 0 && Double.parseDouble(attr.getValue()) > 0){ - station.setStatus(0); - return; - } - } - } - } - } - } - if(aborts.contains(key)){ - station.setStatus(1); - } - } - - /** - * 获取所有告警记录 - * - * @return - */ - private List getFdpFaultAll() { - Object json = redisTemplate.opsForValue().get(fdp_fault_cache_final); - if (ObjectUtil.isEmpty(json)) { - return new ArrayList<>(); + attest.setStatus(ConfigStatus.ConfigStatusEnum.YELLOW.getStatus()); } - return (List) json; } /** @@ -723,7 +661,7 @@ public class MonitorServiceImpl implements MonitorService { * @param chunkMap * @return */ - private List> mapChunk(Map chunkMap) { + private List> limitMapChunk(Map chunkMap) { if (chunkMap == null) { return Lists.newArrayList(); } 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 e6aed35..251a618 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 @@ -252,8 +252,6 @@ public class RealMonitorServiceImpl implements IRealMonitorService { this.weather(nowWeather,weekWeather,item); // 前池水位 this.waterLevel(levelList,item); - // 总有功率 - this.activePower(item); }); log.info("步骤4站点数据处理 耗时 : {}",System.currentTimeMillis() - beginTime); return new TextMessage(JSONObject.toJSONString(validList.stream().peek(o->{ From 85c7f783d442b0a86a59f751dcfb754a42c1739c Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Tue, 14 May 2024 15:36:21 +0800 Subject: [PATCH 15/50] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=EF=BC=9A=E6=9C=88?= =?UTF-8?q?=E6=8A=A5=E7=BB=9F=E8=AE=A1=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../report/service/impl/OperStationMonthReportServiceImpl.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 0d62ff1..7e7de11 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 @@ -487,9 +487,11 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor fdpRunReportVO.setIndex(index); fdpRunReportVO.setLastBeginTime(fdpFaultHistoryDataEntity.getCreateTime()); fdpRunReportVO.setType("智能预警"); - fdpRunReportVO.setOrd(fdpFaultHistoryDataEntity.getOrd()); + fdpRunReportVO.setOrd(fdpFaultHistoryDataEntity.getOrd()==null?"":fdpFaultHistoryDataEntity.getOrd()); List stationEntities = stationEntityList.stream().filter(s -> s.getCode().equals(fdpFaultHistoryDataEntity.getStation())).collect(Collectors.toList()); - fdpRunReportVO.setStation(stationEntities.get(0).getName()); + if (CollectionUtil.isNotEmpty(stationEntities)){ + fdpRunReportVO.setStation(stationEntities.get(0).getName()); + } fdpRunReportVO.setContent(fdpFaultHistoryDataEntity.getName()); fdpRunReportVO.setNum(String.valueOf(fdpFaultHistoryDataEntities.size())); fdpRunReportVO.setReason(fdpFaultHistoryDataEntity.getDiagReason()); From 196eb317e56e2307a638a5f8cf6268933e4653e2 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Wed, 15 May 2024 08:07:35 +0800 Subject: [PATCH 16/50] =?UTF-8?q?#=E5=8F=91=E7=94=B5=E9=87=8F=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E6=9C=80=E5=90=8E=E5=80=BC=E5=87=8F=E6=9C=80=E5=88=9D?= =?UTF-8?q?=E5=80=BC=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/alarm/config/entity/AlarmEntity.java | 5 ++ .../source/service/impl/VideoAlarmServiceImpl.java | 10 ++-- .../scheduled/scheduled/AlarmScheduledTask.java | 1 + .../operation/monitor/impl/MonitorServiceImpl.java | 5 +- .../service/operation/plate/DataService.java | 2 + .../operation/plate/impl/DataServiceImpl.java | 53 +++++++++++++++++++++- 6 files changed, 66 insertions(+), 10 deletions(-) diff --git a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/entity/AlarmEntity.java b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/entity/AlarmEntity.java index a938a80..ebb82d2 100644 --- a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/entity/AlarmEntity.java +++ b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/entity/AlarmEntity.java @@ -1,11 +1,14 @@ package com.hnac.hzims.alarm.config.entity; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import org.springblade.core.tenant.mp.TenantEntity; +import org.springblade.core.tool.utils.DateUtil; +import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; import java.util.Date; @@ -68,6 +71,8 @@ public class AlarmEntity extends TenantEntity { private Integer alarmCount; @ApiModelProperty(value = "告警时间") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss.sss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.sss") private Date alarmTime; @ApiModelProperty(value = "监测点") diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/VideoAlarmServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/VideoAlarmServiceImpl.java index 16a7a37..0ddbaa9 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/VideoAlarmServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/VideoAlarmServiceImpl.java @@ -68,7 +68,7 @@ public class VideoAlarmServiceImpl implements VideoAlarmService { return records; } return records; - }).filter(s -> CollectionUtil.isNotEmpty(s)).collect(Collectors.toList()); + }).filter(CollectionUtil::isNotEmpty).collect(Collectors.toList()); List res =new ArrayList<>(); if (CollectionUtil.isNotEmpty(collect)) { res= collect.stream().flatMap(List::stream).collect(Collectors.toList()); @@ -76,7 +76,7 @@ public class VideoAlarmServiceImpl implements VideoAlarmService { // 转换平台视频预警信息 List alarmEntities =new ArrayList<>(); if (CollectionUtil.isNotEmpty(res)) { - alarmEntities= res.stream().filter(s->ObjectUtils.isNotEmpty(s)).map(s -> getAlarmEntity(s)).collect(Collectors.toList()); + alarmEntities= res.stream().filter(ObjectUtils::isNotEmpty).map(this::getAlarmEntity).collect(Collectors.toList()); } return alarmEntities; } @@ -93,11 +93,7 @@ public class VideoAlarmServiceImpl implements VideoAlarmService { if (CollectionUtil.isEmpty(alarms)) { return new ArrayList<>(); } - List res = alarms.stream().map(s -> { - AlarmEntity entity = getAlarmEntity(s); - return entity; - }).collect(Collectors.toList()); - return res; + return alarms.stream().map(this::getAlarmEntity).collect(Collectors.toList()); } private AlarmEntity getAlarmEntity(DeviceSoeVO item) { diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/AlarmScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/AlarmScheduledTask.java index f84fcb2..8d89a72 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/AlarmScheduledTask.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/AlarmScheduledTask.java @@ -69,4 +69,5 @@ public class AlarmScheduledTask { alarmService.interruption(param); return new ReturnT<>("SUCCESS"); } + } \ No newline at end of file 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 029080c..13b41ce 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 @@ -385,15 +385,16 @@ public class MonitorServiceImpl implements MonitorService { for (RealDeviceVo item : devices) { List attributes = item.getAttbtList(); if (CollectionUtil.isEmpty(attributes)) { - return; + continue; } List powerList = attributes.stream().filter(o -> StringUtil.isNoneBlank(o.getValue()) && !"-".equals(o.getValue()) && HomePageConstant.powerList.contains(o.getName())).collect(Collectors.toList()); if (CollectionUtil.isEmpty(powerList)) { - return; + continue; } // 获取设备中属性为P/p的value值总和 powerSum += BigDecimal.valueOf(powerList.stream().mapToDouble(m -> Double.parseDouble(m.getValue())).sum()).setScale(2, RoundingMode.HALF_UP).doubleValue(); } + realStation.setPowerSum(powerSum); } /** diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/plate/DataService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/plate/DataService.java index b397b5d..d08cab2 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/plate/DataService.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/plate/DataService.java @@ -29,5 +29,7 @@ public interface DataService { List> lastFirstBySignage(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, String signages); + Float lastFirstByFloat(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, Double ride ,String signages); + Float periodTargetFloat(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, Double ride ,String signages); } diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/plate/impl/DataServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/plate/impl/DataServiceImpl.java index ffd6086..4d3fede 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/plate/impl/DataServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/plate/impl/DataServiceImpl.java @@ -168,7 +168,7 @@ public class DataServiceImpl implements DataService { @Override public List> lastFirstBySignage(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, String signage) { ReductionDataDTO reduction = new ReductionDataDTO(); - reduction.setFull(1); + reduction.setFull(0); reduction.setDeviceCode(deviceCode); reduction.setSaveTimeType(cycleType); reduction.setTimeInterval(1); @@ -201,6 +201,57 @@ public class DataServiceImpl implements DataService { * @param cycleType 间隔周期 : 0-> 秒 1-> 分 2-> 小时 3->天 4-> 周 5-> 月 6-> 年 * @param deviceCode 设备编号 * @param ride 配电比 + * @param signage 指标 + * @return + */ + @Override + public Float lastFirstByFloat(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode,Double ride,String signage) { + ReductionDataDTO reduction = new ReductionDataDTO(); + reduction.setFull(0); + reduction.setDeviceCode(deviceCode); + reduction.setSaveTimeType(cycleType); + reduction.setTimeInterval(1); + reduction.setNeedPage(false); + reduction.setBeginTime(LocalDateTime.parse(DateUtil.format(new Date(), startTime), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME))); + reduction.setEndTime(LocalDateTime.parse(DateUtil.format(new Date(), endTime), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME))); + // 属性列表 + List atts = new ArrayList<>(); + ReductionAttrDataDTO attr = new ReductionAttrDataDTO(); + attr.setAccessRules(accessRules); + attr.setKeepFigures(4); + attr.setSignage(signage); + atts.add(attr); + reduction.setDtos(atts); + Result result = deviceDataClient.pageDeviceCodeAndSignages(reduction); + if (!result.isSuccess() || ObjectUtil.isEmpty(result.getData())) { + return 0f; + } + if(MapUtils.isEmpty(result.getData().getFieldMap()) || CollectionUtil.isEmpty(result.getData().getDataList())){ + return 0f; + } + List> dataList = result.getData().getDataList(); + if (CollectionUtil.isEmpty(dataList)) { + return 0f; + } + Map data = dataList.get(0); + if(MapUtils.isEmpty(data)){ + return 0f; + } + String val = data.get(signage); + if(StringUtil.isEmpty(val)){ + return 0f; + } + return Float.parseFloat(String.valueOf(Double.parseDouble(val) * ride)); + } + + /*** + * 指标数据列表查询 + * @param startTime 开始时间 + * @param endTime 结束时间 + * @param accessRules 取数规则 : 0=最早值 1=最大值 2=最小值 3=平均值 4=和值 5=差值 6=最新值 + * @param cycleType 间隔周期 : 0-> 秒 1-> 分 2-> 小时 3->天 4-> 周 5-> 月 6-> 年 + * @param deviceCode 设备编号 + * @param ride 配电比 * @param signages 指标 * @return */ From 8c12033877c4de0c55b09d40b786a4c68171e09b Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Wed, 15 May 2024 08:08:12 +0800 Subject: [PATCH 17/50] =?UTF-8?q?#=E5=8F=91=E7=94=B5=E9=87=8F=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E6=9C=80=E5=90=8E=E5=80=BC=E5=87=8F=E6=9C=80=E5=88=9D?= =?UTF-8?q?=E5=80=BC=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hnac/hzims/alarm/mqtt/DroolsMqttConsumer.java | 3 +++ .../source/service/impl/DroolsAlarmServiceImpl.java | 16 +++------------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/DroolsMqttConsumer.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/DroolsMqttConsumer.java index f14d600..d24774e 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/DroolsMqttConsumer.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/DroolsMqttConsumer.java @@ -4,11 +4,14 @@ import com.alibaba.fastjson.JSONObject; import com.hnac.hzims.alarm.config.entity.AlarmEntity; import com.hnac.hzims.alarm.source.service.DroolsAlarmService; import com.hnac.hzims.alarm.monitor.service.AlarmSaveService; +import com.hnac.hzims.common.utils.DateUtil; import com.hnac.hzinfo.subscribe.SubscribeCallBack; import lombok.extern.slf4j.Slf4j; +import oracle.sql.DATE; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.Date; import java.util.List; import java.util.Map; diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/DroolsAlarmServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/DroolsAlarmServiceImpl.java index f4b756a..9b63cc3 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/DroolsAlarmServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/DroolsAlarmServiceImpl.java @@ -3,7 +3,6 @@ package com.hnac.hzims.alarm.source.service.impl; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.hnac.hzims.alarm.config.entity.AlarmEntity; -import com.hnac.hzims.alarm.config.vo.ConditionAlarmVo; import com.hnac.hzims.alarm.config.vo.DroolsAlarmVo; import com.hnac.hzims.alarm.show.service.AlarmService; import com.hnac.hzims.alarm.source.service.DroolsAlarmService; @@ -14,12 +13,10 @@ import com.hnac.hzims.operational.station.feign.IStationClient; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.CollectionUtil; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; -import java.util.ArrayList; -import java.util.Arrays; +import java.util.Collections; import java.util.List; import java.util.stream.Collectors; @@ -52,15 +49,8 @@ public class DroolsAlarmServiceImpl implements DroolsAlarmService { public List receiveMessage(String message) { // 对象转换 DroolsAlarmVo parseObject= JSONObject.parseObject(message, DroolsAlarmVo.class); - List alarms = Arrays.asList(parseObject); - if (CollectionUtil.isEmpty(alarms)) { - return new ArrayList<>(); - } - List res = alarms.stream().map(s -> { - AlarmEntity entity = getAlarmEntity(s); - return entity; - }).collect(Collectors.toList()); - return res; + List alarms = Collections.singletonList(parseObject); + return alarms.stream().map(this::getAlarmEntity).collect(Collectors.toList()); } private AlarmEntity getAlarmEntity(DroolsAlarmVo item) { From cc8e609a594ffbdeda038a787b8a104a573463d6 Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Wed, 15 May 2024 10:57:48 +0800 Subject: [PATCH 18/50] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E5=B7=A5=E5=85=B7=E7=B1=BB=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hnac/hzims/safeproduct/utils/BaseUtil.java | 119 ++++++++++++++------- 1 file changed, 83 insertions(+), 36 deletions(-) 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 7a4cbca..0789275 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 @@ -6,8 +6,9 @@ import com.hnac.hzims.safeproduct.constants.SafeProductConstant; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.IOUtils; import org.apache.poi.xwpf.usermodel.*; -import org.json.JSONArray; -import org.json.JSONObject; +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.JSONArray; +//import org.json.JSONObject; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTHyperlink; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTText; @@ -115,46 +116,82 @@ public class BaseUtil { * @param params 数据参数 * @return 文件 */ - public static XWPFDocument fillDocument(String templatePath, Map params, String findName) { +// public static XWPFDocument fillDocument(String templatePath, Map params, String findName) { +// XWPFDocument xwpfDocument = null; +// try { +// xwpfDocument = WordExportUtil.exportWord07(templatePath, params); +// if (StringUtils.isNotEmpty(findName)) { +// String findText = params.get(findName).toString(); +// if (StringUtils.isNotEmpty(findText)) { +// JSONArray jsonArray = new JSONArray(findText); +// for (XWPFTable table : xwpfDocument.getTables()) { +// for (int row = 0; row < table.getNumberOfRows(); row++) { +// for (int col = 0; col < table.getRow(row).getTableCells().size(); col++) { +// XWPFTableCell cell = table.getRow(row).getCell(col); +// for (XWPFParagraph p : cell.getParagraphs()) { +// for (int index = 0; index < p.getRuns().size(); index++) { +// XWPFRun run = p.getRuns().get(index); +// String text = run.getText(0); +// if (findText.equals(text)) { +// run.setText("", 0); // 清除原有文本 +// XWPFParagraph paragraph = run.getParagraph(); +// for (int i = 0; i < jsonArray.length(); i++) { +// JSONObject jsonObject = jsonArray.getJSONObject(i); +// String name = jsonObject.getString("name"); +// String url = jsonObject.getString("url"); +// // url编码格式化 +// String encodeName = URLEncoder.encode(name, "UTF-8").replaceAll("\\+", "%20"); +// String prefixString = url.substring(0, url.lastIndexOf("/") + 1); +// String encodeUrl = prefixString + encodeName; +// String id = paragraph.getDocument().getPackagePart().addExternalRelationship(encodeUrl, +// XWPFRelation.HYPERLINK.getRelation()).getId(); +// CTHyperlink cLink = paragraph.getCTP().addNewHyperlink(); +// cLink.setId(id); +// CTText ctText = CTText.Factory.newInstance(); +// ctText.setStringValue(name); +// CTR ctr = CTR.Factory.newInstance(); +// ctr.setTArray(new CTText[]{ctText}); +// cLink.setRArray(new CTR[]{ctr}); +// if (i < jsonArray.length() - 1) { +// paragraph.createRun().addBreak(); +// } +// } +// } +// } +// } +// } +// } +// } +// } +// } +// if (templatePath.equals("template/卫生自查表.docx")) { +// formatHygieneRecordTable(xwpfDocument); +// } +// } catch (Exception e) { +// log.error("数据写入异常: {}",e.getCause().toString()+ e.getStackTrace()); +// e.printStackTrace(); +// } +// return xwpfDocument; +// } + + public static XWPFDocument fillDocument(String templatePath, Map params, String findName) throws IOException { XWPFDocument xwpfDocument = null; try { xwpfDocument = WordExportUtil.exportWord07(templatePath, params); - if (StringUtils.isNotEmpty(findName)) { + if (findName != null && !findName.isEmpty()) { String findText = params.get(findName).toString(); - if (StringUtils.isNotEmpty(findText)) { - JSONArray jsonArray = new JSONArray(findText); + if (findText != null && !findText.isEmpty()) { + JSONArray jsonArray = JSONArray.parseArray(findText); for (XWPFTable table : xwpfDocument.getTables()) { - for (int row = 0; row < table.getNumberOfRows(); row++) { - for (int col = 0; col < table.getRow(row).getTableCells().size(); col++) { - XWPFTableCell cell = table.getRow(row).getCell(col); + for (XWPFTableRow row : table.getRows()) { + for (XWPFTableCell cell : row.getTableCells()) { for (XWPFParagraph p : cell.getParagraphs()) { - for (int index = 0; index < p.getRuns().size(); index++) { - XWPFRun run = p.getRuns().get(index); + for (XWPFRun run : p.getRuns()) { String text = run.getText(0); if (findText.equals(text)) { run.setText("", 0); // 清除原有文本 XWPFParagraph paragraph = run.getParagraph(); - for (int i = 0; i < jsonArray.length(); i++) { - JSONObject jsonObject = jsonArray.getJSONObject(i); - String name = jsonObject.getString("name"); - String url = jsonObject.getString("url"); - // url编码格式化 - String encodeName = URLEncoder.encode(name, "UTF-8").replaceAll("\\+", "%20"); - String prefixString = url.substring(0, url.lastIndexOf("/") + 1); - String encodeUrl = prefixString + encodeName; - String id = paragraph.getDocument().getPackagePart().addExternalRelationship(encodeUrl, - XWPFRelation.HYPERLINK.getRelation()).getId(); - CTHyperlink cLink = paragraph.getCTP().addNewHyperlink(); - cLink.setId(id); - CTText ctText = CTText.Factory.newInstance(); - ctText.setStringValue(name); - CTR ctr = CTR.Factory.newInstance(); - ctr.setTArray(new CTText[]{ctText}); - cLink.setRArray(new CTR[]{ctr}); - if (i < jsonArray.length() - 1) { - paragraph.createRun().addBreak(); - } - } + insertJsonArrayIntoParagraph(jsonArray, paragraph); } } } @@ -163,16 +200,26 @@ public class BaseUtil { } } } - if (templatePath.equals("template/卫生自查表.docx")) { - formatHygieneRecordTable(xwpfDocument); - } } catch (Exception e) { - log.error("数据写入异常: {}",e.getCause().toString()+ e.getStackTrace()); e.printStackTrace(); } return xwpfDocument; } + + private static void insertJsonArrayIntoParagraph(JSONArray jsonArray, XWPFParagraph paragraph) throws IOException { + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject jsonObject = jsonArray.getJSONObject(i); + String name = jsonObject.getString("name"); + String url = jsonObject.getString("url"); + // URL编码格式化 + String encodeName = URLEncoder.encode(name, "UTF-8").replaceAll("\\+", "%20"); + String prefixString = url.substring(0, url.lastIndexOf("/") + 1); + String encodeUrl = prefixString + encodeName; + XWPFRun newRun = paragraph.createRun(); + newRun.setText(encodeUrl); + } + } /** * 卫生自查表格式处理 * @param xwpfDocument word文件类 From 46d8078a0978123a53066c9189fbfbd183856cf1 Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Wed, 15 May 2024 11:13:12 +0800 Subject: [PATCH 19/50] =?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=A0=BC?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/MainSystemMonitoringServiceImpl.java | 1 + .../service/impl/OperStationMonthReportServiceImpl.java | 15 ++++++++++----- .../java/com/hnac/hzims/operational/util/ObjectUtils.java | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainSystemMonitoringServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainSystemMonitoringServiceImpl.java index ea01dee..171d8bc 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainSystemMonitoringServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainSystemMonitoringServiceImpl.java @@ -1360,6 +1360,7 @@ public class MainSystemMonitoringServiceImpl implements IMainSystemMonitoringSer String currentMon = TimeUtils.getMon(year, mon); Integer count=0; Map> powerMapThree = (Map>) redisTemplate.opsForValue().get(RECENT_YEAR_POWER_DATA); + log.info("Redis近三年发电量数据查询:"+powerMapThree); for (Map.Entry> deviceMap : powerMapThree.entrySet()) { for (StationEntity stationEntity : stationEntityList) { if (stationEntity.getId().equals(deviceMap.getKey())) { 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 7e7de11..4ea709d 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 @@ -344,16 +344,19 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor Integer currentYear = calendar.get(Calendar.YEAR); if (year>currentYear-3) { mainSystemMonitoringService.getElectricSituationByRedis(yearAndMonth, reportVOS, stationEntityList); + log.info("电站发电情况"+reportVOS.toString()); }else { stationEntityList.forEach(stationEntity -> { List stationReportVOList = mainSystemMonitoringService.getElectricSituationV2(yearAndMonth, stationEntity.getCode()); reportVOS.addAll(stationReportVOList); }); + log.info("电站发电情况"+reportVOS.toString()); } getSumStationRunReport(reportVOS); stationReportAllVo.setStationReportVOList(reportVOS); + log.info("电站发电量总览"+reportVOS.toString()); }catch (Exception e){ - log.error("", e); + log.error("getStationMonthReportV2电站发电量报错", e); System.out.println(e); }finally { countDownLatch.countDown(); @@ -523,11 +526,12 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor stationRunReportVO.setStationName("合计"); if (CollectionUtil.isNotEmpty(reportVOS)){ double sumPowerMonPlan = reportVOS.stream().mapToDouble(StationRunReportVO::getPowerMonPlan).sum(); - stationRunReportVO.setPowerMonPlan(sumPowerMonPlan); + stationRunReportVO.setPowerMonPlan(new BigDecimal(sumPowerMonPlan).setScale(2,BigDecimal.ROUND_UP).doubleValue()); double sumFinishPowerMon = reportVOS.stream().map(StationRunReportVO::getFinishPowerMon).mapToDouble(s -> Double.valueOf(s)).sum(); - stationRunReportVO.setFinishPowerMon(String.valueOf(sumFinishPowerMon)); + stationRunReportVO.setFinishPowerMon(new BigDecimal(sumFinishPowerMon).setScale(2,BigDecimal.ROUND_UP).toString()); if (!ObjectUtils.isEmpty(sumPowerMonPlan)) { - BigDecimal powerMonRate = new BigDecimal(sumFinishPowerMon).divide(new BigDecimal(sumPowerMonPlan)).setScale(2, BigDecimal.ROUND_UP); + BigDecimal powerMonRate = new BigDecimal(sumFinishPowerMon).divide(new BigDecimal(sumPowerMonPlan),4,BigDecimal.ROUND_UP) + .multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_UP); stationRunReportVO.setPowerMonRate(String.valueOf(powerMonRate)); }else { stationRunReportVO.setPowerMonRate("0.0"); @@ -537,7 +541,8 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor double sumFinishPowerYear = reportVOS.stream().map(StationRunReportVO::getFinishPowerYear).mapToDouble(s -> Double.valueOf(s)).sum(); stationRunReportVO.setFinishPowerYear(String.valueOf(sumFinishPowerYear)); if (!ObjectUtils.isEmpty(sumPowerYearPlan)){ - BigDecimal powerYearRate = new BigDecimal(sumFinishPowerYear).divide(new BigDecimal(sumPowerYearPlan)).setScale(2, BigDecimal.ROUND_UP); + BigDecimal powerYearRate = new BigDecimal(sumFinishPowerYear).divide(new BigDecimal(sumPowerYearPlan),4,BigDecimal.ROUND_UP) + .multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_UP); stationRunReportVO.setPowerYearRate(String.valueOf(powerYearRate)); }else { stationRunReportVO.setPowerYearRate("0.0"); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/util/ObjectUtils.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/util/ObjectUtils.java index 341e2d5..cd140eb 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/util/ObjectUtils.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/util/ObjectUtils.java @@ -85,7 +85,7 @@ public class ObjectUtils { public static BigDecimal objDivide(String s){ BigDecimal bigDecimal = new BigDecimal(s); - BigDecimal res = bigDecimal.divide(new BigDecimal(10000)).setScale(2, BigDecimal.ROUND_UP); + BigDecimal res = bigDecimal.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP).setScale(2, BigDecimal.ROUND_UP); return res; } } From 6d986e13135e685ecb3fbf7c9b1f18ac7133cb92 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Wed, 15 May 2024 14:16:35 +0800 Subject: [PATCH 20/50] =?UTF-8?q?#=E5=8F=91=E7=94=B5=E9=87=8F=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E6=9C=80=E5=90=8E=E5=80=BC=E5=87=8F=E6=9C=80=E5=88=9D?= =?UTF-8?q?=E5=80=BC=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operational/main/constant/MainConstants.java | 3 + .../scheduled/RealTargetScheduledTask.java | 13 +++ .../service/operation/home/RealTargetService.java | 2 +- .../operation/home/impl/RealTargetServiceImpl.java | 118 ++++++++++++--------- 4 files changed, 85 insertions(+), 51 deletions(-) diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java index a080158..f37ce48 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java @@ -50,7 +50,10 @@ public interface MainConstants { String LOAD_HYDROPOWER_UNIT_TARGET = "loadHydropowerUnitTarget"; // 近年发电量 + String LOAD_POWER_DATA_NEW = "loadPowerDataNew"; + String ELECTRICITY_GENERATION_RECENT_YEAR = "electricityGenerationRecentYear"; + // 風電儲能近年发电量 String WIND_POWER_GENERATION_RECENT_YEAR = "windPowerGenerationRecentYear"; 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 9591c87..f71d9d3 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,6 +157,19 @@ 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 bf8d692..7ea1a7d 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,7 @@ public interface RealTargetService { void loadPowerData(String param, List types, Integer serveType, int year); - void loadPowerDataNew(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 8a5f14d..dfca1da 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 @@ -114,6 +114,9 @@ public class RealTargetServiceImpl implements RealTargetService { private final static String recent_year_power_data = "hzims:operation:key:power:data"; + + private final static String recent_year_power_data_test = "hzims:operation:key:power:data:test"; + private final static String load_hydropower_unit_real_key = "hzims:operation:loadhydropowerunit:real:key"; private final static String load_hydropower_unit_target_key = "hzims:operation:loadhydropowerunit:target:key"; private final static String loadwaterpump_target_key = "hzims:operation:loadwaterpump:target:key"; @@ -1275,72 +1278,87 @@ public class RealTargetServiceImpl implements RealTargetService { } @Override - - public void loadPowerDataNew(List types, Integer serveType, int year) { + public void loadPowerDataNew(String param, List types, Integer serveType, int year) { // 站点查询 - List stationList = stationService.list(new LambdaQueryWrapper() {{ - eq(StationEntity::getDataOrigin,"0"); - if (ObjectUtil.isNotEmpty(serveType)) { - eq(StationEntity::getServeType, serveType); - } + 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>() {}); - // 结束时间 + 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"; - LocalDateTime endTime = LocalDateTime.parse(end); - // 开始时间 + // 结束日期 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"; - LocalDateTime startTime = LocalDateTime.parse(end); - // 存储数据map:<站点id, <月份, 发电量>> - Map> powerMap = new HashMap<>(); - stationList.forEach(station -> { - List datas = new ArrayList<>(); - // 站点设备集合 - List stationDevices = devices.stream().filter(device -> device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList()); - log.info("load_power_data station :" + station.getCode() + "==== device :" + stationDevices); - if (CollectionUtil.isNotEmpty(devices)) { - stationDevices.forEach(device -> { - ReductionDataDTO reductionDataDTO = new ReductionDataDTO(); - reductionDataDTO.setDeviceCode(device.getEmCode()); - reductionDataDTO.setSaveTimeType(5); - reductionDataDTO.setTimeInterval(1); - reductionDataDTO.setBeginTime(startTime); - reductionDataDTO.setEndTime(endTime); - reductionDataDTO.setNeedPage(false); - Result reductionDataVOResult = deviceDataClient.pageDeviceCodeAndSignages(reductionDataDTO); - if (!reductionDataVOResult.isSuccess() || CollectionUtil.isEmpty(reductionDataVOResult.getData().getDataList())) { + // 存储数据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; } - List> dataList = reductionDataVOResult.getData().getDataList(); - datas.addAll(dataList.stream().map(data -> { - PowerMonthVo generate = new PowerMonthVo(); - Date time = DateUtil.parse(data.get("ts"), "yyyy-MM-dd HH:mm:ss.s"); - generate.setStrMonth(DateUtil.format(time,DateUtil.PATTERN_DATE)); -// generate.setPower(Float.parseFloat(Optional.ofNullable(data.get(HomePageConstant.HYDROPOWER_GENERATE_POWER)) -// .orElse("0")) * device.getRideCount()); - return generate; - }).collect(Collectors.toList())); + powerMap.put(station.getId(),generateMap); }); - } - // 补充填报数据 - datas.addAll(this.generateFill(station,start,end)); - if (CollectionUtil.isEmpty(datas)) { - return; - } - Map map = datas.stream().collect(Collectors.toMap(PowerMonthVo::getStrMonth, PowerMonthVo::getPower, Float::sum)); - powerMap.put(station.getId(), map); - }); - redisTemplate.opsForValue().set(recent_year_power_data, powerMap); + 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<>(); + // 设备采集发电量 + if(CollectionUtil.isNotEmpty(devices)){ + devices.forEach(device->{ + List> records = dataService.lastFirstBySignage(start,end,7,5,device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER); + if(CollectionUtil.isEmpty(records)){ + return; + } + datas.addAll(records.stream().map(record -> { + PowerMonthVo generate = new PowerMonthVo(); + Date time = DateUtil.parse(record.get("ts"), "yyyy-MM-dd HH:mm:ss.s"); + generate.setStrMonth(DateUtil.format(time,DateUtil.PATTERN_DATE)); + String val = record.get(HomePageConstant.HYDROPOWER_GENERATE_POWER); + if(StringUtil.isEmpty(val)){ + generate.setPower(0f); + }else{ + generate.setPower(Float.parseFloat(String.valueOf(Double.parseDouble(val) * device.getRideCount()))); + } + return generate; + }).collect(Collectors.toList())); + }); + } + // 补充填报数据 + datas.addAll(this.generateFill(station,start,end)); + if(CollectionUtil.isEmpty(datas)){ + return null; + } + return datas.stream().collect(Collectors.toMap(PowerMonthVo::getStrMonth, PowerMonthVo::getPower, Float::sum)); + } /** From 1b8a2cd45d6f27f9e2616a59cd4d66277ac03854 Mon Sep 17 00:00:00 2001 From: liwen Date: Thu, 16 May 2024 10:55:42 +0800 Subject: [PATCH 21/50] =?UTF-8?q?update:=20=E5=AF=BC=E5=87=BA=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hnac/hzims/safeproduct/utils/BaseUtil.java | 89 ++++++---------------- 1 file changed, 22 insertions(+), 67 deletions(-) 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 0789275..3c84c29 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 @@ -6,9 +6,8 @@ import com.hnac.hzims.safeproduct.constants.SafeProductConstant; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.IOUtils; import org.apache.poi.xwpf.usermodel.*; -import com.alibaba.fastjson.JSONObject; -import com.alibaba.fastjson.JSONArray; -//import org.json.JSONObject; +import org.json.JSONArray; +import org.json.JSONObject; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTHyperlink; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTText; @@ -116,77 +115,20 @@ public class BaseUtil { * @param params 数据参数 * @return 文件 */ -// public static XWPFDocument fillDocument(String templatePath, Map params, String findName) { -// XWPFDocument xwpfDocument = null; -// try { -// xwpfDocument = WordExportUtil.exportWord07(templatePath, params); -// if (StringUtils.isNotEmpty(findName)) { -// String findText = params.get(findName).toString(); -// if (StringUtils.isNotEmpty(findText)) { -// JSONArray jsonArray = new JSONArray(findText); -// for (XWPFTable table : xwpfDocument.getTables()) { -// for (int row = 0; row < table.getNumberOfRows(); row++) { -// for (int col = 0; col < table.getRow(row).getTableCells().size(); col++) { -// XWPFTableCell cell = table.getRow(row).getCell(col); -// for (XWPFParagraph p : cell.getParagraphs()) { -// for (int index = 0; index < p.getRuns().size(); index++) { -// XWPFRun run = p.getRuns().get(index); -// String text = run.getText(0); -// if (findText.equals(text)) { -// run.setText("", 0); // 清除原有文本 -// XWPFParagraph paragraph = run.getParagraph(); -// for (int i = 0; i < jsonArray.length(); i++) { -// JSONObject jsonObject = jsonArray.getJSONObject(i); -// String name = jsonObject.getString("name"); -// String url = jsonObject.getString("url"); -// // url编码格式化 -// String encodeName = URLEncoder.encode(name, "UTF-8").replaceAll("\\+", "%20"); -// String prefixString = url.substring(0, url.lastIndexOf("/") + 1); -// String encodeUrl = prefixString + encodeName; -// String id = paragraph.getDocument().getPackagePart().addExternalRelationship(encodeUrl, -// XWPFRelation.HYPERLINK.getRelation()).getId(); -// CTHyperlink cLink = paragraph.getCTP().addNewHyperlink(); -// cLink.setId(id); -// CTText ctText = CTText.Factory.newInstance(); -// ctText.setStringValue(name); -// CTR ctr = CTR.Factory.newInstance(); -// ctr.setTArray(new CTText[]{ctText}); -// cLink.setRArray(new CTR[]{ctr}); -// if (i < jsonArray.length() - 1) { -// paragraph.createRun().addBreak(); -// } -// } -// } -// } -// } -// } -// } -// } -// } -// } -// if (templatePath.equals("template/卫生自查表.docx")) { -// formatHygieneRecordTable(xwpfDocument); -// } -// } catch (Exception e) { -// log.error("数据写入异常: {}",e.getCause().toString()+ e.getStackTrace()); -// e.printStackTrace(); -// } -// return xwpfDocument; -// } - - public static XWPFDocument fillDocument(String templatePath, Map params, String findName) throws IOException { + public static XWPFDocument fillDocument(String templatePath, Map params, String findName) { XWPFDocument xwpfDocument = null; try { xwpfDocument = WordExportUtil.exportWord07(templatePath, params); if (findName != null && !findName.isEmpty()) { String findText = params.get(findName).toString(); if (findText != null && !findText.isEmpty()) { - JSONArray jsonArray = JSONArray.parseArray(findText); + JSONArray jsonArray = new JSONArray(findText); for (XWPFTable table : xwpfDocument.getTables()) { for (XWPFTableRow row : table.getRows()) { for (XWPFTableCell cell : row.getTableCells()) { for (XWPFParagraph p : cell.getParagraphs()) { - for (XWPFRun run : p.getRuns()) { + for (int index = 0; index < p.getRuns().size(); index++) { + XWPFRun run = p.getRuns().get(index); String text = run.getText(0); if (findText.equals(text)) { run.setText("", 0); // 清除原有文本 @@ -200,6 +142,9 @@ public class BaseUtil { } } } + if (templatePath.equals("template/卫生自查表.docx")) { + formatHygieneRecordTable(xwpfDocument); + } } catch (Exception e) { e.printStackTrace(); } @@ -208,7 +153,7 @@ public class BaseUtil { private static void insertJsonArrayIntoParagraph(JSONArray jsonArray, XWPFParagraph paragraph) throws IOException { - for (int i = 0; i < jsonArray.size(); i++) { + for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); String name = jsonObject.getString("name"); String url = jsonObject.getString("url"); @@ -216,8 +161,18 @@ public class BaseUtil { String encodeName = URLEncoder.encode(name, "UTF-8").replaceAll("\\+", "%20"); String prefixString = url.substring(0, url.lastIndexOf("/") + 1); String encodeUrl = prefixString + encodeName; - XWPFRun newRun = paragraph.createRun(); - newRun.setText(encodeUrl); + String id = paragraph.getDocument().getPackagePart().addExternalRelationship(encodeUrl, + XWPFRelation.HYPERLINK.getRelation()).getId(); + CTHyperlink cLink = paragraph.getCTP().addNewHyperlink(); + cLink.setId(id); + CTText ctText = CTText.Factory.newInstance(); + ctText.setStringValue(name); + CTR ctr = CTR.Factory.newInstance(); + ctr.setTArray(new CTText[]{ctText}); + cLink.setRArray(new CTR[]{ctr}); + if (i < jsonArray.length() - 1) { + paragraph.createRun().addBreak(); + } } } /** From bb303d1502119265792ea31f11cb3276d233124a Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Fri, 17 May 2024 09:37:18 +0800 Subject: [PATCH 22/50] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=EF=BC=9A=E5=BA=93?= =?UTF-8?q?=E5=AD=98=E5=88=A4=E6=96=ADbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java index a166dff..b1af6c9 100644 --- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java +++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java @@ -637,8 +637,8 @@ public class WtSpBasicServiceImpl extends BaseServiceImpl libraryExcel.getLowerLimit()) { + if (ObjectUtil.isNotEmpty(libraryExcel.getLowerLimit()) && ObjectUtil.isNotEmpty(libraryExcel.getUpperLimit())) { + if (libraryExcel.getLowerLimit() > libraryExcel.getUpperLimit()) { errors.add("库存下限不能大于库存上限"); } } From b7067df156f3475338eb3f787bfd5999e22ba75a Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Fri, 17 May 2024 10:11:08 +0800 Subject: [PATCH 23/50] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=EF=BC=9A=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E9=80=BB=E8=BE=91=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/operational/station/utils/ArtemisPostUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/utils/ArtemisPostUtils.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/utils/ArtemisPostUtils.java index 31509db..480fb07 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/utils/ArtemisPostUtils.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/utils/ArtemisPostUtils.java @@ -60,7 +60,7 @@ public class ArtemisPostUtils { /* 返回url地址 */ - if(null != result || !"".equals(result)){ + if((null != result) && !"".equals(result)){ JSONObject json = JSONObject.parseObject(result); json = JSONObject.parseObject(json.getString("data")); From c922eb5fe37374c0358aaa1e5640f8779d8fd7f7 Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Mon, 20 May 2024 15:09:01 +0800 Subject: [PATCH 24/50] =?UTF-8?q?=E4=BF=AE=E6=AD=A3:=E4=BA=A4=E6=8E=A5?= =?UTF-8?q?=E7=8F=AD=E5=80=BC=E7=8F=AD=E6=97=A5=E5=BF=97bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operational/duty/service/impl/ImsDutyRecServiceImpl.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java index 3f45160..bad0c0d 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java @@ -245,7 +245,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl { + log.error("交接班请求报错"+flowResult.getMsg()); throw new ServiceException(flowResult.getMsg()); }); return flowResult.getData(); @@ -487,6 +488,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl() {{ eq(ImsDutyLogEntity::getDutyId, dutyId); + last(" limit 1;"); }}); imsDutyRecVO.setImsDutyLogEntity(dutyLogEntity); } @@ -1606,10 +1608,6 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl Date: Mon, 20 May 2024 16:00:36 +0800 Subject: [PATCH 25/50] =?UTF-8?q?update:=20=E8=80=83=E8=AF=95=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E6=B7=BB=E5=8A=A0=E5=8F=8A=E6=A0=BC=E5=88=86=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java | 9 ++++++++- .../main/java/com/hnac/hzims/safeproduct/vo/TestScoreSumVO.java | 8 +++++--- .../hzims/safeproduct/service/impl/TestScoreServiceImpl.java | 5 +++-- hzims-service/safeproduct/src/main/resources/db/2.0.1.sql | 6 +++++- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java index 17e5119..27ae3d7 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java @@ -9,6 +9,8 @@ import lombok.EqualsAndHashCode; import org.springblade.core.mp.base.BaseEntity; import org.springframework.format.annotation.DateTimeFormat; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import java.util.Date; @@ -59,6 +61,12 @@ public class TestEntity extends BaseEntity { private Date testEndTime; @NotNull + @Min(value = 0, message = "及格分必须大于等于0") + @Max(value = 100, message = "及格分必须小于等于100") + @ApiModelProperty("及格分") + private Integer passingScore; + + @NotNull @Size(max = 255, message = "考试地点字段长度不能超过255") @ApiModelProperty("考试地点") private String location; @@ -77,7 +85,6 @@ public class TestEntity extends BaseEntity { @ApiModelProperty("参考人员") private String peopleName; - @Size(max = 1000, message = "考试图片字段长度不能超过1000") @ApiModelProperty("考试图片") private String imgPath; diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TestScoreSumVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TestScoreSumVO.java index 518ebb5..7d89726 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TestScoreSumVO.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TestScoreSumVO.java @@ -13,12 +13,14 @@ import lombok.Data; public class TestScoreSumVO { @ApiModelProperty("应考人数") - private Integer peopleNum=0; + private Integer peopleNum = 0; @ApiModelProperty("实考人数") - private Integer actualPeopleNum=0; + private Integer actualPeopleNum = 0; @ApiModelProperty("及格率") - private Double percentage=0.0; + private Double percentage = 0.0; + @ApiModelProperty("及格分") + private Integer passingScore; } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java index 6145b38..ca24f67 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java @@ -126,6 +126,7 @@ public class TestScoreServiceImpl extends ServiceImpl s.getScore() != null).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(list)) { testScoreSumVO.setActualPeopleNum(list.size()); - List passCollect = list.stream().filter(s -> s.getScore() > 60).collect(Collectors.toList()); + List passCollect = list.stream().filter(s -> s.getScore() > testEntity.getPassingScore()).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(list)&&CollectionUtils.isNotEmpty(passCollect)) { double result = BigDecimal.valueOf(passCollect.size()).divide(BigDecimal.valueOf(list.size()),2, RoundingMode.UP).doubleValue(); testScoreSumVO.setPercentage(result); - }else { + } else { testScoreSumVO.setPercentage(0.0); } } 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 b1296e1..3730612 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 @@ -40,4 +40,8 @@ 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='卫生自查模板详情表'; + +-- 添加考试及格分字段 +ALTER TABLE hzims_test + ADD COLUMN passing_score int(10) NOT NULL DEFAULT 60 COMMENT '考试及格分'; \ No newline at end of file From 849ab8fd06b820a74305fa554d52f8c9a5d6f307 Mon Sep 17 00:00:00 2001 From: liwen Date: Mon, 20 May 2024 16:55:37 +0800 Subject: [PATCH 26/50] =?UTF-8?q?update:=20=E5=9F=B9=E8=AE=AD=E3=80=81?= =?UTF-8?q?=E6=BC=94=E7=BB=83=E7=9A=84=E6=9C=88=E5=BA=A6=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=82=B9=E5=87=BB=E6=9F=A5=E7=9C=8B=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E6=95=B0=E6=8D=AE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hnac/hzims/safeproduct/controller/RehearsalController.java | 3 ++- .../java/com/hnac/hzims/safeproduct/controller/TrainController.java | 3 ++- .../main/java/com/hnac/hzims/safeproduct/mapper/TrainPlanMapper.xml | 3 +++ .../hzims/safeproduct/service/impl/RehearsalPlanServiceImpl.java | 6 +++++- 4 files changed, 12 insertions(+), 3 deletions(-) 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 ae78443..14cdc89 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,7 +82,8 @@ 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 = "scheduledEndTime", value = "计划结束时间", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "rehearsalStatus", value = "演练状态", dataType = "query", paramType = "string") }) @ApiOperation(value = "演练计划分页") @ApiOperationSupport(order = 5) 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 57ef4ba..7eda44c 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,7 +91,8 @@ 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 = "scheduledEndTime", value = "计划结束时间", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "trainStatus", value = "培训计划状态", dataType = "query", paramType = "string") }) @ApiOperation(value = "培训计划分页") @ApiOperationSupport(order = 5) 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 a9ca3f6..19ef188 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 @@ -87,6 +87,9 @@ AND scheduled_end_time <= #{param.endTime} + + AND train_status = #{param.trainStatus} + ORDER BY create_time DESC 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 1714714..9cd63ef 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 @@ -275,7 +275,8 @@ public class RehearsalPlanServiceImpl extends ServiceImpl 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 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); } @@ -285,6 +286,9 @@ public class RehearsalPlanServiceImpl extends ServiceImpl Date: Tue, 21 May 2024 09:10:51 +0800 Subject: [PATCH 27/50] =?UTF-8?q?=E4=BF=AE=E6=AD=A3:=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E5=85=AC=E4=BC=97=E5=8F=B7=E6=B6=88=E6=81=AF=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alarm/source/service/impl/MessageServiceImpl.java | 14 ++++++++++---- .../hzims/message/service/impl/WxMessageServiceImpl.java | 5 ++++- 2 files changed, 14 insertions(+), 5 deletions(-) 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 105bf73..ffa434b 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 @@ -146,9 +146,8 @@ public class MessageServiceImpl implements MessageService { log.error("微信消息发送失败:站点code获取失败 : {}",entity); return; } - Long dept = station.getData().getCreateDept(); // 获取站点用户 - R> result = userClient.userList("200000",dept); + R> result = userClient.userByDeptIdLevel(station.getData().getRefDept(),0); if (!result.isSuccess() || CollectionUtil.isEmpty(result.getData())) { log.error("微信消息发送失败:用户获取失败 : {}",entity); return; @@ -168,9 +167,9 @@ public class MessageServiceImpl implements MessageService { message.setTaskId(entity.getId()); // 微信参数键值对 HashMap map = new HashMap<>(); - map.put("thing18",entity.getStationName()); + map.put("thing18",getTruncateString(entity.getStationName(), 29)); // map.put("thing5",Optional.ofNullable(entity.getDeviceCode()).orElse("未知设备")); - map.put("thing11",entity.getAlarmContext()); + map.put("thing11",getTruncateString(entity.getAlarmContext(), 29)); map.put("time2",entity.getAlarmTime()); map.put("thing14", DictCache.getValue("alarm_source", entity.getAlarmSource())); message.setMap(map); @@ -186,4 +185,11 @@ public class MessageServiceImpl implements MessageService { message.setTenantId(station.getData().getTenantId()); messageClient.sendWxMessage(message); } + private String getTruncateString(String ruleDefName, int maxSize) { + if (ruleDefName.length()<= maxSize){ + return ruleDefName; + }else { + return ruleDefName.substring(0, maxSize - 3) + "..."; + } + } } \ No newline at end of file diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/WxMessageServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/WxMessageServiceImpl.java index cb04c86..dd4e03e 100644 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/WxMessageServiceImpl.java +++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/WxMessageServiceImpl.java @@ -92,7 +92,10 @@ public class WxMessageServiceImpl implements IMessageService { template.setUserIds(Arrays.stream(message.getUserIds().split(",")).collect(Collectors.toList())); template.setTenantId("200000"); R result = wxPushClient.sendPushTemplateByUserId(template); - return result.isSuccess(); + if(result.isSuccess()&&ObjectUtil.isNotEmpty(result.getData())){ + return true; + } + return false; } private String getTruncateString(String ruleDefName, int maxSize) { From 56937e74cad8f52426cddc7b17a367d98a0ce77c Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Tue, 21 May 2024 18:33:23 +0800 Subject: [PATCH 28/50] =?UTF-8?q?=E5=8D=87=E7=BA=A7:user-api=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E4=B8=BA5.1.1.RELEASE.fix.4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3315851..1f8a773 100644 --- a/pom.xml +++ b/pom.xml @@ -54,7 +54,8 @@ org.springblade blade-user-api - ${bladex.project.version} + + 5.1.1.RELEASE.fix.4 org.springblade From c2df9ad56966d106aa28597611dfbfac53ce7d8c Mon Sep 17 00:00:00 2001 From: liwen Date: Tue, 21 May 2024 21:44:04 +0800 Subject: [PATCH 29/50] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E6=96=87=E4=BB=B6=E6=97=A0=E5=9B=BE=E7=89=87=E6=97=B6?= =?UTF-8?q?=E6=8A=A5=E9=94=99=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/vo/RehearsalRecordDetailImgVO.java | 16 ++++++++ .../safeproduct/vo/RehearsalRecordDetailStrVO.java | 15 +++++++ .../safeproduct/vo/RehearsalRecordDetailVO.java | 3 -- .../service/impl/RehearsalRecordServiceImpl.java | 43 ++++++++++++--------- .../com/hnac/hzims/safeproduct/utils/BaseUtil.java | 33 ++++++++++++++++ .../main/resources/template/演练记录表.docx | Bin 12341 -> 12368 bytes 6 files changed, 89 insertions(+), 21 deletions(-) create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailImgVO.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailStrVO.java diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailImgVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailImgVO.java new file mode 100644 index 0000000..abb312d --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailImgVO.java @@ -0,0 +1,16 @@ +package com.hnac.hzims.safeproduct.vo; + +import cn.afterturn.easypoi.entity.ImageEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +@Data +@ApiModel(value = "演练记录表VO类") +public class RehearsalRecordDetailImgVO extends RehearsalRecordDetailVO{ + + @ApiModelProperty("图片列表") + private List images; +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailStrVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailStrVO.java new file mode 100644 index 0000000..2a7c8bf --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailStrVO.java @@ -0,0 +1,15 @@ +package com.hnac.hzims.safeproduct.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +@Data +@ApiModel(value = "演练记录表VO类") +public class RehearsalRecordDetailStrVO extends RehearsalRecordDetailVO{ + + @ApiModelProperty("图片列表") + private List images; +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailVO.java index e1d414f..545065f 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailVO.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailVO.java @@ -55,9 +55,6 @@ public class RehearsalRecordDetailVO { @ApiModelProperty("演练科目") private String subject; - @ApiModelProperty("图片列表") - private List images; - @ApiModelProperty("年份") private String year; diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java index 2b9b50c..4018a62 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java @@ -19,10 +19,13 @@ import com.hnac.hzims.safeproduct.mapper.RehearsalRecordMapper; import com.hnac.hzims.safeproduct.service.IRehearsalRecordService; import com.hnac.hzims.safeproduct.utils.BaseUtil; import com.hnac.hzims.safeproduct.utils.TimeUtils; +import com.hnac.hzims.safeproduct.vo.RehearsalRecordDetailImgVO; +import com.hnac.hzims.safeproduct.vo.RehearsalRecordDetailStrVO; import com.hnac.hzims.safeproduct.vo.RehearsalRecordDetailVO; import com.hnac.hzims.safeproduct.vo.RehearsalRecordlVO; import lombok.extern.slf4j.Slf4j; import org.springblade.core.mp.support.Query; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -150,23 +153,6 @@ public class RehearsalRecordServiceImpl extends ServiceImpl list = new ArrayList<>(); - if (StringUtils.isNotEmpty(rehearsalRecordDetailVO.getImgPath())) { - String[] imgArr = rehearsalRecordDetailVO.getImgPath().split(","); - for (String img : imgArr) { - ImageEntity imageEntity = new ImageEntity(BaseUtil.imgToByte(savePath + - BaseUtil.downloadFileByUrl(img, savePath)), 180, 150); - list.add(imageEntity); - } - } else { - // 添加空的ImageEntity,防止数据填入时显示"{{" - ImageEntity imageEntity = new ImageEntity(); - // 设置空字符串,防止空指针报错 - imageEntity.setUrl(""); - list.add(imageEntity); - } - rehearsalRecordDetailVO.setImages(list); // 记录:换行符使用\r\n String standardRecord = rehearsalRecordDetailVO.getRecord().replaceAll("\n", "\r\n"); rehearsalRecordDetailVO.setRecord(standardRecord); @@ -186,7 +172,28 @@ public class RehearsalRecordServiceImpl extends ServiceImpl params = BaseUtil.obj2Map(rehearsalRecordDetailVO); + // 图片 + Map params; + if (StringUtils.isNotEmpty(rehearsalRecordDetailVO.getImgPath())) { + List list = new ArrayList<>(); + RehearsalRecordDetailImgVO imgVO = new RehearsalRecordDetailImgVO(); + BeanUtils.copyProperties(rehearsalRecordDetailVO, imgVO); + String[] imgArr = rehearsalRecordDetailVO.getImgPath().split(","); + for (String img : imgArr) { + ImageEntity imageEntity = new ImageEntity(BaseUtil.imgToByte(savePath + + BaseUtil.downloadFileByUrl(img, savePath)), 180, 150); + list.add(imageEntity); + } + imgVO.setImages(list); + params = BaseUtil.obj2Map(imgVO); + } else { + List list = new ArrayList<>(); + list.add(""); + RehearsalRecordDetailStrVO strVO = new RehearsalRecordDetailStrVO(); + BeanUtils.copyProperties(rehearsalRecordDetailVO, strVO); + strVO.setImages(list); + params = BaseUtil.obj2Map(strVO); + } String templateFile = "template/演练记录表" + SafeProductConstant.DOCX_SUFFIX; String wordPath = savePath + "/演练记录表" + SafeProductConstant.DOCX_SUFFIX; String pdfPath = savePath + "/演练记录表" + SafeProductConstant.PDF_SUFFIX; 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 3c84c29..da74c7f 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 @@ -119,6 +119,7 @@ public class BaseUtil { XWPFDocument xwpfDocument = null; try { xwpfDocument = WordExportUtil.exportWord07(templatePath, params); + // 超链接处理 if (findName != null && !findName.isEmpty()) { String findText = params.get(findName).toString(); if (findText != null && !findText.isEmpty()) { @@ -142,6 +143,7 @@ public class BaseUtil { } } } + // 表格处理 if (templatePath.equals("template/卫生自查表.docx")) { formatHygieneRecordTable(xwpfDocument); } @@ -151,6 +153,36 @@ public class BaseUtil { return xwpfDocument; } + /** + * 车辆检查表格式处理 + * @param xwpfDocument word文件类 + */ + private static void formatCarCheckRecordTable(XWPFDocument xwpfDocument) { + // 获取文档中所有的表格 + List tableList = xwpfDocument.getTables(); + if (tableList.size() > 0) { + // 循环表格 + for (XWPFTable table : tableList) { + // 获取表格所有行数 + List rows = table.getRows(); + // 第五行到倒数第三行为需合并区域 + for (int row = 5; row < rows.size() - 2;) { + XWPFTableCell startCell = rows.get(row).getCell(0); + String startText = startCell.getText(); + int index = row + 1; + for (; index < rows.size(); index++) { + XWPFTableCell endCell = rows.get(index).getCell(0); + String endText = endCell.getText(); + if (!startText.equals(endText)) { + break; + } + } + mergeCellsVertically(table, 0, row, index - 1); + row = index; + } + } + } + } private static void insertJsonArrayIntoParagraph(JSONArray jsonArray, XWPFParagraph paragraph) throws IOException { for (int i = 0; i < jsonArray.length(); i++) { @@ -175,6 +207,7 @@ public class BaseUtil { } } } + /** * 卫生自查表格式处理 * @param xwpfDocument word文件类 diff --git a/hzims-service/safeproduct/src/main/resources/template/演练记录表.docx b/hzims-service/safeproduct/src/main/resources/template/演练记录表.docx index c83a99c9bb39ebd1d1ae7ced45cd96bb4028312e..38209f5d8c5c03de5ceb57815dc08da24b9aaf6b 100644 GIT binary patch delta 5126 zcmZ9QWmwdGv&U&%y1Tm@0cq)GLApaix|_d%ES*b82olmEwSXYHAT8an#DW4M-Oai0 z^Wu4~bLRJEUd&uG*UY^5eLrosleX#NAo#Gyx-%*YN=Swr6<{!`+b2ZS&3ZxzK1?8; zIsa4-2A#kAXkZwsoYUgLN3zn4|K^DyuJpNO=fTgRt&>#b<6_$sr8#Gt`HztNeqx>y zw`ziYAfHlrYM0m$4_BCn z^dWjHcIj0ZH*gG2njpyL6dN7DNMkTc39uJ{oGke~{(f>ZcbnSr^O_re_Z^RCUwc%x zIaf}%V17ABL4dFB29hE z;D1*D{fWv27$|@t{_%jH|-3a>F&ih^xSmdnTvcMb=8Ajjvi>T)+q z6{ZEYDinB+bRbPzy!t=c;UzI0RrU6AS%C@oTY~NYNRs^*9q+NW(1bT`@|c3Mtids= ztF^}*D#oCG6xsoO1*l)%n$WmYUeJFe%24B*I8rA9p#MTB0e>| z7wh_ZR79h-`bdubYCAgUK*TdDgb0k{*cBM|+s8jbw767+{g0Wpi}s*jrqfnZa{3P4 zk=29I14W0!9PIu!{OLB>O|}m#ot7vik6UJ;PGqtIzp$Y0tzLWZ`r=bKEk*yDTS~Vb zJIe#Wbz3?FYxsqm2F{%{XRZI=@rLR36+qR|d7d%vN3<~BxU@q<(K&z(`X7#=^#%&z zcrqn4tCw$bqbmn-1frbX>z6|(HOn`+@JyW-OokuI)r6OESMifN1vuvsmBcB1&nLg@5!_2sgXq)T)W}Hox@d3NoU+(=rL`yfk;Tv9{o4>PAUSOb5+{}%V+)S$ z#*rx8LYqn4eoej27Rm8Tg4zGe{7vo>_P1 zF(Es^Y1-qHH%+iup`oX~tgtK zX${O9{|%r0TkWVNQrDoYEBV%qS+ow>h&TsC_<~f{bd+-(bWF0q5xY__deb%Z$zO3D^@kbtA)6)(4OJFyk=_8;CQcAKBZi4Zeyys-W!Ey(50A26 zH}yr9dxP{T`+{6sl?Z{F#cBN&_8SvZ>=vXfx4?q_ba+)j$tg+ur)BL zcA#c-kcNWQxp9iDN%6$=Pm-CZ&A$LCJ{<3QY_`V zY(o=FaQROM3U_9)3=^*O;c1x_HVLz0aQBQY40U|o(-@xSteQe(Ut9V)CQBdRi{Sxp zIH6jC$$iT56LNdg4^C>8b@iK(<)#xiyVo&^U6+ZnEsi;u8Pn}&KCNI0^8|1{>-(Ea zs2@y3lLxv9w#dd5{Yl!4VwkK=n6F&=mZe}uB7e_gI4i$&mE>N#LUM^4G8bsiVFaRZ z=N9HSG$z(OyjCMPb8q_O_Mjk!SCC0rsW+L}o&|M#DPa-OSHiWgyI#zU6Z-+s-6^N{!ishq?n4KPtq(|p$C8I@U`pPKZh z=Ovod_{VnMH?pETEbJ5tvE_qFGs&yP){dbWb`+ zPhK&HOB>lt`uIJjosJ1n{>T6uJWYpE!}Zx0rN1#AS`3U7y%)}(;07!s%*eO(QZ6pb zYAh=n?P$XL4L+pqu#aKv8>ggwVvf_>yiG6n|e%^X;r|NbqP{|zBK zc5pMgu)6B&ysjpFwElbG=8_}}Wp^t*?SVrvJnIBM>NuK=v0mkgZ7}EF19_40%X{t}{f+2{@W zHPSmr-wt_Y_*e=)Lv-|~Zs`y;gJl(LT+bdN*H0k143bb#Gv~=iOwiYA+4#MJ3r!2E zU>6~e;Z#z5x{0DTrUuz2dQKN5qO3|Qr^)s^pIw{VZ3qYU1CYbh(X^r_;4AoAhO%EE zUy?swJ{~=6GSf|v3Zr4G%{3`}h2S7(?PSw-V`ud-h z2GT)(5p)U2i`Jq0djSkPGVGR)PwTgy8;i*DPjV3xX(hl4(fY|P^y5!1OT!r!Z;6(S z5UI$VvEiS~x`6T6A0lU74IgLEwH)uxmMP7{iY$ri#P87PLe?bvxwosHm{oY9&tp~* zD6b`#hPtU(ng!;XrE&_OYxznr1LWB0pQ=%r#`ybZUKQQVusCtEvB?3t({6Ld-=A$; zAPtFgr5T&YaxyU+sDV#>DZOjlvUeGfi9}z@)y)~)c;NVOt2bHCpmC$=qWJ(4q)JmE z1jRiQf4MC=QL8rkCT4&_RGNWW82`!Onuq(T?zwJ?6g$=vp7A3*0YuU9H^#0i^}7+H zu2_3XCnrsJC$HR*@)>PDP>P9<-;;P*#=oyH%(V_L^-6{GP$VbFYBbVrE`DJ$(%>>d z;Om)Ykdn9%EfVfQ1jWLkd3eP=zt*0xp&1x7&}42<3lTXO3v`vMP8bD3L8*eip``&< zJZT3nzA8LLEe0i&D}zOddAuD5h0`%qe~YE{drPrNtgV{u6SU=kP+bd{K>18U(})c+ z55~mv;bEop-i!~8O>B39q2rc0UB3)i7GN(Mw^cURwtcq||GaDyuQ1QoX^@P*dzg_; zy&3u5O5NY<2iV2<*n$bHPV+~?IyJk%nd{1OWyZzceDiP#ef+XWY!d;~!m=!Ae> zuej?lw&quUYyNJ0ALY*H97@!JTSs~$=U9>TcAwGevEND44+dPzwOYCDIhn4|Kq9s9 zUD&CKBBwLa4W7;^k+Xchx7jw`?WvN*((Nzl$&* zeJ|~cTOxR=4U~U;#ukRT+Mq@!Pi@+iP@!Pd z_yOxxEVX31PcE&YgFHFR4egtu6_$d*#7m}ym(TGskr?AGZGo%bvRh-bzJ4EiGge)# zf-5eha@U1UGU+I(*eaSVdDcLrn;EzzX`K?|GIvSNssXl%_==M@z-UH3;b}#7bjQa= zPq|I8K%3ps16D+9f<*;Et?B82E^l5>i|>rc+6NRGcBS#m!G(vzS=`kXwva~}TM}=x zDJoq5v!P4N_d$r}ywSI3@z0SWUuIx5!SXoq_z`oCN&*KbrR#xI*y$7xFZ^#~daa}* zfBFBRRk_P4erj6WF=`reJq|)h49n4Ox)0zk`2{x{OV0+Zvyd?UFn_%O$eJ0q(Hys0 zqYGCTXcci16`y>C{7J_8H3WqZjbi9D#_CcwRTDl1y~q9PAX?BSE|v20plw@Kbmy|J zo%SMhe8nPIkKpCinD`jtS>u|qe;jLP-8N zImy5+$3_rC_Q^4RzLPF3Fs4)94`+l7-GBgSruyXb&4#_C6*LPE6&;xUp+(AAC;|P} zP$2r|-zagm0B>o=g^0my!Sc=kUr{@pmpyFl;)3ey{iv09i(UIK9vsP@SFMT7DpyyK zY;>bZ)nB>GZk*KmXelyQQ1>Wb;ly5LOCu^K9WdK1eC-Ps)c3>4$*8a}e zm8=_;M`IGYC!h&Tws;I^@G8*b?L# zXU~Oq$Rjixg0Z0JYbq=&Q97$rjaS7ox5z(V35yxl$TRmvswQUI#S4le?fabgW`@{C zU-kX`tQ~M9)$+5SDniQct^L+7qzUKKtzWGOO_WCp106txIt8QnWW&njdzDuO_D3k2 z505%3RdkG#a4p!kgUAG~5W^f&WyleoMExO(K7zsvsp=7{WmctJR_EtAK$y^FVer13vIv^K?k{6LT|K~WVxC6PJfh7t`?~}(J5pw2*%cF=t}2Eo zn-A>YQ0%=_X6rR$LW@tW_Yq}p2ODR@gL*Sj?59mBb8xV@9?F|TeXsjZnVDjkGWOpSI4$P=pJccxNp;xm)O0Amh!0z@86jjh3nmJl3~~);Yt6A_2eX z)L)Q7q}f09l6r4WN~$AesbSx#YoaIoezzt0+3@jP-kT@9m=AC*>gAG8lxQuM%ZWwQ zBd;CIl}5l7%005@^hL~{49rbndNX}ar?{+x+TAEW3dhI^+S3&cJBxenPJRgziu{PH z10+Bk1qr!sH(?>HgUNJVp9NTQmsn(Zm2@ffa!}EQpT{D8(U97_8n|X*J>%#--I-U? zpW|8(XngNywr4+RBP$tt9ikfivpUJ{bgtE=f8!H;v^p!V)75a9`{j$bj#=>?USK&} ztCm>$!Lfq$t1giPrflwjNV})_qQN6Z1^~F7I;ni(?iC$-ybvoud&WSzDJcpxy*s2Y z=j1ZoRHUb%aoQbrx0UwH+@JJ06ZNGWWk=zk$}%$*lf@pxF*~mGHQ2}-mcwRpDb|dH zz4hUcaaQ`W^gXeTjGp28VHFy7CEDxIgYWLw62k3_E^S7xm_5SX-KbJwk*~dU3cPXY zcjqbti|u!-c|Bxy>UPwu%PB5Eln+`OaPxcjP(rn} zvexOnSoS9^L+TW?5wzSM9qq*~zE^EkcD)@{NnKT(e}6=2Q{3pP7IC`INa{rTRch3v zS~7?9a3?bA&YI>SYHHCSvF&^MK%ciQY)|XRc~bS+qH)2;Kw`04{Ld@QZ6*E|kY0gz zoS3{eEf%KY041)5f@$K6kxG5U*TUJS;cf}bGJdMT#=s1Ev@k^GY9#(X#~%oDbPvI|K+H zIdi|W6K_x=)4)~VdfIuAtE53AGfWUE<;K#gHvG(M8e;@Ib zkioZi*d=|`X~$iiZ34R9nCm)>1nse1=}^ooT6{Ze;!Cm)L`{MgP)(l9=-@kW&F%O> ziGhV~u#=gkDl{3ck>&As`jhy6z5K6D1F-Mpgx<&*QYIvvKJ5iXgp<|{_*K_c4!3iKpx8oOSa10LZQ_3btemxZ delta 5085 zcmZ8lXD}QL*R`x3C9K{edaq&C1ks{L?}X^RWQEv8^v)uBiPedyk6we-g2)Q1TQz!# zUf$>V-XG6=@1OhQ&Ye4V&YZb(&Y84nvPphM7&$5cvH@UW`K8Fy!cuxY`h>|}9;RQD z=^e!6z2H_JjE?lFG-FqkdOB(vjr!K?_HpHKSKLsowsU`M1XIRT-y-4f1+a@qJr$1e zrVUxI1f7VJK?bC=BSZZ)Gpda!Hdjg9S_+fM?CsLU!RW%thzOA!ItfPERnF)7h z*W-Fwky1kAgcTS)n3o9;)Z>M8+8bE~FaIYR+-!^Zk(O(FYxfLhyh|r@6Kkb%!W_8b zZ4RW{L2>#+B|anyof;B*zzj~HKh7MVzF92cZ@g6FG2w&TJTu=yWKQyZiDY{(7u`Ei zP2=aAFH#hxjA%Xsve|dOJuJD_Z&XJvP)@T|36T3qqRG1UVA?b;sFR0-hisgVPA`;^ z*pkSi0=~SdizV^*+}hj&$@vvbS%y;TVAlgU3qdDe4gaNgeU_@avo4i1SX>>Sp`M`v z9&HfGf0MhZ5f-Wb?V=4AD$%!y4tiA5?Yb;@ho`H70|a4VVG&?OX|KKLRx|~@{u}%E z*jQMP|L(%k09M$K*QV;cfZwsN)Ig!Lrss`K(RoM-tsv}o{Bz!&`5)P}l*rZihaPUm z|8h*7)86W(uGWuGf1E%-)Dx}9+n_zw@58LEw<0Th9D!Q+Rbq)rjiZ5e;W1K*_R`CKTJT-K>aXYe zOvYWq^BZ%`O}}AwicykkZK*|F!y(Yp`kLW zJV9@(?9$mgXj%T5LFpAAfLjCMG%sQs8kDR+Vl(uPYs1?wxFNTgpYvE*%}H%YgQDS> zgKb@^m&@1)(hXoXjTk2_IE+gAYjB$7*(tL1G%nDO5BJ1nxgE+E3|?$~(4vVFai7+r z%X{=A56g6VxzFfXP}&rbY_$2hm4A-r|HC}>RWTT@jl)Y|J9p#o{A8*W9)iOO!ycaK_C!PmIH;m<2khVKS!8 zaS*b1m!;wR*E!_!mbK)m3JFO=9k7Uq=oelA zDg+k`tB(Y3LB;{o`MN<&s*eV^WuJv3NDz6`lD5RU$s9@SLmb`r)gJ(&EmC>sgmueH zkS4zFnZ_i2%G66Dju~|Hqk%vz${)9l6eq@eGpQ+RvGHD(rh6KFJ@~z-jLk|^ z#@!bQ0`Ga=_fWp*t@x%7C3f8dbK&MhSE`pRlBevT1*c*|9@7$|Au~KW)+GhE* z>a$kN48KtU35}mnKoo_Dc$9mmUBg20r1M3>(P}V=$oKF`$9U&yrvi?U7-!MRm*9o) z@Ju{eC(U7c8cm^Nmm=k*>{DGk;q;bp3TT@6-77>Xp+g)a*9#X@rsw5s8WkgSOV-5d z)=xyoJ{P+^lKcSs`>N&2I~ET?c^cU%Wq;dy*3^PFT|UiblQp2vQ~(%P2w_uW>bt?= zw+@TRSNW2STM8ypWD{d$@!YMqiF~g}Z4;X^Yz0>X>Av;7R?+XQ$$YKfXdYHD4CIm- z_=-*(FR$zg6W}N{9C1+`V0u8>778@`)v!cII_n>=oe>5eXZZMNZ97zXf18SZ(y7*32`AzkiiQX7j>dK;0FHCLGJmP7?CH0|lk@fNN5$M{c`haL#jgVDB zKvx8X@zx_VQF}5(Cl1kakKD9Ce8VnJKJ)TLx86+WxB)Ank*+6^tbl!NCe=zH|5?6* zUW?Tvjp*hM7m^}E#KOOiCEzFnCp_opa{sl-fv+eVZ6z>n>!Lq+)C5H-rgAC;i>MOX z?Yph0gGyD8zP+X|?KS2{9S4~G(CqO+UFy=;Kd^Vf?Avp=6uO`9Pky-i+8&hccKBIH z=wj-23L7P-iF_S?oLtSLoPM16%4VFfoiidW zcLT@4LV-6o(DlLqbSN-?%i^j5M#|n5n>(48%a*tw#qBr96wUHPJO|8#bR)+*FU$%p z>tYpuhnKj_`q4s&V44uC%DoQ=3dGQ@x6_4KOKY+aRjt8_Yh!#@wtO6;u8uh!44 zVISyheNWowKNiW?nxnh42IIp{!t#mbk2NH=viKP?B5Wr%TPmO%0Vf$xOhUH39^EwY zNDO2kol}o69xVGPc>46|30sHH3EGS>t|mXQMr!DkJ~*xa)tFfuuTh*)Y(M+}7{)by z*C0-GGjx`wL}HDNI&T>mk|bWGNg@_IQfm-bof$oU6X=Mr^$=|phOv;_C!Tgd9jYb1 zBi}gi$*5@dcZ1~FE1y@9xCk5A9!=PwSaLIMLffTiBd-Z8##hyR&9j3Ly<)AKr-|a- zC0D9ulRs9JN*O(DUDZ{tNR51h#Lt>+G}G8SJ!05);|;iq%w9>#+A6;)RIvG6#n3f* zME6$o!|i3@1IynJIt7QOfsM)x55|cOXbB_4!m5P*R~tY)ee8woJ?;G6-+K572DrQJ zGg*4htDM}0+~bEHHnW>&FctZvNITOP3WQ0!v&2y~rOqZ>gjr;H193Wcnb4mFNPGWa zNOx8P$)c9@(NUkHeyYQ?+_)ar9L_&JWo&&XS*-`()j^-$Squq0XIHNX}`whB(Z1;~sjTn+qo3{RwD za3V7NgLYOkObcbAlWY}1UFdtab8gF^?6LU&@IUequJ zA)*><5SxT~AfFhMXfEMPr^XDR6fBl;uL`{=4w;=a(!%y}PNKPM?gtk(ZvQHpW&wGi zkJ-vJtcB3cx3`OL3XBKX%chpSm!I6YMHkcQ*iWnuTkPxp3Wlo%lKZCTUBK+kP;Ncb zfh0c>c%Ni-gyk_o3Da~~_7m{$$kA}k+6Zl$iVCs^NG5R&Tjn@An^9%++|0K)%Qt9d zJ|R$UYhR#)OQvXkGuzQ4+}M*(Ufm8&e*I?eZh=samAPreVRvO=m zC9n&o+?Gii4Y-unA}&kVgmIp%t?aYDg7z&JvQu;iTyi&IQ}GpYKGFluD93)2}Q7 zg1@{V-NiA71l+nTyrw0vwv$gH*GZh1r(WCkStn=gybq>y3+O4_f`!m`Ru&NZ6YS#V z?`TB5{OSLpa!~6QN~AsCCT24CUgM8JBN>~19*AN+UOq-b=HyVD{azJvHanBn6L+w; z;sv}v>%6+=kuSO*k!jzV+B%~zwF?qQm$A!&!GTB9PU`?te0=<&WvI{X(I~t>DSzSN zczeoN=l;%`l`EnV7Jj^HQ?d@Mq!vpKFdeb6;OlUOW?KK1@`+)CgCERvZHycZk7rB10f^k3 zCt2ifkG5|n61%Uib|jyVQ_radweG5~LU;hfuKJjW!uRC3xHFkT*pj;`tig#Ybb;X_ zY`9ix43tv}FgJPj0}plY)cgQ#Md9E%8qrOyY)e=ZD~7?Lg%>R^|vV=PU084J(hgTIGYmlGeZYS#vN zBk$tth!m225$^?-^>~NN#|N4*Ds0ZfmI4)K)29g*uwBShVvew-=x;(ngXl$IoaR?G z{v!iKP+eL|3320uaP4=V9`}WJZz1!+$0&@dwY`Cw%9rorH;&-FN0uW$NozXEvo`9D z&XBr748Q1o5`8#M_KOaW9`U9BXs-{>W|GjiqLp(v!F{sj_QkIyf-#%-_G~|i3l^Ac zD-Y^ahl$QGMo^KG{^E>vVBOu4gDN z5g&Tm90+B;=ScD#LN=N|{?x8G)woeTk-a}Ux`dr3B|U%8d7R}uQ(JZgdU2cy8p^t% z(V$&YfQE%}F#ohIvW+Yl!*0fK<}gWn+$Sy!oKu9PJB{%3x5?oz5}BTrog;e08g3Yq z3+;HX+Hp07SEXcrjAI+^y_(tyU0#-Jg*-2o-8Ao!kj(kyL;V$Q_}HK#w{O=B)K)Ub zV-B+-uE`{OD;^t}M^-+rV_y83G$qD^b8#HeE@0kf-q|I{>qEuEZ)ec1x8H4>--EG+ zO10fUiqX@CVq+5NCG(}C^tfrbg28c_jS$mv7rmiyLOmKXJ)M~toIL(>8M@&7Xe~#2B#jixMDH=VY9ks3R1qab{0|i>j?J&)| z-M3$NV?hdm-WLMc-Rv2rNzI}i2HFi{$FHQ3Z&nq4l<5t8!&APlJtq7;5G7rU=VFP_ zUQ{O<`t7qc@tUar5-8^1r{yoC=M@~IsJh*ja-)-fd$cta^)Tv`P$DXppmP*andtf< zEDOh(oGH_W#PPSiNpS`e$YSDu#nJmUzMOS z*TSsZ-)F1tr@1c?aw;2a3UZ=$g<5n@aziDOD<*r7k}OS#NeGnltQe6UOvo>v^s)-O zTYPZg)&223g)Gt?qy zcMCet>(_n>PWDw=*Zo8Lv4MMjrbNSa)(nOmC|O%CEa(=Ph@#v$_Lto=Y0T0J)H&>v z!JuN4p6NtYF{$>=zvHz@6Wr%xnQ=(EfU{m5{; z${pYp+n2;Z`j;*9%r3U-IbBG2dqsaFffs-j zI9N~=-~)FR1Osy52tgr+|5bMXF3^V`2+9M1Z~-9>hJS7OfA!zLQ}S?kA$dR}yjn;W bdmjY1Fx From 2e96063d62471e597a3ff05c3ce6eadb4b4710f9 Mon Sep 17 00:00:00 2001 From: liwen Date: Tue, 21 May 2024 21:45:55 +0800 Subject: [PATCH 30/50] =?UTF-8?q?update:=20=E8=80=83=E8=AF=95=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E5=8F=8A=E6=A0=BC=E5=88=86=E8=AE=BE=E7=BD=AE=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hnac/hzims/safeproduct/entity/TestEntity.java | 10 +++++----- .../hzims/safeproduct/service/impl/TestScoreServiceImpl.java | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java index 27ae3d7..0235e18 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java @@ -60,11 +60,11 @@ public class TestEntity extends BaseEntity { @ApiModelProperty("考试结束时间") private Date testEndTime; - @NotNull - @Min(value = 0, message = "及格分必须大于等于0") - @Max(value = 100, message = "及格分必须小于等于100") - @ApiModelProperty("及格分") - private Integer passingScore; +// @NotNull +// @Min(value = 0, message = "及格分必须大于等于0") +// @Max(value = 100, message = "及格分必须小于等于100") +// @ApiModelProperty("及格分") +// private Integer passingScore; @NotNull @Size(max = 255, message = "考试地点字段长度不能超过255") diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java index ca24f67..a075bb2 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java @@ -126,7 +126,7 @@ public class TestScoreServiceImpl extends ServiceImpl s.getScore() != null).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(list)) { testScoreSumVO.setActualPeopleNum(list.size()); - List passCollect = list.stream().filter(s -> s.getScore() > testEntity.getPassingScore()).collect(Collectors.toList()); + List passCollect = list.stream().filter(s -> s.getScore() > 60).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(list)&&CollectionUtils.isNotEmpty(passCollect)) { double result = BigDecimal.valueOf(passCollect.size()).divide(BigDecimal.valueOf(list.size()),2, RoundingMode.UP).doubleValue(); testScoreSumVO.setPercentage(result); From 41bb39fdd31ea05e8686368ba3502d8c2486bf49 Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Wed, 22 May 2024 19:02:08 +0800 Subject: [PATCH 31/50] =?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=E6=9F=A5=E8=AF=A2=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alarm/config/constants/AlarmConstants.java | 1 + .../hnac/hzims/alarm/mqtt/DroolsMqttConsumer.java | 2 +- .../com/hnac/hzims/alarm/mqtt/FdpMqttConsumer.java | 3 +- .../hnac/hzims/alarm/mqtt/HZ300MqttConsumer.java | 2 +- .../java/com/hnac/hzims/alarm/mqtt/MqttConfig.java | 10 ++-- .../com/hnac/hzims/alarm/mqtt/SoeMqttConsumer.java | 3 +- .../hnac/hzims/alarm/mqtt/VideoMqttConsumer.java | 2 +- .../source/service/impl/LevelAlarmServiceImpl.java | 2 +- .../source/service/impl/MessageServiceImpl.java | 68 +++++++++++++++++----- .../service/impl/SystemAlarmServiceImpl.java | 6 +- .../hzims-alarm/src/main/resources/db/2.0.0.sql | 2 + 11 files changed, 69 insertions(+), 32 deletions(-) create mode 100644 hzims-service/hzims-alarm/src/main/resources/db/2.0.0.sql diff --git a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/constants/AlarmConstants.java b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/constants/AlarmConstants.java index 0128e39..ab035cd 100644 --- a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/constants/AlarmConstants.java +++ b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/constants/AlarmConstants.java @@ -7,6 +7,7 @@ import java.util.List; * @author ysj */ public interface AlarmConstants { + public static final String PATTERN_DATETIME_MILLIS = "yyyy-MM-dd HH:mm:ss.SSS"; String APP_NAME = "hzims-alarm"; diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/DroolsMqttConsumer.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/DroolsMqttConsumer.java index d24774e..87acece 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/DroolsMqttConsumer.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/DroolsMqttConsumer.java @@ -29,7 +29,7 @@ public class DroolsMqttConsumer implements SubscribeCallBack { private AlarmSaveService alarmSaveService; @Override public void onMessage(Map data) { - System.out.println("监听到消息"+data.toString()); + log.info("DroolsMqttConsumer监听到消息"+data.toString()); String s = JSONObject.toJSONString(data); //消费代码 List alarmEntities = droolsAlarmService.receiveMessage(s); diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/FdpMqttConsumer.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/FdpMqttConsumer.java index c4c2d97..827825c 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/FdpMqttConsumer.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/FdpMqttConsumer.java @@ -29,9 +29,8 @@ public class FdpMqttConsumer implements SubscribeCallBack { @Override public void onMessage(Map data) { String s = JSONObject.toJSONString(data); - log.error("监听Fdp消息 : {}" ,s); + log.info("监听Fdp消息 : {}" ,s); //消费代码 - List alarmEntities = fdpAlarmService.receiveMessage(s); if(CollectionUtil.isEmpty(alarmEntities)){ return; 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 82880ad..97c53b0 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.error("HZ3000队列监听到消息 : {}",data); + log.info("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/mqtt/MqttConfig.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/MqttConfig.java index 09651fd..6a2c34e 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/MqttConfig.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/MqttConfig.java @@ -58,23 +58,23 @@ public class MqttConfig { //fdp AnalysisSubscribe analysisSubscribe = new AnalysisSubscribe(); MqttAsyncClient fdpClient = analysisSubscribe.subscribe(mqttConfig, Collections.singletonList("#"), fdpMqttConsumer); - log.info(fdpClient.toString()); + log.info(fdpClient.toString()+fdpClient.getClientId()); //drools DroolsSoeSubscribe droolsSoeSubscribe = new DroolsSoeSubscribe(); MqttAsyncClient droolsClient = droolsSoeSubscribe.subscribe(mqttConfig, Collections.singletonList("#"), droolsMqttConsumer); - log.info(droolsClient.toString()); + log.info(droolsClient.toString()+droolsClient.getClientId()); //Soe SoeSubscribe soeSubscribe = new SoeSubscribe(); MqttAsyncClient soeClient = soeSubscribe.subscribe(mqttConfig, Collections.singletonList("#"), soeMqttConsumer); - log.info(soeClient.toString()); + log.info(soeClient.toString()+soeClient.getClientId()); //hz3000 HZ3000SoeSubscribe hz3000SoeSubscribe = new HZ3000SoeSubscribe(); MqttAsyncClient hz3000Client = hz3000SoeSubscribe.subscribe(mqttConfig, Collections.singletonList("#"), hz300MqttConsumer); - log.info(hz3000Client.toString()); + log.info(hz3000Client.toString()+hz3000Client.getClientId()); //视频 SoeSubscribe subscribe = new SoeSubscribe(); MqttAsyncClient videoClient = subscribe.subscribe(mqttConfig, Collections.singletonList("#"), videoMqttConsumer); - log.info(videoClient.toString()); + log.info(videoClient.toString()+videoClient.getClientId()); }catch (MqttException e){ log.error(e.toString()) ; } diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/SoeMqttConsumer.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/SoeMqttConsumer.java index 5a29fff..13fae87 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/SoeMqttConsumer.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/SoeMqttConsumer.java @@ -27,7 +27,7 @@ public class SoeMqttConsumer implements SubscribeCallBack { private AlarmSaveService alarmSaveService; @Override public void onMessage(Map data) { - System.out.println("监听到消息"+data.toString()); + log.info("SoeMqttConsumer监听到消息"+data.toString()); String s = JSONObject.toJSONString(data); //消费代码 List alarmEntities = soeAlarmService.receiveMessage(s); @@ -36,7 +36,6 @@ public class SoeMqttConsumer implements SubscribeCallBack { alarmSaveService.save(alarmEntities); }catch (Exception e){ log.error("条件告警数据处理报错(SoeAlarm):"+e); - System.out.println("规则引擎告警数据处理报错(SoeAlarm):"+e); } } } diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/VideoMqttConsumer.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/VideoMqttConsumer.java index 053c4df..447db7b 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/VideoMqttConsumer.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/VideoMqttConsumer.java @@ -26,7 +26,7 @@ public class VideoMqttConsumer implements SubscribeCallBack { private AlarmSaveService alarmSaveService; @Override public void onMessage(Map data) { - System.out.println("监听到消息"+data.toString()); + log.info("VideoMqttConsumer队列监听到消息 : {}",data); String s = JSONObject.toJSONString(data); //消费代码 List alarmEntities = videoAlarmService.receiveMessage(s); diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/LevelAlarmServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/LevelAlarmServiceImpl.java index 41b318f..fe035f1 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/LevelAlarmServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/LevelAlarmServiceImpl.java @@ -91,7 +91,7 @@ public class LevelAlarmServiceImpl implements LevelAlarmService { AlarmEntity entity = new AlarmEntity(); entity.setAlarmSource(AlarmConstants.LEVEL_ALARM); entity.setAlarmId(level.getId()); - entity.setAlarmTime(DateUtil.parse(level.getTs(), "yyyy-MM-dd HH:mm:ss.s")); + entity.setAlarmTime(new Date(level.getTs())); entity.setAlarmType(level.getType()); entity.setRealId(level.getSignage()); entity.setAlarmContext(level.getName()); 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 ffa434b..378a88d 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 @@ -15,6 +15,7 @@ import com.hnac.hzims.message.fegin.IMessageClient; import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.feign.IStationClient; import lombok.AllArgsConstructor; +import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.api.R; import org.springblade.core.tool.jackson.JsonUtil; @@ -27,6 +28,7 @@ import org.springblade.system.feign.ISysClient; import org.springblade.system.user.entity.User; import org.springblade.system.user.entity.UserInfo; import org.springblade.system.user.feign.IUserClient; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import java.util.*; @@ -40,9 +42,10 @@ import static com.hnac.hzims.operational.main.constant.MainConstants.PROJECT_MAN */ @Slf4j @Service -@AllArgsConstructor +@RequiredArgsConstructor public class MessageServiceImpl implements MessageService { + private final ISysClient sysClient; private final IUserClient userClient; @@ -51,6 +54,14 @@ public class MessageServiceImpl implements MessageService { private final IStationClient stationClient; + @Value("${hzims.msg.template}") + private String msgTemplate; + @Value("${hzims.msg.enabled}") + private Boolean msgEnabled; + @Value("${hzims.wxPush.template}") + private String wxPushTemplate; + @Value("${hzims.wxPush.enabled}") + private Boolean wxPushEnabled; /** * web/app消息推送 * @param entity : 告警对象 @@ -106,14 +117,23 @@ public class MessageServiceImpl implements MessageService { // } //写死传给固定用户 // List phoneList=Arrays.asList("18351807087","18163793336","13725599914"); - List phoneList=Arrays.asList("18351807087","18163793336","18285121497"); - for (String phone : phoneList) { - R userByPhone = userClient.getUserByPhone("200000", phone); - if (userByPhone.isSuccess()&&ObjectUtils.isNotEmpty(userByPhone.getData())){ - users.add(userByPhone.getData().getUser()); + if (msgEnabled){ + users = userClient.relationUserListByRoleAlias(station.getData().getTenantId(), station.getData().getRefDept(), PROJECT_MANAGER).getData(); + if(CollectionUtil.isEmpty(users)){ + log.error("短信发送失败:获取站点项目经理用户失败 : {}",entity); + return; + } + log.info("短信发送用户列表",users); + }else { + List phoneList = Arrays.asList("18351807087", "18163793336", "18285121497"); + for (String phone : phoneList) { + R userByPhone = userClient.getUserByPhone("200000", phone); + if (userByPhone.isSuccess() && ObjectUtils.isNotEmpty(userByPhone.getData())) { + users.add(userByPhone.getData().getUser()); + } } + log.info("短信发送用户列表",users); } - SmsImmediatelyPushDTO push = SmsImmediatelyPushDTO.builder() .deptId(entity.getCreateDept()) .taskId(entity.getId()) @@ -122,7 +142,7 @@ public class MessageServiceImpl implements MessageService { .content(entity.getAlarmContext()) .subject("告警短信通知") .tenantId(entity.getTenantId()) - .resourceCode(AlarmConstants.SMS_MESSAGE_TEMPLATE_CODE) + .resourceCode(msgTemplate) .pusher(users.stream().map(o->o.getId().toString()).collect(Collectors.joining(","))) .createUser(CommonConstant.SYSTEM_USER) .params(new HashMap(){{ @@ -146,19 +166,35 @@ public class MessageServiceImpl implements MessageService { log.error("微信消息发送失败:站点code获取失败 : {}",entity); return; } + List userList=new ArrayList<>(); // 获取站点用户 - R> result = userClient.userByDeptIdLevel(station.getData().getRefDept(),0); - if (!result.isSuccess() || CollectionUtil.isEmpty(result.getData())) { - log.error("微信消息发送失败:用户获取失败 : {}",entity); - return; + if (wxPushEnabled){ + R> result = userClient.userByDeptIdLevel(station.getData().getRefDept(),1); + if (!result.isSuccess() || CollectionUtil.isEmpty(result.getData())) { + log.error("微信公众号消息发送失败:用户获取失败 : {}",entity); + return; + } + userList.addAll(result.getData()); + log.info("短信发送用户列表",userList); + }else { + //内测只推给对应的3个用户 + List phoneList = Arrays.asList("18351807087", "18163793336", "18285121497"); + for (String phone : phoneList) { + R userByPhone = userClient.getUserByPhone("200000", phone); + if (userByPhone.isSuccess() && ObjectUtils.isNotEmpty(userByPhone.getData())) { + userList.add(userByPhone.getData().getUser()); + } + } + log.info("短信发送用户列表",userList); } + String userIds = userList.stream().map(o -> String.valueOf(o.getId())).distinct().collect(Collectors.joining(",")); WxMessageDTO message = new WxMessageDTO(); // 模板Id - message.setTemplateId("hIgINCsjpG-gyCKh8wzwBeRL9tanTLqRDgv-X8B9vyc"); + message.setTemplateId(wxPushTemplate); // // 微信消息跳转地址 // message.setSkipUrl("http://baidu.com"); // 机构Id - message.setDeptId(result.getData().get(0).getId()); + message.setDeptId(station.getData().getRefDept()); // 业务关键字 message.setBusinessKey(MessageConstants.BusinessClassifyEnum.WARNING.getKey()); // 业务分类关键字 @@ -178,9 +214,9 @@ public class MessageServiceImpl implements MessageService { // 消息主题 message.setSubject(MessageConstants.BusinessClassifyEnum.WARNING.getDescription()); // 推送用户 - message.setUserIds(result.getData().stream().map(o->String.valueOf(o.getId())).distinct().collect(Collectors.joining(","))); + message.setUserIds(userIds); // 创建用户 - message.setCreateUser(result.getData().get(0).getId()); + message.setCreateUser(userList.get(0).getId()); // 租户Id message.setTenantId(station.getData().getTenantId()); messageClient.sendWxMessage(message); diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/SystemAlarmServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/SystemAlarmServiceImpl.java index 8f3bee4..b829956 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/SystemAlarmServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/SystemAlarmServiceImpl.java @@ -83,9 +83,9 @@ public class SystemAlarmServiceImpl implements SystemAlarmService { private AlarmEntity getAlarmEntity(SystemAlarmVo item) { AlarmEntity entity = new AlarmEntity(); entity.setAlarmId(item.getId()); - Date date = new Date(); - date.setTime(item.getTs()); - entity.setAlarmTime(DateUtil.parse(DateUtil.format(date,DateUtil.PATTERN_DATETIME),DateUtil.PATTERN_DATETIME)); +// Date date = new Date(item.getTs()); +// entity.setAlarmTime(DateUtil.parse(item.getTs().toString(),PATTERN_DATETIME_MILLIS)); + entity.setAlarmTime( new Date(item.getTs())); entity.setAlarmContext(item.getContext()); entity.setAlarmType(item.getType()); entity.setAlarmStatus(item.getState()); diff --git a/hzims-service/hzims-alarm/src/main/resources/db/2.0.0.sql b/hzims-service/hzims-alarm/src/main/resources/db/2.0.0.sql new file mode 100644 index 0000000..0c98175 --- /dev/null +++ b/hzims-service/hzims-alarm/src/main/resources/db/2.0.0.sql @@ -0,0 +1,2 @@ +ALTER TABLE `hzims_alarm` + MODIFY COLUMN `ALARM_TIME` datetime(3) NULL DEFAULT NULL COMMENT '告警时间' AFTER `ALARM_COUNT`; \ No newline at end of file From 90e377ba24eddcaadb82b102695bdbf43096c2d5 Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Wed, 22 May 2024 19:03:37 +0800 Subject: [PATCH 32/50] =?UTF-8?q?hzinfo-data-sdk=E5=8D=87=E4=B8=BA5.1.1.RE?= =?UTF-8?q?LEASE.fix.4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1f8a773..226f1e4 100644 --- a/pom.xml +++ b/pom.xml @@ -75,7 +75,8 @@ com.hnac.hzinfo.data hzinfo-data-sdk - ${bladex.project.version} + + 5.1.1.RELEASE.fix.4 com.xuxueli From 3686b69437a57f87d023066495d675684990c4eb Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Wed, 22 May 2024 19:05:10 +0800 Subject: [PATCH 33/50] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=EF=BC=9A=E5=91=8A?= =?UTF-8?q?=E8=AD=A6=E6=97=B6=E9=97=B4=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hnac/hzims/alarm/source/service/impl/VideoAlarmServiceImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/VideoAlarmServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/VideoAlarmServiceImpl.java index 0ddbaa9..5eecd34 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/VideoAlarmServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/VideoAlarmServiceImpl.java @@ -28,6 +28,8 @@ import java.util.Date; import java.util.List; import java.util.stream.Collectors; +import static com.hnac.hzims.alarm.config.constants.AlarmConstants.PATTERN_DATETIME_MILLIS; + /** * 华自3000告警实现类 * @@ -99,7 +101,7 @@ public class VideoAlarmServiceImpl implements VideoAlarmService { private AlarmEntity getAlarmEntity(DeviceSoeVO item) { AlarmEntity entity = new AlarmEntity(); entity.setAlarmId(item.getId()); - entity.setAlarmTime(DateUtil.parse(item.getTs(), "yyyy-MM-dd HH:mm:ss.s")); + entity.setAlarmTime(DateUtil.parse(item.getTs(), PATTERN_DATETIME_MILLIS)); entity.setAlarmContext(item.getSoeExplain()); entity.setAlarmType(AlarmHandleConstant.VIDEO_ALARM); entity.setAlarmStatus(Integer.valueOf(item.getSoeStatus())); From a580ba4ddc6501ba4032ac78cf2e3c72c28c7d1d Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Wed, 22 May 2024 19:22:40 +0800 Subject: [PATCH 34/50] =?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=E9=99=90=E5=88=B6=E9=95=BF?= =?UTF-8?q?=E5=BA=A6=E4=B8=BA20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hnac/hzims/alarm/source/service/impl/MessageServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 378a88d..304f56b 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 @@ -203,9 +203,9 @@ public class MessageServiceImpl implements MessageService { message.setTaskId(entity.getId()); // 微信参数键值对 HashMap map = new HashMap<>(); - map.put("thing18",getTruncateString(entity.getStationName(), 29)); + map.put("thing18",getTruncateString(entity.getStationName(), 17)); // map.put("thing5",Optional.ofNullable(entity.getDeviceCode()).orElse("未知设备")); - map.put("thing11",getTruncateString(entity.getAlarmContext(), 29)); + map.put("thing11",getTruncateString(entity.getAlarmContext(), 17)); map.put("time2",entity.getAlarmTime()); map.put("thing14", DictCache.getValue("alarm_source", entity.getAlarmSource())); message.setMap(map); From 4dd8d3bc4c01f96c5d10e3571a07b3774b1a42b1 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Thu, 23 May 2024 11:39:12 +0800 Subject: [PATCH 35/50] =?UTF-8?q?#=E5=91=8A=E8=AD=A6=E5=A4=84=E7=90=86?= =?UTF-8?q?=E9=99=90=E5=88=B61=E5=A4=A9=E4=B8=8D=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E6=8A=A5=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../monitor/service/impl/AlarmSaveServiceImpl.java | 54 +++++++++++++++------- .../hzims/alarm/show/mapper/AlarmHandleMapper.java | 4 ++ .../hzims/alarm/show/mapper/AlarmHandleMapper.xml | 21 +++++++++ .../alarm/show/service/AlarmHandleService.java | 4 ++ .../show/service/impl/AlarmHandleServiceImpl.java | 28 +++++++++-- 5 files changed, 90 insertions(+), 21 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 15564c3..97633b9 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 @@ -6,6 +6,7 @@ import com.hnac.hzims.alarm.config.constants.AlarmConstants; import com.hnac.hzims.alarm.config.service.AlarmConfigService; import com.hnac.hzims.alarm.config.entity.AlarmEntity; import com.hnac.hzims.alarm.monitor.service.AlarmSaveService; +import com.hnac.hzims.alarm.show.service.AlarmHandleService; import com.hnac.hzims.alarm.show.service.AlarmService; import com.hnac.hzims.alarm.config.vo.AlarmHandleMarkVo; import com.hnac.hzims.message.entity.MessagePushRecordEntity; @@ -21,6 +22,7 @@ import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Service; import java.util.List; +import java.util.Optional; import java.util.Set; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; @@ -35,6 +37,8 @@ public class AlarmSaveServiceImpl implements AlarmSaveService { private final AlarmService alarmService; + private final AlarmHandleService handleService; + private final AlarmConfigService alarmConfigService; private final IStationClient stationClient; @@ -49,33 +53,49 @@ public class AlarmSaveServiceImpl implements AlarmSaveService { @Override public Boolean save(List alarms) { // 步骤1.查询告警数据对应站点 - R> result = stationClient.querySatationByCodes(alarms.stream().map(AlarmEntity::getStationId).collect(Collectors.toList())); - if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ + R> stations = stationClient.querySatationByCodes(alarms.stream().map(AlarmEntity::getStationId).collect(Collectors.toList())); + if(!stations.isSuccess() || CollectionUtil.isEmpty(stations.getData())){ log.error("alarm_query_station_is_null : {}",alarms.stream().map(AlarmEntity::getAlarmId).collect(Collectors.toList())); return false; } + // 步骤2.查询当天处理的告警 + List handlers = handleService.sameDayContent(); + // 步骤3.查询延后未完成的告警 + List delays = handleService.incompleteContent(); + // 步骤4.近5分钟内告警 Set keys = stringRedisTemplate.keys("hzims:queue:filter:alarm" + "*"); - // 步骤2.遍历保存告警数据 + // 步骤5.遍历保存告警数据 alarms.forEach(alarm->{ - List stations = result.getData().stream().filter(o->o.getCode().equals(alarm.getStationId())).collect(Collectors.toList()); - if(CollectionUtil.isEmpty(stations)){ - return; + // 未匹配到站点 + Optional optional = stations.getData().stream().filter(o->o.getCode().equals(alarm.getStationId())).findFirst(); + if(!optional.isPresent()){ + return; + } + // 告警已处理 + if(CollectionUtil.isNotEmpty(handlers) && handlers.contains(alarm.getAlarmContext())){ + return; + } + // 告警已延后处理 + if(CollectionUtil.isNotEmpty(delays) && delays.contains(alarm.getAlarmContext())){ + return; } - // 根据最近5分钟的数据,做去重 - for (String key : keys) { - String value = stringRedisTemplate.opsForValue().get(key); - if (value.equals(stations.get(0).getName()+alarm.getAlarmContext())){ - return; - } + // 近5分钟内告警重复 + if(CollectionUtil.isNotEmpty(keys)){ + for (String key : keys) { + String value = stringRedisTemplate.opsForValue().get(key); + if (value.equals(optional.get().getName()+alarm.getAlarmContext())){ + return; + } + } } // fpd告警拼接 if(AlarmConstants.EARLY_WARNING.equals(alarm.getAlarmSource())){ - alarm.setAlarmContext(stations.get(0).getName() + "." + alarm.getAlarmContext()); + alarm.setAlarmContext(optional.get().getName() + "." + alarm.getAlarmContext()); } // 步骤3.站点参数设置 - alarm.setCreateDept(stations.get(0).getCreateDept()); - alarm.setStationName(stations.get(0).getName()); - alarm.setTenantId(stations.get(0).getTenantId()); + alarm.setCreateDept(optional.get().getCreateDept()); + alarm.setStationName(optional.get().getName()); + alarm.setTenantId(optional.get().getTenantId()); alarm.setStatus(0); // 步骤4.根据站点查询配置标识 AlarmHandleMarkVo mark = alarmConfigService.mark(alarm.getStationId(),alarm.getAlarmSource(),alarm.getAlarmType()); @@ -99,7 +119,7 @@ public class AlarmSaveServiceImpl implements AlarmSaveService { return; } String key="hzims:queue:filter:alarm"+alarm.getAlarmId(); - stringRedisTemplate.opsForValue().set(key,stations.get(0).getName()+alarm.getAlarmContext()); + stringRedisTemplate.opsForValue().set(key,optional.get().getName()+alarm.getAlarmContext()); stringRedisTemplate.expire(key,5, TimeUnit.MINUTES); // 步骤7.发生数据至redis告警队列 stringRedisTemplate.opsForList().rightPush("hzims:queue:alarm", JSON.toJSONString(alarm)); 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 2f4527c..c80c634 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 @@ -21,4 +21,8 @@ public interface AlarmHandleMapper extends UserDataScopeBaseMapper selectHandlePage(IPage page, @Param("param") HandleQueryVo param); List handles(@Param("start") String start,@Param("end") String end); + + List sameDayContent(@Param("start") String start,@Param("end") String end); + + List incompleteContent(@Param("end") String end); } 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 971f958..110909c 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 @@ -40,4 +40,25 @@ AND (HANDLER.DELAY_TIME > #{end} OR HANDLER.DELAY_TIME IS NULL) + + + 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 e196455..b06840b 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 @@ -25,4 +25,8 @@ public interface AlarmHandleService extends BaseService { List handleUser(); List handles(); + + List sameDayContent(); + + List incompleteContent(); } 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 7fd7cb4..0a954e2 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 @@ -31,10 +31,7 @@ import org.springblade.system.user.entity.User; import org.springblade.system.user.feign.IUserClient; import org.springframework.stereotype.Service; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; /** @@ -170,4 +167,27 @@ public class AlarmHandleServiceImpl extends BaseServiceImpl sameDayContent() { + 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 + */ + @Override + public List incompleteContent() { + String end = DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME); + return this.baseMapper.incompleteContent(end); + } } From 791f2ffdfcb71a1b0b892055cb8c3f8bca0b9e8e Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Thu, 23 May 2024 17:14:22 +0800 Subject: [PATCH 36/50] =?UTF-8?q?#=E6=B0=B4=E7=94=B5=E7=AB=99=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E6=9C=88=E6=8A=A5=E7=94=9F=E6=88=90=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hnac/hzims/equipment/feign/IEmInfoClient.java | 7 + .../hzims/equipment/feign/IEmInfoClientBack.java | 6 + .../hnac/hzims/equipment/feign/EmInfoClient.java | 6 + .../hnac/hzims/equipment/mapper/EmParamMapper.java | 1 + .../hnac/hzims/equipment/mapper/EmParamMapper.xml | 9 + .../hzims/equipment/service/IEmInfoService.java | 2 + .../hzims/equipment/service/IEmParamService.java | 1 + .../equipment/service/impl/EmInfoServiceImpl.java | 47 ++ .../equipment/service/impl/EmParamServiceImpl.java | 5 + hzims-service/operational/pom.xml | 10 + .../main/service/IAnalyseDataService.java | 5 +- .../main/service/impl/AnalyseDataServiceImpl.java | 63 ++- .../report/controller/RunMonthController.java | 18 +- .../report/service/RunMonthService.java | 4 + .../report/service/impl/RunMonthServiceImpl.java | 555 ++++++++++++++++++++- 15 files changed, 715 insertions(+), 24 deletions(-) diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java index 6e6dec3..df356ed 100644 --- a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java @@ -19,6 +19,7 @@ package com.hnac.hzims.equipment.feign; import com.hnac.hzims.EquipmentConstants; import com.hnac.hzims.equipment.entity.EmInfoEntity; import com.hnac.hzims.equipment.vo.DeviceVO; +import com.hnac.hzims.equipment.vo.RideDeviceVo; import org.springblade.core.tool.api.R; import org.springblade.system.vo.CreateTableVO; import org.springframework.cloud.openfeign.FeignClient; @@ -84,6 +85,9 @@ public interface IEmInfoClient { String DEVICE_BY_PATH = API_PREFIX + "/deviceByPath"; String EM_INFO_LIST = API_PREFIX + "/emInfoList"; + String RIDE_DEVICES = API_PREFIX + "/rideDevices"; + + @PostMapping(DETAIL) EmInfoEntity getByCode(@RequestParam("code") String id); @@ -169,4 +173,7 @@ public interface IEmInfoClient { @GetMapping(EM_INFO_LIST) R> emInfoList(EmInfoEntity req); + + @GetMapping(RIDE_DEVICES) + List rideDevices(List longs); } diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java index c411e7e..104d494 100644 --- a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java @@ -2,6 +2,7 @@ package com.hnac.hzims.equipment.feign; import com.hnac.hzims.equipment.entity.EmInfoEntity; import com.hnac.hzims.equipment.vo.DeviceVO; +import com.hnac.hzims.equipment.vo.RideDeviceVo; import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.api.R; import org.springblade.system.vo.CreateTableVO; @@ -114,4 +115,9 @@ public class IEmInfoClientBack implements IEmInfoClient { public R> emInfoList(EmInfoEntity req) { return R.fail("远程调用失败"); } + + @Override + public List rideDevices(List longs) { + return new ArrayList<>(); + } } diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java index 637da20..444b59c 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java @@ -9,6 +9,7 @@ import com.hnac.hzims.common.utils.Condition; import com.hnac.hzims.equipment.entity.EmInfoEntity; import com.hnac.hzims.equipment.service.IEmInfoService; import com.hnac.hzims.equipment.vo.DeviceVO; +import com.hnac.hzims.equipment.vo.RideDeviceVo; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.ObjectUtil; @@ -155,6 +156,11 @@ public class EmInfoClient implements IEmInfoClient { return R.data(service.list(queryWrapper)); } + @Override + public List rideDevices(List deptIds) { + return service.rideDevices(deptIds); + } + @PostMapping(GET_EM_CREATE_TABLE) @Override public List getEmCreateTable(List tableNames) { diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmParamMapper.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmParamMapper.java index a2cb335..0e83b71 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmParamMapper.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmParamMapper.java @@ -19,4 +19,5 @@ public interface EmParamMapper extends UserDataScopeBaseMapper { List selectRideCountGroupEmIdByDepts(@Param("list") List list); + List rides(List deviceIds); } diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmParamMapper.xml b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmParamMapper.xml index bf699b0..09861ea 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmParamMapper.xml +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmParamMapper.xml @@ -53,4 +53,13 @@ 'installedCapacity') + diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmInfoService.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmInfoService.java index ead9dee..5632b61 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmInfoService.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmInfoService.java @@ -98,4 +98,6 @@ public interface IEmInfoService extends BaseService { List select(Long deptId); List getEmInfoTree(EmInfoEntity req); + + List rideDevices(List deptIds); } diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmParamService.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmParamService.java index 9284338..ca087ff 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmParamService.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmParamService.java @@ -19,4 +19,5 @@ public interface IEmParamService extends BaseService { Map> getRideCountGroupEmIdByDepts(List emIds); + List rides(List deviceIds); } diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java index fb6fb04..75d0db5 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java @@ -949,4 +949,51 @@ public class EmInfoServiceImpl extends BaseServiceImpl rideDevices(List deptIds) { + // 查询设备 + List devices = this.list(Wrappers.lambdaQuery() + .in(EmInfoEntity::getDepartment,deptIds) + .eq(EmInfoEntity::getHomePageDisplay,"1") + .eq(EmInfoEntity::getEmType,"2") + ); + if(CollectionUtil.isEmpty(devices)){ + return new ArrayList<>(); + } + List paramList = paramService.rides(devices.stream().map(EmInfoEntity::getId).collect(Collectors.toList())); + return devices.stream().map(device->{ + RideDeviceVo rideDevice = new RideDeviceVo(); + BeanUtil.copyProperties(device,rideDevice); + // 寻找设备配置参数 + List itemParamList = paramList.stream().filter(o->device.getId().equals(o.getInfoId())).collect(Collectors.toList()); + if(CollectionUtil.isNotEmpty(itemParamList)) { + // 遍历设备配置参数 + for (EmParamEntity paramEntity : itemParamList) { + String paramName = paramEntity.getParamName(); + switch (paramName) { + case "ct": + case "CT": + rideDevice.setCt(Double.parseDouble(paramEntity.getParamValue())); + break; + case "pt": + case "PT": + rideDevice.setPt(Double.parseDouble(paramEntity.getParamValue())); + break; + default: + break; + } + } + // 设置ct * pt + if (null != rideDevice.getCt() && null != rideDevice.getPt()) { + rideDevice.setRide(rideDevice.getCt() * rideDevice.getPt()); + }else{ + rideDevice.setRide(1.0); + } + }else{ + rideDevice.setRide(1.0); + } + return rideDevice; + }).collect(Collectors.toList()); + } + } diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmParamServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmParamServiceImpl.java index 394189f..cd4f0c6 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmParamServiceImpl.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmParamServiceImpl.java @@ -69,4 +69,9 @@ public class EmParamServiceImpl extends BaseServiceImpl rides(List deviceIds) { + return this.baseMapper.rides(deviceIds); + } } diff --git a/hzims-service/operational/pom.xml b/hzims-service/operational/pom.xml index 7f60701..688077c 100644 --- a/hzims-service/operational/pom.xml +++ b/hzims-service/operational/pom.xml @@ -240,6 +240,10 @@ com.hnac.hzinfo.data hzinfo-data-sdk + + com.hnac.hzims + alarm-api + @@ -255,6 +259,12 @@ 3.9.1 compile + + com.hnac.hzims + alarm-api + 4.0.0-SNAPSHOT + compile + diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IAnalyseDataService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IAnalyseDataService.java index 14d1292..fe2130f 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IAnalyseDataService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IAnalyseDataService.java @@ -15,10 +15,13 @@ public interface IAnalyseDataService { List getAnalyzeCodeBySignages(Function convert, T resource); + List analyzeCodeBySignages(List list); + + List periodTargetSignages(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, List signages); List periodTargetData(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, String signages); List periodTargetDatas(String startTime, String endTime, Integer accessRules, Integer cycleType, List deviceCodes, String signages); - Float periodTargetFloat(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, Integer ride ,String signages); + Float periodTargetFloat(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, Double ride ,String signages); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AnalyseDataServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AnalyseDataServiceImpl.java index 927d6d2..c66d6ff 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AnalyseDataServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AnalyseDataServiceImpl.java @@ -1,8 +1,6 @@ package com.hnac.hzims.operational.main.service.impl; import com.google.common.collect.Lists; -import com.hnac.hzims.EquipmentConstants; -import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; import com.hnac.hzims.operational.main.service.IAnalyseDataService; import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient; import com.hnac.hzinfo.datasearch.analyse.po.AnalyseCodeByAnalyseDataPO; @@ -22,7 +20,10 @@ import org.springframework.stereotype.Service; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.List; import java.util.function.Function; import java.util.stream.Collectors; @@ -47,6 +48,58 @@ public class AnalyseDataServiceImpl implements IAnalyseDataService { return result; } + /** + * 查询设备实例属性标识 + * @param list + * @return + */ + @Override + public List analyzeCodeBySignages(List list) { + R> result = analyseDataSearchClient.getAnalyzeCodeBySignages(list); + if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ + return new ArrayList<>(); + } + return result.getData(); + } + + /*** + * 指标数据列表查询 + * @param startTime 开始时间 + * @param endTime 结束时间 + * @param accessRules 取数规则 : 0=最早值 1=最大值 2=最小值 3=平均值 4=和值 5=差值 6=最新值 + * @param cycleType 间隔周期 : 0-> 秒 1-> 分 2-> 小时 3->天 4-> 周 5-> 月 6-> 年 + * @param deviceCode 设备编号 + * @param signages 指标集合 + * @return + */ + @Override + public List periodTargetSignages(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, List signages) { + AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO(); + List signboardConditions = new ArrayList<>(); + signages.forEach(signage->{ + AnalyzeDataConditionPO analyzeDataConditionPO = new AnalyzeDataConditionPO(); + analyzeDataConditionPO.setFull(1); + po.setDeviceCode(deviceCode); + analyzeDataConditionPO.setKeepFigures(2); + analyzeDataConditionPO.setAccessRules(accessRules); + analyzeDataConditionPO.setSaveTimeType(cycleType); + analyzeDataConditionPO.setSignages(signage); + // 间隔 + analyzeDataConditionPO.setTimeInterval(1); + analyzeDataConditionPO.setBeginTime(LocalDateTime.parse(DateUtil.format(new Date(), startTime), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME))); + analyzeDataConditionPO.setEndTime(LocalDateTime.parse(DateUtil.format(new Date(), endTime), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME))); + signboardConditions.add(analyzeDataConditionPO); + }); + po.setSignboardConditions(signboardConditions); + log.error("period_targets_data_request {}",po); + R> result = analyseDataSearchClient.getAnalyzeDataByAnalyzeCodeAndSignages(po); + if (!result.isSuccess() || CollectionUtil.isEmpty(result.getData())) { + return new ArrayList<>(); + } + log.error("period_targets_data_resp {}",result); + return result.getData(); + } + /*** * 指标数据列表查询 * @param startTime 开始时间 @@ -134,7 +187,7 @@ public class AnalyseDataServiceImpl implements IAnalyseDataService { * @return */ @Override - public Float periodTargetFloat(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode,Integer ride,String signages) { + public Float periodTargetFloat(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode,Double ride,String signages) { AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO(); List signboardConditions = new ArrayList<>(); AnalyzeDataConditionPO analyzeDataConditionPO = new AnalyzeDataConditionPO(); @@ -170,7 +223,7 @@ public class AnalyseDataServiceImpl implements IAnalyseDataService { if (ObjectUtil.isEmpty(analyseDataTaosVO) || StringUtil.isBlank(analyseDataTaosVO.getVal())) { return 0f; } - return Float.parseFloat(Optional.ofNullable(analyseDataTaosVO.getVal()).orElse("0")) * ride; + return Float.parseFloat(String.valueOf(Double.parseDouble(analyseDataTaosVO.getVal()) * ride)) ; } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/RunMonthController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/RunMonthController.java index 17b18ec..a5872ce 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/RunMonthController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/RunMonthController.java @@ -23,6 +23,22 @@ public class RunMonthController { private final RunMonthService runMonthService; + + @GetMapping("/generate") + @ApiOperation(value = "生成站点月报",notes = "生成站点月报") + @ApiOperationSupport(order = 1) + public R generate(@RequestParam("mon") String mon, + @RequestParam("stationCode") String stationCode){ + return R.data(runMonthService.generate(mon,stationCode)); + } + + @GetMapping("/check") + @ApiOperation(value = "查询站点月报数据",notes = "查询站点月报数据") + @ApiOperationSupport(order = 2) + public R check(@RequestParam("stationCode") String stationCode){ + return R.data(runMonthService.check(stationCode)); + } + @GetMapping("/data") @ApiOperation(value = "查询站点月报数据",notes = "查询站点月报数据") @ApiOperationSupport(order = 3) @@ -33,7 +49,7 @@ public class RunMonthController { @GetMapping("/export") @ApiOperation(value = "导出站点运行月报",notes = "导出站点运行月报") - @ApiOperationSupport(order = 3) + @ApiOperationSupport(order = 4) public void export(@RequestParam("mon") String mon, @RequestParam("stationCode") String stationCode){ runMonthService.export(mon,stationCode); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/RunMonthService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/RunMonthService.java index aa172f4..bed8fde 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/RunMonthService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/RunMonthService.java @@ -11,4 +11,8 @@ public interface RunMonthService extends BaseService { RunMonthEntity data(String mon, String stationCode); void export(String mon, String stationCode); + + Boolean generate(String mon, String stationCode); + + Boolean check(String stationCode); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java index 6e4a668..6d278d2 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java @@ -3,10 +3,38 @@ package com.hnac.hzims.operational.report.service.impl; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.TypeReference; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hnac.hzims.alarm.config.constants.AlarmConstants; +import com.hnac.hzims.alarm.config.constants.AlarmHandleConstant; +import com.hnac.hzims.common.logs.utils.StringUtils; +import com.hnac.hzims.equipment.entity.EmInfoEntity; +import com.hnac.hzims.equipment.entity.PlanGenerationEntity; +import com.hnac.hzims.equipment.feign.IEmInfoClient; +import com.hnac.hzims.equipment.feign.IPlanGenertionClient; +import com.hnac.hzims.equipment.vo.RideDeviceVo; +import com.hnac.hzims.operational.main.constant.HomePageConstant; +import com.hnac.hzims.operational.main.service.IAnalyseDataService; import com.hnac.hzims.operational.report.entity.RunMonthEntity; import com.hnac.hzims.operational.report.mapper.RunMonthMapper; import com.hnac.hzims.operational.report.service.RunMonthService; import com.hnac.hzims.operational.report.vo.*; +import com.hnac.hzims.operational.station.entity.StationEntity; +import com.hnac.hzims.operational.station.service.IStationService; +import com.hnac.hzims.operational.station.vo.StationVO; +import com.hnac.hzinfo.datasearch.PointData; +import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO; +import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO; +import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeDataConditionVO; +import com.hnac.hzinfo.datasearch.history.IHistoryDataSearchClient; +import com.hnac.hzinfo.datasearch.history.OriginalDataQuery; +import com.hnac.hzinfo.datasearch.soe.ISoeClient; +import com.hnac.hzinfo.datasearch.soe.domian.SoeData; +import com.hnac.hzinfo.datasearch.soe.domian.SoeQueryConditionByStation; +import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO; +import com.hnac.hzinfo.sdk.core.response.HzPage; +import com.hnac.hzinfo.sdk.core.response.Result; +import com.hnac.hzinfo.sdk.v5.soe.SoeDataClient; +import com.hnac.hzinfo.sdk.v5.soe.dto.StbAnalysisDTO; +import com.hnac.hzinfo.sdk.v5.soe.vo.StbAnalysisVO; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.poi.hssf.usermodel.HSSFFont; @@ -17,10 +45,9 @@ import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.base.BaseServiceImpl; -import org.springblade.core.tool.utils.BeanUtil; -import org.springblade.core.tool.utils.CollectionUtil; -import org.springblade.core.tool.utils.ObjectUtil; -import org.springblade.core.tool.utils.StringUtil; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.DateUtil; +import org.springblade.core.tool.utils.*; import org.springframework.stereotype.Service; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; @@ -31,19 +58,33 @@ import java.io.IOException; import java.math.BigDecimal; import java.math.RoundingMode; import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; +import java.time.LocalDateTime; +import java.util.*; import java.util.stream.Collectors; /** * @author ysj */ +@SuppressWarnings("ALL") @Service @AllArgsConstructor @Slf4j public class RunMonthServiceImpl extends BaseServiceImpl implements RunMonthService { + private final IStationService stationService; + + private final IAnalyseDataService dataService; + + private final ISoeClient soeClient; + + private final IEmInfoClient deivceClient; + + private final SoeDataClient soeDataClient; + + private final IPlanGenertionClient planClient; + + private final IHistoryDataSearchClient historyDataSearchClient; + /** * 查询站点月报运行数据 * @param mon @@ -124,6 +165,488 @@ public class RunMonthServiceImpl extends BaseServiceImpllambdaQuery() + .eq(StationEntity::getDataOrigin, HomePageConstant.DATA_ORIGIN) + .eq(StationEntity::getType,HomePageConstant.HYDROPOWER) + .eq(StationEntity::getCode,stationCode) + ); + if(ObjectUtil.isEmpty(station)){ + throw new ServiceException("未查询到站点信息!"); + } + // 查询站点设备 + List devices = deivceClient.rideDevices(Collections.singletonList(station.getRefDept())); + if(CollectionUtil.isEmpty(devices)){ + throw new ServiceException("站点未配置机组设备信息、请先为站点添加设备,绑定设备实例,再进行月报查询!"); + } + // 计划发电量 + List plans = planClient.getPlanGenerationByParam(Collections.singletonList(stationCode), null , DateUtil.format(new Date(),"yyyy")); + RunMonthEntity run = new RunMonthEntity(); + run.setTenantId(station.getTenantId()); + run.setCreateDept(station.getRefDept()); + run.setCreateUser(station.getCreateUser()); + run.setUpdateUser(station.getUpdateUser()); + run.setStationCode(station.getCode()); + run.setStationName(station.getName()); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(org.springblade.core.tool.utils.DateUtil.parse("2024-05-01 00:00:00", org.springblade.core.tool.utils.DateUtil.PATTERN_DATETIME)); + calendar.add(Calendar.DAY_OF_MONTH,-1); + run.setMonth(DateUtil.format(calendar.getTime(),"yyyy-MM")); + List stationDevices = devices.stream().filter(device->device.getDepartment().equals(station.getRefDept())).collect(Collectors.toList()); + // 运行数据 + run.setRunData(this.runData(station.getCode(),stationDevices,plans)); + // 告警数据 + run.setAlarmData(this.alarmData(station.getCode())); + // 月度运行曲线 + run.setCurveData(this.curveData(stationDevices)); + // TODO 运行数据分析 + // TODO 运行建议及其他 + // TODO 保存生成月报数据 + // runMonService.save(run); + return true; + } + + /** + * 运行数据 + * @param devices + * @return + */ + private String runData(String stationCode,List devices,List plans) { + List runs = new ArrayList<>(); + devices.forEach(device->{ + RunDataVo run = new RunDataVo(); + run.setDeviceCode(device.getNumber()); + run.setDeviceName(device.getName()); + // 运行时长 + run.setRunHours(this.runHours(device)); + // 月发电量 + Double day = this.generates(0,device.getNumber(),device.getRide()); + if(ObjectUtil.isEmpty(day)){ + run.setGenerate(0.0); + }else{ + run.setGenerate(day/10000); + } + // 年发电量 + Double year = this.generates(1,device.getNumber(),device.getRide()); + if(ObjectUtil.isEmpty(day)){ + run.setGenerateYear(0.0); + }else{ + run.setGenerateYear(year/10000); + } + // 计划发电量 + run.setPlan(this.planGenerate(0,stationCode,plans)/10000); + // 年计划发电量 + run.setPlanYear(this.planGenerate(1,stationCode,plans)/10000); + runs.add(run); + }); + return JSONObject.toJSONString(runs); + } + + /** + * 实际发电量 + * @param type + * @param deviceCode + * @param ride + * @return + */ + private Double generates(int type,String deviceCode,double ride) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(DateUtil.parse("2024-05-01 00:00:00",DateUtil.PATTERN_DATETIME)); + String end = null,start = null; + int cycleType = 5; + switch (type){ + case 0 : + calendar.add(Calendar.DAY_OF_MONTH,-1); + calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY)); + calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE)); + calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND)); + end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); + calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1); + start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); + break; + case 1 : + cycleType = 6; + end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); + calendar.add(Calendar.MONTH,-calendar.get(Calendar.MONTH)); + calendar.add(Calendar.DAY_OF_MONTH,-calendar.get(Calendar.DAY_OF_MONTH)); + calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY)); + calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE)); + calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND)); + calendar.add(Calendar.DAY_OF_MONTH,1); + start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); + break; + } + return Double.valueOf(dataService.periodTargetFloat(start,end,5,cycleType,deviceCode,ride,HomePageConstant.HYDROPOWER_GENERATE_POWER)); + } + + /** + * 计划发电量 + * @param type + * @param stationCode + * @param plans + * @return + */ + private Double planGenerate(int type, String stationCode,List plans) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(DateUtil.parse("2024-05-01 00:00:00",DateUtil.PATTERN_DATETIME)); + if(type == 0){ + calendar.add(Calendar.DAY_OF_MONTH,-1); + calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY) + 1); + calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE)); + calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND)); + String time = DateUtil.format(calendar.getTime(),"yyyy-MM"); + return plans.stream().filter(plan -> plan.getStationId().equals(stationCode) && plan.getDateTime().contains(time)) + .mapToDouble(PlanGenerationEntity::getPlanGeneration).sum(); + } + String time = DateUtil.format(calendar.getTime(),"yyyy"); + return plans.stream().filter(plan -> plan.getStationId().equals(stationCode) && plan.getDateTime().contains(time)) + .mapToDouble(PlanGenerationEntity::getPlanGeneration).sum(); + } + + /** + * 获取运行数据 + * @param device + * @return + */ + private Double runHours(EmInfoEntity device) { + MultiAnalyzeCodePO analyze = new MultiAnalyzeCodePO(); + analyze.setDeviceCode(device.getNumber()); + analyze.setSignages(Collections.singletonList(HomePageConstant.ACTIVE_POWER)); + List signages = dataService.analyzeCodeBySignages(Collections.singletonList(analyze)); + if(CollectionUtil.isEmpty(signages)){ + return 0.0; + } + // 监测点 + String realId = signages.get(0).getRealId(); + if(StringUtils.isEmpty(realId)){ + return 0.0; + } + // 确定查询时间范围: 年、月 + Date startDate,endDate; + Calendar calendar = Calendar.getInstance(); + calendar.setTime(DateUtil.parse("2024-05-01 00:00:00",DateUtil.PATTERN_DATETIME)); + endDate = calendar.getTime(); + calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH)); + calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1); + startDate = calendar.getTime(); + return this.getRunConvertData(realId,startDate,endDate); + } + + /** + * 获取时间范围内运行时长 + * @param realId + * @param startDate + * @param endDate + * @return + */ + private Double getRunConvertData(String realId, Date startDate, Date endDate) { + OriginalDataQuery originalDataQuery = new OriginalDataQuery(); + originalDataQuery.setRealId(realId); + originalDataQuery.setBeginTime(startDate); + originalDataQuery.setEndTime(endDate); + originalDataQuery.setLimit(100000); + originalDataQuery.setPage(1); + // 查询时间范围开关机监测点历史数据 + Result> result = historyDataSearchClient.getOriginalDataByRealIds(originalDataQuery); + if(!result.isSuccess() || ObjectUtil.isEmpty(result.getData())){ + return 0.0; + } + // 开机运行时长 + long time = this.getRunTime(result.getData().getRecords(),startDate,endDate); + return BigDecimal.valueOf(time / (1000 * 60 * 60.00)).setScale(2, RoundingMode.HALF_UP).doubleValue(); + } + + /** + * 获取运行时长 + * @param result + * @return + */ + private long getRunTime(List result,Date startDate,Date endDate) { + if(result.size() == 1){ + // 一直开机 + if(Double.parseDouble(result.get(0).getValue()) > 0){ + return endDate.getTime() - startDate.getTime(); + } + // 一直关机 + return 0; + } + long time=0; + // 遍历累计开机时长 + for(int i = 0; i< result.size() ; i++){ + // 记录为开机状态 就计算到下次关机的时间差 + if(Double.parseDouble(result.get(i).getValue()) <= 0){ + continue; + } + Date endTime,startTime = DateUtil.parse(result.get(i).getTime(), DateUtil.PATTERN_DATETIME); + // 遍历至最后一条数据,累计至当前时间 + if(i == result.size() - 1){ + endTime = endDate; + }else { + endTime = DateUtil.parse(result.get(i+1).getTime(), DateUtil.PATTERN_DATETIME); + } + time += endTime.getTime() - startTime.getTime(); + } + return time; + } + + /** + * 告警数据 + * @param code + * @return + */ + private String alarmData(String code) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(DateUtil.parse("2024-05-01 00:00:00",DateUtil.PATTERN_DATETIME)); + calendar.add(Calendar.DAY_OF_MONTH,-1); + String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); + calendar.add(Calendar.MONTH,-1); + calendar.add(Calendar.DAY_OF_MONTH,1); + calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY)); + calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE)); + calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND)); + String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); + // HZ3000:故障告警 + List alarms = this.hz3000Alarm(code,start,end); + // FIXME 设备实例:一级告警 + // FDP智能预警 + alarms.addAll(this.intelligentEarly(code,start,end)); + return JSONObject.toJSONString(alarms); + } + + /** + * 查询hz3000告警 + * @param code + */ + private List hz3000Alarm(String code,String start,String end) { + SoeQueryConditionByStation query = new SoeQueryConditionByStation(); + query.setStationIds(Collections.singletonList(code)); + query.setTypes(Collections.singletonList(AlarmHandleConstant.FAULT)); + query.setBeginTime(LocalDateTime.parse(start,DateUtil.DATETIME_FORMATTER)); + query.setEndTime(LocalDateTime.parse(end,DateUtil.DATETIME_FORMATTER)); + query.setNeedPage(false); + Result> result = soeClient.getByStationsAndTime(query); + if(!result.isSuccess() || ObjectUtil.isEmpty(result.getData()) || CollectionUtil.isEmpty(result.getData().getRecords())){ + return new ArrayList<>(); + } + return result.getData().getRecords().stream().collect(Collectors.groupingBy(SoeData::getSoeExplain)).entrySet().stream().map(entry->{ + RunAlarmVo alarm = new RunAlarmVo(); + alarm.setAlarmTime(DateUtil.format(entry.getValue().stream().sorted(Comparator.comparing(SoeData::getTs)).collect(Collectors.toList()).get(0).getTs(),DateUtil.PATTERN_DATETIME)); + alarm.setDeviceName(entry.getValue().get(0).getDeviceName()); + alarm.setContent(entry.getKey()); + alarm.setType(String.valueOf(AlarmConstants.FAULT)); + alarm.setTypeName("故障"); + alarm.setCount(Math.max(entry.getValue().stream().filter(o->StringUtil.isNotBlank(o.getTraceCount())).mapToInt(soe->Integer.parseInt(soe.getTraceCount())).sum(), 1)); + return alarm; + }).collect(Collectors.toList()); + } + + /** + * 智能预警 + * @param code + * @param start + * @param end + * @return + */ + private List intelligentEarly(String code, String start, String end) { + StbAnalysisDTO param = new StbAnalysisDTO(); + param.setStartTime(LocalDateTime.parse(start,DateUtil.DATETIME_FORMATTER)); + param.setEndTime(LocalDateTime.parse(end, DateUtil.DATETIME_FORMATTER)); + param.setStations(Collections.singletonList(code)); + param.setNeedPage(false); + Result> result = soeDataClient.pageStbAnalysis(param); + if(!result.isSuccess() || ObjectUtil.isEmpty(result.getData()) || CollectionUtil.isEmpty(result.getData().getRecords())){ + return new ArrayList<>(); + } + return result.getData().getRecords().stream().collect(Collectors.groupingBy(StbAnalysisVO::getName)).entrySet().stream().map(entry->{ + RunAlarmVo alarm = new RunAlarmVo(); + alarm.setAlarmTime(entry.getValue().stream().sorted(Comparator.comparing(StbAnalysisVO::getTs)).collect(Collectors.toList()).get(0).getTs()); + alarm.setDeviceName(entry.getValue().get(0).getOrd()); + alarm.setContent(entry.getKey()); + alarm.setType(String.valueOf(AlarmConstants.EARLY)); + alarm.setTypeName("智能预警"); + alarm.setReason(entry.getValue().get(0).getFinfo()); + alarm.setMemo(entry.getValue().get(0).getInfo()); + alarm.setCount(entry.getValue().size()); + return alarm; + }).collect(Collectors.toList()); + } + + /** + * 运行曲线 + * @param devices + * @return + */ + private String curveData(List devices) { + List curveDatas = devices.stream().map(device -> { + CurveEchartVo curveData = new CurveEchartVo(); + curveData.setDeviceCode(device.getNumber()); + curveData.setDeviceName(device.getName()); + // 负荷曲线 + curveData.setLoadCurve(this.curve(this.attribute(0), device.getNumber())); + // 轴承温度曲线 + curveData.setBearingTempCurve(this.curve(this.attribute(1), device.getNumber())); + // 定子温度曲线 + curveData.setStatorTempCurve(this.curve(this.attribute(2), device.getNumber())); + return curveData; + }).collect(Collectors.toList()); + return JSONObject.toJSONString(curveDatas); + } + + /** + * 获取曲线数据 + * @param attributes + * @param deviceCode + * @return + * + * + */ + private List curve(List attributes, String deviceCode) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(DateUtil.parse("2024-05-01 00:00:00",DateUtil.PATTERN_DATETIME)); + //calendar.setTime(DateUtil.parse(DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 23:59:59",DateUtil.PATTERN_DATETIME)); + calendar.add(Calendar.DAY_OF_MONTH,-1); + String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); + calendar.add(Calendar.MONTH,-1); + calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY)); + calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE)); + calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND)); + String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); + List datas = dataService.periodTargetSignages(start,end,3,3,deviceCode,attributes.stream().map(AttributeVo::getSignage).collect(Collectors.toList())); + if(CollectionUtil.isEmpty(datas)){ + return new ArrayList<>(); + } + List analyseDatas = new ArrayList<>(); + Calendar day = Calendar.getInstance(); + datas.forEach(data->{ + if(CollectionUtil.isEmpty(data.getList())){ + return; + } + analyseDatas.addAll(data.getList().stream().peek(item->{ + item.setSignage(data.getSignage()); + Date date = DateUtil.parse(item.getTs(), "yyyy-MM-dd HH:mm:ss.s"); + day.setTime(date); + item.setTs(String.valueOf(day.get(Calendar.DAY_OF_MONTH))); + }).collect(Collectors.toList())); + }); + if(CollectionUtil.isEmpty(analyseDatas)){ + return new ArrayList<>(); + } + Map> map = analyseDatas.stream().collect(Collectors.groupingBy(AnalyseDataTaosVO::getTs)); + return map.entrySet().stream().map(entry->{ + EchartVo echart = new EchartVo(); + echart.setTime(Integer.valueOf(entry.getKey())); + echart.setValues(entry.getValue().stream().map(value->{ + EchartValueVo echartValue = new EchartValueVo(); + echartValue.setAttribute(value.getSignage()); + echartValue.setAttributeName(attributes.stream().filter(o->o.getSignage().equals(value.getSignage())).collect(Collectors.toList()).get(0).getSignageName()); + if(StringUtil.isEmpty(value.getVal())){ + echartValue.setValue(0.0); + }else{ + echartValue.setValue(Double.parseDouble(value.getVal())); + } + return echartValue; + }).collect(Collectors.toList())); + return echart; + }).sorted(Comparator.comparing(EchartVo::getTime)).collect(Collectors.toList()); + } + + /** + * 曲线属性获取 + * @param attributeType + * @return + */ + private List attribute(int attributeType) { + List attributes = new ArrayList<>(); + switch (attributeType){ + case 0: + AttributeVo attribute = new AttributeVo(); + attribute.setSignage(HomePageConstant.ACTIVE_POWER); + attribute.setSignageName("负荷"); + attributes.add(attribute); + break; + case 1: + + AttributeVo upper_temp = new AttributeVo(); + upper_temp.setSignage(HomePageConstant.UPPER_GUIDE_BEARING_TEMP); + upper_temp.setSignageName("上导轴承瓦温1"); + attributes.add(upper_temp); + AttributeVo oil_tem = new AttributeVo(); + oil_tem.setSignage(HomePageConstant.UPPER_GUIDE_BEARING_OIL_GROOVE_TEMP); + oil_tem.setSignageName("上导轴承油槽温度"); + attributes.add(oil_tem); + AttributeVo thrust_tem = new AttributeVo(); + thrust_tem.setSignage(HomePageConstant.THRUST_BEARING_TEMP); + thrust_tem.setSignageName("推力轴瓦温度1"); + attributes.add(thrust_tem); + AttributeVo lower_tem = new AttributeVo(); + lower_tem.setSignage(HomePageConstant.LOWER_GUIDE_BEARING_TEMP); + lower_tem.setSignageName("下导轴承瓦温1"); + attributes.add(lower_tem); + AttributeVo tank_tem = new AttributeVo(); + tank_tem.setSignage(HomePageConstant.LOWER_GUIDE_OIL_TANK_TEMP); + tank_tem.setSignageName("下导油槽温度"); + attributes.add(tank_tem); + AttributeVo tile_tem = new AttributeVo(); + tile_tem.setSignage(HomePageConstant.WATER_GUIDE_TILE_TEMP); + tile_tem.setSignageName("水导瓦温"); + attributes.add(tile_tem); + AttributeVo water_tem = new AttributeVo(); + water_tem.setSignage(HomePageConstant.WATER_GUIDE_OIL_TANK_TEMP); + water_tem.setSignageName("水导油槽温度"); + attributes.add(water_tem); + break; + case 2: + AttributeVo A_tem = new AttributeVo(); + A_tem.setSignage(HomePageConstant.A_PHASE_IRON_CORE_TEMP); + A_tem.setSignageName("A相铁芯温度1"); + attributes.add(A_tem); + + AttributeVo B_tem = new AttributeVo(); + B_tem.setSignage(HomePageConstant.B_PHASE_IRON_CORE_TEMP); + B_tem.setSignageName("B相铁芯温度1"); + attributes.add(B_tem); + + AttributeVo C_tem = new AttributeVo(); + C_tem.setSignage(HomePageConstant.C_PHASE_IRON_CORE_TEMP); + C_tem.setSignageName("C相铁芯温度1"); + attributes.add(C_tem); + break; + } + return attributes; + } + + /** + * 检查站点是否存在设备信息 + * @param stationCode + * @return + */ + @Override + public Boolean check(String stationCode) { + // 查询站点 + StationVO station = stationService.getStationByCode(stationCode); + if(ObjectUtil.isEmpty(station)){ + throw new ServiceException("未查询到站点信息!"); + } + // 查询设备 + R> emInfos = deivceClient.getEmInfoByDept(Collections.singletonList(station.getRefDept())); + if(!emInfos.isSuccess() || CollectionUtil.isEmpty(emInfos.getData())){ + throw new ServiceException("站点未配置机组设备信息、请先为站点添加设备,绑定设备实例,再进行月报查询!"); + } + List devices = emInfos.getData().stream().filter(o->"2".equals(o.getEmType())).collect(Collectors.toList()); + if(CollectionUtil.isEmpty(devices)){ + throw new ServiceException("站点未配置机组设备信息、请先为站点添加设备,绑定设备实例,再进行月报查询!"); + } + return true; + } + + /** * 手绘运行数据表格 * @return */ @@ -280,16 +803,14 @@ public class RunMonthServiceImpl extends BaseServiceImpl curveToArray(List curves) { List attrValues = new ArrayList<>(); - curves.forEach(curve->{ - attrValues.addAll(curve.getValues().stream().map(value->{ - CurveAttrValueVo attrValue = new CurveAttrValueVo(); - attrValue.setAttribute(value.getAttribute()); - attrValue.setAttributeName(value.getAttributeName()); - attrValue.setTime(curve.getTime()); - attrValue.setValue(value.getValue()); - return attrValue; - }).collect(Collectors.toList())); - }); + curves.forEach(curve-> attrValues.addAll(curve.getValues().stream().map(value->{ + CurveAttrValueVo attrValue = new CurveAttrValueVo(); + attrValue.setAttribute(value.getAttribute()); + attrValue.setAttributeName(value.getAttributeName()); + attrValue.setTime(curve.getTime()); + attrValue.setValue(value.getValue()); + return attrValue; + }).collect(Collectors.toList()))); return attrValues.stream().collect(Collectors.groupingBy(CurveAttrValueVo::getAttribute)).entrySet().stream().map(entry->{ CurveYArrayVo yArray = new CurveYArrayVo(); yArray.setAttribute(entry.getKey()); From 2f0e8716db1d9ffe873b3a70057eb4bf4f61d802 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Tue, 28 May 2024 09:38:21 +0800 Subject: [PATCH 37/50] =?UTF-8?q?#=E6=B0=B4=E7=94=B5=E7=AB=99=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E6=9C=88=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hnac/hzims/equipment/feign/IEmInfoClient.java | 2 +- .../hnac/hzims/equipment/feign/EmInfoClient.java | 3 ++- .../hnac/hzims/equipment/mapper/EmParamMapper.java | 2 +- .../report/mapper/RunMonReportMapper.java | 13 ++++++++++ .../report/service/RunMonthReportService.java | 11 +++++++++ .../service/impl/RunMonReportServiceImpl.java | 19 +++++++++++++++ .../report/service/impl/RunMonthServiceImpl.java | 28 ++++++++++++++++++---- 7 files changed, 71 insertions(+), 7 deletions(-) create mode 100644 hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/mapper/RunMonReportMapper.java create mode 100644 hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/RunMonthReportService.java create mode 100644 hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonReportServiceImpl.java diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java index df356ed..45145c9 100644 --- a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java @@ -175,5 +175,5 @@ public interface IEmInfoClient { R> emInfoList(EmInfoEntity req); @GetMapping(RIDE_DEVICES) - List rideDevices(List longs); + List rideDevices(@RequestParam("deptIds") List deptIds); } diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java index 444b59c..de29497 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java @@ -157,7 +157,8 @@ public class EmInfoClient implements IEmInfoClient { } @Override - public List rideDevices(List deptIds) { + @GetMapping(RIDE_DEVICES) + public List rideDevices(@RequestParam("deptIds") List deptIds) { return service.rideDevices(deptIds); } diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmParamMapper.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmParamMapper.java index 0e83b71..7244763 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmParamMapper.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmParamMapper.java @@ -19,5 +19,5 @@ public interface EmParamMapper extends UserDataScopeBaseMapper { List selectRideCountGroupEmIdByDepts(@Param("list") List list); - List rides(List deviceIds); + List rides(@Param("deviceIds") List deviceIds); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/mapper/RunMonReportMapper.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/mapper/RunMonReportMapper.java new file mode 100644 index 0000000..87a4eb6 --- /dev/null +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/mapper/RunMonReportMapper.java @@ -0,0 +1,13 @@ +package com.hnac.hzims.operational.report.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzims.operational.report.entity.RunMonthEntity; + +/** + * @author ysj + * @date 2023/04/10 11:22:14 + * @version 4.0.0 + */ +public interface RunMonReportMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/RunMonthReportService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/RunMonthReportService.java new file mode 100644 index 0000000..68bca91 --- /dev/null +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/RunMonthReportService.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.operational.report.service; + +import com.hnac.hzims.operational.report.entity.RunMonthEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface RunMonthReportService extends BaseService { + +} \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonReportServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonReportServiceImpl.java new file mode 100644 index 0000000..8dda69a --- /dev/null +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonReportServiceImpl.java @@ -0,0 +1,19 @@ +package com.hnac.hzims.operational.report.service.impl; + +import com.hnac.hzims.operational.report.entity.RunMonthEntity; +import com.hnac.hzims.operational.report.mapper.RunMonReportMapper; +import com.hnac.hzims.operational.report.service.RunMonthReportService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +/** + * @author ysj + */ +@Service +@RequiredArgsConstructor +@Slf4j +public class RunMonReportServiceImpl extends BaseServiceImpl implements RunMonthReportService { + +} \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java index 6d278d2..12eebde 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java @@ -15,6 +15,7 @@ import com.hnac.hzims.operational.main.constant.HomePageConstant; import com.hnac.hzims.operational.main.service.IAnalyseDataService; import com.hnac.hzims.operational.report.entity.RunMonthEntity; import com.hnac.hzims.operational.report.mapper.RunMonthMapper; +import com.hnac.hzims.operational.report.service.RunMonthReportService; import com.hnac.hzims.operational.report.service.RunMonthService; import com.hnac.hzims.operational.report.vo.*; import com.hnac.hzims.operational.station.entity.StationEntity; @@ -75,6 +76,8 @@ public class RunMonthServiceImpl extends BaseServiceImpl stationDevices = devices.stream().filter(device->device.getDepartment().equals(station.getRefDept())).collect(Collectors.toList()); @@ -208,9 +211,26 @@ public class RunMonthServiceImpl extends BaseServiceImpl runs = runMonthReportService.list(Wrappers.lambdaQuery() + .eq(RunMonthEntity::getMonth,mon) + .eq(RunMonthEntity::getStationCode,stationCode) + ); + if(CollectionUtil.isEmpty(runs)){ + return; + } + this.runMonthReportService.deleteLogic(runs.stream().map(RunMonthEntity::getId).collect(Collectors.toList())); } /** From bc4fde238cad836ec79fee200ff8910bbb384526 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Tue, 28 May 2024 15:06:42 +0800 Subject: [PATCH 38/50] =?UTF-8?q?#=E6=B0=B4=E7=94=B5=E7=AB=99=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E6=9C=88=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../report/controller/RunMonthController.java | 2 +- .../report/service/impl/RunMonthServiceImpl.java | 199 +++++++++------------ 2 files changed, 88 insertions(+), 113 deletions(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/RunMonthController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/RunMonthController.java index a5872ce..9801a20 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/RunMonthController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/RunMonthController.java @@ -28,7 +28,7 @@ public class RunMonthController { @ApiOperation(value = "生成站点月报",notes = "生成站点月报") @ApiOperationSupport(order = 1) public R generate(@RequestParam("mon") String mon, - @RequestParam("stationCode") String stationCode){ + @RequestParam("stationCode") String stationCode){ return R.data(runMonthService.generate(mon,stationCode)); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java index 12eebde..fe5149c 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java @@ -3,6 +3,7 @@ package com.hnac.hzims.operational.report.service.impl; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.TypeReference; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.hnac.hzims.alarm.config.constants.AlarmConstants; import com.hnac.hzims.alarm.config.constants.AlarmHandleConstant; import com.hnac.hzims.common.logs.utils.StringUtils; @@ -61,6 +62,7 @@ import java.math.RoundingMode; import java.net.URLEncoder; import java.time.LocalDateTime; import java.util.*; +import java.util.concurrent.*; import java.util.stream.Collectors; /** @@ -88,6 +90,9 @@ public class RunMonthServiceImpl extends BaseServiceImpl(1024), new ThreadFactoryBuilder().setNameFormat("generate-run-report-pool-%d").build() , new ThreadPoolExecutor.CallerRunsPolicy()); + /** * 查询站点月报运行数据 * @param mon @@ -101,7 +106,7 @@ public class RunMonthServiceImpl extends BaseServiceImpl stationDevices = devices.stream().filter(device->device.getDepartment().equals(station.getRefDept())).collect(Collectors.toList()); - // 运行数据 - run.setRunData(this.runData(station.getCode(),stationDevices,plans)); + calendar.setTime(DateUtil.parse(mon,"yyyy-MM")); + String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); + calendar.add(Calendar.MONTH,1); + String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); // 告警数据 - run.setAlarmData(this.alarmData(station.getCode())); - // 月度运行曲线 - run.setCurveData(this.curveData(stationDevices)); + run.setAlarmData(this.alarmData(station.getCode(),start,end)); + CountDownLatch countDownLatch = new CountDownLatch(devices.size()); + List runDatas = new CopyOnWriteArrayList<>(); + List curveEcharts = new CopyOnWriteArrayList<>(); + for (RideDeviceVo device : devices){ + pool.submit(()->{ + // 运行数据 + runDatas.add(this.runData(station.getCode(),device,plans,start,end)); + // 月度运行曲线 + curveEcharts.add(this.curveData(device,start,end)); + }); + countDownLatch.countDown(); + } + //所有模板数据获取完成后释放锁 + try { + countDownLatch.await(); + } catch (InterruptedException e) { + e.printStackTrace(); + Thread.currentThread().interrupt(); + } + if(CollectionUtil.isEmpty(runDatas)){ + run.setRunData(JSONObject.toJSONString(runDatas)); + } + if(CollectionUtil.isEmpty(curveEcharts)){ + run.setCurveData(JSONObject.toJSONString(curveEcharts)); + } // TODO 运行数据分析 // TODO 运行建议及其他 // 先删除原先月报数据 @@ -238,35 +265,31 @@ public class RunMonthServiceImpl extends BaseServiceImpl devices,List plans) { - List runs = new ArrayList<>(); - devices.forEach(device->{ - RunDataVo run = new RunDataVo(); - run.setDeviceCode(device.getNumber()); - run.setDeviceName(device.getName()); - // 运行时长 - run.setRunHours(this.runHours(device)); - // 月发电量 - Double day = this.generates(0,device.getNumber(),device.getRide()); - if(ObjectUtil.isEmpty(day)){ - run.setGenerate(0.0); - }else{ - run.setGenerate(day/10000); - } - // 年发电量 - Double year = this.generates(1,device.getNumber(),device.getRide()); - if(ObjectUtil.isEmpty(day)){ - run.setGenerateYear(0.0); - }else{ - run.setGenerateYear(year/10000); - } - // 计划发电量 - run.setPlan(this.planGenerate(0,stationCode,plans)/10000); - // 年计划发电量 - run.setPlanYear(this.planGenerate(1,stationCode,plans)/10000); - runs.add(run); - }); - return JSONObject.toJSONString(runs); + private RunDataVo runData(String stationCode,RideDeviceVo device,List plans,String start,String end) { + RunDataVo run = new RunDataVo(); + run.setDeviceCode(device.getNumber()); + run.setDeviceName(device.getName()); + // 运行时长 + run.setRunHours(this.runHours(device,DateUtil.parse(start,DateUtil.PATTERN_DATETIME), DateUtil.parse(end,DateUtil.PATTERN_DATETIME))); + // 月发电量 + Double day = this.generates(0,device.getNumber(),device.getRide(),start,end); + if(ObjectUtil.isEmpty(day)){ + run.setGenerate(0.0); + }else{ + run.setGenerate(day/10000); + } + // 年发电量 + Double year = this.generates(1,device.getNumber(),device.getRide(),start,end); + if(ObjectUtil.isEmpty(day)){ + run.setGenerateYear(0.0); + }else{ + run.setGenerateYear(year/10000); + } + // 计划发电量 + run.setPlan(this.planGenerate(0,stationCode,plans)/10000); + // 年计划发电量 + run.setPlanYear(this.planGenerate(1,stationCode,plans)/10000); + return run; } /** @@ -276,34 +299,18 @@ public class RunMonthServiceImpl extends BaseServiceImpl alarms = this.hz3000Alarm(code,start,end); - // FIXME 设备实例:一级告警 // FDP智能预警 alarms.addAll(this.intelligentEarly(code,start,end)); return JSONObject.toJSONString(alarms); @@ -503,20 +491,17 @@ public class RunMonthServiceImpl extends BaseServiceImpl devices) { - List curveDatas = devices.stream().map(device -> { - CurveEchartVo curveData = new CurveEchartVo(); - curveData.setDeviceCode(device.getNumber()); - curveData.setDeviceName(device.getName()); - // 负荷曲线 - curveData.setLoadCurve(this.curve(this.attribute(0), device.getNumber())); - // 轴承温度曲线 - curveData.setBearingTempCurve(this.curve(this.attribute(1), device.getNumber())); - // 定子温度曲线 - curveData.setStatorTempCurve(this.curve(this.attribute(2), device.getNumber())); - return curveData; - }).collect(Collectors.toList()); - return JSONObject.toJSONString(curveDatas); + private CurveEchartVo curveData(RideDeviceVo device,String start,String end) { + CurveEchartVo curveData = new CurveEchartVo(); + curveData.setDeviceCode(device.getNumber()); + curveData.setDeviceName(device.getName()); + // 负荷曲线 + curveData.setLoadCurve(this.curve(this.attribute(0),start,end, device.getNumber())); + // 轴承温度曲线 + curveData.setBearingTempCurve(this.curve(this.attribute(1),start,end, device.getNumber())); + // 定子温度曲线 + curveData.setStatorTempCurve(this.curve(this.attribute(2),start,end, device.getNumber())); + return curveData; } /** @@ -527,17 +512,7 @@ public class RunMonthServiceImpl extends BaseServiceImpl curve(List attributes, String deviceCode) { - Calendar calendar = Calendar.getInstance(); - calendar.setTime(DateUtil.parse("2024-05-01 00:00:00",DateUtil.PATTERN_DATETIME)); - //calendar.setTime(DateUtil.parse(DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 23:59:59",DateUtil.PATTERN_DATETIME)); - calendar.add(Calendar.DAY_OF_MONTH,-1); - String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); - calendar.add(Calendar.MONTH,-1); - calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY)); - calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE)); - calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND)); - String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); + private List curve(List attributes,String start,String end, String deviceCode) { List datas = dataService.periodTargetSignages(start,end,3,3,deviceCode,attributes.stream().map(AttributeVo::getSignage).collect(Collectors.toList())); if(CollectionUtil.isEmpty(datas)){ return new ArrayList<>(); From aac30665c7537c1df60c1e12e324eb2621de79c4 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Tue, 28 May 2024 15:38:14 +0800 Subject: [PATCH 39/50] =?UTF-8?q?#=E6=B0=B4=E7=94=B5=E7=AB=99=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E6=9C=88=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/operational/OperationalConstants.java | 2 +- .../operational/station/vo/HomeMapStationVo.java | 44 ++++++++++++++++++++++ .../station/controller/StationController.java | 7 ++-- .../station/service/IStationService.java | 3 ++ .../station/service/impl/StationServiceImpl.java | 28 ++++++++++++++ 5 files changed, 80 insertions(+), 4 deletions(-) create mode 100644 hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/vo/HomeMapStationVo.java diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/OperationalConstants.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/OperationalConstants.java index 2a49f48..04b7013 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/OperationalConstants.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/OperationalConstants.java @@ -4,7 +4,7 @@ import lombok.Getter; public class OperationalConstants { - public final static String APP_NAME = "hzims-operational"; + public final static String APP_NAME = "hzims-operational-ysj"; diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/vo/HomeMapStationVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/vo/HomeMapStationVo.java new file mode 100644 index 0000000..3aa7c25 --- /dev/null +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/vo/HomeMapStationVo.java @@ -0,0 +1,44 @@ +package com.hnac.hzims.operational.station.vo; + +import com.baomidou.mybatisplus.annotation.FieldStrategy; +import com.baomidou.mybatisplus.annotation.SqlCondition; +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.NullSerializer; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springblade.core.mp.support.QueryField; + +/** + * @author ysj + */ +@Data +public class HomeMapStationVo { + + @ApiModelProperty("行政区划") + private String areaCode; + + @ApiModelProperty("编号") + private String code; + + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("经度(东经)") + @JsonSerialize(nullsUsing = NullSerializer.class) + private Float lgtd; + + @ApiModelProperty("纬度(北纬)") + @JsonSerialize(nullsUsing = NullSerializer.class) + private Float lttd; + + @ApiModelProperty("所属机构") + @JsonSerialize(nullsUsing = NullSerializer.class) + private Long refDept; + + @ApiModelProperty("站点是否为国外 1:是;0:否") + private Boolean isAbroad; + + @ApiModelProperty("所属国家") + private String refCountry; +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationController.java index 7351f30..ce3a5c3 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationController.java @@ -10,6 +10,7 @@ import com.hnac.hzims.operational.data.service.HzimsDataService; import com.hnac.hzims.operational.main.service.IMainSystemMonitoringService; import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.service.IStationService; +import com.hnac.hzims.operational.station.vo.HomeMapStationVo; import com.hnac.hzims.operational.station.vo.StationVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -177,9 +178,9 @@ public class StationController extends BladeController { @ApiLog @GetMapping("/getHomeStationList") @ApiOperationSupport(order = 91) - @ApiOperation(value = "获取首页站点列表", notes = "") - public R> getHomeStationList(@RequestParam(value = "deptId", required = false) Long deptId, @RequestParam(value = "types", required = false) List types, @RequestParam(value = "serveType", required = false) Integer serveType) { - return R.data(stationService.getHomeStationList(deptId, types, serveType,true)); + @ApiOperation(value = "获取首页地图站点列表", notes = "") + public R> getHomeStationList() { + return R.data(stationService.homeMapStationVo()); } @ApiLog diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationService.java index 4e3faac..b54f579 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationService.java @@ -3,6 +3,7 @@ package com.hnac.hzims.operational.station.service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.hnac.hzims.operational.main.vo.StationCountVo; import com.hnac.hzims.operational.station.entity.StationEntity; +import com.hnac.hzims.operational.station.vo.HomeMapStationVo; import com.hnac.hzims.operational.station.vo.StationAndDeptVo; import com.hnac.hzims.operational.station.vo.StationVO; import org.springblade.core.mp.base.BaseService; @@ -136,4 +137,6 @@ public interface IStationService extends BaseService { * @return 更新是否成功 */ boolean updateBatchSort(List req); + + List homeMapStationVo(); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java index 7976d98..be9301e 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java @@ -25,6 +25,7 @@ import com.hnac.hzims.operational.station.mapper.StationMapper; import com.hnac.hzims.operational.station.service.IStationAttributeService; import com.hnac.hzims.operational.station.service.IStationPushConfigService; import com.hnac.hzims.operational.station.service.IStationService; +import com.hnac.hzims.operational.station.vo.HomeMapStationVo; import com.hnac.hzims.operational.station.vo.StationAndDeptVo; import com.hnac.hzims.operational.station.vo.StationPushConfigVO; import com.hnac.hzims.operational.station.vo.StationVO; @@ -768,4 +769,31 @@ public class StationServiceImpl extends BaseServiceImpl homeMapStationVo() { + List stations = this.list(Wrappers.lambdaQuery() + .isNotNull(StationEntity::getRefDept) + .isNotNull(StationEntity::getAreaCode) + ); + if(CollectionUtil.isEmpty(stations)){ + return new ArrayList<>(); + } + return stations.stream().map(o->{ + HomeMapStationVo mapStation = new HomeMapStationVo(); + mapStation.setAreaCode(o.getAreaCode()); + mapStation.setName(o.getName()); + mapStation.setCode(o.getCode()); + mapStation.setLttd(o.getLttd()); + mapStation.setLgtd(o.getLgtd()); + mapStation.setRefDept(o.getRefDept()); + mapStation.setIsAbroad(o.getIsAbroad()); + mapStation.setRefCountry(o.getRefCountry()); + return mapStation; + }).collect(Collectors.toList()); + } } From e0a898c3d55e86428421aaad9b8bf811daddddbe Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Tue, 28 May 2024 15:46:26 +0800 Subject: [PATCH 40/50] =?UTF-8?q?#=E6=B0=B4=E7=94=B5=E7=AB=99=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E6=9C=88=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operation/report/impl/ReportServiceImpl.java | 32 ++++++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java index e071cd8..843473d 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java @@ -620,6 +620,9 @@ public class ReportServiceImpl implements ReportService { if(CollectionUtil.isEmpty(stations)){ return; } + // 删除上个月手动生成月报记录 + this.deleteGenerateReport(stations); + // 计划发电量 List plans = planService.planGeneration(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), null ,DateUtil.format(new Date(),"yyyy")); // 查询站点设备 @@ -633,7 +636,7 @@ public class ReportServiceImpl implements ReportService { run.setStationCode(station.getCode()); run.setStationName(station.getName()); Calendar calendar = Calendar.getInstance(); - calendar.setTime(DateUtil.parse("2024-05-01 00:00:00",DateUtil.PATTERN_DATETIME)); + calendar.setTime(new Date()); calendar.add(Calendar.DAY_OF_MONTH,-1); run.setMonth(DateUtil.format(calendar.getTime(),"yyyy-MM")); List stationDevices = devices.stream().filter(device->device.getDepartment().equals(station.getRefDept())).collect(Collectors.toList()); @@ -654,6 +657,24 @@ public class ReportServiceImpl implements ReportService { } /** + * 删除上月手动生成月报记录 + * @param stations + */ + private void deleteGenerateReport(List stations) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + calendar.add(Calendar.MONTH,-1); + List runs = runMonService.list(Wrappers.lambdaQuery() + .eq(RunMonthEntity::getMonth,DateUtil.format(calendar.getTime(),"yyyy-MM")) + .in(RunMonthEntity::getStationCode,stations.stream().map(StationEntity::getCode).collect(Collectors.toList())) + ); + if(CollectionUtil.isEmpty(runs)){ + return; + } + runMonService.deleteLogic(runs.stream().map(RunMonthEntity::getId).collect(Collectors.toList())); + } + + /** * 运行数据 * @param devices * @return @@ -699,7 +720,7 @@ public class ReportServiceImpl implements ReportService { */ private Double generate(int type,String deviceCode,double ride) { Calendar calendar = Calendar.getInstance(); - calendar.setTime(DateUtil.parse("2024-05-01 00:00:00",DateUtil.PATTERN_DATETIME)); + calendar.setTime(new Date()); String end = null,start = null; int cycleType = 5; switch (type){ @@ -773,7 +794,7 @@ public class ReportServiceImpl implements ReportService { // 确定查询时间范围: 年、月 Date startDate,endDate; Calendar calendar = Calendar.getInstance(); - calendar.setTime(DateUtil.parse("2024-05-01 00:00:00",DateUtil.PATTERN_DATETIME)); + calendar.setTime(new Date()); endDate = calendar.getTime(); calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH)); calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1); @@ -846,7 +867,7 @@ public class ReportServiceImpl implements ReportService { */ private String alarmData(String code) { Calendar calendar = Calendar.getInstance(); - calendar.setTime(DateUtil.parse("2024-05-01 00:00:00",DateUtil.PATTERN_DATETIME)); + calendar.setTime(new Date()); calendar.add(Calendar.DAY_OF_MONTH,-1); String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); calendar.add(Calendar.MONTH,-1); @@ -952,8 +973,7 @@ public class ReportServiceImpl implements ReportService { */ private List curve(List attributes, String deviceCode) { Calendar calendar = Calendar.getInstance(); - calendar.setTime(DateUtil.parse("2024-05-01 00:00:00",DateUtil.PATTERN_DATETIME)); - //calendar.setTime(DateUtil.parse(DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 23:59:59",DateUtil.PATTERN_DATETIME)); + calendar.setTime(DateUtil.parse(DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 23:59:59",DateUtil.PATTERN_DATETIME)); calendar.add(Calendar.DAY_OF_MONTH,-1); String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); calendar.add(Calendar.MONTH,-1); From 97b1ee220157c7b367d59fb99d87e5535cae68d6 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Tue, 28 May 2024 15:47:25 +0800 Subject: [PATCH 41/50] =?UTF-8?q?#=E6=B0=B4=E7=94=B5=E7=AB=99=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E6=9C=88=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/hnac/hzims/operational/OperationalConstants.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/OperationalConstants.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/OperationalConstants.java index 04b7013..2a49f48 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/OperationalConstants.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/OperationalConstants.java @@ -4,7 +4,7 @@ import lombok.Getter; public class OperationalConstants { - public final static String APP_NAME = "hzims-operational-ysj"; + public final static String APP_NAME = "hzims-operational"; From 5e2ab79d97ce30901a6cba745b087d6a9597d0cf Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Tue, 28 May 2024 17:27:18 +0800 Subject: [PATCH 42/50] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E5=85=AC=E4=BC=97=E5=8F=B7=E6=8E=A8=E9=80=81=E5=AD=97?= =?UTF-8?q?=E6=95=B0=E9=99=90=E5=88=B6=E5=9C=A820?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hnac/hzims/alarm/source/service/impl/MessageServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 304f56b..084cf4f 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 @@ -203,9 +203,9 @@ public class MessageServiceImpl implements MessageService { message.setTaskId(entity.getId()); // 微信参数键值对 HashMap map = new HashMap<>(); - map.put("thing18",getTruncateString(entity.getStationName(), 17)); + map.put("thing18",getTruncateString(entity.getStationName(), 20)); // map.put("thing5",Optional.ofNullable(entity.getDeviceCode()).orElse("未知设备")); - map.put("thing11",getTruncateString(entity.getAlarmContext(), 17)); + map.put("thing11",getTruncateString(entity.getAlarmContext(), 20)); map.put("time2",entity.getAlarmTime()); map.put("thing14", DictCache.getValue("alarm_source", entity.getAlarmSource())); message.setMap(map); From bee5de26b85fca75d955a3527a5cdb635bcb54d6 Mon Sep 17 00:00:00 2001 From: liwen Date: Mon, 27 May 2024 16:36:34 +0800 Subject: [PATCH 43/50] =?UTF-8?q?update:=20=E5=8D=AB=E7=94=9F=E8=87=AA?= =?UTF-8?q?=E6=9F=A5=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/HygieneTemplateDetailEntity.java | 8 ++++ .../safeproduct/controller/HygieneController.java | 4 +- .../service/IHygieneTemplateDetailService.java | 7 ++++ .../service/IHygieneTemplateService.java | 7 ++++ .../service/impl/HygienePlanServiceImpl.java | 43 +++++++++------------- .../impl/HygieneTemplateDetailServiceImpl.java | 13 +++++++ .../service/impl/HygieneTemplateServiceImpl.java | 33 ++++++++++++++++- .../com/hnac/hzims/safeproduct/utils/BaseUtil.java | 18 +++++++++ .../safeproduct/src/main/resources/db/2.0.1.sql | 4 +- 9 files changed, 107 insertions(+), 30 deletions(-) diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygieneTemplateDetailEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygieneTemplateDetailEntity.java index 9fe501f..3f3ff43 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygieneTemplateDetailEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygieneTemplateDetailEntity.java @@ -25,6 +25,14 @@ public class HygieneTemplateDetailEntity extends BaseEntity { @ApiModelProperty("责任区") private String zone; + @Size(max = 20, message = "责任人字段长度不能超过20") + @ApiModelProperty("责任人") + private String principal; + @ApiModelProperty("检查项") private String checkItem; + + @Size(max = 255, message = "检查项分值字段长度不能超过255") + @ApiModelProperty("检查项分值") + private String checkItemScore; } 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 e6c0c3e..fe2739c 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 @@ -218,7 +218,7 @@ public class HygieneController extends BladeController { @ApiOperation(value = "卫生自查模板详情") @ApiOperationSupport(order = 18) @Operate(label = "卫生自查模板详情", type = BusinessType.QUERY, ignore = false) - public R hygieneTemplateDetail(@RequestParam Long id) { + public R hygieneTemplateDetail(@RequestParam Long id) { HygieneTemplateDetailVO detail = hygieneTemplateService.getHygieneTemplateDetail(id); return R.data(detail); } @@ -227,7 +227,7 @@ public class HygieneController extends BladeController { @ApiOperation(value = "卫生自查模板分页") @ApiOperationSupport(order = 19) @Operate(label = "卫生自查模板分页", type = BusinessType.QUERY, ignore = false) - public R hygieneTemplatePage(@ApiIgnore @RequestParam Map param, Query query) { + public R> hygieneTemplatePage(@ApiIgnore @RequestParam Map param, Query query) { IPage page = hygieneTemplateService.page(Condition.getPage(query), Condition.getQueryWrapper( param, HygieneTemplateEntity.class)); return R.data(page); diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneTemplateDetailService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneTemplateDetailService.java index de71dad..463b0b5 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneTemplateDetailService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneTemplateDetailService.java @@ -18,4 +18,11 @@ public interface IHygieneTemplateDetailService extends IService getListByTemplateId(Long templateId); + + /** + * 删除关联模板详情数据 + * @param templateId 模板id + * @return true-成功,false-失败 + */ + boolean removeReferenceDetail(Long templateId); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneTemplateService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneTemplateService.java index 71493f9..5f45e16 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneTemplateService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneTemplateService.java @@ -39,4 +39,11 @@ public interface IHygieneTemplateService extends IService * @return 详情 */ HygieneTemplateDetailVO getHygieneTemplateDetail(Long id); + + /** + * 根据模板名获取模板 + * @param name 模板名 + * @return 模板实体类 + */ + HygieneTemplateEntity getHygieneTemplateByName(String name); } 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 2c3b176..fb4a3d3 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 @@ -18,6 +18,7 @@ import com.hnac.hzims.safeproduct.mapper.HygienePlanMapper; import com.hnac.hzims.safeproduct.service.IHygienePlanService; import com.hnac.hzims.safeproduct.service.IHygieneRecordService; import com.hnac.hzims.safeproduct.service.IHygieneZoneService; +import com.hnac.hzims.safeproduct.utils.BaseUtil; import com.hnac.hzims.safeproduct.vo.HygienePlanDetailVO; import com.hnac.hzims.safeproduct.vo.HygieneMonthVO; import org.springblade.core.log.exception.ServiceException; @@ -126,7 +127,7 @@ public class HygienePlanServiceImpl extends ServiceImpl zoneList = hygienePlanDTO.getZoneList(); // 若计划修改成功,修改关联责任区数据 if (updatePlan) { - for (HygieneZoneEntity zone : zoneList) { - String[] scores = zone.getCheckItemScore().split(",|,"); - // 校验检查项总成绩是否为标准总成绩 - getSumScore(scores, hygienePlanDTO.getStandardScore()); + // 删除旧数据 + boolean removeZone = hygieneZoneService.removeReferenceZone(hygienePlanDTO.getId()); + if (removeZone) { + hygienePlan = getPlanByName(hygienePlanDTO.getName()); + // 增加新数据 + for (HygieneZoneEntity zone : zoneList) { + // 传计划id + if (hygienePlan != null) { + zone.setHygienePlanId(hygienePlan.getId()); + } + String[] scores = zone.getCheckItemScore().split(",|,"); + // 校验检查项总成绩是否为标准总成绩 + BaseUtil.getSumScore(scores, hygienePlanDTO.getStandardScore()); + } + // 校验通过则批量修改责任区数据 + return R.status(hygieneZoneService.saveBatch(zoneList)); } - // 校验通过则批量修改责任区数据 - return R.status(hygieneZoneService.updateBatchById(zoneList)); } return R.status(Boolean.FALSE); } @@ -210,24 +221,6 @@ public class HygienePlanServiceImpl extends ServiceImpl standardScore) { - throw new ServiceException("累计分值超过标准总分值"); - } - } - if (sum < standardScore) { - throw new ServiceException("标准总分值未全部分配"); - } - } - - /** * 根据编码查询卫生自查计划 */ @Override diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneTemplateDetailServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneTemplateDetailServiceImpl.java index 3ea4851..8df4088 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneTemplateDetailServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneTemplateDetailServiceImpl.java @@ -8,6 +8,7 @@ import com.hnac.hzims.safeproduct.service.IHygieneTemplateDetailService; import org.springframework.stereotype.Service; import java.util.List; +import java.util.stream.Collectors; /** * 卫生自查模板详情服务实现类 @@ -27,4 +28,16 @@ public class HygieneTemplateDetailServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(HygieneTemplateDetailEntity::getTemplateId, templateId); + List list = this.list(queryWrapper); + List ids = list.stream().map(HygieneTemplateDetailEntity::getId).collect(Collectors.toList()); + return this.removeByIds(ids); + } } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneTemplateServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneTemplateServiceImpl.java index efceb94..55f66bb 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneTemplateServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneTemplateServiceImpl.java @@ -8,6 +8,7 @@ import com.hnac.hzims.safeproduct.entity.HygieneTemplateEntity; import com.hnac.hzims.safeproduct.mapper.HygieneTemplateMapper; import com.hnac.hzims.safeproduct.service.IHygieneTemplateDetailService; import com.hnac.hzims.safeproduct.service.IHygieneTemplateService; +import com.hnac.hzims.safeproduct.utils.BaseUtil; import com.hnac.hzims.safeproduct.vo.HygieneTemplateDetailVO; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.tool.utils.CollectionUtil; @@ -49,6 +50,15 @@ public class HygieneTemplateServiceImpl extends ServiceImpl detailList = hygieneTemplateDTO.getTemplateDetailList(); + detailList.forEach(detail -> { + detail.setTemplateId(hygieneTemplateEntity.getId()); + String[] scores = detail.getCheckItemScore().split(",|,"); + // 校验检查项总成绩是否为标准总成绩 + BaseUtil.getSumScore(scores, 100); + }); return hygieneTemplateDetailService.saveBatch(hygieneTemplateDTO.getTemplateDetailList()); } @@ -72,9 +82,18 @@ public class HygieneTemplateServiceImpl extends ServiceImpl detailList = hygieneTemplateDTO.getTemplateDetailList(); + for (HygieneTemplateDetailEntity detail : detailList) { + String[] scores = detail.getCheckItemScore().split(",|,"); + BaseUtil.getSumScore(scores, 100); + } + return hygieneTemplateDetailService.saveBatch(detailList); } /** @@ -104,4 +123,14 @@ public class HygieneTemplateServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(HygieneTemplateEntity::getTemplateName, name); + return this.getOne(queryWrapper); + } } 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 da74c7f..76aada7 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 @@ -395,4 +395,22 @@ public class BaseUtil { } return fileName; } + + /** + * 计算累计分值 + * @param scores 各项分值 + * @param standardScore 标准总分值 + */ + public static void getSumScore(String[] scores, Integer standardScore) { + int sum = 0; + for (String score : scores) { + sum += Integer.parseInt(score); + if (sum > standardScore) { + throw new ServiceException("累计分值超过标准总分值"); + } + } + if (sum < standardScore) { + throw new ServiceException("标准总分值未全部分配"); + } + } } 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 3730612..9434144 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 @@ -31,7 +31,9 @@ CREATE TABLE IF NOT EXISTS `hzims_hygiene_template_detail` ( `id` bigint(20) NOT NULL COMMENT '主键ID', `template_id` bigint(20) NOT NULL COMMENT '模板id', `zone` varchar(50) NOT NULL COMMENT '责任区', - `check_item` mediumtext NOT NULL COMMENT '检查项', + `PRINCIPAL` VARCHAR(20) NOT NULL COMMENT '责任人', + `CHECK_ITEM` MEDIUMTEXT NOT NULL COMMENT '检查项', + `CHECK_ITEM_SCORE` VARCHAR(255) 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 '创建时间', From 9d5461c38f2e875b88196a71f23dc05fb8e6ee64 Mon Sep 17 00:00:00 2001 From: liwen Date: Tue, 28 May 2024 11:24:00 +0800 Subject: [PATCH 44/50] =?UTF-8?q?update:=20=E5=8D=AB=E7=94=9F=E8=87=AA?= =?UTF-8?q?=E6=9F=A5=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../safeproduct/mapper/HygienePlanMapper.java | 1 - .../service/impl/HygienePlanServiceImpl.java | 82 ++++++++++------------ .../service/impl/HygieneRecordServiceImpl.java | 14 ++-- .../service/impl/HygieneTemplateServiceImpl.java | 46 ++++++------ .../safeproduct/src/main/resources/db/2.0.1.sql | 6 +- 5 files changed, 75 insertions(+), 74 deletions(-) diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygienePlanMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygienePlanMapper.java index 946d92b..8170e95 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygienePlanMapper.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygienePlanMapper.java @@ -7,7 +7,6 @@ import org.apache.ibatis.annotations.Mapper; import org.springblade.core.datascope.annotation.UserDataAuth; import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; - /** * 卫生自查计划Mapper类 * 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 fb4a3d3..4ad0ca5 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 @@ -63,15 +63,16 @@ public class HygienePlanServiceImpl extends ServiceImpl zoneList = hygienePlanDTO.getZoneList(); - // 若计划新增成功,新增关联责任区数据 - if (savePlan) { - hygienePlan = getPlanByName(hygienePlanDTO.getName()); - for (HygieneZoneEntity zone : zoneList) { - // 传计划id - if (hygienePlan != null) { - zone.setHygienePlanId(hygienePlan.getId()); - } - String[] scores = zone.getCheckItemScore().split(",|,"); - // 校验检查项总成绩是否为标准总成绩 - BaseUtil.getSumScore(scores, hygienePlanDTO.getStandardScore()); - } - // 校验通过则批量新增责任区数据 - return R.status(hygieneZoneService.saveBatch(zoneList)); + hygienePlan = getPlanByName(hygienePlanDTO.getName()); + for (HygieneZoneEntity zone : zoneList) { + zone.setHygienePlanId(hygienePlan.getId()); + String[] scores = zone.getCheckItemScore().split(",|,"); + // 校验检查项总成绩是否为标准总成绩 + BaseUtil.getSumScore(scores, hygienePlanDTO.getStandardScore()); } - return R.status(Boolean.FALSE); + // 校验通过则批量新增责任区数据 + return R.status(hygieneZoneService.saveBatch(zoneList)); } /** @@ -153,28 +151,26 @@ public class HygienePlanServiceImpl extends ServiceImpl zoneList = hygienePlanDTO.getZoneList(); - // 若计划修改成功,修改关联责任区数据 - if (updatePlan) { - // 删除旧数据 - boolean removeZone = hygieneZoneService.removeReferenceZone(hygienePlanDTO.getId()); - if (removeZone) { - hygienePlan = getPlanByName(hygienePlanDTO.getName()); - // 增加新数据 - for (HygieneZoneEntity zone : zoneList) { - // 传计划id - if (hygienePlan != null) { - zone.setHygienePlanId(hygienePlan.getId()); - } - String[] scores = zone.getCheckItemScore().split(",|,"); - // 校验检查项总成绩是否为标准总成绩 - BaseUtil.getSumScore(scores, hygienePlanDTO.getStandardScore()); - } - // 校验通过则批量修改责任区数据 - return R.status(hygieneZoneService.saveBatch(zoneList)); - } + // 删除旧的责任区数据 + boolean removeZone = hygieneZoneService.removeReferenceZone(hygienePlanDTO.getId()); + if (!removeZone) { + throw new ServiceException("删除旧的责任区数据失败"); + } + // 新增新的责任区数据 + hygienePlan = getPlanByName(hygienePlanDTO.getName()); + for (HygieneZoneEntity zone : zoneList) { + zone.setHygienePlanId(hygienePlan.getId()); + String[] scores = zone.getCheckItemScore().split(",|,"); + // 校验检查项总成绩是否为标准总成绩 + BaseUtil.getSumScore(scores, hygienePlanDTO.getStandardScore()); } - return R.status(Boolean.FALSE); + // 校验通过则批量修改责任区数据 + return R.status(hygieneZoneService.saveBatch(zoneList)); } /** diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java index 24d3a9f..b38db24 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java @@ -84,9 +84,9 @@ public class HygieneRecordServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); - queryWrapper.lambda().eq(HygieneTemplateEntity::getTemplateName, templateName); - List list = this.list(queryWrapper); - if (CollectionUtil.isNotEmpty(list)) { + // 重名校验 + HygieneTemplateEntity hygieneTemplate = getHygieneTemplateByName(templateName); + if (hygieneTemplate != null) { throw new ServiceException("模板名不可重复"); } - HygieneTemplateEntity hygieneTemplate = new HygieneTemplateEntity(); - hygieneTemplate.setTemplateName(templateName); - boolean saveTemplate = this.save(hygieneTemplate); + // 新增模板 + HygieneTemplateEntity hygieneTemplateEntity = new HygieneTemplateEntity(); + hygieneTemplateEntity.setTemplateName(templateName); + boolean saveTemplate = this.save(hygieneTemplateEntity); if (!saveTemplate) { throw new ServiceException("卫生自查模板新增失败"); } - // 传模板id - HygieneTemplateEntity hygieneTemplateEntity = getHygieneTemplateByName(templateName); + // 新增模板详情 + hygieneTemplate = getHygieneTemplateByName(templateName); List detailList = hygieneTemplateDTO.getTemplateDetailList(); - detailList.forEach(detail -> { - detail.setTemplateId(hygieneTemplateEntity.getId()); + for (HygieneTemplateDetailEntity detail : detailList) { + detail.setTemplateId(hygieneTemplate.getId()); String[] scores = detail.getCheckItemScore().split(",|,"); // 校验检查项总成绩是否为标准总成绩 BaseUtil.getSumScore(scores, 100); - }); - return hygieneTemplateDetailService.saveBatch(hygieneTemplateDTO.getTemplateDetailList()); + } + return hygieneTemplateDetailService.saveBatch(detailList); } /** @@ -70,26 +69,33 @@ public class HygieneTemplateServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); queryWrapper.lambda().eq(HygieneTemplateEntity::getTemplateName, templateName); queryWrapper.lambda().ne(HygieneTemplateEntity::getId, templateId); - List list = this.list(queryWrapper); - if (CollectionUtil.isNotEmpty(list)) { + HygieneTemplateEntity hygieneTemplate = this.getOne(queryWrapper); + if (hygieneTemplate != null) { throw new ServiceException("模板名不可重复"); } - HygieneTemplateEntity hygieneTemplate = new HygieneTemplateEntity(); - hygieneTemplate.setId(templateId); - hygieneTemplate.setTemplateName(templateName); - boolean updateTemplate = this.updateById(hygieneTemplate); + // 更新模板 + HygieneTemplateEntity hygieneTemplateEntity = new HygieneTemplateEntity(); + hygieneTemplateEntity.setId(templateId); + hygieneTemplateEntity.setTemplateName(templateName); + boolean updateTemplate = this.updateById(hygieneTemplateEntity); if (!updateTemplate) { throw new ServiceException("卫生自查模板更新失败"); } + // 更新模板详情 + // 删除旧的模板详情数据 boolean removeDetail = hygieneTemplateDetailService.removeReferenceDetail(templateId); if (!removeDetail) { throw new ServiceException("卫生自查模板详情数据删除失败"); } + // 新增新的模板详情数据 + hygieneTemplate = getHygieneTemplateByName(templateName); List detailList = hygieneTemplateDTO.getTemplateDetailList(); for (HygieneTemplateDetailEntity detail : detailList) { + detail.setTemplateId(hygieneTemplate.getId()); String[] scores = detail.getCheckItemScore().split(",|,"); BaseUtil.getSumScore(scores, 100); } 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 9434144..26bf967 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 @@ -31,9 +31,9 @@ CREATE TABLE IF NOT EXISTS `hzims_hygiene_template_detail` ( `id` bigint(20) NOT NULL COMMENT '主键ID', `template_id` bigint(20) NOT NULL COMMENT '模板id', `zone` varchar(50) NOT NULL COMMENT '责任区', - `PRINCIPAL` VARCHAR(20) NOT NULL COMMENT '责任人', - `CHECK_ITEM` MEDIUMTEXT NOT NULL COMMENT '检查项', - `CHECK_ITEM_SCORE` VARCHAR(255) NOT NULL COMMENT '检查项分值', + `prinicipal` varchar(20) NOT NULL COMMENT '责任人', + `check_item` mediumtext NOT NULL COMMENT '检查项', + `check_item_score` varchar(255) 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 '创建时间', From b601dd36e166fa39553cc999a4405cee97bf92da Mon Sep 17 00:00:00 2001 From: liwen Date: Tue, 28 May 2024 16:07:29 +0800 Subject: [PATCH 45/50] =?UTF-8?q?update:=20=E5=8D=AB=E7=94=9F=E8=87=AA?= =?UTF-8?q?=E6=9F=A5=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../safeproduct/entity/HygieneTemplateEntity.java | 4 +++ .../safeproduct/controller/HygieneController.java | 4 +-- .../safeproduct/mapper/HygieneTemplateMapper.java | 10 +++++++ .../safeproduct/mapper/HygieneTemplateMapper.xml | 13 +++++++++ .../safeproduct/service/IHygieneRecordService.java | 8 ++++++ .../service/IHygieneTemplateService.java | 12 +++++++++ .../service/impl/HygienePlanServiceImpl.java | 29 +++++++++++++++++--- .../service/impl/HygieneRecordServiceImpl.java | 10 +++++++ .../service/impl/HygieneTemplateServiceImpl.java | 31 ++++++++++++++++++++++ 9 files changed, 115 insertions(+), 6 deletions(-) diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygieneTemplateEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygieneTemplateEntity.java index 9a82c8f..9875675 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygieneTemplateEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygieneTemplateEntity.java @@ -1,5 +1,6 @@ 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; @@ -18,4 +19,7 @@ public class HygieneTemplateEntity extends BaseEntity { @ApiModelProperty("模板名称") private String templateName; + + @TableField(exist = false) + private String createDeptName; } 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 fe2739c..8290da9 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 @@ -2,7 +2,6 @@ package com.hnac.hzims.safeproduct.controller; import com.baomidou.mybatisplus.core.metadata.IPage; 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.HygienePlanDTO; import com.hnac.hzims.safeproduct.dto.HygieneRecordDTO; @@ -228,8 +227,7 @@ public class HygieneController extends BladeController { @ApiOperationSupport(order = 19) @Operate(label = "卫生自查模板分页", type = BusinessType.QUERY, ignore = false) public R> hygieneTemplatePage(@ApiIgnore @RequestParam Map param, Query query) { - IPage page = hygieneTemplateService.page(Condition.getPage(query), Condition.getQueryWrapper( - param, HygieneTemplateEntity.class)); + IPage page = hygieneTemplateService.getHygieneTemplatePage(param, query); return R.data(page); } } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneTemplateMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneTemplateMapper.java index 1a76e7c..d5bcf94 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneTemplateMapper.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneTemplateMapper.java @@ -1,9 +1,12 @@ 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.HygieneTemplateEntity; import org.apache.ibatis.annotations.Mapper; +import java.util.Map; + /** * 卫生自查模板Mapper类 * @@ -12,4 +15,11 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface HygieneTemplateMapper extends BaseMapper { + /** + * 卫生自查页面 + * @param param 参数 + * @param page 分页类 + * @return 页面 + */ + IPage getHygieneTemplatePage(IPage page, Map param); } 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 28b08b9..cdb1378 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 @@ -1,4 +1,17 @@ + \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneRecordService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneRecordService.java index 86d8637..7d050d0 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneRecordService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneRecordService.java @@ -10,6 +10,7 @@ import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; import javax.servlet.http.HttpServletResponse; +import java.util.List; import java.util.Map; /** @@ -62,4 +63,11 @@ public interface IHygieneRecordService extends IService { * @param response 响应类 */ void exportHygieneRecordData(Long id, HttpServletResponse response); + + /** + * 查询关联卫生自查记录 + * @param planId 计划id + * @return 记录列表 + */ + List getReferenceRecord(Long planId); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneTemplateService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneTemplateService.java index 5f45e16..bd908d6 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneTemplateService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneTemplateService.java @@ -1,9 +1,13 @@ 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.HygieneTemplateDTO; import com.hnac.hzims.safeproduct.entity.HygieneTemplateEntity; import com.hnac.hzims.safeproduct.vo.HygieneTemplateDetailVO; +import org.springblade.core.mp.support.Query; + +import java.util.Map; /** * 卫生自查模板服务类 @@ -46,4 +50,12 @@ public interface IHygieneTemplateService extends IService * @return 模板实体类 */ HygieneTemplateEntity getHygieneTemplateByName(String name); + + /** + * 卫生自查页面 + * @param param 参数 + * @param query 分页类 + * @return 页面 + */ + IPage getHygieneTemplatePage(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 4ad0ca5..d0d3b88 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 @@ -7,11 +7,13 @@ import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; 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.dto.HygienePlanDTO; import com.hnac.hzims.safeproduct.entity.HygienePlanEntity; +import com.hnac.hzims.safeproduct.entity.HygieneRecordEntity; import com.hnac.hzims.safeproduct.entity.HygieneZoneEntity; import com.hnac.hzims.safeproduct.enums.HygieneStatusEnum; import com.hnac.hzims.safeproduct.mapper.HygienePlanMapper; @@ -39,6 +41,7 @@ import java.net.URLEncoder; import java.util.List; import java.util.Map; import java.util.Optional; +import java.util.stream.Collectors; /** * 卫生自查计划服务实现类 @@ -139,9 +142,10 @@ public class HygienePlanServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); - queryWrapper.lambda().ne(HygienePlanEntity::getId, hygienePlanDTO.getId()); + queryWrapper.lambda().ne(HygienePlanEntity::getId, planId); queryWrapper.lambda().eq(HygienePlanEntity::getName, hygienePlanDTO.getName()); HygienePlanEntity hygienePlan = this.getOne(queryWrapper); if (hygienePlan != null) { @@ -157,7 +161,7 @@ public class HygienePlanServiceImpl extends ServiceImpl zoneList = hygienePlanDTO.getZoneList(); // 删除旧的责任区数据 - boolean removeZone = hygieneZoneService.removeReferenceZone(hygienePlanDTO.getId()); + boolean removeZone = hygieneZoneService.removeReferenceZone(planId); if (!removeZone) { throw new ServiceException("删除旧的责任区数据失败"); } @@ -170,7 +174,26 @@ public class HygienePlanServiceImpl extends ServiceImpl recordList = hygieneRecordService.getReferenceRecord(planId); + if (CollectionUtils.isNotEmpty(recordList)) { + List zones = hygieneZoneService.getReferenceZone(planId); + List ids = zones.stream().map(HygieneZoneEntity::getId).collect(Collectors.toList()); + StringBuilder zoneIds = new StringBuilder(); + for (int i = 0; i < ids.size(); i++) { + zoneIds.append(ids.get(i)); + if (i != ids.size() - 1) { + zoneIds.append(","); + } + } + recordList.forEach(record -> record.setHygieneZoneIds(zoneIds.toString())); + return R.status(hygieneRecordService.updateBatchById(recordList)); + } + return R.status(Boolean.TRUE); } /** diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java index b38db24..5392c0a 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java @@ -200,6 +200,16 @@ public class HygieneRecordServiceImpl extends ServiceImpl getReferenceRecord(Long planId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(HygieneRecordEntity::getHygienePlanId, planId); + return this.list(queryWrapper); + } + + /** * 查询是否存在同月编号 * @param currentMonth 当月 * @return 存在则返回上一编号,否则返回null diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneTemplateServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneTemplateServiceImpl.java index af8ff3a..f2f99b5 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneTemplateServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneTemplateServiceImpl.java @@ -1,6 +1,8 @@ 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.HygieneTemplateDTO; import com.hnac.hzims.safeproduct.entity.HygieneTemplateDetailEntity; @@ -11,12 +13,17 @@ import com.hnac.hzims.safeproduct.service.IHygieneTemplateService; import com.hnac.hzims.safeproduct.utils.BaseUtil; import com.hnac.hzims.safeproduct.vo.HygieneTemplateDetailVO; 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.BeanUtils; 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; import java.util.stream.Collectors; /** @@ -30,6 +37,12 @@ public class HygieneTemplateServiceImpl extends ServiceImpl getHygieneTemplatePage(Map param, Query query) { + IPage page = new Page<>(query.getCurrent(), query.getSize()); + IPage templatePage = hygieneTemplateMapper.getHygieneTemplatePage(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; + } } From 3b2fe257ec5e2b1e55f8c9d68830bf17a074eb4a Mon Sep 17 00:00:00 2001 From: liwen Date: Tue, 28 May 2024 19:44:42 +0800 Subject: [PATCH 46/50] =?UTF-8?q?update:=20=E5=8D=AB=E7=94=9F=E8=87=AA?= =?UTF-8?q?=E6=9F=A5=E6=A8=A1=E6=9D=BF=E8=AF=A6=E6=83=85=E8=A1=A8=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hzims-service/safeproduct/src/main/resources/db/2.0.1.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 26bf967..516bede 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 @@ -31,7 +31,7 @@ CREATE TABLE IF NOT EXISTS `hzims_hygiene_template_detail` ( `id` bigint(20) NOT NULL COMMENT '主键ID', `template_id` bigint(20) NOT NULL COMMENT '模板id', `zone` varchar(50) NOT NULL COMMENT '责任区', - `prinicipal` varchar(20) NOT NULL COMMENT '责任人', + `principal` varchar(20) NOT NULL COMMENT '责任人', `check_item` mediumtext NOT NULL COMMENT '检查项', `check_item_score` varchar(255) NOT NULL COMMENT '检查项分值', `create_user` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建人', From da0c28467a90e036caacefe1c0f7ab909e10324f Mon Sep 17 00:00:00 2001 From: liwen Date: Tue, 28 May 2024 19:45:08 +0800 Subject: [PATCH 47/50] =?UTF-8?q?update:=20=E8=80=83=E8=AF=95=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E5=8F=8A=E6=A0=BC=E5=88=86=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hnac/hzims/safeproduct/entity/TestEntity.java | 10 +++++----- .../hzims/safeproduct/service/impl/TestScoreServiceImpl.java | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java index 0235e18..27ae3d7 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java @@ -60,11 +60,11 @@ public class TestEntity extends BaseEntity { @ApiModelProperty("考试结束时间") private Date testEndTime; -// @NotNull -// @Min(value = 0, message = "及格分必须大于等于0") -// @Max(value = 100, message = "及格分必须小于等于100") -// @ApiModelProperty("及格分") -// private Integer passingScore; + @NotNull + @Min(value = 0, message = "及格分必须大于等于0") + @Max(value = 100, message = "及格分必须小于等于100") + @ApiModelProperty("及格分") + private Integer passingScore; @NotNull @Size(max = 255, message = "考试地点字段长度不能超过255") diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java index a075bb2..ca24f67 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java @@ -126,7 +126,7 @@ public class TestScoreServiceImpl extends ServiceImpl s.getScore() != null).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(list)) { testScoreSumVO.setActualPeopleNum(list.size()); - List passCollect = list.stream().filter(s -> s.getScore() > 60).collect(Collectors.toList()); + List passCollect = list.stream().filter(s -> s.getScore() > testEntity.getPassingScore()).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(list)&&CollectionUtils.isNotEmpty(passCollect)) { double result = BigDecimal.valueOf(passCollect.size()).divide(BigDecimal.valueOf(list.size()),2, RoundingMode.UP).doubleValue(); testScoreSumVO.setPercentage(result); From af8b1c438979d4ff355c4b1c8bfd4a17ed7ad4d2 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Wed, 29 May 2024 14:28:49 +0800 Subject: [PATCH 48/50] =?UTF-8?q?#=E6=B0=B4=E7=94=B5=E7=AB=99=E6=9C=88?= =?UTF-8?q?=E6=8A=A5=E5=8F=91=E7=94=B5=E9=87=8F=E5=B0=8F=E6=95=B0=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../report/service/impl/RunMonthServiceImpl.java | 53 +++++++++++++++++----- 1 file changed, 41 insertions(+), 12 deletions(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java index fe5149c..60c6d4d 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java @@ -110,19 +110,30 @@ public class RunMonthServiceImpl extends BaseServiceImpl run = JSONObject.parseObject(entity.getRunData(),new TypeReference>(){}); - if(CollectionUtil.isEmpty(run)){ + List runs = JSONObject.parseObject(entity.getRunData(),new TypeReference>(){}); + if(CollectionUtil.isEmpty(runs)){ return data; } - double monSumGenerate = run.stream().mapToDouble(RunDataVo::getGenerate).sum(); - double monSumPlan = run.stream().mapToDouble(RunDataVo::getPlan).sum(); + // 保留两位小数 + data.setRunData(JSONObject.toJSONString(runs.stream().map(run->{ + // 月发电量 + run.setGenerate(BigDecimal.valueOf(run.getGenerate()).setScale(2, RoundingMode.HALF_UP).doubleValue()); + // 年发电量 + run.setGenerateYear(BigDecimal.valueOf(run.getGenerateYear()).setScale(2, RoundingMode.HALF_UP).doubleValue()); + return run; + }).collect(Collectors.toList()))); + + // 月发电量完成率 + double monSumGenerate = runs.stream().mapToDouble(RunDataVo::getGenerate).sum(); + double monSumPlan = runs.stream().mapToDouble(RunDataVo::getPlan).sum(); data.setMonSumGenerate(monSumGenerate); data.setMonSumPlan(monSumPlan); if(Math.abs(monSumGenerate) > 0 && Math.abs(monSumPlan) > 0){ data.setMonRate(BigDecimal.valueOf(monSumGenerate / monSumPlan * 100L).setScale(2, RoundingMode.HALF_UP).doubleValue()); } - double yearSumGenerate = run.stream().mapToDouble(RunDataVo::getGenerateYear).sum(); - double yearSumPlan = run.stream().mapToDouble(RunDataVo::getPlanYear).sum(); + // 年发电量完成率 + double yearSumGenerate = runs.stream().mapToDouble(RunDataVo::getGenerateYear).sum(); + double yearSumPlan = runs.stream().mapToDouble(RunDataVo::getPlanYear).sum(); data.setYearSumGenerate(yearSumGenerate); data.setYearSumPlan(yearSumPlan); if(Math.abs(yearSumGenerate) > 0 && Math.abs(yearSumPlan) > 0){ @@ -131,7 +142,6 @@ public class RunMonthServiceImpl extends BaseServiceImpl runs = JSONObject.parseObject(data.getRunData(),new TypeReference>(){}); + if(CollectionUtil.isNotEmpty(runs)){ + // 保留两位小数 + data.setRunData(JSONObject.toJSONString(runs.stream().map(run->{ + // 月发电量 + run.setGenerate(BigDecimal.valueOf(run.getGenerate()).setScale(2, RoundingMode.HALF_UP).doubleValue()); + // 年发电量 + run.setGenerateYear(BigDecimal.valueOf(run.getGenerateYear()).setScale(2, RoundingMode.HALF_UP).doubleValue()); + return run; + }).collect(Collectors.toList()))); + } // 创建Excel文件 // 表头、sheet页、文件名 String headerName = data.getStationName() + "运行月报(" + mon + ")"; @@ -211,7 +232,15 @@ public class RunMonthServiceImpl extends BaseServiceImpl runDatas = new ArrayList<>(); + List curveEcharts = new ArrayList<>(); + for (RideDeviceVo device : devices){ + // 运行数据 + runDatas.add(this.runData(station.getCode(),device,plans,start,end)); + // 月度运行曲线 + curveEcharts.add(this.curveData(device,start,end)); + } + /*CountDownLatch countDownLatch = new CountDownLatch(devices.size()); List runDatas = new CopyOnWriteArrayList<>(); List curveEcharts = new CopyOnWriteArrayList<>(); for (RideDeviceVo device : devices){ @@ -220,8 +249,8 @@ public class RunMonthServiceImpl extends BaseServiceImpl Date: Wed, 29 May 2024 16:16:58 +0800 Subject: [PATCH 49/50] =?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 --- .../com/hnac/hzims/alarm/show/mapper/AlarmHandleMapper.xml | 2 +- .../java/com/hnac/hzims/alarm/show/wrapper/HandleWrapper.java | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) 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 110909c..029edcc 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 @@ -4,7 +4,7 @@ - select * from hzims_user_feedback where IS_DELETED = 0 - - AND CONTENT like concat('%',#{req.content},'%') - - - AND STATUS = #{req.status} - - - AND CREATE_TIME = ]]> #{req.startTime} - - - AND CREATE_TIME #{req.endTime} - - - AND CREATE_USER = #{req.createUser} - - order by CREATE_TIME desc - - - diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IUserFeedbackService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IUserFeedbackService.java deleted file mode 100644 index b2f0d7f..0000000 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IUserFeedbackService.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.hnac.hzims.operational.main.service; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.hnac.hzims.operational.main.dto.UserFeedbackDTO; -import com.hnac.hzims.operational.main.entity.UserFeedbackEntity; -import org.springblade.core.mp.base.BaseService; - -/** - * Created by Sam Huang 2022/5/24 11:18 - */ -public interface IUserFeedbackService extends BaseService { - - IPage pageNotDataScope(IPage page, UserFeedbackDTO req); - -} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/UserFeedbackServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/UserFeedbackServiceImpl.java deleted file mode 100644 index 4eb8507..0000000 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/UserFeedbackServiceImpl.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.hnac.hzims.operational.main.service.impl; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.hnac.hzims.operational.main.dto.UserFeedbackDTO; -import com.hnac.hzims.operational.main.entity.UserFeedbackEntity; -import com.hnac.hzims.operational.main.mapper.UserFeedbackMapper; -import com.hnac.hzims.operational.main.service.IUserFeedbackService; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.mp.base.BaseServiceImpl; -import org.springframework.stereotype.Service; - -/** - * Created by Sam Huang 2022/5/24 11:19 - */ -@Service -@Slf4j -@AllArgsConstructor -public class UserFeedbackServiceImpl extends BaseServiceImpl implements IUserFeedbackService { - - - private final UserFeedbackMapper userFeedbackMapper; - - @Override - public IPage pageNotDataScope(IPage page, UserFeedbackDTO req) { - return userFeedbackMapper.pageNotDataScope(page, req); - } -} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/vo/UserFeedbackVo.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/vo/UserFeedbackVo.java index c594b34..2d8a986 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/vo/UserFeedbackVo.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/vo/UserFeedbackVo.java @@ -1,6 +1,6 @@ package com.hnac.hzims.operational.main.vo; -import com.hnac.hzims.operational.main.entity.UserFeedbackEntity; +import com.hnac.hzims.operational.feedback.entity.UserFeedbackEntity; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/wrapper/UserFeedbackWrapper.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/wrapper/UserFeedbackWrapper.java index 8282ab0..1588f88 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/wrapper/UserFeedbackWrapper.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/wrapper/UserFeedbackWrapper.java @@ -1,6 +1,6 @@ package com.hnac.hzims.operational.main.wrapper; -import com.hnac.hzims.operational.main.entity.UserFeedbackEntity; +import com.hnac.hzims.operational.feedback.entity.UserFeedbackEntity; import com.hnac.hzims.operational.main.vo.UserFeedbackVo; import org.springblade.core.mp.support.BaseEntityWrapper; import org.springblade.core.tool.utils.BeanUtil;