diff --git a/src/main/java/com/iflytop/gd/app/command/control/HeatStartCommand.java b/src/main/java/com/iflytop/gd/app/command/control/HeatStartCommand.java index 85e2591..25897f7 100644 --- a/src/main/java/com/iflytop/gd/app/command/control/HeatStartCommand.java +++ b/src/main/java/com/iflytop/gd/app/command/control/HeatStartCommand.java @@ -6,6 +6,7 @@ import com.iflytop.gd.app.service.device.DeviceStateService; import com.iflytop.gd.app.service.device.module.HeatModuleService; import com.iflytop.gd.common.annotation.CommandMapping; import com.iflytop.gd.common.enums.HeatModuleCode; +import com.iflytop.gd.common.enums.HeatingType; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; @@ -26,13 +27,17 @@ public class HeatStartCommand extends BaseCommandHandler { @Override public CompletableFuture handle(CmdDTO cmdDTO) { String heatId = cmdDTO.getStringParam("heatId"); + Integer time = cmdDTO.getIntegerParam("time"); + Integer minutes = cmdDTO.getIntegerParam("minutes"); + Integer seconds = cmdDTO.getIntegerParam("seconds"); + Double temperature = cmdDTO.getDoubleParam("temperature"); HeatModuleCode heatModuleCode = HeatModuleCode.valueOf(heatId); return runAsync(() -> { - //从系统状态中获取指定加热区设定的温度数值 - double temperature = deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).getTemperature(); - //开启加热 heatModuleService.heatRodOpen(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode, temperature); -// deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setHeating(true); + deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTargetTime(time); + deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setHeatTemperature(temperature); + deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTargetTemperature(temperature); + deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setHeatingType(HeatingType.thermostatic); }); } } diff --git a/src/main/java/com/iflytop/gd/app/command/control/HeatStopCommand.java b/src/main/java/com/iflytop/gd/app/command/control/HeatStopCommand.java index 5676e80..e4c8841 100644 --- a/src/main/java/com/iflytop/gd/app/command/control/HeatStopCommand.java +++ b/src/main/java/com/iflytop/gd/app/command/control/HeatStopCommand.java @@ -6,6 +6,7 @@ import com.iflytop.gd.app.service.device.DeviceStateService; import com.iflytop.gd.app.service.device.module.HeatModuleService; import com.iflytop.gd.common.annotation.CommandMapping; import com.iflytop.gd.common.enums.HeatModuleCode; +import com.iflytop.gd.common.enums.HeatingType; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; @@ -30,7 +31,11 @@ public class HeatStopCommand extends BaseCommandHandler { return runAsync(() -> { //关闭加热 heatModuleService.heatRodClose(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode); -// deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setHeating(false); + deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTargetTime(null); + deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setWarmUpTemperature(null); + deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setHeatTemperature(null); + deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTargetTemperature(null); + deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setHeatingType(HeatingType.stop); }); } } diff --git a/src/main/java/com/iflytop/gd/app/model/bo/status/device/HeatModuleState.java b/src/main/java/com/iflytop/gd/app/model/bo/status/device/HeatModuleState.java index 3004c0d..2d40dfa 100644 --- a/src/main/java/com/iflytop/gd/app/model/bo/status/device/HeatModuleState.java +++ b/src/main/java/com/iflytop/gd/app/model/bo/status/device/HeatModuleState.java @@ -34,11 +34,17 @@ public class HeatModuleState { @Schema(description = "是否存在拍子,true为存在拍子,false无拍子") private boolean capExist = false; + @Schema(description = "加热器加热温度") + private Double heatTemperature = null; + + @Schema(description = "加热器预热温度") + private Double warmUpTemperature = null; + @Schema(description = "加热器目标温度") private Double targetTemperature = null; @Schema(description = "加热器目标加热时间,单位秒") - private Long targetTime = 0L; + private Integer targetTime = null; @Schema(description = "加热器当前温度") private Double temperature = null; diff --git a/src/main/java/com/iflytop/gd/common/enums/HeatingType.java b/src/main/java/com/iflytop/gd/common/enums/HeatingType.java index 9e71625..dd0c4b2 100644 --- a/src/main/java/com/iflytop/gd/common/enums/HeatingType.java +++ b/src/main/java/com/iflytop/gd/common/enums/HeatingType.java @@ -8,6 +8,6 @@ import lombok.Getter; @Getter public enum HeatingType { stop, - preheating, + warm_up, thermostatic, }