段飞宇
2 years ago
48 changed files with 2859 additions and 0 deletions
@ -0,0 +1,242 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||||
|
<modelVersion>4.0.0</modelVersion> |
||||||
|
<parent> |
||||||
|
<groupId>com.hnac.hzims</groupId> |
||||||
|
<artifactId>hzims-service</artifactId> |
||||||
|
<version>4.0.0-SNAPSHOT</version> |
||||||
|
</parent> |
||||||
|
|
||||||
|
<artifactId>hzims-scheduled</artifactId> |
||||||
|
|
||||||
|
<properties> |
||||||
|
<maven.compiler.source>8</maven.compiler.source> |
||||||
|
<maven.compiler.target>8</maven.compiler.target> |
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
||||||
|
</properties> |
||||||
|
<dependencies> |
||||||
|
<dependency> |
||||||
|
<groupId>redis.clients</groupId> |
||||||
|
<artifactId>jedis</artifactId> |
||||||
|
<version>2.9.3</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>org.springblade</groupId> |
||||||
|
<artifactId>blade-core-boot</artifactId> |
||||||
|
<exclusions> |
||||||
|
<exclusion> |
||||||
|
<groupId>org.springblade</groupId> |
||||||
|
<artifactId>blade-core-cloud</artifactId> |
||||||
|
</exclusion> |
||||||
|
</exclusions> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>org.springblade</groupId> |
||||||
|
<artifactId>blade-core-cloud</artifactId> |
||||||
|
<exclusions> |
||||||
|
<exclusion> |
||||||
|
<groupId>io.github.openfeign</groupId> |
||||||
|
<artifactId>feign-okhttp</artifactId> |
||||||
|
</exclusion> |
||||||
|
</exclusions> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<dependency> |
||||||
|
<groupId>org.springblade</groupId> |
||||||
|
<artifactId>blade-common</artifactId> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>org.springblade</groupId> |
||||||
|
<artifactId>blade-starter-swagger</artifactId> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>com.hnac.hzims</groupId> |
||||||
|
<artifactId>hzims-operational-api</artifactId> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>com.hnac.hzinfo</groupId> |
||||||
|
<artifactId>inspect-api</artifactId> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>org.springblade</groupId> |
||||||
|
<artifactId>blade-core-test</artifactId> |
||||||
|
<scope>test</scope> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>org.springblade</groupId> |
||||||
|
<artifactId>blade-core-auto</artifactId> |
||||||
|
<scope>provided</scope> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>org.springblade</groupId> |
||||||
|
<artifactId>blade-dict-api</artifactId> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>org.springblade</groupId> |
||||||
|
<artifactId>blade-flow-api</artifactId> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>com.xuxueli</groupId> |
||||||
|
<artifactId>xxl-job-core</artifactId> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<!-- 月报统计图表导出--> |
||||||
|
<dependency> |
||||||
|
<groupId>org.apache.poi</groupId> |
||||||
|
<artifactId>ooxml-schemas</artifactId> |
||||||
|
<version>1.4</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>org.jfree</groupId> |
||||||
|
<artifactId>jcommon</artifactId> |
||||||
|
<version>1.0.24</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>org.jfree</groupId> |
||||||
|
<artifactId>jfreechart</artifactId> |
||||||
|
<version>1.5.0</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>com.hikvision.ga</groupId> |
||||||
|
<artifactId>artemis-http-client</artifactId> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<!-- ApacheHttp请求工具 Start --> |
||||||
|
<dependency> |
||||||
|
<groupId>org.apache.httpcomponents</groupId> |
||||||
|
<artifactId>httpclient</artifactId> |
||||||
|
</dependency> |
||||||
|
<!-- ApacheHttp请求工具 End --> |
||||||
|
|
||||||
|
<!-- freemark,用于导出word Start--> |
||||||
|
<dependency> |
||||||
|
<groupId>org.freemarker</groupId> |
||||||
|
<artifactId>freemarker</artifactId> |
||||||
|
</dependency> |
||||||
|
<!-- freemark,用于导出word End--> |
||||||
|
|
||||||
|
<dependency> |
||||||
|
<groupId>com.hnac.hzims</groupId> |
||||||
|
<artifactId>equipment-api</artifactId> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<dependency> |
||||||
|
<groupId>com.hnac.hzims</groupId> |
||||||
|
<artifactId>message-api</artifactId> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<dependency> |
||||||
|
<groupId>com.hnac.hzims</groupId> |
||||||
|
<artifactId>ticket-api</artifactId> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<dependency> |
||||||
|
<groupId>com.hnac.hzims</groupId> |
||||||
|
<artifactId>assets-api</artifactId> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<!-- --> |
||||||
|
<dependency> |
||||||
|
<groupId>com.google.zxing</groupId> |
||||||
|
<artifactId>core</artifactId> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>com.google.zxing</groupId> |
||||||
|
<artifactId>javase</artifactId> |
||||||
|
</dependency> |
||||||
|
<!--${bladex.project.version}--> |
||||||
|
<dependency> |
||||||
|
<groupId>org.springblade</groupId> |
||||||
|
<artifactId>blade-user-api</artifactId> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-collections4 --> |
||||||
|
<dependency> |
||||||
|
<groupId>org.apache.commons</groupId> |
||||||
|
<artifactId>commons-collections4</artifactId> |
||||||
|
</dependency> |
||||||
|
<!-- spring-boot-websocket start --> |
||||||
|
<dependency> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-starter-websocket</artifactId> |
||||||
|
<exclusions> |
||||||
|
<exclusion> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-starter-tomcat</artifactId> |
||||||
|
</exclusion> |
||||||
|
</exclusions> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<!-- https://mvnrepository.com/artifact/cn.hutool/hutool-http --> |
||||||
|
<dependency> |
||||||
|
<groupId>cn.hutool</groupId> |
||||||
|
<artifactId>hutool-http</artifactId> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<!-- https://mvnrepository.com/artifact/cn.hutool/hutool-core --> |
||||||
|
<dependency> |
||||||
|
<groupId>cn.hutool</groupId> |
||||||
|
<artifactId>hutool-core</artifactId> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<!--WebSocket核心依赖包--> |
||||||
|
<dependency> |
||||||
|
<groupId>org.java-websocket</groupId> |
||||||
|
<artifactId>Java-WebSocket</artifactId> |
||||||
|
</dependency> |
||||||
|
<!-- spring-boot-websocket end --> |
||||||
|
<dependency> |
||||||
|
<groupId>org.springblade</groupId> |
||||||
|
<artifactId>blade-resource-api</artifactId> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>com.itextpdf</groupId> |
||||||
|
<artifactId>itextpdf</artifactId> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>com.hnac.hzims</groupId> |
||||||
|
<artifactId>weather-api</artifactId> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>com.alibaba</groupId> |
||||||
|
<artifactId>fastjson</artifactId> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>org.springblade</groupId> |
||||||
|
<artifactId>blade-core-tool</artifactId> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>org.springblade</groupId> |
||||||
|
<artifactId>blade-system-api</artifactId> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>com.hnac.hzinfo.data</groupId> |
||||||
|
<artifactId>hzinfo-data-sdk</artifactId> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
</dependencies> |
||||||
|
|
||||||
|
<build> |
||||||
|
<finalName>${project.name}-${project.version}</finalName> |
||||||
|
<plugins> |
||||||
|
<plugin> |
||||||
|
<groupId>com.spotify</groupId> |
||||||
|
<artifactId>dockerfile-maven-plugin</artifactId> |
||||||
|
<configuration> |
||||||
|
<username>${docker.username}</username> |
||||||
|
<password>${docker.password}</password> |
||||||
|
<repository>${docker.registry.url}/${docker.namespace}/${project.artifactId}</repository> |
||||||
|
<tag>${project.version}</tag> |
||||||
|
<useMavenSettingsForAuth>true</useMavenSettingsForAuth> |
||||||
|
<buildArgs> |
||||||
|
<JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE> |
||||||
|
</buildArgs> |
||||||
|
<skip>false</skip> |
||||||
|
</configuration> |
||||||
|
</plugin> |
||||||
|
|
||||||
|
</plugins> |
||||||
|
</build> |
||||||
|
</project> |
@ -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); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -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; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
@ -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"; |
||||||
|
} |
@ -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>{ |
||||||
|
|
||||||
|
AbnormalAlarmEntity getAbnormalAlarm(@Param("stationId") String stationId, @Param("type") String type); |
||||||
|
|
||||||
|
List<String> getAbnormalAlarmList(); |
||||||
|
} |
@ -0,0 +1,17 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||||
|
<mapper namespace="com.hnac.hzims.scheduled.mapper.operation.AbnormalAlarmMapper"> |
||||||
|
|
||||||
|
<select id="getAbnormalAlarm" resultType="com.hnac.hzims.operational.alert.entity.AbnormalAlarmEntity"> |
||||||
|
select * from hzims_abnormal_alarm |
||||||
|
where station_id = #{stationId} |
||||||
|
and type = #{type} |
||||||
|
and is_deleted = 0 |
||||||
|
</select> |
||||||
|
<select id="getAbnormalAlarmList" resultType="java.lang.String"> |
||||||
|
select distinct station_id from hzims_abnormal_alarm |
||||||
|
where is_deleted = 0 |
||||||
|
and type in (13,14) |
||||||
|
and `STATUS` = 0 |
||||||
|
</select> |
||||||
|
</mapper> |
@ -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<HistoryAbnormalAlarmEntity> { |
||||||
|
|
||||||
|
List<HistoryAbnormalAlarmEntity> getHistoryAbnormalAlarm(@Param("stationId") String stationId, @Param("type") String type); |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,10 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||||
|
<mapper namespace="com.hnac.hzims.scheduled.mapper.operation.HistoryAbnormalAlarmMapper"> |
||||||
|
<select id="getHistoryAbnormalAlarm" resultType="com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity"> |
||||||
|
select * from hzims_history_abnormal_alarm |
||||||
|
where station_id = #{stationId} |
||||||
|
and type = #{type} |
||||||
|
and status = 0 |
||||||
|
</select> |
||||||
|
</mapper> |
@ -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<HzimsAnalyzeModelStationEntity> { |
||||||
|
} |
@ -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<StAlarmRecordEntity> { |
||||||
|
Long insertReturnId(StAlarmRecordEntity record); |
||||||
|
} |
@ -0,0 +1,19 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||||
|
<mapper namespace="com.hnac.hzims.scheduled.mapper.operation.StAlarmRecordMapper"> |
||||||
|
|
||||||
|
<insert id="insertReturnId" parameterType="com.hnac.hzims.operational.config.entity.StAlarmRecordEntity"> |
||||||
|
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="id"> |
||||||
|
SELECT LAST_INSERT_ID() AS id |
||||||
|
</selectKey> |
||||||
|
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} |
||||||
|
) |
||||||
|
</insert> |
||||||
|
|
||||||
|
</mapper> |
@ -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<StFocusPropertiesEntity> { |
||||||
|
} |
@ -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<StationAttrConfigEntity> { |
||||||
|
} |
@ -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<StationAttributeEntity> { |
||||||
|
} |
@ -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<StationEntity> { |
||||||
|
|
||||||
|
List<StationEntity> selectStationByType(Integer stationType, Integer serveType); |
||||||
|
|
||||||
|
List<StationEntity> selectAll(); |
||||||
|
|
||||||
|
List<StationEntity> selectStationByInCode(List<String> codes); |
||||||
|
} |
@ -0,0 +1,26 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||||
|
<mapper namespace="com.hnac.hzims.scheduled.mapper.operation.StationMapper"> |
||||||
|
<select id="selectStationByType" resultType="com.hnac.hzims.operational.station.entity.StationEntity"> |
||||||
|
select * from hzims_station where IS_DELETED = 0 and REF_DEPT IS NOT NULL and `TYPE` IS NOT NULL |
||||||
|
<if test="serveType != null"> |
||||||
|
AND SERVE_TYPE = #{serveType} |
||||||
|
</if> |
||||||
|
<if test="stationType != null"> |
||||||
|
AND `TYPE` = #{stationType} |
||||||
|
</if> |
||||||
|
</select> |
||||||
|
|
||||||
|
|
||||||
|
<select id="selectAll" resultType="com.hnac.hzims.operational.station.entity.StationEntity"> |
||||||
|
select * from hzims_station where IS_DELETED = 0 and REF_DEPT IS NOT NULL AND REF_DOMAIN IS NOT NULL AND `TYPE` IS NOT NULL |
||||||
|
</select> |
||||||
|
|
||||||
|
|
||||||
|
<select id="selectStationByInCode" resultType="com.hnac.hzims.operational.station.entity.StationEntity"> |
||||||
|
SELECT * FROM hzims_station WHERE IS_DELETED = 0 and `CODE` IN |
||||||
|
<foreach collection="list" item="item" index="index" open="(" close=")" separator=","> |
||||||
|
#{item} |
||||||
|
</foreach> |
||||||
|
</select> |
||||||
|
</mapper> |
@ -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<String> |
||||||
|
*/ |
||||||
|
@XxlJob(LOAD_WATER_LEVEL) |
||||||
|
//@Scheduled(cron = "0/40 * * * * ? ")
|
||||||
|
public ReturnT<String> loadWaterLevel(String param) throws Exception { |
||||||
|
if (Func.isBlank(param)) { |
||||||
|
param = DateUtil.format(new Date(), "yyyy-MM"); |
||||||
|
} |
||||||
|
waterService.loadWaterLevel(param); |
||||||
|
return new ReturnT<>("SUCCESS"); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} |
@ -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<String> |
||||||
|
*/ |
||||||
|
@XxlJob(ALARM_DATA_HANDLE) |
||||||
|
public ReturnT<String> 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<String> |
||||||
|
*/ |
||||||
|
@XxlJob(REAL_ID_DATA) |
||||||
|
public ReturnT<String> 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<String> |
||||||
|
*/ |
||||||
|
@XxlJob(REAL_TIME_DATA) |
||||||
|
//@Scheduled(cron = "0/40 * * * * ? ")
|
||||||
|
public ReturnT<String> 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<String> |
||||||
|
*/ |
||||||
|
@XxlJob(CENTRALIZED_MONITORING) |
||||||
|
//@Scheduled(cron = "0/40 * * * * ? ")
|
||||||
|
public ReturnT<String> centralizedMonitoring(String param) throws Exception { |
||||||
|
if (Func.isBlank(param)) { |
||||||
|
param = DateUtil.format(new Date(), "yyyy-MM"); |
||||||
|
} |
||||||
|
monitorService.centralizedMonitoring(param); |
||||||
|
return new ReturnT<>("SUCCESS"); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -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<AbnormalAlarmEntity> { |
||||||
|
void alarmDataHandle(String param); |
||||||
|
|
||||||
|
List<String> getAbnormalAlarmList(); |
||||||
|
} |
@ -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> { |
||||||
|
|
||||||
|
|
||||||
|
HistoryAbnormalAlarmEntity getAbnormalAlarm(String station, String soeType); |
||||||
|
} |
@ -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<HzimsAnalyzeModelStationEntity> { |
||||||
|
|
||||||
|
} |
@ -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<EminfoAndEmParamVo> getEmInfoList(); |
||||||
|
} |
@ -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); |
||||||
|
} |
@ -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<StationAttrConfigEntity> { |
||||||
|
List<String> getHideList(); |
||||||
|
} |
@ -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<StationAttributeEntity> { |
||||||
|
} |
@ -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<StationEntity> { |
||||||
|
|
||||||
|
List<StationEntity> getStationByType(Integer stationType, Integer serveType); |
||||||
|
|
||||||
|
List<StationEntity> getAll(); |
||||||
|
|
||||||
|
List<StationEntity> getStationByInCode(List<String> strings); |
||||||
|
|
||||||
|
|
||||||
|
List<StationEntity> getStationType(Integer serveType,List<Integer> typeList,List<Long> departIdList); |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -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); |
||||||
|
} |
@ -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<StAlarmRecordEntity> { |
||||||
|
Long insertAlert(String stationId, String monitorId); |
||||||
|
} |
@ -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<StFocusPropertiesEntity> { |
||||||
|
void getStationRealIds(String param); |
||||||
|
} |
@ -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<AbnormalAlarmMapper, AbnormalAlarmEntity> 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<StationEntity> 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<HzPage<SoeData>> result = soeClient.getByStationsAndTime(query); |
||||||
|
// 未查询到告警信息
|
||||||
|
if(!result.isSuccess() || ObjectUtil.isEmpty(result.getData().getRecords())){ |
||||||
|
return; |
||||||
|
} |
||||||
|
log.error("alarm_data_handle_begin_result : {}",result.getData().getRecords()); |
||||||
|
// 遍历告警信息
|
||||||
|
List<SoeData> 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<SoeData> list,List<StationEntity> 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<HistoryAbnormalAlarmEntity> entitys,List<StationEntity> stations) { |
||||||
|
if(CollectionUtil.isEmpty(entitys)){ |
||||||
|
return; |
||||||
|
} |
||||||
|
// 告警等级 :事故、数据中断
|
||||||
|
List<HistoryAbnormalAlarmEntity> 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<Long> depts = stations.stream().filter(station -> station.getCode().equals(entity.getStationId())).map(StationEntity::getRefDept).collect(Collectors.toList()); |
||||||
|
if(CollectionUtil.isEmpty(depts)){ |
||||||
|
return; |
||||||
|
} |
||||||
|
// 获取站点用户
|
||||||
|
R<List<User>> 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<String> 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<String> getAbnormalAlarmList() { |
||||||
|
List<String> alarmList = this.baseMapper.getAbnormalAlarmList(); |
||||||
|
if(CollectionUtil.isEmpty(alarmList)){ |
||||||
|
return new ArrayList<>(); |
||||||
|
} |
||||||
|
return alarmList; |
||||||
|
} |
||||||
|
} |
@ -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<HistoryAbnormalAlarmMapper, HistoryAbnormalAlarmEntity> implements HistoryAbnormalAlarmService { |
||||||
|
/** |
||||||
|
* 查询单条历史告警 |
||||||
|
* |
||||||
|
* @param station |
||||||
|
* @param soeType |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
public HistoryAbnormalAlarmEntity getAbnormalAlarm(String station, String soeType) { |
||||||
|
List<HistoryAbnormalAlarmEntity> 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); |
||||||
|
} |
||||||
|
} |
@ -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<HzimsAnalyzeModelStationMapper, HzimsAnalyzeModelStationEntity> implements IHzimsAnalyzeModelStationService { |
||||||
|
} |
@ -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<EminfoAndEmParamVo> getEmInfoList() { |
||||||
|
List<EminfoAndEmParamVo> list = new ArrayList<>(); |
||||||
|
Object json = redisTemplate.opsForValue().get(emInfoListPath); |
||||||
|
if (ObjectUtil.isNotEmpty(json)) { |
||||||
|
list = JSONObject.parseObject(json.toString(), new TypeReference<List<EminfoAndEmParamVo>>() { |
||||||
|
}); |
||||||
|
} |
||||||
|
return list; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -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<EminfoAndEmParamVo> devices = systemMonitoringService.getEmInfoList(); |
||||||
|
// 设备开关机集合监测点
|
||||||
|
List<String> switchOnOff = devices.stream().map(o->{ |
||||||
|
Map<String,String> 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<StationRealVo> stationRealVos = (List<StationRealVo>) redisTemplate.opsForValue().get(moniter_realId_key); |
||||||
|
if(CollectionUtil.isEmpty(stationRealVos)){ |
||||||
|
return; |
||||||
|
} |
||||||
|
// 数据切割
|
||||||
|
int limit = countStep(stationRealVos.size()); |
||||||
|
List<List<StationRealVo>> 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); |
||||||
|
// <real,value>
|
||||||
|
Map<String,String> valueMap = new ConcurrentHashMap<>(); |
||||||
|
// <real,<attribute,value>>
|
||||||
|
Map<String,Map<String,String>> keyMap = new ConcurrentHashMap<>(); |
||||||
|
CountDownLatch countDownLatch = new CountDownLatch(limit); |
||||||
|
pool.execute(()-> list.forEach(stations -> { |
||||||
|
stations.forEach(stationReal -> { |
||||||
|
String[] realIdArr = stationReal.getRealId(); |
||||||
|
List<String> realIds = Stream.of(realIdArr).collect(Collectors.toList()); |
||||||
|
if(CollectionUtil.isEmpty(realIds)){ |
||||||
|
return; |
||||||
|
} |
||||||
|
log.error("real_time_data: {},{}",stationReal.getStation(),realIds); |
||||||
|
List<String> 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<String,String> attribute = (Map<String, String>) 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<String, String> value,List<String> 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<String, Map<String, String>> map = JSONObject.parseObject(json.toString(), new TypeReference<Map<String, Map<String, String>>>() { |
||||||
|
}); |
||||||
|
if (MapUtils.isEmpty(map)) { |
||||||
|
return; |
||||||
|
} |
||||||
|
log.info(thread.getName() + "步骤1获取检测点数据耗时 : {}",System.currentTimeMillis() - beginTime); |
||||||
|
beginTime = System.currentTimeMillis(); |
||||||
|
// 获取所有设备重点属性
|
||||||
|
List<StationAttributeEntity> list = attbtService.list(new LambdaQueryWrapper<StationAttributeEntity>() {{ |
||||||
|
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<StAlarmRecordEntity> alertList = alertService.list(new LambdaQueryWrapper<StAlarmRecordEntity>() {{ |
||||||
|
orderByDesc(StAlarmRecordEntity::getCreateTime); |
||||||
|
}}); |
||||||
|
log.info(thread.getName() + "步骤3获取告警记录 耗时 : {}",System.currentTimeMillis() - beginTime); |
||||||
|
beginTime = System.currentTimeMillis(); |
||||||
|
List<String> alarmList = abnormalAlarmService.getAbnormalAlarmList(); |
||||||
|
log.info(thread.getName() + "步骤4获取数据中断告警记录 耗时 : {}",System.currentTimeMillis() - beginTime); |
||||||
|
beginTime = System.currentTimeMillis(); |
||||||
|
// 获取所有故障记录
|
||||||
|
List<FdpFaultStatusVo> faultList = this.getFdpFaultAll(); |
||||||
|
log.info(thread.getName() + "步骤5获取故障记录 耗时 : {}",System.currentTimeMillis() - beginTime); |
||||||
|
beginTime = System.currentTimeMillis(); |
||||||
|
// 所有设备分类
|
||||||
|
Map<String, List<String>> deviceClassifyMap = (Map<String, List<String>>) redisTemplate.opsForValue().get(device_classify_key); |
||||||
|
log.info(thread.getName() + "步骤6获取设备分类 耗时 : {}",System.currentTimeMillis() - beginTime); |
||||||
|
beginTime = System.currentTimeMillis(); |
||||||
|
// 所有设备
|
||||||
|
List<EminfoAndEmParamVo> emList = maintenanceTaskService.getEmInfoList(); |
||||||
|
log.info(thread.getName() + "步骤7获取设备信息 耗时 : {}",System.currentTimeMillis() - beginTime); |
||||||
|
beginTime = System.currentTimeMillis(); |
||||||
|
// 根据站点分组
|
||||||
|
Map<String, List<StationAttributeEntity>> stationAttbtMap = list.stream().collect(Collectors.groupingBy(StationAttributeEntity::getStationId)); |
||||||
|
// 获取站点列表
|
||||||
|
List<StationEntity> stationEntityList = stationService.getStationByInCode(new ArrayList<>(stationAttbtMap.keySet())); |
||||||
|
log.info(thread.getName() + "步骤8站点列表 耗时 : {}",System.currentTimeMillis() - beginTime); |
||||||
|
beginTime = System.currentTimeMillis(); |
||||||
|
// 隐藏设备列表
|
||||||
|
List<String> hideList = stationAttrConfigService.getHideList(); |
||||||
|
// 分割,每个map限制10个长度
|
||||||
|
List<Map<String, List<StationAttributeEntity>>> 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<List<Dept>> deptAll = sysClient. getDeptList(); |
||||||
|
// 存储数据节点
|
||||||
|
List<RealStationVo> stationList = new CopyOnWriteArrayList<>(); |
||||||
|
pool.execute(()->{ |
||||||
|
// 线程处理数据
|
||||||
|
for(Map<String, List<StationAttributeEntity>> 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<String, List<StationAttributeEntity>> deviceAttbtMap = value.stream().filter(o -> !hideList.contains(o.getEmName())).collect(Collectors.groupingBy(StationAttributeEntity::getEmName)); |
||||||
|
List<RealDeviceVo> 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 <k> |
||||||
|
* @param <v> |
||||||
|
* @param chunkMap |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
private <k, v> List<Map<k, v>> mapChunk(Map<k, v> chunkMap) { |
||||||
|
if (chunkMap == null || RealMonitorServiceImpl.MAX_SEND <= 0) { |
||||||
|
List<Map<k, v>> list = new ArrayList<>(); |
||||||
|
list.add(chunkMap); |
||||||
|
return list; |
||||||
|
} |
||||||
|
Set<k> keySet = chunkMap.keySet(); |
||||||
|
Iterator<k> iterator = keySet.iterator(); |
||||||
|
int i = 1; |
||||||
|
List<Map<k, v>> total = new ArrayList<>(); |
||||||
|
Map<k, v> 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<EminfoAndEmParamVo> emList, Map<String, List<String>> deviceClassifyMap, List<RealDeviceVo> deviceList) { |
||||||
|
if (CollectionUtil.isEmpty(emList) || CollectionUtil.isEmpty(deviceList) || MapUtils.isEmpty(deviceClassifyMap)) { |
||||||
|
return; |
||||||
|
} |
||||||
|
List<String> faultList = deviceClassifyMap.get(HomePageConstant.FAULT); |
||||||
|
List<String> maintaintList = deviceClassifyMap.get(HomePageConstant.MAINTAIN); |
||||||
|
List<String> overhaultList = deviceClassifyMap.get(HomePageConstant.OVERHAUL); |
||||||
|
List<String> runtList = deviceClassifyMap.get(HomePageConstant.RUN); |
||||||
|
List<String> sparetList = deviceClassifyMap.get(HomePageConstant.SPARE); |
||||||
|
deviceList.forEach(device -> { |
||||||
|
if (StringUtil.isBlank(device.getDeviceCode())) { |
||||||
|
device.setState(-1); |
||||||
|
return; |
||||||
|
} |
||||||
|
List<EminfoAndEmParamVo> 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<FdpFaultStatusVo> getFdpFaultAll() { |
||||||
|
Object json = redisTemplate.opsForValue().get(fdp_fault_data_key); |
||||||
|
if (ObjectUtil.isEmpty(json)) { |
||||||
|
return new ArrayList<>(); |
||||||
|
} |
||||||
|
return (List<FdpFaultStatusVo>) json; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 设置站点状态 |
||||||
|
* @param alarmList |
||||||
|
* @param station |
||||||
|
* @param key |
||||||
|
*/ |
||||||
|
private void setStationStatus(List<String> alarmList, RealStationVo station, String key) { |
||||||
|
station.setStatus(0); |
||||||
|
if(alarmList.contains(key)){ |
||||||
|
station.setStatus(1); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 获取站点属性 |
||||||
|
* @param stationEntityList |
||||||
|
* @param item |
||||||
|
*/ |
||||||
|
private void stationParam(List<StationEntity> stationEntityList, RealStationVo item,List<Dept> deptAll) { |
||||||
|
if(CollectionUtil.isEmpty(stationEntityList)){ |
||||||
|
return; |
||||||
|
} |
||||||
|
List<StationEntity> 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<Dept> 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<StationAttributeEntity> list, Map<String, Map<String, String>> map, |
||||||
|
RealDeviceVo device, List<StAlarmRecordEntity> alertList, |
||||||
|
List<FdpFaultStatusVo> faultList) { |
||||||
|
if (CollectionUtil.isEmpty(list) || MapUtils.isEmpty(map)) { |
||||||
|
return; |
||||||
|
} |
||||||
|
List<RealAttributeVo> attbtList = new ArrayList<>(); |
||||||
|
list.forEach(item -> { |
||||||
|
RealAttributeVo realAttributeVo = new RealAttributeVo(); |
||||||
|
// 设备重点属性处理 : 单条-item
|
||||||
|
Map<String, String> 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<String, String> real, |
||||||
|
List<StAlarmRecordEntity> alertList, List<FdpFaultStatusVo> 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<FdpFaultStatusVo> faultList, String value) { |
||||||
|
if (CollectionUtil.isEmpty(faultList) || "-".equals(value)) { |
||||||
|
return; |
||||||
|
} |
||||||
|
List<FdpFaultStatusVo> 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<StAlarmRecordEntity> 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<StAlarmRecordEntity> handleList = alertList.stream().filter(o -> o.getStationId().equals(item.getStationId()) && o.getRealId().equals(attest.getRealId()) && o.getStatus() == 1).collect(Collectors.toList()); |
||||||
|
//查询出来未处理告警记录
|
||||||
|
List<StAlarmRecordEntity> 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<String, String> 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; |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
@ -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<StAlarmRecordMapper, StAlarmRecordEntity> 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); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -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<StFocusPropertiesMapper, StFocusPropertiesEntity> 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<StationEntity> stationList = stationService.getAll(); |
||||||
|
if(CollectionUtil.isEmpty(stationList)){ |
||||||
|
return; |
||||||
|
} |
||||||
|
// 设备监测点list
|
||||||
|
Object json = redisTemplate.opsForValue().get(em_info_list_path); |
||||||
|
List<EminfoAndEmParamVo> eminfoAndEmParams = JSONObject.parseObject(json.toString(), new TypeReference<List<EminfoAndEmParamVo>>() {}); |
||||||
|
// 厂房监测点list
|
||||||
|
List<AnalyzeCodeBySignagesVO> wsMonitorList = this.getRealIdByWsCodeAndSign(); |
||||||
|
// 实时监控监测点list
|
||||||
|
List<StationAttributeEntity> timeList = attbtService.list(new LambdaQueryWrapper<StationAttributeEntity>() {{ |
||||||
|
eq(StationAttributeEntity::getIsDeleted, "0"); |
||||||
|
isNotNull(StationAttributeEntity::getMonitorId); |
||||||
|
orderByAsc(StationAttributeEntity::getSort); |
||||||
|
}}); |
||||||
|
// 监测点存储list
|
||||||
|
List<StationRealVo> list = new ArrayList<>(); |
||||||
|
stationList.forEach(station->{ |
||||||
|
StationRealVo stationRealVo = new StationRealVo(); |
||||||
|
stationRealVo.setStation(station.getCode()); |
||||||
|
List<String> realDeviceList = this.getRealDeviceList(station.getRefDept(),eminfoAndEmParams); |
||||||
|
// 厂站匹配站点监测点集合
|
||||||
|
List<String> realWsList = wsMonitorList.stream().filter( |
||||||
|
o -> Func.isNotEmpty(o.getStation()) && o.getStation().equals(station.getCode()) |
||||||
|
).map(AnalyzeCodeBySignagesVO::getRealId).collect(Collectors.toList()); |
||||||
|
// 实时监控匹配站点监测点集合
|
||||||
|
List<String> 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<String> 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<AnalyzeCodeBySignagesVO> getRealIdByWsCodeAndSign() { |
||||||
|
R<List<WorkshopInfoEntity>> wsInfoListR = workshopInfoClient.getAllWorkshop(); |
||||||
|
List<WorkshopInfoEntity> 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<String, MultiAnalyzeCodePO> 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<MultiAnalyzeCodePO> analyzeCodePOList = wsInfoList.stream().map(WorkshopInfoEntity::getNumber).map(getAnalyzeCodePO).collect(Collectors.toList()); |
||||||
|
R<List<AnalyzeCodeBySignagesVO>> 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<String> getRealDeviceList(Long refDept, List<EminfoAndEmParamVo> eminfoAndEmParams) { |
||||||
|
// 参数检查
|
||||||
|
if(CollectionUtil.isEmpty(eminfoAndEmParams) || ObjectUtil.isEmpty(refDept)){ |
||||||
|
return new ArrayList<>(); |
||||||
|
} |
||||||
|
// 有效设备
|
||||||
|
List<EminfoAndEmParamVo> filters = eminfoAndEmParams.stream().filter(o-> o.getCreateDept().equals(refDept)).collect(Collectors.toList()); |
||||||
|
if(CollectionUtil.isEmpty(filters)){ |
||||||
|
return new ArrayList<>(); |
||||||
|
} |
||||||
|
// 遍历设备
|
||||||
|
List<String> result = new ArrayList<>(); |
||||||
|
for(EminfoAndEmParamVo device : filters){ |
||||||
|
result.addAll(device.getPoint().values()); |
||||||
|
} |
||||||
|
return result; |
||||||
|
} |
||||||
|
} |
@ -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<StationAttrConfigMapper, StationAttrConfigEntity> |
||||||
|
implements IStationAttrConfigService { |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public List<String> getHideList() { |
||||||
|
List<StationAttrConfigEntity> list = this.list(new QueryWrapper<StationAttrConfigEntity>() {{ |
||||||
|
eq("ENABLE_SHOW", false); |
||||||
|
eq("IS_DELETED",0); |
||||||
|
}}); |
||||||
|
if(CollectionUtil.isEmpty(list)){ |
||||||
|
return new ArrayList<>(); |
||||||
|
} |
||||||
|
return list.stream().map(StationAttrConfigEntity::getEmName).collect(Collectors.toList()); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -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<StationAttributeMapper, StationAttributeEntity> implements IStationAttributeService { |
||||||
|
|
||||||
|
} |
@ -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<StationMapper, StationEntity> implements IStationService { |
||||||
|
|
||||||
|
@Override |
||||||
|
public List<StationEntity> getStationByType(Integer stationType, Integer serveType) { |
||||||
|
return this.baseMapper.selectStationByType(stationType, serveType); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public List<StationEntity> getAll() { |
||||||
|
return this.baseMapper.selectAll(); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public List<StationEntity> getStationByInCode(List<String> codes) { |
||||||
|
return this.baseMapper.selectStationByInCode(codes); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public List<StationEntity> getStationType(Integer serveType, List<Integer> typeList, List<Long> departIdList) { |
||||||
|
return this.list(new LambdaQueryWrapper<StationEntity>() {{ |
||||||
|
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); |
||||||
|
} |
||||||
|
}}); |
||||||
|
} |
||||||
|
} |
@ -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<HzimsAnalyzeModelStationEntity> modelList = getModelStationList(); |
||||||
|
if(CollectionUtil.isEmpty(modelList)){ |
||||||
|
return; |
||||||
|
} |
||||||
|
List<WaterLevelVo> list = new ArrayList<>(); |
||||||
|
modelList.forEach(item -> { |
||||||
|
List<MultiAnalyzeCodePO> multiAnalyzeCodePOList = new ArrayList<>(); |
||||||
|
MultiAnalyzeCodePO multiAnalyzeCodePO = new MultiAnalyzeCodePO(); |
||||||
|
multiAnalyzeCodePO.setDeviceCode(item.getInstanceCode()); |
||||||
|
multiAnalyzeCodePO.setSignages(Collections.singletonList(HomePageConstant.FRONT_WATER_LEVEL)); |
||||||
|
multiAnalyzeCodePOList.add(multiAnalyzeCodePO); |
||||||
|
R<List<AnalyzeCodeBySignagesVO>> 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<Integer,String> frontCurveMap = this.getWaterLevelMap(item.getInstanceCode(),HomePageConstant.FRONT_WATER_LEVEL); |
||||||
|
waterLevelVo.setFrontCurveMap(frontCurveMap); |
||||||
|
// 后水位当日曲线
|
||||||
|
Map<Integer,String> 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<String> signages = Collections.singletonList(signage); |
||||||
|
realData.setSignages(signages); |
||||||
|
// 调用fegin接口查询实时数据
|
||||||
|
R<List<FieldsData>> 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<Integer, String> 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<AnalyzeDataConditionPO> 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<List<AnalyzeDataConditionVO>> 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<HzimsAnalyzeModelStationEntity> getModelStationList() { |
||||||
|
// 水利站点(All)
|
||||||
|
List<StationEntity> stationList = stationService.getStationType(HomePageConstant.HYDROPOWER_SERVETYPE, null, null); |
||||||
|
if(CollectionUtil.isEmpty(stationList)){ |
||||||
|
return null; |
||||||
|
} |
||||||
|
// 站点code集合
|
||||||
|
List<String> codes = stationList.stream().map(StationEntity::getCode).collect(Collectors.toList()); |
||||||
|
if(CollectionUtil.isEmpty(codes)){ |
||||||
|
return null; |
||||||
|
} |
||||||
|
// 查询站点模型列表
|
||||||
|
List<HzimsAnalyzeModelStationEntity> list = modelStationService.list(new LambdaQueryWrapper<HzimsAnalyzeModelStationEntity>() {{ |
||||||
|
in(HzimsAnalyzeModelStationEntity::getStationId, codes); |
||||||
|
}}); |
||||||
|
if(CollectionUtil.isEmpty(list)){ |
||||||
|
return null; |
||||||
|
} |
||||||
|
return list; |
||||||
|
} |
||||||
|
} |
@ -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; |
||||||
|
} |
@ -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<RealAttributeVo> attbtList; |
||||||
|
} |
||||||
|
|
@ -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<RealDeviceVo> deviceList; |
||||||
|
|
||||||
|
@ApiModelProperty("站点状态 : 0-正常 1-数据中断") |
||||||
|
private Integer status; |
||||||
|
|
||||||
|
@ApiModelProperty("排序") |
||||||
|
private Integer sort; |
||||||
|
} |
||||||
|
|
@ -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; |
||||||
|
} |
@ -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; |
||||||
|
} |
@ -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 |
||||||
|
|
||||||
|
|
@ -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); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue