From b89c1f4b5a90bb1d8ec1ea0e7c0400a34932a845 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Tue, 6 Jun 2023 17:20:35 +0800 Subject: [PATCH] =?UTF-8?q?#=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1=E6=8A=BD?= =?UTF-8?q?=E7=A6=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/operational/config/vo/StationRealVo.java | 12 + .../main/constant/HomePageConstant.java | 2 +- .../hzims/operational/main/vo/RealAttributeVo.java | 46 + .../hzims/operational/main/vo/RealDeviceVo.java | 26 + .../hzims/operational/main/vo/RealStationVo.java | 48 + .../hnac/hzims/operational/main/vo/WeatherVo.java | 24 + hzims-service/hzims-scheduled/pom.xml | 65 +- .../hnac/hzims/scheduled/config/XxlJobConfig.java | 59 - .../mapper/equipment/WorkshopInfoMapper.java | 10 + .../mapper/operation/AbnormalAlarmMapper.java | 12 +- .../scheduled/mapper/operation/GenerateMapper.java | 17 + .../operation/HistoryAbnormalAlarmMapper.java | 21 - .../operation/HzimsAnalyzeModelStationMapper.java | 13 - .../mapper/operation/ModelStationMapper.java | 12 + .../scheduled/mapper/operation/PowerMapper.java | 11 + .../scheduled/mapper/operation/RecordMapper.java | 17 + .../mapper/operation/StAlarmRecordMapper.java | 14 - .../mapper/operation/StFocusPropertiesMapper.java | 13 - .../mapper/operation/StationAttrConfigMapper.java | 6 +- .../mapper/operation/StationAttributeMapper.java | 11 +- .../scheduled/mapper/operation/StationMapper.java | 13 +- .../scheduled/mapper/operation/UseMapper.java | 13 + .../scheduled/scheduled/MonitorScheduledTask.java | 65 + .../scheduled/RealTargetScheduledTask.java | 126 ++ .../scheduled/scheduled/ReportScheduledTask.java | 14 + .../scheduled/scheduled/ScheduledCreateTask.java | 54 - .../scheduled/scheduled/ShowScheduledTask.java | 14 + .../scheduled/scheduled/StAlamRecordTask.java | 101 -- .../scheduled/service/AbnormalAlarmService.java | 19 - .../service/HistoryAbnormalAlarmService.java | 16 - .../service/IHzimsAnalyzeModelStationService.java | 17 - .../service/IMainSystemMonitoringService.java | 16 - .../scheduled/service/IRealMonitorService.java | 13 - .../service/IStationAttrConfigService.java | 16 - .../service/IStationAttributeService.java | 13 - .../hzims/scheduled/service/IStationService.java | 27 - .../hzims/scheduled/service/IWaterService.java | 11 - .../scheduled/service/StAlamRecordService.java | 14 - .../service/StFocusPropertiesService.java | 14 - .../service/equipment/WorkshopInfoService.java | 12 + .../equipment/impl/WorkshopInfoServiceImpl.java | 20 + .../service/impl/AbnormalAlarmServiceImpl.java | 242 ---- .../impl/HistoryAbnormalAlarmServiceImpl.java | 41 - .../impl/HzimsAnalyzeModelStationServiceImpl.java | 17 - .../impl/MainSystemMonitoringServiceImpl.java | 51 - .../service/impl/RealMonitorServiceImpl.java | 713 --------- .../service/impl/StAlamRecordServiceImpl.java | 42 - .../service/impl/StFocusPropertiesServiceImpl.java | 164 --- .../service/impl/StationAttrConfigServiceImpl.java | 42 - .../service/impl/StationAttributeServiceImpl.java | 22 - .../scheduled/service/impl/StationServiceImpl.java | 60 - .../scheduled/service/impl/WaterServiceImpl.java | 201 --- .../service/operation/AbnormalAlarmService.java | 15 + .../service/operation/AnalyseDataService.java | 22 + .../service/operation/GenerateService.java | 25 + .../service/operation/ModelStationService.java | 12 + .../service/operation/MonitorService.java | 16 + .../scheduled/service/operation/PowerService.java | 17 + .../service/operation/RealTargetService.java | 34 + .../scheduled/service/operation/RecordService.java | 13 + .../operation/StationAttrConfigService.java | 14 + .../service/operation/StationAttributeService.java | 14 + .../service/operation/StationService.java | 12 + .../scheduled/service/operation/UseService.java | 29 + .../operation/impl/AbnormalAlarmServiceImpl.java | 33 + .../operation/impl/AnalyseDataServiceImpl.java | 139 ++ .../operation/impl/GenerateServiceImpl.java | 112 ++ .../operation/impl/ModelStationServiceImpl.java | 16 + .../service/operation/impl/MonitorServiceImpl.java | 744 ++++++++++ .../service/operation/impl/PowerServiceImpl.java | 77 + .../operation/impl/RealTargetServiceImpl.java | 1512 ++++++++++++++++++++ .../service/operation/impl/RecordServiceImpl.java | 36 + .../impl/StationAttrConfigServiceImpl.java | 34 + .../impl/StationAttributeServiceImpl.java | 36 + .../service/operation/impl/StationServiceImpl.java | 19 + .../service/operation/impl/UseServiceImpl.java | 99 ++ .../hnac/hzims/scheduled/vo/RealAttributeVo.java | 52 - .../com/hnac/hzims/scheduled/vo/RealDeviceVo.java | 33 - .../com/hnac/hzims/scheduled/vo/RealStationVo.java | 54 - .../com/hnac/hzims/scheduled/vo/StationRealVo.java | 17 - .../com/hnac/hzims/scheduled/vo/WeatherVo.java | 30 - .../src/main/resources/application.yml | 208 --- .../mapper/equipment/WorkshopInfoMapper.xml | 5 + .../mapper/operation/AbnormalAlarmMapper.xml | 12 +- .../resources/mapper/operation/GenerateMapper.xml | 5 + .../mapper/operation/ModelStationMapper.xml | 21 + .../resources/mapper/operation/PowerMapper.xml | 32 + .../resources/mapper/operation/RecordMapper.xml | 29 + .../mapper/operation/StAlarmRecordMapper.xml | 19 - .../mapper/operation/StationAttrConfigMapper.xml | 5 + .../mapper/operation/StationAttributeMapper.xml | 15 + .../resources/mapper/operation/StationMapper.xml | 6 + .../main/resources/mapper/operation/UseMapper.xml | 4 + .../controller/CentralMonitorController.java | 2 +- .../config/service/CentralMonitorService.java | 2 +- .../service/impl/CentralMonitorServiceImpl.java | 2 +- .../service/impl/StAlamRecordServiceImpl.java | 22 +- .../hzims/operational/config/vo/StationRealVo.java | 12 - .../main/service/impl/HydropowerServiceImpl.java | 1 + .../service/impl/RealMonitorServiceImpl.java | 8 +- .../operational/station/vo/RealAttributeVo.java | 46 - .../hzims/operational/station/vo/RealDeviceVo.java | 26 - .../operational/station/vo/RealStationVo.java | 48 - .../hzims/operational/station/vo/WeatherVo.java | 24 - 104 files changed, 3735 insertions(+), 2727 deletions(-) create mode 100644 hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/config/vo/StationRealVo.java create mode 100644 hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/RealAttributeVo.java create mode 100644 hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/RealDeviceVo.java create mode 100644 hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/RealStationVo.java create mode 100644 hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WeatherVo.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/config/XxlJobConfig.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/equipment/WorkshopInfoMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/GenerateMapper.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/HistoryAbnormalAlarmMapper.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/HzimsAnalyzeModelStationMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/ModelStationMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/PowerMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/RecordMapper.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StAlarmRecordMapper.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StFocusPropertiesMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/UseMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ReportScheduledTask.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ScheduledCreateTask.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ShowScheduledTask.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/StAlamRecordTask.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/AbnormalAlarmService.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/HistoryAbnormalAlarmService.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IHzimsAnalyzeModelStationService.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IMainSystemMonitoringService.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IRealMonitorService.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IStationAttrConfigService.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IStationAttributeService.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IStationService.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IWaterService.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/StAlamRecordService.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/StFocusPropertiesService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/WorkshopInfoService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/WorkshopInfoServiceImpl.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/AbnormalAlarmServiceImpl.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/HistoryAbnormalAlarmServiceImpl.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/HzimsAnalyzeModelStationServiceImpl.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/MainSystemMonitoringServiceImpl.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/RealMonitorServiceImpl.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StAlamRecordServiceImpl.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StFocusPropertiesServiceImpl.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StationAttrConfigServiceImpl.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StationAttributeServiceImpl.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StationServiceImpl.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/WaterServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/AbnormalAlarmService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/AnalyseDataService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/GenerateService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/ModelStationService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/MonitorService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/PowerService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/RealTargetService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/RecordService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/StationAttrConfigService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/StationAttributeService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/StationService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/UseService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/AbnormalAlarmServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/AnalyseDataServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/GenerateServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/ModelStationServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/MonitorServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/PowerServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/RealTargetServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/RecordServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/StationAttrConfigServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/StationAttributeServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/StationServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/UseServiceImpl.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/RealAttributeVo.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/RealDeviceVo.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/RealStationVo.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/StationRealVo.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/WeatherVo.java delete mode 100644 hzims-service/hzims-scheduled/src/main/resources/application.yml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/WorkshopInfoMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/operation/GenerateMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/operation/ModelStationMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/operation/PowerMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/operation/RecordMapper.xml delete mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/operation/StAlarmRecordMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/operation/StationAttrConfigMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/operation/StationAttributeMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/operation/StationMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/operation/UseMapper.xml delete mode 100644 hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/vo/StationRealVo.java delete mode 100644 hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/vo/RealAttributeVo.java delete mode 100644 hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/vo/RealDeviceVo.java delete mode 100644 hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/vo/RealStationVo.java delete mode 100644 hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/vo/WeatherVo.java diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/config/vo/StationRealVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/config/vo/StationRealVo.java new file mode 100644 index 0000000..e61f1d2 --- /dev/null +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/config/vo/StationRealVo.java @@ -0,0 +1,12 @@ +package com.hnac.hzims.operational.config.vo; + +import lombok.Data; + +@Data +public class StationRealVo { + + private String station; + + private String[] realId; + +} 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 30f464f..2879db1 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 @@ -146,7 +146,7 @@ public interface HomePageConstant { // 水利-泵组实时属性名称 String JOINT_RELAY = "joint_relay"; // 开机状态 String SWITCH_ON_OFF = "switch_on_off"; // 开机状态 - String OFF = "1"; // 开机 + String OFF = "1.0"; // 开机 String ON = "0"; // 关机 String ELECTRICITY_CONSUMPTION = "electricity_consumption"; // 用电量 diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/RealAttributeVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/RealAttributeVo.java new file mode 100644 index 0000000..52a73ff --- /dev/null +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/RealAttributeVo.java @@ -0,0 +1,46 @@ +package com.hnac.hzims.operational.main.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class RealAttributeVo implements Serializable { + + @ApiModelProperty("属性名称") + private String name; + + @ApiModelProperty("属性数值") + private String value; + + @ApiModelProperty("属性单位") + private String unit; + + @ApiModelProperty("属性类型:1-遥信 2-遥测") + private Integer type; + + @ApiModelProperty("属性实时数据Id") + private String realId; + + @ApiModelProperty("告警Id") + private Long id; + + @ApiModelProperty("属性状态:0:正常、1:预警、2:告警、3:空值、4:黄色、5:橙色") + private int status; + + @ApiModelProperty("属性质量") + private int quality; + + @ApiModelProperty("属性时间") + private String time; + + @ApiModelProperty("属性故障ID") + private String fdpFaultId; + + @ApiModelProperty("监测点") + private String fdpMonitorId; + + @ApiModelProperty("属性故障值") + private Double fdpRate; +} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/RealDeviceVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/RealDeviceVo.java new file mode 100644 index 0000000..0522108 --- /dev/null +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/RealDeviceVo.java @@ -0,0 +1,26 @@ +package com.hnac.hzims.operational.main.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class RealDeviceVo implements Serializable { + + @ApiModelProperty("设备编号") + private String deviceCode; + + @ApiModelProperty("设备名称") + private String deviceName; + + @ApiModelProperty("设备状态") + private Integer state; + + @ApiModelProperty("排序字段") + private Integer sort; + + @ApiModelProperty("设备属性集合") + private List attbtList; +} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/RealStationVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/RealStationVo.java new file mode 100644 index 0000000..515d623 --- /dev/null +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/RealStationVo.java @@ -0,0 +1,48 @@ +package com.hnac.hzims.operational.main.vo; + +import io.swagger.annotations.ApiModelProperty; +import io.swagger.models.auth.In; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class RealStationVo implements Serializable { + + @ApiModelProperty("站点Id") + private String stationCode; + + @ApiModelProperty("站点名称") + private String stationName; + + @ApiModelProperty("站点机构Id") + private Long stationDeptId; + + @ApiModelProperty("站点类型") + private String serverType; + + @ApiModelProperty("当前天气") + private WeatherVo nowWater; + + @ApiModelProperty("总有功率") + private Double powerSum; + + @ApiModelProperty("降水") + private String precipitation; + + @ApiModelProperty("最大前池水位") + private Double waterLevelMax; + + @ApiModelProperty("前池水位") + private Double waterLevel; + + @ApiModelProperty("设备集合") + private List deviceList; + + @ApiModelProperty("站点状态 : 0-正常 1-数据中断") + private Integer status; + + @ApiModelProperty("排序") + private Integer sort; +} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WeatherVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WeatherVo.java new file mode 100644 index 0000000..284e995 --- /dev/null +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WeatherVo.java @@ -0,0 +1,24 @@ +package com.hnac.hzims.operational.main.vo; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class WeatherVo implements Serializable { + + /**当前天气状况和图标的代码,图标可通过天气状况和图标下载; //100**/ + private String icon; + + /**实况温度,默认单位:摄氏度; //21**/ + private String temp; + + /**实况天气状况的文字描述,包括阴晴雨雪等天气状态的描述; //晴**/ + private String text; + + /**预报当天最高温度; //4**/ + private String tempMax; + + /**预报当天最低温度; //-5**/ + private String tempMin; +} diff --git a/hzims-service/hzims-scheduled/pom.xml b/hzims-service/hzims-scheduled/pom.xml index 4183ad7..87e3691 100644 --- a/hzims-service/hzims-scheduled/pom.xml +++ b/hzims-service/hzims-scheduled/pom.xml @@ -2,15 +2,15 @@ - 4.0.0 com.hnac.hzims hzims-service 4.0.0-SNAPSHOT + 4.0.0 hzims-scheduled - + jar 8 8 @@ -81,42 +81,6 @@ com.xuxueli xxl-job-core - - - - org.apache.poi - ooxml-schemas - 1.4 - - - org.jfree - jcommon - 1.0.24 - - - org.jfree - jfreechart - 1.5.0 - - - com.hikvision.ga - artemis-http-client - - - - - org.apache.httpcomponents - httpclient - - - - - - org.freemarker - freemarker - - - com.hnac.hzims equipment-api @@ -146,47 +110,22 @@ com.google.zxing javase - org.springblade blade-user-api - - org.apache.commons commons-collections4 - - - org.springframework.boot - spring-boot-starter-websocket - - - org.springframework.boot - spring-boot-starter-tomcat - - - - - cn.hutool hutool-http - - cn.hutool hutool-core - - - - org.java-websocket - Java-WebSocket - - org.springblade blade-resource-api diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/config/XxlJobConfig.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/config/XxlJobConfig.java deleted file mode 100644 index 6b473a9..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/config/XxlJobConfig.java +++ /dev/null @@ -1,59 +0,0 @@ -// package com.hnac.hzims.scheduled.config; -// -// import com.xxl.job.core.executor.impl.XxlJobSpringExecutor; -// import lombok.extern.slf4j.Slf4j; -// import org.springframework.beans.factory.annotation.Value; -// import org.springframework.context.annotation.Bean; -// import org.springframework.context.annotation.ComponentScan; -// import org.springframework.context.annotation.Configuration; -// -// /** -// * @Author WL -// * @Version v1.0 -// * @Serial 1.0 -// * @Date 2022/1/8 10:23 -// */ -// @Slf4j -// @Configuration -// //指定任务Handler所在包路径 -// public class XxlJobConfig { -// -// -// @Value("${xxl.job.admin.addresses}") -// private String adminAddresses; -// -// @Value("${xxl.job.executor.appname}") -// private String appName; -// -// @Value("${xxl.job.executor.ip}") -// private String ip; -// -// @Value("${xxl.job.executor.port}") -// private int port; -// -// @Value("${xxl.job.accessToken}") -// private String accessToken; -// -// @Value("${xxl.job.executor.logpath}") -// private String logPath; -// -// @Value("${xxl.job.executor.logretentiondays}") -// private int logRetentionDays; -// -// -// @Bean(initMethod = "start", destroyMethod = "destroy") -// public XxlJobSpringExecutor xxlJobExecutor() { -// log.info("====xxl-job config init===="); -// XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor(); -// xxlJobSpringExecutor.setAdminAddresses(adminAddresses); -// xxlJobSpringExecutor.setAppName(appName); -// xxlJobSpringExecutor.setIp(ip); -// xxlJobSpringExecutor.setPort(port); -// xxlJobSpringExecutor.setAccessToken(accessToken); -// xxlJobSpringExecutor.setLogPath(logPath); -// xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays); -// return xxlJobSpringExecutor; -// } -// -// } -// diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/equipment/WorkshopInfoMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/equipment/WorkshopInfoMapper.java new file mode 100644 index 0000000..3e0d5c4 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/equipment/WorkshopInfoMapper.java @@ -0,0 +1,10 @@ +package com.hnac.hzims.scheduled.mapper.equipment; + +import com.hnac.hzims.equipment.entity.WorkshopInfoEntity; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +/** + * @author ysj + */ +public interface WorkshopInfoMapper extends UserDataScopeBaseMapper { +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/AbnormalAlarmMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/AbnormalAlarmMapper.java index b677a4e..12876bd 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/AbnormalAlarmMapper.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/AbnormalAlarmMapper.java @@ -1,20 +1,14 @@ package com.hnac.hzims.scheduled.mapper.operation; import com.hnac.hzims.operational.alert.entity.AbnormalAlarmEntity; -import org.apache.ibatis.annotations.Param; import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; import java.util.List; /** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/19 10:30 + * @author ysj */ -public interface AbnormalAlarmMapper extends UserDataScopeBaseMapper{ +public interface AbnormalAlarmMapper extends UserDataScopeBaseMapper { - AbnormalAlarmEntity getAbnormalAlarm(@Param("stationId") String stationId, @Param("type") String type); - - List getAbnormalAlarmList(); + List abnormalAlarms(); } diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/GenerateMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/GenerateMapper.java new file mode 100644 index 0000000..7f2eaa1 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/GenerateMapper.java @@ -0,0 +1,17 @@ +package com.hnac.hzims.scheduled.mapper.operation; + +import com.hnac.hzims.operational.fill.entity.GenerateEntity; +import org.apache.ibatis.annotations.Param; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +import java.util.List; + +/** + * @author ysj + * @date 2023/04/10 11:22:14 + * @version 4.0.0 + */ +public interface GenerateMapper extends UserDataScopeBaseMapper { + + List records(@Param("date") String date,@Param("station") String station); +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/HistoryAbnormalAlarmMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/HistoryAbnormalAlarmMapper.java deleted file mode 100644 index e680c53..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/HistoryAbnormalAlarmMapper.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.hnac.hzims.scheduled.mapper.operation; - -import com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity; -import org.apache.ibatis.annotations.Param; -import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; - -import java.util.List; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/19 11:12 - */ -public interface HistoryAbnormalAlarmMapper extends UserDataScopeBaseMapper { - - List getHistoryAbnormalAlarm(@Param("stationId") String stationId, @Param("type") String type); - - - -} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/HzimsAnalyzeModelStationMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/HzimsAnalyzeModelStationMapper.java deleted file mode 100644 index 41ad4ad..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/HzimsAnalyzeModelStationMapper.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.hnac.hzims.scheduled.mapper.operation; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.hnac.hzims.operational.station.entity.HzimsAnalyzeModelStationEntity; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/22 11:43 - */ -public interface HzimsAnalyzeModelStationMapper extends BaseMapper { -} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/ModelStationMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/ModelStationMapper.java new file mode 100644 index 0000000..907e4ff --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/ModelStationMapper.java @@ -0,0 +1,12 @@ +package com.hnac.hzims.scheduled.mapper.operation; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzims.operational.station.entity.HzimsAnalyzeModelStationEntity; + + +/** + * @author ysj + */ +public interface ModelStationMapper extends BaseMapper { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/PowerMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/PowerMapper.java new file mode 100644 index 0000000..d463fd1 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/PowerMapper.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.scheduled.mapper.operation; + +import com.hnac.hzims.operational.fill.entity.PowerEntity; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +/** + * @author ysj + */ +public interface PowerMapper extends UserDataScopeBaseMapper { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/RecordMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/RecordMapper.java new file mode 100644 index 0000000..27d01a1 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/RecordMapper.java @@ -0,0 +1,17 @@ +package com.hnac.hzims.scheduled.mapper.operation; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.hnac.hzims.operational.config.entity.StAlarmRecordEntity; +import com.hnac.hzims.operational.config.vo.StAlarmRecordVo; + +import java.util.List; + +/** + * @author ysj + */ +public interface RecordMapper extends BaseMapper { + + Long insertReturnId(StAlarmRecordEntity record); +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StAlarmRecordMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StAlarmRecordMapper.java deleted file mode 100644 index 8b3e211..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StAlarmRecordMapper.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.hnac.hzims.scheduled.mapper.operation; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.hnac.hzims.operational.config.entity.StAlarmRecordEntity; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/19 15:47 - */ -public interface StAlarmRecordMapper extends BaseMapper { - Long insertReturnId(StAlarmRecordEntity record); -} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StFocusPropertiesMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StFocusPropertiesMapper.java deleted file mode 100644 index 68d7a3d..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StFocusPropertiesMapper.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.hnac.hzims.scheduled.mapper.operation; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.hnac.hzims.operational.config.entity.StFocusPropertiesEntity; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/19 11:28 - */ -public interface StFocusPropertiesMapper extends BaseMapper { -} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StationAttrConfigMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StationAttrConfigMapper.java index 76a7952..04a16ee 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StationAttrConfigMapper.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StationAttrConfigMapper.java @@ -4,10 +4,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hnac.hzims.operational.station.entity.StationAttrConfigEntity; /** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/19 16:09 + * @author ysj */ public interface StationAttrConfigMapper extends BaseMapper { + } diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StationAttributeMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StationAttributeMapper.java index 89cf2a3..9cfd0f9 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StationAttributeMapper.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StationAttributeMapper.java @@ -1,13 +1,16 @@ package com.hnac.hzims.scheduled.mapper.operation; import com.hnac.hzims.operational.station.entity.StationAttributeEntity; +import org.apache.ibatis.annotations.Mapper; import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; +import java.util.List; + /** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/19 11:39 + * @author hx */ +@Mapper public interface StationAttributeMapper extends UserDataScopeBaseMapper { + + List PointUnit(); } diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StationMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StationMapper.java index 3b81746..f1d3745 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StationMapper.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StationMapper.java @@ -1,21 +1,12 @@ package com.hnac.hzims.scheduled.mapper.operation; + import com.hnac.hzims.operational.station.entity.StationEntity; import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; -import java.util.List; - /** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/19 10:36 + * @author ysj */ public interface StationMapper extends UserDataScopeBaseMapper { - List selectStationByType(Integer stationType, Integer serveType); - - List selectAll(); - - List selectStationByInCode(List codes); } diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/UseMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/UseMapper.java new file mode 100644 index 0000000..364bce0 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/UseMapper.java @@ -0,0 +1,13 @@ +package com.hnac.hzims.scheduled.mapper.operation; + +import com.hnac.hzims.operational.fill.entity.UseEntity; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +/** + * @author ysj + * @date 2023/04/10 11:22:14 + * @version 4.0.0 + */ +public interface UseMapper extends UserDataScopeBaseMapper { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java new file mode 100644 index 0000000..ed0af83 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java @@ -0,0 +1,65 @@ +package com.hnac.hzims.scheduled.scheduled; + +import com.hnac.hzims.scheduled.service.operation.MonitorService; +import com.xxl.job.core.biz.model.ReturnT; +import com.xxl.job.core.handler.annotation.XxlJob; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.tool.utils.DateUtil; +import org.springblade.core.tool.utils.Func; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.Date; + +import static com.hnac.hzims.operational.main.constant.MainConstants.*; + + +/** + * @author ysj + */ +@Slf4j +@Component +public class MonitorScheduledTask { + + @Autowired + private MonitorService service; + + /** + * realId刷新 + */ + @XxlJob(REAL_ID_DATA) + public ReturnT loadRealId(String param) { + if (Func.isBlank(param)) { + param = DateUtil.format(new Date(), "yyyy-MM"); + } + service.loadRealId(param); + return new ReturnT<>("SUCCESS"); + } + + /** + * 实时数据刷新 + * @return ReturnT + */ + @XxlJob(REAL_TIME_DATA) + //@Scheduled(cron = "0/40 * * * * ? ") + public ReturnT loadRealData(String param) throws Exception { + if (Func.isBlank(param)) { + param = DateUtil.format(new Date(), "yyyy-MM"); + } + service.loadRealData(param); + return new ReturnT<>("SUCCESS"); + } + + /** + * 集中监控数据处理 + * @return ReturnT + */ + @XxlJob(CENTRALIZED_MONITORING) + public ReturnT loadMonitoring(String param) throws Exception { + if (Func.isBlank(param)) { + param = DateUtil.format(new Date(), "yyyy-MM"); + } + service.loadMonitoring(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/scheduled/RealTargetScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java new file mode 100644 index 0000000..b589578 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java @@ -0,0 +1,126 @@ +package com.hnac.hzims.scheduled.scheduled; + +import com.hnac.hzims.operational.main.constant.HomePageConstant; +import com.hnac.hzims.scheduled.service.operation.RealTargetService; +import com.xxl.job.core.biz.model.ReturnT; +import com.xxl.job.core.handler.annotation.XxlJob; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.tool.utils.DateUtil; +import org.springblade.core.tool.utils.Func; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.Arrays; +import java.util.Date; + +import static com.hnac.hzims.operational.main.constant.MainConstants.*; + + +/** + * @author ysj + */ +@Slf4j +@Component +public class RealTargetScheduledTask { + + @Autowired + private RealTargetService service; + + + /** + * 水电站-机组实时加载 + */ + @XxlJob(LOAD_HYDROPOWER_UNIT_REAL) + public ReturnT loadHydropowerReal(String param) { + if (Func.isBlank(param)) { + param = DateUtil.format(new Date(), "yyyy-MM"); + } + service.loadHydropowerReal(param); + return new ReturnT<>("SUCCESS"); + } + + /** + * 水电站-机组指标加载 + */ + @XxlJob(LOAD_HYDROPOWER_UNIT_TARGET) + public ReturnT loadHydropowerTarget(String param) { + if (Func.isBlank(param)) { + param = DateUtil.format(new Date(), "yyyy-MM"); + } + service.loadHydropowerTarget(param); + return new ReturnT<>("SUCCESS"); + } + + /** + * 水利-泵组实时加载 + */ + @XxlJob(LOAD_WATER_PUMP_REAL) + public ReturnT loadWaterPumpReal(String param) { + if (Func.isBlank(param)) { + param = DateUtil.format(new Date(), "yyyy-MM"); + } + service.loadWaterPumpReal(param); + return new ReturnT<>("SUCCESS"); + } + + + /** + * 水利-泵组指标加载 + */ + @XxlJob(LOAD_WATER_PUMP_TARGET) + public ReturnT loadWaterPumpTarget(String param) { + if (Func.isBlank(param)) { + param = DateUtil.format(new Date(), "yyyy-MM"); + } + service.loadWaterPumpTarget(param); + return new ReturnT<>("SUCCESS"); + } + + /** + * 水利-站点水位数据 + */ + @XxlJob(LOAD_WATER_LEVEL) + public ReturnT loadWaterLevel(String param) { + if (Func.isBlank(param)) { + param = DateUtil.format(new Date(), "yyyy-MM"); + } + service.loadWaterLevel(param); + return new ReturnT<>("SUCCESS"); + } + + /** + * 光伏站-逆变器实时加载 + */ + @XxlJob(LOAD_PHOTOVOLTAIC_REAL) + public ReturnT loadPhotovoltaicReal(String param) { + if (Func.isBlank(param)) { + param = DateUtil.format(new Date(), "yyyy-MM"); + } + service.loadPhotovoltaicReal(param); + return new ReturnT<>("SUCCESS"); + } + + /** + * 光伏站-逆变器指标加载 + */ + @XxlJob(LOAD_PHOTOVOLTAIC_TARGET) + public ReturnT loadPhotovoltaicTarget(String param) { + if (Func.isBlank(param)) { + param = DateUtil.format(new Date(), "yyyy-MM"); + } + service.loadPhotovoltaicTarget(param); + return new ReturnT<>("SUCCESS"); + } + + /** + * 获取站点近3年发电量数据 + */ + @XxlJob(ELECTRICITY_GENERATION_RECENT_YEAR) + public ReturnT loadPowerData(String param) { + if (Func.isBlank(param)) { + param = DateUtil.format(new Date(), "yyyy-MM"); + } + service.loadPowerData(param, Arrays.asList(HomePageConstant.HYDROPOWER,HomePageConstant.PHOTOVOLTAIC),2,3); + return new ReturnT<>("SUCCESS"); + } +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ReportScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ReportScheduledTask.java new file mode 100644 index 0000000..b5d19a6 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ReportScheduledTask.java @@ -0,0 +1,14 @@ +package com.hnac.hzims.scheduled.scheduled; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + + +/** + * @author ysj + */ +@Slf4j +@Component +public class ReportScheduledTask { + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ScheduledCreateTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ScheduledCreateTask.java deleted file mode 100644 index 81cb979..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ScheduledCreateTask.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.hnac.hzims.scheduled.scheduled; - -import com.hnac.hzims.scheduled.service.IWaterService; -import com.xxl.job.core.biz.model.ReturnT; -import com.xxl.job.core.handler.annotation.XxlJob; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.tool.utils.DateUtil; -import org.springblade.core.tool.utils.Func; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.util.Date; - -import static com.hnac.hzims.operational.main.constant.MainConstants.LOAD_WATER_LEVEL; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/22 11:21 - */ -@Slf4j -@Component -public class ScheduledCreateTask { - - @Autowired - private IWaterService waterService; - - /** - * 水利-站点水位数据 - * @return ReturnT - */ - @XxlJob(LOAD_WATER_LEVEL) - public ReturnT loadWaterLevel(String param) throws Exception { - if (Func.isBlank(param)) { - param = DateUtil.format(new Date(), "yyyy-MM"); - } - waterService.loadWaterLevel(param); - return new ReturnT<>("SUCCESS"); - } - - - - /** - * 水利-站点水位数据 - * @return ReturnT - */ - @XxlJob("cheshi") - public ReturnT cheshi(String param) throws Exception { - System.out.println("执行呢方法"); - return new ReturnT<>("SUCCESS"); - } - -} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ShowScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ShowScheduledTask.java new file mode 100644 index 0000000..c7bb905 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ShowScheduledTask.java @@ -0,0 +1,14 @@ +package com.hnac.hzims.scheduled.scheduled; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + + +/** + * @author ysj + */ +@Slf4j +@Component +public class ShowScheduledTask { + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/StAlamRecordTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/StAlamRecordTask.java deleted file mode 100644 index b253c41..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/StAlamRecordTask.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.hnac.hzims.scheduled.scheduled; - -import com.hnac.hzims.scheduled.service.AbnormalAlarmService; -import com.hnac.hzims.scheduled.service.IRealMonitorService; -import com.hnac.hzims.scheduled.service.StFocusPropertiesService; -import com.xxl.job.core.biz.model.ReturnT; -import com.xxl.job.core.handler.annotation.XxlJob; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.tool.utils.DateUtil; -import org.springblade.core.tool.utils.Func; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -import java.util.Date; - -import static com.hnac.hzims.operational.main.constant.MainConstants.*; - -/** - * 集中监控 - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/19 10:17 - */ -@Slf4j -@Component -public class StAlamRecordTask { - - @Value("${hzims.operation.comprehensiveD}") - public String path; - - // @Autowired - private IRealMonitorService monitorService; - - @Autowired - private AbnormalAlarmService abnormalAlarmService; - - @Autowired - private StFocusPropertiesService stFocusPropertiesService; - - /** - * 数据中断告警 - * @return ReturnT - */ - @XxlJob(ALARM_DATA_HANDLE) - public ReturnT alarmDataHandle(String param) throws Exception { - if (Func.isBlank(param)) { - param = DateUtil.format(new Date(), "yyyy-MM"); - } - abnormalAlarmService.alarmDataHandle(param); - return new ReturnT<>("SUCCESS"); - } - - - - /** - * realId获取 - * @return ReturnT - */ - @XxlJob(REAL_ID_DATA) - public ReturnT realIdData(String param) throws Exception { - if (Func.isBlank(param)) { - param = DateUtil.format(new Date(), "yyyy-MM"); - } - stFocusPropertiesService.getStationRealIds(param); - return new ReturnT<>("SUCCESS"); - } - - /** - * 站点实时数据 - * @return ReturnT - */ - @XxlJob(REAL_TIME_DATA) - //@Scheduled(cron = "0/40 * * * * ? ") - public ReturnT realTimeData(String param) throws Exception { - if (Func.isBlank(param)) { - param = DateUtil.format(new Date(), "yyyy-MM"); - } - monitorService.realTimeData(param); - return new ReturnT<>("SUCCESS"); - } - - - - /** - * 集中监控数据处理 - * @return ReturnT - */ - @XxlJob(CENTRALIZED_MONITORING) - //@Scheduled(cron = "0/40 * * * * ? ") - public ReturnT centralizedMonitoring(String param) throws Exception { - if (Func.isBlank(param)) { - param = DateUtil.format(new Date(), "yyyy-MM"); - } - monitorService.centralizedMonitoring(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/AbnormalAlarmService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/AbnormalAlarmService.java deleted file mode 100644 index 180d275..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/AbnormalAlarmService.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.hnac.hzims.scheduled.service; - -import com.hnac.hzims.operational.alert.entity.AbnormalAlarmEntity; -import org.springblade.core.mp.base.BaseService; - -import java.util.List; - -/** - * 告警处理接口 - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/19 10:20 - */ -public interface AbnormalAlarmService extends BaseService { - void alarmDataHandle(String param); - - List getAbnormalAlarmList(); -} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/HistoryAbnormalAlarmService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/HistoryAbnormalAlarmService.java deleted file mode 100644 index 4c2816e..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/HistoryAbnormalAlarmService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.hnac.hzims.scheduled.service; - -import com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity; -import org.springblade.core.mp.base.BaseService; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/19 11:09 - */ -public interface HistoryAbnormalAlarmService extends BaseService { - - - HistoryAbnormalAlarmEntity getAbnormalAlarm(String station, String soeType); -} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IHzimsAnalyzeModelStationService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IHzimsAnalyzeModelStationService.java deleted file mode 100644 index 15c7b7a..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IHzimsAnalyzeModelStationService.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.hnac.hzims.scheduled.service; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.hnac.hzims.operational.station.entity.HzimsAnalyzeModelStationEntity; -import org.springblade.core.mp.base.BaseService; - -import java.util.List; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/22 11:31 - */ -public interface IHzimsAnalyzeModelStationService extends BaseService { - -} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IMainSystemMonitoringService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IMainSystemMonitoringService.java deleted file mode 100644 index d9b6c4e..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IMainSystemMonitoringService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.hnac.hzims.scheduled.service; - -import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; - -import java.util.List; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/19 14:00 - */ -public interface IMainSystemMonitoringService { - - List getEmInfoList(); -} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IRealMonitorService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IRealMonitorService.java deleted file mode 100644 index 9de496f..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IRealMonitorService.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.hnac.hzims.scheduled.service; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/19 10:20 - */ -public interface IRealMonitorService { - void realTimeData(String param); - - void centralizedMonitoring(String param); -} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IStationAttrConfigService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IStationAttrConfigService.java deleted file mode 100644 index 747bcc4..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IStationAttrConfigService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.hnac.hzims.scheduled.service; - -import com.hnac.hzims.operational.station.entity.StationAttrConfigEntity; -import org.springblade.core.mp.base.BaseService; - -import java.util.List; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/19 16:06 - */ -public interface IStationAttrConfigService extends BaseService { - List getHideList(); -} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IStationAttributeService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IStationAttributeService.java deleted file mode 100644 index 0713bb1..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IStationAttributeService.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.hnac.hzims.scheduled.service; - -import com.hnac.hzims.operational.station.entity.StationAttributeEntity; -import org.springblade.core.mp.base.BaseService; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/19 11:34 - */ -public interface IStationAttributeService extends BaseService { -} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IStationService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IStationService.java deleted file mode 100644 index 246d261..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IStationService.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.hnac.hzims.scheduled.service; - -import com.hnac.hzims.operational.station.entity.StationEntity; -import org.springblade.core.mp.base.BaseService; - -import java.util.ArrayList; -import java.util.List; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/19 10:33 - */ -public interface IStationService extends BaseService { - - List getStationByType(Integer stationType, Integer serveType); - - List getAll(); - - List getStationByInCode(List strings); - - - List getStationType(Integer serveType,List typeList,List departIdList); - - -} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IWaterService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IWaterService.java deleted file mode 100644 index e50d049..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IWaterService.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.hnac.hzims.scheduled.service; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/22 11:22 - */ -public interface IWaterService { - void loadWaterLevel(String param); -} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/StAlamRecordService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/StAlamRecordService.java deleted file mode 100644 index cff89fd..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/StAlamRecordService.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.hnac.hzims.scheduled.service; - -import com.hnac.hzims.operational.config.entity.StAlarmRecordEntity; -import org.springblade.core.mp.base.BaseService; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/19 15:41 - */ -public interface StAlamRecordService extends BaseService { - Long insertAlert(String stationId, String monitorId); -} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/StFocusPropertiesService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/StFocusPropertiesService.java deleted file mode 100644 index 479b4b3..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/StFocusPropertiesService.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.hnac.hzims.scheduled.service; - -import com.hnac.hzims.operational.config.entity.StFocusPropertiesEntity; -import org.springblade.core.mp.base.BaseService; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/19 10:21 - */ -public interface StFocusPropertiesService extends BaseService { - void getStationRealIds(String param); -} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/WorkshopInfoService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/WorkshopInfoService.java new file mode 100644 index 0000000..3fe8199 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/WorkshopInfoService.java @@ -0,0 +1,12 @@ +package com.hnac.hzims.scheduled.service.equipment; + +import com.hnac.hzims.equipment.entity.WorkshopInfoEntity; +import org.springblade.core.mp.base.BaseService; + + +/** + * @author hx + */ +public interface WorkshopInfoService extends BaseService { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/WorkshopInfoServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/WorkshopInfoServiceImpl.java new file mode 100644 index 0000000..20aed9a --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/WorkshopInfoServiceImpl.java @@ -0,0 +1,20 @@ +package com.hnac.hzims.scheduled.service.equipment.impl; + +import com.hnac.hzims.equipment.entity.WorkshopInfoEntity; +import com.hnac.hzims.scheduled.mapper.equipment.WorkshopInfoMapper; +import com.hnac.hzims.scheduled.service.equipment.WorkshopInfoService; +import groovy.util.logging.Slf4j; +import lombok.AllArgsConstructor; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +/** + * @author hx + */ +@Service +@AllArgsConstructor +@Slf4j +public class WorkshopInfoServiceImpl extends BaseServiceImpl implements WorkshopInfoService { + + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/AbnormalAlarmServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/AbnormalAlarmServiceImpl.java deleted file mode 100644 index 9a57ee4..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/AbnormalAlarmServiceImpl.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.hnac.hzims.scheduled.service.impl; - -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.dto.MessagePushRecordDto; -import com.hnac.hzims.message.fegin.IMessageClient; -import com.hnac.hzims.operational.alert.constants.AbnormalAlarmConstant; -import com.hnac.hzims.operational.alert.entity.AbnormalAlarmEntity; -import com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity; -import com.hnac.hzims.operational.main.constant.HomePageConstant; -import com.hnac.hzims.operational.station.entity.StationEntity; -import com.hnac.hzims.scheduled.mapper.operation.AbnormalAlarmMapper; -import com.hnac.hzims.scheduled.service.AbnormalAlarmService; -import com.hnac.hzims.scheduled.service.HistoryAbnormalAlarmService; -import com.hnac.hzims.scheduled.service.IStationService; -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.core.response.HzPage; -import com.hnac.hzinfo.sdk.core.response.Result; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.mp.base.BaseServiceImpl; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.CollectionUtil; -import org.springblade.core.tool.utils.DateUtil; -import org.springblade.core.tool.utils.ObjectUtil; -import org.springblade.core.tool.utils.StringUtil; -import org.springblade.system.feign.ISysClient; -import org.springblade.system.user.entity.User; -import org.springblade.system.user.feign.IUserClient; -import org.springframework.stereotype.Service; - -import java.time.LocalDateTime; -import java.util.*; -import java.util.concurrent.CompletableFuture; -import java.util.function.Function; -import java.util.stream.Collectors; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/19 10:29 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class AbnormalAlarmServiceImpl extends BaseServiceImpl implements AbnormalAlarmService { - - - private final IStationService stationService; - - - private final HistoryAbnormalAlarmService historyAbnormalAlarmService; - - private final ISysClient sysClient; - - private final ISoeClient soeClient; - - private final IUserClient userClient; - - private final IMessageClient messageClient; - - - /** - * 数据中断、数据异常告警 - * @param param - */ - @Override - public void alarmDataHandle(String param) { - // 查询代运维站点 - List stations = stationService.getStationByType(null, HomePageConstant.HYDROPOWER_SERVETYPE); - if(CollectionUtil.isEmpty(stations)){ - return; - } - SoeQueryConditionByStation query = new SoeQueryConditionByStation(); - query.setTypes(AbnormalAlarmConstant.SEND_MESSSAGE_TYPE_LIST); - query.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList())); - Calendar calendar = Calendar.getInstance(); - query.setEndTime(LocalDateTime.parse(DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME),DateUtil.DATETIME_FORMATTER)); - calendar.add(Calendar.MINUTE,-2); - query.setBeginTime(LocalDateTime.parse(DateUtil.format(calendar.getTime() , DateUtil.PATTERN_DATETIME),DateUtil.DATETIME_FORMATTER)); - query.setNeedPage(false); - log.error("alarm_data_handle_param : {}",query); - Result> result = soeClient.getByStationsAndTime(query); - // 未查询到告警信息 - if(!result.isSuccess() || ObjectUtil.isEmpty(result.getData().getRecords())){ - return; - } - log.error("alarm_data_handle_begin_result : {}",result.getData().getRecords()); - // 遍历告警信息 - List list = new ArrayList<>(result.getData().getRecords().stream().sorted(Comparator.comparing(SoeData::getTs).reversed()) - .collect(Collectors.toMap(o -> o.getStation() + o.getSoeType(), Function.identity(), (o1, o2) -> o1)).values()); - log.error("alarm_data_handle_end_result : {}",list); - list.forEach(item -> { - AbnormalAlarmEntity queryEntity = this.baseMapper.getAbnormalAlarm(item.getStation(),item.getSoeType()); - boolean flag = AbnormalAlarmConstant.ABNORMAL_STATUS.equals(item.getSoeAlarmType()); - String stationName = Optional.ofNullable(stations.stream().filter(o-> o.getCode().equals(item.getStation())).collect(Collectors.toList())).map(o->o.get(0).getName()).orElse(null); - if(ObjectUtil.isEmpty(queryEntity)){ - AbnormalAlarmEntity entity = new AbnormalAlarmEntity(); - entity.setStationId(item.getStation()); - entity.setStationName(stationName); - entity.setRealId(item.getRealId()); - entity.setSoeExplain(item.getSoeExplain()); - entity.setType(item.getSoeType()); - entity.setStartTime(item.getTs()); - entity.setEndTime(null); - entity.setStatus(0); - if(flag){ - entity.setStartTime(null); - entity.setEndTime(item.getTs()); - entity.setStatus(1); - } - // 保存告警信息 - this.save(entity); - return; - } - queryEntity.setSoeExplain(item.getSoeExplain()); - queryEntity.setStationName(stationName); - queryEntity.setType(item.getSoeType()); - queryEntity.setStartTime(queryEntity.getStartTime()); - queryEntity.setUpdateTime(new Date()); - queryEntity.setEndTime(null); - queryEntity.setStatus(0); - if(flag){ - queryEntity.setEndTime(item.getTs()); - queryEntity.setStatus(1); - } - this.updateById(queryEntity); - }); - - // 异步保存历史告警 - CompletableFuture.supplyAsync(()-> this.saveHistoryAlarm(result.getData().getRecords(),stations)); - } - - - /** - * 保存告警历史信息 - * @param list - * @return - */ - private String saveHistoryAlarm(List list,List stations) { - list.forEach(item -> { - Date ts = DateUtil.parse(DateUtil.format(item.getTs(),DateUtil.PATTERN_DATETIME),DateUtil.DATETIME_FORMAT); - // 历史数据异常查询 - HistoryAbnormalAlarmEntity queryEntity = this.historyAbnormalAlarmService.getAbnormalAlarm(item.getStation(),item.getSoeType()); - // 数据中断恢复 - boolean flag = AbnormalAlarmConstant.ABNORMAL_STATUS.equals(item.getSoeAlarmType()); - String stationName = Optional.ofNullable(stations.stream().filter(o-> o.getCode().equals(item.getStation())).collect(Collectors.toList())).map(o->o.get(0).getName()).orElse(null); - if(ObjectUtil.isEmpty(queryEntity) || !flag){ - HistoryAbnormalAlarmEntity entity = new HistoryAbnormalAlarmEntity(); - entity.setAlarmId(item.getId()); - entity.setStationId(item.getStation()); - entity.setStationName(stationName); - entity.setRealId(item.getRealId()); - entity.setSoeExplain(item.getSoeExplain()); - entity.setType(item.getSoeType()); - entity.setStartTime(ts); - entity.setStatus(0); - this.historyAbnormalAlarmService.save(entity); - // 消息推送 - this.sendAlarmMessage(Collections.singletonList(entity),stations); - return; - } - queryEntity.setSoeExplain(item.getSoeExplain()); - queryEntity.setUpdateTime(new Date()); - queryEntity.setEndTime(ts); - queryEntity.setStatus(1); - this.historyAbnormalAlarmService.updateById(queryEntity); - }); - return "success"; - } - - - - /** - * 告警消息推送 - * @param entitys - */ - private void sendAlarmMessage(List entitys,List stations) { - if(CollectionUtil.isEmpty(entitys)){ - return; - } - // 告警等级 :事故、数据中断 - List alarms = entitys.stream().filter(entity -> AbnormalAlarmConstant.SEND_MESSSAGE_TYPE_LIST.contains(entity.getType())).collect(Collectors.toList()); - if(CollectionUtil.isEmpty(alarms)){ - return; - } - // 查询站点用户 - entitys.forEach(entity->{ - if(StringUtil.isEmpty(entity.getStationId())){ - return; - } - List depts = stations.stream().filter(station -> station.getCode().equals(entity.getStationId())).map(StationEntity::getRefDept).collect(Collectors.toList()); - if(CollectionUtil.isEmpty(depts)){ - return; - } - // 获取站点用户 - R> result = userClient.userListByDeptId(depts.get(0)); - if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ - return; - } - MessagePushRecordDto message = new MessagePushRecordDto(); - message.setBusinessClassify("warning"); - message.setBusinessKey(MessageConstants.BusinessClassifyEnum.WARNING.getKey()); - message.setSubject(MessageConstants.BusinessClassifyEnum.WARNING.getDescription()); - message.setTaskId(entity.getId()); - message.setTenantId("200000"); - message.setContent(entity.getSoeExplain()); - message.setTypes(Arrays.asList(MessageConstants.APP_PUSH, MessageConstants.WS_PUSH)); - message.setPushType(MessageConstants.IMMEDIATELY); - message.setDeptId(depts.get(0)); - R deptName = sysClient.getDeptName(depts.get(0)); - if (deptName.isSuccess()) { - message.setDeptName(deptName.getData()); - } - User admin = userClient.userByAccount("200000", "admin").getData(); - message.setCreateDept(admin.getCreateDept()); - message.setCreateUser(admin.getCreateUser()); - result.getData().forEach(user->{ - message.setPusher(String.valueOf(user.getId())); - message.setPusherName(user.getName()); - message.setAccount(String.valueOf(user.getId())); - messageClient.sendMessage(message); - }); - }); - } - - - /** - * 查询实时告警数据 - * @return - */ - @Override - public List getAbnormalAlarmList() { - List alarmList = this.baseMapper.getAbnormalAlarmList(); - if(CollectionUtil.isEmpty(alarmList)){ - return new ArrayList<>(); - } - return alarmList; - } -} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/HistoryAbnormalAlarmServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/HistoryAbnormalAlarmServiceImpl.java deleted file mode 100644 index 6824c7a..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/HistoryAbnormalAlarmServiceImpl.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.hnac.hzims.scheduled.service.impl; - -import com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity; -import com.hnac.hzims.scheduled.mapper.operation.HistoryAbnormalAlarmMapper; -import com.hnac.hzims.scheduled.service.HistoryAbnormalAlarmService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.mp.base.BaseServiceImpl; -import org.springblade.core.tool.utils.CollectionUtil; -import org.springframework.stereotype.Service; - -import java.util.Comparator; -import java.util.List; -import java.util.stream.Collectors; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/19 11:12 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl implements HistoryAbnormalAlarmService { - /** - * 查询单条历史告警 - * - * @param station - * @param soeType - * @return - */ - @Override - public HistoryAbnormalAlarmEntity getAbnormalAlarm(String station, String soeType) { - List alarms = this.baseMapper.getHistoryAbnormalAlarm(station, soeType); - if(CollectionUtil.isEmpty(alarms)){ - return null; - } - return alarms.stream().sorted(Comparator.comparing(HistoryAbnormalAlarmEntity::getStartTime)).collect(Collectors.toList()).get(0); - } -} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/HzimsAnalyzeModelStationServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/HzimsAnalyzeModelStationServiceImpl.java deleted file mode 100644 index 26c1e39..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/HzimsAnalyzeModelStationServiceImpl.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.hnac.hzims.scheduled.service.impl; - -import com.hnac.hzims.operational.station.entity.HzimsAnalyzeModelStationEntity; -import com.hnac.hzims.scheduled.mapper.operation.HzimsAnalyzeModelStationMapper; -import com.hnac.hzims.scheduled.service.IHzimsAnalyzeModelStationService; -import org.springblade.core.mp.base.BaseServiceImpl; -import org.springframework.stereotype.Service; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/22 11:42 - */ -@Service -public class HzimsAnalyzeModelStationServiceImpl extends BaseServiceImpl implements IHzimsAnalyzeModelStationService { -} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/MainSystemMonitoringServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/MainSystemMonitoringServiceImpl.java deleted file mode 100644 index 2620394..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/MainSystemMonitoringServiceImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.hnac.hzims.scheduled.service.impl; - -import com.alibaba.fastjson.JSONObject; -import com.alibaba.fastjson.TypeReference; -import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; -import com.hnac.hzims.scheduled.service.IMainSystemMonitoringService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.tool.utils.ObjectUtil; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.List; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/19 14:01 - */ -@Service -@Slf4j -@RequiredArgsConstructor -public class MainSystemMonitoringServiceImpl implements IMainSystemMonitoringService { - - - private final RedisTemplate redisTemplate; - - - @Value("${hzims.equipment.emInfo.emInfoList}") - public String emInfoListPath; - - /** - * 从Redis获取设备信息 - * - * @return - */ - @Override - public List getEmInfoList() { - List list = new ArrayList<>(); - Object json = redisTemplate.opsForValue().get(emInfoListPath); - if (ObjectUtil.isNotEmpty(json)) { - list = JSONObject.parseObject(json.toString(), new TypeReference>() { - }); - } - return list; - } - -} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/RealMonitorServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/RealMonitorServiceImpl.java deleted file mode 100644 index 4a595ad..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/RealMonitorServiceImpl.java +++ /dev/null @@ -1,713 +0,0 @@ -package com.hnac.hzims.scheduled.service.impl; - -import com.alibaba.fastjson.JSONObject; -import com.alibaba.fastjson.TypeReference; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -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.main.constant.HomePageConstant; -import com.hnac.hzims.operational.station.entity.StationAttributeEntity; -import com.hnac.hzims.operational.station.entity.StationEntity; -import com.hnac.hzims.scheduled.service.*; -import com.hnac.hzims.scheduled.vo.RealAttributeVo; -import com.hnac.hzims.scheduled.vo.RealDeviceVo; -import com.hnac.hzims.scheduled.vo.RealStationVo; -import com.hnac.hzims.scheduled.vo.StationRealVo; -import com.hnac.hzinfo.sdk.v5.redis.RedisClient; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.collections4.MapUtils; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.CollectionUtil; -import org.springblade.core.tool.utils.DateUtil; -import org.springblade.core.tool.utils.ObjectUtil; -import org.springblade.core.tool.utils.StringUtil; -import org.springblade.system.entity.Dept; -import org.springblade.system.feign.ISysClient; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.stereotype.Service; - -import javax.validation.constraints.NotNull; -import java.util.*; -import java.util.concurrent.*; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/19 13:54 - */ -@Service -@RequiredArgsConstructor -@Slf4j -public class RealMonitorServiceImpl implements IRealMonitorService { - - @NotNull - private final IStationAttributeService attbtService; - - - private final AbnormalAlarmService abnormalAlarmService; - - private final StAlamRecordService alertService; - - @NotNull - private final IStationService stationService; - @NotNull - private final IMainSystemMonitoringService maintenanceTaskService; - @NotNull - private final RedisTemplate redisTemplate; - - - private final IMainSystemMonitoringService systemMonitoringService; - - - private final RedisClient redisClient; - - @NotNull - private final ISysClient sysClient; - - - private final IStationAttrConfigService stationAttrConfigService; - - @Value("${hzims.operation.monitor.realId}") - public String moniter_realId_key; - - @Value("${hzims.operation.monitor.station}") - public String moniter_station_key; - - @Value("${hzims.equipment.fdp.redisData}") - public String fdp_fault_data_key; - - @Value("${hzims.operation.homePage.activePowerKey}") - public String active_power_key; - - @Value("${hzims.equipment.fdp.greaterThan}") - public Double greater_than; - - @Value("${hzims.equipment.fdp.lessThan}") - public Double less_than; - - @Value("${hzims.equipment.fdp.beEqualOrGreaterThan}") - public Double be_equal_or_greater_than; - - @Value("${hzims.operation.region.deviceClassifyKey}") - private String device_classify_key; - - @Value("${hzims.operation.realIdKeyGather}") - public String real_id_key_gather_path; - - @Value("${hzims.operation.realIdKey}") - public String real_id_key_path; - - @Value("${hzims.operation.homePage.jointRelayKey}") - public String joint_relay_key; - - /** - * 10站点为一组数据 - */ - private static final Integer MAX_SEND = 5; - - private final static String loadwater_level_key = "hzims:operation:loadwater:level:key"; - - - @Override - public void realTimeData(String param) { - Long beginTime = System.currentTimeMillis(); - // 获取设备 - List devices = systemMonitoringService.getEmInfoList(); - // 设备开关机集合监测点 - List switchOnOff = devices.stream().map(o->{ - Map points = o.getPoint(); - if(CollectionUtil.isEmpty(points)){ - return ""; - } - String jointRelay = points.get(HomePageConstant.JOINT_RELAY); - if(!StringUtil.isEmpty(jointRelay)){ - return jointRelay; - } - String onOff = points.get(HomePageConstant.SWITCH_ON_OFF); - if(!StringUtil.isEmpty(onOff)){ - return onOff; - } - return ""; - }).collect(Collectors.toList()); - // 获取站点缓存数据 - List stationRealVos = (List) redisTemplate.opsForValue().get(moniter_realId_key); - if(CollectionUtil.isEmpty(stationRealVos)){ - return; - } - // 数据切割 - int limit = countStep(stationRealVos.size()); - List> list = Stream.iterate(0, n -> n + 1).limit(limit).parallel().map(a -> stationRealVos.stream().skip((long) a * MAX_SEND).limit(MAX_SEND).parallel().collect(Collectors.toList())).collect(Collectors.toList()); - ExecutorService pool = Executors.newFixedThreadPool(limit); - // - Map valueMap = new ConcurrentHashMap<>(); - // > - Map> keyMap = new ConcurrentHashMap<>(); - CountDownLatch countDownLatch = new CountDownLatch(limit); - pool.execute(()-> list.forEach(stations -> { - stations.forEach(stationReal -> { - String[] realIdArr = stationReal.getRealId(); - List realIds = Stream.of(realIdArr).collect(Collectors.toList()); - if(CollectionUtil.isEmpty(realIds)){ - return; - } - 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{ - Map attribute = (Map) JSONObject.parse(objects.get(i)); - attribute.put("realId",attribute.get("k")); - attribute.put("value",attribute.get("v")); - attribute.put("time",attribute.get("t")); - attribute.remove("v"); - attribute.remove("k"); - attribute.remove("t"); - this.getCheckMap(attribute,switchOnOff); - valueMap.put(realIdArr[i],attribute.get("value")); - keyMap.put(realIdArr[i],attribute); - } - } - }); - countDownLatch.countDown(); - })); - // 等待所有线程执行完成 - try { - countDownLatch.await(); - } catch (InterruptedException e) { - e.printStackTrace(); - Thread.currentThread().interrupt(); - } - pool.shutdown(); - // redis 存储 - redisTemplate.opsForValue().set(real_id_key_path,JSONObject.toJSONString(valueMap)); - redisTemplate.opsForValue().set(real_id_key_gather_path,JSONObject.toJSONString(keyMap)); - Long endTime = System.currentTimeMillis(); - Long time = endTime - beginTime; - log.error("处理redis实时数据 耗时 : {}",time); - } - - - - /** - * 计算切分次数 - */ - private static Integer countStep(Integer size) { - return (size + MAX_SEND - 1) / MAX_SEND; - } - - - /** - * 监测点过期数据检查 - * @param value - * @return - */ - private void getCheckMap(Map value,List switchOnOff){ - // 不处理开机状态监测点 - if(switchOnOff.contains(value.get("realId"))){ - return; - } - String time = value.get("time"); - if(StringUtil.isEmpty(time)){ - return; - } - Date date = DateUtil.parse(time,DateUtil.PATTERN_DATETIME); - // 实时数据超出10分钟未刷新,值置为 0 显示 - if(System.currentTimeMillis() - date.getTime() > 10 * 60 * 1000L){ - value.put("value","0"); - } - } - - - - - /** - * 集中监控数据处理 - * @param param - */ - @Override - public void centralizedMonitoring(String param) { - long beginTime = System.currentTimeMillis(); - Thread thread = Thread.currentThread(); - Object json = redisTemplate.opsForValue().get(real_id_key_gather_path); - if (ObjectUtil.isEmpty(json)) { - return; - } - Map> map = JSONObject.parseObject(json.toString(), new TypeReference>>() { - }); - if (MapUtils.isEmpty(map)) { - return; - } - log.info(thread.getName() + "步骤1获取检测点数据耗时 : {}",System.currentTimeMillis() - beginTime); - beginTime = System.currentTimeMillis(); - // 获取所有设备重点属性 - List list = attbtService.list(new LambdaQueryWrapper() {{ - isNotNull(StationAttributeEntity::getStationId); - eq(StationAttributeEntity::getIsDeleted, "0"); - orderByAsc(StationAttributeEntity::getSort); - }}); - if (CollectionUtil.isEmpty(list)) { - return; - } - log.info(thread.getName() + "步骤2获取监控配置监测点 耗时 : {}",System.currentTimeMillis() - beginTime); - beginTime = System.currentTimeMillis(); - // 获取所有告警记录 - List alertList = alertService.list(new LambdaQueryWrapper() {{ - orderByDesc(StAlarmRecordEntity::getCreateTime); - }}); - log.info(thread.getName() + "步骤3获取告警记录 耗时 : {}",System.currentTimeMillis() - beginTime); - beginTime = System.currentTimeMillis(); - List alarmList = abnormalAlarmService.getAbnormalAlarmList(); - log.info(thread.getName() + "步骤4获取数据中断告警记录 耗时 : {}",System.currentTimeMillis() - beginTime); - beginTime = System.currentTimeMillis(); - // 获取所有故障记录 - List faultList = this.getFdpFaultAll(); - log.info(thread.getName() + "步骤5获取故障记录 耗时 : {}",System.currentTimeMillis() - beginTime); - beginTime = System.currentTimeMillis(); - // 所有设备分类 - Map> deviceClassifyMap = (Map>) redisTemplate.opsForValue().get(device_classify_key); - log.info(thread.getName() + "步骤6获取设备分类 耗时 : {}",System.currentTimeMillis() - beginTime); - beginTime = System.currentTimeMillis(); - // 所有设备 - List emList = maintenanceTaskService.getEmInfoList(); - log.info(thread.getName() + "步骤7获取设备信息 耗时 : {}",System.currentTimeMillis() - beginTime); - beginTime = System.currentTimeMillis(); - // 根据站点分组 - Map> stationAttbtMap = list.stream().collect(Collectors.groupingBy(StationAttributeEntity::getStationId)); - // 获取站点列表 - List stationEntityList = stationService.getStationByInCode(new ArrayList<>(stationAttbtMap.keySet())); - log.info(thread.getName() + "步骤8站点列表 耗时 : {}",System.currentTimeMillis() - beginTime); - beginTime = System.currentTimeMillis(); - // 隐藏设备列表 - List hideList = stationAttrConfigService.getHideList(); - // 分割,每个map限制10个长度 - List>> handleList = this.mapChunk(stationAttbtMap); - log.info(thread.getName() + "步骤9监测点数据切割 耗时 : {}",System.currentTimeMillis() - beginTime); - beginTime = System.currentTimeMillis(); - // 创建线程池 - ExecutorService pool = Executors.newFixedThreadPool(handleList.size()); - CountDownLatch countDownLatch = new CountDownLatch(handleList.size()); - log.info(thread.getName() +"步骤10创建线程 耗时 : {}",System.currentTimeMillis() - beginTime); - beginTime = System.currentTimeMillis(); - // 所有机构 - R> deptAll = sysClient. getDeptList(); - // 存储数据节点 - List stationList = new CopyOnWriteArrayList<>(); - pool.execute(()->{ - // 线程处理数据 - for(Map> item : handleList){ - item.forEach((key,value)->{ - RealStationVo station = new RealStationVo(); - // 站点编码 - station.setStationCode(key); - // 设置站点状态 - this.setStationStatus(alarmList,station,key); - // 名称、限制水位、服务类型、机构、排序 - this.stationParam(stationEntityList,station,deptAll.getData()); - // 根据设备名称分组 - Map> deviceAttbtMap = value.stream().filter(o -> !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, faultList); - deviceList.add(deviceVo); - }); - // 设备状态 - this.getDeviceParam(emList, deviceClassifyMap, deviceList); - station.setDeviceList(deviceList.stream().sorted(Comparator.comparing((RealDeviceVo::getDeviceName))).collect(Collectors.toList())); - stationList.add(station); - }); - countDownLatch.countDown(); - } - }); - log.info(thread.getName() + "步骤11线程数据处理 耗时 : {}",System.currentTimeMillis() - beginTime); - beginTime = System.currentTimeMillis(); - // 等待所有线程执行完成 - try { - countDownLatch.await(); - } catch (InterruptedException e) { - e.printStackTrace(); - Thread.currentThread().interrupt(); - } - pool.shutdown(); - log.info(thread.getName() + "步骤12所有线程完成 耗时 : {}",System.currentTimeMillis() - beginTime); - redisTemplate.opsForValue().set(moniter_station_key, stationList); - } - - - /** - * map分割 - * - * @param - * @param - * @param chunkMap - * @return - */ - private List> mapChunk(Map chunkMap) { - if (chunkMap == null || RealMonitorServiceImpl.MAX_SEND <= 0) { - List> list = new ArrayList<>(); - list.add(chunkMap); - return list; - } - Set keySet = chunkMap.keySet(); - Iterator iterator = keySet.iterator(); - int i = 1; - List> total = new ArrayList<>(); - Map tem = new HashMap<>(); - while (iterator.hasNext()) { - k next = iterator.next(); - tem.put(next, chunkMap.get(next)); - if (i == RealMonitorServiceImpl.MAX_SEND) { - total.add(tem); - tem = new HashMap<>(); - i = 0; - } - i++; - } - if (!CollectionUtil.isEmpty(tem)) { - total.add(tem); - } - return total; - } - - - - /** - * 设备参数设置 - * - * @param emList - * @param deviceClassifyMap - * @param deviceList - */ - private void getDeviceParam(List emList, Map> deviceClassifyMap, List deviceList) { - if (CollectionUtil.isEmpty(emList) || CollectionUtil.isEmpty(deviceList) || MapUtils.isEmpty(deviceClassifyMap)) { - 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 = emList.stream().filter(o -> null != o.getId() && o.getId().toString().equals(device.getDeviceCode())).collect(Collectors.toList()); - if (CollectionUtil.isEmpty(list)) { - device.setState(-1); - return; - } - String deviceCode = list.get(0).getEmCode(); - if (StringUtil.isBlank(deviceCode)) { - device.setState(-1); - 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); - } - }); - } - /** - * 获取所有告警记录 - * - * @return - */ - private List getFdpFaultAll() { - Object json = redisTemplate.opsForValue().get(fdp_fault_data_key); - if (ObjectUtil.isEmpty(json)) { - return new ArrayList<>(); - } - return (List) json; - } - - - - /** - * 设置站点状态 - * @param alarmList - * @param station - * @param key - */ - private void setStationStatus(List alarmList, RealStationVo station, String key) { - station.setStatus(0); - if(alarmList.contains(key)){ - station.setStatus(1); - } - } - - - /** - * 获取站点属性 - * @param stationEntityList - * @param item - */ - private void stationParam(List stationEntityList, RealStationVo item,List deptAll) { - if(CollectionUtil.isEmpty(stationEntityList)){ - return; - } - List filterList = stationEntityList.stream().filter(o->item.getStationCode().equals(o.getCode())).collect(Collectors.toList()); - if(CollectionUtil.isEmpty(filterList)){ - return; - } - StationEntity station = filterList.get(0); - if(ObjectUtil.isEmpty(station)){ - return; - } - item.setStationName(station.getName()); - item.setWaterLevelMax(station.getLimitWaterLevel()); - 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; - } - item.setSort(list.get(0).getSort()); - } - - - - /** - * 设备处理 - * - * @param list - * @param map - * @param device - */ - private void handleDevice(List list, Map> map, - RealDeviceVo device, List alertList, - List faultList) { - if (CollectionUtil.isEmpty(list) || MapUtils.isEmpty(map)) { - 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); - return; - } - realAttributeVo = handleAttbt(item, real, alertList, faultList); - if (ObjectUtil.isEmpty(realAttributeVo)) { - return; - } - attbtList.add(realAttributeVo); - }); - device.setAttbtList(attbtList); - } - - - /** - * 设备单条重点属性处理 - * - * @param item - * @param real - * @return - */ - private RealAttributeVo handleAttbt(StationAttributeEntity item, Map real, - List alertList, List faultList) { - RealAttributeVo attest = new RealAttributeVo(); - this.setAttbtParam(attest, real); - attest.setRealId(item.getMonitorId()); - attest.setName(item.getAttributes()); - attest.setUnit(item.getUnit()); - attest.setType(item.getAttributeType()); - String value = Optional.ofNullable(attest.getValue()).orElse("-"); - // 正常状态 - attest.setStatus(ConfigStatus.ConfigStatusEnum.NORMAL.getStatus()); - int quality = Optional.ofNullable(attest.getQuality()).orElse(-1); - String time = Optional.ofNullable(attest.getTime()).orElse(""); - // 延时状态 :质量为空 && 时间为空 - if (-1 == quality && StringUtil.isEmpty(time)) { - attest.setStatus(ConfigStatus.ConfigStatusEnum.GRAY.getStatus()); - } - int type = item.getAttributeType(); - switch (type) { - 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); - //处理 - break; - default: - throw new IllegalStateException("Unexpected type: " + type); - } - // 故障信息设置 - accidentDetails(attest, faultList, value); - return attest; - } - - /** - * 故障信息设置 - * - * @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 && fdpFaultStatusVo.getValue() < less_than) { - attest.setStatus(ConfigStatus.ConfigStatusEnum.YELLOW.getStatus()); - // 橙色 - } else if (fdpFaultStatusVo.getValue() >= be_equal_or_greater_than) { - attest.setStatus(ConfigStatus.ConfigStatusEnum.ORANGE.getStatus()); - } - attest.setFdpRate(fdpFaultStatusVo.getValue()); - attest.setFdpFaultId(fdpFaultStatusVo.getFaultId()); - attest.setFdpMonitorId(fdpFaultStatusVo.getMonitorId()); - } - - /** - * 重点属性类型-遥信 :数据逻辑处理 - * - * @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()) { - return; - } - if (-1 == quality) { - return; - } - if (quality != 0) { - return; - } - 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()); - 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()); - } - } - } 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 attest - * @param real - */ - private void setAttbtParam(RealAttributeVo attest, Map real) { - if (CollectionUtil.isEmpty(real)) { - return; - } - real.forEach((key, value) -> { - if (StringUtil.isBlank(value)) { - return; - } - switch (key) { - case "q": - attest.setQuality(Integer.parseInt(value)); - break; - case "realId": - attest.setRealId(value); - break; - case "value": - attest.setValue(Optional.ofNullable(value).orElse("-")); - break; - case "time": - attest.setTime(value); - break; - } - }); - } -} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StAlamRecordServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StAlamRecordServiceImpl.java deleted file mode 100644 index 06d1fd0..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StAlamRecordServiceImpl.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.hnac.hzims.scheduled.service.impl; - -import com.hnac.hzims.operational.config.entity.StAlarmRecordEntity; -import com.hnac.hzims.scheduled.mapper.operation.StAlarmRecordMapper; -import com.hnac.hzims.scheduled.service.StAlamRecordService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.mp.base.BaseServiceImpl; -import org.springframework.stereotype.Service; - -import java.util.Date; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/19 15:46 - */ -@Service -@RequiredArgsConstructor -@Slf4j -public class StAlamRecordServiceImpl extends BaseServiceImpl implements StAlamRecordService { - - - /** - * 添加告警 - * @param stationId - * @param realId - * @return - */ - @Override - public Long insertAlert(String stationId, String realId) { - StAlarmRecordEntity record = new StAlarmRecordEntity(); - record.setStationId(stationId); - record.setRealId(realId); - record.setStatus(0); - record.setCreateTime(new Date()); - log.info("insert_alert_entity:{}",record); - return this.baseMapper.insertReturnId(record); - } - -} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StFocusPropertiesServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StFocusPropertiesServiceImpl.java deleted file mode 100644 index f10b67e..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StFocusPropertiesServiceImpl.java +++ /dev/null @@ -1,164 +0,0 @@ -package com.hnac.hzims.scheduled.service.impl; - -import com.alibaba.fastjson.JSONObject; -import com.alibaba.fastjson.TypeReference; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.google.common.collect.Lists; -import com.hnac.hzims.equipment.entity.WorkshopInfoEntity; -import com.hnac.hzims.equipment.feign.IEmInfoClient; -import com.hnac.hzims.equipment.feign.IWorkshopInfoClient; -import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; -import com.hnac.hzims.operational.config.entity.StFocusPropertiesEntity; -import com.hnac.hzims.operational.main.constant.HomePageConstant; -import com.hnac.hzims.operational.station.entity.StationAttributeEntity; -import com.hnac.hzims.operational.station.entity.StationEntity; -import com.hnac.hzims.scheduled.mapper.operation.StFocusPropertiesMapper; -import com.hnac.hzims.scheduled.service.IStationAttributeService; -import com.hnac.hzims.scheduled.service.IStationService; -import com.hnac.hzims.scheduled.service.StFocusPropertiesService; -import com.hnac.hzims.scheduled.vo.StationRealVo; -import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient; -import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO; -import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO; -import lombok.RequiredArgsConstructor; -import org.springblade.core.log.logger.BladeLogger; -import org.springblade.core.mp.base.BaseServiceImpl; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.CollectionUtil; -import org.springblade.core.tool.utils.Func; -import org.springblade.core.tool.utils.ObjectUtil; -import org.springblade.core.tool.utils.StringUtil; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import java.util.function.Function; -import java.util.stream.Collectors; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/19 11:27 - */ -@Service -@RequiredArgsConstructor -public class StFocusPropertiesServiceImpl extends BaseServiceImpl implements StFocusPropertiesService { - - - private final IStationService stationService; - - private final IStationAttributeService attbtService; - - private final IEmInfoClient emInfoClient; - - private final IAnalyseDataSearchClient analyseDataSearchClient; - - private final IWorkshopInfoClient workshopInfoClient; - - private final RedisTemplate redisTemplate; - - private final BladeLogger logger; - - @Value("${hzims.operation.monitor.realId}") - public String moniter_realId_key; - - @Value("${hzims.equipment.emInfo.emInfoList}") - public String em_info_list_path; - - @Override - public void getStationRealIds(String param) { - // 所有站点 - List stationList = stationService.getAll(); - if(CollectionUtil.isEmpty(stationList)){ - return; - } - // 设备监测点list - Object json = redisTemplate.opsForValue().get(em_info_list_path); - List eminfoAndEmParams = JSONObject.parseObject(json.toString(), new TypeReference>() {}); - // 厂房监测点list - List wsMonitorList = this.getRealIdByWsCodeAndSign(); - // 实时监控监测点list - List timeList = attbtService.list(new LambdaQueryWrapper() {{ - eq(StationAttributeEntity::getIsDeleted, "0"); - isNotNull(StationAttributeEntity::getMonitorId); - orderByAsc(StationAttributeEntity::getSort); - }}); - // 监测点存储list - List list = new ArrayList<>(); - stationList.forEach(station->{ - StationRealVo stationRealVo = new StationRealVo(); - stationRealVo.setStation(station.getCode()); - List realDeviceList = this.getRealDeviceList(station.getRefDept(),eminfoAndEmParams); - // 厂站匹配站点监测点集合 - List realWsList = wsMonitorList.stream().filter( - o -> Func.isNotEmpty(o.getStation()) && o.getStation().equals(station.getCode()) - ).map(AnalyzeCodeBySignagesVO::getRealId).collect(Collectors.toList()); - // 实时监控匹配站点监测点集合 - List realTimeList = timeList.stream().filter(o -> null != o.getStationId() && o.getStationId().equals(station.getCode())).map(StationAttributeEntity::getMonitorId).collect(Collectors.toList()); - if(CollectionUtil.isNotEmpty(realTimeList)){ - realDeviceList.addAll(realTimeList); - } - if(CollectionUtil.isNotEmpty(realWsList)) { - realDeviceList.addAll(realWsList); - } - if(CollectionUtil.isEmpty(realDeviceList)){ - return; - } - List realList = realDeviceList.stream().distinct().collect(Collectors.toList()); - String[] realArr = StringUtil.join(realList,",").split(","); - stationRealVo.setRealId(realArr); - list.add(stationRealVo); - }); - redisTemplate.opsForValue().set(moniter_realId_key,list); - } - - - - private List getRealIdByWsCodeAndSign() { - R> wsInfoListR = workshopInfoClient.getAllWorkshop(); - List wsInfoList = Optional.ofNullable(wsInfoListR).filter(r -> r.isSuccess() && CollectionUtil.isNotEmpty(wsInfoListR.getData())) - .map(R::getData).orElse(null); - if(CollectionUtil.isEmpty(wsInfoList)) { - return Lists.newArrayList(); - } - Function getAnalyzeCodePO = wsCode -> { - MultiAnalyzeCodePO multiAnalyzeCodePO = new MultiAnalyzeCodePO(); - multiAnalyzeCodePO.setDeviceCode(wsCode); - multiAnalyzeCodePO.setSignages(Lists.newArrayList(HomePageConstant.PV_JOINT_RELAY,HomePageConstant.PV_REACTIVE_POWER,HomePageConstant.PV_GENERATION_CAPACITY)); - return multiAnalyzeCodePO; - }; - List analyzeCodePOList = wsInfoList.stream().map(WorkshopInfoEntity::getNumber).map(getAnalyzeCodePO).collect(Collectors.toList()); - R> analyzeCodeBySignages = analyseDataSearchClient.getAnalyzeCodeBySignages(analyzeCodePOList); - return Optional.ofNullable(analyzeCodeBySignages).filter(r -> r.isSuccess()).map(R::getData).orElse(Lists.newArrayList()); - } - - - - /** - * 获取站点realId - * @param refDept - * @param eminfoAndEmParams - * @return - */ - private List getRealDeviceList(Long refDept, List eminfoAndEmParams) { - // 参数检查 - if(CollectionUtil.isEmpty(eminfoAndEmParams) || ObjectUtil.isEmpty(refDept)){ - return new ArrayList<>(); - } - // 有效设备 - List filters = eminfoAndEmParams.stream().filter(o-> o.getCreateDept().equals(refDept)).collect(Collectors.toList()); - if(CollectionUtil.isEmpty(filters)){ - return new ArrayList<>(); - } - // 遍历设备 - List result = new ArrayList<>(); - for(EminfoAndEmParamVo device : filters){ - result.addAll(device.getPoint().values()); - } - return result; - } -} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StationAttrConfigServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StationAttrConfigServiceImpl.java deleted file mode 100644 index 58bd475..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StationAttrConfigServiceImpl.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.hnac.hzims.scheduled.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.hnac.hzims.operational.station.entity.StationAttrConfigEntity; -import com.hnac.hzims.scheduled.mapper.operation.StationAttrConfigMapper; -import com.hnac.hzims.scheduled.service.IStationAttrConfigService; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.mp.base.BaseServiceImpl; -import org.springblade.core.tool.utils.CollectionUtil; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/19 16:07 - */ -@Service -@Slf4j -@AllArgsConstructor -public class StationAttrConfigServiceImpl extends BaseServiceImpl - implements IStationAttrConfigService { - - - @Override - public List getHideList() { - List list = this.list(new QueryWrapper() {{ - eq("ENABLE_SHOW", false); - eq("IS_DELETED",0); - }}); - if(CollectionUtil.isEmpty(list)){ - return new ArrayList<>(); - } - return list.stream().map(StationAttrConfigEntity::getEmName).collect(Collectors.toList()); - } - -} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StationAttributeServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StationAttributeServiceImpl.java deleted file mode 100644 index ae6cc6c..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StationAttributeServiceImpl.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.hnac.hzims.scheduled.service.impl; - -import com.hnac.hzims.operational.station.entity.StationAttributeEntity; -import com.hnac.hzims.scheduled.mapper.operation.StationAttributeMapper; -import com.hnac.hzims.scheduled.service.IStationAttributeService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.mp.base.BaseServiceImpl; -import org.springframework.stereotype.Service; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/19 11:39 - */ -@Service -@Slf4j -@RequiredArgsConstructor -public class StationAttributeServiceImpl extends BaseServiceImpl implements IStationAttributeService { - -} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StationServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StationServiceImpl.java deleted file mode 100644 index 7490ba6..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StationServiceImpl.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.hnac.hzims.scheduled.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.hnac.hzims.operational.station.entity.StationEntity; -import com.hnac.hzims.scheduled.mapper.operation.StationMapper; -import com.hnac.hzims.scheduled.service.IStationService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.mp.base.BaseServiceImpl; -import org.springblade.core.tool.utils.CollectionUtil; -import org.springblade.core.tool.utils.ObjectUtil; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/19 10:36 - */ -@Service -@RequiredArgsConstructor -@Slf4j -public class StationServiceImpl extends BaseServiceImpl implements IStationService { - - @Override - public List getStationByType(Integer stationType, Integer serveType) { - return this.baseMapper.selectStationByType(stationType, serveType); - } - - @Override - public List getAll() { - return this.baseMapper.selectAll(); - } - - - @Override - public List getStationByInCode(List codes) { - return this.baseMapper.selectStationByInCode(codes); - } - - - - @Override - public List getStationType(Integer serveType, List typeList, List departIdList) { - return this.list(new LambdaQueryWrapper() {{ - eq(StationEntity::getIsDeleted, 0); - if (ObjectUtil.isNotEmpty(serveType)) { - eq(StationEntity::getServeType, serveType); - } - if (CollectionUtil.isNotEmpty(typeList)) { - in(StationEntity::getType, typeList); - } - if (CollectionUtil.isNotEmpty(departIdList)) { - in(StationEntity::getRefDept, departIdList); - } - }}); - } -} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/WaterServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/WaterServiceImpl.java deleted file mode 100644 index 0218fe0..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/WaterServiceImpl.java +++ /dev/null @@ -1,201 +0,0 @@ -package com.hnac.hzims.scheduled.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.hnac.hzims.EquipmentConstants; -import com.hnac.hzims.operational.main.constant.HomePageConstant; -import com.hnac.hzims.operational.main.vo.WaterLevelVo; -import com.hnac.hzims.operational.station.entity.HzimsAnalyzeModelStationEntity; -import com.hnac.hzims.operational.station.entity.StationEntity; -import com.hnac.hzims.scheduled.service.IHzimsAnalyzeModelStationService; -import com.hnac.hzims.scheduled.service.IStationService; -import com.hnac.hzims.scheduled.service.IWaterService; -import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient; -import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData; -import com.hnac.hzinfo.datasearch.analyse.po.AnalyseCodeByAnalyseDataPO; -import com.hnac.hzinfo.datasearch.analyse.po.AnalyzeDataConditionPO; -import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO; -import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeDataConditionVO; -import com.hnac.hzinfo.datasearch.real.po.RealDataSearchPO; -import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.CollectionUtil; -import org.springblade.core.tool.utils.DateUtil; -import org.springblade.core.tool.utils.StringUtil; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.stereotype.Service; - -import java.time.LocalDateTime; -import java.util.*; -import java.util.stream.Collectors; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/22 11:23 - */ -@Service -@RequiredArgsConstructor -@Slf4j -public class WaterServiceImpl implements IWaterService { - - - private final IStationService stationService; - - - private final IHzimsAnalyzeModelStationService modelStationService; - - - - private final IAnalyseDataSearchClient analyseDataSearchClient; - - - - private final RedisTemplate redisTemplate; - - - - private final static String loadwater_level_key = "hzims:operation:loadwater:level:key"; - /** - * 水利-站点水位数据 - * @param param - */ - @Override - public void loadWaterLevel(String param) { - // 有效站点模型 - List modelList = getModelStationList(); - if(CollectionUtil.isEmpty(modelList)){ - return; - } - List list = new ArrayList<>(); - modelList.forEach(item -> { - List multiAnalyzeCodePOList = new ArrayList<>(); - MultiAnalyzeCodePO multiAnalyzeCodePO = new MultiAnalyzeCodePO(); - multiAnalyzeCodePO.setDeviceCode(item.getInstanceCode()); - multiAnalyzeCodePO.setSignages(Collections.singletonList(HomePageConstant.FRONT_WATER_LEVEL)); - multiAnalyzeCodePOList.add(multiAnalyzeCodePO); - R> result = analyseDataSearchClient.getAnalyzeCodeBySignages(multiAnalyzeCodePOList); - if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ - return; - } - WaterLevelVo waterLevelVo = new WaterLevelVo(); - waterLevelVo.setStationCode(item.getStationId()); - // 前水位 - double frontWaterLevel = this.getWaterLevel(item.getInstanceCode(),HomePageConstant.FRONT_WATER_LEVEL); - waterLevelVo.setFrontWaterLevel(frontWaterLevel); - // 后水位 - double rearWaterLevel = this.getWaterLevel(item.getInstanceCode(),HomePageConstant.REAR_WATER_LEVEL); - waterLevelVo.setRearWaterLevel(rearWaterLevel); - // 前水位当日曲线 - Map frontCurveMap = this.getWaterLevelMap(item.getInstanceCode(),HomePageConstant.FRONT_WATER_LEVEL); - waterLevelVo.setFrontCurveMap(frontCurveMap); - // 后水位当日曲线 - Map rearCurveMap = this.getWaterLevelMap(item.getInstanceCode(),HomePageConstant.REAR_WATER_LEVEL); - waterLevelVo.setRearCurveMap(rearCurveMap); - list.add(waterLevelVo); - }); - redisTemplate.opsForValue().set(loadwater_level_key,list); - } - - - /** - * 获取水位实时数据 - * @param instanceCode - * @param signage - * @return - */ - private double getWaterLevel(String instanceCode, String signage) { - RealDataSearchPO realData = new RealDataSearchPO(); - realData.setAnalyzeCode(instanceCode); - List signages = Collections.singletonList(signage); - realData.setSignages(signages); - // 调用fegin接口查询实时数据 - R> R = analyseDataSearchClient.getRealDataByAnalyzeCode(realData); - if(!R.isSuccess() || CollectionUtil.isEmpty(R.getData())){ - return 0.0; - } - // 时间限制 - String time = R.getData().get(0).getTime(); - if(StringUtil.isEmpty(time) || "-".equals(time)){ - return 0.0; - } - Date date = DateUtil.parse(time, "yyyy-MM-dd HH:mm:ss.sss"); - if(System.currentTimeMillis() - date.getTime() > 30 * 60 * 1000L){ - return 0.0; - } - return Double.parseDouble(R.getData().get(0).getValue()); - } - - - - /** - * 获取水位当年数据 - * @param instanceCode - * @param signage - * @return - */ - private Map getWaterLevelMap(String instanceCode, String signage) { - LocalDateTime beginTime = LocalDateTime.parse(DateUtil.format(new Date(), "yyyy-MM-dd 00:00:00"), DateUtil.DATETIME_FORMATTER); - LocalDateTime endTime = LocalDateTime.now(); - AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO(); - List signboardConditions = new ArrayList<>(); - AnalyzeDataConditionPO analyzeDataConditionPO = new AnalyzeDataConditionPO(); - analyzeDataConditionPO.setFull(1); - analyzeDataConditionPO.setSignages(signage); - // 取数规则: 0=(整点值/最早值)、1=最大值、2=最小值、3=平均值、4=(累计值/和值)、5=(变化值/差值) 6=最新值 - analyzeDataConditionPO.setAccessRules(EquipmentConstants.AccessRulesEnum.FINAL_CYCLE.getType()); - // 周期类型: 0-> s(秒) 1->、m(分)、2->h(小时)3->、d(天)4->、w(周)5->、n(自然月)、6->y(自然年) - analyzeDataConditionPO.setSaveTimeType(2); - // 间隔 - analyzeDataConditionPO.setTimeInterval(1); - analyzeDataConditionPO.setBeginTime(beginTime); - analyzeDataConditionPO.setEndTime(endTime); - signboardConditions.add(analyzeDataConditionPO); - po.setDeviceCode(instanceCode); - po.setSignboardConditions(signboardConditions); - R> R = analyseDataSearchClient.getAnalyzeDataByAnalyzeCodeAndSignages(po); - if(!R.isSuccess() || CollectionUtil.isEmpty(R.getData())){ - return null; - } - if(CollectionUtil.isEmpty(R.getData().get(0).getList())){ - return null; - } - return R.getData().get(0).getList().stream().collect(Collectors.toMap(key-> { - Date dateTime = DateUtil.parse(key.getTs(), "yyyy-MM-dd HH:mm:ss.s"); - return dateTime.getHours(); - }, value -> { - if(StringUtil.isBlank(value.getVal())){ - return "0"; - } - return value.getVal(); - })); - } - - /** - * 获取有效站点模型 - * @return - */ - private List getModelStationList() { - // 水利站点(All) - List stationList = stationService.getStationType(HomePageConstant.HYDROPOWER_SERVETYPE, null, null); - if(CollectionUtil.isEmpty(stationList)){ - return null; - } - // 站点code集合 - List codes = stationList.stream().map(StationEntity::getCode).collect(Collectors.toList()); - if(CollectionUtil.isEmpty(codes)){ - return null; - } - // 查询站点模型列表 - List list = modelStationService.list(new LambdaQueryWrapper() {{ - in(HzimsAnalyzeModelStationEntity::getStationId, codes); - }}); - if(CollectionUtil.isEmpty(list)){ - return null; - } - return list; - } -} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/AbnormalAlarmService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/AbnormalAlarmService.java new file mode 100644 index 0000000..53997ff --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/AbnormalAlarmService.java @@ -0,0 +1,15 @@ +package com.hnac.hzims.scheduled.service.operation; + +import com.hnac.hzims.operational.alert.entity.AbnormalAlarmEntity; +import org.springblade.core.mp.base.BaseService; + +import java.util.List; + +/** + * 告警处理接口 + * @author ysj + */ +public interface AbnormalAlarmService extends BaseService { + + List abnormalAlarms(); +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/AnalyseDataService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/AnalyseDataService.java new file mode 100644 index 0000000..7f2fb5c --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/AnalyseDataService.java @@ -0,0 +1,22 @@ +package com.hnac.hzims.scheduled.service.operation; + +import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO; +import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO; +import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO; + +import java.util.List; +import java.util.function.Function; + + +/** + * @author ysj + */ +public interface AnalyseDataService { + + List getAnalyzeCodeBySignages(Function convert, T resource); + + + List periodTargetData(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, String signages); + + Float periodTargetFloat(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, Integer ride ,String signages); +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/GenerateService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/GenerateService.java new file mode 100644 index 0000000..8f9e1b1 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/GenerateService.java @@ -0,0 +1,25 @@ +package com.hnac.hzims.scheduled.service.operation; + +import com.hnac.hzims.operational.fill.entity.GenerateEntity; +import com.hnac.hzims.operational.main.vo.GenerationPowerVo; +import com.hnac.hzims.operational.main.vo.PowerMonthVo; +import org.springblade.core.mp.base.BaseService; + +import java.util.List; + +/** + * @author ysj + * @date 2023/04/10 11:16:07 + * @version 4.0.0 + */ +public interface GenerateService extends BaseService { + + // 查询填报用电量 + Float generate(String date,String station); + + // 查询30天填报用电量 + List generate30Day(String day, String station); + + // 获取站点填报发电量 + List generateThreeYear(String start, String end, String station); +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/ModelStationService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/ModelStationService.java new file mode 100644 index 0000000..e8e4560 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/ModelStationService.java @@ -0,0 +1,12 @@ +package com.hnac.hzims.scheduled.service.operation; + + +import com.hnac.hzims.operational.station.entity.HzimsAnalyzeModelStationEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface ModelStationService extends BaseService { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/MonitorService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/MonitorService.java new file mode 100644 index 0000000..087a7e5 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/MonitorService.java @@ -0,0 +1,16 @@ +package com.hnac.hzims.scheduled.service.operation; + +/** + * WEB水电站首页接口 + * @author ysj + */ +public interface MonitorService { + + // realId刷新 + void loadRealId(String param); + + // 集中监控数据处理 + void loadMonitoring(String param); + + void loadRealData(String param); +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/PowerService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/PowerService.java new file mode 100644 index 0000000..d6d3007 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/PowerService.java @@ -0,0 +1,17 @@ +package com.hnac.hzims.scheduled.service.operation; + +import com.hnac.hzims.operational.fill.entity.PowerEntity; +import com.hnac.hzims.operational.main.vo.PowerMonthVo; +import org.springblade.core.mp.base.BaseService; + +import java.util.List; + +/** + * @author ysj + */ +public interface PowerService extends BaseService { + + Double generate(String date,Long station); + + List generateThreeYear(String start,String end,Long station); +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/RealTargetService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/RealTargetService.java new file mode 100644 index 0000000..43afd9e --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/RealTargetService.java @@ -0,0 +1,34 @@ +package com.hnac.hzims.scheduled.service.operation; + +import java.util.List; + +/** + * WEB水电站首页接口 + * @author ysj + */ +public interface RealTargetService { + + // 水电站实时数据加载 + void loadHydropowerReal(String param); + + // 水电站指标数据加载 + void loadHydropowerTarget(String param); + + // 泵站实时数据加载 + void loadWaterPumpReal(String param); + + // 泵站指标数据加载 + void loadWaterPumpTarget(String param); + + // 站点水位指标数据 + void loadWaterLevel(String param); + + // 光伏站实时数据加载 + void loadPhotovoltaicReal(String param); + + // 光伏站指标数据加载 + void loadPhotovoltaicTarget(String param); + + // 光伏、水电站近3年发电量 + void loadPowerData(String param, List types, Integer serveType, int year); +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/RecordService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/RecordService.java new file mode 100644 index 0000000..00da41d --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/RecordService.java @@ -0,0 +1,13 @@ +package com.hnac.hzims.scheduled.service.operation; + + +import com.hnac.hzims.operational.config.entity.StAlarmRecordEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface RecordService extends BaseService { + + Long insertAlert(String stationId, String monitorId); +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/StationAttrConfigService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/StationAttrConfigService.java new file mode 100644 index 0000000..47dce3f --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/StationAttrConfigService.java @@ -0,0 +1,14 @@ +package com.hnac.hzims.scheduled.service.operation; + +import com.hnac.hzims.operational.station.entity.StationAttrConfigEntity; +import org.springblade.core.mp.base.BaseService; + +import java.util.List; + +/** + * @author ysj + */ +public interface StationAttrConfigService extends BaseService { + + List getHideList(); +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/StationAttributeService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/StationAttributeService.java new file mode 100644 index 0000000..53479ba --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/StationAttributeService.java @@ -0,0 +1,14 @@ +package com.hnac.hzims.scheduled.service.operation; + +import com.hnac.hzims.operational.station.entity.StationAttributeEntity; +import org.springblade.core.mp.base.BaseService; + +import java.util.Map; + +/** + * @author hx + */ +public interface StationAttributeService extends BaseService { + + Map PointUnit(); +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/StationService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/StationService.java new file mode 100644 index 0000000..2757282 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/StationService.java @@ -0,0 +1,12 @@ +package com.hnac.hzims.scheduled.service.operation; + +import com.hnac.hzims.operational.station.entity.StationEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface StationService extends BaseService { + + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/UseService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/UseService.java new file mode 100644 index 0000000..72dc927 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/UseService.java @@ -0,0 +1,29 @@ +package com.hnac.hzims.scheduled.service.operation; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.hnac.hzims.operational.fill.entity.UseEntity; +import com.hnac.hzims.operational.fill.vo.QueryVo; +import com.hnac.hzims.operational.fill.vo.UseVo; +import com.hnac.hzims.operational.main.vo.UsrPowerVo; +import org.springblade.core.mp.base.BaseService; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; + +import java.util.List; +import java.util.Map; + +/** + * @author ysj + * @date 2023/04/10 11:16:07 + * @version 4.0.0 + */ +public interface UseService extends BaseService { + + // 查询填报用电量 + Float use(String date,String station); + + // 查询30天填报用电量 + List use30Day(String day, String station); + + Map generateThreeYear(String start, String end, String station); +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/AbnormalAlarmServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/AbnormalAlarmServiceImpl.java new file mode 100644 index 0000000..fa8ef8a --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/AbnormalAlarmServiceImpl.java @@ -0,0 +1,33 @@ +package com.hnac.hzims.scheduled.service.operation.impl; + +import com.hnac.hzims.operational.alert.entity.AbnormalAlarmEntity; +import com.hnac.hzims.scheduled.mapper.operation.AbnormalAlarmMapper; +import com.hnac.hzims.scheduled.service.operation.AbnormalAlarmService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + * 告警实现类 + * @author ysj + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class AbnormalAlarmServiceImpl extends BaseServiceImpl implements AbnormalAlarmService { + + + @Override + public List abnormalAlarms() { + List alarmList = this.baseMapper.abnormalAlarms(); + if(CollectionUtil.isEmpty(alarmList)){ + return new ArrayList<>(); + } + return alarmList; + } +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/AnalyseDataServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/AnalyseDataServiceImpl.java new file mode 100644 index 0000000..b469c8a --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/AnalyseDataServiceImpl.java @@ -0,0 +1,139 @@ +package com.hnac.hzims.scheduled.service.operation.impl; + +import com.google.common.collect.Lists; +import com.hnac.hzims.scheduled.service.operation.AnalyseDataService; +import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient; +import com.hnac.hzinfo.datasearch.analyse.po.AnalyseCodeByAnalyseDataPO; +import com.hnac.hzinfo.datasearch.analyse.po.AnalyzeDataConditionPO; +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.sdk.analyse.po.MultiAnalyzeCodePO; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.DateUtil; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.core.tool.utils.StringUtil; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Optional; +import java.util.function.Function; +import java.util.stream.Collectors; + +/** + * @author hx + */ +@Service +@AllArgsConstructor +@Slf4j +public class AnalyseDataServiceImpl implements AnalyseDataService { + + private final IAnalyseDataSearchClient analyseDataSearchClient; + + @Override + public List getAnalyzeCodeBySignages(Function convert, T resource) { + List result = Lists.newArrayList(); + List multiAnalyzeCodePOList = Lists.newArrayList(resource).stream().map(convert).collect(Collectors.toList()); + R> analyzeCodeBySignResult = analyseDataSearchClient.getAnalyzeCodeBySignages(multiAnalyzeCodePOList); + if(analyzeCodeBySignResult.isSuccess() && CollectionUtil.isNotEmpty(analyzeCodeBySignResult.getData())) { + result = analyzeCodeBySignResult.getData(); + } + return result; + } + + /*** + * 指标数据列表查询 + * @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 periodTargetData(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, String signages) { + AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO(); + List signboardConditions = new ArrayList<>(); + AnalyzeDataConditionPO analyzeDataConditionPO = new AnalyzeDataConditionPO(); + analyzeDataConditionPO.setFull(1); + po.setDeviceCode(deviceCode); + analyzeDataConditionPO.setSignages(signages); + analyzeDataConditionPO.setKeepFigures(2); + analyzeDataConditionPO.setAccessRules(accessRules); + analyzeDataConditionPO.setSaveTimeType(cycleType); + // 间隔 + 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_target_data_request {}",po); + R> result = analyseDataSearchClient.getAnalyzeDataByAnalyzeCodeAndSignages(po); + if (!result.isSuccess() || CollectionUtil.isEmpty(result.getData())) { + return new ArrayList<>(); + } + log.error("period_target_data_resp {}",result); + return result.getData().get(0).getList(); + } + + /*** + * 指标数据列表查询 + * @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 + */ + @Override + public Float periodTargetFloat(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode,Integer ride,String signages) { + AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO(); + List signboardConditions = new ArrayList<>(); + AnalyzeDataConditionPO analyzeDataConditionPO = new AnalyzeDataConditionPO(); + analyzeDataConditionPO.setFull(1); + po.setDeviceCode(deviceCode); + analyzeDataConditionPO.setSignages(signages); + analyzeDataConditionPO.setKeepFigures(2); + analyzeDataConditionPO.setAccessRules(accessRules); + analyzeDataConditionPO.setSaveTimeType(cycleType); + // 间隔 + 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); + R> result = analyseDataSearchClient.getAnalyzeDataByAnalyzeCodeAndSignages(po); + if (!result.isSuccess() || CollectionUtil.isEmpty(result.getData())) { + return 0f; + } + List records = result.getData(); + if(CollectionUtil.isEmpty(records)){ + return 0f; + } + AnalyzeDataConditionVO analyzeDataConditionVO = records.get(0); + if (ObjectUtil.isEmpty(analyzeDataConditionVO)) { + return 0f; + } + List analyseDataTaosVOList = analyzeDataConditionVO.getList(); + if (CollectionUtil.isEmpty(analyseDataTaosVOList)) { + return 0f; + } + AnalyseDataTaosVO analyseDataTaosVO = analyzeDataConditionVO.getList().get(0); + if (ObjectUtil.isEmpty(analyseDataTaosVO) || StringUtil.isBlank(analyseDataTaosVO.getVal())) { + return 0f; + } + return Float.parseFloat(Optional.ofNullable(analyseDataTaosVO.getVal()).orElse("0")) * ride; + } + + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/GenerateServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/GenerateServiceImpl.java new file mode 100644 index 0000000..470f95e --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/GenerateServiceImpl.java @@ -0,0 +1,112 @@ +package com.hnac.hzims.scheduled.service.operation.impl; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hnac.hzims.operational.fill.entity.GenerateEntity; +import com.hnac.hzims.operational.main.vo.GenerationPowerVo; +import com.hnac.hzims.operational.main.vo.PowerMonthVo; +import com.hnac.hzims.scheduled.mapper.operation.GenerateMapper; +import com.hnac.hzims.scheduled.service.operation.GenerateService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.DateUtil; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author ysj + * @date 2023/04/10 11:16:07 + * @version 4.0.0 + */ +@Slf4j +@Service +@AllArgsConstructor +public class GenerateServiceImpl extends BaseServiceImpl implements GenerateService { + + /** + * 根据时间、机构查询用电量 + * @param date 时间: 年 - yyyy/月 yyyy-mm/日 yyyy-mm-dd + * @param station 所属机构 + * @return + */ + @Override + public Float generate(String date, String station) { + List powers = this.list(Wrappers.lambdaQuery() + .likeRight(GenerateEntity::getFillDate,date) + .eq(GenerateEntity::getStationCode,station) + ); + if(CollectionUtil.isEmpty(powers)){ + return 0f; + } + return (float) powers.stream().mapToDouble(GenerateEntity::getGenerate).sum(); + } + + /** + * 查询30天填报用电量 + * @param day : 结束日期 yyyy-MM-dd + * @param station 站点编码 + * @return + */ + @Override + public List generate30Day(String day, String station) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(DateUtil.parse(day,DateUtil.PATTERN_DATE)); + String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE); + calendar.add(Calendar.DAY_OF_MONTH,-29); + String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE); + List records = this.list(Wrappers.lambdaQuery() + .between(GenerateEntity::getFillDate,start,end) + .eq(GenerateEntity::getStationCode,station) + ); + if(CollectionUtil.isEmpty(records)){ + return new ArrayList<>(); + } + return records.stream().map(record->{ + GenerationPowerVo generate = new GenerationPowerVo(); + generate.setDate(record.getFillDate()); + if(Math.abs(record.getGenerate()) <= 0){ + generate.setGenerate(0f); + }else{ + generate.setGenerate(Float.parseFloat(record.getGenerate().toString())); + } + return generate; + }).collect(Collectors.toList()); + } + + /** + * + * @param start 时间: 年 - yyyy/月 yyyy-mm/日 yyyy-mm-dd + * @param end 时间: 年 - yyyy/月 yyyy-mm/日 yyyy-mm-dd + * @param station 站点编码 + * @return + */ + @Override + public List generateThreeYear(String start, String end, String station) { + List records = this.list(Wrappers.lambdaQuery() + .eq(GenerateEntity::getStationCode,station) + .between(GenerateEntity::getFillDate,start,end) + ); + if(CollectionUtil.isEmpty(records)){ + return new ArrayList<>(); + } + // 返回结果 + return records.stream().peek( + record-> record.setFillDate(DateUtil.format(DateUtil.parse(record.getFillDate(),"yyyy-MM"),"yyyy-MM") + "-01") + ).collect(Collectors.toMap(GenerateEntity::getFillDate,GenerateEntity::getGenerate,Double::sum)). + entrySet().stream().map(entry->{ + PowerMonthVo mon = new PowerMonthVo(); + mon.setStrMonth(entry.getKey()); + if(Math.abs(entry.getValue()) <= 0){ + mon.setPower(0f); + }else{ + mon.setPower(Float.parseFloat(entry.getValue().toString())); + } + return mon; + }).collect(Collectors.toList()); + } +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/ModelStationServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/ModelStationServiceImpl.java new file mode 100644 index 0000000..946fdab --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/ModelStationServiceImpl.java @@ -0,0 +1,16 @@ +package com.hnac.hzims.scheduled.service.operation.impl; + + +import com.hnac.hzims.operational.station.entity.HzimsAnalyzeModelStationEntity; +import com.hnac.hzims.scheduled.mapper.operation.ModelStationMapper; +import com.hnac.hzims.scheduled.service.operation.ModelStationService; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +/** + * @author ysj + */ +@Service +public class ModelStationServiceImpl extends BaseServiceImpl implements ModelStationService { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/MonitorServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/MonitorServiceImpl.java new file mode 100644 index 0000000..06145f6 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/MonitorServiceImpl.java @@ -0,0 +1,744 @@ +package com.hnac.hzims.scheduled.service.operation.impl; + +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.TypeReference; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +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; +import com.hnac.hzims.operational.main.vo.RealAttributeVo; +import com.hnac.hzims.operational.main.vo.RealDeviceVo; +import com.hnac.hzims.operational.main.vo.RealStationVo; +import com.hnac.hzims.operational.station.entity.StationAttributeEntity; +import com.hnac.hzims.operational.station.entity.StationEntity; +import com.hnac.hzims.scheduled.service.equipment.WorkshopInfoService; +import com.hnac.hzims.scheduled.service.operation.*; +import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient; +import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO; +import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO; +import com.hnac.hzinfo.sdk.v5.redis.RedisClient; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.MapUtils; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.*; +import org.springblade.system.entity.Dept; +import org.springblade.system.feign.ISysClient; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Service; + +import java.util.*; +import java.util.concurrent.*; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * 集中监控数据获取实现类 + * @author ysj + */ +@Service +@RequiredArgsConstructor +@Slf4j +public class MonitorServiceImpl implements MonitorService { + + private final RecordService alertService; + private final StationService stationService; + private final StationAttributeService attbtService; + private final WorkshopInfoService workshopInfoService; + private final AbnormalAlarmService abnormalAlarmService; + private final StationAttrConfigService attrConfigService; + private final RedisTemplate redisTemplate; + private final ISysClient sysClient; + private final RedisClient redisClient; + private final IAnalyseDataSearchClient analyseDataSearchClient; + + @Value("${hzims.equipment.emInfo.emInfoList}") + public String device_cache_final; + + @Value("${hzims.operation.realIdKey}") + public String real_cache_final; + + @Value("${hzims.operation.realIdKeyGather}") + public String real_gather_cache_final; + + @Value("${hzims.operation.realIdKeyGather}") + public String real_data_cache_final; + + @Value("${hzims.equipment.fdp.redisData}") + public String fdp_fault_cache_final; + + @Value("${hzims.equipment.fdp.lessThan}") + public Double less_than_cache_final; + + @Value("${hzims.equipment.fdp.greaterThan}") + public Double greater_than_cache_final; + + @Value("${hzims.operation.monitor.realId}") + public String moniter_realId_cache_final; + + @Value("${hzims.operation.monitor.station}") + public String moniter_station_cache_final; + + @Value("${hzims.equipment.fdp.beEqualOrGreaterThan}") + public Double be_equa_cache_final; + + @Value("${hzims.operation.region.deviceClassifyKey}") + private String device_classify_cache_final; + + @Override + public void loadRealId(String param) { + // 所有站点 + List stationList = stationService.list(); + if(CollectionUtil.isEmpty(stationList)){ + return; + } + // 设备监测点list + Object json = redisTemplate.opsForValue().get(device_cache_final); + List eminfoAndEmParams = JSONObject.parseObject(json.toString(), new TypeReference>() {}); + // 厂房监测点list + List wsMonitorList = this.getRealIdByWsCodeAndSign(); + // 实时监控监测点list + List timeList = attbtService.list(new LambdaQueryWrapper() {{ + eq(StationAttributeEntity::getIsDeleted, "0"); + isNotNull(StationAttributeEntity::getMonitorId); + orderByAsc(StationAttributeEntity::getSort); + }}); + // 监测点存储list + List list = new ArrayList<>(); + stationList.forEach(station->{ + StationRealVo stationRealVo = new StationRealVo(); + stationRealVo.setStation(station.getCode()); + List realDeviceList = this.getRealDeviceList(station.getRefDept(),eminfoAndEmParams); + // 厂站匹配站点监测点集合 + List realWsList = wsMonitorList.stream().filter( + o -> Func.isNotEmpty(o.getStation()) && o.getStation().equals(station.getCode()) + ).map(AnalyzeCodeBySignagesVO::getRealId).collect(Collectors.toList()); + // 实时监控匹配站点监测点集合 + List realTimeList = timeList.stream().filter(o -> null != o.getStationId() && o.getStationId().equals(station.getCode())).map(StationAttributeEntity::getMonitorId).collect(Collectors.toList()); + if(CollectionUtil.isNotEmpty(realTimeList)){ + realDeviceList.addAll(realTimeList); + } + if(CollectionUtil.isNotEmpty(realWsList)) { + realDeviceList.addAll(realWsList); + } + if(CollectionUtil.isEmpty(realDeviceList)){ + return; + } + List realList = realDeviceList.stream().distinct().collect(Collectors.toList()); + String[] realArr = StringUtil.join(realList,",").split(","); + stationRealVo.setRealId(realArr); + list.add(stationRealVo); + }); + redisTemplate.opsForValue().set(moniter_realId_cache_final,list); + } + + @Override + public void loadRealData(String param) { + // 获取设备 + List devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_final).toString(),new TypeReference>() {});; + // 设备开关机集合监测点 + List switchOnOff = devices.stream().map(o->{ + Map points = o.getPoint(); + if(CollectionUtil.isEmpty(points)){ + return ""; + } + String jointRelay = points.get(HomePageConstant.JOINT_RELAY); + if(!StringUtil.isEmpty(jointRelay)){ + return jointRelay; + } + String onOff = points.get(HomePageConstant.SWITCH_ON_OFF); + if(!StringUtil.isEmpty(onOff)){ + return onOff; + } + return ""; + }).collect(Collectors.toList()); + // 获取站点缓存数据 + List stationRealVos = (List) redisTemplate.opsForValue().get(moniter_realId_cache_final); + if(CollectionUtil.isEmpty(stationRealVos)){ + return; + } + // 数据切割 + int limit = countStep(stationRealVos.size()); + List> list = Stream.iterate(0, n -> n + 1).limit(limit).parallel().map(a -> stationRealVos.stream().skip((long) a * 5).limit(5).parallel().collect(Collectors.toList())).collect(Collectors.toList()); + ExecutorService pool = Executors.newFixedThreadPool(limit); + // + Map valueMap = new ConcurrentHashMap<>(); + // > + Map> keyMap = new ConcurrentHashMap<>(); + CountDownLatch countDownLatch = new CountDownLatch(limit); + pool.execute(()-> list.forEach(stations -> { + stations.forEach(stationReal -> { + String[] realIdArr = stationReal.getRealId(); + List realIds = Stream.of(realIdArr).collect(Collectors.toList()); + if(CollectionUtil.isEmpty(realIds)){ + return; + } + 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{ + Map attribute = (Map) JSONObject.parse(objects.get(i)); + attribute.put("realId",attribute.get("k")); + attribute.put("value",attribute.get("v")); + attribute.put("time",attribute.get("t")); + attribute.remove("v"); + attribute.remove("k"); + attribute.remove("t"); + this.getCheckMap(attribute,switchOnOff); + valueMap.put(realIdArr[i],attribute.get("value")); + keyMap.put(realIdArr[i],attribute); + } + } + }); + countDownLatch.countDown(); + })); + // 等待所有线程执行完成 + try { + countDownLatch.await(); + } catch (InterruptedException e) { + e.printStackTrace(); + Thread.currentThread().interrupt(); + } + pool.shutdown(); + // redis 存储 + redisTemplate.opsForValue().set(real_cache_final,JSONObject.toJSONString(valueMap)); + redisTemplate.opsForValue().set(real_gather_cache_final,JSONObject.toJSONString(keyMap)); + } + + /** + * 计算切分次数 + */ + private static Integer countStep(Integer size) { + return (size + 5 - 1) / 5; + } + + /** + * 监测点过期数据检查 + * @param value + * @return + */ + private void getCheckMap(Map value,List switchOnOff){ + // 不处理开机状态监测点 + if(switchOnOff.contains(value.get("realId"))){ + return; + } + String time = value.get("time"); + if(StringUtil.isEmpty(time)){ + return; + } + Date date = DateUtil.parse(time,DateUtil.PATTERN_DATETIME); + // 实时数据超出10分钟未刷新,值置为 0 显示 + if(System.currentTimeMillis() - date.getTime() > 10 * 60 * 1000L){ + value.put("value","0"); + } + } + + /** + * 集中监控数据处理 + * @param param + */ + @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)) { + return; + } + // 获取所有设备重点属性 + List list = attbtService.list(new LambdaQueryWrapper() {{ + isNotNull(StationAttributeEntity::getStationId); + eq(StationAttributeEntity::getIsDeleted, "0"); + orderByAsc(StationAttributeEntity::getSort); + }}); + if (CollectionUtil.isEmpty(list)) { + return; + } + // 获取所有告警记录 + List alertList = alertService.list(new LambdaQueryWrapper() {{ + orderByDesc(StAlarmRecordEntity::getCreateTime); + }}); + List alarmList = abnormalAlarmService.abnormalAlarms(); + // 获取所有故障记录 + List faultList = this.getFdpFaultAll(); + // 所有设备分类 + 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 hideList = attrConfigService.getHideList(); + // 分割,每个map限制10个长度 + List>> handleList = this.mapChunk(stationAttbtMap); + // 创建线程池 + ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("load-monitoring-pool-%d").build(); + ExecutorService pool = new ThreadPoolExecutor(5, 5, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy()); + CountDownLatch countDownLatch = new CountDownLatch(handleList.size()); + // 所有机构 + R> deptAll = sysClient.getDeptList(); + // 存储数据节点 + List stationList = new CopyOnWriteArrayList<>(); + pool.execute(()->{ + // 线程处理数据 + for(Map> item : handleList){ + item.forEach((key,value)->{ + RealStationVo station = new RealStationVo(); + // 站点编码 + station.setStationCode(key); + // 设置站点状态 + this.setStationStatus(alarmList,station,key); + // 名称、限制水位、服务类型、机构、排序 + this.stationParam(stationEntityList,station,deptAll.getData()); + // 根据设备名称分组 + Map> deviceAttbtMap = value.stream().filter(o -> !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, faultList); + deviceList.add(deviceVo); + }); + // 设备状态 + this.getDeviceParam(devices, deviceClassifyMap, deviceList); + station.setDeviceList(deviceList.stream().sorted(Comparator.comparing((RealDeviceVo::getDeviceName))).collect(Collectors.toList())); + stationList.add(station); + }); + countDownLatch.countDown(); + } + }); + // 等待所有线程执行完成 + try { + countDownLatch.await(); + } catch (InterruptedException e) { + e.printStackTrace(); + Thread.currentThread().interrupt(); + } + pool.shutdown(); + redisTemplate.opsForValue().set(moniter_station_cache_final, stationList); + } + + /** + * 设备处理 + * + * @param list + * @param map + * @param device + */ + private void handleDevice(List list, Map> map, + RealDeviceVo device, List alertList, + List faultList) { + if (CollectionUtil.isEmpty(list) || MapUtils.isEmpty(map)) { + 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); + return; + } + realAttributeVo = handleAttbt(item, real, alertList, faultList); + if (ObjectUtil.isEmpty(realAttributeVo)) { + return; + } + attbtList.add(realAttributeVo); + }); + device.setAttbtList(attbtList); + } + + /** + * 获取站点属性 + * @param stationEntityList + * @param item + */ + private void stationParam(List stationEntityList, RealStationVo item,List deptAll) { + if(CollectionUtil.isEmpty(stationEntityList)){ + return; + } + List filterList = stationEntityList.stream().filter(o->item.getStationCode().equals(o.getCode())).collect(Collectors.toList()); + if(CollectionUtil.isEmpty(filterList)){ + return; + } + StationEntity station = filterList.get(0); + if(ObjectUtil.isEmpty(station)){ + return; + } + item.setStationName(station.getName()); + item.setWaterLevelMax(station.getLimitWaterLevel()); + 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; + } + item.setSort(list.get(0).getSort()); + } + + /** + * 设备参数设置 + * + * @param devices + * @param deviceClassifyMap + * @param deviceList + */ + private void getDeviceParam(List devices, Map> deviceClassifyMap, List deviceList) { + if (CollectionUtil.isEmpty(devices) || CollectionUtil.isEmpty(deviceList) || MapUtils.isEmpty(deviceClassifyMap)) { + 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); + return; + } + String deviceCode = list.get(0).getEmCode(); + if (StringUtil.isBlank(deviceCode)) { + device.setState(-1); + 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); + } + }); + } + + /** + * 设备单条重点属性处理 + * + * @param item + * @param real + * @return + */ + private RealAttributeVo handleAttbt(StationAttributeEntity item, Map real, + List alertList, List faultList) { + RealAttributeVo attest = new RealAttributeVo(); + this.setAttbtParam(attest, real); + attest.setRealId(item.getMonitorId()); + attest.setName(item.getAttributes()); + attest.setUnit(item.getUnit()); + attest.setType(item.getAttributeType()); + String value = Optional.ofNullable(attest.getValue()).orElse("-"); + // 正常状态 + attest.setStatus(ConfigStatus.ConfigStatusEnum.NORMAL.getStatus()); + int quality = Optional.ofNullable(attest.getQuality()).orElse(-1); + String time = Optional.ofNullable(attest.getTime()).orElse(""); + // 延时状态 :质量为空 && 时间为空 + if (-1 == quality && StringUtil.isEmpty(time)) { + attest.setStatus(ConfigStatus.ConfigStatusEnum.GRAY.getStatus()); + } + int type = item.getAttributeType(); + switch (type) { + 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); + //处理 + break; + default: + throw new IllegalStateException("Unexpected type: " + type); + } + // 故障信息设置 + accidentDetails(attest, faultList, value); + return attest; + } + + /** + * 设置重点属性参数 + * + * @param attest + * @param real + */ + private void setAttbtParam(RealAttributeVo attest, Map real) { + if (CollectionUtil.isEmpty(real)) { + return; + } + real.forEach((key, value) -> { + if (StringUtil.isBlank(value)) { + return; + } + switch (key) { + case "q": + attest.setQuality(Integer.parseInt(value)); + break; + case "realId": + attest.setRealId(value); + break; + case "value": + attest.setValue(Optional.ofNullable(value).orElse("-")); + break; + case "time": + attest.setTime(value); + break; + default: + break; + } + }); + } + + /** + * 故障信息设置 + * + * @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 + */ + 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()) { + return; + } + if (-1 == quality) { + return; + } + if (quality != 0) { + return; + } + 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()); + 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()); + } + } + } 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 alarmList + * @param station + * @param key + */ + private void setStationStatus(List alarmList, RealStationVo station, String key) { + station.setStatus(0); + if(alarmList.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<>(); + } + return (List) json; + } + + /** + * map分割 + * + * @param + * @param + * @param chunkMap + * @return + */ + private List> mapChunk(Map chunkMap) { + if (chunkMap == null) { + return Lists.newArrayList(); + } + Set keySet = chunkMap.keySet(); + Iterator iterator = keySet.iterator(); + int i = 1; + List> total = new ArrayList<>(); + Map tem = new HashMap<>(); + while (iterator.hasNext()) { + k next = iterator.next(); + tem.put(next, chunkMap.get(next)); + if (i == 5) { + total.add(tem); + tem = new HashMap<>(); + i = 0; + } + i++; + } + if (!CollectionUtil.isEmpty(tem)) { + total.add(tem); + } + return total; + } + + /** + * 获取厂房监测点 + * @return + */ + private List getRealIdByWsCodeAndSign() { + List wsInfoList = workshopInfoService.list(); + if(CollectionUtil.isEmpty(wsInfoList)) { + return Lists.newArrayList(); + } + Function getAnalyzeCodePO = wsCode -> { + MultiAnalyzeCodePO multiAnalyzeCodePO = new MultiAnalyzeCodePO(); + multiAnalyzeCodePO.setDeviceCode(wsCode); + multiAnalyzeCodePO.setSignages(Lists.newArrayList(HomePageConstant.PV_JOINT_RELAY,HomePageConstant.PV_REACTIVE_POWER,HomePageConstant.PV_GENERATION_CAPACITY)); + return multiAnalyzeCodePO; + }; + List analyzeCodePOList = wsInfoList.stream().map(WorkshopInfoEntity::getNumber).map(getAnalyzeCodePO).collect(Collectors.toList()); + R> analyzeCodeBySignages = analyseDataSearchClient.getAnalyzeCodeBySignages(analyzeCodePOList); + return Optional.ofNullable(analyzeCodeBySignages).filter(r -> r.isSuccess()).map(R::getData).orElse(Lists.newArrayList()); + } + + /** + * 获取站点realId + * @param refDept + * @param eminfoAndEmParams + * @return + */ + private List getRealDeviceList(Long refDept, List eminfoAndEmParams) { + // 参数检查 + if(CollectionUtil.isEmpty(eminfoAndEmParams) || ObjectUtil.isEmpty(refDept)){ + return new ArrayList<>(); + } + // 有效设备 + List filters = eminfoAndEmParams.stream().filter(o-> o.getCreateDept().equals(refDept)).collect(Collectors.toList()); + if(CollectionUtil.isEmpty(filters)){ + return new ArrayList<>(); + } + // 遍历设备 + List result = new ArrayList<>(); + for(EminfoAndEmParamVo device : filters){ + result.addAll(device.getPoint().values()); + } + return result; + } +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/PowerServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/PowerServiceImpl.java new file mode 100644 index 0000000..265a8b7 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/PowerServiceImpl.java @@ -0,0 +1,77 @@ +package com.hnac.hzims.scheduled.service.operation.impl; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hnac.hzims.operational.fill.entity.PowerEntity; +import com.hnac.hzims.operational.main.vo.PowerMonthVo; +import com.hnac.hzims.scheduled.mapper.operation.PowerMapper; +import com.hnac.hzims.scheduled.service.operation.PowerService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.DateUtil; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + + +@Slf4j +@Service +@AllArgsConstructor +public class PowerServiceImpl extends BaseServiceImpl implements PowerService { + + + /** + * 根据时间、机构查询发电量 + * @param date 时间: 年 - yyyy/月 yyyy-mm/日 yyyy-mm-dd + * @param station 所属机构 + * @return + */ + @Override + public Double generate(String date, Long station) { + List powers = this.list(Wrappers.lambdaQuery() + .likeRight(PowerEntity::getMon,date) + .eq(PowerEntity::getCreateDept,station) + // 类型: 光伏 + .eq(PowerEntity::getType,1) + ); + if(CollectionUtil.isEmpty(powers)){ + return 0.0; + } + return powers.stream().mapToDouble(PowerEntity::getPowerMon).sum(); + } + + /** + * + * @param start 开始时间 : yyyy-mm + * @param end 结束时间 : yyyy-mm + * @param station 所属机构 + * @return + */ + @Override + public List generateThreeYear(String start, String end, Long station) { + List fills = this.list(Wrappers.lambdaQuery() + .between(PowerEntity::getMon,start,end) + .eq(PowerEntity::getCreateDept,station) + // 类型: 光伏 + .eq(PowerEntity::getType,1) + ); + if(CollectionUtil.isEmpty(fills)){ + return new ArrayList<>(); + + } + return fills.stream().map(fill->{ + PowerMonthVo mon = new PowerMonthVo(); + mon.setStrMonth(DateUtil.format(DateUtil.parse(fill.getMon(),"yyyy-MM"),DateUtil.PATTERN_DATE)); + if(Math.abs(fill.getPowerMon()) <= 0){ + mon.setPower(0f); + }else{ + mon.setPower(Float.parseFloat(fill.getPowerMon().toString())); + } + return mon; + }).collect(Collectors.toList()); + } + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/RealTargetServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/RealTargetServiceImpl.java new file mode 100644 index 0000000..eacda88 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/RealTargetServiceImpl.java @@ -0,0 +1,1512 @@ +package com.hnac.hzims.scheduled.service.operation.impl; + +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.TypeReference; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hnac.hzims.EquipmentConstants; +import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; +import com.hnac.hzims.operational.main.constant.HomePageConstant; +import com.hnac.hzims.operational.main.vo.*; +import com.hnac.hzims.operational.station.StationConstants; +import com.hnac.hzims.operational.station.entity.HzimsAnalyzeModelStationEntity; +import com.hnac.hzims.operational.station.entity.StationEntity; +import com.hnac.hzims.scheduled.service.operation.*; +import com.hnac.hzinfo.datasearch.PointData; +import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient; +import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData; +import com.hnac.hzinfo.datasearch.analyse.po.AnalyseCodeByAnalyseDataPO; +import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO; +import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO; +import com.hnac.hzinfo.datasearch.history.IHistoryDataSearchClient; +import com.hnac.hzinfo.datasearch.history.OriginalDataQuery; +import com.hnac.hzinfo.datasearch.real.po.RealDataSearchPO; +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 lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.MapUtils; +import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.DateUtil; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.core.tool.utils.StringUtil; +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.util.*; +import java.util.stream.Collectors; + +/** + * APP首页实现类 + * @author ysj + */ +@Service +@RequiredArgsConstructor +@Slf4j +public class RealTargetServiceImpl implements RealTargetService { + + private final UseService useService; + + private final PowerService powerService; + + private final StationService stationService; + + private final GenerateService generateService; + + private final AnalyseDataService analyseDataService; + + private final StationAttributeService attributeService; + + private final ModelStationService modelStationService; + + private final RedisTemplate redisTemplate; + + private final IAnalyseDataSearchClient analyseDataSearchClient; + + private final IHistoryDataSearchClient historyDataSearchClient; + + @Value("${hzims.equipment.emInfo.emInfoList}") + public String device_cache_cofig_final; + + @Value("${hzims.operation.realIdKey}") + public String real_id_cofig_final; + + private final static String recent_year_power_data = "hzims:operation:key:power:data"; + 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"; + private final static String loadwaterpump_real_key = "hzims:operation:loadwaterpump:real:key"; + private final static String loadwater_level_key = "hzims:operation:loadwater:level:key"; + private final static String loadwater_group_key = "hzims:operation:group:key"; + private final static String load_photovoltaic_real_key = "hzims:operation:photovoltaic:real:key"; + private final static String load_photovoltaic_target_key = "hzims:operation:photovoltaic:target:key"; + + + + /** + * 加载水电站机组实时数据 + * @param param + */ + @Override + public void loadHydropowerReal(String param) { + // 水电站站点 + List stations = stationService.list(Wrappers.lambdaQuery() + .eq(StationEntity::getType,HomePageConstant.HYDROPOWER) + ); + if(CollectionUtil.isEmpty(stations)){ + return; + } + // 水电站设备 + List devices = this.pumpDevices(stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())); + if(CollectionUtil.isEmpty(devices)){ + return; + } + // 实时数据 + Map map = this.getRealMap(); + // 单位 + Map unitMap = this.attributeService.PointUnit(); + // 实时数据 + List reals = devices.stream().map(device->{ + HydropowerUnitRealVo real = new HydropowerUnitRealVo(); + real.setDeptId(device.getCreateDept()); + real.setDeviceCode(device.getEmCode()); + real.setDeptName(device.getName()); + real.setDeviceName(device.getName()); + // 装机容量 + real.setInstalledCapacity(device.getInstalledCapacity()); + // 开关机状态 + real.setState(this.state(device,map)); + // 有功功率 + real.setActivePower(this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_ACTIVE_POWER)); + // 无功功率 + real.setReactivePower(this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_REACTIVE_POWER)); + // 功率因数 + real.setPowerFactor(this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_POWERFACTOR)); + // 机组频率 + real.setFrequency(this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_FREQUENCY)); + // 导叶开度 + real.setGuideOpen(this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_GUIDEOPEN)); + // 定子电压 + real.setStatorVoltage(this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_VOLTAGE)); + // 定子电流 + real.setStatorCurrent(this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_CURRENT)); + // 单位设置 + this.setttingUnit(device,unitMap,real); + return real; + }).collect(Collectors.toList()); + if(CollectionUtil.isEmpty(reals)){ + return; + } + redisTemplate.opsForValue().set(load_hydropower_unit_real_key,reals); + } + + /** + * 加载水电站机组指标数据 + * @param param + */ + @Override + public void loadHydropowerTarget(String param) { + // 水电站站点 + List stations = stationService.list(Wrappers.lambdaQuery() + //.eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE) + .eq(StationEntity::getType,HomePageConstant.HYDROPOWER) + ); + if(CollectionUtil.isEmpty(stations)){ + return; + } + // 补充填补发电指标 + List targets = this.generteFill(stations); + // 水电站设备 + List devices = this.pumpDevices(stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())); + if(CollectionUtil.isNotEmpty(devices)){ + targets.addAll(devices.stream().map(device->{ + HydropowerUnitTargetVo target = new HydropowerUnitTargetVo(); + target.setDeptId(device.getCreateDept()); + target.setDeviceCode(device.getEmCode()); + target.setDeviceName(device.getName()); + target.setDeptName(device.getName()); + // 当年发电量 + target.setPowerYear(this.getGenerationPower(device,0)); + // 当月发电量 + target.setPowerMon(this.getGenerationPower(device,1)); + // 当日发电量 + target.setPowerDay(this.getGenerationPower(device,2)); + // 当天有功功率 + target.setActivePowerVoList(this.getLoadsByDay(device)); + // 30天发电量 + target.setGenerationPowerVoList(this.getGenerationPowerList(device)); + return target; + }).collect(Collectors.toList())); + } + // 站点指标数据为空 + if(CollectionUtil.isEmpty(targets)){ + return; + } + redisTemplate.opsForValue().set(load_hydropower_unit_target_key,targets); + } + + /** + * 水利-泵组实时加载 + * @param param + */ + @Override + public void loadWaterPumpReal(String param) { + // 水利站点 + List stations = stationService.list(Wrappers.lambdaQuery() + .eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE) + .in(StationEntity::getType,HomePageConstant.waterList) + ); + if(CollectionUtil.isEmpty(stations)){ + return; + } + // 泵站设备 + List devices = this.pumpDevices(stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())); + if(CollectionUtil.isEmpty(devices)){ + return; + } + // 实时数据 + Map map = this.getRealMap(); + List list = devices.stream().map(device->{ + WaterPumpRealVo real = new WaterPumpRealVo(); + real.setDeptId(device.getCreateDept()); + real.setDeviceCode(device.getEmCode()); + real.setDeptName(device.getName()); + // 装机容量 + real.setInstalledCapacity(device.getInstalledCapacity()); + // 开机状态 + real.setState(this.pumpState(device,map)); + // 功率因数 + real.setPowerFactor(this.getSignageValue(device,map,HomePageConstant.POWER_FACTOR)); + // 有功功率 + real.setActivePower(this.floatValue(device,map,HomePageConstant.ACTIVE_POWER)); + // 无功功率 + real.setReactivePower(this.floatValue(device,map,HomePageConstant.REACTIVE_POWER)); + // 电压 + real.setVoltage(this.getSignageValue(device,map,HomePageConstant.VOLTAGE)); + // 电流 + real.setCurrent(this.getSignageValue(device,map,HomePageConstant.CURRENT)); + return real; + }).collect(Collectors.toList()); + redisTemplate.opsForValue().set(loadwaterpump_real_key,list); + } + + /** + * 水利-泵组指标加载 + * @param param + */ + @Override + public void loadWaterPumpTarget(String param) { + // 水利站点 + List stations = stationService.list(Wrappers.lambdaQuery() + .eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE) + .in(StationEntity::getType,HomePageConstant.waterList) + ); + if(CollectionUtil.isEmpty(stations)){ + return; + } + // 泵站设备 + List devices = this.pumpDevices(stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())); + // 补充站点填报发电量 + List list = this.useFill(stations); + // 站点设备数据统计 + if(CollectionUtil.isNotEmpty(devices)){ + list.addAll(devices.stream().map(device->{ + WaterPumpTargetVo target = new WaterPumpTargetVo(); + target.setDeptId(device.getCreateDept()); + target.setDeviceCode(device.getEmCode()); + target.setDeptName(device.getName()); + // 当年用电量 + target.setUsrPowerYear(this.getUsrPowerYear(device)); + // 当月用电量 + target.setUsrPowerMon(this.getUsrPowerMon(device)); + // 当日用电量 + target.setUsrPowerDay(this.getUsrPowerDay(device)); + // 当日机组有功功率 + target.setActivePowerVoList(this.getActivePowerVoList(device)); + // 近30天用电量 + target.setUsrPowerVoList(this.getUsrPowerVoList(device)); + // 近3年用电量 + target.setUsrYearMap(this.getUsrYearMap(device)); + // 月运行次数、时长 + WaterRunVo runMon = this.getRunData(device,1); + target.setRunCountMon(runMon.getCount()); + target.setRunDurationMon(runMon.getHour()); + // 年运行次数、时长 + WaterRunVo runYear = this.getRunData(device,0); + target.setRunCountYear(runYear.getCount()); + target.setRunDurationYear(runYear.getHour()); + return target; + }).collect(Collectors.toList())); + } + redisTemplate.opsForValue().set(loadwaterpump_target_key,list); + } + + /** + * 水利-站点水位数据 + * @param param + */ + @Override + public void loadWaterLevel(String param) { + // 有效站点模型 + List modelList = getModelStationList(); + if(CollectionUtil.isEmpty(modelList)){ + return; + } + List list = new ArrayList<>(); + modelList.forEach(item -> { + List multiAnalyzeCodePOList = new ArrayList<>(); + MultiAnalyzeCodePO multiAnalyzeCodePO = new MultiAnalyzeCodePO(); + multiAnalyzeCodePO.setDeviceCode(item.getInstanceCode()); + multiAnalyzeCodePO.setSignages(Collections.singletonList(HomePageConstant.FRONT_WATER_LEVEL)); + multiAnalyzeCodePOList.add(multiAnalyzeCodePO); + R> result = analyseDataSearchClient.getAnalyzeCodeBySignages(multiAnalyzeCodePOList); + if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ + return; + } + WaterLevelVo waterLevelVo = new WaterLevelVo(); + waterLevelVo.setStationCode(item.getStationId()); + // 前水位 + double frontWaterLevel = this.getWaterLevel(item.getInstanceCode(),HomePageConstant.FRONT_WATER_LEVEL); + waterLevelVo.setFrontWaterLevel(frontWaterLevel); + // 后水位 + double rearWaterLevel = this.getWaterLevel(item.getInstanceCode(),HomePageConstant.REAR_WATER_LEVEL); + waterLevelVo.setRearWaterLevel(rearWaterLevel); + // 前水位当日曲线 + Map frontCurveMap = this.getWaterLevelMap(item.getInstanceCode(),HomePageConstant.FRONT_WATER_LEVEL); + waterLevelVo.setFrontCurveMap(frontCurveMap); + // 后水位当日曲线 + Map rearCurveMap = this.getWaterLevelMap(item.getInstanceCode(),HomePageConstant.REAR_WATER_LEVEL); + waterLevelVo.setRearCurveMap(rearCurveMap); + list.add(waterLevelVo); + }); + redisTemplate.opsForValue().set(loadwater_level_key,list); + } + + /** + * 光伏站-逆变器实时加载 + * + * @param param + */ + + @Override + public void loadPhotovoltaicReal(String param) { + // 查询设备 + List devices = this.getPhotovoltaicDevice(); + if (CollectionUtil.isEmpty(devices)) { + return; + } + // 取redis实时数据 + Map map = this.getRealMap(); + if (MapUtils.isEmpty(map)) { + return; + } + // redis缓存设备实时数据 + List history = (List) redisTemplate.opsForValue().get(load_photovoltaic_real_key); + // 设备实时数据 + List list = devices.stream().map(device -> { + PhotovoltaicRealVo real = new PhotovoltaicRealVo(); + real.setDeptId(device.getCreateDept()); + real.setDeviceCode(device.getEmCode()); + real.setDeviceName(device.getName()); + real.setState(this.getPhotovoltaicState(device, map)); + // 容量 + real.setCapacity(device.getInstalledCapacity()); + // 发电量 + real.setGenerate(this.getSignageValue(device, map, HomePageConstant.PV_GENERATION_CAPACITY)); + // 功率 + real.setLoad(this.getSignageValue(device, map, HomePageConstant.PV_LOAD)); + // 交流电压 + real.setVoltage(this.getSignageValue(device, map, HomePageConstant.PV_VOLTAGE)); + // 交流电流 + real.setCurrent(this.getSignageValue(device, map, HomePageConstant.PV_CURRENT)); + // 交流电压2 + real.setVoltage_two(this.getSignageValue(device, map, HomePageConstant.PV_VOLTAGE_TWO)); + // 交流电流2 + real.setCurrent_two(this.getSignageValue(device, map, HomePageConstant.PV_CURRENT_TWO)); + // 交流电压3 + real.setVoltage_three(this.getSignageValue(device, map, HomePageConstant.PV_VOLTAGE_THREE)); + // 交流电流3 + real.setCurrent_three(this.getSignageValue(device, map, HomePageConstant.PV_CURRENT_THREE)); + // 直流电流1 + real.setDirect_one(this.getSignageValue(device, map, HomePageConstant.DIRECT_ONE)); + // 直流电流2 + real.setDirect_two(this.getSignageValue(device, map, HomePageConstant.DIRECT_TWO)); + // 直流电流3 + real.setDirect_three(this.getSignageValue(device, map, HomePageConstant.DIRECT_THREE)); + // 直流电流4 + real.setDirect_four(this.getSignageValue(device, map, HomePageConstant.DIRECT_FOUR)); + // 直流电流5 + real.setDirect_five(this.getSignageValue(device, map, HomePageConstant.DIRECT_FIVE)); + // 直流电流6 + real.setDirect_six(this.getSignageValue(device, map, HomePageConstant.DIRECT_SIX)); + // 直流电流7 + real.setDirect_seven(this.getSignageValue(device, map, HomePageConstant.DIRECT_SEVEN)); + // 直流电流8 + real.setDirect_eight(this.getSignageValue(device, map, HomePageConstant.DIRECT_EIGHT)); + // 直流电流9 + real.setDirect_nine(this.getSignageValue(device, map, HomePageConstant.DIRECT_NINE)); + // 直流电流10 + real.setDirect_ten(this.getSignageValue(device, map, HomePageConstant.DIRECT_TEN)); + // 直流电流11 + real.setDirect_eleven(this.getSignageValue(device, map, HomePageConstant.DIRECT_ELEVEN)); + // 直流电流12 + real.setDirect_twelve(this.getSignageValue(device, map, HomePageConstant.DIRECT_TWELVE)); + // 直流电压1 + real.setDc_voltage_one(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_ONE)); + // 直流电压2 + real.setDc_voltage_two(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_TWO)); + // 直流电压3 + real.setDc_voltage_three(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_THREE)); + // 直流电压4 + real.setDc_voltage_four(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_FOUR)); + // 直流电压5 + real.setDc_voltage_five(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_FIVE)); + // 直流电压6 + real.setDc_voltage_six(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_SIX)); + // 直流电压7 + real.setDc_voltage_seven(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_SEVEN)); + // 直流电压8 + real.setDc_voltage_eight(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_EIGHT)); + // 直流电压9 + real.setDc_voltage_nine(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_NINE)); + // 直流电压10 + real.setDc_voltage_ten(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_TEN)); + // 直流电压11 + real.setDc_voltage_eleven(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_ELEVEN)); + // 直流电压12 + real.setDc_voltage_twelve(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_TWELVE)); + // 串流电流1 + real.setDirect_one(this.getSignageValue(device, map, HomePageConstant.DIRECT_ONE)); + // 串流电流2 + real.setSeries_two(this.getSignageValue(device, map, HomePageConstant.SERIES_TWO)); + // 串流电流3 + real.setSeries_three(this.getSignageValue(device, map, HomePageConstant.SERIES_THREE)); + // 串流电流4 + real.setSeries_four(this.getSignageValue(device, map, HomePageConstant.SERIES_FOUR)); + // 串流电流5 + real.setSeries_five(this.getSignageValue(device, map, HomePageConstant.SERIES_FIVE)); + // 串流电流6 + real.setSeries_six(this.getSignageValue(device, map, HomePageConstant.SERIES_SIX)); + // 串流电流7 + real.setSeries_seven(this.getSignageValue(device, map, HomePageConstant.SERIES_SEVEN)); + // 串流电流8 + real.setSeries_eight(this.getSignageValue(device, map, HomePageConstant.SERIES_EIGHT)); + // 串流电流9 + real.setSeries_nine(this.getSignageValue(device, map, HomePageConstant.SERIES_NINE)); + // 串流电流10 + real.setSeries_ten(this.getSignageValue(device, map, HomePageConstant.SERIES_TEN)); + // 串流电流11 + real.setSeries_eleven(this.getSignageValue(device, map, HomePageConstant.SERIES_ELEVEN)); + // 串流电流12 + real.setSeries_twelve(this.getSignageValue(device, map, HomePageConstant.SERIES_TWELVE)); + // 串流电压1 + real.setSe_voltage_one(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_ONE)); + // 串流电压2 + real.setSe_voltage_two(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_TWO)); + // 串流电压3 + real.setSe_voltage_three(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_THREE)); + // 串流电压4 + real.setSe_voltage_four(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_FOUR)); + // 串流电压5 + real.setSe_voltage_five(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_FIVE)); + // 串流电压6 + real.setSe_voltage_six(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_SIX)); + // 串流电压7 + real.setSe_voltage_seven(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_SEVEN)); + // 串流电压8 + real.setSe_voltage_eight(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_EIGHT)); + // 串流电压9 + real.setSe_voltage_nine(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_NINE)); + // 串流电压10 + real.setSe_voltage_ten(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_TEN)); + // 串流电压11 + real.setSe_voltage_eleven(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_ELEVEN)); + // 串流电压12 + real.setSe_voltage_twelve(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_TWELVE)); + // 上次功率 + real.setLastLoad(this.getLastLoad(device, history)); + return real; + }).collect(Collectors.toList()); + // 存储redis + redisTemplate.opsForValue().set(load_photovoltaic_real_key, list); + } + + + + /** + * 光伏站-逆变器指标加载 + * + * @param param + */ + @Override + public void loadPhotovoltaicTarget(String param) { + // 有效设备 + List devices = this.getPhotovoltaicDevice(); + if (CollectionUtil.isEmpty(devices)) { + return; + } + List list = new ArrayList<>(); + // 接入站点设备统计 + devices.forEach(device -> { + PhotovoltaicTargetVo target = new PhotovoltaicTargetVo(); + target.setDeptId(device.getCreateDept()); + target.setDeviceCode(device.getEmCode()); + target.setDeviceName(device.getName()); + target.setDeptName(device.getName()); + // 当日运行时长 + target.setRunHours(this.runHours(device.getPoint().get(HomePageConstant.PV_JOINT_RELAY))); + // 年发电量 + target.setGenerationYear((double) this.sumValueByTime(device.getEmCode(), device.getRideCount(), "0")); + // 月发电量 + target.setGenerationMon((double) this.sumValueByTime(device.getEmCode(), device.getRideCount(), "1")); + // 日发电量 + target.setGenerationDay((double) this.sumValueByTime(device.getEmCode(), device.getRideCount(), "2")); + // 昨日发电量 + target.setGenerationYesterday((double) this.sumValueByTime(device.getEmCode(), device.getRideCount(), "3")); + // 收益 + target.setIncome(target.getGenerationDay() * 0.34); + // 节约标准煤 + target.setTec(target.getGenerationMon() * 0.0001229); + // 二氧化碳减排 + target.setCo2(target.getGenerationMon() * 0.000997); + // 减少森林砍伐 + target.setDeforest(target.getGenerationMon() * 0.000553); + // 当天有功功率 + target.setActivePowerVoList(this.photovoltaicLoadsByDay(device)); + // 30天发电量 + target.setGenerationPowerVoList(this.getGenerateByMon(device)); + list.add(target); + }); + // 补充站点填报发电量 + List stations = stationService.list(Wrappers.lambdaQuery() + .eq(StationEntity::getType, HomePageConstant.PHOTOVOLTAIC) + .eq(StationEntity::getServeType, HomePageConstant.HYDROPOWER_SERVETYPE) + ); + if(CollectionUtil.isNotEmpty(stations)){ + list.addAll(this.generateFill(stations)); + } + redisTemplate.opsForValue().set(load_photovoltaic_target_key, list); + } + + + /** + * 当日用电量 + * @param device + * @return + */ + private float getUsrPowerDay(EminfoAndEmParamVo device) { + String time = DateUtil.format(new Date(),DateUtil.PATTERN_DATE); + // 当日用电量 + return analyseDataService.periodTargetFloat(time + " 00:00:00",time + " 23:59:59",5,3,device.getEmCode(),device.getRideCount(),HomePageConstant.ELECTRICITY_CONSUMPTION); + + } + + /** + * 当月用电量 + * @param device + * @return + */ + private float getUsrPowerMon(EminfoAndEmParamVo device) { + String start = DateUtil.format(new Date(), "yyyy-MM") + "-01 00:00:00"; + String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); + // 当月用电量 + return analyseDataService.periodTargetFloat(start,end,5,5,device.getEmCode(),device.getRideCount(),HomePageConstant.ELECTRICITY_CONSUMPTION); + } + + /** + * 当年用电量 + * @param device + * @return + */ + private float getUsrPowerYear(EminfoAndEmParamVo device) { + Calendar calendar = Calendar.getInstance(); + String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); + calendar.setTime(new Date()); + calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH)); + calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1); + String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); + // 当年用电量 + return analyseDataService.periodTargetFloat(start,end,5,6,device.getEmCode(),device.getRideCount(),HomePageConstant.ELECTRICITY_CONSUMPTION); + } + + /** + * 当日机组有功功率 + * @param device + * @return + */ + public List getActivePowerVoList(EminfoAndEmParamVo device) { + String startTime = DateUtil.format(new Date(), "yyyy-MM-dd 00:00:00"); + String endTime = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"); + List datas = analyseDataService.periodTargetData(startTime,endTime,2,6,device.getEmCode(),HomePageConstant.ACTIVE_POWER); + if(CollectionUtil.isEmpty(datas)){ + return new ArrayList<>(); + } + return datas.stream().map(data->{ + ActivePowerVo active = new ActivePowerVo(); + Date dateTime = DateUtil.parse(data.getTs(), "yyyy-MM-dd HH:mm:ss.s"); + active.setHour(dateTime.getHours()); + if (StringUtil.isBlank(data.getVal())) { + active.setActivePower("0"); + }else { + active.setActivePower(data.getVal()); + } + return active; + }).collect(Collectors.toList()); + } + + /** + * 近30天用电量 + * @param device + * @return + */ + private List getUsrPowerVoList(EminfoAndEmParamVo device) { + String start = DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00"; + Calendar calendar = Calendar.getInstance(); + calendar.add(Calendar.DAY_OF_MONTH,-29); + String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); + List records = analyseDataService.periodTargetData(start,end,5,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),device.getEmCode(),HomePageConstant.ELECTRICITY_CONSUMPTION); + if(CollectionUtil.isEmpty(records)){ + return new ArrayList<>(); + } + return records.stream().map(record -> { + UsrPowerVo usr = new UsrPowerVo(); + Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); + usr.setDate(DateUtil.format(time,DateUtil.PATTERN_DATE)); + usr.setUsrPower(Float.valueOf(Optional.ofNullable(record.getVal()).orElse("0"))); + return usr; + }).collect(Collectors.toList()); + } + + /** + * 近3年发电量 + * + * @param device + * @return + */ + private Map getUsrYearMap(EminfoAndEmParamVo device) { + // 开始时间 + Calendar calendar = Calendar.getInstance(); + calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH) + 12); + calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1); + String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00"; + // 结束日期 + calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) - 3); + calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH)); + String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00"; + // 查询数据 + List records = analyseDataService.periodTargetData(start,end,5,5,device.getEmCode(),HomePageConstant.ELECTRICITY_CONSUMPTION); + if(CollectionUtil.isEmpty(records)){ + return new HashMap<>(); + } + return records.stream().map(record -> { + PowerMonthVo generate = new PowerMonthVo(); + Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); + generate.setStrMonth(DateUtil.format(time, DateUtil.PATTERN_DATE)); + generate.setPower(Float.parseFloat(Optional.ofNullable(record.getVal()).orElse("0")) * device.getRideCount()); + return generate; + }).collect(Collectors.toMap(PowerMonthVo::getStrMonth,PowerMonthVo::getPower)); + } + + /** + * 获取运行数据 + * @param device + * @param type + * @return + */ + private WaterRunVo getRunData(EminfoAndEmParamVo device, int type) { + // 默认返回运行数据 + WaterRunVo waterRunVo = new WaterRunVo(); + waterRunVo.setCount(0); + waterRunVo.setHour(0.0); + Map point = device.getPoint(); + if(MapUtils.isEmpty(point)){ + return waterRunVo; + } + // 监测点 + String realId = point.get(HomePageConstant.SWITCH_ON_OFF); + if(StringUtil.isBlank(realId)){ + return waterRunVo; + } + // 确定查询时间范围: 年、月 + Date startDate,endDate; + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + switch (type){ + case 0: + endDate = calendar.getTime(); + calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH)); + calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1); + startDate = calendar.getTime(); + break; + case 1: + endDate = calendar.getTime(); + calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 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)); + startDate = calendar.getTime(); + break; + default: + throw new IllegalStateException("Unexpected value: " + type); + } + return this.getRunConvertData(realId,startDate,endDate,waterRunVo); + } + + /** + * 获取时间范围内开机次数、运行时长 + * @param realId + * @param startDate + * @param endDate + * @param waterRunVo + * @return + */ + private WaterRunVo getRunConvertData(String realId, Date startDate, Date endDate, WaterRunVo waterRunVo) { + OriginalDataQuery originalDataQuery = new OriginalDataQuery(); + originalDataQuery.setRealId(realId); + originalDataQuery.setBeginTime(startDate); + originalDataQuery.setEndTime(endDate); + originalDataQuery.setLimit(100000); + originalDataQuery.setPage(1); + // 查询时间范围开关机监测点历史数据 + Result> R = historyDataSearchClient.getOriginalDataByRealIds(originalDataQuery); + if(!R.isSuccess() || ObjectUtil.isEmpty(R.getData())){ + return waterRunVo; + } + // 过滤相邻开关机状态相同数据 + List result = this.getFilterList(R.getData().getRecords()); + if(CollectionUtil.isEmpty(result)){ + return waterRunVo; + } + // 开机次数 + int count = (int) result.stream().filter(o->HomePageConstant.OFF.equals(o.getValue())).count(); + waterRunVo.setCount(count); + // 开机运行时长 + long time = this.getRunTime(result,startDate,endDate); + waterRunVo.setHour(BigDecimal.valueOf(time / (1000 * 60 * 60.00)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); + return waterRunVo; + } + + /** + * 过滤相邻开关机状态相同数据 + * @param list + * @return + */ + private List getFilterList(List list) { + if(CollectionUtil.isEmpty(list)){ + return null; + } + List result = new ArrayList<>(); + // 遍历数据 + for(int i = 0; i< list.size() ; i++){ + // 第一个数据保存下来 + if(i == 0){ + result.add(list.get(i)); + continue; + } + // 遍历数据状态 + String value = list.get(i).getValue(); + if(StringUtil.isBlank(value)){ + continue; + } + // 上一条数据状态 + String up_value = list.get(i-1).getValue(); + if(value.equals(up_value)){ + continue; + } + result.add(list.get(i)); + } + return result; + } + + /** + * 获取运行时长 + * @param result + * @return + */ + private long getRunTime(List result,Date startDate,Date endDate) { + if(result.size() == 1){ + // 一直开机 + if(HomePageConstant.OFF.equals(result.get(0).getValue())){ + return endDate.getTime() - startDate.getTime(); + } + // 一直关机 + return 0; + } + long time=0; + // 遍历累计开机时长 + for(int i = 0; i< result.size() ; i++){ + // 记录为开机状态 就计算到下次关机的时间差 + if(HomePageConstant.ON.equals(result.get(i).getValue())){ + 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 stations + * @return + */ + private List useFill(List stations) { + Calendar calendar = Calendar.getInstance(); + String day = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE); + String mon = DateUtil.format(calendar.getTime(),"yyyy-MM"); + String year = String.valueOf(calendar.get(Calendar.YEAR)); + return stations.stream().map(station ->{ + WaterPumpTargetVo target = new WaterPumpTargetVo(); + target.setDeptId(station.getRefDept()); + target.setDeptName(station.getName()); + // 月运行次数、时长 + target.setRunCountMon(0); + target.setRunDurationMon(0.0); + // 年运行次数、时长 + target.setRunCountYear(0); + target.setRunDurationYear(0.0); + // 当年用电量 + target.setUsrPowerYear(useService.use(year,station.getCode())); + // 当月用电量 + target.setUsrPowerMon(useService.use(mon,station.getCode())); + // 当日用电量 + target.setUsrPowerDay(useService.use(day,station.getCode())); + if(StationConstants.DATA_ORIGIN_FILL.equals(station.getDataOrigin())){ + // 30天用电量 + target.setUsrPowerVoList(useService.use30Day(day,station.getCode())); + } + // 近3年用电量 + target.setUsrYearMap(this.useThreeYear(station.getCode())); + return target; + }).collect(Collectors.toList()); + } + + /** + * 获取水位实时数据 + * @param instanceCode + * @param signage + * @return + */ + private double getWaterLevel(String instanceCode, String signage) { + RealDataSearchPO realData = new RealDataSearchPO(); + realData.setAnalyzeCode(instanceCode); + List signages = Collections.singletonList(signage); + realData.setSignages(signages); + // 调用fegin接口查询实时数据 + R> R = analyseDataSearchClient.getRealDataByAnalyzeCode(realData); + if(!R.isSuccess() || CollectionUtil.isEmpty(R.getData())){ + return 0.0; + } + // 时间限制 + String time = R.getData().get(0).getTime(); + if(StringUtil.isEmpty(time) || "-".equals(time)){ + return 0.0; + } + Date date = DateUtil.parse(time, "yyyy-MM-dd HH:mm:ss.sss"); + if(System.currentTimeMillis() - date.getTime() > 30 * 60 * 1000L){ + return 0.0; + } + return Double.parseDouble(R.getData().get(0).getValue()); + } + + /** + * 获取水位当年数据 + * @param instanceCode + * @param signage + * @return + */ + private Map getWaterLevelMap(String instanceCode, String signage) { + String beginTime = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00"; + String endTime = DateUtil.format(new Date(), DateUtil.PATTERN_DATE); + AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO(); + List datas = analyseDataService.periodTargetData(beginTime, endTime,2, 6,instanceCode,signage); + if(CollectionUtil.isEmpty(datas)){ + return new HashMap<>(); + } + return datas.stream().collect(Collectors.toMap( + key-> { + Date dateTime = DateUtil.parse(key.getTs(), "yyyy-MM-dd HH:mm:ss.s"); + return dateTime.getHours(); + }, + value -> { + if(StringUtil.isBlank(value.getVal())){ + return "0"; + } + return value.getVal(); + }) + ); + } + + /** + * 填报近3年发电量 + * @param station + * @return + */ + private Map useThreeYear(String station) { + // 开始时间 + 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(),"yyyy-MM"); + // 结束日期 + calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) - 3); + calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH)); + String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE); + return useService.generateThreeYear(start,end,station); + } + + + /** + * 获取有效站点模型 + * @return + */ + private List getModelStationList() { + // 水利站点(All) + List stations = stationService.list(new LambdaQueryWrapper() {{ + eq(StationEntity::getServeType, HomePageConstant.HYDROPOWER_SERVETYPE); + }}); + if(CollectionUtil.isEmpty(stations)){ + return new ArrayList<>(); + } + // 站点code集合 + List codes = stations.stream().map(StationEntity::getCode).collect(Collectors.toList()); + if(CollectionUtil.isEmpty(codes)){ + return new ArrayList<>(); + } + // 查询站点模型列表 + List list = modelStationService.list(new LambdaQueryWrapper() {{ + in(HzimsAnalyzeModelStationEntity::getStationId, codes); + }}); + if(CollectionUtil.isEmpty(list)){ + return new ArrayList<>(); + } + return list; + } + + /** + * 获取开机状态 + * @param device + * @return + */ + private int pumpState(EminfoAndEmParamVo device,Map map) { + // 获取开关机监测点实时数据 + double value = this.getSignageValue(device,map,HomePageConstant.SWITCH_ON_OFF); + // 开机状态 + if (Math.abs(value) <= 0) { + return 0; + } + return 1; + } + + /** + * 有功功率 + * @param device + * @return + */ + private float floatValue(EminfoAndEmParamVo device,Map map,String target) { + // 获取有功功率监测点实时数据 + double value = this.getSignageValue(device,map,target); + // 转换float + return Float.parseFloat(String.valueOf(value)); + } + + /** + * 设备状态 + * @param device + * @param map + * @return + */ + private Boolean state(EminfoAndEmParamVo device, Map map) { + if(Math.abs(this.getSignageValue(device,map,HomePageConstant.JOINT_RELAY)) > 0){ + return true; + } + return Math.abs(this.getSignageValue(device, map, HomePageConstant.ACTIVE_POWER)) > 0; + } + + /** + * 近年发电量数据 + * + * @param param 时间 + * @param serveType 站点类型 + * @param year 近几年 + */ + @Override + public void loadPowerData(String param, List types, Integer serveType, int year) { + // 站点查询 + List stationList = stationService.list(new LambdaQueryWrapper() {{ + if (ObjectUtil.isNotEmpty(serveType)) { + eq(StationEntity::getServeType, serveType); + } + if (CollectionUtil.isNotEmpty(types)) { + in(StationEntity::getType, types); + } + }}); + // 设备信息 + List devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_cofig_final).toString(), new TypeReference>() { + }); + // 开始时间 + Calendar calendar = Calendar.getInstance(); + calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH) + 12); + calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1); + String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00"; + // 结束日期 + calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) - year); + calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH)); + String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00"; + // 存储数据map :<站点id,<月份,发电量>> + Map> powerMap = new HashMap<>(); + stationList.forEach(station -> { + // 站点设备集合 + List stationDevices = devices.stream().filter(device -> device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList()); + log.error("load_power_data station :" + station.getCode() + "==== device :" + stationDevices ); + Map generateMap = this.getGenerateYear(station,stationDevices,start,end); + if(MapUtils.isEmpty(generateMap)){ + return; + } + powerMap.put(station.getId(),generateMap); + }); + redisTemplate.opsForValue().set(recent_year_power_data, powerMap); + } + + + /** + * 当天有功功率 + * @param device + * @return + */ + private List getLoadsByDay(EminfoAndEmParamVo device) { + String start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00"; + String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); + List records = analyseDataService.periodTargetData(start, end, 3, 2, device.getEmCode(), HomePageConstant.PV_LOAD); + if (CollectionUtil.isEmpty(records)) { + return new ArrayList<>(); + } + return records.stream().map(record -> { + ActivePowerVo load = new ActivePowerVo(); + Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); + load.setHour(time.getHours()); + load.setActivePower(Optional.ofNullable(record.getVal()).orElse("0")); + return load; + }).sorted(Comparator.comparing(ActivePowerVo::getHour)).collect(Collectors.toList()); + } + + /** + * 获取年发电量 + * @param devices + * @param start + * @param end + * @return + */ + private Map getGenerateYear(StationEntity station,List devices, String start, String end) { + List datas = new ArrayList<>(); + // 设备采集发电量 + if(CollectionUtil.isNotEmpty(devices)){ + devices.forEach(device->{ + List records = analyseDataService.periodTargetData(start,end,5,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.getTs(), "yyyy-MM-dd HH:mm:ss.s"); + generate.setStrMonth(DateUtil.format(time,DateUtil.PATTERN_DATE)); + generate.setPower(Float.parseFloat(Optional.ofNullable(record.getVal()).orElse("0")) * 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)); + } + + + /** + * 获取填报用电量 + * @param stations + * @return + */ + private List generteFill(List stations) { + Calendar calendar = Calendar.getInstance(); + String day = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE); + String mon = DateUtil.format(calendar.getTime(),"yyyy-MM"); + String year = String.valueOf(calendar.get(Calendar.YEAR)); + return stations.stream().map(station ->{ + HydropowerUnitTargetVo target = new HydropowerUnitTargetVo(); + target.setDeptId(station.getRefDept()); + target.setDeptName(station.getName()); + // 当年发电量 + target.setPowerYear(generateService.generate(year,station.getCode())); + // 当月发电量 + target.setPowerMon(generateService.generate(mon,station.getCode())); + // 当日发电量 + target.setPowerDay(generateService.generate(day,station.getCode())); + // 30天发电量 + target.setGenerationPowerVoList(generateService.generate30Day(day,station.getCode())); + return target; + }).collect(Collectors.toList()); + } + + + /** + * 补充填报数据 + * @param station + * @param start + * @param end + */ + private List generateFill(StationEntity station, String start, String end) { + start = DateUtil.format(DateUtil.parse(start,DateUtil.PATTERN_DATETIME),"yyyy-MM"); + end = DateUtil.format(DateUtil.parse(end,DateUtil.PATTERN_DATETIME),"yyyy-MM"); + // 光伏 + if(HomePageConstant.PHOTOVOLTAIC.equals(station.getType())){ + return powerService.generateThreeYear(start,end,station.getRefDept()); + } + // 水电 + return generateService.generateThreeYear(start,end,station.getCode()); + } + + /** + * 获取开机状态 + * + * @param device + * @return + */ + private int getPhotovoltaicState(EminfoAndEmParamVo device, Map map) { + // 获取开关机监测点实时数据 + Double value = this.getSignageValue(device, map, HomePageConstant.PV_JOINT_RELAY); + // 开机状态 + if (Math.abs(value) <= 0) { + return 0; + } + return 1; + } + + /** + * 获取上一次功率 + * + * @param device + * @param history + * @return + */ + private Double getLastLoad(EminfoAndEmParamVo device, List history) { + if (CollectionUtil.isEmpty(history)) { + return 0.0; + } + List historyDevice = history.stream().filter(o -> o.getDeviceCode().equals(device.getEmCode())).collect(Collectors.toList()); + if (CollectionUtil.isEmpty(historyDevice)) { + return 0.0; + } + return historyDevice.get(0).getLoad(); + } + + /** + * 获取光伏设备 + * + * @return + */ + private List getPhotovoltaicDevice() { + // 光伏站点 + List stations = stationService.list(Wrappers.lambdaQuery() + .eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE) + .eq(StationEntity::getType,HomePageConstant.PHOTOVOLTAIC) + ); + if (CollectionUtil.isEmpty(stations)) { + return new ArrayList<>(); + } + // 设备 + List devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_cofig_final).toString(), new TypeReference>() { + }); + if (CollectionUtil.isEmpty(devices)) { + return new ArrayList<>(); + } + return devices.stream().filter(device -> + stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(device.getCreateDept()) + ).collect(Collectors.toList()); + } + + /** + * 当天运行时长 + * + * @param realId + * @return + */ + private Double runHours(String realId) { + Calendar calendar = Calendar.getInstance(); + Date end = calendar.getTime(); + 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)); + Date start = calendar.getTime(); + OriginalDataQuery originalDataQuery = new OriginalDataQuery(); + originalDataQuery.setRealId(realId); + originalDataQuery.setBeginTime(start); + originalDataQuery.setEndTime(end); + originalDataQuery.setLimit(100000); + originalDataQuery.setPage(1); + // 查询时间范围开关机监测点历史数据 + Result> R = historyDataSearchClient.getOriginalDataByRealIds(originalDataQuery); + if (!R.isSuccess() || ObjectUtil.isEmpty(R.getData())) { + return 0.0; + } + // 过滤相邻开关机状态相同数据 + List result = this.getFilterList(R.getData().getRecords()); + if (CollectionUtil.isEmpty(result)) { + return 0.0; + } + // 开机运行时长 + long time = this.getRunTime(result, start, end); + return BigDecimal.valueOf(time / (1000 * 60 * 60.00)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + } + + /** + * 根据事件查询数据值 + * + * @param deviceCode + * @param rideCount + * @param type + * @return + */ + private float sumValueByTime(String deviceCode, int rideCount, String type) { + Calendar calendar = Calendar.getInstance(); + String start, end; + int cycleType = 3; + switch (type) { + //年 + case "0": + calendar.add(Calendar.HOUR_OF_DAY, +1); + end = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME); + calendar.setTime(new Date()); + calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH)); + calendar.add(Calendar.DAY_OF_MONTH, -calendar.get(Calendar.DATE) + 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)); + start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME); + cycleType = 6; + break; + //月 + case "1": + start = DateUtil.format(new Date(), "yyyy-MM") + "-01 00:00:00"; + end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); + cycleType = 5; + break; + //日 + case "2": + start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00"; + end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); + break; + //昨日 + case "3": + 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)); + start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME); + end = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00"; + break; + default: + throw new ServiceException("无效查询类型!"); + } + return analyseDataService.periodTargetFloat(start, end, 5, cycleType, deviceCode, rideCount, HomePageConstant.PV_GENERATION_CAPACITY); + } + + /** + * 当天有功功率 + * + * @param device + * @return + */ + private List photovoltaicLoadsByDay(EminfoAndEmParamVo device) { + String start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00"; + String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); + List records = analyseDataService.periodTargetData(start, end, 1, 2, device.getEmCode(), HomePageConstant.PV_LOAD); + if (CollectionUtil.isEmpty(records)) { + return new ArrayList<>(); + } + return records.stream().map(record -> { + PhotovoltaicPowerVo load = new PhotovoltaicPowerVo(); + Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); + load.setHour(time.getHours()); + load.setActivePower(Optional.ofNullable(record.getVal()).orElse("0")); + return load; + }).sorted(Comparator.comparing(PhotovoltaicPowerVo::getHour)).collect(Collectors.toList()); + } + + /** + * 近30天发电量 + * + * @param device + * @return + */ + private List getGenerateByMon(EminfoAndEmParamVo device) { + Calendar calendar = Calendar.getInstance(); + String end = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME); + calendar.add(Calendar.DAY_OF_MONTH, -29); + 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 records = analyseDataService.periodTargetData(start, end, 5, 3, device.getEmCode(), HomePageConstant.PV_GENERATION_CAPACITY); + if (CollectionUtil.isEmpty(records)) { + return new ArrayList<>(); + } + return records.stream().map(record -> { + GenerationPowerVo generate = new GenerationPowerVo(); + Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); + generate.setDate(DateUtil.format(time, DateUtil.PATTERN_DATE)); + generate.setGenerate(Float.valueOf(Optional.ofNullable(record.getVal()).orElse("0"))); + return generate; + }).sorted(Comparator.comparing(GenerationPowerVo::getDate)).collect(Collectors.toList()); + } + + /** + * 获取光伏站点填报数据 + * @param stations + * @return + */ + private List generateFill(List stations) { + Calendar calendar = Calendar.getInstance(); + String mon = DateUtil.format(calendar.getTime(),"yyyy-MM"); + String year = String.valueOf(calendar.get(Calendar.YEAR)); + return stations.stream().map(station ->{ + PhotovoltaicTargetVo target = new PhotovoltaicTargetVo(); + target.setDeptId(station.getRefDept()); + target.setDeptName(station.getName()); + // 当日运行时长 + target.setRunHours(0.0); + // 日发电量 + target.setGenerationDay(0.0); + // 昨日发电量 + target.setGenerationYesterday(0.0); + // 收益 + target.setIncome(0.0); + // 日发电量 + // 月发电量 + target.setGenerationMon(powerService.generate(mon,station.getRefDept())); + // 节约标准煤 + target.setTec(target.getGenerationMon() * 0.0001229); + // 二氧化碳减排 + target.setCo2(target.getGenerationMon() * 0.000997); + // 减少森林砍伐 + target.setDeforest(target.getGenerationMon() * 0.000553); + // 年发电量 + target.setGenerationYear(powerService.generate(year,station.getRefDept())); + // 30天发电量 + return target; + }).collect(Collectors.toList()); + } + + /** + * 泵站设备 + * @param stations + * @return + */ + private List pumpDevices(List stations){ + if(CollectionUtil.isEmpty(stations)){ + return new ArrayList<>(); + } + List devices = null; + Object json = redisTemplate.opsForValue().get(device_cache_cofig_final); + if (ObjectUtil.isNotEmpty(json)) { + devices = JSONObject.parseObject(json.toString(),new TypeReference>() {}); + } + if(CollectionUtil.isEmpty(devices)){ + return new ArrayList<>(); + } + return devices.stream().filter(device->stations.contains(device.getCreateDept())).collect(Collectors.toList()); + } + + /** + * 获取实时数据 + * @return + */ + private Map getRealMap() { + String json = (String) redisTemplate.opsForValue().get(real_id_cofig_final); + if(StringUtil.isBlank(json)){ + return null; + } + return JSONObject.parseObject(json, new TypeReference>() {}); + } + + + /** + * 获取监测点实时数据 + * @param device + * @param targets + * @return + */ + private double getSignageValue(EminfoAndEmParamVo device,Map map, String targets) { + if(ObjectUtil.isEmpty(device) || MapUtils.isEmpty(map)){ + return 0.0; + } + Map point = device.getPoint(); + if(MapUtils.isEmpty(point)){ + return 0.0; + } + String realId = point.get(targets); + if(StringUtil.isBlank(realId)){ + return 0.0; + } + String value = map.get(realId); + if(StringUtil.isBlank(value)){ + return 0.0; + } + // 获取value + return Double.parseDouble(value); + } + + /** + * 单位设置 + * @param device + * @param unitMap + * @param realVo + */ + private void setttingUnit(EminfoAndEmParamVo device, Map unitMap, HydropowerUnitRealVo realVo) { + if(MapUtils.isEmpty(unitMap)){ + return; + } + // 有功功率单位 + String power = unitMap.get(device.getId()+HomePageConstant.CONCAT_P); + if(StringUtil.isNotBlank(power)){ + realVo.setPowerUnit(power); + } else { + realVo.setPowerUnit("kW"); + } + // 无功功率 + String reactivePowerUnit = unitMap.get(device.getId()+HomePageConstant.CONCAT_Q); + if(StringUtil.isNotBlank(reactivePowerUnit)){ + realVo.setReactivePowerUnit(reactivePowerUnit); + } else { + realVo.setReactivePowerUnit("kVa r"); + } + // 定子电压单位 + String voltage = unitMap.get(device.getId()+HomePageConstant.CONCAT_UAB); + if(StringUtil.isNotBlank(voltage)){ + realVo.setVoltageUnit(voltage); + } else { + realVo.setVoltageUnit("V"); + } + // 定子电流单位 + String current = unitMap.get(device.getId()+HomePageConstant.CONCAT_IA); + if(StringUtil.isNotBlank(current)){ + realVo.setCurrentUnit(current); + } else { + realVo.setCurrentUnit("A"); + } + } + + /** + * 获取年、月、日发电量 + * @param device + * @param scope + * @return + */ + private float getGenerationPower(EminfoAndEmParamVo device,int scope) { + String start,end; + int accessRules; + Calendar calendar = Calendar.getInstance(); + switch (scope){ + // 年 + case 0: + end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); + calendar.setTime(new Date()); + calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH)); + calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1); + start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00"; + accessRules = EquipmentConstants.CycleTypeEnum.YEAR_CYCLE.getType(); + break; + // 月 + case 1: + start = DateUtil.format(new Date(), "yyyy-MM") + "-01 00:00:00"; + end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); + accessRules = EquipmentConstants.CycleTypeEnum.MONTH_CYCLE.getType(); + break; + // 日 + case 2: + String time = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE); + start = time + " 00:00:00"; + end = time + " 23:59:59"; + accessRules = EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(); + break; + default: + throw new IllegalStateException("Unexpected value: " + scope); + } + return analyseDataService.periodTargetFloat(start,end,5,accessRules,device.getEmCode(),device.getRideCount(),HomePageConstant.HYDROPOWER_GENERATE_POWER); + } + + /** + * 近30天发电量 + * @param device + * @return + */ + private List getGenerationPowerList(EminfoAndEmParamVo device) { + String start = DateUtil.format(new Date(), "yyyy-MM") + "-01 00:00:00"; + String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); + List records = analyseDataService.periodTargetData(start,end,5,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER); + if(CollectionUtil.isEmpty(records)){ + return new ArrayList<>(); + } + return records.stream().map(record -> { + GenerationPowerVo generate = new GenerationPowerVo(); + Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); + generate.setDate(DateUtil.format(time,DateUtil.PATTERN_DATE)); + generate.setGenerate(Float.parseFloat(Optional.ofNullable(record.getVal()).orElse("0")) * device.getRideCount()); + return generate; + }).collect(Collectors.toList()); + } +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/RecordServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/RecordServiceImpl.java new file mode 100644 index 0000000..d5489b8 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/RecordServiceImpl.java @@ -0,0 +1,36 @@ +package com.hnac.hzims.scheduled.service.operation.impl; + +import com.hnac.hzims.operational.config.entity.StAlarmRecordEntity; +import com.hnac.hzims.scheduled.mapper.operation.RecordMapper; +import com.hnac.hzims.scheduled.service.operation.RecordService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.Date; + +/** + * @author ysj + */ +@Service +@RequiredArgsConstructor +@Slf4j +public class RecordServiceImpl extends BaseServiceImpl implements RecordService { + + /** + * 添加告警 + * @param stationId + * @param realId + * @return + */ + @Override + public Long insertAlert(String stationId, String realId) { + StAlarmRecordEntity record = new StAlarmRecordEntity(); + record.setStationId(stationId); + record.setRealId(realId); + record.setStatus(0); + record.setCreateTime(new Date()); + return this.baseMapper.insertReturnId(record); + } +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/StationAttrConfigServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/StationAttrConfigServiceImpl.java new file mode 100644 index 0000000..d928365 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/StationAttrConfigServiceImpl.java @@ -0,0 +1,34 @@ +package com.hnac.hzims.scheduled.service.operation.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.hnac.hzims.operational.station.entity.StationAttrConfigEntity; +import com.hnac.hzims.scheduled.mapper.operation.StationAttrConfigMapper; +import com.hnac.hzims.scheduled.service.operation.StationAttrConfigService; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author ysj + */ +@Service +@Slf4j +public class StationAttrConfigServiceImpl extends BaseServiceImpl implements StationAttrConfigService { + + @Override + public List getHideList() { + List list = this.list(new QueryWrapper() {{ + eq("ENABLE_SHOW", false); + eq("IS_DELETED",0); + }}); + if(CollectionUtil.isEmpty(list)){ + return new ArrayList<>(); + } + return list.stream().map(StationAttrConfigEntity::getEmName).collect(Collectors.toList()); + } +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/StationAttributeServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/StationAttributeServiceImpl.java new file mode 100644 index 0000000..122278e --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/StationAttributeServiceImpl.java @@ -0,0 +1,36 @@ +package com.hnac.hzims.scheduled.service.operation.impl; + +import com.hnac.hzims.operational.station.entity.StationAttributeEntity; +import com.hnac.hzims.scheduled.mapper.operation.StationAttributeMapper; +import com.hnac.hzims.scheduled.service.operation.StationAttributeService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @author hx + */ +@Service +@Slf4j +@RequiredArgsConstructor +public class StationAttributeServiceImpl extends BaseServiceImpl implements StationAttributeService { + + /** + * 获取集中监控监测点单位 + * @return + */ + @Override + public Map PointUnit() { + List list = this.baseMapper.PointUnit(); + if(CollectionUtil.isEmpty(list)){ + return null; + } + return list.stream().collect(Collectors.toMap(StationAttributeEntity::getAttributes, StationAttributeEntity::getUnit)); + } +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/StationServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/StationServiceImpl.java new file mode 100644 index 0000000..8735909 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/StationServiceImpl.java @@ -0,0 +1,19 @@ +package com.hnac.hzims.scheduled.service.operation.impl; + +import com.hnac.hzims.operational.station.entity.StationEntity; +import com.hnac.hzims.scheduled.mapper.operation.StationMapper; +import com.hnac.hzims.scheduled.service.operation.StationService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +/** + * @author hx + */ +@Service +@RequiredArgsConstructor +@Slf4j +public class StationServiceImpl extends BaseServiceImpl implements StationService { + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/UseServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/UseServiceImpl.java new file mode 100644 index 0000000..82ba5b1 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/UseServiceImpl.java @@ -0,0 +1,99 @@ +package com.hnac.hzims.scheduled.service.operation.impl; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hnac.hzims.operational.fill.entity.UseEntity; +import com.hnac.hzims.operational.main.vo.UsrPowerVo; +import com.hnac.hzims.scheduled.mapper.operation.UseMapper; +import com.hnac.hzims.scheduled.service.operation.UseService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.DateUtil; +import org.springframework.stereotype.Service; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * @author ysj + * @date 2023/04/10 11:16:07 + * @version 4.0.0 + */ +@Slf4j +@Service +@AllArgsConstructor +public class UseServiceImpl extends BaseServiceImpl implements UseService { + + /** + * 根据时间、机构查询用电量 + * @param date 时间: 年 - yyyy/月 yyyy-mm/日 yyyy-mm-dd + * @param station 所属机构 + * @return + */ + @Override + public Float use(String date, String station) { + List powers = this.list(Wrappers.lambdaQuery() + .likeRight(UseEntity::getFillDate,date) + .eq(UseEntity::getStationCode,station) + ); + if(CollectionUtil.isEmpty(powers)){ + return 0f; + } + return (float) powers.stream().mapToDouble(UseEntity::getEmploy).sum(); + } + + /** + * 查询30天填报用电量 + * @param day : 结束日期 yyyy-MM-dd + * @param station 站点编码 + * @return + */ + @Override + public List use30Day(String day, String station) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(DateUtil.parse(day,DateUtil.PATTERN_DATE)); + String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE); + calendar.add(Calendar.DAY_OF_MONTH,-29); + String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE); + List records = this.list(Wrappers.lambdaQuery() + .between(UseEntity::getFillDate,start,end) + .eq(UseEntity::getStationCode,station) + ); + if(CollectionUtil.isEmpty(records)){ + return new ArrayList<>(); + } + return records.stream().map(record->{ + UsrPowerVo use = new UsrPowerVo(); + use.setDate(record.getFillDate()); + if(Math.abs(record.getEmploy()) <= 0){ + use.setUsrPower(0f); + }else{ + use.setUsrPower(Float.parseFloat(record.getEmploy().toString())); + } + return use; + }).collect(Collectors.toList()); + } + + /** + * 查询近3年的填报用电量 + * @param start + * @param end + * @param station + * @return + */ + @Override + public Map generateThreeYear(String start, String end, String station) { + List records = this.list(Wrappers.lambdaQuery() + .between(UseEntity::getFillDate,start,end) + .eq(UseEntity::getStationCode,station) + ); + if(CollectionUtil.isEmpty(records)){ + return new HashMap<>(); + + } + return records.stream().peek(record-> record.setFillDate(DateUtil.format(DateUtil.parse(record.getFillDate(),"yyyy-MM"),"yyyy-MM") + "-01")). + collect(Collectors.toMap(UseEntity::getFillDate, value->Float.parseFloat(value.getEmploy().toString()),Float::sum)); + } + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/RealAttributeVo.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/RealAttributeVo.java deleted file mode 100644 index 00ea9d8..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/RealAttributeVo.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.hnac.hzims.scheduled.vo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/19 15:27 - */ -@Data -public class RealAttributeVo implements Serializable { - - @ApiModelProperty("属性名称") - private String name; - - @ApiModelProperty("属性数值") - private String value; - - @ApiModelProperty("属性单位") - private String unit; - - @ApiModelProperty("属性类型:1-遥信 2-遥测") - private Integer type; - - @ApiModelProperty("属性实时数据Id") - private String realId; - - @ApiModelProperty("告警Id") - private Long id; - - @ApiModelProperty("属性状态:0:正常、1:预警、2:告警、3:空值、4:黄色、5:橙色") - private int status; - - @ApiModelProperty("属性质量") - private int quality; - - @ApiModelProperty("属性时间") - private String time; - - @ApiModelProperty("属性故障ID") - private String fdpFaultId; - - @ApiModelProperty("监测点") - private String fdpMonitorId; - - @ApiModelProperty("属性故障值") - private Double fdpRate; -} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/RealDeviceVo.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/RealDeviceVo.java deleted file mode 100644 index 330a5df..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/RealDeviceVo.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.hnac.hzims.scheduled.vo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.util.List; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/19 15:26 - */ -@Data -public class RealDeviceVo implements Serializable { - - @ApiModelProperty("设备编号") - private String deviceCode; - - @ApiModelProperty("设备名称") - private String deviceName; - - @ApiModelProperty("设备状态") - private Integer state; - - @ApiModelProperty("排序字段") - private Integer sort; - - @ApiModelProperty("设备属性集合") - private List attbtList; -} - diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/RealStationVo.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/RealStationVo.java deleted file mode 100644 index 00a0c9e..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/RealStationVo.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.hnac.hzims.scheduled.vo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.util.List; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/19 15:24 - */ -@Data -public class RealStationVo implements Serializable { - - @ApiModelProperty("站点Id") - private String stationCode; - - @ApiModelProperty("站点名称") - private String stationName; - - @ApiModelProperty("站点机构Id") - private Long stationDeptId; - - @ApiModelProperty("站点类型") - private String serverType; - - @ApiModelProperty("当前天气") - private WeatherVo nowWater; - - @ApiModelProperty("总有功率") - private Double powerSum; - - @ApiModelProperty("降水") - private String precipitation; - - @ApiModelProperty("最大前池水位") - private Double waterLevelMax; - - @ApiModelProperty("前池水位") - private Double waterLevel; - - @ApiModelProperty("设备集合") - private List deviceList; - - @ApiModelProperty("站点状态 : 0-正常 1-数据中断") - private Integer status; - - @ApiModelProperty("排序") - private Integer sort; -} - diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/StationRealVo.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/StationRealVo.java deleted file mode 100644 index 8e9d7da..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/StationRealVo.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.hnac.hzims.scheduled.vo; - -import lombok.Data; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/19 11:43 - */ -@Data -public class StationRealVo { - - private String station; - - private String[] realId; -} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/WeatherVo.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/WeatherVo.java deleted file mode 100644 index bd46d22..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/WeatherVo.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.hnac.hzims.scheduled.vo; - -import lombok.Data; - -import java.io.Serializable; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/5/19 15:25 - */ -@Data -public class WeatherVo implements Serializable { - - /**当前天气状况和图标的代码,图标可通过天气状况和图标下载; //100**/ - private String icon; - - /**实况温度,默认单位:摄氏度; //21**/ - private String temp; - - /**实况天气状况的文字描述,包括阴晴雨雪等天气状态的描述; //晴**/ - private String text; - - /**预报当天最高温度; //4**/ - private String tempMax; - - /**预报当天最低温度; //-5**/ - private String tempMin; -} diff --git a/hzims-service/hzims-scheduled/src/main/resources/application.yml b/hzims-service/hzims-scheduled/src/main/resources/application.yml deleted file mode 100644 index e738d56..0000000 --- a/hzims-service/hzims-scheduled/src/main/resources/application.yml +++ /dev/null @@ -1,208 +0,0 @@ -#服务器端口 -server: - port: 8501 - -#数据源配置 -spring: - cloud: - nacos: - discovery: - server-addr: 175.6.40.67:10056 - config: - server-addr: 175.6.40.67:10056 - application: - name: hzims-scheduled - main: - allow-bean-definition-overriding: true - #排除DruidDataSourceAutoConfigure - autoconfigure: - exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure - datasource: - dynamic: - primary: operational #设置默认的数据源或者数据源组,默认值即为master - strict: false #严格匹配数据源,默认false. true未匹配到指定数据源时抛异常,false使用默认数据源 - datasource: - operational: - url: jdbc:mysql://192.168.1.3:3576/dev_hzims_operation?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true - username: root - password: 123 - redis: - # redis数据库索引(默认为0),我们使用索引为0的数据库,避免和其他数据库冲突 - database: 0 - # redis服务器地址(默认为localhost) - host: 192.168.1.3 - # redis端口(默认为6379) - port: 3577 - # redis访问密码(默认为空) - password: 1qaz2WSX@redis - -#xxl: -# job: -# accessToken: '' -# admin: -# addresses: http://192.168.1.3:7009/xxl-job-admin -# executor: -# appname: hzims-operational -# ip: 192.168.1.3 -# logpath: /data/applogs/xxl-job/jobhandler -# logretentiondays: -1 -# port: 28501 - -xxl: - job: - accessToken: '' - admin: - addresses: http://192.168.5.128:9080/xxl-job-admin - executor: - appname: hzims-operational - ip: 192.168.18.232 - logpath: /data/applogs/xxl-job/jobhandler - logretentiondays: -1 - port: 28501 - - -#mybatis-plus配置 -mybatis-plus: - mapper-locations: classpath*:/mapper/**/*.xml - #实体扫描,多个package用逗号或者分号分隔 -# typeAliasesPackage: com.hnac.hzims.**.entity - configuration: - log-impl: org.apache.ibatis.logging.stdout.StdOutImpl - -#swagger扫描路径配置 -swagger: - base-packages: - - org.springbalde - - com.hnac - -hzims: - # 视频配置地址随机码 - video: - random-code: qnrld30yto85cji5 - # 视频配置秘钥属性 - videoProperties: - appKey: 21111042 - videoHost: 42.192.39.246:443 - appSecret: QXRevZ2AQeXtmlYZT6Rf - equipment: - emInfo: - code: hzims:equipment:emInfo:deviceCode.stationDeviceCode - emInfoList: hzims:equipment:emInfo:deviceCode.emInfoList - fdp: - redisData: hzims:equipment:fdp:fault.data.realIdAndValueList - greaterThan: 0.3 - lessThan: 0.9 - beEqualOrGreaterThan: 0.9 - alert: - # 接收告警的websocket url - ws-url: wss://175.6.40.67:9036/api/hzinfo-data-socket/websocket/soe - config: - #接收遥测或遥信实时数据的websocket url - ws-url: wss://175.6.40.67:9036/api/hzinfo-data-socket/websocket/data - level: - ws-url: wss://175.6.40.67:9036/api/hzinfo-data-socket/websocket/alarm - pdf: - # pdf文件存储路径,请配置绝对路径 - #file-path: /data/inspect/pdf/file - file-path: D:/data/hzinfo/file # windows - operation: - access: - task-key: hzims:operation:access:task - alert: - saveDefectIsOpen: true - save: - area: - url: http://49.234.126.72:8255/apiIntroduction/demo/saveHzimsArea - station: - url: http://49.234.126.72:8255/apiIntroduction/demo/saveHzimsStation - defect: - repair: /data/hzims/operational/defect/repair/应急抢修单.docx - area: - report: hzims.operation.area.report - monitor: - station: hzims:operation:monitor:station - realId : hzims:operation:monitor:realId - region: - areaDutyInfoKey: hzims:operation:region:areaDutyInfoKey - deviceClassifyKey: hzims.operation.region.deviceClassifyKey - projectDepartmentId: 200000000000101 - projectDepartmentName: 智能运维事业部 - notInDept: 2000000000001010048,2000000000001010049,2000000000001010050 - tenantId: 200000 - #工单返回记录(暂存) - workOrder: - access: hzims:operation:workOrder.access - defect: hzims:operation:workOrder.defect - task: - # 消息推送存入redis的key值 - templateCode: - maintenance: - taskDispose: hzinfo:operation:maintenance:task - # 消息推送code - jgPushCode: ops-push - comprehensiveD: hzims:operation:comprehensiveD:real.time - realIdKey: hzims:operation:comprehensiveD:realIdKey.realData - lastDayRealIdKey: hzims:operation:comprehensiveD:lastDayRealIdKey.realData - realIdKeyGather: hzims:operation:comprehensiveD:realIdKeyGather.realData - homePage: - charge: - url: https://www.hznychh.cn/api/charging-manage/manage/external/provide?secretKey=f5aee9fe24e4d1d80eb7564414392bc3 - activePowerKey: hzims:operation:homePage:activePowerKey - jointRelayKey: hzims:operation:homePage:jointRelayKey - systemMonitoring: - hydropowerStation: - hisData: hzims:operation:homePage:systemMonitoring:hydropowerStation:hisData:. - hisDataActivePower: hzims:operation:homePage:systemMonitoring:hydropowerStation:hisDataActivePower:. - theDayHydrograph: hzims:operation:homePage:systemMonitoring:hydropowerStation:theDayHydrograph:. - yearGeneration: hzims:operation:homePage:systemMonitoring:hydropowerStation:yearGeneration.data - hisDataNew: hzims:operation:homePage:systemMonitoring:hydropowerStation:hisDataNew - theDayHydrographNew: hzims:operation:homePage:systemMonitoring:hydropowerStation:theDayHydrographNew - alarm: - # "0-默认", "1-系统", "2-告警", "3-故障", "4-用户操作", "5-遥测越限", "6-遥信变位", "7-注册信息", "8-信息提示", "9-设备巡检", "10-遥控操作", "11-遥测越限恢复","12-未定义","13-通讯中断","14-数据异常" - types: 3,2,5,13,14 - -category: - id: 1384429129110360065 - -sanya: - one: 2000000000001010048 - tow: 2000000000001010049 - hoop: 2000000000001010050 - -defect: - # 超时自动甄别时间间隔:单位(小时) - discriminateDeadline: 1 - # 默认计划工时:单位(小时) - defaultPlanHoure: 8 - -blade: - data: - sdk: - enabled: true - url: http://175.6.40.67:37681/api/hzinfo-data-config - appId: '1635888805125099521' - appSecret: f4b6a4dc696b36445d2e5d38bbab2417 - redisIp: 192.168.1.13 - redisPort: 3577 - password: L_MM&h=+Nm&p)U9sk.uH - maxKeys: 1000 - data-scope: - enabled: false - lock: - enabled: true - address: redis://192.168.1.3:3577 - password: - database: 0 - ssl: false - -url: - video: - stationsPath: http://localhost:10001/stations - monitorsPath: http://localhost:10001/monitor - login: https://175.6.40.67:9300/hzApi/auth/mix/login?tenantId=200000&account=videoViewers&pwd=e10adc3949ba59abbe56e057f20f883e&grant_type=password&scope=all&type=account - water-out: - #工单受理 - orderCrtPackage: http://175.6.40.67:9021/api/water-out/orderCrt/package - orderCrtGrabPackage: http://175.6.40.67:9021/api/water-out/orderCrt/grabPackage - - diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/WorkshopInfoMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/WorkshopInfoMapper.xml new file mode 100644 index 0000000..933d153 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/WorkshopInfoMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/AbnormalAlarmMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/AbnormalAlarmMapper.xml index 49c1076..aab621f 100644 --- a/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/AbnormalAlarmMapper.xml +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/AbnormalAlarmMapper.xml @@ -2,16 +2,10 @@ - - select distinct station_id from hzims_abnormal_alarm where is_deleted = 0 - and type in (13,14) - and `STATUS` = 0 + and type in (13,14) + and `STATUS` = 0 diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/GenerateMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/GenerateMapper.xml new file mode 100644 index 0000000..2f3e18b --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/GenerateMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/ModelStationMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/ModelStationMapper.xml new file mode 100644 index 0000000..df6a033 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/ModelStationMapper.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/PowerMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/PowerMapper.xml new file mode 100644 index 0000000..73820fc --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/PowerMapper.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + ID, MON, INSTALLED_CAPACITY , PLANNED_POWER_YEAR , PLANNED_POWER_MON , POWER_MON , POWER_RATE_MON ,POWER_YEAR , + POWER_RATE_YEAR , DOUBLE_QUALIFY_RATE , TYPE , TENANT_ID, STATUS, CREATE_TIME, UPDATE_TIME, CREATE_USER, UPDATE_USER, + IS_DELETED, CREATE_DEPT + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/RecordMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/RecordMapper.xml new file mode 100644 index 0000000..6086a5f --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/RecordMapper.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + SELECT LAST_INSERT_ID() AS id + + insert into hy_st_alarm_record (id, station_id, real_id, + status, phone_record, process_desc, + create_time, processor, process_time + ) + values (#{id,jdbcType=BIGINT}, #{stationId,jdbcType=VARCHAR}, #{realId,jdbcType=VARCHAR}, + #{status,jdbcType=TINYINT}, #{phoneRecord,jdbcType=VARCHAR}, #{processDesc,jdbcType=VARCHAR}, + #{createTime,jdbcType=TIMESTAMP}, #{processor,jdbcType=VARCHAR}, #{processTime,jdbcType=TIMESTAMP} + ) + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/StAlarmRecordMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/StAlarmRecordMapper.xml deleted file mode 100644 index cfe513d..0000000 --- a/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/StAlarmRecordMapper.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - SELECT LAST_INSERT_ID() AS id - - insert into hy_st_alarm_record (id, station_id, real_id, - status, phone_record, process_desc, - create_time, processor, process_time - ) - values (#{id,jdbcType=BIGINT}, #{stationId,jdbcType=VARCHAR}, #{realId,jdbcType=VARCHAR}, - #{status,jdbcType=TINYINT}, #{phoneRecord,jdbcType=VARCHAR}, #{processDesc,jdbcType=VARCHAR}, - #{createTime,jdbcType=TIMESTAMP}, #{processor,jdbcType=VARCHAR}, #{processTime,jdbcType=TIMESTAMP} - ) - - - \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/StationAttrConfigMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/StationAttrConfigMapper.xml new file mode 100644 index 0000000..bf7b1e0 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/StationAttrConfigMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/StationAttributeMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/StationAttributeMapper.xml new file mode 100644 index 0000000..525d6fc --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/StationAttributeMapper.xml @@ -0,0 +1,15 @@ + + + + + + + \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/StationMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/StationMapper.xml new file mode 100644 index 0000000..23312d6 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/StationMapper.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/UseMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/UseMapper.xml new file mode 100644 index 0000000..021eaf7 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/UseMapper.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/controller/CentralMonitorController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/controller/CentralMonitorController.java index da4018a..0989365 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/controller/CentralMonitorController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/controller/CentralMonitorController.java @@ -3,7 +3,7 @@ package com.hnac.hzims.operational.config.controller; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.hnac.hzims.operational.config.service.CentralMonitorService; import com.hnac.hzims.operational.station.service.IRealMonitorService; -import com.hnac.hzims.operational.station.vo.RealStationVo; +import com.hnac.hzims.operational.main.vo.RealStationVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/CentralMonitorService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/CentralMonitorService.java index 46bedcf..040e7c9 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/CentralMonitorService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/CentralMonitorService.java @@ -1,7 +1,7 @@ package com.hnac.hzims.operational.config.service; -import com.hnac.hzims.operational.station.vo.RealStationVo; +import com.hnac.hzims.operational.main.vo.RealStationVo; import java.util.List; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/CentralMonitorServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/CentralMonitorServiceImpl.java index 07b632d..2124c9c 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/CentralMonitorServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/CentralMonitorServiceImpl.java @@ -4,7 +4,7 @@ import com.hnac.hzims.operational.config.service.CentralMonitorService; import com.hnac.hzims.operational.main.constant.HomePageConstant; import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.service.IStationService; -import com.hnac.hzims.operational.station.vo.RealStationVo; +import com.hnac.hzims.operational.main.vo.RealStationVo; import lombok.RequiredArgsConstructor; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.CollectionUtil; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java index 5114295..95e30cd 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java @@ -236,7 +236,7 @@ public class StAlamRecordServiceImpl extends BaseServiceImpl stFocusPropertiesEntity.getUpperUpperLimit() || Double.valueOf(value) < stFocusPropertiesEntity.getLowerLowerLimit())) { if (alarmList.size() > 0) { - time = new Date().getTime() - alarmList.get(0).getProcessTime().getTime(); + time = System.currentTimeMillis() - alarmList.get(0).getProcessTime().getTime(); } if ((recordList.size() == 0 && alarmList.size() == 0) || (time / 1000 / 60 > 30 && recordList.size() == 0)) { isWarn = setStAlarmRecordEntity(dataSet, stFocusPropertiesEntity, isWarn, 2, true); @@ -251,7 +251,7 @@ public class StAlamRecordServiceImpl extends BaseServiceImpl stFocusPropertiesEntity.getUpperLimit() && Double.valueOf(value) < stFocusPropertiesEntity.getUpperUpperLimit()) || (Double.valueOf(value) > stFocusPropertiesEntity.getLowerLowerLimit() && Double.valueOf(value) < stFocusPropertiesEntity.getLowerLimit()))) { if (alarmList.size() > 0) { - time = new Date().getTime() - alarmList.get(0).getProcessTime().getTime(); + time = System.currentTimeMillis() - alarmList.get(0).getProcessTime().getTime(); } if ((recordList.size() == 0 && alarmList.size() == 0) || (time / 1000 / 60 > 30 && recordList.size() == 0)) { isWarn = setStAlarmRecordEntity(dataSet, stFocusPropertiesEntity, isWarn, ConfigStatus.ConfigStatusEnum.RED.getStatus(), false); @@ -728,7 +728,7 @@ public class StAlamRecordServiceImpl extends BaseServiceImpl getFaultList(String code) { List stations = this.getStationByUserAuth(code);; - if(CollectionUtil.isEmpty(stations)){ + /*if(CollectionUtil.isEmpty(stations)){ return null; } String result = fdpMonitorClient.getFaultList(); @@ -738,7 +738,21 @@ public class StAlamRecordServiceImpl extends BaseServiceImpl list = JSONArray.parseArray(result,FaultVo.class); if(CollectionUtil.isEmpty(list)){ return new ArrayList<>(); - } + }*/ + List list = new ArrayList<>(); + FaultVo test =new FaultVo(); + test.setInfo("可是我不会忘"); + test.setFtype("1"); + test.setFaultId("114233824210698186"); + test.setName("爱来爱去空一场"); + test.setStationName("海南三亚大隆一级电站"); + test.setStation("902100000026"); + test.setStatus("0"); + test.setCreateTime("2023-06-01 09:55:33"); + test.setOrd("1"); + test.setFtype("1"); + test.setFinfo("你说人这东西可信不可信,骗子脸上又不会写字"); + list.add(test); Map map = stations.stream().collect(Collectors.toMap(StationEntity::getCode,StationEntity::getName)); // 查询已处理预警数据 List handles = handleService.handles(Collections.singletonList(AbnormalAlarmConstant.EARLY_WARNING),null); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/vo/StationRealVo.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/vo/StationRealVo.java deleted file mode 100644 index e61f1d2..0000000 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/vo/StationRealVo.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.hnac.hzims.operational.config.vo; - -import lombok.Data; - -@Data -public class StationRealVo { - - private String station; - - private String[] realId; - -} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java index 8a6cb12..f1f74b4 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java @@ -269,6 +269,7 @@ public class HydropowerServiceImpl implements HydropowerService { stationList.forEach(station -> { // 站点设备集合 List stationDevices = devices.stream().filter(device -> device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList()); + log.error("load_power_data station :" + station.getCode() + "==== device :" + stationDevices ); Map generateMap = this.getGenerateYear(station,stationDevices,start,end); if(MapUtils.isEmpty(generateMap)){ return; 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 7150980..9cd48e0 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 @@ -27,10 +27,10 @@ import com.hnac.hzims.operational.station.service.IRealMonitorService; import com.hnac.hzims.operational.station.service.IStationAttrConfigService; import com.hnac.hzims.operational.station.service.IStationAttributeService; import com.hnac.hzims.operational.station.service.IStationService; -import com.hnac.hzims.operational.station.vo.RealAttributeVo; -import com.hnac.hzims.operational.station.vo.RealDeviceVo; -import com.hnac.hzims.operational.station.vo.RealStationVo; -import com.hnac.hzims.operational.station.vo.WeatherVo; +import com.hnac.hzims.operational.main.vo.RealAttributeVo; +import com.hnac.hzims.operational.main.vo.RealDeviceVo; +import com.hnac.hzims.operational.main.vo.RealStationVo; +import com.hnac.hzims.operational.main.vo.WeatherVo; import com.hnac.hzinfo.sdk.v5.redis.RedisClient; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/vo/RealAttributeVo.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/vo/RealAttributeVo.java deleted file mode 100644 index 7e6c9c2..0000000 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/vo/RealAttributeVo.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.hnac.hzims.operational.station.vo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; - -@Data -public class RealAttributeVo implements Serializable { - - @ApiModelProperty("属性名称") - private String name; - - @ApiModelProperty("属性数值") - private String value; - - @ApiModelProperty("属性单位") - private String unit; - - @ApiModelProperty("属性类型:1-遥信 2-遥测") - private Integer type; - - @ApiModelProperty("属性实时数据Id") - private String realId; - - @ApiModelProperty("告警Id") - private Long id; - - @ApiModelProperty("属性状态:0:正常、1:预警、2:告警、3:空值、4:黄色、5:橙色") - private int status; - - @ApiModelProperty("属性质量") - private int quality; - - @ApiModelProperty("属性时间") - private String time; - - @ApiModelProperty("属性故障ID") - private String fdpFaultId; - - @ApiModelProperty("监测点") - private String fdpMonitorId; - - @ApiModelProperty("属性故障值") - private Double fdpRate; -} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/vo/RealDeviceVo.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/vo/RealDeviceVo.java deleted file mode 100644 index 5d7319e..0000000 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/vo/RealDeviceVo.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.hnac.hzims.operational.station.vo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.util.List; - -@Data -public class RealDeviceVo implements Serializable { - - @ApiModelProperty("设备编号") - private String deviceCode; - - @ApiModelProperty("设备名称") - private String deviceName; - - @ApiModelProperty("设备状态") - private Integer state; - - @ApiModelProperty("排序字段") - private Integer sort; - - @ApiModelProperty("设备属性集合") - private List attbtList; -} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/vo/RealStationVo.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/vo/RealStationVo.java deleted file mode 100644 index 876eaf5..0000000 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/vo/RealStationVo.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.hnac.hzims.operational.station.vo; - -import io.swagger.annotations.ApiModelProperty; -import io.swagger.models.auth.In; -import lombok.Data; - -import java.io.Serializable; -import java.util.List; - -@Data -public class RealStationVo implements Serializable { - - @ApiModelProperty("站点Id") - private String stationCode; - - @ApiModelProperty("站点名称") - private String stationName; - - @ApiModelProperty("站点机构Id") - private Long stationDeptId; - - @ApiModelProperty("站点类型") - private String serverType; - - @ApiModelProperty("当前天气") - private WeatherVo nowWater; - - @ApiModelProperty("总有功率") - private Double powerSum; - - @ApiModelProperty("降水") - private String precipitation; - - @ApiModelProperty("最大前池水位") - private Double waterLevelMax; - - @ApiModelProperty("前池水位") - private Double waterLevel; - - @ApiModelProperty("设备集合") - private List deviceList; - - @ApiModelProperty("站点状态 : 0-正常 1-数据中断") - private Integer status; - - @ApiModelProperty("排序") - private Integer sort; -} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/vo/WeatherVo.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/vo/WeatherVo.java deleted file mode 100644 index fb9b7b3..0000000 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/vo/WeatherVo.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.hnac.hzims.operational.station.vo; - -import lombok.Data; - -import java.io.Serializable; - -@Data -public class WeatherVo implements Serializable { - - /**当前天气状况和图标的代码,图标可通过天气状况和图标下载; //100**/ - private String icon; - - /**实况温度,默认单位:摄氏度; //21**/ - private String temp; - - /**实况天气状况的文字描述,包括阴晴雨雪等天气状态的描述; //晴**/ - private String text; - - /**预报当天最高温度; //4**/ - private String tempMax; - - /**预报当天最低温度; //-5**/ - private String tempMin; -}