From 1a2b07f01ba4616fd9e894dddf474b56d020158c Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期一, 07 四月 2025 15:18:51 +0800
Subject: [PATCH] 整理版本

---
 pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerSv.java |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerSv.java
index d741f10..edec64e 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerSv.java
@@ -6,6 +6,7 @@
 import com.dy.common.multiDataSource.DataSourceContext;
 import com.dy.common.mw.protocol.Command;
 import com.dy.common.webUtil.BaseResponse;
+import com.dy.common.webUtil.BaseResponseUtils;
 import com.dy.common.webUtil.QueryResultVo;
 import com.dy.pipIrrGlobal.daoPr.PrControllerMapper;
 import com.dy.pipIrrGlobal.daoPr.PrIntakeControllerMapper;
@@ -25,7 +26,10 @@
 import org.springframework.web.client.RestTemplate;
 import org.springframework.web.util.UriComponentsBuilder;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
 
 /**
  * @author ZhuBaoMin
@@ -80,19 +84,13 @@
         comSendUrl = env.getProperty(pro_mw + "." + DataSourceContext.get() + "." + key_mw);
 
         JSONObject response = (JSONObject) JSON.toJSON(sendCom2Mw(com));
+
+
         if (response != null && response.getString("code").equals("0001")) {
-            //JSONObject attachment = response.getJSONObject("content").getJSONObject("attachment").getJSONObject("onLineMap");
             JSONObject attachment = response.getJSONObject("content").getJSONObject("attachment");
 
             JSONArray jsonArray = new JSONArray();
             if(attachment != null) {
-                //HashMap<String, Boolean> onLineMap = JSON.parseObject(attachment.toJSONString(), HashMap.class);
-                //for (Map.Entry<String, Boolean> entry : onLineMap.entrySet()) {
-                //    JSONObject jsonObject = new JSONObject();
-                //    jsonObject.put("rtuAddr", entry.getKey());
-                //    jsonObject.put("isOnLine", entry.getValue());
-                //    jsonArray.add(jsonObject);
-                //}
                 attachment.forEach((key, value) -> {
                     JSONObject jsonObject = new JSONObject();
                     jsonObject.put("rtuAddr", key);
@@ -264,6 +262,11 @@
         } catch (Exception e) {
             e.printStackTrace();
         }
+
+        if(response == null) {
+            return BaseResponseUtils.buildErrorMsg("涓棿浠惰皟鐢ㄥけ璐�");
+        }
+
         return response.getBody();
     }
 }

--
Gitblit v1.8.0