|  |  |  | 
|---|
|  |  |  | public class ValveCtrl extends ComSupport { | 
|---|
|  |  |  | private final CommandSv commandSv; | 
|---|
|  |  |  | private final SeVirtualCardMapper seVirtualCardMapper; | 
|---|
|  |  |  | private final IDLongGenerator idLongGenerator; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Value("${mw.rtuCallbackUrl_wx}") | 
|---|
|  |  |  | private String rtuCallbackUrl_wx; | 
|---|
|  |  |  | 
|---|
|  |  |  | private String key_mw = "comSendUrl"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | public ValveCtrl(CommandSv commandSv, SeVirtualCardMapper seVirtualCardMapper, IDLongGenerator idLongGenerator, Environment env) { | 
|---|
|  |  |  | public ValveCtrl(CommandSv commandSv, SeVirtualCardMapper seVirtualCardMapper, Environment env) { | 
|---|
|  |  |  | this.commandSv = commandSv; | 
|---|
|  |  |  | this.seVirtualCardMapper = seVirtualCardMapper; | 
|---|
|  |  |  | this.idLongGenerator = idLongGenerator; | 
|---|
|  |  |  | this.env = env; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @PostMapping(path = "open_wx", consumes = MediaType.APPLICATION_JSON_VALUE) | 
|---|
|  |  |  | //@Transactional(rollbackFor = Exception.class) | 
|---|
|  |  |  | @Transactional(rollbackFor = Exception.class) | 
|---|
|  |  |  | public BaseResponse<Boolean> open(@RequestBody @Valid ValveOpen valve, BindingResult bindingResult) { | 
|---|
|  |  |  | if (bindingResult != null && bindingResult.hasErrors()) { | 
|---|
|  |  |  | return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); | 
|---|
|  |  |  | 
|---|
|  |  |  | Long vcId = valve.getVcId(); | 
|---|
|  |  |  | Boolean forceOpen = valve.getForceOpen(); | 
|---|
|  |  |  | Long operator = valve.getOperator(); | 
|---|
|  |  |  | Long comId = idLongGenerator.generate(); | 
|---|
|  |  |  | Long comId = new IDLongGenerator().generate(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(intakeId == null && intakeName == null) { | 
|---|
|  |  |  | return BaseResponseUtils.buildErrorMsg(WechatResultCode.PLEASE_SELECT_A_INTAKE.getMessage()); | 
|---|
|  |  |  | 
|---|
|  |  |  | Long vcId = Optional.ofNullable(seVirtualCardMapper.getVcIdByNum(vcNum)).orElse(0L); | 
|---|
|  |  |  | String orderNo = valve.getOrderNo(); | 
|---|
|  |  |  | Long operator = valve.getOperator(); | 
|---|
|  |  |  | Long comId = idLongGenerator.generate(); | 
|---|
|  |  |  | Long comId = new IDLongGenerator().generate(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 阀控器地址换取水口ID和通讯协议 | 
|---|
|  |  |  | JSONObject job_rtu = getRtu(null, rtuAddr); | 
|---|
|  |  |  | 
|---|
|  |  |  | Long vcId = automaticClose.getVcId(); | 
|---|
|  |  |  | Integer minutes = automaticClose.getMinutes(); | 
|---|
|  |  |  | Long operator = automaticClose.getOperator(); | 
|---|
|  |  |  | Long comId = idLongGenerator.generate(); | 
|---|
|  |  |  | Long comId = new IDLongGenerator().generate(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 如果农户选择了虚拟卡,则使用该虚拟卡 | 
|---|
|  |  |  | 
|---|
|  |  |  | Long vcId = automaticClose.getVcId(); | 
|---|
|  |  |  | Integer waterAmount = automaticClose.getWaterAmount(); | 
|---|
|  |  |  | Long operator = automaticClose.getOperator(); | 
|---|
|  |  |  | Long comId = idLongGenerator.generate(); | 
|---|
|  |  |  | Long comId = new IDLongGenerator().generate(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 如果农户选择了虚拟卡,则使用该虚拟卡 | 
|---|
|  |  |  | 
|---|
|  |  |  | Date plannedOpenTime = automaticClose.getPlannedOpenTime(); | 
|---|
|  |  |  | Integer minutes = automaticClose.getMinutes(); | 
|---|
|  |  |  | Long operator = automaticClose.getOperator(); | 
|---|
|  |  |  | Long comId = idLongGenerator.generate(); | 
|---|
|  |  |  | Long comId = new IDLongGenerator().generate(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Integer year = Integer.parseInt(String.format("%tY", plannedOpenTime)); | 
|---|
|  |  |  | Integer month = Integer.parseInt(String.format("%tm", plannedOpenTime)); | 
|---|
|  |  |  | 
|---|
|  |  |  | Date plannedOpenTime = automaticClose.getPlannedOpenTime(); | 
|---|
|  |  |  | Integer waterAmount = automaticClose.getWaterAmount(); | 
|---|
|  |  |  | Long operator = automaticClose.getOperator(); | 
|---|
|  |  |  | Long comId = idLongGenerator.generate(); | 
|---|
|  |  |  | Long comId = new IDLongGenerator().generate(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Integer year = Integer.parseInt(String.format("%tY", plannedOpenTime)); | 
|---|
|  |  |  | Integer month = Integer.parseInt(String.format("%tm", plannedOpenTime)); | 
|---|
|  |  |  | 
|---|
|  |  |  | Double chargeWater = po.getChargeWater(); | 
|---|
|  |  |  | Long operator = po.getOperator(); | 
|---|
|  |  |  | String flowNo = RandomStringUtils.randomNumeric(12); // 生成12位随机数 | 
|---|
|  |  |  | Long comId = idLongGenerator.generate(); | 
|---|
|  |  |  | Long comId = new IDLongGenerator().generate(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 取水口ID换阀控器地址及通讯协议 | 
|---|
|  |  |  | JSONObject job_rtu = getRtu(intakeId, null); | 
|---|