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.core.action.ShuttleAction; 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; @Component @Slf4j public class ShuttleDemoScheduler { @Autowired private DeviceConfigService deviceConfigService; @Autowired private ShuttleAction shuttleAction; @Scheduled(cron = "0/3 * * * * ? ") public synchronized void execute() { List shuttleList = deviceConfigService.selectList(new EntityWrapper() .eq("device_type", String.valueOf(SlaveType.Shuttle))); for (DeviceConfig device : shuttleList) { shuttleAction.demo(device.getDeviceNo()); } } @Scheduled(cron = "0/3 * * * * ? ") public synchronized void executeCargoMove() { shuttleAction.demoModeCargoMove(); } }