| | |
| | | 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(); |
| | |
| | | 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()); |
| | | } |
| | | } |
| | | |
| | |
| | | // 虚拟卡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()); |
| | | } |
| | | |
| | | // 获取水价 |
| | |
| | | |
| | | // 回调失败 |
| | | 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()); |
| | | } |
| | | |
| | | // 回调成功,再判断执行是否成功 |
| | |
| | | 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()); |
| | | } |
| | | |
| | | /** |
| | |
| | | } 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")) { |
| | | // 获取功能码 |
| | |
| | | rmCommandHistory.setId(comId); |
| | | rmCommandHistory.setResult((byte)0); |
| | | commandSv.update(rmCommandHistory); |
| | | return BaseResponseUtils.buildFail(response_CallBack.getContent().toString()); |
| | | return BaseResponseUtils.buildErrorMsg(response_CallBack.getContent().toString()); |
| | | } |
| | | |
| | | // 回调超时 |
| | |
| | | //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()); |
| | | } |
| | | |
| | | // 回调成功,再判断执行是否成功 |
| | |
| | | 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()); |
| | | } |
| | | |
| | | /** |
| | |
| | | } 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("系统暂不支持该协议"); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | // 回调失败 |
| | | 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()); |
| | | } |
| | | |
| | |
| | | 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()); |
| | | } |
| | | |
| | | /** |
| | |
| | | } 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")) { |
| | | // 获取功能码 |
| | |
| | | rmCommandHistory.setId(comId); |
| | | rmCommandHistory.setResult((byte)0); |
| | | commandSv.update(rmCommandHistory); |
| | | return BaseResponseUtils.buildFail(response_CallBack.getContent().toString()); |
| | | return BaseResponseUtils.buildErrorMsg(response_CallBack.getContent().toString()); |
| | | } |
| | | |
| | | // 回调超时 |
| | |
| | | //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()); |
| | | } |
| | | |
| | | // 回调成功,再判断执行是否成功 |
| | |
| | | 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()); |
| | | } |
| | | |
| | | /** |
| | |
| | | } 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("系统暂不支持该协议"); |
| | | } |
| | | } |
| | | |