fix(client): 设备移除逻辑与认证流程优化

- 修改设备移除时的本地清理方法,统一调用 clearLocalAuth
- 优化设备数量限制校验逻辑,避免重复计算当前设备- 移除冗余的设备状态检查,简化设备移除流程- 调整 Redis 连接超时与等待时间,提升连接稳定性- 增强 MySQL 数据库连接配置,添加自动重连机制
-优化 Druid 连接池参数,提高数据库连接性能
- 简化客户端认证与数据上报逻辑,提升处理效率
- 移除过期设备状态更新逻辑,减少不必要的数据库操作- 调整慢 SQL 记录阈值,便于及时发现性能问题-优化版本分布与数据类型统计查询逻辑,提高响应速度
This commit is contained in:
2025-10-15 18:32:48 +08:00
parent f614860eee
commit 6f04658265
29 changed files with 702 additions and 1010 deletions

View File

@@ -6,7 +6,7 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://8.138.23.49:8896/erp?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://8.138.23.49:8896/erp?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&failOverReadOnly=false&maxReconnects=3&initialTimeout=2&connectTimeout=5000&socketTimeout=5000
username: root
password: jaz7fMSiCrQK48nK
# url: jdbc:mysql://localhost:3306/erp?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
@@ -19,20 +19,20 @@ spring:
url:
username:
password:
# 初始连接数
initialSize: 5
# 初始连接数(增加预热连接)
initialSize: 8
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置连接超时时间
connectTimeout: 30000
# 配置网络超时时间
socketTimeout: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
maxActive: 25
# 配置获取连接等待超时的时间5秒
maxWait: 5000
# 配置连接超时时间5秒
connectTimeout: 5000
# 配置网络超时时间5秒
socketTimeout: 5000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒30秒检测一次
timeBetweenEvictionRunsMillis: 30000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
@@ -55,9 +55,9 @@ spring:
filter:
stat:
enabled: true
# 慢SQL记录
# 慢SQL记录500ms以上记录为慢SQL
log-slow-sql: true
slow-sql-millis: 1000
slow-sql-millis: 500
merge-sql: true
wall:
config:

View File

@@ -88,7 +88,7 @@ spring:
# password:
password: 123123
# 连接超时时间(降低超时,快速失败)
timeout: 3s
timeout: 5s
lettuce:
pool:
# 连接池中的最小空闲连接(保持预热连接,避免临时建连)
@@ -98,7 +98,7 @@ spring:
# 连接池的最大数据库连接数(增加以应对并发)
max-active: 20
# 连接池最大阻塞等待时间(设置合理超时,避免无限等待)
max-wait: 3000ms
max-wait: 5000ms
# 关闭超时时间
shutdown-timeout: 100ms

View File

@@ -10,7 +10,9 @@ PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
<!-- 允许JDBC 支持自动生成主键 -->
<setting name="useGeneratedKeys" value="true" />
<!-- 配置默认的执行器.SIMPLE就是普通执行器;REUSE执行器会重用预处理语句(prepared statements);BATCH执行器将重用语句并执行批量更新 -->
<setting name="defaultExecutorType" value="SIMPLE" />
<setting name="defaultExecutorType" value="REUSE" />
<!-- 设置超时时间防止慢查询5秒 -->
<setting name="defaultStatementTimeout" value="5" />
<!-- 指定 MyBatis 所用日志的具体实现 -->
<setting name="logImpl" value="SLF4J" />
<!-- 使用驼峰命名法转换字段 -->