沙钢智慧能源系统后端代码
shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunScheduleOnaOptTask.java
@@ -1,7 +1,6 @@
package com.iailab.module.shasteel.job.task;
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.mcs.dto.StScheduleSchemeDTO;
import com.iailab.module.model.api.mdk.MdkApi;
@@ -82,21 +81,20 @@
            }
            schemeMap.clear();
            Map<String, MdkScheduleRespDTO> resultMap = new HashMap<String, MdkScheduleRespDTO>();
            schemeList.forEach(item -> {
                schemeMap.put(item.getCode(), item);
                StScheduleSchemeDTO scheme = schemeList.get(0);
            schemeList.forEach(scheme -> {
                schemeMap.put(scheme.getCode(), scheme);
                MdkScheduleReqDTO dto = new MdkScheduleReqDTO();
                dto.setScheduleTime(scheduleTime);
                dto.setScheduleCode(scheme.getCode());
                MdkScheduleRespDTO mdkScheduleRespDTO = mdkApi.doSchedule(dto);
                resultMap.put(item.getCode(), mdkScheduleRespDTO);
                resultMap.put(scheme.getCode(), mdkScheduleRespDTO);
            });
            if (CollectionUtils.isEmpty(resultMap)) {
                logger.info("resultMap为空");
                return;
            }
            for (Map.Entry<String, MdkScheduleRespDTO> entry : resultMap.entrySet()) {
                if (CommonConstant.MDK_STATUS_100.equals(entry.getValue().getStatusCode())) {
                if (!CommonConstant.MDK_STATUS_100.equals(entry.getValue().getStatusCode())) {
                    logger.info("调度结果异常,STATUS=" + entry.getValue().getStatusCode());
                    continue;
                }
@@ -104,21 +102,31 @@
                if (entry.getKey().equals(CODE06)) {
                    // 氧气班平衡计划,建议值写入测点
                    mdkApi.scheduleModelOut(entry.getValue());
                    logger.info("氧气班平衡计划下发参数: {}", entry.getValue());
                } else if (entry.getKey().equals(CODE05)) {
                    String scheduleObj = schemeMap.get(CODE05).getScheduleObj();
                    // double[] adviceValues = (double[]) entry.getValue().getResult().get("adviceValues");
                    String yingdiAdvice = entry.getValue().getResult().get("yingdiAdvice").toString();
                    saveScheduleSuggest("盈德中压建议调整量", yingdiAdvice, scheduleObj, scheduleTime);
                    String faAdvice = entry.getValue().getResult().get("faAdvice").toString();
                    saveScheduleSuggest("法夜空建议调整量", faAdvice, scheduleObj, scheduleTime);
                    String hongAdvice = entry.getValue().getResult().get("hongAdvice").toString();
                    saveScheduleSuggest("宏昌建议调整量", hongAdvice, scheduleObj, scheduleTime);
                    String runAdvice = entry.getValue().getResult().get("RunAdvice").toString();
                    saveScheduleSuggest("宏昌建议调整量", runAdvice, scheduleObj, scheduleTime);
                    String runAdvice = entry.getValue().getResult().get("runAdvice").toString();
                    String yingdiAdvice = entry.getValue().getResult().get("yingdiAdvice").toString();
                    if(!("压力正常".equals(yingdiAdvice)||"-2.0".equals(yingdiAdvice))){
                        saveScheduleSuggest("盈德中压调整建议", yingdiAdvice, scheduleObj, scheduleTime);
                    }
                    if(!("压力正常".equals(faAdvice)||"-2.0".equals(faAdvice))){
                        saveScheduleSuggest("法夜空调整建议", faAdvice, scheduleObj, scheduleTime);
                    }
                    if(!("压力正常".equals(hongAdvice)||"-2.0".equals(hongAdvice))){
                        saveScheduleSuggest("宏昌调整建议", hongAdvice, scheduleObj, scheduleTime);
                    }
                    if(!("压力正常".equals(runAdvice)||"-2.0".equals(runAdvice))){
                        saveScheduleSuggest("润忠调整建议", runAdvice, scheduleObj, scheduleTime);
                    }
                } else if (entry.getKey().equals(CODE01)) {
                    String scheduleObj = schemeMap.get(CODE05).getScheduleObj();
                    String scheduleObj = schemeMap.get(CODE01).getScheduleObj();
                    String advice = entry.getValue().getResult().get("advice").toString();
                    saveScheduleSuggest("氮气预警", advice, scheduleObj, scheduleTime);
                    if(!("压力正常".equals(advice)||"-2.0".equals(advice))){
                        saveScheduleSuggest("氮气预警", advice, scheduleObj, scheduleTime);
                    }
                }
            }
            logger.info(params + "调度方案执行完成");