Administrator
2024-06-18 292970714c72b6eb0e6acae509d70c1927402f9a
2024-06-18 朱宝民 优化开关阀逻辑
2个文件已修改
104 ■■■■ 已修改文件
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java 62 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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 @@
        // 虚拟卡ID换虚拟卡对象
        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());
        }
        // 获取水价
@@ -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();
@@ -383,7 +383,7 @@
                    //rmCommandHistory.setId(comId);
                    //rmCommandHistory.setResult((byte)0);
                    //commandSv.updateCommandResult(rmCommandHistory);
                    return BaseResponseUtils.buildFail(response_CallBack.getMsg());
                    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,7 +521,7 @@
    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();
@@ -590,7 +590,7 @@
                    //rmCommandHistory.setId(comId);
                    //rmCommandHistory.setResult((byte)0);
                    //commandSv.updateCommandResult(rmCommandHistory);
                    return BaseResponseUtils.buildFail(response_CallBack.getMsg());
                    return BaseResponseUtils.buildErrorMsg(response_CallBack.getMsg());
                    //return BaseResponseUtils.buildErrorMsgMsg(WechatResultCode.GET_RESULT_ERROR.getMessage());
                }
@@ -601,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());
                }
                /**
@@ -622,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")) {
            // 获取功能码
@@ -657,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());
                }
                // 回调超时
@@ -680,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());
                }
                // 回调成功,再判断执行是否成功
@@ -690,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());
                }
                /**
@@ -711,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("系统暂不支持该协议");
        }
    }
pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java
@@ -68,7 +68,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();
@@ -84,7 +84,7 @@
        if(vcId == null) {
            vcId = commandSv.getVcIdByIntakeId(intakeId);
            if(vcId == null) {
                return BaseResponseUtils.buildFail(WechatResultCode.PLEASE_SELECT_A_VC.getMessage());
                return BaseResponseUtils.buildErrorMsg(WechatResultCode.PLEASE_SELECT_A_VC.getMessage());
            }
        }
@@ -96,10 +96,10 @@
        // 虚拟卡ID换虚拟卡对象
        VoVirtualCard vc = commandSv.getVcById(vcId);
        if(vc == null) {
            return BaseResponseUtils.buildFail(WechatResultCode.PLEASE_SELECT_A_VC.getMessage());
            return BaseResponseUtils.buildErrorMsg(WechatResultCode.PLEASE_SELECT_A_VC.getMessage());
        }
        if(vc.getInUse() == 1) {
            return BaseResponseUtils.buildFail(WechatResultCode.IN_USE_VC_CANNOT_OPEN_VALVE.getMessage());
            return BaseResponseUtils.buildErrorMsg(WechatResultCode.IN_USE_VC_CANNOT_OPEN_VALVE.getMessage());
        }
        // 获取水价
@@ -151,8 +151,8 @@
                // 回调失败
                if(!response_CallBack.getCode().equals("0001")) {
                    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());
                }
                // 回调成功,再判断执行是否成功
@@ -162,7 +162,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());
                }
                /**
@@ -182,7 +182,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")) {
            // 获取功能码
@@ -219,7 +219,7 @@
                    rmCommandHistory.setId(comId);
                    rmCommandHistory.setResult((byte)0);
                    commandSv.update(rmCommandHistory);
                    return BaseResponseUtils.buildFail(response_CallBack.getContent().toString());
                    return BaseResponseUtils.buildErrorMsg(response_CallBack.getContent().toString());
                }
                // 回调超时
@@ -241,7 +241,7 @@
                    //virtualCard.setLastOperate(LastOperateENUM.OPEN_VALVE.getCode());
                    //virtualCard.setLastOperateTime(new Date());
                    //seVirtualCardMapper.updateByPrimaryKeySelective(virtualCard);
                    return BaseResponseUtils.buildFail(WechatResultCode.GET_RESULT_IN_ONE_MINUTE.getMessage());
                    return BaseResponseUtils.buildErrorMsg(WechatResultCode.GET_RESULT_IN_ONE_MINUTE.getMessage());
                }
                // 回调成功,再判断执行是否成功
@@ -251,7 +251,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());
                }
                /**
@@ -271,10 +271,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("系统暂不支持该协议");
        }
    }
@@ -342,7 +342,7 @@
                // 回调失败
                if(!response_CallBack.getCode().equals("0001")) {
                    return BaseResponseUtils.buildFail(response_CallBack.getMsg());
                    return BaseResponseUtils.buildErrorMsg(response_CallBack.getMsg());
                    //return BaseResponseUtils.buildErrorMsg(WechatResultCode.GET_RESULT_ERROR.getMessage());
                }
@@ -353,7 +353,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());
                }
                /**
@@ -374,7 +374,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")) {
            // 获取功能码
@@ -409,7 +409,7 @@
                    rmCommandHistory.setId(comId);
                    rmCommandHistory.setResult((byte)0);
                    commandSv.update(rmCommandHistory);
                    return BaseResponseUtils.buildFail(response_CallBack.getContent().toString());
                    return BaseResponseUtils.buildErrorMsg(response_CallBack.getContent().toString());
                }
                // 回调超时
@@ -432,7 +432,7 @@
                    //virtualCard.setLastOperate(LastOperateENUM.OPEN_VALVE.getCode());
                    //virtualCard.setLastOperateTime(new Date());
                    //seVirtualCardMapper.updateByPrimaryKeySelective(virtualCard);
                    return BaseResponseUtils.buildFail(WechatResultCode.GET_RESULT_IN_ONE_MINUTE.getMessage());
                    return BaseResponseUtils.buildErrorMsg(WechatResultCode.GET_RESULT_IN_ONE_MINUTE.getMessage());
                }
                // 回调成功,再判断执行是否成功
@@ -442,7 +442,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());
                }
                /**
@@ -463,10 +463,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("系统暂不支持该协议");
        }
    }