From 62a7f3228c94db41bf57858a6549eb0db033bf1e Mon Sep 17 00:00:00 2001
From: Administrator <zhubaomin>
Date: 星期三, 29 五月 2024 11:44:17 +0800
Subject: [PATCH] 2024-05-29 朱宝民

---
 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandSv.java |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandSv.java
index 7482f9d..00296db 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandSv.java
@@ -18,6 +18,7 @@
 import org.apache.dubbo.common.utils.PojoUtils;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -116,4 +117,33 @@
         }
     }
 
+    /**
+     * 鏍规嵁鎿嶄綔鍛樿幏鍙栧父鐢ㄥ彇姘村彛
+     * @param operator
+     * @return
+     */
+    public List<VoOnLineIntake> getUsedIntakes(Long operator) {
+        Command com = new Command() ;
+        com.id = Command.defaultId;
+        com.code = "LCD0001";
+        com.type = "innerCommand";
+        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);
+            }
+            return prIntakeMapper.getUsedIntakes(jsonArray.toJSONString(), operator);
+        } else {
+            return new ArrayList<>();
+        }
+    }
+
 }

--
Gitblit v1.8.0