#
Junjie
2025-08-01 728ad81fa10d2879654c5f9ae4314db94eafb865
src/main/java/com/zy/core/task/ShuttleExecuteScheduler.java
@@ -18,29 +18,29 @@
@Component
public class ShuttleExecuteScheduler {
    @Autowired
    private ShuttleAction shuttleAction;
    @Autowired
    private DeviceConfigService deviceConfigService;
    @Autowired
    private RedisUtil redisUtil;
    @Scheduled(cron = "0/1 * * * * ? ")
    public void execute() {
        List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                .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);
            }
        }
    }
//    @Autowired
//    private ShuttleAction shuttleAction;
//    @Autowired
//    private DeviceConfigService deviceConfigService;
//    @Autowired
//    private RedisUtil redisUtil;
//
//    @Scheduled(cron = "0/1 * * * * ? ")
//    public void execute() {
//        List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
//                .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);
//            }
//        }
//    }
}