From 73ef7206a89b119a68b7de9abd68c7664d1c605c Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期三, 07 五月 2025 09:47:35 +0800
Subject: [PATCH] 获取轮灌组详情返回值增加是否已开

---
 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/IrrigationSv.java |   33 ++++++++++++++++++++++++++-------
 1 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/IrrigationSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/IrrigationSv.java
index 205ec52..b853e64 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/IrrigationSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/IrrigationSv.java
@@ -136,7 +136,10 @@
                 return map;
             }
             for (VoIntake intake : intakes) {
-                intake.setIsOnLine(getRtuStatus(intake.getRtuAddr()));
+                Boolean isOnLine = getOnlineStatus(intake.getRtuAddr());
+                intake.setIsOnLine(isOnLine);
+                Boolean isOpen = getOpenCloseStatus(intake.getRtuAddr());
+                intake.setIsOpen(isOpen);
             }
             voGroupIntakes.setIntakes(intakes);
 
@@ -154,12 +157,7 @@
         }
     }
 
-    /**
-     * 鑾峰彇rtu鍦ㄧ嚎鎯呭喌
-     * @param rtuAdd
-     * @return
-     */
-    public Boolean getRtuStatus(String rtuAdd) {
+    public Boolean getOnlineStatus(String rtuAdd) {
         Command com = new Command();
         com.id = Command.defaultId;
         com.code = CodeLocal.onLinePart;
@@ -180,6 +178,27 @@
         }
     }
 
+    public Boolean getOpenCloseStatus(String rtuAdd) {
+        Command com = new Command();
+        com.id = Command.defaultId;
+        com.code = CodeLocal.oneRtuStates;
+        com.type = CommandType.innerCommand;
+        com.setRtuAddr(rtuAdd);
+        com.setParam(rtuAdd);
+        JSONObject response = (JSONObject) JSON.toJSON(sendCom2Mw(com));
+
+        if (response == null || !response.getString("code").equals("0001") || response.getJSONObject("content").getJSONObject("attachment") == null) {
+            return false;
+        }
+
+        if(response.getJSONObject("content").getJSONObject("attachment").get("valveOpenTrueCloseFalse").equals("true")) {
+            return true;
+        }
+        else {
+            return false;
+        }
+    }
+
     /**
      * 鍙戦�佸懡浠�
      *

--
Gitblit v1.8.0