You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
898 B
30 lines
898 B
package com.aiprose.sbquartz.quartz;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.quartz.*;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import java.util.Date;
|
|
|
|
/**
|
|
* @author yanpeng
|
|
* @version 1.0
|
|
* @desc 具体实现业务逻辑
|
|
* @company 北京中经网软件有限公司
|
|
* @date 2020/12/23 16:02
|
|
*/
|
|
//这两个是在分布式环境中使用的
|
|
//@PersistJobDataAfterExecution
|
|
//@DisallowConcurrentExecution
|
|
@Component
|
|
@Slf4j
|
|
public class CronJob implements Job {
|
|
@Override
|
|
public void execute(JobExecutionContext context) throws JobExecutionException {
|
|
JobKey key = context.getJobDetail().getKey();
|
|
log.info("task name: {}",key.getName());
|
|
JobDataMap jobDataMap = context.getTrigger().getJobDataMap();
|
|
log.info("传递的参数:name:{}",jobDataMap.get("name"));
|
|
log.info("我要开始做具体的工作了,{}",new Date());
|
|
}
|
|
}
|
|
|