| | |
| | | */ |
| | | |
| | | @Slf4j |
| | | @Tag(name = "远程命令", description = "清除故障") |
| | | @Tag(name = "远程命令", description = "搅拌启停") |
| | | @RestController("mqttSd1StirCtrl") |
| | | @RequestMapping(path = "mqttSd1/stirCtrl") |
| | | @RequiredArgsConstructor |
| | |
| | | * @param bindingResult 对dto验证的结果 |
| | | * @return 返回前端 |
| | | */ |
| | | @PostMapping(path = "send", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @PostMapping(path = "start", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Object> send(@RequestBody @Valid CdDto dto, BindingResult bindingResult) { |
| | | public BaseResponse<Object> start(@RequestBody @Valid CdDto dto, BindingResult bindingResult) { |
| | | return this.send(dto, bindingResult, true) ; |
| | | } |
| | | /** |
| | | * 向设备(Mqtt中间件->FBox)发送命令 |
| | | * @param dto 前端发来的值对象 |
| | | * @param bindingResult 对dto验证的结果 |
| | | * @return 返回前端 |
| | | */ |
| | | @PostMapping(path = "stop", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Object> stop(@RequestBody @Valid CdDto dto, BindingResult bindingResult) { |
| | | return this.send(dto, bindingResult, false) ; |
| | | } |
| | | /** |
| | | * 向设备(Mqtt中间件->FBox)发送命令 |
| | | * @param dto 前端发来的值对象 |
| | | * @param bindingResult 对dto验证的结果 |
| | | * @return 返回前端 |
| | | */ |
| | | private BaseResponse<Object> send(CdDto dto, BindingResult bindingResult, boolean startTrueStopFalse) { |
| | | BaseResponse<Object> res ; |
| | | //发送命令前-1:验证 |
| | | res = super.pre1(sv, ComCode, dto, bindingResult); |
| | |
| | | res = super.pre2(sv, Protocol, ProtocolVersion, ComCode, dto, bindingResult); |
| | | if (res == null) { |
| | | //发送命令前-3:保存命令日志 |
| | | CdParam comParam = CdParam.builder().commandCode(ComCode).build(); |
| | | CdParam comParam = CdParam.builder().no(ctrlPo.no).startTrueStopFalse(startTrueStopFalse).build(); |
| | | res = super.pre3(sv, dto.manureId, dto.getOperator(), Protocol, ProtocolVersion, ComCode, comParam); |
| | | if (res == null) { |
| | | //发送命令前-4:准备Feature |
| | | super.pre4(); |
| | | try { |
| | | //创建外部命令(发给控制器) |
| | | Command com = sv.createOuterCommand(ctrlPo.fboxId, "" + comId, ComCode); |
| | | //创建外部命令(发给MQTT->FBox) |
| | | Command com = sv.createMQTTCommand(ctrlPo.fboxId, "" + comId, Protocol, ProtocolVersion, ComCode); |
| | | com.rtuResultSendWebUrl = rtuResultSendWebUrl; |
| | | com.param = comParam ; |
| | | //发送命令 |