| | |
| | | package com.iailab.module.shasteel.mq.consumer; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.iailab.framework.common.util.date.DateUtils; |
| | | import com.iailab.module.model.api.mcs.McsApi; |
| | |
| | | |
| | | private static String lastRunGasSchedule = ""; |
| | | |
| | | // 最早调度时间 |
| | | private static Date earliestScheduleTime = null; |
| | | |
| | | /** |
| | | * 监听报警信息,执行调度 |
| | | * |
| | |
| | | return; |
| | | } |
| | | |
| | | // 判断predictTime 是否大于outTime,否则不执行调度 |
| | | if (earliestScheduleTime != null && predictTime.compareTo(earliestScheduleTime) < 0) { |
| | | return; |
| | | } |
| | | |
| | | List<AlarmMessageRespDTO> alarmList = JSONObject.parseArray(messageJson.get("alarmList").toString(),AlarmMessageRespDTO.class); |
| | | // 取出最小outTime |
| | | Date minOutTime = alarmList.stream().filter(e -> e.getOutTime() != null).map(AlarmMessageRespDTO::getOutTime).min(Date::compareTo).get(); |
| | | earliestScheduleTime = minOutTime; |
| | | |
| | | |
| | | // 查找需要执行的调度方案 |
| | | List<StScheduleSchemeDTO> scheduleSchemeList = mcsApi.listScheduleScheme(ScheduleTriggerMethodEnum.EVENT.getCode(), routingKey); |
| | | if (CollectionUtils.isEmpty(scheduleSchemeList)) { |