opt: 提示横幅,检测服务

This commit is contained in:
2026-09-30 13:50:37 +08:00
parent 49c8e8a73d
commit 51c3bbc697
16 changed files with 379 additions and 38 deletions

View File

@@ -0,0 +1,20 @@
package cn.code.nl.module.task.controller.defaults;
import cn.code.nl.framework.common.pojo.CommonResult;
import jakarta.annotation.security.PermitAll;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
/**
*
* @Author: liyongde
* @Date: 2026/9/30 12:55
*/
@RestController
public class TaskCheckController {
@GetMapping("/task-check")
@PermitAll
public CommonResult<String> check() {
return CommonResult.success("欢迎使用华创任务服务......");
}
}

View File

@@ -0,0 +1,21 @@
package cn.code.nl.module.task.utils;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
/**
* 默认是NlBannerAutoConfiguration通用组件
* 项目启动成功后,提供文档相关的地址
*
* @author 芋道源码
*/
@Component("taskBannerApplicationRunner")
public class BannerApplicationRunner implements ApplicationRunner {
@Override
public void run(ApplicationArguments args) {
System.out.println("华创项目任务服务启动成功!");
}
}

View File

@@ -0,0 +1,138 @@
--- #################### 注册中心 + 配置中心相关配置 ####################
spring:
cloud:
nacos:
server-addr: 10.53.141.28:8848 # Nacos 服务器地址
username: nacos
password: nacos
discovery: # 【注册中心】配置项
namespace: 2d1e686e-dc96-4776-a0cd-fa4806d68051
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
config: # 【配置中心】配置项
namespace: 2d1e686e-dc96-4776-a0cd-fa4806d68051
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
--- #################### 数据库相关配置 ####################
spring:
# 数据源配置项
autoconfigure:
exclude:
datasource:
druid: # Druid 【监控】相关的全局配置
web-stat-filter:
enabled: true
stat-view-servlet:
enabled: true
allow: # 设置白名单,不填则允许所有访问
url-pattern: /druid/*
login-username: # 控制台管理用户名和密码
login-password:
filter:
stat:
enabled: true
log-slow-sql: true # 慢 SQL 记录
slow-sql-millis: 100
merge-sql: true
wall:
config:
multi-statement-allow: true
dynamic: # 多数据源配置
druid: # Druid 【连接池】相关的全局配置
initial-size: 5 # 初始连接数
min-idle: 10 # 最小连接池数量
max-active: 20 # 最大连接池数量
max-wait: 60000 # 配置获取连接等待超时的时间,单位:毫秒(1 分钟)
time-between-eviction-runs-millis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位:毫秒(1 分钟)
min-evictable-idle-time-millis: 600000 # 配置一个连接在池中最小生存的时间,单位:毫秒(10 分钟)
max-evictable-idle-time-millis: 1800000 # 配置一个连接在池中最大生存的时间,单位:毫秒(30 分钟)
validation-query: SELECT 1 FROM DUAL # 配置检测连接是否有效
test-while-idle: true
test-on-borrow: false
test-on-return: false
pool-prepared-statements: true # 是否开启 PreparedStatement 缓存
max-pool-prepared-statement-per-connection-size: 20 # 每个连接缓存的 PreparedStatement 数量
primary: master
datasource:
master:
url: jdbc:mysql://10.53.141.29:3306/huachuang_lms?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例
username: root
password: NLABC&hc123
slave: # 模拟从库,可根据自己需要修改 # 模拟从库,可根据自己需要修改
lazy: true # 开启懒加载,保证启动速度
url: jdbc:mysql://10.53.141.29:3306/huachuang_lms?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例
username: root
password: NLABC&hc123
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
data:
redis:
host: 10.53.141.28 # 地址
port: 6379 # 端口
database: 1 # 数据库索引
# password: 123456 # 密码,建议生产环境开启
--- #################### MQ 消息队列相关配置 ####################
# rocketmq 配置项,对应 RocketMQProperties 配置类
rocketmq:
name-server: 192.168.81.193:9876 # RocketMQ Namesrv
producer:
group: task_producer_dev_group # 生产者分组
consumer:
task:
topic: task_status_change_dev_topic
--- #################### 定时任务相关配置 ####################
xxl:
job:
enabled: true # 是否开启调度中心,默认为 true 开启
admin:
addresses: http://10.53.141.29:8080/xxl-job-admin # 调度中心部署跟地址
executor:
appname: huachuang-job
ip: 10.53.141.28
port: 9986
logpath: ${user.home}/logs/xxl-job/${spring.application.name}/${spring.application.name} # 执行器运行日志文件存储磁盘路径
accessToken: default_token # 执行器通讯TOKEN
--- #################### 服务保障相关配置 ####################
# Lock4j 配置项
lock4j:
acquire-timeout: 3000 # 获取分布式锁超时时间,默认为 3000 毫秒
expire: 30000 # 分布式锁的超时时间,默认为 30000 毫秒
--- #################### 监控相关配置 ####################
# Actuator 监控端点的配置项
management:
endpoints:
web:
base-path: /actuator # Actuator 提供的 API 接口的根目录。默认为 /actuator
exposure:
include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
# Spring Boot Admin 配置项
spring:
boot:
admin:
# Spring Boot Admin Client 客户端的相关配置
client:
instance:
service-host-type: IP # 注册实例时,优先使用 IP [IP, HOST_NAME, CANONICAL_HOST_NAME]
username: admin
password: admin
# Spring Boot Admin Server 服务端的相关配置
context-path: /admin # 配置 Spring
# 日志文件配置
logging:
file:
name: D:/logs/${spring.application.name}/${spring.application.name}.log # 日志文件名,全路径
--- #################### 芋道相关配置 ####################
# 芋道配置项,设置当前项目所有自定义的配置
nl:
demo: false # 开启演示模式

View File

@@ -3,7 +3,7 @@ spring:
name: task-server
profiles:
active: dev
active: prod
main:
allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。
@@ -38,10 +38,6 @@ spring:
server:
port: 48086
logging:
file:
name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径
--- #################### 接口文档配置 ####################
springdoc:
@@ -89,24 +85,6 @@ spring:
easy-trans:
is-enable-global: false # 【默认禁用,对性能确认压力大】启用全局翻译(拦截所有 SpringMVC ResponseBody 进行自动翻译 )。如果对于性能要求很高可关闭此配置,或通过 @IgnoreTrans 忽略某个接口
--- #################### RPC 远程调用相关配置 ####################
--- #################### 消息队列相关 ####################
# rocketmq 配置项,对应 RocketMQProperties 配置类
rocketmq:
# Producer 配置项
producer:
group: ${spring.application.name}_PRODUCER # 生产者分组
--- #################### 定时任务相关配置 ####################
xxl:
job:
executor:
appname: ${spring.application.name} # 执行器 AppName
logpath: ${user.home}/logs/xxl-job/${spring.application.name} # 执行器运行日志文件存储磁盘路径
--- #################### 芋道相关配置 ####################
nl:

View File

@@ -0,0 +1,16 @@
Application Version: ${nl.info.version}
Spring Boot Version: ${spring-boot.version}
.__ __. ______ .______ __ _______ __ __ _______ .___________.
| \ | | / __ \ | _ \ | | | ____|| | | | | ____|| |
| \| | | | | | | |_) | | | | |__ | | | | | |__ `---| |----`
| . ` | | | | | | _ < | | | __| | | | | | __| | |
| |\ | | `--' | | |_) | | `----.| |____ | `----.| | | | | |
|__| \__| \______/ |______/ |_______||_______||_______||__| |__| |__|
__ __
/ /_ __ ______ ______/ /_ __ ______ _____ ____ _
/ __ \/ / / / __ `/ ___/ __ \/ / / / __ `/ __ \/ __ `/
/ / / / /_/ / /_/ / /__/ / / / /_/ / /_/ / / / / /_/ /
/_/ /_/\__,_/\__,_/\___/_/ /_/\__,_/\__,_/_/ /_/\__, /
/____/

View File

@@ -46,7 +46,7 @@
-->
<root level="INFO">
<appender-ref ref="STDOUT"/>
<!-- <appender-ref ref="STDOUT"/>-->
<!-- 本地环境下,如果不想【FILE】打印日志,可以注释掉本行 -->
<appender-ref ref="ASYNC"/>
<!-- 如果想接入【SkyWalking 日志服务】,可以取消注释掉本行 -->