Browse Source

投放磁子指令

master
王梦远 1 week ago
parent
commit
8ead28c95c
  1. 41
      src/main/java/com/iflytop/colortitration/app/command/control/magnet/MagnetAddCommand.java

41
src/main/java/com/iflytop/colortitration/app/command/control/magnet/MagnetAddCommand.java

@ -0,0 +1,41 @@
package com.iflytop.colortitration.app.command.control.magnet;
import com.iflytop.colortitration.app.common.annotation.CommandMapping;
import com.iflytop.colortitration.app.common.enums.MultipleModuleCode;
import com.iflytop.colortitration.app.core.command.BaseCommandHandler;
import com.iflytop.colortitration.app.core.state.DeviceState;
import com.iflytop.colortitration.app.model.dto.CommandDTO;
import com.iflytop.colortitration.app.service.module.HeatModuleService;
import com.iflytop.colortitration.common.exception.AppException;
import com.iflytop.colortitration.common.result.ResultCode;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import java.util.concurrent.CompletableFuture;
/**
* 开启加热棒
*/
@Slf4j
@Component
@RequiredArgsConstructor
@CommandMapping("magnet_add")
public class MagnetAddCommand extends BaseCommandHandler {
private final HeatModuleService heatModuleService;
private final DeviceState deviceState;
@Override
public CompletableFuture<Void> handle(CommandDTO commandDTO) {
String titrationModuleCodeStr = commandDTO.getStringParam("titrationModuleCode");
if (StringUtils.isEmpty(titrationModuleCodeStr)) {
throw new AppException(ResultCode.INVALID_PARAMETER);//参数缺失
}
MultipleModuleCode heatModuleCode = MultipleModuleCode.valueOf(titrationModuleCodeStr);
return runAsync(() -> {
//todo 投放磁子
});
}
}
Loading…
Cancel
Save