xuefei
2020-12-10 eeeb7233935ea9b10e99043bdbf740ef86c9bf20
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package cn.cetc54.platform.quartz.jobs;
 
import cn.hutool.core.date.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
 
/**
 * 示例带参定时任务
 * @author
 */
@Slf4j
public class SampleParamJob implements Job {
 
    /**
     * 若参数变量名修改 QuartzJobController中也需对应修改
     */
    private String parameter;
 
    public void setParameter(String parameter) {
        this.parameter = parameter;
    }
 
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
 
        log.info(String.format("Hello %s!  时间:"+ DateUtil.now(), this.parameter));
    }
}