You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
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; import com.iflytop.gd.app.service.DeviceStateService; import com.iflytop.gd.common.annotation.CommandMapping; import com.iflytop.gd.common.enums.HeatModuleCode; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component;
import java.util.concurrent.CompletableFuture;
/** * 停止加热 */ @Slf4j @Component @RequiredArgsConstructor @CommandMapping("heat_stop")//业务指令注解
public class HeatStopCommand extends BaseCommandHandler { private final DeviceCommandUtilService deviceCommandUtilService; private final DeviceStateService deviceStateService;
@Override public CompletableFuture<Void> handle(CmdDTO cmdDTO) { JSONArray heatIdJsonArray = cmdDTO.getJSONArrayParam("heatId"); return runAsync(() -> { for (int i = 0; i < heatIdJsonArray.size(); i++) { String heatId = heatIdJsonArray.getStr(i); HeatModuleCode heatModuleId = HeatModuleCode.valueOf(heatId); //关闭加热
deviceCommandUtilService.heatRodClose(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleId); deviceStateService.setHeatModuleStateHeating(heatModuleId, false);//设置状态停止加热
} }); } }
|