From a29139a8f7bf8301afb09fad4610646c33b4cdb2 Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期一, 19 八月 2024 20:38:24 +0800
Subject: [PATCH] 2024-08-19 朱宝民 优化代码

---
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/ComSupport.java               |   21 ++++++++++++++-------
 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java   |   12 ++++++------
 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java |    8 ++++----
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/result/CommandResultCode.java |    1 +
 4 files changed, 25 insertions(+), 17 deletions(-)

diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/ComSupport.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/ComSupport.java
index 8413b02..db9713f 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/ComSupport.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/ComSupport.java
@@ -334,15 +334,22 @@
         if(commandCode.equals("92") || commandCode.equals("97")) {
             JSONObject job_response = (JSONObject) JSON.toJSON(response_CallBack);
             JSONObject job_param = (JSONObject) JSON.toJSON(param);
-
             JSONObject job_data = job_response.getJSONObject("content").getJSONObject("data");
-            job_data.remove("success");
-            job_data.put("intakeId", intakeId);
-            job_data.put("rtuAddr", rtuAddr);
-            job_data.put("vcNum", job_param.getString("icCardNo"));
-            job_data.put("orderNo", job_param.getString("orderNo"));
+            if(!job_data.getBoolean("success")) {
+                // 寮�鍏抽榾澶辫触
+                response_CallBack.setCode("10003");
+                response_CallBack.setMsg(CommandResultCode.OPEN_CLOSE_FAIL.getMessage());
+                response_CallBack.setSuccess(false);
+            }else {
+                // 寮�鍏抽榾鎴愬姛
+                job_data.remove("success");
+                job_data.put("intakeId", intakeId);
+                job_data.put("rtuAddr", rtuAddr);
+                job_data.put("vcNum", job_param.getString("icCardNo"));
+                job_data.put("orderNo", job_param.getString("orderNo"));
 
-            response_CallBack = JSON.parseObject(job_response.toJSONString(), BaseResponse.class);
+                response_CallBack = JSON.parseObject(job_response.toJSONString(), BaseResponse.class);
+            }
         }
 
         // 鍥炶皟杩斿洖鐨勫唴瀹癸紝鍥炶皟缁撴灉鍐欏叆鍛戒护鏃ュ織琛ㄧ殑浠诲姟鐢变腑闂翠欢瀹屾垚
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/result/CommandResultCode.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/result/CommandResultCode.java
index 6671501..b69cd68 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/result/CommandResultCode.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/result/CommandResultCode.java
@@ -17,6 +17,7 @@
      */
     GET_RESULT_IN_ONE_MINUTE(10001,"1鍒嗛挓鍚庡幓鏌ョ湅缁撴灉"),
     GET_RESULT_ERROR(10002, "鑾峰彇缁撴灉寮傚父"),
+    OPEN_CLOSE_FAIL(10003, "寮�鍏抽榾澶辫触"),
 
     /**
      * RTU
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java
index d047b4f..4ddcf26 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java
@@ -190,7 +190,7 @@
             myParam.setComId(comId);
             myParam.setComType((byte)1);
             myParam.setCommandCode(commandCode);
-            myParam.setCommandName(CodeV202404.getCodeName(commandCode));
+            myParam.setCommandName(CodeV1_0_1.getCodeName(commandCode));
             myParam.setIntakeId(intakeId);
             myParam.setRtuAddr(rtuAddr);
             myParam.setProtocol(protocol);
@@ -295,7 +295,7 @@
             myParam.setComId(comId);
             myParam.setComType((byte)2);
             myParam.setCommandCode(commandCode);
-            myParam.setCommandName(CodeV202404.getCodeName(commandCode));
+            myParam.setCommandName(CodeV1_0_1.getCodeName(commandCode));
             myParam.setIntakeId(intakeId);
             myParam.setRtuAddr(rtuAddr);
             myParam.setProtocol(protocol);
@@ -389,7 +389,7 @@
             myParam.setComId(comId);
             myParam.setComType((byte)2);
             myParam.setCommandCode(commandCode);
-            myParam.setCommandName(CodeV202404.getCodeName(commandCode));
+            myParam.setCommandName(CodeV1_0_1.getCodeName(commandCode));
             myParam.setIntakeId(intakeId);
             myParam.setRtuAddr(rtuAddr);
             myParam.setProtocol(protocol);
@@ -483,7 +483,7 @@
             myParam.setComId(comId);
             myParam.setComType((byte)2);
             myParam.setCommandCode(commandCode);
-            myParam.setCommandName(CodeV202404.getCodeName(commandCode));
+            myParam.setCommandName(CodeV1_0_1.getCodeName(commandCode));
             myParam.setIntakeId(intakeId);
             myParam.setRtuAddr(rtuAddr);
             myParam.setProtocol(protocol);
@@ -589,7 +589,7 @@
             myParam.setComId(comId);
             myParam.setComType((byte)2);
             myParam.setCommandCode(commandCode);
-            myParam.setCommandName(CodeV202404.getCodeName(commandCode));
+            myParam.setCommandName(CodeV1_0_1.getCodeName(commandCode));
             myParam.setIntakeId(intakeId);
             myParam.setRtuAddr(rtuAddr);
             myParam.setProtocol(protocol);
@@ -695,7 +695,7 @@
             myParam.setComId(comId);
             myParam.setComType((byte)2);
             myParam.setCommandCode(commandCode);
-            myParam.setCommandName(CodeV202404.getCodeName(commandCode));
+            myParam.setCommandName(CodeV1_0_1.getCodeName(commandCode));
             myParam.setIntakeId(intakeId);
             myParam.setRtuAddr(rtuAddr);
             myParam.setProtocol(protocol);
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java
index ca31d85..c02a984 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java
@@ -389,7 +389,7 @@
             myParam.setComId(comId);
             myParam.setComType((byte)2);
             myParam.setCommandCode(commandCode);
-            myParam.setCommandName(CodeV202404.getCodeName(commandCode));
+            myParam.setCommandName(CodeV1_0_1.getCodeName(commandCode));
             myParam.setIntakeId(intakeId);
             myParam.setRtuAddr(rtuAddr);
             myParam.setProtocol(protocol);
@@ -482,7 +482,7 @@
             myParam.setComId(comId);
             myParam.setComType((byte)2);
             myParam.setCommandCode(commandCode);
-            myParam.setCommandName(CodeV202404.getCodeName(commandCode));
+            myParam.setCommandName(CodeV1_0_1.getCodeName(commandCode));
             myParam.setIntakeId(intakeId);
             myParam.setRtuAddr(rtuAddr);
             myParam.setProtocol(protocol);
@@ -588,7 +588,7 @@
             myParam.setComId(comId);
             myParam.setComType((byte)2);
             myParam.setCommandCode(commandCode);
-            myParam.setCommandName(CodeV202404.getCodeName(commandCode));
+            myParam.setCommandName(CodeV1_0_1.getCodeName(commandCode));
             myParam.setIntakeId(intakeId);
             myParam.setRtuAddr(rtuAddr);
             myParam.setProtocol(protocol);
@@ -694,7 +694,7 @@
             myParam.setComId(comId);
             myParam.setComType((byte)2);
             myParam.setCommandCode(commandCode);
-            myParam.setCommandName(CodeV202404.getCodeName(commandCode));
+            myParam.setCommandName(CodeV1_0_1.getCodeName(commandCode));
             myParam.setIntakeId(intakeId);
             myParam.setRtuAddr(rtuAddr);
             myParam.setProtocol(protocol);

--
Gitblit v1.8.0