From cef410f571a2960e979ca9383d9c8dd01ecc862c Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期一, 28 十月 2024 14:44:31 +0800
Subject: [PATCH] 2024-10-28 常用取水口单独建表,按照使用时间和使用次数排序

---
 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/intake/IntakeSv.java |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/intake/IntakeSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/intake/IntakeSv.java
index d3a59e3..2f4884a 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/intake/IntakeSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/intake/IntakeSv.java
@@ -78,14 +78,16 @@
         JSONObject response = (JSONObject) JSON.toJSON(sendCom2Mw(com));
         if(response != null && response.getString("code").equals("0001")) {
             JSONObject attachment = response.getJSONObject("content").getJSONObject("attachment").getJSONObject("onLineMap");
-            HashMap<String, Boolean> onLineMap = JSON.parseObject(attachment.toJSONString(), HashMap.class);
 
             JSONArray jsonArray = new JSONArray();
-            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);
+            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);
+                }
             }
 
             qo.setOnLineMap(jsonArray.toJSONString());
@@ -116,14 +118,16 @@
         JSONObject response = (JSONObject) JSON.toJSON(sendCom2Mw(com));
         if(response != null && response.getString("code").equals("0001")) {
             JSONObject attachment = response.getJSONObject("content").getJSONObject("attachment").getJSONObject("onLineMap");
-            HashMap<String, Boolean> onLineMap = JSON.parseObject(attachment.toJSONString(), HashMap.class);
 
             JSONArray jsonArray = new JSONArray();
-            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);
+            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);
+                }
             }
 
             qo.setOnLineMap(jsonArray.toJSONString());

--
Gitblit v1.8.0