package com.wms_main.service.quartz_job.job_executor;

import lombok.RequiredArgsConstructor;
import org.quartz.*;

/**
 * 定时任务定义类
 */
@PersistJobDataAfterExecution
@DisallowConcurrentExecution
@RequiredArgsConstructor
public class JobTest implements Job {
    /**
     * 运行定时任务
     *
     * @param jobExecutionContext 定时任务执行的环境（上下文）
     * @throws JobExecutionException 异常
     */
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        // TODO 需要增加定时器的全局异常捕获
        // 测试定时任务
        System.out.println("本次Test执行时间：" + jobExecutionContext.getFireTime());
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
}
