Browse Source

#告警修改

zhongwei
yang_shj 10 months ago
parent
commit
afc8d84848
  1. 10
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/AlarmScheduledTask.java
  2. 2
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/AlarmQueryService.java
  3. 15
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmQueryServiceImpl.java
  4. 4
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java

10
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/AlarmScheduledTask.java

@ -39,4 +39,14 @@ public class AlarmScheduledTask {
service.startStopAlarm(param);
return new ReturnT<>("SUCCESS");
}
@XxlJob(START_STOP_ALARM)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> interruptAlarm(String param) {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
service.interruptAlarm(param);
return new ReturnT<>("SUCCESS");
}
}

2
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/AlarmQueryService.java

@ -16,4 +16,6 @@ public interface AlarmQueryService extends BaseService<AlarmEntity> {
List<String> bells(List<String> codes);
List<String> aborts(List<String> codes);
void interruptAlarm(String param);
}

15
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmQueryServiceImpl.java

@ -178,14 +178,23 @@ public class AlarmQueryServiceImpl extends BaseServiceImpl<AlarmQueryMapper, Ala
if(CollectionUtil.isEmpty(alarms)){
return new ArrayList<>();
}
return alarms.stream().collect(Collectors.groupingBy(AlarmEntity::getStationId)).entrySet().stream().map(entry->{
return alarms.stream().collect(Collectors.groupingBy(AlarmEntity::getStationId)).values().stream().map(alarmEntities -> {
// 站点最近的一条数据中断、数据异常告警
AlarmEntity alarm = entry.getValue().stream().sorted(Comparator.comparing(AlarmEntity::getCreateTime).reversed()).collect(Collectors.toList()).get(0);
AlarmEntity alarm = alarmEntities.stream().sorted(Comparator.comparing(AlarmEntity::getCreateTime).reversed()).collect(Collectors.toList()).get(0);
// 状态为中断
if(alarm.getAlarmStatus().equals(0)){
if (alarm.getAlarmStatus().equals(0)) {
return alarm.getStationId();
}
return "";
}).filter(StringUtil::isBlank).distinct().collect(Collectors.toList());
}
/**
* 数据中断告警
* @param param
*/
@Override
public void interruptAlarm(String param) {
}
}

4
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java

@ -862,7 +862,7 @@ public class ReportServiceImpl implements ReportService {
List<RunAlarmVo> alarms = this.hz3000Alarm(code,start,end);
// FIXME 设备实例:一级告警
// FDP智能预警
// alarms.addAll(this.intelligentEarly(code,start,end));
alarms.addAll(this.intelligentEarly(code,start,end));
return JSONObject.toJSONString(alarms);
}
@ -904,7 +904,7 @@ public class ReportServiceImpl implements ReportService {
StbAnalysisDTO param = new StbAnalysisDTO();
param.setStartTime(LocalDateTime.parse(start,DateUtil.DATETIME_FORMATTER));
param.setEndTime(LocalDateTime.parse(end, DateUtil.DATETIME_FORMATTER));
param.setStation(code);
param.setStations(Collections.singletonList(code));
param.setPage(0);
param.setPageSize(100000);
Result<HzPage<StbAnalysisVO>> result = soeDataClient.pageStbAnalysis(param);

Loading…
Cancel
Save