白凤吉 2 months ago
parent
commit
d74dd6bc7a
  1. 13
      src/main/java/com/iflytop/gd/app/command/control/HeatStartCommand.java
  2. 7
      src/main/java/com/iflytop/gd/app/command/control/HeatStopCommand.java
  3. 8
      src/main/java/com/iflytop/gd/app/model/bo/status/device/HeatModuleState.java
  4. 2
      src/main/java/com/iflytop/gd/common/enums/HeatingType.java

13
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<Void> 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);
});
}
}

7
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);
});
}
}

8
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;

2
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,
}
Loading…
Cancel
Save