52 lines
1.1 KiB
Java
52 lines
1.1 KiB
Java
package com.ruoyi.schedule.scheduleTask;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.scheduling.annotation.Async;
|
|
import org.springframework.scheduling.annotation.EnableAsync;
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
@Slf4j
|
|
@Component
|
|
public class Timer {
|
|
|
|
@Autowired
|
|
Generation generation;
|
|
|
|
@Autowired
|
|
Execution execution;
|
|
|
|
@Autowired
|
|
StatusUpdate statusUpdate;
|
|
|
|
@Autowired
|
|
TaskFinish taskFinish;
|
|
|
|
@Autowired
|
|
TaskHandler taskHandler;
|
|
|
|
@Async
|
|
@Scheduled(cron = "*/2 * * * * *")
|
|
public void timerTask() {
|
|
|
|
try {
|
|
execution.executeTask();
|
|
Thread.sleep(200);
|
|
|
|
statusUpdate.statusUpdate();
|
|
Thread.sleep(200);
|
|
|
|
taskFinish.taskFinish();
|
|
Thread.sleep(200);
|
|
|
|
// generation.
|
|
|
|
} catch (Exception e) {
|
|
log.error("【调度任务异常】" + e.getMessage());
|
|
}
|
|
|
|
}
|
|
|
|
}
|