From e2212f87aa207448a171b3b8e177f6fe3b804236 Mon Sep 17 00:00:00 2001
From: dengzedong <dengzedong@email>
Date: 星期五, 24 一月 2025 10:56:56 +0800
Subject: [PATCH] 功率因数调度 保存调度建议 判空

---
 shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/consumer/ModelElecPredictFinishConsumer.java |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/consumer/ModelElecPredictFinishConsumer.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/consumer/ModelElecPredictFinishConsumer.java
index e76ebbf..c0229c5 100644
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/consumer/ModelElecPredictFinishConsumer.java
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/consumer/ModelElecPredictFinishConsumer.java
@@ -10,6 +10,7 @@
 import com.iailab.module.shasteel.mq.common.constant.CommonConstant;
 import com.iailab.module.shasteel.mq.config.QueuePredictFinishConfig;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.amqp.core.Message;
 import org.springframework.amqp.rabbit.annotation.RabbitListener;
 import org.springframework.stereotype.Component;
@@ -71,14 +72,16 @@
             if (elecScheduleCodes.contains(stScheduleSchemeDTO.getCode())) {
                 Map<String, Object> result = mdkScheduleRespDTO.getResult();
                 if (result.containsKey(adviceKey)) {
-                    String advice = result.get(adviceKey).toString();
-                    ScheduleSuggestRespDTO suggest = new ScheduleSuggestRespDTO();
-                    suggest.setTitle("电力调度建议");
-                    suggest.setContent(advice);
-                    suggest.setScheduleObj(stScheduleSchemeDTO.getScheduleObj());
-                    suggest.setScheduleTime(scheduleTime);
-                    suggest.setSort(0);
-                    mcsApi.createScheduleSuggest(suggest);
+                    String advice = result.get(adviceKey).toString().trim();
+                    if (StringUtils.isNotBlank(advice)) {
+                        ScheduleSuggestRespDTO suggest = new ScheduleSuggestRespDTO();
+                        suggest.setTitle("电力调度建议");
+                        suggest.setContent(advice);
+                        suggest.setScheduleObj(stScheduleSchemeDTO.getScheduleObj());
+                        suggest.setScheduleTime(scheduleTime);
+                        suggest.setSort(0);
+                        mcsApi.createScheduleSuggest(suggest);
+                    }
                 }
             }
 

--
Gitblit v1.9.3