From dae160fd763d69c1846083c6aa855d1009cc5ed7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=B5=E9=A3=9E=E5=AE=87?= <2684146481@qq.com> Date: Mon, 22 May 2023 12:34:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E5=AE=9A=E6=97=B6=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hzims-service/hzims-scheduled/pom.xml | 242 +++++++ .../hnac/hzims/scheduled/ScheduledApplication.java | 31 + .../hnac/hzims/scheduled/config/XxlJobConfig.java | 59 ++ .../scheduled/constants/ScheduledConstants.java | 12 + .../mapper/operation/AbnormalAlarmMapper.java | 20 + .../mapper/operation/AbnormalAlarmMapper.xml | 17 + .../operation/HistoryAbnormalAlarmMapper.java | 21 + .../operation/HistoryAbnormalAlarmMapper.xml | 10 + .../operation/HzimsAnalyzeModelStationMapper.java | 13 + .../mapper/operation/StAlarmRecordMapper.java | 14 + .../mapper/operation/StAlarmRecordMapper.xml | 19 + .../mapper/operation/StFocusPropertiesMapper.java | 13 + .../mapper/operation/StationAttrConfigMapper.java | 13 + .../mapper/operation/StationAttributeMapper.java | 13 + .../scheduled/mapper/operation/StationMapper.java | 21 + .../scheduled/mapper/operation/StationMapper.xml | 26 + .../scheduled/scheduled/ScheduledCreateTask.java | 46 ++ .../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/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 ++++++ .../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 | 193 ++++++ .../hzims/scheduled/ScheduledApplicationTest.java | 17 + hzims-service/pom.xml | 1 + 48 files changed, 2859 insertions(+) create mode 100644 hzims-service/hzims-scheduled/pom.xml create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/ScheduledApplication.java create 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/constants/ScheduledConstants.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/AbnormalAlarmMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/AbnormalAlarmMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/HistoryAbnormalAlarmMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/HistoryAbnormalAlarmMapper.xml create 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/StAlarmRecordMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StAlarmRecordMapper.xml create 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/StationAttrConfigMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StationAttributeMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StationMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StationMapper.xml create 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/StAlamRecordTask.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/AbnormalAlarmService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/HistoryAbnormalAlarmService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IHzimsAnalyzeModelStationService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IMainSystemMonitoringService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IRealMonitorService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IStationAttrConfigService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IStationAttributeService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IStationService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IWaterService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/StAlamRecordService.java create 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/impl/AbnormalAlarmServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/HistoryAbnormalAlarmServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/HzimsAnalyzeModelStationServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/MainSystemMonitoringServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/RealMonitorServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StAlamRecordServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StFocusPropertiesServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StationAttrConfigServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StationAttributeServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StationServiceImpl.java create 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/vo/RealAttributeVo.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/RealDeviceVo.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/RealStationVo.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/StationRealVo.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/WeatherVo.java create mode 100644 hzims-service/hzims-scheduled/src/main/resources/application.yml create mode 100644 hzims-service/hzims-scheduled/src/test/java/com/hnac/hzims/scheduled/ScheduledApplicationTest.java diff --git a/hzims-service/hzims-scheduled/pom.xml b/hzims-service/hzims-scheduled/pom.xml new file mode 100644 index 0000000..4183ad7 --- /dev/null +++ b/hzims-service/hzims-scheduled/pom.xml @@ -0,0 +1,242 @@ + + + 4.0.0 + + com.hnac.hzims + hzims-service + 4.0.0-SNAPSHOT + + + hzims-scheduled + + + 8 + 8 + UTF-8 + + + + redis.clients + jedis + 2.9.3 + + + org.springblade + blade-core-boot + + + org.springblade + blade-core-cloud + + + + + org.springblade + blade-core-cloud + + + io.github.openfeign + feign-okhttp + + + + + + org.springblade + blade-common + + + org.springblade + blade-starter-swagger + + + com.hnac.hzims + hzims-operational-api + + + com.hnac.hzinfo + inspect-api + + + org.springblade + blade-core-test + test + + + org.springblade + blade-core-auto + provided + + + org.springblade + blade-dict-api + + + org.springblade + blade-flow-api + + + 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 + + + + com.hnac.hzims + message-api + + + + com.hnac.hzims + ticket-api + + + + com.hnac.hzims + assets-api + + + + + com.google.zxing + core + + + 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 + + + com.itextpdf + itextpdf + + + com.hnac.hzims + weather-api + + + com.alibaba + fastjson + + + org.springblade + blade-core-tool + + + org.springblade + blade-system-api + + + com.hnac.hzinfo.data + hzinfo-data-sdk + + + + + + ${project.name}-${project.version} + + + com.spotify + dockerfile-maven-plugin + + ${docker.username} + ${docker.password} + ${docker.registry.url}/${docker.namespace}/${project.artifactId} + ${project.version} + true + + target/${project.build.finalName}.jar + + false + + + + + + diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/ScheduledApplication.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/ScheduledApplication.java new file mode 100644 index 0000000..d2772ca --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/ScheduledApplication.java @@ -0,0 +1,31 @@ +package com.hnac.hzims.scheduled; + +import org.mybatis.spring.annotation.MapperScan; +import org.springblade.core.cloud.feign.EnableBladeFeign; +import org.springframework.boot.Banner; +import org.springframework.boot.SpringApplication; +import org.springframework.cloud.client.SpringCloudApplication; +import org.springframework.context.annotation.ComponentScan; + +import javax.annotation.Resource; + +/** + * @Author dfy + * @Version v1.0 + * @Serial 1.0 + * @Date 2023/5/19 9:05 + */ +@EnableBladeFeign +@SpringCloudApplication +@MapperScan("com.hnac.hzims.scheduled.**.mapper.**") +@ComponentScan(basePackages = {"com.hnac.*","org.springblade.core.*"}) +@Resource +public class ScheduledApplication { + public static void main(String[] args) { + // BladeApplication.run(ScheduledConstants.APP_NAME, ScheduledApplication.class, args); + SpringApplication springApplication = new SpringApplication(ScheduledApplication.class); + springApplication.setBannerMode(Banner.Mode.OFF); + springApplication.run(args); + } + +} 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 new file mode 100644 index 0000000..b587329 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/config/XxlJobConfig.java @@ -0,0 +1,59 @@ +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/constants/ScheduledConstants.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/constants/ScheduledConstants.java new file mode 100644 index 0000000..037d967 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/constants/ScheduledConstants.java @@ -0,0 +1,12 @@ +package com.hnac.hzims.scheduled.constants; + +/** + * @Author WL + * @Version v1.0 + * @Serial 1.0 + * @Date 2023/5/19 9:06 + */ +public class ScheduledConstants { + + public final static String APP_NAME = "hzims-scheduled"; +} 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 new file mode 100644 index 0000000..b677a4e --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/AbnormalAlarmMapper.java @@ -0,0 +1,20 @@ +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 + */ +public interface AbnormalAlarmMapper extends UserDataScopeBaseMapper{ + + AbnormalAlarmEntity getAbnormalAlarm(@Param("stationId") String stationId, @Param("type") String type); + + List getAbnormalAlarmList(); +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/AbnormalAlarmMapper.xml b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/AbnormalAlarmMapper.xml new file mode 100644 index 0000000..49c1076 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/AbnormalAlarmMapper.xml @@ -0,0 +1,17 @@ + + + + + + + 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 new file mode 100644 index 0000000..e680c53 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/HistoryAbnormalAlarmMapper.java @@ -0,0 +1,21 @@ +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/HistoryAbnormalAlarmMapper.xml b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/HistoryAbnormalAlarmMapper.xml new file mode 100644 index 0000000..fdbd02b --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/HistoryAbnormalAlarmMapper.xml @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file 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 new file mode 100644 index 0000000..41ad4ad --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/HzimsAnalyzeModelStationMapper.java @@ -0,0 +1,13 @@ +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/StAlarmRecordMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StAlarmRecordMapper.java new file mode 100644 index 0000000..8b3e211 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StAlarmRecordMapper.java @@ -0,0 +1,14 @@ +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/StAlarmRecordMapper.xml b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StAlarmRecordMapper.xml new file mode 100644 index 0000000..cfe513d --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StAlarmRecordMapper.xml @@ -0,0 +1,19 @@ + + + + + + + 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/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 new file mode 100644 index 0000000..68d7a3d --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StFocusPropertiesMapper.java @@ -0,0 +1,13 @@ +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 new file mode 100644 index 0000000..76a7952 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StationAttrConfigMapper.java @@ -0,0 +1,13 @@ +package com.hnac.hzims.scheduled.mapper.operation; + +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 + */ +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 new file mode 100644 index 0000000..89cf2a3 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StationAttributeMapper.java @@ -0,0 +1,13 @@ +package com.hnac.hzims.scheduled.mapper.operation; + +import com.hnac.hzims.operational.station.entity.StationAttributeEntity; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +/** + * @Author WL + * @Version v1.0 + * @Serial 1.0 + * @Date 2023/5/19 11:39 + */ +public interface StationAttributeMapper extends UserDataScopeBaseMapper { +} 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 new file mode 100644 index 0000000..3b81746 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StationMapper.java @@ -0,0 +1,21 @@ +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 + */ +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/StationMapper.xml b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StationMapper.xml new file mode 100644 index 0000000..e5e9daf --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StationMapper.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + \ 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 new file mode 100644 index 0000000..280ab7e --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ScheduledCreateTask.java @@ -0,0 +1,46 @@ +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) + //@Scheduled(cron = "0/40 * * * * ? ") + 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"); + } + + + + +} 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 new file mode 100644 index 0000000..b253c41 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/StAlamRecordTask.java @@ -0,0 +1,101 @@ +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 new file mode 100644 index 0000000..180d275 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/AbnormalAlarmService.java @@ -0,0 +1,19 @@ +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 new file mode 100644 index 0000000..4c2816e --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/HistoryAbnormalAlarmService.java @@ -0,0 +1,16 @@ +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 new file mode 100644 index 0000000..15c7b7a --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IHzimsAnalyzeModelStationService.java @@ -0,0 +1,17 @@ +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 new file mode 100644 index 0000000..d9b6c4e --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IMainSystemMonitoringService.java @@ -0,0 +1,16 @@ +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 new file mode 100644 index 0000000..9de496f --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IRealMonitorService.java @@ -0,0 +1,13 @@ +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 new file mode 100644 index 0000000..747bcc4 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IStationAttrConfigService.java @@ -0,0 +1,16 @@ +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 new file mode 100644 index 0000000..0713bb1 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IStationAttributeService.java @@ -0,0 +1,13 @@ +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 new file mode 100644 index 0000000..246d261 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IStationService.java @@ -0,0 +1,27 @@ +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 new file mode 100644 index 0000000..e50d049 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IWaterService.java @@ -0,0 +1,11 @@ +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 new file mode 100644 index 0000000..cff89fd --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/StAlamRecordService.java @@ -0,0 +1,14 @@ +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 new file mode 100644 index 0000000..479b4b3 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/StFocusPropertiesService.java @@ -0,0 +1,14 @@ +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/impl/AbnormalAlarmServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/AbnormalAlarmServiceImpl.java new file mode 100644 index 0000000..9a57ee4 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/AbnormalAlarmServiceImpl.java @@ -0,0 +1,242 @@ +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 new file mode 100644 index 0000000..6824c7a --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/HistoryAbnormalAlarmServiceImpl.java @@ -0,0 +1,41 @@ +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 new file mode 100644 index 0000000..26c1e39 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/HzimsAnalyzeModelStationServiceImpl.java @@ -0,0 +1,17 @@ +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 new file mode 100644 index 0000000..2620394 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/MainSystemMonitoringServiceImpl.java @@ -0,0 +1,51 @@ +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 new file mode 100644 index 0000000..4a595ad --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/RealMonitorServiceImpl.java @@ -0,0 +1,713 @@ +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 new file mode 100644 index 0000000..06d1fd0 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StAlamRecordServiceImpl.java @@ -0,0 +1,42 @@ +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 new file mode 100644 index 0000000..f10b67e --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StFocusPropertiesServiceImpl.java @@ -0,0 +1,164 @@ +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 new file mode 100644 index 0000000..58bd475 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StationAttrConfigServiceImpl.java @@ -0,0 +1,42 @@ +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 new file mode 100644 index 0000000..ae6cc6c --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StationAttributeServiceImpl.java @@ -0,0 +1,22 @@ +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 new file mode 100644 index 0000000..7490ba6 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StationServiceImpl.java @@ -0,0 +1,60 @@ +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 new file mode 100644 index 0000000..0218fe0 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/WaterServiceImpl.java @@ -0,0 +1,201 @@ +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/vo/RealAttributeVo.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/RealAttributeVo.java new file mode 100644 index 0000000..00ea9d8 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/RealAttributeVo.java @@ -0,0 +1,52 @@ +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 new file mode 100644 index 0000000..330a5df --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/RealDeviceVo.java @@ -0,0 +1,33 @@ +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 new file mode 100644 index 0000000..00a0c9e --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/RealStationVo.java @@ -0,0 +1,54 @@ +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 new file mode 100644 index 0000000..8e9d7da --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/StationRealVo.java @@ -0,0 +1,17 @@ +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 new file mode 100644 index 0000000..bd46d22 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/WeatherVo.java @@ -0,0 +1,30 @@ +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 new file mode 100644 index 0000000..2f8c38f --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/application.yml @@ -0,0 +1,193 @@ +#服务器端口 +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 + +#mybatis-plus配置 +mybatis-plus: + mapper-locations: classpath:com/hnac/hzims/**/mapper/*Mapper.xml + #实体扫描,多个package用逗号或者分号分隔 + typeAliasesPackage: com.hnac.hzims.**.entity + +#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/test/java/com/hnac/hzims/scheduled/ScheduledApplicationTest.java b/hzims-service/hzims-scheduled/src/test/java/com/hnac/hzims/scheduled/ScheduledApplicationTest.java new file mode 100644 index 0000000..d3aa174 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/test/java/com/hnac/hzims/scheduled/ScheduledApplicationTest.java @@ -0,0 +1,17 @@ +package com.hnac.hzims.scheduled; + +import org.junit.jupiter.api.Test; +import org.junit.runner.RunWith; +import org.springblade.core.test.BladeSpringRunner; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest(classes = ScheduledApplication.class) +// @BladeBootTest +public class ScheduledApplicationTest { + + + @Test + public void testScheduled(){ + System.out.println(1); + } +} \ No newline at end of file diff --git a/hzims-service/pom.xml b/hzims-service/pom.xml index 709983b..b690007 100644 --- a/hzims-service/pom.xml +++ b/hzims-service/pom.xml @@ -27,6 +27,7 @@ ticket weather hzims-middle + hzims-scheduled