From afc8d8484883d188793eec91b9542d61dee7a047 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Tue, 30 Jan 2024 16:29:59 +0800 Subject: [PATCH] =?UTF-8?q?#=E5=91=8A=E8=AD=A6=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/scheduled/scheduled/AlarmScheduledTask.java | 10 ++++++++++ .../hzims/scheduled/service/alarm/AlarmQueryService.java | 2 ++ .../service/alarm/impl/AlarmQueryServiceImpl.java | 15 ++++++++++++--- .../service/operation/report/impl/ReportServiceImpl.java | 4 ++-- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/AlarmScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/AlarmScheduledTask.java index 6f4721d..f6b7552 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/AlarmScheduledTask.java +++ b/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 interruptAlarm(String param) { + if (Func.isBlank(param)) { + param = DateUtil.format(new Date(), "yyyy-MM"); + } + service.interruptAlarm(param); + return new ReturnT<>("SUCCESS"); + } } \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/AlarmQueryService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/AlarmQueryService.java index 5b8f793..ff85d1c 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/AlarmQueryService.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/AlarmQueryService.java @@ -16,4 +16,6 @@ public interface AlarmQueryService extends BaseService { List bells(List codes); List aborts(List codes); + + void interruptAlarm(String param); } \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmQueryServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmQueryServiceImpl.java index fd31272..a922504 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmQueryServiceImpl.java +++ b/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(); } - 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) { + + } } \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java index 81b5dae..373edb3 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java +++ b/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 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> result = soeDataClient.pageStbAnalysis(param);