From 8ead28c95c70de55392832646e71c974e7a88abb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=A2=A6=E8=BF=9C?= <1063331231@qq.com> Date: Sat, 26 Jul 2025 21:28:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=95=E6=94=BE=E7=A3=81=E5=AD=90=E6=8C=87?= =?UTF-8?q?=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../command/control/magnet/MagnetAddCommand.java | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/main/java/com/iflytop/colortitration/app/command/control/magnet/MagnetAddCommand.java 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 投放磁子 + }); + } +} +