Browse Source

#bug修改

zhongwei
yang_shj 2 years ago
parent
commit
99074a721e
  1. 10
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java
  2. 4
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/AlarmHandleEntity.java
  3. 5
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/HistoryLevelAlarmEntity.java
  4. 11
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmDataVo.java
  5. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicStationVo.java
  6. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.java
  7. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.xml
  8. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/AlarmHandleService.java
  9. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java
  10. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlertMerageServiceImpl.java
  11. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java
  12. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryLevelAlarmServiceImpl.java
  13. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/LevelAlarmServiceImpl.java
  14. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java

10
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<String> LEVEL_LIST = Arrays.asList("0","1");
/**
* 告警类型: 智能告警
*/
Integer SYSTEM_ALARM = 0;
/**
* 告警类型: 智能告警
*/
Integer INTELLIGENCE_ALARM = 1;
}

4
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;

5
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;

11
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;

2
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 = "七日内天气")

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.java

@ -20,5 +20,5 @@ public interface AlarmHandleMapper extends UserDataScopeBaseMapper<AlarmHandleEn
@UserDataAuth
IPage<AlarmHandleVo> selectHandlePage(IPage<Object> page,@Param("param") HandleQueryVo param);
List<AlarmHandleEntity> handles(@Param("types") List<Long> types,@Param("start") String start,@Param("end") String end);
List<AlarmHandleEntity> handles(@Param("types") List<Long> types,@Param("alarm") Integer alarm,@Param("start") String start,@Param("end") String end);
}

5
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.xml

@ -51,7 +51,10 @@
<if test="start != null and end != null">
and handler.create_time between #{start} and #{end}
</if>
and (detail.DELAY_TIME &gt; #{end} or detail.DELAY_TIME is null);
<if test="alarm != null">
and type = #{alarm}
</if>
and (detail.DELAY_TIME &gt; #{end} or detail.DELAY_TIME is null)
</where>
</select>
</mapper>

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/AlarmHandleService.java

@ -23,5 +23,5 @@ public interface AlarmHandleService extends BaseService<AlarmHandleEntity> {
List<User> handleUser();
List<AlarmHandleEntity> handles(List<Long> types);
List<AlarmHandleEntity> handles(List<Long> types,Integer alarmType);
}

5
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java

@ -80,6 +80,7 @@ public class AlarmHandleServiceImpl extends BaseServiceImpl<AlarmHandleMapper, A
// 处理记录
AlarmHandleEntity entity = new AlarmHandleEntity();
entity.setAlarmId(param.getAlarmId());
entity.setType(param.getType());
entity.setDetailId(detail.getId());
entity.setAlarmTime(param.getAlarmTime());
entity.setAlarmContent(param.getAlarmContent());
@ -150,9 +151,9 @@ public class AlarmHandleServiceImpl extends BaseServiceImpl<AlarmHandleMapper, A
* @return
*/
@Override
public List<AlarmHandleEntity> handles(List<Long> types) {
public List<AlarmHandleEntity> handles(List<Long> 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);
}
}

2
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<AlarmHandleEntity> handles = alarmHandleService.handles(AbnormalAlarmConstant.LONG_TYPE_LIST);
List<AlarmHandleEntity> handles = alarmHandleService.handles(AbnormalAlarmConstant.LONG_TYPE_LIST,null);
List<AlarmMergeVo> alarms = new ArrayList<>();
if(CollectionUtil.isNotEmpty(faults)){

7
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java

@ -250,8 +250,8 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
return new AlarmReustVo();
}
// 查询处理告警
List<AlarmHandleEntity> handles = handleService.handles(types.stream().map(Long::parseLong).collect(Collectors.toList()));
// 查询当天类型处理告警
List<AlarmHandleEntity> 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<HistoryAbno
}
record.setStationName(filter.get(0).getName());
record.setServeType(filter.get(0).getServeType());
record.setAlarmType(AbnormalAlarmConstant.SYSTEM_ALARM);
return record;
}).sorted(Comparator.comparing(AlarmDataVo::getIsHandle)
.thenComparing(AlarmDataVo::getTs, Comparator.reverseOrder())).collect(Collectors.toList());
response.setCount((int) datas.stream().filter(data-> !data.getIsHandle()).count());
response.setCount((int) (result.getData().getTotal() - handles.size()));
response.setSoeList(datas);
response.setTotal(result.getData().getTotal());
return response;

7
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryLevelAlarmServiceImpl.java

@ -61,9 +61,12 @@ public class HistoryLevelAlarmServiceImpl extends BaseServiceImpl<HistoryLevelAl
IPage<HistoryLevelAlarmEntity> page = super.page(Condition.getPage(query), wrapper);
List<HistoryLevelAlarmEntity> records = page.getRecords();
// 步骤2. 过滤已处理等級告警
List<AlarmHandleEntity> handles = handleService.handles(ObjectUtil.isEmpty(entity.getType()) ? AbnormalAlarmConstant.LONG_TYPE_LIST : Collections.singletonList(Long.parseLong(entity.getType())));
List<AlarmHandleEntity> 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;
}

2
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<HistoryLevelAlarmEntity> entitys = alarms.stream().filter(alarm -> CollectionUtil.isNotEmpty(historys) /*|| !historys.stream().map(HistoryLevelAlarmEntity::getAlarmId).collect(Collectors.toList()).contains(alarm.getId())*/).map(item->{
List<HistoryLevelAlarmEntity> 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"));

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java

@ -741,7 +741,7 @@ public class StAlamRecordServiceImpl extends BaseServiceImpl<StAlarmRecordMapper
}
Map<String,String> map = stations.stream().collect(Collectors.toMap(StationEntity::getCode,StationEntity::getName));
// 查询已处理预警数据
List<AlarmHandleEntity> handles = handleService.handles(Collections.singletonList(AbnormalAlarmConstant.EARLY_WARNING));
List<AlarmHandleEntity> 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());
}

Loading…
Cancel
Save