From c42614978ff12013a1eabebd0289b27169a5784f Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期二, 06 五月 2025 17:25:56 +0800
Subject: [PATCH] 1、实现万功能token(0000-0000-1234-9876-5); 2、web端单独实现命令结果等待器,并相应修改相关部分; 3、web端实现透传命令; 4、修改一些不当注释; 5、优化一些代码。

---
 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/CommandSv.java |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 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 f23d3b8..6bbaac0 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
@@ -47,6 +47,7 @@
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.core.env.Environment;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.util.*;
 
@@ -258,6 +259,7 @@
      * @param automaticClose
      * @return
      */
+    @Transactional(rollbackFor = Exception.class)
     public Map planedOpenTimedClose(AutomaticClose automaticClose, Long planId, Byte operatetype, Date startTime, Integer duration) {
         Long intakeId = automaticClose.getIntakeId();
         Long vcId = automaticClose.getVcId();
@@ -415,6 +417,11 @@
             myParam.setOpenType(openType);
 
             BaseResponse<Boolean> result = dealWithCommandResult(myParam);
+            // 濡傛灉鍛戒护鎵ц澶辫触锛屽垯鍐嶆鎵ц鍛戒护
+            if(!result.isSuccess()) {
+                myParam.setComId(new IDLongGenerator().generate());
+                result = dealWithCommandResult(myParam);
+            }
 
             Map map = new HashMap<>();
             map.put("success", result.isSuccess());
@@ -612,7 +619,14 @@
             myParam.setParam(param);
             myParam.setRtuResultSendWebUrl(rtuCallbackUrl_wx);
             myParam.setOperator(operator);
+            //BaseResponse<Boolean> result = dealWithCommandResult(myParam);
+
             BaseResponse<Boolean> result = dealWithCommandResult(myParam);
+            // 濡傛灉鍛戒护鎵ц澶辫触锛屽垯鍐嶆鎵ц鍛戒护
+            if(!result.isSuccess()) {
+                myParam.setComId(new IDLongGenerator().generate());
+                result = dealWithCommandResult(myParam);
+            }
 
             Map map = new HashMap<>();
             map.put("success", result.isSuccess());
@@ -675,6 +689,7 @@
      * @param operatetype
      * @return
      */
+    @Transactional(rollbackFor = Exception.class)
     public Map closeWx(ValveClose valve, Long planId, Byte operatetype) {
         String rtuAddr = valve.getRtuAddr();
         String vcNum = valve.getVcNum();
@@ -706,6 +721,7 @@
             irIntakeOperate.setOperateType(operatetype);
             irIntakeOperate.setCommandId(comId);
             irIntakeOperate.setIntakeId(intakeId);
+            irIntakeOperate.setCommandResult((byte)1);
 
             Long id = addIntakeOperate(irIntakeOperate);
             if(id == null) {
@@ -783,7 +799,13 @@
             myParam.setRtuResultSendWebUrl(rtuCallbackUrl_wx);
             myParam.setOperator(operator);
             //return dealWithCommandResult(myParam);
+
             BaseResponse<Boolean> result = dealWithCommandResult(myParam);
+            // 濡傛灉鍛戒护鎵ц澶辫触锛屽垯鍐嶆鎵ц鍛戒护
+            if(!result.isSuccess()) {
+                myParam.setComId(new IDLongGenerator().generate());
+                result = dealWithCommandResult(myParam);
+            }
 
             Map map = new HashMap<>();
             map.put("success", result.isSuccess());

--
Gitblit v1.8.0