|
|
@ -40,13 +40,17 @@ public class PumpRotateStartCommand extends BaseCommandHandler { |
|
|
|
if (direction == null) { |
|
|
|
throw new IllegalArgumentException("参数 direction 不能为空"); |
|
|
|
} |
|
|
|
Double position = commandDTO.getDoubleParam("position"); |
|
|
|
if (position == null) { |
|
|
|
throw new IllegalArgumentException("参数 position 不能为空"); |
|
|
|
} |
|
|
|
return runAsync(() -> { |
|
|
|
if (Direction.FORWARD.equals(direction)) { |
|
|
|
DeviceCommand getPositionDeviceCommand = channelCtrlService.getPumpForwardRotateCommandByChannel(channelCode); |
|
|
|
CommandFuture positionCommandFuture = deviceCommandService.sendCommand(getPositionDeviceCommand); |
|
|
|
CommandUtil.wait(positionCommandFuture); |
|
|
|
Integer currentPosition = (Integer) positionCommandFuture.getResponseResult().get("position"); |
|
|
|
DeviceCommand deviceCommand = channelCtrlService.getPumpForwardRotateCommandByChannel(channelCode); |
|
|
|
DeviceCommand deviceCommand = channelCtrlService.getPumpMoveCommandByChannel(channelCode, position); |
|
|
|
CommandFuture commandFuture = deviceCommandService.sendCommand(deviceCommand); |
|
|
|
CommandUtil.wait(commandFuture); |
|
|
|
Integer newPosition = (Integer) commandFuture.getResponseResult().get("position"); |
|
|
|