|  |  | 
 |  |  | import com.dy.pipIrrGlobal.command.ComSupport; | 
 |  |  | import com.dy.pipIrrGlobal.command.dto.Param; | 
 |  |  | import com.dy.pipIrrGlobal.daoSe.SeVirtualCardMapper; | 
 |  |  | import com.dy.pipIrrGlobal.pojoSe.SeClientCard; | 
 |  |  | import com.dy.pipIrrGlobal.voRm.VoIrrigaterProfile; | 
 |  |  | import com.dy.pipIrrGlobal.voRm.VoUnclosedValve; | 
 |  |  | import com.dy.pipIrrGlobal.voSe.VoVirtualCard; | 
 |  |  | 
 |  |  |         this.env = env; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 小程序远程开阀 | 
 |  |  |      * @param valve | 
 |  |  |      * @param bindingResult | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     @PostMapping(path = "open_wx", consumes = MediaType.APPLICATION_JSON_VALUE) | 
 |  |  |     @Transactional(rollbackFor = Exception.class) | 
 |  |  |     public BaseResponse<Boolean> open(@RequestBody @Valid ValveOpen valve, BindingResult bindingResult) { | 
 |  |  | 
 |  |  |         //} | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 小程序远程关阀 | 
 |  |  |      * | 
 |  |  |      * @param valve | 
 |  |  |      * @param bindingResult | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     @PostMapping(path = "close_wx", consumes = MediaType.APPLICATION_JSON_VALUE) | 
 |  |  |     //@Transactional(rollbackFor = Exception.class) | 
 |  |  |     public BaseResponse<Boolean> close(@RequestBody @Valid ValveClose valve, BindingResult bindingResult) { | 
 |  |  | 
 |  |  |         //} | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 定时关阀 | 
 |  |  |      * @param automaticClose | 
 |  |  |      * @param bindingResult | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     @PostMapping(path = "timed_close", consumes = MediaType.APPLICATION_JSON_VALUE) | 
 |  |  |     @Transactional(rollbackFor = Exception.class) | 
 |  |  |     public BaseResponse<Boolean> timedClose(@RequestBody @Valid AutomaticClose automaticClose, BindingResult bindingResult) { | 
 |  |  | 
 |  |  |         Long operator = automaticClose.getOperator(); | 
 |  |  |         Long comId = new IDLongGenerator().generate(); | 
 |  |  |  | 
 |  |  |         /** | 
 |  |  |          * 如果农户选择了虚拟卡,则使用该虚拟卡 | 
 |  |  |          * 如果农户未选择虚拟卡,则根据取水口ID获取与之绑定的虚拟卡 | 
 |  |  |          * 如果取水口没有与之绑定的虚拟卡,则提示农户选择一张虚拟卡 | 
 |  |  |          */ | 
 |  |  |         if(vcId == null) { | 
 |  |  |             vcId = commandSv.getVcIdByIntakeId(intakeId); | 
 |  |  |             if(vcId == null) { | 
 |  |  | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 定量关阀 | 
 |  |  |      * @param automaticClose | 
 |  |  |      * @param bindingResult | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     @PostMapping(path = "quantify_close", consumes = MediaType.APPLICATION_JSON_VALUE) | 
 |  |  |     @Transactional(rollbackFor = Exception.class) | 
 |  |  |     public BaseResponse<Boolean> quantifyClose(@RequestBody @Valid AutomaticClose automaticClose, BindingResult bindingResult) { | 
 |  |  | 
 |  |  |         Long operator = automaticClose.getOperator(); | 
 |  |  |         Long comId = new IDLongGenerator().generate(); | 
 |  |  |  | 
 |  |  |         /** | 
 |  |  |          * 如果农户选择了虚拟卡,则使用该虚拟卡 | 
 |  |  |          * 如果农户未选择虚拟卡,则根据取水口ID获取与之绑定的虚拟卡 | 
 |  |  |          * 如果取水口没有与之绑定的虚拟卡,则提示农户选择一张虚拟卡 | 
 |  |  |          */ | 
 |  |  |         if(vcId == null) { | 
 |  |  |             vcId = commandSv.getVcIdByIntakeId(intakeId); | 
 |  |  |             if(vcId == null) { | 
 |  |  | 
 |  |  |             param.setWaterAmount(waterAmount); | 
 |  |  |             param.setOrderNo(orderNo); | 
 |  |  |  | 
 |  |  |             /** | 
 |  |  |              * 构造命令、发送命令并处理请求结果及执行结果 | 
 |  |  |              * 1 准备参数 | 
 |  |  |              * 2 调用公共方法 | 
 |  |  |              */ | 
 |  |  |             Param myParam = new Param(); | 
 |  |  |             myParam.setComId(comId); | 
 |  |  |             myParam.setComType((byte)1); | 
 |  |  | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 计划开阀定时关阀 | 
 |  |  |      * @param automaticClose | 
 |  |  |      * @param bindingResult | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     @PostMapping(path = "planed_open_timed_close", consumes = MediaType.APPLICATION_JSON_VALUE) | 
 |  |  |     @Transactional(rollbackFor = Exception.class) | 
 |  |  |     public BaseResponse<Boolean> planedOpenTimedClose(@RequestBody @Valid AutomaticClose automaticClose, BindingResult bindingResult) { | 
 |  |  | 
 |  |  |         //} | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 计划开阀定量关阀 | 
 |  |  |      * @param automaticClose | 
 |  |  |      * @param bindingResult | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     @PostMapping(path = "planed_open_quantify_close", consumes = MediaType.APPLICATION_JSON_VALUE) | 
 |  |  |     @Transactional(rollbackFor = Exception.class) | 
 |  |  |     public BaseResponse<Boolean> planedOpenQuantifyClose(@RequestBody @Valid AutomaticClose automaticClose, BindingResult bindingResult) { | 
 |  |  | 
 |  |  |         Integer hour = Integer.parseInt(String.format("%tH", plannedOpenTime)); | 
 |  |  |         Integer minute = Integer.parseInt(String.format("%tM", plannedOpenTime)); | 
 |  |  |  | 
 |  |  |         /** | 
 |  |  |          * 如果农户选择了虚拟卡,则使用该虚拟卡 | 
 |  |  |          * 如果农户未选择虚拟卡,则根据取水口ID获取与之绑定的虚拟卡 | 
 |  |  |          * 如果取水口没有与之绑定的虚拟卡,则提示农户选择一张虚拟卡 | 
 |  |  |          */ | 
 |  |  |         if(vcId == null) { | 
 |  |  |             vcId = commandSv.getVcIdByIntakeId(intakeId); | 
 |  |  |             if(vcId == null) { | 
 |  |  | 
 |  |  |             param.setMinute(minute); | 
 |  |  |             param.setOrderNo(orderNo); | 
 |  |  |  | 
 |  |  |             /** | 
 |  |  |              * 构造命令、发送命令并处理请求结果及执行结果 | 
 |  |  |              * 1 准备参数 | 
 |  |  |              * 2 调用公共方法 | 
 |  |  |              */ | 
 |  |  |             Param myParam = new Param(); | 
 |  |  |             myParam.setComId(comId); | 
 |  |  |             myParam.setComType((byte)1); | 
 |  |  | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 根据操作员ID获取未关阀记录 | 
 |  |  |      * | 
 |  |  |      * @param operator | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     @GetMapping(path = "/get") | 
 |  |  |     public BaseResponse<List<VoUnclosedValve>> getUnclosedValves(@RequestParam Long operator) { | 
 |  |  |         try { | 
 |  |  | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 强制隐藏未关阀记录:为指定(阀控器地址、水卡编号、无关阀记录)开关阀最新记录添加关阀时间,使之不在未关阀记录中显示 | 
 |  |  |      * @param po | 
 |  |  |      * @param bindingResult | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     @PostMapping(path = "deleteUnclosed", consumes = MediaType.APPLICATION_JSON_VALUE) | 
 |  |  |     public BaseResponse<Boolean> deleteUnclosed(@RequestBody @Valid deleteUnclosedParam po, BindingResult bindingResult) { | 
 |  |  |         if(bindingResult != null && bindingResult.hasErrors()){ | 
 |  |  | 
 |  |  |         return BaseResponseUtils.buildSuccess(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 小程序远程充值 | 
 |  |  |      * @param po | 
 |  |  |      * @param bindingResult | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     @PostMapping(path = "recharge", consumes = MediaType.APPLICATION_JSON_VALUE) | 
 |  |  |     @Transactional(rollbackFor = Exception.class) | 
 |  |  |     public BaseResponse<Boolean> recharge(@RequestBody @Valid Recharge po, BindingResult bindingResult) { | 
 |  |  | 
 |  |  |             param.chargeWater = chargeWater; | 
 |  |  |             param.flowNo = flowNo; | 
 |  |  |  | 
 |  |  |             /** | 
 |  |  |              * 构造命令、发送命令并处理请求结果及执行结果 | 
 |  |  |              * 1 准备参数 | 
 |  |  |              * 2 调用公共方法 | 
 |  |  |              */ | 
 |  |  |             Param myParam = new Param(); | 
 |  |  |             myParam.setComId(comId); | 
 |  |  |             myParam.setCommandCode(commandCode); | 
 |  |  | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 根据配置类型获取配置值 | 
 |  |  |      * @param type | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     @GetMapping(path = "/irrigate_profile") | 
 |  |  |     public BaseResponse<QueryResultVo<List<VoIrrigaterProfile>>> getIrrPro(Integer type){ | 
 |  |  |         try { |