From 302b525c1bd459b2fc6e27d3b4073aee6e8b3f2b Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期一, 28 十月 2024 17:28:30 +0800 Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV --- pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/intake/IntakeSv.java | 43 +++++++++++++++++++++++++------------------ 1 files changed, 25 insertions(+), 18 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 010f95c..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()); @@ -163,15 +167,18 @@ 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); + } } + return prIntakeMapper.getUsedIntakes(jsonArray.toJSONString(), operator); } else { return new ArrayList<>(); -- Gitblit v1.8.0