| | |
| | | package com.iailab.module.shasteel.job.task; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.iailab.module.model.api.mcs.McsApi; |
| | | import com.iailab.module.model.api.mcs.dto.AlarmMessageRespDTO; |
| | | import com.iailab.module.model.api.mcs.dto.ScheduleSuggestRespDTO; |
| | |
| | | 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; |
| | |
| | | * 氮气预警模型 |
| | | * 预警信号 advice |
| | | * |
| | | * consumpOxygenTest |
| | | * 耗氧异常检测 |
| | | * 预警信号 advice |
| | | * |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2025年01月07日 |
| | |
| | | |
| | | @Autowired |
| | | private MdkApi mdkApi; |
| | | |
| | | @Autowired |
| | | private MessageInfoService messageInfoService; |
| | | |
| | | private Map<String, StScheduleSchemeDTO> schemeMap = new HashMap<>(); |
| | | |
| | |
| | | private static final String CODE05 = "05"; |
| | | |
| | | 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) { |
| | |
| | | |
| | | String advice = entry.getValue().getResult().get("advice").toString(); |
| | | if(adviceValues.compareTo(BigDecimal.ZERO) != 0){ |
| | | saveScheduleSuggest("各制氧机组建议", advice, scheduleObj, scheduleTime, adviceValues, scheduleScheme.getAdjustRate()); |
| | | saveScheduleSuggest("各制氧机组建议", advice, scheduleObj, scheduleTime, adviceValues, scheduleScheme.getAdjustRate(), scheduleScheme.getModelId(), scheduleScheme.getId()); |
| | | } |
| | | |
| | | } else if (entry.getKey().equals(CODE01)) { |
| | |
| | | String advice = entry.getValue().getResult().get("advice").toString(); |
| | | if(adviceValues.compareTo(BigDecimal.ZERO) != 0){ |
| | | saveAlarmMessage("氮气预警", advice, scheduleObj, scheduleTime,adviceValues,scheduleScheme.getAdjustRate()); |
| | | } |
| | | }else if (entry.getKey().equals(CODE_CONS)) { |
| | | StScheduleSchemeDTO scheduleScheme = schemeMap.get(CODE_CONS); |
| | | 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()); |
| | | } |
| | | } |
| | | 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()); |
| | | } |
| | | } |
| | | } |
| | |
| | | mcsApi.createScheduleSuggest(suggest); |
| | | } |
| | | |
| | | private void saveScheduleSuggest(String title, String content, String scheduleObj, Date scheduleTime, BigDecimal adjustValue, int adjustRate) { |
| | | private void saveScheduleSuggest(String title, String content, String scheduleObj, Date scheduleTime, BigDecimal adjustValue, int adjustRate, String modelId, String schemeId) { |
| | | if (StringUtils.isBlank(content)) { |
| | | logger.info(title + "调整值为空,不产生建议"); |
| | | return; |
| | |
| | | suggest.setContent(content); |
| | | suggest.setScheduleObj(scheduleObj); |
| | | suggest.setScheduleTime(scheduleTime); |
| | | suggest.setModelId(modelId); |
| | | suggest.setSchemeId(schemeId); |
| | | suggest.setSort(0); |
| | | mcsApi.createScheduleSuggest(suggest); |
| | | } |