|
|
@ -1,5 +1,6 @@ |
|
|
|
package com.iflytop.gd.app.cmd; |
|
|
|
|
|
|
|
import cn.hutool.json.JSONArray; |
|
|
|
import com.iflytop.gd.app.core.BaseCommandHandler; |
|
|
|
import com.iflytop.gd.app.model.dto.CmdDTO; |
|
|
|
import com.iflytop.gd.app.service.DeviceCommandUtilService; |
|
|
@ -25,15 +26,18 @@ public class HeatStartCommand extends BaseCommandHandler { |
|
|
|
|
|
|
|
@Override |
|
|
|
public CompletableFuture<Void> handle(CmdDTO cmdDTO) { |
|
|
|
String heatId = cmdDTO.getStringParam("heatId");//获取加热区ID |
|
|
|
HeatModuleCode heatModuleId = HeatModuleCode.valueOf(heatId); |
|
|
|
JSONArray heatIdJsonArray = cmdDTO.getJSONArrayParam("heatId"); |
|
|
|
return runAsync(() -> { |
|
|
|
//从系统状态中获取指定加热区设定的温度数值 |
|
|
|
double temperature = deviceStateService.getHeatModuleState(heatModuleId).getTemperature(); |
|
|
|
//开启加热 |
|
|
|
deviceCommandUtilService.heatRodOpen(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleId, temperature); |
|
|
|
deviceStateService.setHeatModuleStateHeating(heatModuleId, true);//设置状态加热中 |
|
|
|
//TODO以后思考如果加热棒不可恒温 |
|
|
|
for (int i = 0; i < heatIdJsonArray.size(); i++) { |
|
|
|
String heatId = heatIdJsonArray.getStr(i); |
|
|
|
HeatModuleCode heatModuleId = HeatModuleCode.valueOf(heatId); |
|
|
|
//从系统状态中获取指定加热区设定的温度数值 |
|
|
|
double temperature = deviceStateService.getHeatModuleState(heatModuleId).getTemperature(); |
|
|
|
//开启加热 |
|
|
|
deviceCommandUtilService.heatRodOpen(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleId, temperature); |
|
|
|
deviceStateService.setHeatModuleStateHeating(heatModuleId, true);//设置状态加热中 |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|