rev:添加Tlog与动态线程池监控,去掉前端多余文件
@@ -48,10 +48,16 @@
|
||||
<version>${hutool.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 日志链路追踪 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-all-spring-boot-starter</artifactId>
|
||||
<version>1.5.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.dynamictp</groupId>
|
||||
<artifactId>dynamic-tp-spring-boot-starter-adapter-webserver</artifactId>
|
||||
<version>1.1.6.1</version>
|
||||
<version>1.1.7</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -4,6 +4,7 @@ import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation;
|
||||
import com.alicp.jetcache.anno.config.EnableMethodCache;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.dromara.dynamictp.core.spring.EnableDynamicTp;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.config.thread.ThreadPoolExecutorUtil;
|
||||
@@ -36,6 +37,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@EnableMethodCache(basePackages = "org.nl")
|
||||
@EnableCreateCacheAnnotation
|
||||
@MapperScan("org.nl.**.mapper")
|
||||
@EnableDynamicTp
|
||||
public class AppRun {
|
||||
|
||||
public static void main(String[] args) {
|
||||
@@ -48,14 +50,6 @@ public class AppRun {
|
||||
return new SpringContextHolder();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ServletWebServerFactory webServerFactory() {
|
||||
TomcatServletWebServerFactory fa = new TomcatServletWebServerFactory();
|
||||
fa.addConnectorCustomizers(connector -> connector.setProperty("relaxedQueryChars", "[]{}"));
|
||||
return fa;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 访问首页提示
|
||||
|
||||
@@ -2,8 +2,8 @@ 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;
|
||||
@@ -18,7 +18,6 @@ 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;
|
||||
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
@@ -32,7 +31,7 @@ import java.util.concurrent.ThreadPoolExecutor;
|
||||
@SuppressWarnings({"unchecked", "all"})
|
||||
@Slf4j
|
||||
@DisallowConcurrentExecution
|
||||
public class ExecutionJob extends QuartzJobBean {
|
||||
public class ExecutionJob extends TLogQuartzJobBean {
|
||||
|
||||
/**
|
||||
* 该处仅供参考
|
||||
@@ -41,8 +40,9 @@ public class ExecutionJob extends QuartzJobBean {
|
||||
@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);
|
||||
@@ -52,7 +52,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());
|
||||
@@ -61,8 +61,8 @@ public class ExecutionJob extends QuartzJobBean {
|
||||
logDto.setCron_expression(quartzJob.getCron_expression());
|
||||
try {
|
||||
// 执行任务
|
||||
System.out.println("--------------------------------------------------------------");
|
||||
System.out.println("任务开始执行,任务名称:" + quartzJob.getJob_name());
|
||||
//System.out.println("--------------------------------------------------------------");
|
||||
//System.out.println("任务开始执行,任务名称:" + quartzJob.getJob_name());
|
||||
QuartzRunnable task = new QuartzRunnable(quartzJob.getBean_name(), quartzJob.getMethod_name(),
|
||||
quartzJob.getParams());
|
||||
Future<?> future = EXECUTOR.submit(task);
|
||||
@@ -74,8 +74,8 @@ public class ExecutionJob extends QuartzJobBean {
|
||||
}
|
||||
// 任务状态
|
||||
logDto.setIs_success(true);
|
||||
System.out.println("任务执行完毕,任务名称:" + quartzJob.getJob_name() + ", 执行时间:" + times + "毫秒");
|
||||
System.out.println("--------------------------------------------------------------");
|
||||
// System.out.println("任务执行完毕,任务名称:" + quartzJob.getJob_name() + ", 执行时间:" + times + "毫秒");
|
||||
//System.out.println("--------------------------------------------------------------");
|
||||
// 判断是否存在子任务
|
||||
if (StrUtil.isNotEmpty(quartzJob.getSub_task())) {
|
||||
String[] tasks = quartzJob.getSub_task().split("[,,]");
|
||||
@@ -86,8 +86,8 @@ public class ExecutionJob extends QuartzJobBean {
|
||||
if (StrUtil.isNotEmpty(uuid)) {
|
||||
redisUtils.set(uuid, false);
|
||||
}
|
||||
System.out.println("任务执行失败,任务名称:" + quartzJob.getJob_name());
|
||||
System.out.println("--------------------------------------------------------------");
|
||||
//System.out.println("任务执行失败,任务名称:" + quartzJob.getJob_name());
|
||||
// System.out.println("--------------------------------------------------------------");
|
||||
long times = System.currentTimeMillis() - startTime;
|
||||
logDto.setTime(times);
|
||||
// 任务状态 0:成功 1:失败
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,34 @@
|
||||
server:
|
||||
tomcat:
|
||||
relaxed-query-chars: [ '|','{','}','[',']' ] #字符问题:https://blog.csdn.net/CanYue_Yi/article/details/109182577
|
||||
relaxed-path-chars: [ '|','{','}','[',']' ] #字符问题: https://blog.csdn.net/weixin_41996632/article/details/90715118
|
||||
spring:
|
||||
freemarker:
|
||||
check-template-location: false
|
||||
profiles:
|
||||
active: prod
|
||||
active: dev
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
data:
|
||||
redis:
|
||||
repositories:
|
||||
enabled: false
|
||||
dynamic:
|
||||
tp:
|
||||
enabled: true # 是否启用 dynamictp,默认true
|
||||
enabledBanner: false # 是否启用 控制台banner,默认true
|
||||
enabledCollect: true # 是否开启监控指标采集,默认true
|
||||
collectorTypes: logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer
|
||||
logPath: d:\log\lms # 监控日志数据路径,默认 ${user.home}/logs,采集类型非logging不用配置
|
||||
monitorInterval: 8
|
||||
tomcatTp: # tomcat webserver 线程池配置
|
||||
threadPoolAliasName: tomcat 线程池 # 线程池别名,可选
|
||||
corePoolSize: 12
|
||||
tryInterrupt: true
|
||||
maximumPoolSize: 50
|
||||
keepAliveTime: 60
|
||||
runTimeout: 10000
|
||||
queueTimeout: 100
|
||||
|
||||
#配置 Jpa
|
||||
jpa:
|
||||
@@ -93,3 +113,5 @@ mybatis-plus:
|
||||
lucene:
|
||||
index:
|
||||
path: D:\lucene\index
|
||||
tlog:
|
||||
enable-invoke-time-print: true
|
||||
@@ -21,9 +21,10 @@ https://juejin.cn/post/6844903775631572999
|
||||
<!-- <include resource="log/XgAgvDeviceDriver.xml"/>-->
|
||||
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<!-- 控制台高亮-->
|
||||
<withJansi>true</withJansi>
|
||||
<encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder">
|
||||
<pattern>${log.pattern}</pattern>
|
||||
<charset>${log.charset}</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
@@ -49,7 +50,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 +58,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"/>
|
||||
|
||||
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 876 KiB |
|
Before Width: | Height: | Size: 389 KiB |
|
Before Width: | Height: | Size: 87 KiB |
|
Before Width: | Height: | Size: 647 KiB |
|
Before Width: | Height: | Size: 82 KiB |
|
Before Width: | Height: | Size: 509 KiB |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 120 KiB |
|
Before Width: | Height: | Size: 120 KiB |
|
Before Width: | Height: | Size: 79 KiB |
@@ -1,5 +1,8 @@
|
||||
.head-container {
|
||||
padding-bottom: 10px;
|
||||
padding-top: 8px;
|
||||
padding-bottom: 6px;
|
||||
background-color: #ffffff;
|
||||
border-radius: 4px;
|
||||
|
||||
.filter-item {
|
||||
display: inline-block;
|
||||
@@ -188,7 +191,7 @@ input[type="number"]::-webkit-outer-spin-button {
|
||||
.el-table__fixed-header-wrapper {
|
||||
th {
|
||||
word-break: break-word;
|
||||
background-color: #f8f8f9;
|
||||
background-color: #f5f5f5;
|
||||
color: #515a6e;
|
||||
height: 35px;
|
||||
font-size: 13px;
|
||||
|
||||
@@ -21,6 +21,7 @@ label {
|
||||
html {
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
//background-color: #eeeeee;
|
||||
}
|
||||
|
||||
#app {
|
||||
@@ -98,7 +99,7 @@ div:focus {
|
||||
}
|
||||
|
||||
aside {
|
||||
background: #eef1f6;
|
||||
background: #d40c70;
|
||||
padding: 8px 24px;
|
||||
margin-bottom: 20px;
|
||||
border-radius: 2px;
|
||||
@@ -122,7 +123,7 @@ aside {
|
||||
|
||||
//main-container全局样式
|
||||
.app-container {
|
||||
padding: 20px 20px 45px 20px;
|
||||
padding: 10px 10px 45px 10px;
|
||||
}
|
||||
|
||||
.components-container {
|
||||
|
||||
@@ -13,17 +13,17 @@ $base-logo-light-title-color: #001529;
|
||||
$base-menu-light-background:#ffffff;
|
||||
|
||||
// sidebar
|
||||
$menuText:#bfcbd9;
|
||||
$menuText: #ffffff;
|
||||
$menuActiveText:#409EFF;
|
||||
$subMenuActiveText:#f4f4f5; // https://github.com/ElemeFE/element/issues/12951
|
||||
$subMenuActiveText: #ffffff; // https://github.com/ElemeFE/element/issues/12951
|
||||
|
||||
$menuBg:#304156; //https://cloud.tencent.com/developer/article/1753773
|
||||
$menuHover:#263445;
|
||||
$menuBg: #001529; //https://cloud.tencent.com/developer/article/1753773
|
||||
$menuHover:#4e5465;
|
||||
|
||||
$base-menu-light-color:rgba(0,0,0,.70);
|
||||
|
||||
$subMenuBg:#1f2d3d;
|
||||
$subMenuHover:#001528;
|
||||
$subMenuBg:#000c17;
|
||||
$subMenuHover:#4e5465;
|
||||
|
||||
$sideBarWidth: 205px;
|
||||
|
||||
@@ -45,4 +45,4 @@ $sideBarWidth: 205px;
|
||||
logoLightTitleColor: $base-logo-light-title-color
|
||||
}
|
||||
|
||||
$base-sidebar-width: 200px;
|
||||
$base-sidebar-width: 2010px;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Logo from '@/assets/images/open5.png'
|
||||
import Logo from '@/assets/images/logo.png'
|
||||
import variables from '@/assets/styles/variables.scss'
|
||||
export default {
|
||||
name: 'SidebarLogo',
|
||||
|
||||
@@ -323,9 +323,9 @@
|
||||
<el-table-column prop="point_code" label="设备编码" :min-width="flexWidth('point_code',crud.data,'设备编码')" />
|
||||
<el-table-column prop="point_name" label="设备名称" :min-width="flexWidth('point_name',crud.data,'设备名称')" />
|
||||
<el-table-column prop="operator" label="开工人" :min-width="flexWidth('operator',crud.data,'开工人')" />
|
||||
<el-table-column prop="material_code" label="物料编码" :min-width="flexWidth('material_name',crud.data,'物料标识')" />
|
||||
<el-table-column prop="material_code" label="物料编码" :min-width="flexWidth('material_code',crud.data,'物料标识')" />
|
||||
<el-table-column prop="material_name" label="物料名称" :min-width="flexWidth('material_name',crud.data,'物料标识')" />
|
||||
<el-table-column prop="material_spec" label="物料规格" :min-width="flexWidth('material_name',crud.data,'物料标识')" />
|
||||
<el-table-column prop="material_spec" label="物料规格" :min-width="flexWidth('material_spec',crud.data,'物料标识')" />
|
||||
<el-table-column prop="vehicle_type" label="载具类型" :min-width="flexWidth('vehicle_type',crud.data,'载具类型', 20)">
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.vehicle_type[scope.row.vehicle_type] }}
|
||||
|
||||
@@ -64,13 +64,13 @@
|
||||
<el-table-column
|
||||
prop="request_param"
|
||||
label="生成任务的请求参数"
|
||||
:min-width="flexWidth('request_param',crud.data,'生成任务的请求参数')"
|
||||
:min-width="100"
|
||||
/>
|
||||
<el-table-column
|
||||
<!-- <el-table-column
|
||||
prop="response_param"
|
||||
label="下发任务的请求参数"
|
||||
:min-width="flexWidth('response_param',crud.data,'下发任务的请求参数')"
|
||||
/>
|
||||
/>-->
|
||||
<el-table-column
|
||||
prop="acs_trace_id"
|
||||
label="链路标识"
|
||||
|
||||
@@ -289,7 +289,7 @@
|
||||
<el-table-column prop="create_time" label="创建时间" :min-width="flexWidth('create_time',crud.data,'创建时间')" />
|
||||
<el-table-column prop="update_name" label="修改人" :min-width="flexWidth('update_name',crud.data,'修改人')" />
|
||||
<el-table-column prop="update_time" label="修改时间" :min-width="flexWidth('update_time',crud.data,'修改时间')" />
|
||||
<el-table-column v-permission="[]" label="操作" width="200px" align="center" fixed="right">
|
||||
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
style="display: inline"
|
||||
|
||||
@@ -196,8 +196,8 @@
|
||||
<el-table-column v-if="false" prop="handle_class" label="处理类" :min-width="flexWidth('handle_class',crud.data,'处理类')" />
|
||||
<el-table-column v-if="false" prop="handle_status" label="处理状态" :min-width="flexWidth('handle_status',crud.data,'处理状态')" />
|
||||
<el-table-column prop="car_no" label="车号" :min-width="flexWidth('car_no',crud.data,'车号')" />
|
||||
<el-table-column prop="task_group_id" label="任务组标识" :min-width="flexWidth('task_group_id',crud.data,'任务组标识')" />
|
||||
<el-table-column prop="task_group_seq" label="任务组顺序号" :min-width="flexWidth('task_group_seq',crud.data,'任务组顺序号')" />
|
||||
<el-table-column v-if="false" prop="task_group_id" label="任务组标识" :min-width="flexWidth('task_group_id',crud.data,'任务组标识')" />
|
||||
<el-table-column v-if="false" prop="task_group_seq" label="任务组顺序号" :min-width="flexWidth('task_group_seq',crud.data,'任务组顺序号')" />
|
||||
<el-table-column prop="finished_type" label="任务完成类型" :min-width="flexWidth('finished_type',crud.data,'任务完成类型')">
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.finished_type[scope.row.finished_type]?dict.label.finished_type[scope.row.finished_type]:'未完成' }}
|
||||
@@ -208,11 +208,8 @@
|
||||
{{ dict.label.create_mode[scope.row.create_mode] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="acs_trace_id" label="链路标识" :min-width="flexWidth('acs_trace_id',crud.data,'链路标识')" />
|
||||
<el-table-column prop="request_param" label="生成任务的请求参数" :min-width="flexWidth('request_param',crud.data,'生成任务的请求参数')" />
|
||||
<el-table-column prop="response_param" label="下发任务的请求参数" :min-width="flexWidth('response_param',crud.data,'下发任务的请求参数')" />
|
||||
<el-table-column prop="workshop_code" label="车间编码" :min-width="flexWidth('workshop_code',crud.data,'车间编码')" />
|
||||
<el-table-column prop="ext_group_data" label="额外组盘信息" :min-width="flexWidth('ext_group_data',crud.data,'额外组盘信息')" />
|
||||
<el-table-column prop="request_param" label="生成任务的请求参数" :min-width="100" show-overflow-tooltip/>
|
||||
<el-table-column prop="workshop_code" v-if="false" label="车间编码" :min-width="flexWidth('workshop_code',crud.data,'车间编码')" />
|
||||
<el-table-column prop="create_name" label="创建人" :min-width="flexWidth('create_name',crud.data,'创建人')" />
|
||||
<el-table-column prop="create_time" label="创建时间" :min-width="flexWidth('create_time',crud.data,'创建时间')" />
|
||||
<el-table-column prop="update_name" label="修改人" :min-width="flexWidth('update_name',crud.data,'修改人')" />
|
||||
|
||||