package com.skr.mdm.quartz;

import com.skr.mdm.constant.JobConstant;
import com.skr.mdm.util.JobUtil;
import org.quartz.Job;
import org.quartz.JobBuilder;
import org.quartz.JobDetail;

/**
 * @author nfq
 * @date 2022-11-01 17:44
 */
public class JobDetailHandler {

    public static JobDetail build(Class <? extends Job> jobClass, String jobKey) {
        return JobBuilder.newJob(jobClass)
                .withIdentity(JobUtil.getJobKey(jobKey))
                .build();
    }

    public static void putJobDataMap(JobDetail jobDetail, String data) {
         jobDetail.getJobDataMap().put(JobConstant.JOB_INFO_IN_JOB_DATA_MAP_KEY, data);
    }
}
