From 0b12a5439bc5ddf9a0960cd7f0d7f211d134e4c9 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Tue, 3 Jul 2018 09:18:28 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8B=A5=E4=BE=9D=202.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project/monitor/job/util/ScheduleJob.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/ruoyi/project/monitor/job/util/ScheduleJob.java b/src/main/java/com/ruoyi/project/monitor/job/util/ScheduleJob.java index b1e09069..5163ba3c 100644 --- a/src/main/java/com/ruoyi/project/monitor/job/util/ScheduleJob.java +++ b/src/main/java/com/ruoyi/project/monitor/job/util/ScheduleJob.java @@ -4,12 +4,13 @@ import java.util.Date; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; +import org.apache.commons.beanutils.PropertyUtils; +import org.quartz.JobDataMap; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.scheduling.quartz.QuartzJobBean; - import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.ScheduleConstants; import com.ruoyi.common.utils.spring.SpringUtils; @@ -32,7 +33,17 @@ public class ScheduleJob extends QuartzJobBean @Override protected void executeInternal(JobExecutionContext context) throws JobExecutionException { - Job job = (Job) context.getMergedJobDataMap().get(ScheduleConstants.JOB_PARAM_KEY); + // Job job = (Job) context.getMergedJobDataMap().get(ScheduleConstants.JOB_PARAM_KEY); + JobDataMap jobDataMap = context.getMergedJobDataMap(); + Job job = new Job(); + try + { + PropertyUtils.copyProperties(job, jobDataMap.get(ScheduleConstants.JOB_PARAM_KEY)); + } + catch (Exception e) + { + log.error("copyProperties执行异常 - :", e); + } IJobLogService jobLogService = (IJobLogService) SpringUtils.getBean(IJobLogService.class);