package com.mes.job; import cn.hutool.json.JSONObject; import com.mes.workstation.service.UpWorkstationService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @Component @Slf4j public class PlcLoadGlassTask { @Autowired private UpWorkstationService upWorkstationService; /** * fixedRate : 上一个调用开始后再次调用的延时(不用等待上一次调用完成) * fixedDelay : 上一个调用结束后再次调用的延时 */ @Scheduled(fixedDelay = 300) public void plcLoadGlassTask() throws InterruptedException { JSONObject jsonObject = new JSONObject(); try { Thread.sleep(300); upWorkstationService.selectPriority(); } catch (Exception e) { e.printStackTrace(); } } }