diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/AppRun.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/AppRun.java index f12511396..6172bf843 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/AppRun.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/AppRun.java @@ -28,6 +28,7 @@ import org.springframework.web.bind.annotation.RestController; @RestController @Api(hidden = true) @SpringBootApplication(exclude = { + QuartzAutoConfiguration.class, org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class }) @ServletComponentScan //https://blog.csdn.net/qq_36850813/article/details/101194250 diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/utils/ExecutionJob.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/utils/ExecutionJob.java index 234c64195..19ea9701b 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/utils/ExecutionJob.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/utils/ExecutionJob.java @@ -2,18 +2,22 @@ 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.config.thread.ThreadPoolExecutorUtil; import org.nl.common.utils.RedisUtils; import org.nl.common.utils.ThrowableUtil; import org.nl.config.SpringContextHolder; +import org.nl.config.thread.ThreadPoolExecutorUtil; import org.nl.system.service.quartz.ISysQuartzJobService; 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.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.quartz.QuartzJobBean; @@ -28,14 +32,19 @@ import java.util.concurrent.ThreadPoolExecutor; @Async @SuppressWarnings({"unchecked", "all"}) @Slf4j -public class ExecutionJob extends QuartzJobBean { +@DisallowConcurrentExecution +public class ExecutionJob extends TLogQuartzJobBean { /** * 该处仅供参考 */ - private final static ThreadPoolExecutor EXECUTOR = ThreadPoolExecutorUtil.getPoll(); + @Autowired + @Qualifier("threadPoolExecutor") + private ThreadPoolExecutor EXECUTOR; + + @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); @@ -45,7 +54,7 @@ public class ExecutionJob extends QuartzJobBean { String uuid = quartzJob.getUuid(); SysQuartzLog logDto = new SysQuartzLog(); - logDto.setLog_id(IdUtil.getSnowflake(1,1).nextIdStr()); + logDto.setLog_id(IdUtil.getSnowflake(1, 1).nextIdStr()); logDto.setJob_name(quartzJob.getJob_name()); logDto.setBean_name(quartzJob.getBean_name()); logDto.setMethod_name(quartzJob.getMethod_name()); diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml b/acs2/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml index 2967ddd59..152cb05e1 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml @@ -26,9 +26,11 @@ https://juejin.cn/post/6844903775631572999 - + + true + ${log.pattern} - ${log.charset} + @@ -52,9 +54,9 @@ https://juejin.cn/post/6844903775631572999 - + 0 - 200 + 500