From 91f6317d381bb399d31781c59cb4d21194d36517 Mon Sep 17 00:00:00 2001
From: Administrator <zhubaomin>
Date: 星期四, 20 六月 2024 17:45:51 +0800
Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV

---
 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java |   80 +++++++++++++++++++++------------------
 1 files changed, 43 insertions(+), 37 deletions(-)

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 3d9cbf5..d3eb063 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
@@ -71,7 +71,7 @@
     public BaseResponse<Boolean> open(@RequestBody @Valid ValveOpen valve, BindingResult bindingResult) {
         DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyMMddHHmmss");
         if(bindingResult != null && bindingResult.hasErrors()){
-            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
+            return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
         }
 
         Long intakeId = valve.getIntakeId();
@@ -87,7 +87,7 @@
         if(vcId == null) {
             vcId = commandSv.getVcIdByIntakeId(intakeId);
             if(vcId == null) {
-                return BaseResponseUtils.buildFail(RemoteResultCode.PLEASE_SELECT_A_VC.getMessage());
+                return BaseResponseUtils.buildErrorMsg(RemoteResultCode.PLEASE_SELECT_A_VC.getMessage());
             }
         }
 
@@ -99,10 +99,10 @@
         // 铏氭嫙鍗D鎹㈣櫄鎷熷崱瀵硅薄
         VoVirtualCard vc = commandSv.getVcById(vcId);
         if(vc == null) {
-            return BaseResponseUtils.buildFail(RemoteResultCode.PLEASE_SELECT_A_VC.getMessage());
+            return BaseResponseUtils.buildErrorMsg(RemoteResultCode.PLEASE_SELECT_A_VC.getMessage());
         }
         if(vc.getInUse() == 1) {
-            return BaseResponseUtils.buildFail(RemoteResultCode.IN_USE_VC_CANNOT_OPEN_VALVE.getMessage());
+            return BaseResponseUtils.buildErrorMsg(RemoteResultCode.IN_USE_VC_CANNOT_OPEN_VALVE.getMessage());
         }
 
         // 鑾峰彇姘翠环
@@ -111,7 +111,7 @@
         // 鍙栨按鍙D鎹㈤榾鎺у櫒鍦板潃鍙婇�氳鍗忚
         JSONObject job_rtu = getRtu(intakeId, null);
         if(job_rtu == null) {
-            return BaseResponseUtils.buildError(RemoteResultCode.RTU_NOT_EXIST.getMessage());
+            return BaseResponseUtils.buildErrorMsg(RemoteResultCode.RTU_NOT_EXIST.getMessage());
         }
         String rtuAddr = job_rtu.getString("rtuAddr");
         String protocol = job_rtu.getString("protocol");
@@ -159,8 +159,8 @@
                     //rmCommandHistory.setId(comId);
                     //rmCommandHistory.setResult((byte)0);
                     //commandSv.updateCommandResult(rmCommandHistory);
-                    return BaseResponseUtils.buildFail(response_CallBack.getMsg());
-                    //return BaseResponseUtils.buildFail(response_CallBack.getContent().toString());
+                    return BaseResponseUtils.buildErrorMsg(response_CallBack.getMsg());
+                    //return BaseResponseUtils.buildErrorMsg(response_CallBack.getContent().toString());
                 }
 
                 // 鍥炶皟鎴愬姛锛屽啀鍒ゆ柇鎵ц鏄惁鎴愬姛
@@ -170,7 +170,7 @@
                 System.out.println(job_subData);
                 Boolean dealResult = job_subData.getBoolean("success");
                 if(!dealResult) {
-                    return BaseResponseUtils.buildFail(response_CallBack.getContent().toString());
+                    return BaseResponseUtils.buildErrorMsg(response_CallBack.getContent().toString());
                 }
 
                 /**
@@ -198,7 +198,7 @@
             } else {
                 // 璇锋眰澶辫触
                 JSONObject job_param = response_SendCom.getJSONObject("content").getJSONObject("param");
-                return BaseResponseUtils.buildFail(job_param.getString("message"));
+                return BaseResponseUtils.buildErrorMsg(job_param.getString("message"));
             }
         } else if(protocol.equals("p206V1_0_1")) {
             // 鑾峰彇鍔熻兘鐮�
@@ -235,7 +235,7 @@
                     rmCommandHistory.setId(comId);
                     rmCommandHistory.setResult((byte)0);
                     commandSv.updateCommandResult(rmCommandHistory);
-                    return BaseResponseUtils.buildFail(response_CallBack.getContent().toString());
+                    return BaseResponseUtils.buildErrorMsg(response_CallBack.getContent().toString());
                 }
 
                 // 鍥炶皟瓒呮椂
@@ -266,7 +266,7 @@
                     //job_response.put("vcNum", vc.getVcNum());
                     //job_response.put("orderNo", orderNo);
                     //return BaseResponseUtils.buildSuccess(job_response);
-                    return BaseResponseUtils.buildFail(RemoteResultCode.GET_RESULT_IN_ONE_MINUTE.getMessage());
+                    return BaseResponseUtils.buildErrorMsg(RemoteResultCode.GET_RESULT_IN_ONE_MINUTE.getMessage());
 
                 }
 
@@ -277,7 +277,7 @@
                 System.out.println(job_subData);
                 Boolean dealResult = job_subData.getBoolean("success");
                 if(!dealResult) {
-                    return BaseResponseUtils.buildFail(response_CallBack.getContent().toString());
+                    return BaseResponseUtils.buildErrorMsg(response_CallBack.getContent().toString());
                 }
 
                 /**
@@ -307,10 +307,10 @@
             } else {
                 // 璇锋眰澶辫触
                 JSONObject job_param = response_SendCom.getJSONObject("content").getJSONObject("param");
-                return BaseResponseUtils.buildFail(job_param.getString("message"));
+                return BaseResponseUtils.buildErrorMsg(job_param.getString("message"));
             }
         } else {
-            return BaseResponseUtils.buildFail("绯荤粺鏆備笉鏀寔璇ュ崗璁�");
+            return BaseResponseUtils.buildErrorMsg("绯荤粺鏆備笉鏀寔璇ュ崗璁�");
         }
     }
 
@@ -326,7 +326,7 @@
     public BaseResponse<Boolean> close(@RequestBody @Valid ValveClose valve, BindingResult bindingResult) {
         DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyMMddHHmmss");
         if(bindingResult != null && bindingResult.hasErrors()){
-            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
+            return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
         }
 
         String rtuAddr = valve.getRtuAddr();
@@ -343,7 +343,7 @@
         // 闃�鎺у櫒鍦板潃鎹㈠彇姘村彛ID鍜岄�氳鍗忚
         JSONObject job_rtu = getRtu(null, rtuAddr);
         if(job_rtu == null) {
-            return BaseResponseUtils.buildError(RemoteResultCode.RTU_NOT_EXIST.getMessage());
+            return BaseResponseUtils.buildErrorMsg(RemoteResultCode.RTU_NOT_EXIST.getMessage());
         }
         Long intakeId = job_rtu.getLong("intakeId");
         String protocol = job_rtu.getString("protocol");
@@ -383,8 +383,8 @@
                     //rmCommandHistory.setId(comId);
                     //rmCommandHistory.setResult((byte)0);
                     //commandSv.updateCommandResult(rmCommandHistory);
-                    return BaseResponseUtils.buildFail(response_CallBack.getMsg());
-                    //return BaseResponseUtils.buildError(WechatResultCode.GET_RESULT_ERROR.getMessage());
+                    return BaseResponseUtils.buildErrorMsg(response_CallBack.getMsg());
+                    //return BaseResponseUtils.buildErrorMsgMsg(WechatResultCode.GET_RESULT_ERROR.getMessage());
                 }
 
                 // 鍥炶皟鎴愬姛锛屽啀鍒ゆ柇鎵ц鏄惁鎴愬姛
@@ -394,7 +394,7 @@
                 System.out.println(job_subData);
                 Boolean dealResult = job_subData.getBoolean("success");
                 if(!dealResult) {
-                    return BaseResponseUtils.buildFail(response_CallBack.getContent().toString());
+                    return BaseResponseUtils.buildErrorMsg(response_CallBack.getContent().toString());
                 }
 
                 /**
@@ -414,7 +414,7 @@
             } else {
                 // 璇锋眰澶辫触
                 JSONObject job_param = response_SendCom.getJSONObject("content").getJSONObject("param");
-                return BaseResponseUtils.buildFail(job_param.getString("message"));
+                return BaseResponseUtils.buildErrorMsg(job_param.getString("message"));
             }
         } else if(protocol.equals("p206V1_0_1")) {
             // 鑾峰彇鍔熻兘鐮�
@@ -449,7 +449,7 @@
                     rmCommandHistory.setId(comId);
                     rmCommandHistory.setResult((byte)0);
                     commandSv.updateCommandResult(rmCommandHistory);
-                    return BaseResponseUtils.buildFail(response_CallBack.getContent().toString());
+                    return BaseResponseUtils.buildErrorMsg(response_CallBack.getContent().toString());
                 }
 
                 // 鍥炶皟瓒呮椂
@@ -472,7 +472,7 @@
                     //virtualCard.setLastOperate(LastOperateENUM.CLOSE_VALVE.getCode());
                     //virtualCard.setLastOperateTime(new Date());
                     //seVirtualCardMapper.updateByPrimaryKey(virtualCard);
-                    return BaseResponseUtils.buildFail(RemoteResultCode.GET_RESULT_IN_ONE_MINUTE.getMessage());
+                    return BaseResponseUtils.buildErrorMsg(RemoteResultCode.GET_RESULT_IN_ONE_MINUTE.getMessage());
                 }
 
                 // 鍥炶皟鎴愬姛锛屽啀鍒ゆ柇鎵ц鏄惁鎴愬姛
@@ -482,7 +482,7 @@
                 System.out.println(job_subData);
                 Boolean dealResult = job_subData.getBoolean("success");
                 if(!dealResult) {
-                    return BaseResponseUtils.buildFail(response_CallBack.getContent().toString());
+                    return BaseResponseUtils.buildErrorMsg(response_CallBack.getContent().toString());
                 }
 
                 /**
@@ -502,10 +502,10 @@
             } else {
                 // 璇锋眰澶辫触
                 JSONObject job_param = response_SendCom.getJSONObject("content").getJSONObject("param");
-                return BaseResponseUtils.buildFail(job_param.getString("message"));
+                return BaseResponseUtils.buildErrorMsg(job_param.getString("message"));
             }
         } else {
-            return BaseResponseUtils.buildFail("绯荤粺鏆備笉鏀寔璇ュ崗璁�");
+            return BaseResponseUtils.buildErrorMsg("绯荤粺鏆備笉鏀寔璇ュ崗璁�");
         }
     }
 
@@ -521,13 +521,19 @@
     public BaseResponse<Boolean> closeByIntake(@RequestBody @Valid DtoBase dtoBase, BindingResult bindingResult) {
         DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyMMddHHmmss");
         if(bindingResult != null && bindingResult.hasErrors()){
-            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
+            return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
         }
 
         Long intakeId = dtoBase.getIntakeId();
         Long operator = dtoBase.getOperator();
 
-        VoUnclosedParam voUnclosedParam = commandSv.getUncloseParam(intakeId);
+        VoUnclosedParam voUnclosedParam = null;
+        try {
+            voUnclosedParam = commandSv.getUncloseParam(intakeId);
+        }catch (Exception e) {
+            return BaseResponseUtils.buildErrorMsg("鑾峰彇鏈叧闃�淇℃伅閿欒");
+        }
+
         if(voUnclosedParam == null) {
             return BaseResponseUtils.buildSuccess(RemoteResultCode.VALVE_CLOSED.getMessage());
         }
@@ -544,7 +550,7 @@
         // 闃�鎺у櫒鍦板潃鎹㈠彇姘村彛ID鍜岄�氳鍗忚
         JSONObject job_rtu = getRtu(null, rtuAddr);
         if(job_rtu == null) {
-            return BaseResponseUtils.buildError(RemoteResultCode.RTU_NOT_EXIST.getMessage());
+            return BaseResponseUtils.buildErrorMsg(RemoteResultCode.RTU_NOT_EXIST.getMessage());
         }
         //Long intakeId = job_rtu.getLong("intakeId");
         String protocol = job_rtu.getString("protocol");
@@ -584,8 +590,8 @@
                     //rmCommandHistory.setId(comId);
                     //rmCommandHistory.setResult((byte)0);
                     //commandSv.updateCommandResult(rmCommandHistory);
-                    return BaseResponseUtils.buildFail(response_CallBack.getMsg());
-                    //return BaseResponseUtils.buildError(WechatResultCode.GET_RESULT_ERROR.getMessage());
+                    return BaseResponseUtils.buildErrorMsg(response_CallBack.getMsg());
+                    //return BaseResponseUtils.buildErrorMsgMsg(WechatResultCode.GET_RESULT_ERROR.getMessage());
                 }
 
                 // 鍥炶皟鎴愬姛锛屽啀鍒ゆ柇鎵ц鏄惁鎴愬姛
@@ -595,7 +601,7 @@
                 System.out.println(job_subData);
                 Boolean dealResult = job_subData.getBoolean("success");
                 if(!dealResult) {
-                    return BaseResponseUtils.buildFail(response_CallBack.getContent().toString());
+                    return BaseResponseUtils.buildErrorMsg(response_CallBack.getContent().toString());
                 }
 
                 /**
@@ -616,7 +622,7 @@
             } else {
                 // 璇锋眰澶辫触
                 JSONObject job_param = response_SendCom.getJSONObject("content").getJSONObject("param");
-                return BaseResponseUtils.buildFail(job_param.getString("message"));
+                return BaseResponseUtils.buildErrorMsg(job_param.getString("message"));
             }
         } else if(protocol.equals("p206V1_0_1")) {
             // 鑾峰彇鍔熻兘鐮�
@@ -651,7 +657,7 @@
                     rmCommandHistory.setId(comId);
                     rmCommandHistory.setResult((byte)0);
                     commandSv.updateCommandResult(rmCommandHistory);
-                    return BaseResponseUtils.buildFail(response_CallBack.getContent().toString());
+                    return BaseResponseUtils.buildErrorMsg(response_CallBack.getContent().toString());
                 }
 
                 // 鍥炶皟瓒呮椂
@@ -674,7 +680,7 @@
                     //virtualCard.setLastOperate(LastOperateENUM.OPEN_VALVE.getCode());
                     //virtualCard.setLastOperateTime(new Date());
                     //seVirtualCardMapper.updateByPrimaryKeySelective(virtualCard);
-                    return BaseResponseUtils.buildFail(RemoteResultCode.GET_RESULT_IN_ONE_MINUTE.getMessage());
+                    return BaseResponseUtils.buildErrorMsg(RemoteResultCode.GET_RESULT_IN_ONE_MINUTE.getMessage());
                 }
 
                 // 鍥炶皟鎴愬姛锛屽啀鍒ゆ柇鎵ц鏄惁鎴愬姛
@@ -684,7 +690,7 @@
                 System.out.println(job_subData);
                 Boolean dealResult = job_subData.getBoolean("success");
                 if(!dealResult) {
-                    return BaseResponseUtils.buildFail(response_CallBack.getContent().toString());
+                    return BaseResponseUtils.buildErrorMsg(response_CallBack.getContent().toString());
                 }
 
                 /**
@@ -705,10 +711,10 @@
             } else {
                 // 璇锋眰澶辫触
                 JSONObject job_param = response_SendCom.getJSONObject("content").getJSONObject("param");
-                return BaseResponseUtils.buildFail(job_param.getString("message"));
+                return BaseResponseUtils.buildErrorMsg(job_param.getString("message"));
             }
         } else {
-            return BaseResponseUtils.buildFail("绯荤粺鏆備笉鏀寔璇ュ崗璁�");
+            return BaseResponseUtils.buildErrorMsg("绯荤粺鏆備笉鏀寔璇ュ崗璁�");
         }
     }
 

--
Gitblit v1.8.0