Browse Source

定时任务修改

master
管理员 2 years ago
parent
commit
dd96c17f56
  1. 10
      nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/utils/ExecutionJob.java

10
nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/utils/ExecutionJob.java

@ -2,6 +2,7 @@ package org.nl.system.service.quartz.utils;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.yomahub.tlog.task.quartz.TLogQuartzJobBean;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.utils.RedisUtils;
import org.nl.common.utils.SpringContextHolder;
@ -12,10 +13,10 @@ import org.nl.system.service.quartz.dao.SysQuartzJob;
import org.nl.system.service.quartz.dao.SysQuartzLog;
import org.nl.system.service.quartz.dao.mapper.SysQuartzLogMapper;
import org.nl.system.service.quartz.impl.SysQuartzJobServiceImpl;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.quartz.QuartzJobBean;
import java.util.concurrent.Future;
import java.util.concurrent.ThreadPoolExecutor;
@ -28,14 +29,16 @@ import java.util.concurrent.ThreadPoolExecutor;
@Async
@SuppressWarnings({"unchecked", "all"})
@Slf4j
public class ExecutionJob extends QuartzJobBean {
@DisallowConcurrentExecution
//public class ExecutionJob extends QuartzJobBean {
public class ExecutionJob extends TLogQuartzJobBean {
/**
* 该处仅供参考
*/
private final static ThreadPoolExecutor EXECUTOR = ThreadPoolExecutorUtil.getPoll();
@Override
protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
public void executeTask(JobExecutionContext context) throws JobExecutionException {
SysQuartzJob quartzJob = (SysQuartzJob) context.getMergedJobDataMap().get(SysQuartzJob.JOB_KEY);
// 获取spring bean
ISysQuartzJobService quartzJobService = SpringContextHolder.getBean(SysQuartzJobServiceImpl.class);
@ -99,4 +102,5 @@ public class ExecutionJob extends QuartzJobBean {
}
}
}

Loading…
Cancel
Save