| | |
| | | import com.iailab.module.model.api.mdk.dto.MdkScheduleRespDTO; |
| | | import com.iailab.module.model.enums.CommonConstant; |
| | | import com.iailab.module.model.enums.ScheduleTriggerMethodEnum; |
| | | import com.iailab.module.shasteel.job.entity.MessageInfoEntity; |
| | | import com.iailab.module.shasteel.job.service.MessageInfoService; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | @Autowired |
| | | private MdkApi mdkApi; |
| | | |
| | | @Autowired |
| | | private MessageInfoService messageInfoService; |
| | | |
| | | private Map<String, StScheduleSchemeDTO> schemeMap = new HashMap<>(); |
| | | |
| | | /** |
| | |
| | | private static final String CODE01 = "01"; |
| | | |
| | | private static final String CODE_CONS = "consumpOxygenTest"; |
| | | |
| | | private static final String CODE_OXYGEN = "shaOxygenPlanDetection"; |
| | | |
| | | @Override |
| | | public void run(String params) { |
| | |
| | | saveAlarmMessage("耗氧异常检测", advice, scheduleObj, scheduleTime, adviceValues, scheduleScheme.getAdjustRate()); |
| | | } |
| | | } |
| | | else if (entry.getKey().equals(CODE_OXYGEN)) { |
| | | StScheduleSchemeDTO scheduleScheme = schemeMap.get(CODE_OXYGEN); |
| | | String scheduleObj = scheduleScheme.getScheduleObj(); |
| | | BigDecimal adviceValues = new BigDecimal(entry.getValue().getResult().get("adviceValues").toString()); |
| | | logger.info("耗氧异常检测(检修计划检测) adviceValues=" + adviceValues); |
| | | |
| | | String advice = entry.getValue().getResult().get("advice").toString(); |
| | | if(adviceValues.compareTo(BigDecimal.ZERO) != 0){ |
| | | saveAlarmMessage("耗氧异常检测", advice, scheduleObj, scheduleTime, adviceValues, scheduleScheme.getAdjustRate()); |
| | | } |
| | | } |
| | | } |
| | | logger.info(params + "调度方案执行完成"); |
| | | } catch (Exception ex) { |
| | |
| | | alarm.setAlarmType(adjustValue.compareTo(BigDecimal.ZERO) > 0 ? "超上限" : "超下限"); |
| | | alarm.setAlarmTime(scheduleTime); |
| | | mcsApi.createAlarmMessage(alarm); |
| | | MessageInfoEntity messageInfoEntity = new MessageInfoEntity(); |
| | | messageInfoEntity.setTitle(title); |
| | | messageInfoEntity.setContent(content); |
| | | messageInfoEntity.setSendTime(scheduleTime); |
| | | messageInfoEntity.setBusinessKey(alarm.getId()); |
| | | messageInfoEntity.setMessageSource("模型预警"); |
| | | messageInfoEntity.setCreateDate(new Date()); |
| | | messageInfoService.create(messageInfoEntity); |
| | | } |
| | | } |