|
|
@ -3,6 +3,7 @@ package com.iflytop.colortitration.app.command.control.heat; |
|
|
|
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; |
|
|
@ -12,6 +13,7 @@ import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.util.concurrent.CompletableFuture; |
|
|
|
|
|
|
|
/** |
|
|
@ -23,6 +25,7 @@ import java.util.concurrent.CompletableFuture; |
|
|
|
@CommandMapping("heater_start") |
|
|
|
public class HeatRodOpenCommand extends BaseCommandHandler { |
|
|
|
private final HeatModuleService heatModuleService; |
|
|
|
private final DeviceState deviceState; |
|
|
|
|
|
|
|
@Override |
|
|
|
public CompletableFuture<Void> handle(CommandDTO commandDTO) { |
|
|
@ -34,6 +37,9 @@ public class HeatRodOpenCommand extends BaseCommandHandler { |
|
|
|
MultipleModuleCode heatModuleCode = MultipleModuleCode.valueOf(heatModuleCodeStr); |
|
|
|
return runAsync(() -> { |
|
|
|
heatModuleService.openHeatRod(heatModuleCode, temperature); |
|
|
|
deviceState.getHeatModuleStateMap().get(heatModuleCode).setTargetTemperature(temperature); |
|
|
|
deviceState.getHeatModuleStateMap().get(heatModuleCode).setOpen(true); |
|
|
|
deviceState.getHeatModuleStateMap().get(heatModuleCode).setStartHeatTime(LocalDateTime.now()); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|