格式化文案

This commit is contained in:
2026-04-21 16:42:38 +08:00
parent b5119afb9f
commit 75dc1429cf

348
README.md
View File

@@ -7,7 +7,8 @@
- **项目名称**xtools-boot - **项目名称**xtools-boot
- **项目版本**5.0.0 - **项目版本**5.0.0
- **父POM**org.xujun:xtools-parent-boot:5.0.0 - **父POM**org.xujun:xtools-parent-boot:5.0.0
- **项目定位**低调大师工具箱SpringBoot工具模块适配JDK25。提供企业级应用开发所需的通用功能模块涵盖缓存、数据库、搜索、消息队列、任务调度、日志、存储、脱敏等核心能力以Spring Boot Starter形式封装支持按需引入。 - **项目定位**低调大师工具箱SpringBoot工具模块适配JDK25。提供企业级应用开发所需的通用功能模块涵盖缓存、数据库、搜索、消息队列、任务调度、日志、存储、脱敏等核心能力以Spring
Boot Starter形式封装支持按需引入。
### 1.2 技术特点 ### 1.2 技术特点
@@ -152,36 +153,25 @@ graph LR
Client[客户端请求] --> Web[xtools-boot-web] Client[客户端请求] --> Web[xtools-boot-web]
Web --> Filter[请求过滤器] Web --> Filter[请求过滤器]
Filter --> LogTrack[日志链路追踪] Filter --> LogTrack[日志链路追踪]
LogTrack --> Log[xtools-boot-log] LogTrack --> Log[xtools-boot-log]
Log --> LogBus[LogBus日志总线] Log --> LogBus[LogBus日志总线]
Web --> Controller[业务Controller] Web --> Controller[业务Controller]
Controller --> Cache[xtools-boot-cache] Controller --> Cache[xtools-boot-cache]
Controller --> DB[xtools-boot-db] Controller --> DB[xtools-boot-db]
Cache --> Redis[Redis] Cache --> Redis[Redis]
DB --> MySQL[MySQL] DB --> MySQL[MySQL]
Controller --> MQ[xtools-boot-mq] Controller --> MQ[xtools-boot-mq]
MQ --> RabbitMQ[RabbitMQ] MQ --> RabbitMQ[RabbitMQ]
MQ --> Thread[xtools-boot-thread] MQ --> Thread[xtools-boot-thread]
Thread --> VThread[虚拟线程] Thread --> VThread[虚拟线程]
Controller --> Task[xtools-boot-task] Controller --> Task[xtools-boot-task]
Task --> TaskBus[TaskBus任务总线] Task --> TaskBus[TaskBus任务总线]
Job[xtools-boot-job] --> XXLJob[XXL-JOB] Job[xtools-boot-job] --> XXLJob[XXL-JOB]
Controller --> ES[xtools-boot-elasticsearch] Controller --> ES[xtools-boot-elasticsearch]
ES --> Elasticsearch[Elasticsearch] ES --> Elasticsearch[Elasticsearch]
Controller --> Storage[xtools-boot-storage] Controller --> Storage[xtools-boot-storage]
Storage --> File[本地文件/S3] Storage --> File[本地文件/S3]
Controller --> Mask[xtools-boot-mask] Controller --> Mask[xtools-boot-mask]
Log --> Doc[xtools-boot-knife4j] Log --> Doc[xtools-boot-knife4j]
``` ```
@@ -193,36 +183,27 @@ graph LR
graph TD graph TD
App[xtools-boot<br/>父模块] --> API[xtools-boot-api<br/>API定义模块] App[xtools-boot<br/>父模块] --> API[xtools-boot-api<br/>API定义模块]
App --> Core[xtools-boot-core<br/>核心工具模块] App --> Core[xtools-boot-core<br/>核心工具模块]
App --> DB[xtools-boot-db<br/>数据库模块] App --> DB[xtools-boot-db<br/>数据库模块]
App --> Cache[xtools-boot-cache<br/>缓存模块] App --> Cache[xtools-boot-cache<br/>缓存模块]
App --> ES[xtools-boot-elasticsearch<br/>搜索引擎模块] App --> ES[xtools-boot-elasticsearch<br/>搜索引擎模块]
App --> MQ[xtools-boot-mq<br/>消息队列模块] App --> MQ[xtools-boot-mq<br/>消息队列模块]
App --> Task[xtools-boot-task<br/>任务管理模块] App --> Task[xtools-boot-task<br/>任务管理模块]
App --> Job[xtools-boot-job<br/>任务调度模块] App --> Job[xtools-boot-job<br/>任务调度模块]
App --> Thread[xtools-boot-thread<br/>线程管理模块] App --> Thread[xtools-boot-thread<br/>线程管理模块]
App --> Log[xtools-boot-log<br/>日志模块] App --> Log[xtools-boot-log<br/>日志模块]
App --> Web[xtools-boot-web<br/>Web模块] App --> Web[xtools-boot-web<br/>Web模块]
App --> Knife4j[xtools-boot-knife4j<br/>API文档模块] App --> Knife4j[xtools-boot-knife4j<br/>API文档模块]
App --> IP[xtools-boot-ip<br/>IP定位模块] App --> IP[xtools-boot-ip<br/>IP定位模块]
App --> Mask[xtools-boot-mask<br/>数据脱敏模块] App --> Mask[xtools-boot-mask<br/>数据脱敏模块]
App --> Storage[xtools-boot-storage<br/>存储模块] App --> Storage[xtools-boot-storage<br/>存储模块]
DB --> DBMybatis[xtools-boot-db-mybatis] DB --> DBMybatis[xtools-boot-db-mybatis]
DB --> DBMP[xtools-boot-db-mybatis-plus] DB --> DBMP[xtools-boot-db-mybatis-plus]
Cache --> CacheRedis[xtools-boot-cache-redis] Cache --> CacheRedis[xtools-boot-cache-redis]
MQ --> MQBase[xtools-boot-mq-base] MQ --> MQBase[xtools-boot-mq-base]
MQ --> MQRabbit[xtools-boot-mq-rabbit] MQ --> MQRabbit[xtools-boot-mq-rabbit]
Job --> JobXXL[xtools-boot-job-xxl] Job --> JobXXL[xtools-boot-job-xxl]
Web --> WebBase[xtools-boot-web-base] Web --> WebBase[xtools-boot-web-base]
Web --> WebFilter[xtools-boot-web-filter] Web --> WebFilter[xtools-boot-web-filter]
Storage --> StorageBase[xtools-boot-storage-base] Storage --> StorageBase[xtools-boot-storage-base]
Storage --> StorageFile[xtools-boot-storage-file] Storage --> StorageFile[xtools-boot-storage-file]
Storage --> StorageS3[xtools-boot-storage-s3] Storage --> StorageS3[xtools-boot-storage-s3]
@@ -277,28 +258,28 @@ flowchart TB
### 2.3 模块职责 ### 2.3 模块职责
| 模块 | 职责 | 核心类 | | 模块 | 职责 | 核心类 |
|------|------|--------| |-----------------------------|--------------------------------|-------------------------------------------|
| xtools-boot-api | API定义层提供基础实体、枚举、异常、日志链路等公共定义 | BaseEntity、BaseEnum、BizError、LogTrack | | xtools-boot-api | API定义层提供基础实体、枚举、异常、日志链路等公共定义 | BaseEntity、BaseEnum、BizError、LogTrack |
| xtools-boot-core | 核心工具层提供Spring上下文、树形结构、枚举等通用工具 | SpringContextUtils、TreeUtils、EnumUtils | | xtools-boot-core | 核心工具层提供Spring上下文、树形结构、枚举等通用工具 | SpringContextUtils、TreeUtils、EnumUtils |
| xtools-boot-db-mybatis | MyBatis集成提供数据库访问、监控、慢查询检测 | MyBatisConfig、MySqlMonitor | | xtools-boot-db-mybatis | MyBatis集成提供数据库访问、监控、慢查询检测 | MyBatisConfig、MySqlMonitor |
| xtools-boot-db-mybatis-plus | MyBatis-Plus集成提供分页插件、查询工具 | MybatisPlusConfig、QueryUtils | | xtools-boot-db-mybatis-plus | MyBatis-Plus集成提供分页插件、查询工具 | MybatisPlusConfig、QueryUtils |
| xtools-boot-cache-redis | Redis缓存提供缓存操作、监控 | RedisUtils、RedisMonitor | | xtools-boot-cache-redis | Redis缓存提供缓存操作、监控 | RedisUtils、RedisMonitor |
| xtools-boot-elasticsearch | ES集成提供搜索、查询、集群监控 | EsUtils、EsQueryUtils、ElasticsearchMonitor | | xtools-boot-elasticsearch | ES集成提供搜索、查询、集群监控 | EsUtils、EsQueryUtils、ElasticsearchMonitor |
| xtools-boot-mq-base | 消息总线,提供消息发布、处理、错误处理 | MqBus、BaseMqHandle、BaseErrorHandle | | xtools-boot-mq-base | 消息总线,提供消息发布、处理、错误处理 | MqBus、BaseMqHandle、BaseErrorHandle |
| xtools-boot-mq-rabbit | RabbitMQ实现提供消息监听、消费 | BootRabbitMqConfiguration | | xtools-boot-mq-rabbit | RabbitMQ实现提供消息监听、消费 | BootRabbitMqConfiguration |
| xtools-boot-task | 任务管理,提供任务总线、状态追踪 | TaskBus、TaskInfo、TaskStatus | | xtools-boot-task | 任务管理,提供任务总线、状态追踪 | TaskBus、TaskInfo、TaskStatus |
| xtools-boot-job-xxl | XXL-JOB集成提供分布式任务调度 | BootXxlJobConfiguration、InitXxlJob | | xtools-boot-job-xxl | XXL-JOB集成提供分布式任务调度 | BootXxlJobConfiguration、InitXxlJob |
| xtools-boot-thread | 线程管理,提供虚拟线程、回调机制 | BootThreadConfiguration | | xtools-boot-thread | 线程管理,提供虚拟线程、回调机制 | BootThreadConfiguration |
| xtools-boot-log | 日志模块,提供日志总线、链路追踪 | LogBus、LogTrackHolder、LogBody | | xtools-boot-log | 日志模块,提供日志总线、链路追踪 | LogBus、LogTrackHolder、LogBody |
| xtools-boot-web-base | Web基础提供MVC配置、过滤器、转换器 | BootWebBaseConfiguration、CommonFilter | | xtools-boot-web-base | Web基础提供MVC配置、过滤器、转换器 | BootWebBaseConfiguration、CommonFilter |
| xtools-boot-web-filter | Web过滤器提供过滤器扫描注册 | BootWebFilterConfiguration | | xtools-boot-web-filter | Web过滤器提供过滤器扫描注册 | BootWebFilterConfiguration |
| xtools-boot-knife4j | API文档提供Knife4j/OpenAPI3集成 | BootKnife4jConfiguration | | xtools-boot-knife4j | API文档提供Knife4j/OpenAPI3集成 | BootKnife4jConfiguration |
| xtools-boot-ip | IP定位提供离线IP地址查询 | BootIpConfiguration | | xtools-boot-ip | IP定位提供离线IP地址查询 | BootIpConfiguration |
| xtools-boot-mask | 数据脱敏,提供注解式敏感数据处理 | DefaultMaskHandle、MaskType | | xtools-boot-mask | 数据脱敏,提供注解式敏感数据处理 | DefaultMaskHandle、MaskType |
| xtools-boot-storage-base | 存储基础,提供统一存储接口 | StorageService | | xtools-boot-storage-base | 存储基础,提供统一存储接口 | StorageService |
| xtools-boot-storage-file | 文件存储,提供本地文件系统存储 | StorageServiceFileImpl | | xtools-boot-storage-file | 文件存储,提供本地文件系统存储 | StorageServiceFileImpl |
| xtools-boot-storage-s3 | S3存储提供AWS S3对象存储 | BootStorageS3Configuration | | xtools-boot-storage-s3 | S3存储提供AWS S3对象存储 | BootStorageS3Configuration |
### 2.4 包结构设计 ### 2.4 包结构设计
@@ -334,42 +315,33 @@ graph LR
API --> WebCore[xtools-web] API --> WebCore[xtools-web]
Core[xtools-boot-core] --> API Core[xtools-boot-core] --> API
Core --> Extend Core --> Extend
DBMybatis[xtools-boot-db-mybatis] --> Core DBMybatis[xtools-boot-db-mybatis] --> Core
DBMybatis --> Log[xtools-boot-log] DBMybatis --> Log[xtools-boot-log]
DBMybatis --> Thread[xtools-boot-thread] DBMybatis --> Thread[xtools-boot-thread]
DBMP[xtools-boot-db-mybatis-plus] --> Core DBMP[xtools-boot-db-mybatis-plus] --> Core
CacheRedis[xtools-boot-cache-redis] --> Core CacheRedis[xtools-boot-cache-redis] --> Core
ES[xtools-boot-elasticsearch] --> Extend ES[xtools-boot-elasticsearch] --> Extend
ES --> Core ES --> Core
ES --> Log ES --> Log
MQBase[xtools-boot-mq-base] --> Core MQBase[xtools-boot-mq-base] --> Core
MQBase --> Log MQBase --> Log
MQBase --> Thread MQBase --> Thread
MQRabbit[xtools-boot-mq-rabbit] --> Core MQRabbit[xtools-boot-mq-rabbit] --> Core
MQRabbit --> MQBase MQRabbit --> MQBase
Task[xtools-boot-task] --> Core Task[xtools-boot-task] --> Core
JobXXL[xtools-boot-job-xxl] --> Core JobXXL[xtools-boot-job-xxl] --> Core
Log --> Core Log --> Core
Thread --> Core Thread --> Core
IP[xtools-boot-ip] --> Extend IP[xtools-boot-ip] --> Extend
IP --> Core IP --> Core
Knife4j[xtools-boot-knife4j] --> Core Knife4j[xtools-boot-knife4j] --> Core
Mask[xtools-boot-mask] --> Core Mask[xtools-boot-mask] --> Core
StorageBase[xtools-boot-storage-base] --> Core StorageBase[xtools-boot-storage-base] --> Core
StorageFile[xtools-boot-storage-file] --> Core StorageFile[xtools-boot-storage-file] --> Core
StorageFile --> StorageBase StorageFile --> StorageBase
StorageS3[xtools-boot-storage-s3] --> Extend StorageS3[xtools-boot-storage-s3] --> Extend
StorageS3 --> Core StorageS3 --> Core
StorageS3 --> StorageBase StorageS3 --> StorageBase
WebBase[xtools-boot-web-base] --> WebCore WebBase[xtools-boot-web-base] --> WebCore
WebBase --> Core WebBase --> Core
WebBase --> Log WebBase --> Log
@@ -393,6 +365,7 @@ flowchart TD
``` ```
**自动配置设计** **自动配置设计**
- 每个模块通过 `META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports` 注册自动配置类 - 每个模块通过 `META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports` 注册自动配置类
- 配置类通过 `@Import(XXXImportSelector.class)` 导入自定义选择器 - 配置类通过 `@Import(XXXImportSelector.class)` 导入自定义选择器
- 选择器实现 `ImportBeanDefinitionRegistrar` 接口按包名扫描注册Bean - 选择器实现 `ImportBeanDefinitionRegistrar` 接口按包名扫描注册Bean
@@ -406,7 +379,6 @@ flowchart TD
A[BaseEnum接口] --> B[int code<br/>枚举编码] A[BaseEnum接口] --> B[int code<br/>枚举编码]
A --> C[String desc<br/>枚举描述] A --> C[String desc<br/>枚举描述]
A --> D["BaseEnum[] all()<br/>获取所有枚举"] A --> D["BaseEnum[] all()<br/>获取所有枚举"]
B --> E[StatusEnum<br/>状态枚举] B --> E[StatusEnum<br/>状态枚举]
B --> F[DeleteEnum<br/>删除枚举] B --> F[DeleteEnum<br/>删除枚举]
B --> G[ThreadType<br/>线程类型] B --> G[ThreadType<br/>线程类型]
@@ -418,6 +390,7 @@ flowchart TD
``` ```
**枚举规范** **枚举规范**
- 所有业务枚举实现 `BaseEnum` 接口 - 所有业务枚举实现 `BaseEnum` 接口
- 提供 `code()``desc()` 方法 - 提供 `code()``desc()` 方法
- 提供静态 `valueOf(int code)``valueOfDesc(String desc)` 方法 - 提供静态 `valueOf(int code)``valueOfDesc(String desc)` 方法
@@ -431,12 +404,10 @@ flowchart TD
A --> C[BizWarning<br/>业务警告] A --> C[BizWarning<br/>业务警告]
A --> D[UnauthorizedError<br/>未授权异常] A --> D[UnauthorizedError<br/>未授权异常]
A --> E[BizPublicKeyError<br/>公钥异常] A --> E[BizPublicKeyError<br/>公钥异常]
F[BootError<br/>错误码枚举] --> F1[code<br/>错误编码] F[BootError<br/>错误码枚举] --> F1[code<br/>错误编码]
F --> F2[type<br/>错误类型] F --> F2[type<br/>错误类型]
F --> F3[module<br/>所属模块] F --> F3[module<br/>所属模块]
F --> F4[messageTemplate<br/>消息模板] F --> F4[messageTemplate<br/>消息模板]
G[BootErrorModule<br/>错误模块枚举] --> G1[API<br/>API模块] G[BootErrorModule<br/>错误模块枚举] --> G1[API<br/>API模块]
G --> G2[CORE<br/>核心模块] G --> G2[CORE<br/>核心模块]
G --> G3[LOG<br/>日志模块] G --> G3[LOG<br/>日志模块]
@@ -444,6 +415,7 @@ flowchart TD
``` ```
**异常体系** **异常体系**
- `CommonException`基础异常来自xtools-core - `CommonException`基础异常来自xtools-core
- `BizError`:业务逻辑异常,使用错误码和消息模板 - `BizError`:业务逻辑异常,使用错误码和消息模板
- `BizWarning`:业务警告异常 - `BizWarning`:业务警告异常
@@ -466,7 +438,6 @@ flowchart TD
C --> C6[stackTrace<br/>堆栈信息] C --> C6[stackTrace<br/>堆栈信息]
C --> C7[logData<br/>日志数据] C --> C7[logData<br/>日志数据]
C --> C8[err<br/>异常文本] C --> C8[err<br/>异常文本]
B --> D[LogBusInterface实现类<br/>日志处理器] B --> D[LogBusInterface实现类<br/>日志处理器]
D --> E[写入Elasticsearch] D --> E[写入Elasticsearch]
D --> F[写入数据库] D --> F[写入数据库]
@@ -487,6 +458,7 @@ flowchart LR
``` ```
**日志功能** **日志功能**
- **LogBus**:日志总线,统一的日志创建和管理入口 - **LogBus**:日志总线,统一的日志创建和管理入口
- **LogTrack**链路追踪信息包含traceId、spanId、线程类型等 - **LogTrack**链路追踪信息包含traceId、spanId、线程类型等
- **HolderLogTrack**:线程持有者的链路追踪,支持主子线程传递 - **HolderLogTrack**:线程持有者的链路追踪,支持主子线程传递
@@ -516,6 +488,7 @@ flowchart TD
``` ```
**消息队列功能** **消息队列功能**
- **MqBus**:消息总线,统一的消息发布入口 - **MqBus**:消息总线,统一的消息发布入口
- **BaseMqHandle**:消息处理基类,定义消息处理模板 - **BaseMqHandle**:消息处理基类,定义消息处理模板
- **BaseErrorHandle**:错误处理基类,定义错误处理策略 - **BaseErrorHandle**:错误处理基类,定义错误处理策略
@@ -542,6 +515,7 @@ flowchart TD
``` ```
**任务管理功能** **任务管理功能**
- **TaskBus**任务总线提供Builder模式创建和管理任务 - **TaskBus**任务总线提供Builder模式创建和管理任务
- **TaskInfo**:任务信息,包含任务类型、任务数据、状态等 - **TaskInfo**:任务信息,包含任务类型、任务数据、状态等
- **TaskStatus**任务状态枚举ING、SUCCESS、ERROR - **TaskStatus**任务状态枚举ING、SUCCESS、ERROR
@@ -562,6 +536,7 @@ flowchart TD
``` ```
**任务调度功能** **任务调度功能**
- **BootXxlJobConfiguration**XXL-JOB自动配置 - **BootXxlJobConfiguration**XXL-JOB自动配置
- **InitXxlJob**XXL-JOB初始化自动扫描和注册任务处理器 - **InitXxlJob**XXL-JOB初始化自动扫描和注册任务处理器
- **JobInterface**:任务执行接口,定义任务执行契约 - **JobInterface**:任务执行接口,定义任务执行契约
@@ -574,16 +549,15 @@ flowchart TD
flowchart TD flowchart TD
A[BootThreadConfiguration<br/>线程配置] --> B[虚拟线程支持] A[BootThreadConfiguration<br/>线程配置] --> B[虚拟线程支持]
A --> C[VirtualThreadTaskCallback<br/>虚拟线程任务回调] A --> C[VirtualThreadTaskCallback<br/>虚拟线程任务回调]
B --> D[MQ消息消费使用虚拟线程] B --> D[MQ消息消费使用虚拟线程]
B --> E[异步任务使用虚拟线程] B --> E[异步任务使用虚拟线程]
C --> F[任务执行前回调] C --> F[任务执行前回调]
C --> G[任务执行后回调] C --> G[任务执行后回调]
C --> H[异常处理回调] C --> H[异常处理回调]
``` ```
**线程管理功能** **线程管理功能**
- **BootThreadConfiguration**线程配置注册虚拟线程相关Bean - **BootThreadConfiguration**线程配置注册虚拟线程相关Bean
- **VirtualThreadTaskCallback**:虚拟线程任务回调接口,提供执行前、执行后、异常处理回调 - **VirtualThreadTaskCallback**:虚拟线程任务回调接口,提供执行前、执行后、异常处理回调
- 支持在消息消费和异步任务中使用虚拟线程 - 支持在消息消费和异步任务中使用虚拟线程
@@ -603,6 +577,7 @@ flowchart LR
``` ```
**缓存功能** **缓存功能**
- **BootCacheRedisConfiguration**Redis自动配置 - **BootCacheRedisConfiguration**Redis自动配置
- **RedisUtils**Redis工具类封装常用Redis操作 - **RedisUtils**Redis工具类封装常用Redis操作
- **RedisMonitor**Redis监控提供缓存统计和健康检查 - **RedisMonitor**Redis监控提供缓存统计和健康检查
@@ -631,6 +606,7 @@ flowchart TD
``` ```
**数据库功能** **数据库功能**
- **MyBatisConfig**MyBatis核心配置 - **MyBatisConfig**MyBatis核心配置
- **MybatisPlusConfig**MyBatis-Plus配置注册分页插件 - **MybatisPlusConfig**MyBatis-Plus配置注册分页插件
- **QueryUtils**:查询工具类,提供时间范围过滤等通用查询方法 - **QueryUtils**:查询工具类,提供时间范围过滤等通用查询方法
@@ -645,15 +621,12 @@ flowchart TD
flowchart TD flowchart TD
A[业务代码] --> B[EsUtils<br/>ES HTTP工具] A[业务代码] --> B[EsUtils<br/>ES HTTP工具]
A --> C[EsQueryUtils<br/>ES查询工具] A --> C[EsQueryUtils<br/>ES查询工具]
B --> D[索引操作] B --> D[索引操作]
B --> E[文档操作] B --> E[文档操作]
B --> F[集群操作] B --> F[集群操作]
C --> G[构建查询] C --> G[构建查询]
C --> H[聚合查询] C --> H[聚合查询]
C --> I[分页查询] C --> I[分页查询]
J[ElasticsearchMonitor<br/>ES监控] --> K[集群健康] J[ElasticsearchMonitor<br/>ES监控] --> K[集群健康]
J --> L[索引状态] J --> L[索引状态]
J --> M[节点信息] J --> M[节点信息]
@@ -661,6 +634,7 @@ flowchart TD
``` ```
**搜索引擎功能** **搜索引擎功能**
- **BootElasticsearchConfiguration**ES自动配置 - **BootElasticsearchConfiguration**ES自动配置
- **EsUtils**Elasticsearch HTTP客户端工具提供索引、文档、集群操作 - **EsUtils**Elasticsearch HTTP客户端工具提供索引、文档、集群操作
- **EsQueryUtils**ES查询工具提供通用查询构建 - **EsQueryUtils**ES查询工具提供通用查询构建
@@ -680,7 +654,6 @@ flowchart TD
B --> B6[PASSWORD<br/>密码] B --> B6[PASSWORD<br/>密码]
B --> B7[ADDRESS<br/>地址] B --> B7[ADDRESS<br/>地址]
B --> B8[CUSTOM<br/>自定义] B --> B8[CUSTOM<br/>自定义]
A --> C["配置参数<br/>prefixNoMaskLen<br/>suffixNoMaskLen<br/>maskChar"] A --> C["配置参数<br/>prefixNoMaskLen<br/>suffixNoMaskLen<br/>maskChar"]
C --> D[DefaultMaskHandle<br/>默认脱敏处理] C --> D[DefaultMaskHandle<br/>默认脱敏处理]
D --> E[MaskCustom<br/>自定义脱敏接口] D --> E[MaskCustom<br/>自定义脱敏接口]
@@ -688,6 +661,7 @@ flowchart TD
``` ```
**数据脱敏功能** **数据脱敏功能**
- **BootMaskConfiguration**:脱敏模块自动配置 - **BootMaskConfiguration**:脱敏模块自动配置
- **MaskType**脱敏类型枚举支持8种内置类型 - **MaskType**脱敏类型枚举支持8种内置类型
- **DefaultMaskHandle**:默认脱敏处理器,根据类型自动脱敏 - **DefaultMaskHandle**:默认脱敏处理器,根据类型自动脱敏
@@ -703,13 +677,10 @@ flowchart TD
A --> A2[save<br/>保存文件] A --> A2[save<br/>保存文件]
A --> A3[get<br/>获取文件] A --> A3[get<br/>获取文件]
A --> A4[del<br/>删除文件] A --> A4[del<br/>删除文件]
B[StorageServiceFileImpl<br/>文件存储实现] --> C[本地文件系统] B[StorageServiceFileImpl<br/>文件存储实现] --> C[本地文件系统]
D[BootStorageS3Configuration<br/>S3存储配置] --> E[AWS S3] D[BootStorageS3Configuration<br/>S3存储配置] --> E[AWS S3]
F["@ConditionalOnProperty<br/>storage.type=file"] --> B F["@ConditionalOnProperty<br/>storage.type=file"] --> B
G["@ConditionalOnProperty<br/>storage.type=s3"] --> D G["@ConditionalOnProperty<br/>storage.type=s3"] --> D
A2 --> A2a[bucket<br/>桶名称] A2 --> A2a[bucket<br/>桶名称]
A2 --> A2b[fileName<br/>文件名] A2 --> A2b[fileName<br/>文件名]
A2 --> A2c[inputStream<br/>输入流] A2 --> A2c[inputStream<br/>输入流]
@@ -717,6 +688,7 @@ flowchart TD
``` ```
**存储功能** **存储功能**
- **StorageService**统一存储接口定义exists、save、get、del操作 - **StorageService**统一存储接口定义exists、save、get、del操作
- **BootStorageBaseConfiguration**:存储基础配置 - **BootStorageBaseConfiguration**:存储基础配置
- **StorageServiceFileImpl**:本地文件系统存储实现 - **StorageServiceFileImpl**:本地文件系统存储实现
@@ -730,15 +702,12 @@ flowchart TD
flowchart TD flowchart TD
A[xtools-boot-web] --> B[xtools-boot-web-base] A[xtools-boot-web] --> B[xtools-boot-web-base]
A --> C[xtools-boot-web-filter] A --> C[xtools-boot-web-filter]
B --> B1[BootWebBaseConfiguration<br/>Web基础配置] B --> B1[BootWebBaseConfiguration<br/>Web基础配置]
B --> B2[CommonFilter<br/>通用过滤器] B --> B2[CommonFilter<br/>通用过滤器]
B --> B3[MvcConverterConfig<br/>MVC转换器配置] B --> B3[MvcConverterConfig<br/>MVC转换器配置]
B --> B4[LogTrackConfig<br/>日志链路配置] B --> B4[LogTrackConfig<br/>日志链路配置]
C --> C1[BootWebFilterConfiguration<br/>过滤器配置] C --> C1[BootWebFilterConfiguration<br/>过滤器配置]
C --> C2[BootWebFilterImportSelector<br/>过滤器导入选择器] C --> C2[BootWebFilterImportSelector<br/>过滤器导入选择器]
B4 --> D[生成LogTrack] B4 --> D[生成LogTrack]
D --> E[绑定到ThreadLocal] D --> E[绑定到ThreadLocal]
E --> F[请求处理] E --> F[请求处理]
@@ -746,6 +715,7 @@ flowchart TD
``` ```
**Web模块功能** **Web模块功能**
- **BootWebBaseConfiguration**Web基础配置集成xtools-web - **BootWebBaseConfiguration**Web基础配置集成xtools-web
- **CommonFilter**:通用请求过滤器,处理请求上下文 - **CommonFilter**:通用请求过滤器,处理请求上下文
- **MvcConverterConfig**MVC转换器配置 - **MvcConverterConfig**MVC转换器配置
@@ -773,42 +743,42 @@ flowchart TD
**类命名** **类命名**
| 类型 | 命名规则 | 示例 | | 类型 | 命名规则 | 示例 |
|------|----------|------| |-------|-------------------------------------|---------------------------------------|
| 配置类 | Boot{Module}Configuration | BootCoreConfiguration | | 配置类 | Boot{Module}Configuration | BootCoreConfiguration |
| 导入选择器 | Boot{Module}ImportSelector | BootCoreImportSelector | | 导入选择器 | Boot{Module}ImportSelector | BootCoreImportSelector |
| 工具类 | {功能}Utils | SpringContextUtils | | 工具类 | {功能}Utils | SpringContextUtils |
| 监控类 | {组件}Monitor | MySqlMonitor | | 监控类 | {组件}Monitor | MySqlMonitor |
| 枚举类 | {功能}Enum / {功能}Enums | StatusEnum、MySqlMonitorEnums | | 枚举类 | {功能}Enum / {功能}Enums | StatusEnum、MySqlMonitorEnums |
| 异常类 | Biz{类型}Error | BizError、BizWarning | | 异常类 | Biz{类型}Error | BizError、BizWarning |
| 接口 | Base{类型} / {功能}Interface / {功能}Type | BaseEnum、LogBusInterface、BaseTaskType | | 接口 | Base{类型} / {功能}Interface / {功能}Type | BaseEnum、LogBusInterface、BaseTaskType |
| DTO类 | {功能}Dto / {功能}Info / {功能}Body | MessageDto、TaskInfo、LogBody | | DTO类 | {功能}Dto / {功能}Info / {功能}Body | MessageDto、TaskInfo、LogBody |
| 回调类 | {功能}Callback | VirtualThreadTaskCallback | | 回调类 | {功能}Callback | VirtualThreadTaskCallback |
| 初始化类 | Init{功能} | InitMq、InitXxlJob | | 初始化类 | Init{功能} | InitMq、InitXxlJob |
| 处理器 | {功能}Handle / Default{功能}Handle | BaseMqHandle、DefaultMaskHandle | | 处理器 | {功能}Handle / Default{功能}Handle | BaseMqHandle、DefaultMaskHandle |
**方法命名** **方法命名**
| 操作 | 命名规则 | 示例 | | 操作 | 命名规则 | 示例 |
|------|----------|------| |-----|-------------------------|----------------------------|
| 查询 | get / find / query | getBean、findById、queryList | | 查询 | get / find / query | getBean、findById、queryList |
| 创建 | create / save / publish | createLog、save、publish | | 创建 | create / save / publish | createLog、save、publish |
| 删除 | delete / del / remove | deleteById、del | | 删除 | delete / del / remove | deleteById、del |
| 判断 | is / has / exists | exists、isValid | | 判断 | is / has / exists | exists、isValid |
| 转换 | to / convert / of | valueOf、convert | | 转换 | to / convert / of | valueOf、convert |
| 初始化 | init | init | | 初始化 | init | init |
| 加载 | load | loadSuccess | | 加载 | load | loadSuccess |
| 执行 | execute / run | execute | | 执行 | execute / run | execute |
**变量命名** **变量命名**
| 类型 | 命名规则 | 示例 | | 类型 | 命名规则 | 示例 |
|------|----------|------| |---------|------------------|--------------------------|
| 普通变量 | camelCase | logTrack、taskInfo | | 普通变量 | camelCase | logTrack、taskInfo |
| 常量 | UPPER_SNAKE_CASE | CP_NUM0、CP_NUM50 | | 常量 | UPPER_SNAKE_CASE | CP_NUM0、CP_NUM50 |
| Boolean | is/has前缀 | isValid、hasChildren | | Boolean | is/has前缀 | isValid、hasChildren |
| 集合 | 复数形式 | items、list | | 集合 | 复数形式 | items、list |
| 配置属性 | camelCase | prefixNoMaskLen、maskChar | | 配置属性 | camelCase | prefixNoMaskLen、maskChar |
### 4.2 注释规范 ### 4.2 注释规范
@@ -880,131 +850,131 @@ private String fieldName;
### 5.1 核心框架依赖 ### 5.1 核心框架依赖
| 依赖 | 版本 | 用途 | | 依赖 | 版本 | 用途 |
|------|------|------| |---------------------------|----------|-----------------|
| Spring Boot | 4.0.5 | 应用框架 | | Spring Boot | 4.0.5 | 应用框架 |
| Spring Framework | 7.0.6 | 核心框架 | | Spring Framework | 7.0.6 | 核心框架 |
| Spring Security | 7.0.4 | 安全框架 | | Spring Security | 7.0.4 | 安全框架 |
| Spring AMQP | 4.0.2 | RabbitMQ集成 | | Spring AMQP | 4.0.2 | RabbitMQ集成 |
| Spring Data BOM | 2025.1.4 | Spring Data版本管理 | | Spring Data BOM | 2025.1.4 | Spring Data版本管理 |
| Spring Data Redis | 4.0.4 | Redis集成 | | Spring Data Redis | 4.0.4 | Redis集成 |
| Spring Data Elasticsearch | 6.0.4 | Elasticsearch集成 | | Spring Data Elasticsearch | 6.0.4 | Elasticsearch集成 |
| Jakarta Servlet | 6.1.0 | Servlet API | | Jakarta Servlet | 6.1.0 | Servlet API |
| Jakarta Validation | 3.1.1 | 参数校验 | | Jakarta Validation | 3.1.1 | 参数校验 |
### 5.2 数据库相关依赖 ### 5.2 数据库相关依赖
| 依赖 | 版本 | 用途 | | 依赖 | 版本 | 用途 |
|------|------|------| |-----------------------------|--------|-----------|
| MyBatis Spring Boot Starter | 4.0.1 | MyBatis集成 | | MyBatis Spring Boot Starter | 4.0.1 | MyBatis集成 |
| MyBatis-Plus | 3.5.16 | ORM增强工具 | | MyBatis-Plus | 3.5.16 | ORM增强工具 |
| Druid | 1.2.28 | 数据库连接池 | | Druid | 1.2.28 | 数据库连接池 |
### 5.3 搜索引擎依赖 ### 5.3 搜索引擎依赖
| 依赖 | 版本 | 用途 | | 依赖 | 版本 | 用途 |
|------|------|------| |----------------------|-------|------------|
| Elasticsearch Client | 9.2.6 | ES Java客户端 | | Elasticsearch Client | 9.2.6 | ES Java客户端 |
### 5.4 消息队列依赖 ### 5.4 消息队列依赖
| 依赖 | 版本 | 用途 | | 依赖 | 版本 | 用途 |
|------|------|------| |----------------------|--------|------------------|
| RabbitMQ AMQP Client | 5.27.1 | RabbitMQ Java客户端 | | RabbitMQ AMQP Client | 5.27.1 | RabbitMQ Java客户端 |
### 5.5 缓存依赖 ### 5.5 缓存依赖
| 依赖 | 版本 | 用途 | | 依赖 | 版本 | 用途 |
|------|------|------| |----------|---------------|----------|
| Lettuce | 6.8.2.RELEASE | Redis客户端 | | Lettuce | 6.8.2.RELEASE | Redis客户端 |
| Caffeine | 3.2.3 | 本地缓存 | | Caffeine | 3.2.3 | 本地缓存 |
### 5.6 工具库依赖 ### 5.6 工具库依赖
| 依赖 | 版本 | 用途 | | 依赖 | 版本 | 用途 |
|------|------|------| |----------------|----------|--------|
| Lombok | 1.18.44 | 代码简化 | | Lombok | 1.18.44 | 代码简化 |
| MapStruct | 1.6.3 | 对象映射 | | MapStruct | 1.6.3 | 对象映射 |
| FastJSON2 | 2.0.60 | JSON处理 | | FastJSON2 | 2.0.60 | JSON处理 |
| Velocity | 2.4.1 | 模板引擎 | | Velocity | 2.4.1 | 模板引擎 |
| Jackson BOM | 3.1.0 | JSON处理 | | Jackson BOM | 3.1.0 | JSON处理 |
| Commons Lang3 | 3.20.0 | 通用工具 | | Commons Lang3 | 3.20.0 | 通用工具 |
| Commons IO | 2.21.0 | IO工具 | | Commons IO | 2.21.0 | IO工具 |
| Commons Text | 1.15.0 | 文本处理 | | Commons Text | 1.15.0 | 文本处理 |
| AspectJ Weaver | 1.9.25.1 | AOP支持 | | AspectJ Weaver | 1.9.25.1 | AOP支持 |
### 5.7 安全相关依赖 ### 5.7 安全相关依赖
| 依赖 | 版本 | 用途 | | 依赖 | 版本 | 用途 |
|------|------|------| |--------------|-------|-------|
| BouncyCastle | 1.84 | 加密库 | | BouncyCastle | 1.84 | 加密库 |
| Easy Captcha | 1.6.2 | 验证码 | | Easy Captcha | 1.6.2 | 验证码 |
| java-jwt | 4.5.1 | JWT令牌 | | java-jwt | 4.5.1 | JWT令牌 |
### 5.8 文档相关依赖 ### 5.8 文档相关依赖
| 依赖 | 版本 | 用途 | | 依赖 | 版本 | 用途 |
|------|------|------| |---------------------|--------|-------------|
| Knife4j OpenAPI3 | 4.5.0 | API文档增强 | | Knife4j OpenAPI3 | 4.5.0 | API文档增强 |
| Springdoc OpenAPI | 3.0.3 | OpenAPI 3集成 | | Springdoc OpenAPI | 3.0.3 | OpenAPI 3集成 |
| Swagger Annotations | 2.2.48 | API文档注解 | | Swagger Annotations | 2.2.48 | API文档注解 |
### 5.9 任务调度依赖 ### 5.9 任务调度依赖
| 依赖 | 版本 | 用途 | | 依赖 | 版本 | 用途 |
|------|------|------| |--------------|-------|---------|
| XXL-JOB Core | 3.4.0 | 分布式任务调度 | | XXL-JOB Core | 3.4.0 | 分布式任务调度 |
### 5.10 系统监控依赖 ### 5.10 系统监控依赖
| 依赖 | 版本 | 用途 | | 依赖 | 版本 | 用途 |
|------|------|------| |-----------|--------|--------|
| OSHI Core | 6.11.1 | 系统监控 | | OSHI Core | 6.11.1 | 系统监控 |
| ip2region | 3.3.7 | IP地址定位 | | ip2region | 3.3.7 | IP地址定位 |
### 5.11 存储依赖 ### 5.11 存储依赖
| 依赖 | 版本 | 用途 | | 依赖 | 版本 | 用途 |
|------|------|------| |------------|---------|--------|
| AWS S3 SDK | 2.42.34 | S3对象存储 | | AWS S3 SDK | 2.42.34 | S3对象存储 |
### 5.12 办公工具依赖 ### 5.12 办公工具依赖
| 依赖 | 版本 | 用途 | | 依赖 | 版本 | 用途 |
|------|------|------| |-------------|------------------|---------|
| Fesod Sheet | 2.0.1-incubating | Excel处理 | | Fesod Sheet | 2.0.1-incubating | Excel处理 |
| PDFBox | 3.0.7 | PDF处理 | | PDFBox | 3.0.7 | PDF处理 |
### 5.13 其他工具依赖 ### 5.13 其他工具依赖
| 依赖 | 版本 | 用途 | | 依赖 | 版本 | 用途 |
|------|------|------| |---------------------|--------------|---------|
| UserAgentUtils | 1.21 | 浏览器标识解析 | | UserAgentUtils | 1.21 | 浏览器标识解析 |
| Pinyin4j | 2.5.1 | 拼音转换 | | Pinyin4j | 2.5.1 | 拼音转换 |
| Thumbnailator | 0.4.21 | 图片压缩 | | Thumbnailator | 0.4.21 | 图片压缩 |
| mmseg4j-core | 1.10.0 | 中文分词 | | mmseg4j-core | 1.10.0 | 中文分词 |
| ZXing | 3.5.4 | 二维码/条形码 | | ZXing | 3.5.4 | 二维码/条形码 |
| Jsoup | 1.22.1 | HTML解析 | | Jsoup | 1.22.1 | HTML解析 |
| Hibernate Validator | 9.0.1.Final | 参数校验 | | Hibernate Validator | 9.0.1.Final | 参数校验 |
| Netty | 4.2.12.Final | 网络通信 | | Netty | 4.2.12.Final | 网络通信 |
### 5.14 测试依赖 ### 5.14 测试依赖
| 依赖 | 版本 | 用途 | | 依赖 | 版本 | 用途 |
|------|------|------| |---------------|-------|------|
| JUnit Jupiter | 6.0.3 | 单元测试 | | JUnit Jupiter | 6.0.3 | 单元测试 |
### 5.15 xtools内部框架依赖 ### 5.15 xtools内部框架依赖
| 模块 | 版本 | 用途 | | 模块 | 版本 | 用途 |
|------|------|------| |---------------------|-------|----------|
| xtools-core | 5.0.0 | 核心工具库 | | xtools-core | 5.0.0 | 核心工具库 |
| xtools-web | 5.0.0 | Web工具库 | | xtools-web | 5.0.0 | Web工具库 |
| xtools-extend | 5.0.0 | 扩展工具库 | | xtools-extend | 5.0.0 | 扩展工具库 |
| xtools-api | 5.0.0 | API定义库 | | xtools-api | 5.0.0 | API定义库 |
| xtools-parent-boot | 5.0.0 | Boot父POM | | xtools-parent-boot | 5.0.0 | Boot父POM |
| xtools-parent | 5.0.0 | 基础父POM | | xtools-parent | 5.0.0 | 基础父POM |
| xtools-dependencies | 5.0.0 | 依赖管理POM | | xtools-dependencies | 5.0.0 | 依赖管理POM |
## 六、技术选型说明 ## 六、技术选型说明
@@ -1087,20 +1057,20 @@ private String fieldName;
### 6.8 其他重要依赖版本 ### 6.8 其他重要依赖版本
| 依赖 | 版本 | 用途 | | 依赖 | 版本 | 用途 |
|------|------|------| |--------------|---------|------------|
| FastJSON2 | 2.0.60 | 高性能JSON序列化 | | FastJSON2 | 2.0.60 | 高性能JSON序列化 |
| Lombok | 1.18.44 | 代码简化 | | Lombok | 1.18.44 | 代码简化 |
| MapStruct | 1.6.3 | 编译期对象映射 | | MapStruct | 1.6.3 | 编译期对象映射 |
| Velocity | 2.4.1 | 模板引擎(代码生成) | | Velocity | 2.4.1 | 模板引擎(代码生成) |
| Knife4j | 4.5.0 | API文档增强 | | Knife4j | 4.5.0 | API文档增强 |
| BouncyCastle | 1.84 | 国密算法支持 | | BouncyCastle | 1.84 | 国密算法支持 |
| OSHI | 6.11.1 | 系统信息采集 | | OSHI | 6.11.1 | 系统信息采集 |
| ip2region | 3.3.7 | 离线IP定位 | | ip2region | 3.3.7 | 离线IP定位 |
| Druid | 1.2.28 | 数据库连接池监控 | | Druid | 1.2.28 | 数据库连接池监控 |
| AWS S3 SDK | 2.42.34 | S3对象存储 | | AWS S3 SDK | 2.42.34 | S3对象存储 |
| Caffeine | 3.2.3 | 高性能本地缓存 | | Caffeine | 3.2.3 | 高性能本地缓存 |
| Jackson | 3.1.0 | JSON处理 | | Jackson | 3.1.0 | JSON处理 |
--- ---