merge: 合并 upgrade/springboot-4.0 到 develop
- 解决 pom.xml 冲突 (空行) - 解决 TokenService.java 冲突 (保留 getSigningKey() 方案) - 包含: JDK 25 + Spring Boot 4.0 特性落地
This commit is contained in:
193
openhis-server-new/SPRINGBOOT_4_UPGRADE_ANALYSIS.md
Normal file
193
openhis-server-new/SPRINGBOOT_4_UPGRADE_ANALYSIS.md
Normal file
@@ -0,0 +1,193 @@
|
||||
# Spring Boot 4.0 升级分析报告
|
||||
|
||||
> 📅 分析日期: 2026-06-04
|
||||
> 📌 当前版本: Spring Boot 3.5.14
|
||||
> 🎯 目标版本: Spring Boot 4.0.6 (最新稳定版)
|
||||
> ⚠️ 风险等级: 🔴 高 (存在关键组件不兼容)
|
||||
|
||||
---
|
||||
|
||||
## 1. 版本对比总览
|
||||
|
||||
| 组件 | 当前 (SB 3.5.14) | 目标 (SB 4.0.6) | 变化 |
|
||||
|---|---|---|---|
|
||||
| **Spring Boot** | 3.5.14 | **4.0.6** | 大版本跳跃 |
|
||||
| **Spring Framework** | 6.2.18 | **7.0.7** | 大版本跳跃 |
|
||||
| **Spring Security** | 6.5.10 | **7.0.5** | 大版本跳跃 |
|
||||
| **Java** | 17+ | **17+** | 不变 |
|
||||
| **Tomcat** | 10.1.54 | **11.0.21** | 大版本跳跃 |
|
||||
| **Hibernate** | 6.6.x | **7.2.12** | 大版本跳跃 |
|
||||
| **Flyway** | 11.7.2 | **11.14.1** | 小版本升级 |
|
||||
| **Kotlin** | 2.0.x | **2.2.21** | 小版本升级 |
|
||||
| **Jackson 2** | 2.21.2 | **2.21.2** | 不变 |
|
||||
| **Jackson 3** | ❌ 无 | **3.1.2** | 🆕 新增 |
|
||||
| **Quartz** | 2.5.2 | **2.5.2** | 不变 |
|
||||
| **PostgreSQL** | 42.7.4 | **42.7.10** | 补丁升级 |
|
||||
|
||||
---
|
||||
|
||||
## 2. 🔴 关键阻塞项 (必须解决才能升级)
|
||||
|
||||
### 2.1 MyBatis Plus — 没有 Spring Boot 4 Starter
|
||||
|
||||
| 项目 | 状态 |
|
||||
|---|---|
|
||||
| `mybatis-plus-spring-boot4-starter` | ❌ **不存在** |
|
||||
| `mybatis-plus-spring-boot3-starter` 最新版 | 3.5.16 (仅支持 SB 3.x) |
|
||||
| `mybatis-plus-boot-starter` 最新版 | 3.5.7 (SB 2.x) |
|
||||
|
||||
**影响**: MyBatis Plus 是项目核心 ORM,没有 Boot 4 Starter 意味着:
|
||||
- 自动配置可能不兼容 Spring Framework 7.x
|
||||
- Bean 注册方式可能变化
|
||||
- 需要手动配置或等待官方适配
|
||||
|
||||
**可能方案**:
|
||||
1. ⏳ **等待官方发布** — MyBatis Plus 通常在 Spring Boot 大版本发布后 3-6 个月适配
|
||||
2. 🔧 **手动适配** — 基于 `mybatis-plus-spring-boot3-starter` 修改自动配置类
|
||||
3. 🔄 **降级使用** — 使用 `mybatis-plus-core` + 手动配置(工作量大)
|
||||
|
||||
### 2.2 Druid — 没有 Spring Boot 4 Starter
|
||||
|
||||
| 项目 | 状态 |
|
||||
|---|---|
|
||||
| `druid-spring-boot4-starter` | ❌ **不存在** |
|
||||
| `druid-spring-boot-3-starter` 最新版 | 1.2.25 |
|
||||
| Druid 核心版 | 1.2.25 |
|
||||
|
||||
**影响**: Druid 数据源自动配置和监控功能可能不兼容。
|
||||
|
||||
**可能方案**:
|
||||
1. 🔧 **手动配置 DruidDataSource** — 绕过 Spring Boot 自动配置
|
||||
2. 🔄 **替换为 HikariCP** — Spring Boot 4 默认连接池(已内置)
|
||||
|
||||
### 2.3 Flowable — 需要验证
|
||||
|
||||
| 项目 | 状态 |
|
||||
|---|---|
|
||||
| `flowable-engine` 最新版 | **8.0.0** |
|
||||
| 当前使用 | 7.1.0 |
|
||||
| Spring Framework 7 兼容性 | ⚠️ 未确认 |
|
||||
|
||||
**影响**: Flowable 8.0.0 可能适配了 Spring Framework 7,但需要验证。
|
||||
|
||||
---
|
||||
|
||||
## 3. 🟡 中等风险项
|
||||
|
||||
### 3.1 Jackson 3 引入
|
||||
|
||||
Spring Boot 4 同时支持 Jackson 2 和 Jackson 3,但:
|
||||
- 项目使用 `fastjson2` 作为 JSON 库
|
||||
- Jackson 3 可能与 fastjson2 的 Kotlin 扩展产生新的冲突
|
||||
- 需要验证 `springdoc-openapi` 对 Jackson 3 的支持
|
||||
|
||||
### 3.2 Tomcat 11.x
|
||||
|
||||
- Tomcat 11 基于 Servlet 6.1 (Jakarta EE 11)
|
||||
- 项目已迁移到 `jakarta.servlet`,理论上兼容
|
||||
- 需要验证自定义 Filter/Servlet 的兼容性
|
||||
|
||||
### 3.3 Spring Security 7.0
|
||||
|
||||
- 可能有 API 变更(已在 3.5 中适配了大部分)
|
||||
- 需要检查 `@EnableMethodSecurity` 等注解是否有变化
|
||||
|
||||
### 3.4 Hibernate 7.2
|
||||
|
||||
- 项目使用 JPA 相关功能较少(主要是 MyBatis Plus)
|
||||
- 风险较低
|
||||
|
||||
---
|
||||
|
||||
## 4. 🟢 低风险项
|
||||
|
||||
| 组件 | 当前 | SB 4 管理 | 备注 |
|
||||
|---|---|---|---|
|
||||
| Springdoc | 2.8.6 | 不管理 | 需要单独验证兼容性 |
|
||||
| LiteFlow | 2.12.4.1 | 不管理 | 需要验证 Spring Framework 7 兼容性 |
|
||||
| pagehelper | 2.1.1 | 不管理 | 需要验证 |
|
||||
| Lombok | 1.18.34 | 不管理 | 低风险 |
|
||||
| PostgreSQL Driver | 42.7.4 | 42.7.10 | 安全升级 |
|
||||
|
||||
---
|
||||
|
||||
## 5. 升级路径建议
|
||||
|
||||
### 方案 A: 等待生态成熟 (推荐 ⭐)
|
||||
|
||||
**时间线**: 2026 Q4 - 2027 Q1
|
||||
|
||||
| 阶段 | 时间 | 动作 |
|
||||
|---|---|---|
|
||||
| 等待 | 现在 ~ 2026 Q3 | 监控 MyBatis Plus / Druid / Flowable 的 Boot 4 适配进度 |
|
||||
| 评估 | 2026 Q3 | 确认关键组件适配状态 |
|
||||
| 升级 | 2026 Q4 | 执行升级 |
|
||||
| 测试 | 2026 Q4 ~ 2027 Q1 | 全面回归测试 |
|
||||
|
||||
**优点**: 风险最低,依赖组件有官方支持
|
||||
**缺点**: 滞后于 Spring Boot 4 的新特性
|
||||
|
||||
### 方案 B: 激进升级 (不推荐)
|
||||
|
||||
**时间线**: 立即
|
||||
|
||||
| 阶段 | 时间 | 动作 |
|
||||
|---|---|---|
|
||||
| 准备 | 1-2 周 | fork MyBatis Plus / Druid 源码,手动适配 Boot 4 |
|
||||
| 升级 | 1 周 | 修改 POM + 代码适配 |
|
||||
| 测试 | 2-4 周 | 全面回归测试 |
|
||||
| 维护 | 持续 | 手动维护 fork 版本 |
|
||||
|
||||
**优点**: 最早享受 Spring Boot 4 新特性
|
||||
**缺点**: 维护成本极高,上游变更需要手动同步
|
||||
|
||||
### 方案 C: 渐进升级 (折中方案)
|
||||
|
||||
**时间线**: 2026 Q3
|
||||
|
||||
1. **Phase 1**: 先升级到 Spring Boot 3.5.16 (最新 3.x)
|
||||
2. **Phase 2**: 等待 MyBatis Plus 发布 Boot 4 Starter
|
||||
3. **Phase 3**: 升级到 Spring Boot 4.0.x
|
||||
|
||||
**优点**: 风险适中,保持在 3.x 的最新状态
|
||||
**缺点**: 需要两次升级
|
||||
|
||||
---
|
||||
|
||||
## 6. 升级收益
|
||||
|
||||
如果成功升级到 Spring Boot 4.0.6,可以获得:
|
||||
|
||||
| 收益 | 详情 |
|
||||
|---|---|
|
||||
| **Spring Framework 7** | 虚拟线程更好的支持、HTTP 接口增强 |
|
||||
| **Tomcat 11** | 性能提升、Servlet 6.1 支持 |
|
||||
| **Hibernate 7.2** | 更好的性能和稳定性 |
|
||||
| **Flyway 11.14** | 更多数据库支持、性能优化 |
|
||||
| **安全更新** | 最新的安全补丁 |
|
||||
| **长期支持** | Spring Boot 4.x 将是未来 3 年的主线版本 |
|
||||
| **Jackson 3** | 新的 JSON 处理能力(但需要迁移) |
|
||||
| **虚拟线程** | 更好的并发性能(Java 21+) |
|
||||
|
||||
---
|
||||
|
||||
## 7. 结论与建议
|
||||
|
||||
### 当前状态
|
||||
- ✅ Spring Boot 3.5.14 升级已完成并验证通过
|
||||
- ⚠️ Spring Boot 4.0 升级存在 **2 个关键阻塞项** (MyBatis Plus, Druid)
|
||||
|
||||
### 建议
|
||||
1. **短期 (1-3个月)**: 保持在 Spring Boot 3.5.14,监控依赖组件适配进度
|
||||
2. **中期 (3-6个月)**: 当 MyBatis Plus 和 Druid 发布 Boot 4 Starter 时,立即评估升级
|
||||
3. **长期 (6-12个月)**: 执行 Spring Boot 4.0 升级
|
||||
|
||||
### 关键监控项
|
||||
- [ ] [MyBatis Plus GitHub](https://github.com/baomidou/mybatis-plus) — 关注 `mybatis-plus-spring-boot4-starter` 发布
|
||||
- [ ] [Druid GitHub](https://github.com/alibaba/druid) — 关注 `druid-spring-boot4-starter` 发布
|
||||
- [ ] [Flowable GitHub](https://github.com/flowable/flowable-engine) — 关注 8.x 对 Spring Framework 7 的兼容性
|
||||
- [ ] [Springdoc GitHub](https://github.com/springdoc/springdoc-openapi) — 关注对 Jackson 3 的支持
|
||||
|
||||
---
|
||||
|
||||
*报告生成时间: 2026-06-04 22:30*
|
||||
221
openhis-server-new/SPRINGBOOT_4_UPGRADE_GUIDE.md
Normal file
221
openhis-server-new/SPRINGBOOT_4_UPGRADE_GUIDE.md
Normal file
@@ -0,0 +1,221 @@
|
||||
# Spring Boot 3.5.14 → 4.0.6 升级操作手册
|
||||
|
||||
> 📅 基于实际编译验证,2026-06-04
|
||||
> ⏱️ 预估工时:2-3 天(不含回归测试)
|
||||
|
||||
---
|
||||
|
||||
## 一、必须修改的文件清单
|
||||
|
||||
### Phase 1: POM 版本升级
|
||||
|
||||
#### 1.1 父 POM (`pom.xml`)
|
||||
|
||||
```xml
|
||||
<!-- 修改前 -->
|
||||
<parent>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.5.14</version>
|
||||
</parent>
|
||||
|
||||
<!-- 修改后 -->
|
||||
<parent>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>4.0.6</version>
|
||||
</parent>
|
||||
```
|
||||
|
||||
同时需要在 `<properties>` 中确认:
|
||||
|
||||
```xml
|
||||
<!-- Spring Boot 4.0.6 管理的版本 -->
|
||||
<postgresql.version>42.7.10</postgresql.version> <!-- 原 42.7.4 -->
|
||||
```
|
||||
|
||||
#### 1.2 `core-framework/pom.xml` — Starter 改名
|
||||
|
||||
```xml
|
||||
<!-- 修改前 -->
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
|
||||
<!-- 修改后 -->
|
||||
<artifactId>spring-boot-starter-aspectj</artifactId>
|
||||
```
|
||||
|
||||
**原因**: SB4 将 `spring-boot-starter-aop` 重命名为 `spring-boot-starter-aspectj`
|
||||
|
||||
#### 1.3 所有使用 `mybatis-plus-spring-boot3-starter` 的 POM(7个模块)
|
||||
|
||||
保持 `mybatis-plus-spring-boot3-starter:3.5.16` 不变,但需要添加 `spring-boot-jackson2` 依赖:
|
||||
|
||||
```xml
|
||||
<!-- 在 core-framework/pom.xml 中添加 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-jackson2</artifactId>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Phase 2: Java 代码修改
|
||||
|
||||
#### 2.1 Jackson 包路径迁移 (1个文件)
|
||||
|
||||
**文件**: `core-framework/src/main/java/com/core/framework/config/ApplicationConfig.java`
|
||||
|
||||
```java
|
||||
// 修改前
|
||||
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
|
||||
|
||||
// 修改后
|
||||
import org.springframework.boot.jackson2.autoconfigure.Jackson2ObjectMapperBuilderCustomizer;
|
||||
```
|
||||
|
||||
**原因**: SB4 将 Jackson 自动配置从 `spring-boot-autoconfigure` 拆分到独立的 `spring-boot-jackson2` 模块
|
||||
|
||||
#### 2.2 Spring Security 7.0 适配 (可能需要)
|
||||
|
||||
检查 `SecurityConfig.java` 中是否有 Spring Security 7.0 的废弃 API:
|
||||
- `requestMatchers()` 可能有新变化
|
||||
- `@EnableMethodSecurity` 可能有参数变化
|
||||
|
||||
#### 2.3 Tomcat 11 适配 (低风险)
|
||||
|
||||
Tomcat 11 基于 Servlet 6.1,与 Jakarta EE 11 对齐。项目已迁移到 `jakarta.servlet`,理论上兼容。
|
||||
|
||||
---
|
||||
|
||||
### Phase 3: 配置文件变更
|
||||
|
||||
#### 3.1 可能的属性重命名
|
||||
|
||||
SB4 可能重命名了一些属性。使用 `spring-boot-properties-migrator` 检测:
|
||||
|
||||
```xml
|
||||
<!-- 在 core-framework/pom.xml 中临时添加 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-properties-migrator</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
启动后控制台会输出所有需要迁移的属性。
|
||||
|
||||
---
|
||||
|
||||
## 二、已知的 Breaking Changes
|
||||
|
||||
### 2.1 Starter 变化
|
||||
|
||||
| SB3 Starter | SB4 状态 | 替代方案 |
|
||||
|---|---|---|
|
||||
| `spring-boot-starter-aop` | ❌ 移除 | `spring-boot-starter-aspectj` |
|
||||
| `spring-boot-starter-undertow` | ❌ 移除 | `spring-boot-starter-tomcat` |
|
||||
| `spring-boot-starter-pulsar-reactive` | ❌ 移除 | 无替代 |
|
||||
|
||||
### 2.2 包路径变化
|
||||
|
||||
| 旧路径 | 新路径 |
|
||||
|---|---|
|
||||
| `o.s.b.autoconfigure.jackson.*` | `o.s.b.jackson2.autoconfigure.*` |
|
||||
|
||||
### 2.3 Spring Framework 7.0
|
||||
|
||||
- 基于 Jakarta EE 11
|
||||
- 虚拟线程更好的支持
|
||||
- HTTP 接口增强
|
||||
- 部分废弃 API 移除
|
||||
|
||||
### 2.4 Spring Security 7.0
|
||||
|
||||
- 部分配置方式变化
|
||||
- OAuth2 相关 API 调整
|
||||
|
||||
---
|
||||
|
||||
## 三、第三方依赖兼容性
|
||||
|
||||
| 依赖 | 当前版本 | SB4 兼容性 | 需要操作 |
|
||||
|---|---|---|---|
|
||||
| **MyBatis Plus** | 3.5.16 (boot3-starter) | ⚠️ 未验证 | 启动测试,可能需要手动适配 |
|
||||
| **Druid** | 1.2.28 (boot3-starter) | ⚠️ 未验证 | 启动测试 |
|
||||
| **Flowable** | 7.1.0 | ⚠️ 需验证 | 可能需要升级到 7.2+ |
|
||||
| **Springdoc** | 2.8.6 | ✅ 应兼容 | 验证 OpenAPI 文档 |
|
||||
| **LiteFlow** | 2.12.4.1 | ⚠️ 需验证 | 验证流程引擎 |
|
||||
| **pagehelper** | 2.1.1 | ⚠️ 需验证 | 验证分页功能 |
|
||||
| **fastjson2** | 2.0.61 | ⚠️ 注意 Jackson 3 冲突 | 排除 kotlin-reflect |
|
||||
|
||||
---
|
||||
|
||||
## 四、推荐执行步骤
|
||||
|
||||
### Step 1: 创建升级分支
|
||||
```bash
|
||||
git checkout -b upgrade/springboot-4.0 develop
|
||||
```
|
||||
|
||||
### Step 2: 修改 POM 文件
|
||||
按 Phase 1 修改所有 POM 文件
|
||||
|
||||
### Step 3: 修改 Java 代码
|
||||
按 Phase 2 修改 Java 文件
|
||||
|
||||
### Step 4: 添加属性迁移器
|
||||
临时添加 `spring-boot-properties-migrator` 依赖
|
||||
|
||||
### Step 5: 编译验证
|
||||
```bash
|
||||
mvn clean compile -DskipTests
|
||||
```
|
||||
|
||||
### Step 6: 修复编译错误
|
||||
根据编译错误逐一修复
|
||||
|
||||
### Step 7: 启动测试
|
||||
```bash
|
||||
java -jar openhis-application/target/openhis-application.jar --spring.profiles.active=dev --server.port=18082
|
||||
```
|
||||
|
||||
### Step 8: 检查控制台输出
|
||||
- 查看属性迁移警告
|
||||
- 检查 Bean 创建错误
|
||||
- 验证数据库连接
|
||||
- 验证 Redis 连接
|
||||
|
||||
### Step 9: 回归测试
|
||||
- Swagger UI / OpenAPI 文档
|
||||
- 登录接口
|
||||
- 核心业务接口
|
||||
- 前端页面
|
||||
|
||||
### Step 10: 清理
|
||||
- 移除 `spring-boot-properties-migrator` 依赖
|
||||
- 提交代码
|
||||
|
||||
---
|
||||
|
||||
## 五、风险评估
|
||||
|
||||
| 风险项 | 概率 | 影响 | 缓解措施 |
|
||||
|---|---|---|---|
|
||||
| MyBatis Plus 不兼容 | 中 | 高 | 手动配置 DataSource + SqlSessionFactory |
|
||||
| Druid 自动配置失败 | 中 | 中 | 手动配置 DruidDataSource |
|
||||
| Flowable 表结构不兼容 | 低 | 高 | 设置 `databaseSchemaUpdate=true` |
|
||||
| Jackson 3 与 fastjson2 冲突 | 低 | 中 | 排除 kotlin-reflect |
|
||||
| Spring Security 7.0 配置变化 | 低 | 中 | 参考官方迁移指南 |
|
||||
|
||||
---
|
||||
|
||||
## 六、回退方案
|
||||
|
||||
如果升级失败,随时可以回退:
|
||||
```bash
|
||||
git checkout develop
|
||||
git branch -D upgrade/springboot-4.0
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
*文档生成时间: 2026-06-04 23:15*
|
||||
@@ -21,10 +21,10 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.11.0</version>
|
||||
<version>${maven-compiler-plugin.version}</version>
|
||||
<configuration>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
<compilerArgs>
|
||||
<arg>-parameters</arg>
|
||||
@@ -35,7 +35,7 @@
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.34</version>
|
||||
<version>${lombok.version}</version>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
|
||||
@@ -30,8 +30,8 @@ public class Convert {
|
||||
if (null == value) {
|
||||
return defaultValue;
|
||||
}
|
||||
if (value instanceof String) {
|
||||
return (String)value;
|
||||
if (value instanceof String t) {
|
||||
return t;
|
||||
}
|
||||
return value.toString();
|
||||
}
|
||||
@@ -61,8 +61,8 @@ public class Convert {
|
||||
if (null == value) {
|
||||
return defaultValue;
|
||||
}
|
||||
if (value instanceof Character) {
|
||||
return (Character)value;
|
||||
if (value instanceof Character t) {
|
||||
return t;
|
||||
}
|
||||
|
||||
final String valueStr = toStr(value, null);
|
||||
@@ -94,8 +94,8 @@ public class Convert {
|
||||
if (value == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
if (value instanceof Byte) {
|
||||
return (Byte)value;
|
||||
if (value instanceof Byte t) {
|
||||
return t;
|
||||
}
|
||||
if (value instanceof Number) {
|
||||
return ((Number)value).byteValue();
|
||||
@@ -136,8 +136,8 @@ public class Convert {
|
||||
if (value == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
if (value instanceof Short) {
|
||||
return (Short)value;
|
||||
if (value instanceof Short t) {
|
||||
return t;
|
||||
}
|
||||
if (value instanceof Number) {
|
||||
return ((Number)value).shortValue();
|
||||
@@ -178,8 +178,8 @@ public class Convert {
|
||||
if (value == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
if (value instanceof Number) {
|
||||
return (Number)value;
|
||||
if (value instanceof Number t) {
|
||||
return t;
|
||||
}
|
||||
final String valueStr = toStr(value, null);
|
||||
if (StringUtils.isEmpty(valueStr)) {
|
||||
@@ -217,8 +217,8 @@ public class Convert {
|
||||
if (value == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
if (value instanceof Integer) {
|
||||
return (Integer)value;
|
||||
if (value instanceof Integer t) {
|
||||
return t;
|
||||
}
|
||||
if (value instanceof Number) {
|
||||
return ((Number)value).intValue();
|
||||
@@ -343,8 +343,8 @@ public class Convert {
|
||||
if (value == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
if (value instanceof Long) {
|
||||
return (Long)value;
|
||||
if (value instanceof Long t) {
|
||||
return t;
|
||||
}
|
||||
if (value instanceof Number) {
|
||||
return ((Number)value).longValue();
|
||||
@@ -386,8 +386,8 @@ public class Convert {
|
||||
if (value == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
if (value instanceof Double) {
|
||||
return (Double)value;
|
||||
if (value instanceof Double t) {
|
||||
return t;
|
||||
}
|
||||
if (value instanceof Number) {
|
||||
return ((Number)value).doubleValue();
|
||||
@@ -429,8 +429,8 @@ public class Convert {
|
||||
if (value == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
if (value instanceof Float) {
|
||||
return (Float)value;
|
||||
if (value instanceof Float t) {
|
||||
return t;
|
||||
}
|
||||
if (value instanceof Number) {
|
||||
return ((Number)value).floatValue();
|
||||
@@ -471,8 +471,8 @@ public class Convert {
|
||||
if (value == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
if (value instanceof Boolean) {
|
||||
return (Boolean)value;
|
||||
if (value instanceof Boolean t) {
|
||||
return t;
|
||||
}
|
||||
String valueStr = toStr(value, null);
|
||||
if (StringUtils.isEmpty(valueStr)) {
|
||||
@@ -560,8 +560,8 @@ public class Convert {
|
||||
if (value == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
if (value instanceof BigInteger) {
|
||||
return (BigInteger)value;
|
||||
if (value instanceof BigInteger t) {
|
||||
return t;
|
||||
}
|
||||
if (value instanceof Long) {
|
||||
return BigInteger.valueOf((Long)value);
|
||||
@@ -602,8 +602,8 @@ public class Convert {
|
||||
if (value == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
if (value instanceof BigDecimal) {
|
||||
return (BigDecimal)value;
|
||||
if (value instanceof BigDecimal t) {
|
||||
return t;
|
||||
}
|
||||
if (value instanceof Long) {
|
||||
return new BigDecimal((Long)value);
|
||||
@@ -673,8 +673,8 @@ public class Convert {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (obj instanceof String) {
|
||||
return (String)obj;
|
||||
if (obj instanceof String t) {
|
||||
return t;
|
||||
} else if (obj instanceof byte[]) {
|
||||
return str((byte[])obj, charset);
|
||||
} else if (obj instanceof Byte[]) {
|
||||
|
||||
@@ -255,8 +255,7 @@ public class NewExcelUtil<T> {
|
||||
if (!pictures.isEmpty()) {
|
||||
for (HSSFShape shape : sheet.getDrawingPatriarch().getChildren()) {
|
||||
HSSFClientAnchor anchor = (HSSFClientAnchor)shape.getAnchor();
|
||||
if (shape instanceof HSSFPicture) {
|
||||
HSSFPicture pic = (HSSFPicture)shape;
|
||||
if (shape instanceof HSSFPicture pic) {
|
||||
int pictureIndex = pic.getPictureIndex() - 1;
|
||||
HSSFPictureData picData = pictures.get(pictureIndex);
|
||||
String picIndex = anchor.getRow1() + "_" + anchor.getCol1();
|
||||
@@ -279,12 +278,10 @@ public class NewExcelUtil<T> {
|
||||
public static Map<String, PictureData> getSheetPictures07(XSSFSheet sheet, XSSFWorkbook workbook) {
|
||||
Map<String, PictureData> sheetIndexPicMap = new HashMap<String, PictureData>();
|
||||
for (POIXMLDocumentPart dr : sheet.getRelations()) {
|
||||
if (dr instanceof XSSFDrawing) {
|
||||
XSSFDrawing drawing = (XSSFDrawing)dr;
|
||||
if (dr instanceof XSSFDrawing drawing) {
|
||||
List<XSSFShape> shapes = drawing.getShapes();
|
||||
for (XSSFShape shape : shapes) {
|
||||
if (shape instanceof XSSFPicture) {
|
||||
XSSFPicture pic = (XSSFPicture)shape;
|
||||
if (shape instanceof XSSFPicture pic) {
|
||||
XSSFClientAnchor anchor = pic.getPreferredSize();
|
||||
CTMarker ctMarker = anchor.getFrom();
|
||||
String picIndex = ctMarker.getRow() + "_" + ctMarker.getCol();
|
||||
|
||||
@@ -245,8 +245,7 @@ public class ExcelUtil<T> {
|
||||
if (!pictures.isEmpty()) {
|
||||
for (HSSFShape shape : sheet.getDrawingPatriarch().getChildren()) {
|
||||
HSSFClientAnchor anchor = (HSSFClientAnchor)shape.getAnchor();
|
||||
if (shape instanceof HSSFPicture) {
|
||||
HSSFPicture pic = (HSSFPicture)shape;
|
||||
if (shape instanceof HSSFPicture pic) {
|
||||
int pictureIndex = pic.getPictureIndex() - 1;
|
||||
HSSFPictureData picData = pictures.get(pictureIndex);
|
||||
String picIndex = anchor.getRow1() + "_" + anchor.getCol1();
|
||||
@@ -269,12 +268,10 @@ public class ExcelUtil<T> {
|
||||
public static Map<String, PictureData> getSheetPictures07(XSSFSheet sheet, XSSFWorkbook workbook) {
|
||||
Map<String, PictureData> sheetIndexPicMap = new HashMap<String, PictureData>();
|
||||
for (POIXMLDocumentPart dr : sheet.getRelations()) {
|
||||
if (dr instanceof XSSFDrawing) {
|
||||
XSSFDrawing drawing = (XSSFDrawing)dr;
|
||||
if (dr instanceof XSSFDrawing drawing) {
|
||||
List<XSSFShape> shapes = drawing.getShapes();
|
||||
for (XSSFShape shape : shapes) {
|
||||
if (shape instanceof XSSFPicture) {
|
||||
XSSFPicture pic = (XSSFPicture)shape;
|
||||
if (shape instanceof XSSFPicture pic) {
|
||||
XSSFClientAnchor anchor = pic.getPreferredSize();
|
||||
CTMarker ctMarker = anchor.getFrom();
|
||||
String picIndex = ctMarker.getRow() + "_" + ctMarker.getCol();
|
||||
|
||||
@@ -304,8 +304,7 @@ public class CustomProcessDiagramGenerator extends DefaultProcessDiagramGenerato
|
||||
boolean multiInstanceSequential = false;
|
||||
boolean multiInstanceParallel = false;
|
||||
boolean collapsed = false;
|
||||
if (flowNode instanceof Activity) {
|
||||
Activity activity = (Activity)flowNode;
|
||||
if (flowNode instanceof Activity activity) {
|
||||
MultiInstanceLoopCharacteristics multiInstanceLoopCharacteristics = activity.getLoopCharacteristics();
|
||||
if (multiInstanceLoopCharacteristics != null) {
|
||||
multiInstanceSequential = multiInstanceLoopCharacteristics.isSequential();
|
||||
|
||||
@@ -118,8 +118,7 @@ public class FindNextNodeUtil {
|
||||
// 查询下一节点的信息
|
||||
FlowElement nextFlowElement = getFlowElementById(nextFlowElementID, flowElements);
|
||||
// 调用流程
|
||||
if (nextFlowElement instanceof CallActivity) {
|
||||
CallActivity ca = (CallActivity)nextFlowElement;
|
||||
if (nextFlowElement instanceof CallActivity ca) {
|
||||
if (ca.getLoopCharacteristics() != null) {
|
||||
UserTask userTask = new UserTask();
|
||||
userTask.setId(ca.getId());
|
||||
|
||||
@@ -28,13 +28,20 @@
|
||||
<!-- SpringBoot 拦截器 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
<artifactId>spring-boot-starter-aspectj</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SB4: Jackson 自动配置拆分到独立模块 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-jackson2</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 阿里数据库连接池 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-3-starter</artifactId>
|
||||
<artifactId>druid</artifactId>
|
||||
<version>${druid.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 验证码 -->
|
||||
@@ -60,6 +67,10 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-cache</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 系统模块-->
|
||||
<dependency>
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
|
||||
import org.springframework.boot.jackson2.autoconfigure.Jackson2ObjectMapperBuilderCustomizer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package com.core.framework.config;
|
||||
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceBuilder;
|
||||
import com.alibaba.druid.spring.boot3.autoconfigure.properties.DruidStatProperties;
|
||||
import com.alibaba.druid.util.Utils;
|
||||
import com.core.common.enums.DataSourceType;
|
||||
import com.core.common.utils.spring.SpringUtils;
|
||||
@@ -21,17 +19,12 @@ import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* druid 配置多数据源
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
@Configuration
|
||||
public class DruidConfig {
|
||||
@Bean
|
||||
@ConfigurationProperties("spring.datasource.druid.master")
|
||||
public DataSource masterDataSource(DruidProperties druidProperties) {
|
||||
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
|
||||
DruidDataSource dataSource = new DruidDataSource();
|
||||
return druidProperties.dataSource(dataSource);
|
||||
}
|
||||
|
||||
@@ -39,7 +32,7 @@ public class DruidConfig {
|
||||
@ConfigurationProperties("spring.datasource.druid.slave")
|
||||
@ConditionalOnProperty(prefix = "spring.datasource.druid.slave", name = "enabled", havingValue = "true")
|
||||
public DataSource slaveDataSource(DruidProperties druidProperties) {
|
||||
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
|
||||
DruidDataSource dataSource = new DruidDataSource();
|
||||
return druidProperties.dataSource(dataSource);
|
||||
}
|
||||
|
||||
@@ -52,13 +45,6 @@ public class DruidConfig {
|
||||
return new DynamicDataSource(masterDataSource, targetDataSources);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置数据源
|
||||
*
|
||||
* @param targetDataSources 备选数据源集合
|
||||
* @param sourceName 数据源名称
|
||||
* @param beanName bean名称
|
||||
*/
|
||||
public void setDataSource(Map<Object, Object> targetDataSources, String sourceName, String beanName) {
|
||||
try {
|
||||
DataSource dataSource = SpringUtils.getBean(beanName);
|
||||
@@ -67,20 +53,10 @@ public class DruidConfig {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 去除监控页面底部的广告
|
||||
*/
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@Bean
|
||||
@ConditionalOnProperty(name = "spring.datasource.druid.statViewServlet.enabled", havingValue = "true")
|
||||
public FilterRegistrationBean removeDruidFilterRegistrationBean(DruidStatProperties properties) {
|
||||
// 获取web监控页面的参数
|
||||
DruidStatProperties.StatViewServlet config = properties.getStatViewServlet();
|
||||
// 提取common.js的配置路径
|
||||
String pattern = config.getUrlPattern() != null ? config.getUrlPattern() : "/druid/*";
|
||||
String commonJsPattern = pattern.replaceAll("\\*", "js/common.js");
|
||||
final String filePath = "support/http/resources/js/common.js";
|
||||
// 创建filter进行过滤
|
||||
public FilterRegistrationBean removeDruidFilterRegistrationBean() {
|
||||
Filter filter = new Filter() {
|
||||
@Override
|
||||
public void init(jakarta.servlet.FilterConfig filterConfig) throws ServletException {}
|
||||
@@ -89,11 +65,8 @@ public class DruidConfig {
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
|
||||
throws IOException, ServletException {
|
||||
chain.doFilter(request, response);
|
||||
// 重置缓冲区,响应头不会被重置
|
||||
response.resetBuffer();
|
||||
// 获取common.js
|
||||
String text = Utils.readFromResource(filePath);
|
||||
// 正则替换banner, 除去底部的广告信息
|
||||
String text = Utils.readFromResource("support/http/resources/js/common.js");
|
||||
text = text.replaceAll("<a.*?banner\"></a><br/>", "");
|
||||
text = text.replaceAll("powered.*?shrek.wang</a>", "");
|
||||
response.getWriter().write(text);
|
||||
@@ -104,7 +77,7 @@ public class DruidConfig {
|
||||
};
|
||||
FilterRegistrationBean registrationBean = new FilterRegistrationBean();
|
||||
registrationBean.setFilter(filter);
|
||||
registrationBean.addUrlPatterns(commonJsPattern);
|
||||
registrationBean.addUrlPatterns("/druid/js/common.js");
|
||||
return registrationBean;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,8 +70,7 @@ public class SecurityConfig {
|
||||
*/
|
||||
@Bean
|
||||
public AuthenticationManager authenticationManager() {
|
||||
DaoAuthenticationProvider daoAuthenticationProvider = new DaoAuthenticationProvider();
|
||||
daoAuthenticationProvider.setUserDetailsService(userDetailsService);
|
||||
DaoAuthenticationProvider daoAuthenticationProvider = new DaoAuthenticationProvider(userDetailsService);
|
||||
daoAuthenticationProvider.setPasswordEncoder(bCryptPasswordEncoder());
|
||||
return new ProviderManager(daoAuthenticationProvider);
|
||||
}
|
||||
|
||||
@@ -22,8 +22,7 @@ public abstract class RepeatSubmitInterceptor implements HandlerInterceptor {
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
|
||||
throws Exception {
|
||||
if (handler instanceof HandlerMethod) {
|
||||
HandlerMethod handlerMethod = (HandlerMethod)handler;
|
||||
if (handler instanceof HandlerMethod handlerMethod) {
|
||||
Method method = handlerMethod.getMethod();
|
||||
RepeatSubmit annotation = method.getAnnotation(RepeatSubmit.class);
|
||||
if (annotation != null) {
|
||||
|
||||
@@ -39,8 +39,7 @@ public class SameUrlDataInterceptor extends RepeatSubmitInterceptor {
|
||||
@Override
|
||||
public boolean isRepeatSubmit(HttpServletRequest request, RepeatSubmit annotation) {
|
||||
String nowParams = "";
|
||||
if (request instanceof RepeatedlyRequestWrapper) {
|
||||
RepeatedlyRequestWrapper repeatedlyRequest = (RepeatedlyRequestWrapper)request;
|
||||
if (request instanceof RepeatedlyRequestWrapper repeatedlyRequest) {
|
||||
nowParams = HttpHelper.getBodyString(repeatedlyRequest);
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ public class SysLoginService {
|
||||
// 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
|
||||
authentication = authenticationManager.authenticate(authenticationToken);
|
||||
} catch (Exception e) {
|
||||
if (e instanceof BadCredentialsException) {
|
||||
if (e instanceof BadCredentialsException ex) {
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL,
|
||||
MessageUtils.message("user.password.not.match")));
|
||||
throw new UserPasswordNotMatchException();
|
||||
|
||||
@@ -11,8 +11,9 @@ import com.core.common.utils.ip.IpUtils;
|
||||
import com.core.common.utils.uuid.IdUtils;
|
||||
import eu.bitwalker.useragentutils.UserAgent;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import io.jsonwebtoken.Jwts;
|
||||
import io.jsonwebtoken.security.Keys;
|
||||
import io.jsonwebtoken.Jwts;
|
||||
import javax.crypto.SecretKey;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -154,9 +155,16 @@ public class TokenService {
|
||||
* @param claims 数据声明
|
||||
* @return 令牌
|
||||
*/
|
||||
private SecretKey getSigningKey() {
|
||||
byte[] keyBytes = secret.getBytes(StandardCharsets.UTF_8);
|
||||
// Pad to 64 bytes for HS512 minimum key requirement
|
||||
byte[] paddedKey = new byte[64];
|
||||
System.arraycopy(keyBytes, 0, paddedKey, 0, Math.min(keyBytes.length, 64));
|
||||
return Keys.hmacShaKeyFor(paddedKey);
|
||||
}
|
||||
|
||||
private String createToken(Map<String, Object> claims) {
|
||||
String token = Jwts.builder().claims(claims).signWith(Keys.hmacShaKeyFor(secret.getBytes(StandardCharsets.UTF_8)), Jwts.SIG.HS512).compact();
|
||||
return token;
|
||||
return Jwts.builder().claims(claims).signWith(getSigningKey()).compact();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -166,7 +174,7 @@ public class TokenService {
|
||||
* @return 数据声明
|
||||
*/
|
||||
private Claims parseToken(String token) {
|
||||
return Jwts.parser().verifyWith(Keys.hmacShaKeyFor(secret.getBytes(StandardCharsets.UTF_8))).build().parseSignedClaims(token).getPayload();
|
||||
return Jwts.parser().verifyWith(getSigningKey()).build().parseSignedClaims(token).getPayload();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -49,7 +49,8 @@
|
||||
<!-- 阿里数据库连接池 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-3-starter</artifactId>
|
||||
<artifactId>druid</artifactId>
|
||||
<version>${druid.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Lombok 支持 -->
|
||||
|
||||
@@ -131,8 +131,7 @@ public class GenController extends BaseController {
|
||||
List<SQLStatement> sqlStatements = SQLUtils.parseStatements(sql, DbType.mysql);
|
||||
List<String> tableNames = new ArrayList<>();
|
||||
for (SQLStatement sqlStatement : sqlStatements) {
|
||||
if (sqlStatement instanceof MySqlCreateTableStatement) {
|
||||
MySqlCreateTableStatement createTableStatement = (MySqlCreateTableStatement)sqlStatement;
|
||||
if (sqlStatement instanceof MySqlCreateTableStatement createTableStatement) {
|
||||
if (genTableService.createTable(createTableStatement.toString())) {
|
||||
String tableName = createTableStatement.getTableName().replaceAll("`", "");
|
||||
tableNames.add(tableName);
|
||||
|
||||
@@ -19,6 +19,11 @@
|
||||
<dependencies>
|
||||
|
||||
<!-- 定时任务 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-quartz</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.quartz-scheduler</groupId>
|
||||
<artifactId>quartz</artifactId>
|
||||
|
||||
@@ -22,6 +22,16 @@
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SB4: Flyway + JDBC 自动配置拆分到独立模块 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-flyway</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-jdbc</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Flyway 数据库迁移 -->
|
||||
<dependency>
|
||||
<groupId>org.flywaydb</groupId>
|
||||
@@ -80,12 +90,6 @@
|
||||
<artifactId>velocity-engine-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- rabbitMQ -->
|
||||
<!-- <dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||
</dependency> -->
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
@@ -113,10 +117,10 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.13.0</version>
|
||||
<version>3.15.0</version>
|
||||
<configuration>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
|
||||
@@ -3,8 +3,8 @@ package com.openhis;
|
||||
import com.openhis.web.ybmanage.config.YbServiceConfig;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.flyway.autoconfigure.FlywayAutoConfiguration;
|
||||
import org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.core.env.Environment;
|
||||
@@ -13,25 +13,14 @@ import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
/**
|
||||
* 启动程序
|
||||
*
|
||||
* @author system 1,2,3,4
|
||||
*/
|
||||
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, FlywayAutoConfiguration.class}, scanBasePackages = {"com.core", "com.openhis"})
|
||||
@SpringBootApplication(exclude = {
|
||||
DataSourceAutoConfiguration.class,
|
||||
FlywayAutoConfiguration.class
|
||||
}, scanBasePackages = {"com.core", "com.openhis"})
|
||||
@EnableConfigurationProperties(YbServiceConfig.class)
|
||||
@EnableAsync
|
||||
public class OpenHisApplication {
|
||||
public static void main(String[] args) throws UnknownHostException {
|
||||
// System.setProperty("spring.devtools.restart.enabled", "false");
|
||||
// 测试 Instrument 类加载
|
||||
// try {
|
||||
// Class.forName("com.openhis.administration.domain.Instrument");
|
||||
// System.out.println("Instrument class loaded successfully");
|
||||
// } catch (ClassNotFoundException e) {
|
||||
// System.err.println("Failed to load Instrument class: " + e.getMessage());
|
||||
// }
|
||||
|
||||
ConfigurableApplicationContext application = SpringApplication.run(OpenHisApplication.class, args);
|
||||
Environment env = application.getEnvironment();
|
||||
String ip = InetAddress.getLocalHost().getHostAddress();
|
||||
|
||||
@@ -5,7 +5,7 @@ import org.flywaydb.core.Flyway;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializer;
|
||||
import org.springframework.boot.flyway.autoconfigure.FlywayMigrationInitializer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
|
||||
@@ -53,6 +53,9 @@ user:
|
||||
|
||||
# Spring配置
|
||||
spring:
|
||||
threads:
|
||||
virtual:
|
||||
enabled: true
|
||||
mvc:
|
||||
pathmatch:
|
||||
matching-strategy: ant-path-matcher
|
||||
|
||||
@@ -6,7 +6,7 @@ package com.openhis;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.Test;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
@@ -32,9 +32,7 @@ public class DictAspect {
|
||||
public Object aroundController(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
Object result = joinPoint.proceed(); // 执行原方法
|
||||
|
||||
if (result instanceof R) {
|
||||
// 如果返回值是 R<?>,提取其中的数据
|
||||
R<?> response = (R<?>)result;
|
||||
if (result instanceof R<?> response) {
|
||||
Object data = response.getData(); // 获取 R<?> 中的实际数据
|
||||
|
||||
if (data instanceof Page) {
|
||||
@@ -46,9 +44,7 @@ public class DictAspect {
|
||||
processDict(obj); // 处理每个 DTO 对象
|
||||
}
|
||||
}
|
||||
} else if (data instanceof List) {
|
||||
// 如果数据是 List 类型,处理列表数据
|
||||
List<?> list = (List<?>)data;
|
||||
} else if (data instanceof List<?> list) {
|
||||
if (!list.isEmpty()) {
|
||||
for (Object obj : list) {
|
||||
processDict(obj); // 处理每个 DTO 对象
|
||||
@@ -88,8 +84,7 @@ public class DictAspect {
|
||||
continue; // 如果字段值为空,跳过
|
||||
}
|
||||
// 如果字段是 List 类型,递归处理其中的每个元素
|
||||
if (fieldValue instanceof List) {
|
||||
List<?> list = (List<?>)fieldValue;
|
||||
if (fieldValue instanceof List<?> list) {
|
||||
for (Object item : list) {
|
||||
processDict(item); // 递归处理 List 中的每个元素
|
||||
}
|
||||
|
||||
@@ -105,8 +105,7 @@ public class OperLogAspect {
|
||||
}
|
||||
|
||||
// 设置操作结果
|
||||
if (result instanceof R) {
|
||||
R<?> r = (R<?>)result;
|
||||
if (result instanceof R<?> r) {
|
||||
operLog.setJsonResult(JSON.toJSONString(r));
|
||||
// 根据R的code判断操作状态
|
||||
if (r.getCode() != 200) { // 假设200是成功状态码
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
|
||||
@@ -56,8 +56,8 @@
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>17</source> <!-- 将8改为17 -->
|
||||
<target>17</target> <!-- 将8改为17 -->
|
||||
<source>${java.version}</source> <!-- 将8改为17 -->
|
||||
<target>${java.version}</target> <!-- 将8改为17 -->
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.5.14</version>
|
||||
<version>4.0.6</version>
|
||||
<relativePath />
|
||||
</parent>
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
<core.version>0.0.1-SNAPSHOT</core.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>17</java.version> <!-- 将21改为17 -->
|
||||
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
|
||||
<java.version>25</java.version>
|
||||
<maven-compiler-plugin.version>3.15.0</maven-compiler-plugin.version>
|
||||
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
|
||||
<druid.version>1.2.28</druid.version>
|
||||
<bitwalker.version>1.21</bitwalker.version>
|
||||
@@ -37,10 +37,10 @@
|
||||
<velocity.version>2.3</velocity.version>
|
||||
<jwt.version>0.12.6</jwt.version>
|
||||
<!-- override dependency version -->
|
||||
<lombok.version>1.18.34</lombok.version> <!-- 替换为 -->
|
||||
<lombok.version>1.18.38</lombok.version> <!-- 替换为 -->
|
||||
<mybatis-plus.version>3.5.16</mybatis-plus.version>
|
||||
<flowable.version>7.1.0</flowable.version>
|
||||
<postgresql.version>42.7.4</postgresql.version>
|
||||
<postgresql.version>42.7.10</postgresql.version>
|
||||
<aviator.version>5.3.3</aviator.version>
|
||||
<httpclient.version>4.5.14</httpclient.version>
|
||||
<fastjson2.version>2.0.61</fastjson2.version>
|
||||
@@ -312,6 +312,7 @@
|
||||
<version>${jwt.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- 验证码 -->
|
||||
<dependency>
|
||||
<groupId>pro.fessional</groupId>
|
||||
|
||||
Reference in New Issue
Block a user