diff --git a/src/main/java/com/iflytop/colortitration/app/command/control/magnet/MagnetAddCommand.java b/src/main/java/com/iflytop/colortitration/app/command/control/magnet/MagnetAddCommand.java new file mode 100644 index 0000000..d0fa89e --- /dev/null +++ b/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 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 投放磁子 + }); + } +} +