Browse Source

Merge remote-tracking branch 'origin/master'

master
psh 6 months ago
parent
commit
9155062db6
  1. 4
      .gitignore
  2. 2
      acs/nladmin-system/nlsso-server/src/main/resources/config/application-prod.yml
  3. 11
      acs/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml
  4. 9
      lms/nladmin-system/nlsso-server/pom.xml
  5. 10
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/utils/ExecutionJob.java
  6. 11
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/utils/QuartzRunnable.java
  7. 4
      lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml
  8. 14
      lms/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml

4
.gitignore

@ -0,0 +1,4 @@
lms/nladmin-system/nlsso-server/target/
lms/nladmin-system/.idea/
acs/nladmin-system/.idea/
acs/nladmin-system/nlsso-server/target/

2
acs/nladmin-system/nlsso-server/src/main/resources/config/application-prod.yml

@ -54,7 +54,7 @@ spring:
multi-statement-allow: true
flyway:
# 是否启用flyway
enabled: true
enabled: false
# 编码格式,默认UTF-8
encoding: UTF-8
# 迁移sql脚本文件存放路径,默认db/migration

11
acs/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml

@ -12,17 +12,15 @@ https://juejin.cn/post/6844903775631572999
<contextName>nlAdmin</contextName>
<property name="log.charset" value="utf-8"/>
<property name="log.pattern"
value="%black(%contextName-) %red(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %gray(%msg%n)"/>
value="%cyan(%contextName-) %red(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %cyan(%msg%n)"/>
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<property name="LOG_HOME" value="${logPath}"/>
<!--引入默认的一些设置-->
<!--<include resource="log/XrToMes.xml"/>
<include resource="log/MesToErp.xml"/>-->
<include resource="log/AutoCreateInst.xml"/>
<include resource="log/AcsToWms.xml"/>
<include resource="log/WmsToAcs.xml"/>
<include resource="log/OneNDCSocketConnectionAutoRun.xml"/>
<!-- <include resource="log/Lucene.xml"/>-->
<include resource="log/AgvNdcOneDeviceDriver.xml"/>
<include resource="log/NDCAgvServiceImpl.xml"/>
<include resource="log/LnshRGVDeviceDriver.xml"/>
@ -30,7 +28,6 @@ https://juejin.cn/post/6844903775631572999
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<withJansi>true</withJansi>
<encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder">
<!-- <encoder>-->
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
@ -50,8 +47,7 @@ https://juejin.cn/post/6844903775631572999
<totalSizeCap>20GB</totalSizeCap>
</rollingPolicy>
<encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder">
<!-- <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">-->
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
</encoder>
@ -59,7 +55,6 @@ https://juejin.cn/post/6844903775631572999
</appender>
<!--异步到文件-->
<!-- <appender name="asyncFileAppender" class="ch.qos.logback.classic.AsyncAppender">-->
<appender name="asyncFileAppender" class="com.yomahub.tlog.core.enhance.logback.async.AspectLogbackAsyncAppender">
<discardingThreshold>0</discardingThreshold>
<queueSize>500</queueSize>

9
lms/nladmin-system/nlsso-server/pom.xml

@ -33,11 +33,18 @@
</properties>
<dependencies>
<!-- 日志链路追踪 https://tlog.yomahub.com/pages/f62a84/#%E5%90%8C%E6%AD%A5%E6%97%A5%E5%BF%97-->
<dependency>
<groupId>com.yomahub</groupId>
<artifactId>tlog-web-spring-boot-starter</artifactId>
<version>1.5.0</version>
</dependency>
<!-- https://onew.me/logback/2018/09/17/logback_win.html-->
<dependency>
<groupId>org.fusesource.jansi</groupId>
<artifactId>jansi</artifactId>
<version>1.17.1</version>
<version>1.9</version>
</dependency>
<!--工具包-->

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

@ -2,11 +2,12 @@ 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;
@ -15,7 +16,6 @@ import org.nl.system.service.quartz.impl.SysQuartzJobServiceImpl;
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 +28,14 @@ import java.util.concurrent.ThreadPoolExecutor;
@Async
@SuppressWarnings({"unchecked", "all"})
@Slf4j
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 +99,6 @@ public class ExecutionJob extends QuartzJobBean {
}
}
}

11
lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/utils/QuartzRunnable.java

@ -1,19 +1,21 @@
package org.nl.system.service.quartz.utils;
import cn.hutool.core.util.StrUtil;
import com.yomahub.tlog.core.thread.TLogInheritableTask;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.nl.config.SpringContextHolder;
import org.springframework.util.ReflectionUtils;
import java.lang.reflect.Method;
import java.util.concurrent.Callable;
/**
* 执行定时任务
*
* @author /
*/
@Slf4j
public class QuartzRunnable implements Callable {
public class QuartzRunnable extends TLogInheritableTask {
private final Object target;
private final Method method;
@ -31,14 +33,15 @@ public class QuartzRunnable implements Callable {
}
}
@SneakyThrows
@Override
public Object call() throws Exception {
public void runTask() {
ReflectionUtils.makeAccessible(method);
if (StrUtil.isNotEmpty(params)) {
method.invoke(target, params);
} else {
method.invoke(target);
}
return null;
}
}

4
lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml

@ -88,6 +88,10 @@ mybatis-plus:
global-config:
db-config:
id-type: INPUT
banner: false
lucene:
index:
path: D:\lucene\index
tlog:
enable-invoke-time-print: true
pattern: "[$preApp][$preIp][$spanId][$traceId]"

14
lms/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml

@ -12,18 +12,18 @@ https://juejin.cn/post/6844903775631572999
<contextName>nlAdmin</contextName>
<property name="log.charset" value="utf-8"/>
<property name="log.pattern"
value="%black(%contextName-) %red(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %gray(%msg%n)"/>
value="%cyan(%contextName-) %red(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %cyan(%msg%n)"/>
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<property name="LOG_HOME" value="${logPath}"/>
<!--引入默认的一些设置-->
<!--<include resource="log/XrToMes.xml"/>
<include resource="log/MesToErp.xml"/>-->
<include resource="log/XgAgvDeviceDriver.xml"/>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<!--withJansi 参数改为true-->
<withJansi>true</withJansi>
<encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder">
<pattern>${log.pattern}</pattern>
<charset>${log.charset}</charset>
<!-- <charset>${log.charset}</charset>-->
</encoder>
</appender>
@ -49,7 +49,7 @@ https://juejin.cn/post/6844903775631572999
</appender>
<!--异步到文件-->
<appender name="asyncFileAppender" class="ch.qos.logback.classic.AsyncAppender">
<appender name="asyncFileAppender" class="com.yomahub.tlog.core.enhance.logback.async.AspectLogbackAsyncAppender">
<discardingThreshold>0</discardingThreshold>
<queueSize>500</queueSize>
<appender-ref ref="FILE"/>
@ -57,7 +57,7 @@ https://juejin.cn/post/6844903775631572999
<!--开发环境:打印控制台-->
<springProfile name="dev">
<root level="debug">
<appender-ref ref="asyncFileAppender"/>
<appender-ref ref="CONSOLE"/>
</root>
<logger name="org.springframework" level="ERROR" additivity="false">
<appender-ref ref="asyncFileAppender"/>

Loading…
Cancel
Save