From 7d387aa126262ee12068f5b31aad661501edd286 Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期三, 13 十一月 2024 16:34:21 +0800
Subject: [PATCH] 优化未关阀记录接口

---
 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/CommandSv.java |   28 +++++++++++++++++++++++-----
 1 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/CommandSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/CommandSv.java
index 21df891..e9fea08 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/CommandSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/CommandSv.java
@@ -18,6 +18,7 @@
 import com.dy.pipIrrGlobal.pojoRm.RmCommandHistory;
 import com.dy.pipIrrGlobal.pojoSe.SeClientCard;
 import com.dy.pipIrrGlobal.voRm.VoIrrigaterProfile;
+import com.dy.pipIrrGlobal.voRm.VoRtuAndVc;
 import com.dy.pipIrrGlobal.voRm.VoUnclosedValve;
 import com.dy.pipIrrGlobal.voSe.VoVirtualCard;
 import lombok.RequiredArgsConstructor;
@@ -116,12 +117,29 @@
             System.out.println(jsonArray.toJSONString());
         }
 
-        List<VoUnclosedValve> res = rmCommandHistoryMapper.getUnclosedValves(jsonArray.toJSONString(), operator);
-        if(res != null) {
-            return res;
-        } else {
-            return new ArrayList<>();
+        /**
+         * 鑾峰彇鏈叧闃�鐨凴TU鍦板潃鍜岃櫄鎷熷崱缂栧彿瀵规暟缁�
+         * 閬嶅巻鏁扮粍鑾峰彇鏈�鍚庡懡浠ゆ棩蹇桰D闆嗗悎
+         */
+        List<VoRtuAndVc> rtus = rmCommandHistoryMapper.getUnclosedRtus(operator);
+        String comIds = "";
+        if(rtus != null && rtus.size() > 0) {
+            for (int i = 0; i < rtus.size(); i++) {
+                Long comId = rmCommandHistoryMapper.getLastComId(rtus.get(i).getRtuAddr(), rtus.get(i).getVcNum());
+                if(comId > 0) {
+                    comIds = comIds + comId + ",";
+                }
+            }
         }
+
+        if(comIds.length() > 0) {
+            comIds = "(" + comIds.substring(0,comIds.length()) + ")";
+            List<VoUnclosedValve> res = rmCommandHistoryMapper.getUnclosedValves(jsonArray.toJSONString(), comIds);
+            if(res != null) {
+                return res;
+            }
+        }
+        return new ArrayList<>();
     }
 
     /**

--
Gitblit v1.8.0