From 6cce675bb26ab0ffbdc19fe7f48cb3fcbd9890e3 Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期二, 07 一月 2025 16:01:18 +0800
Subject: [PATCH] 压缩空气优化调度

---
 shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunScheduleAirDispatchTask.java |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunScheduleAirDispatchTask.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunScheduleAirDispatchTask.java
index 6d424e8..74a9c66 100644
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunScheduleAirDispatchTask.java
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunScheduleAirDispatchTask.java
@@ -67,14 +67,15 @@
             dto.setScheduleTime(scheduleTime);
             dto.setScheduleCode(scheme.getCode());
             MdkScheduleRespDTO mdkScheduleRespDTO = mdkApi.doSchedule(dto);
-            if (CommonConstant.MDK_STATUS_100.equals(mdkScheduleRespDTO.getStatusCode())) {
+            if (!CommonConstant.MDK_STATUS_100.equals(mdkScheduleRespDTO.getStatusCode())) {
                 logger.info("调度结果异常,STATUS=" + mdkScheduleRespDTO.getStatusCode());
                 return;
             }
 
             // 保存预警信息
-            String pressureLWarning = mdkScheduleRespDTO.getResult().get("pressureLWarning").toString();
-            if (StringUtils.isNotBlank(pressureLWarning)) {
+            if (mdkScheduleRespDTO.getResult().get("pressureLWarning") != null &&
+                    StringUtils.isNotEmpty(mdkScheduleRespDTO.getResult().get("pressureLWarning").toString())) {
+                String pressureLWarning = mdkScheduleRespDTO.getResult().get("pressureLWarning").toString();
                 AlarmMessageRespDTO alarm = new AlarmMessageRespDTO();
                 alarm.setTitle("压力低于下限预警");
                 alarm.setContent(pressureLWarning);
@@ -84,8 +85,10 @@
                 mcsApi.createAlarmMessage(alarm);
             }
 
-            String pressureHWarning = mdkScheduleRespDTO.getResult().get("pressureHWarning").toString();
-            if (StringUtils.isNotBlank(pressureHWarning)) {
+
+            if (mdkScheduleRespDTO.getResult().get("pressureHWarning") != null &&
+                    StringUtils.isNotEmpty(mdkScheduleRespDTO.getResult().get("pressureHWarning").toString())) {
+                String pressureHWarning = mdkScheduleRespDTO.getResult().get("pressureHWarning").toString();
                 AlarmMessageRespDTO alarm = new AlarmMessageRespDTO();
                 alarm.setTitle("压力高于上限预警");
                 alarm.setContent(pressureHWarning);
@@ -96,8 +99,9 @@
             }
 
             // 保存调度建议
-            String dispatchStart = mdkScheduleRespDTO.getResult().get("dispatchStart").toString();
-            if (StringUtils.isNotBlank(pressureHWarning)) {
+            if (mdkScheduleRespDTO.getResult().get("dispatchStart") != null &&
+                    StringUtils.isNotEmpty(mdkScheduleRespDTO.getResult().get("dispatchStart").toString())) {
+                String dispatchStart = mdkScheduleRespDTO.getResult().get("dispatchStart").toString();
                 ScheduleSuggestRespDTO suggest = new ScheduleSuggestRespDTO();
                 suggest.setTitle("空压机启动调度建议");
                 suggest.setContent(dispatchStart);
@@ -107,8 +111,9 @@
                 mcsApi.createScheduleSuggest(suggest);
             }
 
-            String dispatchClose = mdkScheduleRespDTO.getResult().get("dispatchClose").toString();
-            if (StringUtils.isNotBlank(dispatchClose)) {
+            if (mdkScheduleRespDTO.getResult().get("dispatchClose") != null &&
+                    StringUtils.isNotEmpty(mdkScheduleRespDTO.getResult().get("dispatchClose").toString())) {
+                String dispatchClose = mdkScheduleRespDTO.getResult().get("dispatchClose").toString();
                 ScheduleSuggestRespDTO suggest = new ScheduleSuggestRespDTO();
                 suggest.setTitle("空压机关停调度建议");
                 suggest.setContent(dispatchClose);

--
Gitblit v1.9.3