package com.zy.core.task; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.zy.asrs.entity.DeviceConfig; import com.zy.asrs.service.DeviceConfigService; import com.zy.common.utils.RedisUtil; import com.zy.core.action.ShuttleAction; import com.zy.core.enums.RedisKeyType; import com.zy.core.enums.SlaveType; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.util.List; @Slf4j @Component public class ShuttleExecuteScheduler { // @Autowired // private ShuttleAction shuttleAction; // @Autowired // private DeviceConfigService deviceConfigService; // @Autowired // private RedisUtil redisUtil; // // @Scheduled(cron = "0/1 * * * * ? ") // public void execute() { // List shuttleList = deviceConfigService.selectList(new EntityWrapper() // .eq("device_type", String.valueOf(SlaveType.Shuttle))); // for (DeviceConfig deviceConfig : shuttleList) { // Object object = redisUtil.get(RedisKeyType.SHUTTLE_FLAG.key + deviceConfig.getDeviceNo()); // if (object == null) { // continue; // } // // int taskNo = Integer.parseInt(String.valueOf(object)); // if (taskNo != 0) { // //存在任务需要执行 // boolean result = shuttleAction.executeWork(deviceConfig.getDeviceNo(), taskNo); // } // } // } }