|
|
@ -61,9 +61,9 @@ public class AbnormalAlarmServiceImpl extends BaseServiceImpl<AbnormalAlarmMappe |
|
|
|
query.setTypes(AbnormalAlarmConstant.TYPE_LIST); |
|
|
|
query.setTypes(AbnormalAlarmConstant.TYPE_LIST); |
|
|
|
query.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList())); |
|
|
|
query.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList())); |
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
query.setEndTime(LocalDateTime.parse(DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME), df)); |
|
|
|
query.setEndTime(LocalDateTime.parse(/*DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME)*/"2022-12-30 00:00:00", df)); |
|
|
|
calendar.add(Calendar.MINUTE,-2); |
|
|
|
calendar.add(Calendar.MINUTE,-2); |
|
|
|
query.setBeginTime(LocalDateTime.parse(DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME), df)); |
|
|
|
query.setBeginTime(LocalDateTime.parse(/*DateUtil.format(calendar.getTime() , DateUtil.PATTERN_DATETIME)*/"2022-12-01 00:00:00", df)); |
|
|
|
query.setNeedPage(false); |
|
|
|
query.setNeedPage(false); |
|
|
|
log.error("alarm_data_handle_param : {}",query); |
|
|
|
log.error("alarm_data_handle_param : {}",query); |
|
|
|
R<BladePage<SoeData>> result = soeClient.getByStationsAndTime(query); |
|
|
|
R<BladePage<SoeData>> result = soeClient.getByStationsAndTime(query); |
|
|
@ -103,6 +103,7 @@ public class AbnormalAlarmServiceImpl extends BaseServiceImpl<AbnormalAlarmMappe |
|
|
|
queryEntity.setStationName(stationName); |
|
|
|
queryEntity.setStationName(stationName); |
|
|
|
queryEntity.setType(item.getSoeType()); |
|
|
|
queryEntity.setType(item.getSoeType()); |
|
|
|
queryEntity.setStartTime(queryEntity.getStartTime()); |
|
|
|
queryEntity.setStartTime(queryEntity.getStartTime()); |
|
|
|
|
|
|
|
queryEntity.setUpdateTime(new Date()); |
|
|
|
queryEntity.setEndTime(null); |
|
|
|
queryEntity.setEndTime(null); |
|
|
|
queryEntity.setStatus(0); |
|
|
|
queryEntity.setStatus(0); |
|
|
|
if(flag){ |
|
|
|
if(flag){ |
|
|
@ -137,10 +138,12 @@ public class AbnormalAlarmServiceImpl extends BaseServiceImpl<AbnormalAlarmMappe |
|
|
|
private String saveHistoryAlarm(List<SoeData> list,List<StationEntity> stations) { |
|
|
|
private String saveHistoryAlarm(List<SoeData> list,List<StationEntity> stations) { |
|
|
|
list.forEach(item -> { |
|
|
|
list.forEach(item -> { |
|
|
|
Date ts = DateUtil.parse(DateUtil.format(item.getTs(),DateUtil.PATTERN_DATETIME),DateUtil.DATETIME_FORMAT); |
|
|
|
Date ts = DateUtil.parse(DateUtil.format(item.getTs(),DateUtil.PATTERN_DATETIME),DateUtil.DATETIME_FORMAT); |
|
|
|
HistoryAbnormalAlarmEntity queryEntity = this.historyAbnormalAlarmService.getAbnormalAlarm(item.getStation(),item.getSoeType(),ts); |
|
|
|
// 历史数据异常查询
|
|
|
|
String stationName = Optional.ofNullable(stations.stream().filter(o-> o.getCode().equals(item.getStation())).collect(Collectors.toList())).map(o->o.get(0).getName()).orElse(null); |
|
|
|
HistoryAbnormalAlarmEntity queryEntity = this.historyAbnormalAlarmService.getAbnormalAlarm(item.getStation(),item.getSoeType()); |
|
|
|
|
|
|
|
// 数据中断恢复
|
|
|
|
boolean flag = AbnormalAlarmConstant.ABNORMAL_STATUS.equals(item.getSoeAlarmType()); |
|
|
|
boolean flag = AbnormalAlarmConstant.ABNORMAL_STATUS.equals(item.getSoeAlarmType()); |
|
|
|
if(ObjectUtil.isEmpty(queryEntity)){ |
|
|
|
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(); |
|
|
|
HistoryAbnormalAlarmEntity entity = new HistoryAbnormalAlarmEntity(); |
|
|
|
entity.setStationId(item.getStation()); |
|
|
|
entity.setStationId(item.getStation()); |
|
|
|
entity.setStationName(stationName); |
|
|
|
entity.setStationName(stationName); |
|
|
@ -149,11 +152,14 @@ public class AbnormalAlarmServiceImpl extends BaseServiceImpl<AbnormalAlarmMappe |
|
|
|
entity.setType(item.getSoeType()); |
|
|
|
entity.setType(item.getSoeType()); |
|
|
|
entity.setStartTime(ts); |
|
|
|
entity.setStartTime(ts); |
|
|
|
entity.setStatus(0); |
|
|
|
entity.setStatus(0); |
|
|
|
if(flag){ |
|
|
|
|
|
|
|
entity.setStatus(1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.historyAbnormalAlarmService.save(entity); |
|
|
|
this.historyAbnormalAlarmService.save(entity); |
|
|
|
|
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
queryEntity.setSoeExplain(item.getSoeExplain()); |
|
|
|
|
|
|
|
queryEntity.setUpdateTime(new Date()); |
|
|
|
|
|
|
|
queryEntity.setEndTime(item.getTs()); |
|
|
|
|
|
|
|
queryEntity.setStatus(1); |
|
|
|
|
|
|
|
this.historyAbnormalAlarmService.updateById(queryEntity); |
|
|
|
}); |
|
|
|
}); |
|
|
|
return "success"; |
|
|
|
return "success"; |
|
|
|
} |
|
|
|
} |
|
|
|