From 99074a721e05f7fff7ebbf6bb52d8c7d1ca30e2d Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Wed, 10 May 2023 14:42:15 +0800 Subject: [PATCH] =?UTF-8?q?#bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operational/alert/constants/AbnormalAlarmConstant.java | 10 ++++++++++ .../hzims/operational/alert/entity/AlarmHandleEntity.java | 4 ++++ .../operational/alert/entity/HistoryLevelAlarmEntity.java | 5 +++++ .../java/com/hnac/hzims/operational/alert/vo/AlarmDataVo.java | 11 ++++------- .../hnac/hzims/operational/main/vo/PhotovoltaicStationVo.java | 2 ++ .../hzims/operational/alert/mapper/AlarmHandleMapper.java | 2 +- .../hnac/hzims/operational/alert/mapper/AlarmHandleMapper.xml | 5 ++++- .../hzims/operational/alert/service/AlarmHandleService.java | 2 +- .../alert/service/impl/AlarmHandleServiceImpl.java | 5 +++-- .../alert/service/impl/AlertMerageServiceImpl.java | 2 +- .../alert/service/impl/HistoryAbnormalAlarmServiceImpl.java | 7 ++++--- .../alert/service/impl/HistoryLevelAlarmServiceImpl.java | 7 +++++-- .../operational/alert/service/impl/LevelAlarmServiceImpl.java | 2 +- .../config/service/impl/StAlamRecordServiceImpl.java | 2 +- 14 files changed, 46 insertions(+), 20 deletions(-) diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java index c67229b..eab3ee0 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java @@ -44,4 +44,14 @@ public interface AbnormalAlarmConstant { * 告警等级: 0 - 1级告警 1-二级告警 */ List LEVEL_LIST = Arrays.asList("0","1"); + + /** + * 告警类型: 智能告警 + */ + Integer SYSTEM_ALARM = 0; + + /** + * 告警类型: 智能告警 + */ + Integer INTELLIGENCE_ALARM = 1; } diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/AlarmHandleEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/AlarmHandleEntity.java index 88a300f..1fc22fc 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/AlarmHandleEntity.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/AlarmHandleEntity.java @@ -3,6 +3,7 @@ package com.hnac.hzims.operational.alert.entity; 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; @@ -27,6 +28,9 @@ public class AlarmHandleEntity extends BaseEntity { @ApiModelProperty("告警类型") private Long alarmType; + @ApiModelProperty("告警所属类型:0-系统告警 1-智能告警") + private Integer type; + @ApiModelProperty("告警时间") private Date alarmTime; 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 index b8a201f..a6d4b73 100644 --- 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 @@ -4,6 +4,7 @@ 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; @@ -55,6 +56,10 @@ public class HistoryLevelAlarmEntity extends BaseEntity { @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 index ecc5e1c..034e1a9 100644 --- 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 @@ -15,13 +15,7 @@ import lombok.EqualsAndHashCode; public class AlarmDataVo extends SoeData { @ApiModelProperty(value = "数量") - private String unitName; - - @ApiModelProperty(value = "数量") - private String pointName; - - @ApiModelProperty(value = "数量") - private int count; + private Integer count; @ApiModelProperty(value = "站点编号") private String stationCode; @@ -41,6 +35,9 @@ public class AlarmDataVo extends SoeData { @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/main/vo/PhotovoltaicStationVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicStationVo.java index 8138281..6220223 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicStationVo.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicStationVo.java @@ -82,9 +82,11 @@ public class PhotovoltaicStationVo { private String temp; @ApiModelProperty(value = "站点收益") + @JsonSerialize(nullsUsing = NullSerializer.class) private Double income; @ApiModelProperty(value = "逆变器数量") + @JsonSerialize(nullsUsing = NullSerializer.class) private Integer inverterCount; @ApiModelProperty(value = "七日内天气") diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.java index c989ecc..0c55878 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.java @@ -20,5 +20,5 @@ public interface AlarmHandleMapper extends UserDataScopeBaseMapper selectHandlePage(IPage page,@Param("param") HandleQueryVo param); - List handles(@Param("types") List types,@Param("start") String start,@Param("end") String end); + List handles(@Param("types") List types,@Param("alarm") Integer alarm,@Param("start") String start,@Param("end") String end); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.xml b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.xml index ab07923..ec557f8 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.xml +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.xml @@ -51,7 +51,10 @@ and handler.create_time between #{start} and #{end} - and (detail.DELAY_TIME > #{end} or detail.DELAY_TIME is null); + + and type = #{alarm} + + and (detail.DELAY_TIME > #{end} or detail.DELAY_TIME is null) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/AlarmHandleService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/AlarmHandleService.java index 9fe3eb2..ce66494 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/AlarmHandleService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/AlarmHandleService.java @@ -23,5 +23,5 @@ public interface AlarmHandleService extends BaseService { List handleUser(); - List handles(List types); + List handles(List types,Integer alarmType); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java index b78f73d..a2fb1b9 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java @@ -80,6 +80,7 @@ public class AlarmHandleServiceImpl extends BaseServiceImpl handles(List types) { + public List handles(List types,Integer alarm) { String start = DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00"; String end = DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME); - return this.baseMapper.handles(types,start,end); + return this.baseMapper.handles(types,alarm,start,end); } } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlertMerageServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlertMerageServiceImpl.java index 65aba88..ab5864c 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlertMerageServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlertMerageServiceImpl.java @@ -76,7 +76,7 @@ public class AlertMerageServiceImpl implements AlarmMergeService { .between(HistoryAbnormalAlarmEntity::getStartTime,start,end) ); // 处理告警记录 - List handles = alarmHandleService.handles(AbnormalAlarmConstant.LONG_TYPE_LIST); + List handles = alarmHandleService.handles(AbnormalAlarmConstant.LONG_TYPE_LIST,null); List alarms = new ArrayList<>(); if(CollectionUtil.isNotEmpty(faults)){ diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java index 9a234f2..bbce8f5 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java @@ -250,8 +250,8 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl handles = handleService.handles(types.stream().map(Long::parseLong).collect(Collectors.toList())); + // 查询当天类型处理告警 + List handles = handleService.handles(types.stream().map(Long::parseLong).collect(Collectors.toList()),AbnormalAlarmConstant.INTELLIGENCE_ALARM); // 返回数据 AlarmReustVo response = new AlarmReustVo(); @@ -274,11 +274,12 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl !data.getIsHandle()).count()); + response.setCount((int) (result.getData().getTotal() - handles.size())); response.setSoeList(datas); response.setTotal(result.getData().getTotal()); return response; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryLevelAlarmServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryLevelAlarmServiceImpl.java index 6910c67..62b35e1 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryLevelAlarmServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryLevelAlarmServiceImpl.java @@ -61,9 +61,12 @@ public class HistoryLevelAlarmServiceImpl extends BaseServiceImpl page = super.page(Condition.getPage(query), wrapper); List records = page.getRecords(); // 步骤2. 过滤已处理等級告警 - List handles = handleService.handles(ObjectUtil.isEmpty(entity.getType()) ? AbnormalAlarmConstant.LONG_TYPE_LIST : Collections.singletonList(Long.parseLong(entity.getType()))); + List handles = handleService.handles(ObjectUtil.isEmpty(entity.getType()) ? AbnormalAlarmConstant.LONG_TYPE_LIST : Collections.singletonList(Long.parseLong(entity.getType())),AbnormalAlarmConstant.INTELLIGENCE_ALARM); - page.setRecords(records.stream().peek(record-> record.setIsHandle(CollectionUtil.isNotEmpty(handles) || handles.stream().map(AlarmHandleEntity::getAlarmId).collect(Collectors.toList()).contains(record.getAlarmId()))).collect(Collectors.toList())); + page.setRecords(records.stream().peek(record-> { + record.setIsHandle(CollectionUtil.isNotEmpty(handles) || handles.stream().map(AlarmHandleEntity::getAlarmId).collect(Collectors.toList()).contains(record.getAlarmId())); + record.setAlarmType(AbnormalAlarmConstant.INTELLIGENCE_ALARM); + }).collect(Collectors.toList())); return page; } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/LevelAlarmServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/LevelAlarmServiceImpl.java index 3839214..b607b2c 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/LevelAlarmServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/LevelAlarmServiceImpl.java @@ -101,7 +101,7 @@ public class LevelAlarmServiceImpl implements LevelAlarmService { ); // 数据过滤 - List entitys = alarms.stream().filter(alarm -> CollectionUtil.isNotEmpty(historys) /*|| !historys.stream().map(HistoryLevelAlarmEntity::getAlarmId).collect(Collectors.toList()).contains(alarm.getId())*/).map(item->{ + List entitys = alarms.stream().filter(alarm -> CollectionUtil.isNotEmpty(historys) || !historys.stream().map(HistoryLevelAlarmEntity::getAlarmId).collect(Collectors.toList()).contains(alarm.getId())).map(item->{ HistoryLevelAlarmEntity entity = new HistoryLevelAlarmEntity(); entity.setAlarmId(item.getId()); entity.setAlarmTime(DateUtil.parse(item.getTs(), "yyyy-MM-dd HH:mm:ss.s")); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java index f11f3ae..5114295 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java @@ -741,7 +741,7 @@ public class StAlamRecordServiceImpl extends BaseServiceImpl map = stations.stream().collect(Collectors.toMap(StationEntity::getCode,StationEntity::getName)); // 查询已处理预警数据 - List handles = handleService.handles(Collections.singletonList(AbnormalAlarmConstant.EARLY_WARNING)); + List handles = handleService.handles(Collections.singletonList(AbnormalAlarmConstant.EARLY_WARNING),null); if(CollectionUtil.isEmpty(handles)){ return list.stream().filter(fault -> map.containsKey(fault.getStation())).peek(o-> o.setStationName(map.get(o.getStation()))).collect(Collectors.toList()); }