From f511f52e44d5a2cf29af82950acef4b07526a687 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Mon, 19 Feb 2024 10:07:17 +0800 Subject: [PATCH] =?UTF-8?q?#=E6=95=B0=E6=8D=AE=E4=B8=AD=E6=96=AD=E5=91=8A?= =?UTF-8?q?=E8=AD=A6=E7=A7=BB=E6=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/constants/AlarmHandleConstant.java | 37 ------------ .../constants/InterruptionConstants.java | 3 + .../interruption/entity/InterruptionEntity.java | 29 ++++++++++ .../alert/constants/AlertDefectConfigConstant.java | 9 --- .../alert/entity/AbnormalAlarmEntity.java | 41 -------------- .../alert/entity/AlertDefectConfigEntity.java | 20 ------- .../alert/entity/HistoryAbnormalAlarmEntity.java | 50 ---------------- .../alert/entity/HistoryLevelAlarmEntity.java | 66 ---------------------- .../hzims/operational/alert/vo/AlarmDataVo.java | 44 --------------- .../hzims/operational/alert/vo/AlarmMergeVo.java | 48 ---------------- .../hzims/operational/alert/vo/AlarmParamVo.java | 30 ---------- .../hzims/operational/alert/vo/AlarmReustVo.java | 31 ---------- .../hnac/hzims/operational/alert/vo/AlertVo.java | 36 ------------ .../hzims/operational/alert/vo/HandleQueryVo.java | 30 ---------- .../hzims/operational/alert/vo/HistoryAlarmVo.java | 42 -------------- .../hzims/operational/alert/vo/SoeParamVo.java | 29 ---------- .../hzims/operational/alert/vo/SoeReustVo.java | 31 ---------- .../alarm/impl/InterruptionAlarmServiceImpl.java | 38 ++++++++++++- 18 files changed, 67 insertions(+), 547 deletions(-) delete mode 100644 hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AlertDefectConfigConstant.java delete mode 100644 hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/AbnormalAlarmEntity.java delete mode 100644 hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/AlertDefectConfigEntity.java delete mode 100644 hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/HistoryAbnormalAlarmEntity.java delete mode 100644 hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/HistoryLevelAlarmEntity.java delete mode 100644 hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmDataVo.java delete mode 100644 hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmMergeVo.java delete mode 100644 hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmParamVo.java delete mode 100644 hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmReustVo.java delete mode 100644 hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlertVo.java delete mode 100644 hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/HandleQueryVo.java delete mode 100644 hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/HistoryAlarmVo.java delete mode 100644 hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/SoeParamVo.java delete mode 100644 hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/SoeReustVo.java diff --git a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/constants/AlarmHandleConstant.java b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/constants/AlarmHandleConstant.java index ef59136..4bdbaa1 100644 --- a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/constants/AlarmHandleConstant.java +++ b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/constants/AlarmHandleConstant.java @@ -7,57 +7,20 @@ import java.util.List; * @author YSJ */ public interface AlarmHandleConstant { - - List INTERRUPT_LIST = Arrays.asList("13","14"); - - List TYPE_LIST = Arrays.asList("3","2","5","10","13","14"); - - List LONG_TYPE_LIST = Arrays.asList(3L,2L,5L,10L,13L,14L); - - List SEND_MESSSAGE_TYPE_LIST = Arrays.asList("3","13","14"); - - String LEVEL_TYPE_LIST = "3,2,5,10,13,14"; String SYSTEM_TYPE_LIST = "3,2,5,13,14"; - /**通讯恢复*/ - String ABNORMAL_STATUS = "1"; - /**故障**/ String FAULT = "3"; /**预警**/ Long EARLY_WARNING = 20L; - String WEBSOCKET_FAULT = "3"; - - String[] TYPE_NAMES = {"默认", "系统", "告警" - , "故障", "用户操作", "遥测越限", "遥信变位", "注册信息", "信息提示", "设备巡检", "遥控操作", "遥测越限恢复","未定义","通讯中断","数据异常"}; - /**误报 、延后、缺陷 、检修、处理*/ List HANDLE_WAY = Arrays.asList(1L,2L,3L,4L,5L); List HANDLE = Arrays.asList(3L,4L,5L); /** - * 2-告警,3-故障,5-遥测越限,13-通讯异常,14-数据异常 - */ - List SOE_TYPE_LIST = Arrays.asList(2,3,5,13,14); - - /** - * 告警等级: 0 - 1级告警 1-二级告警 - */ - List LEVEL_LIST = Arrays.asList("0","1"); - - /** - * 告警类型: HZ3000告警 - */ - Integer SYSTEM_ALARM = 0; - - /** - * 告警类型: 智能告警 - */ - Integer INTELLIGENCE_ALARM = 1; - /** * 告警类型: 视频告警 */ Integer VIDEO_ALARM = 4; diff --git a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/business/interruption/constants/InterruptionConstants.java b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/business/interruption/constants/InterruptionConstants.java index 3beabb5..6a93515 100644 --- a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/business/interruption/constants/InterruptionConstants.java +++ b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/business/interruption/constants/InterruptionConstants.java @@ -9,4 +9,7 @@ import java.util.List; public interface InterruptionConstants { List INTERRUPTION_TYPE = Arrays.asList("13","14"); + + /**通讯恢复*/ + String ABNORMAL_STATUS = "1"; } diff --git a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/business/interruption/entity/InterruptionEntity.java b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/business/interruption/entity/InterruptionEntity.java index 106e6a1..ea57aac 100644 --- a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/business/interruption/entity/InterruptionEntity.java +++ b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/business/interruption/entity/InterruptionEntity.java @@ -2,10 +2,13 @@ package com.hnac.hzims.business.interruption.entity; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import org.springblade.core.tenant.mp.TenantEntity; +import java.util.Date; + /** * @author ysj @@ -16,4 +19,30 @@ import org.springblade.core.tenant.mp.TenantEntity; @ApiModel(value = "数据中断告警", description = "数据中断告警对象") public class InterruptionEntity extends TenantEntity { + @ApiModelProperty("ID") + private Long id; + + @ApiModelProperty("站点编码") + private String stationId; + + @ApiModelProperty("站点名称") + private String stationName; + + @ApiModelProperty("告警编码") + private Long alarmId; + + @ApiModelProperty("检查点") + private String realId; + + @ApiModelProperty("告警开始时间") + private Date alarmTime; + + @ApiModelProperty("告警类型") + private String type; + + @ApiModelProperty("状态") + private Integer status; + + @ApiModelProperty("告警原因") + private String soeExplain; } \ No newline at end of file diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AlertDefectConfigConstant.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AlertDefectConfigConstant.java deleted file mode 100644 index 2250541..0000000 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AlertDefectConfigConstant.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.hnac.hzims.operational.alert.constants; - -/** - * @author YSJ - */ -public interface AlertDefectConfigConstant { - - String ALERT_SOURCE_CODE = "XTGJ"; -} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/AbnormalAlarmEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/AbnormalAlarmEntity.java deleted file mode 100644 index ebef512..0000000 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/AbnormalAlarmEntity.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.hnac.hzims.operational.alert.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import org.springblade.core.mp.base.BaseEntity; - -import java.util.Date; - -@Data -@TableName("hzims_abnormal_alarm") -@EqualsAndHashCode(callSuper = true) -@ApiModel(value = "数据中断告警对象") -public class AbnormalAlarmEntity extends BaseEntity { - - @ApiModelProperty("站点编码") - private String stationId; - - @ApiModelProperty("站点名称") - private String stationName; - - @ApiModelProperty("检查点") - private String realId; - - @ApiModelProperty("告警开始时间") - private Date startTime; - - @ApiModelProperty("告警结束时间") - private Date endTime; - - @ApiModelProperty("告警类型") - private String type; - - @ApiModelProperty("状态") - private Integer status; - - @ApiModelProperty("告警原因") - private String soeExplain; -} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/AlertDefectConfigEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/AlertDefectConfigEntity.java deleted file mode 100644 index 0f63dcf..0000000 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/AlertDefectConfigEntity.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.hnac.hzims.operational.alert.entity; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * @author : YSJ - */ -@Data -public class AlertDefectConfigEntity { - - @ApiModelProperty("主键ID") - private Integer id; - - @ApiModelProperty("告警类型") - private Integer alertType; - - @ApiModelProperty("是否开启缺陷保存 : 0-关闭 1 - 开启") - private Integer isOpen; -} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/HistoryAbnormalAlarmEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/HistoryAbnormalAlarmEntity.java deleted file mode 100644 index 8dc40fd..0000000 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/HistoryAbnormalAlarmEntity.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.hnac.hzims.operational.alert.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import org.springblade.core.mp.base.BaseEntity; - -import java.util.Date; - -/** - * @author ysj - */ -@Data -@TableName("hzims_history_abnormal_alarm") -@EqualsAndHashCode(callSuper = false) -@ApiModel(value = "数据中断告警对象") -public class HistoryAbnormalAlarmEntity extends BaseEntity { - - @ApiModelProperty("ID") - private Long id; - - @ApiModelProperty("站点编码") - private String stationId; - - @ApiModelProperty("站点名称") - private String stationName; - - @ApiModelProperty("告警编码") - private Long alarmId; - - @ApiModelProperty("检查点") - private String realId; - - @ApiModelProperty("告警开始时间") - private Date startTime; - - @ApiModelProperty("告警结束时间") - private Date endTime; - - @ApiModelProperty("告警类型") - private String type; - - @ApiModelProperty("状态") - private Integer status; - - @ApiModelProperty("告警原因") - private String soeExplain; -} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/HistoryLevelAlarmEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/HistoryLevelAlarmEntity.java deleted file mode 100644 index a6d4b73..0000000 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/HistoryLevelAlarmEntity.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.hnac.hzims.operational.alert.entity; - -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import io.swagger.models.auth.In; -import lombok.Data; -import lombok.EqualsAndHashCode; -import org.springblade.core.mp.base.BaseEntity; - -import java.util.Date; - -/** - * @author ysj - */ -@Data -@TableName("hzims_history_level_alarm") -@EqualsAndHashCode(callSuper = false) -@ApiModel(value = "数据中断告警对象") -public class HistoryLevelAlarmEntity extends BaseEntity { - - @ApiModelProperty("ID") - private Long id; - - @ApiModelProperty("站点编码") - private String stationId; - - @ApiModelProperty("站点名称") - private String stationName; - - @ApiModelProperty("设备编码") - private String deviceCode; - - @ApiModelProperty("设备名称") - private String deviceName; - - @ApiModelProperty("告警等级") - private String alarmLevel; - - @ApiModelProperty("告警编码") - private String alarmId; - - @ApiModelProperty("检查点") - private String realId; - - @ApiModelProperty("告警开始时间") - private Date alarmTime; - - @ApiModelProperty("告警类型") - private String type; - - @ApiModelProperty("状态") - private Integer status; - - @ApiModelProperty("告警原因") - private String soeExplain; - - @ApiModelProperty(value = "告警所属类型:0-系统告警 1-智能告警") - @TableField(exist=false) - private Integer alarmType; - - @ApiModelProperty(value = "告警是否处理") - @TableField(exist=false) - private Boolean isHandle; -} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmDataVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmDataVo.java deleted file mode 100644 index 034e1a9..0000000 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmDataVo.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.hnac.hzims.operational.alert.vo; - -import com.hnac.hzinfo.datasearch.soe.domian.SoeData; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * @author ysj - * @date 2023/03/23 14:06:27 - * @version 4.0.0 - */ -@EqualsAndHashCode(callSuper = true) -@Data -public class AlarmDataVo extends SoeData { - - @ApiModelProperty(value = "数量") - private Integer count; - - @ApiModelProperty(value = "站点编号") - private String stationCode; - - @ApiModelProperty(value = "站点名称") - private String stationName; - - @ApiModelProperty(value = "内容") - private String content; - - @ApiModelProperty(value = "是否绑定") - private Boolean isBinding; - - @ApiModelProperty(value = "站点类型: 2-待运维 1-云服务") - private String serveType; - - @ApiModelProperty(value = "告警类型") - private String type; - - @ApiModelProperty(value = "告警所属类型:0-系统告警 1-智能告警") - private Integer alarmType; - - @ApiModelProperty(value = "告警是否处理") - private Boolean isHandle; - -} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmMergeVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmMergeVo.java deleted file mode 100644 index 79bddc2..0000000 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmMergeVo.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.hnac.hzims.operational.alert.vo; - -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModelProperty; -import io.swagger.models.auth.In; -import lombok.Data; -import org.springblade.core.tool.utils.DateUtil; -import org.springframework.format.annotation.DateTimeFormat; - -import java.util.Date; - -/** - * @author ysj - * @date 2023/03/17 10:02:33 - * @version 4.0.0 - */ -@Data -public class AlarmMergeVo{ - - @ApiModelProperty("站点编号") - private String stationCode; - - @ApiModelProperty("站点名称") - private String stationName; - - @ApiModelProperty("检测点位") - private String realId; - - @ApiModelProperty("告警编号") - private String alarmCode; - - @ApiModelProperty("告警等级") - private String level; - - @ApiModelProperty("告警类型") - private String type; - - @ApiModelProperty("类型:0-系统告警、2-智能告警") - private Integer alarmType; - - @ApiModelProperty("告警内容") - private String content; - - @ApiModelProperty("告警时间") - @DateTimeFormat(pattern = DateUtil.PATTERN_DATE) - @JsonFormat(pattern = DateUtil.PATTERN_DATE) - private Date date; -} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmParamVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmParamVo.java deleted file mode 100644 index 197e415..0000000 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmParamVo.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.hnac.hzims.operational.alert.vo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * @author ysj - * @date 2023/03/23 13:34:37 - * @version 4.0.0 - */ -@Data -public class AlarmParamVo { - - @ApiModelProperty(value = "查询开始时间:yyyy-MM-dd HH:mm:ss") - private String date; - - @ApiModelProperty(value = "默认,系统,告警,故障,用户操作,遥测越限,遥信变位,注册信息,信息提示,设备巡检,遥控操作,遥测越限恢复,未定义,通讯中断,数据异常") - private String type; - - @ApiModelProperty(value = "当前页码") - private Integer current; - - - @ApiModelProperty(value = "每页条目") - private Integer size; - - - @ApiModelProperty(value = "站点编码") - private String code; -} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmReustVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmReustVo.java deleted file mode 100644 index e30ae12..0000000 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmReustVo.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.hnac.hzims.operational.alert.vo; - -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.NullSerializer; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.List; - -/** - * @author ysj - * @date 2023/03/23 13:34:37 - * @version 4.0.0 - */ -@Data -public class AlarmReustVo { - - @ApiModelProperty(value = "最新的时间") - private String date; - - @ApiModelProperty(value = "告警数据") - private List soeList; - - @ApiModelProperty(value = "数量统计") - @JsonSerialize(nullsUsing = NullSerializer.class) - private Integer count; - - @ApiModelProperty(value = "总条数") - @JsonSerialize(nullsUsing = NullSerializer.class) - private Long total; -} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlertVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlertVo.java deleted file mode 100644 index a780a71..0000000 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlertVo.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.hnac.hzims.operational.alert.vo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * 告警对象 - */ -@Data -public class AlertVo { - - - @ApiModelProperty("主键Id") - private String id; - - @ApiModelProperty("告警类型") - private String soeType; - - @ApiModelProperty("告警状态") - private String soeStatus; - - @ApiModelProperty("站点") - private String station; - - @ApiModelProperty("事件未定义(通道:2 模块:1 点号:2006)") - private String soeExplain; - - @ApiModelProperty("告警报警类型") - private String soeAlarmType; - - @ApiModelProperty("监测点位") - private String realid; - - @ApiModelProperty("时间") - private String ts; -} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/HandleQueryVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/HandleQueryVo.java deleted file mode 100644 index ff0a9df..0000000 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/HandleQueryVo.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.hnac.hzims.operational.alert.vo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.Date; - -/** - * @author ysj - * @date 2023/03/17 10:02:33 - * @version 4.0.0 - */ -@Data -public class HandleQueryVo { - - @ApiModelProperty("处理人") - private String stationCode; - - @ApiModelProperty("处理人") - private Long handleUser; - - @ApiModelProperty("开始时间") - private Date startTime; - - @ApiModelProperty("结束时间") - private Date endTime; - - @ApiModelProperty("处理类型:1-延后 2-误报 3-缺陷 4-检修") - private Long handleWay; -} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/HistoryAlarmVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/HistoryAlarmVo.java deleted file mode 100644 index dad9dc4..0000000 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/HistoryAlarmVo.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.hnac.hzims.operational.alert.vo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import org.springblade.core.mp.base.BaseEntity; - -import java.util.Date; -import java.util.List; - -@Data -public class HistoryAlarmVo extends BaseEntity { - - @ApiModelProperty("ID") - private Long id; - - @ApiModelProperty("站点编码") - private String stationId; - - @ApiModelProperty("站点名称") - private String stationName; - - @ApiModelProperty("告警编码") - private Long alarmId; - - @ApiModelProperty("检查点") - private String realId; - - @ApiModelProperty("告警开始时间") - private Date startTime; - - @ApiModelProperty("告警结束时间") - private Date endTime; - - @ApiModelProperty("告警类型") - private List type; - - @ApiModelProperty("状态") - private Integer status; - - @ApiModelProperty("告警原因") - private String soeExplain; -} \ No newline at end of file diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/SoeParamVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/SoeParamVo.java deleted file mode 100644 index 2f9d104..0000000 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/SoeParamVo.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.hnac.hzims.operational.alert.vo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * @author ysj - * @date 2023/03/23 13:34:37 - * @version 4.0.0 - */ -@Data -public class SoeParamVo { - - @ApiModelProperty(value = "站点编码") - private String code; - - @ApiModelProperty(value = "查询开始时间:yyyy-MM-dd HH:mm:ss") - private String date; - - @ApiModelProperty(value = "2-告警,3-故障,5-遥测越限,13-通讯异常,14-数据异常") - private Integer type; - - @ApiModelProperty(value = "当前页码") - private Integer current; - - - @ApiModelProperty(value = "每页条目") - private Integer size; -} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/SoeReustVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/SoeReustVo.java deleted file mode 100644 index 379542d..0000000 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/SoeReustVo.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.hnac.hzims.operational.alert.vo; - -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.NullSerializer; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.List; - -/** - * @author ysj - * @date 2023/03/23 13:34:37 - * @version 4.0.0 - */ -@Data -public class SoeReustVo { - - @ApiModelProperty(value = "最新的时间") - private String date; - - @ApiModelProperty(value = "告警数据") - private List soeList; - - @ApiModelProperty(value = "数量统计") - @JsonSerialize(nullsUsing = NullSerializer.class) - private Integer count; - - @ApiModelProperty(value = "总条数") - @JsonSerialize(nullsUsing = NullSerializer.class) - private Long total; -} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/InterruptionAlarmServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/InterruptionAlarmServiceImpl.java index 57c2615..4b1e416 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/InterruptionAlarmServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/InterruptionAlarmServiceImpl.java @@ -20,9 +20,9 @@ import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.ObjectUtil; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.time.LocalDateTime; -import java.util.ArrayList; import java.util.Calendar; import java.util.List; import java.util.stream.Collectors; @@ -45,6 +45,7 @@ public class InterruptionAlarmServiceImpl extends BaseServiceImpl stations = stationService.list(Wrappers.lambdaQuery() @@ -73,15 +74,46 @@ public class InterruptionAlarmServiceImpl extends BaseServiceImpl soes = result.getData().getRecords(); // 查询当天数据中断告警记录 List saves = this.saveInterruptions(stations.stream().map(StationEntity::getCode).collect(Collectors.toList())); + // 批量保存中断告警数据 + this.saveBatch(soes.stream().filter(o-> CollectionUtil.isEmpty(saves) || !saves.stream().map(InterruptionEntity::getAlarmId).collect(Collectors.toList()).contains(o.getId())).map(soe->{ + InterruptionEntity entity = new InterruptionEntity(); + List soeStations = stations.stream().filter(o->o.getCode().equals(soe.getStation())).collect(Collectors.toList()); + if(!CollectionUtil.isEmpty(soeStations)){ + entity.setStationId(soeStations.get(0).getCode()); + entity.setStationName(soeStations.get(0).getName()); + entity.setCreateDept(soeStations.get(0).getRefDept()); + } + entity.setAlarmId(soe.getId()); + entity.setRealId(soe.getRealId()); + entity.setSoeExplain(soe.getSoeExplain()); + entity.setType(soe.getSoeType()); + entity.setAlarmTime(soe.getTs()); + entity.setStatus(0); + // 通讯中断恢复 + if(InterruptionConstants.ABNORMAL_STATUS.equals(soe.getSoeAlarmType())){ + entity.setStatus(1); + } + return entity; + }).collect(Collectors.toList())); } + /** * 查询当天数据中断告警记录 * @param stations * @return */ private List saveInterruptions(List stations) { - this.list(Wrappers.lambdaQuery()); - return new ArrayList<>(); + Calendar calendar = Calendar.getInstance(); + String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); + calendar.add(Calendar.HOUR_OF_DAY, -calendar.get(Calendar.HOUR_OF_DAY)); + calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE)); + calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND)); + String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); + return this.list(Wrappers.lambdaQuery() + .in(InterruptionEntity::getStationId,stations) + .ge(InterruptionEntity::getCreateTime,start) + .le(InterruptionEntity::getCreateTime,end) + ); } } \ No newline at end of file