From b3b691a7e3316d5009b3a36694e0203c11e87812 Mon Sep 17 00:00:00 2001 From: chenbowen Date: Wed, 7 Jan 2026 16:49:18 +0800 Subject: [PATCH 01/10] =?UTF-8?q?1.=E5=88=9D=E5=A7=8B=E5=8C=96=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E6=97=B6=E5=B9=B6=E6=B2=A1=E6=9C=89=E6=9C=89=E6=95=88?= =?UTF-8?q?=E7=9A=84=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF=EF=BC=8C=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E4=B8=BA=E7=A9=BA=E5=AD=97=E7=AC=A6=E4=B8=B2=E5=8D=A0?= =?UTF-8?q?=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/dm/ruoyi-vue-pro-dm8.sql | 4 +- sql/dm/数据总线API访问日志表结构_20251028.sql | 82 +++++++++---------- .../gateway/core/ApiGatewayAccessLogger.java | 2 + 3 files changed, 45 insertions(+), 43 deletions(-) diff --git a/sql/dm/ruoyi-vue-pro-dm8.sql b/sql/dm/ruoyi-vue-pro-dm8.sql index ba46b297..9dc55d0a 100644 --- a/sql/dm/ruoyi-vue-pro-dm8.sql +++ b/sql/dm/ruoyi-vue-pro-dm8.sql @@ -1590,8 +1590,8 @@ INSERT INTO system_menu (id, name, permission, type, sort, parent_id, path, icon INSERT INTO system_menu (id, name, permission, type, sort, parent_id, path, icon, component, component_name, status, visible, keep_alive, always_show, creator, create_time, updater, update_time, deleted) VALUES (5005, 'AI 工作流测试', 'ai:workflow:test', 3, 5, 5000, '', '', '', '', 0, '1', '1', '1', '1', '2025-03-30 10:29:41', '1', '2025-03-30 10:29:41', '0'); INSERT INTO system_menu (id, name, permission, type, sort, parent_id, path, icon, component, component_name, status, visible, keep_alive, always_show, creator, create_time, updater, update_time, deleted) VALUES (5009, '仪表盘设计器', '', 2, 1, 1281, 'jimu-bi', 'fa:y-combinator', 'report/jmreport/bi', 'JimuBI', 0, '1', '1', '1', '1', '2025-05-03 09:57:15', '1', '2025-05-03 10:02:05', '0'); INSERT INTO system_menu (id, name, permission, type, sort, parent_id, path, icon, component, component_name, status, visible, keep_alive, always_show, creator, create_time, updater, update_time, deleted) VALUES (5010, '租户切换', 'system:tenant:visit', 3, 999, 1138, '', '', '', '', 0, '1', '1', '1', '1', '2025-05-05 15:25:32', '1', '2025-05-05 15:25:32', '0'); -INSERT INTO system_menu (id, name, permission, type, sort, parent_id, path, icon, component, component_name, status, visible, keep_alive, always_show, creator, create_time, updater, update_time, deleted) VALUES (5013, '公司切换', 'system:company:visit', 3, 100, 103, '', '', '', '', 0, '1', '1', '1', '1', '2025-12-05 09:00:00', '1', '2025-12-05 09:00:00', '0'); -INSERT INTO system_menu (id, name, permission, type, sort, parent_id, path, icon, component, component_name, status, visible, keep_alive, always_show, creator, create_time, updater, update_time, deleted) VALUES (5014, '部门切换', 'system:dept:visit', 3, 101, 103, '', '', '', '', 0, '1', '1', '1', '1', '2025-12-05 09:00:00', '1', '2025-12-05 09:00:00', '0'); +INSERT INTO system_menu (id, name, permission, type, sort, parent_id, path, icon, component, component_name, status, visible, keep_alive, always_show, creator, create_time, updater, update_time, deleted) VALUES (5013, '公司切换', 'system:company:visit', 3, 100, 0, '', '', '', '', 0, '1', '1', '1', '1', '2025-12-05 09:00:00', '1', '2025-12-05 09:00:00', '0'); +INSERT INTO system_menu (id, name, permission, type, sort, parent_id, path, icon, component, component_name, status, visible, keep_alive, always_show, creator, create_time, updater, update_time, deleted) VALUES (5014, '部门切换', 'system:dept:visit', 3, 101, 0, '', '', '', '', 0, '1', '1', '1', '1', '2025-12-05 09:00:00', '1', '2025-12-05 09:00:00', '0'); insert into SYSTEM_MENU (ID, NAME, PERMISSION, TYPE, SORT, PARENT_ID, PATH, ICON, COMPONENT, COMPONENT_NAME, STATUS, VISIBLE, KEEP_ALIVE, ALWAYS_SHOW, CREATOR, CREATE_TIME, UPDATER, UPDATE_TIME, DELETED) values (1953701540574969857, '系统序列号管理', '', 2, 0, 1, 'sequence', '', 'system/sequence/index', 'Sequence', 0, 1, 1, 1, '', '2025-08-08 14:38:20.455625', '', '2025-08-08 14:38:20.455626', 0); insert into SYSTEM_MENU (ID, NAME, PERMISSION, TYPE, SORT, PARENT_ID, PATH, ICON, COMPONENT, COMPONENT_NAME, STATUS, VISIBLE, KEEP_ALIVE, ALWAYS_SHOW, CREATOR, CREATE_TIME, UPDATER, UPDATE_TIME, DELETED) values (1953706417225150470, '系统序列号导出', 'system:sequence:export', 3, 5, 1953701540574969857, '', '', '', null, 0, 1, 1, 1, '', '2025-08-08 14:38:20.580376', '', '2025-08-08 14:38:20.580377', 0); insert into SYSTEM_MENU (ID, NAME, PERMISSION, TYPE, SORT, PARENT_ID, PATH, ICON, COMPONENT, COMPONENT_NAME, STATUS, VISIBLE, KEEP_ALIVE, ALWAYS_SHOW, CREATOR, CREATE_TIME, UPDATER, UPDATE_TIME, DELETED) values (1953706417225150469, '系统序列号删除', 'system:sequence:delete', 3, 4, 1953701540574969857, '', '', '', null, 0, 1, 1, 1, '', '2025-08-08 14:38:20.553819', '', '2025-08-08 14:38:20.553820', 0); diff --git a/sql/dm/数据总线API访问日志表结构_20251028.sql b/sql/dm/数据总线API访问日志表结构_20251028.sql index 8ddec75a..4ba99a2e 100644 --- a/sql/dm/数据总线API访问日志表结构_20251028.sql +++ b/sql/dm/数据总线API访问日志表结构_20251028.sql @@ -1,4 +1,4 @@ -CREATE TABLE "RUOYI-VUE-PRO"."DATABUS_API_ACCESS_LOG" +CREATE TABLE "DATABUS_API_ACCESS_LOG" ( "ID" BIGINT NOT NULL, "TRACE_ID" VARCHAR(64) DEFAULT NULL, @@ -23,52 +23,52 @@ CREATE TABLE "RUOYI-VUE-PRO"."DATABUS_API_ACCESS_LOG" "RESPONSE_TIME" DATETIME(6) DEFAULT NULL, "STEP_RESULTS" TEXT, "EXTRA" TEXT, - "CREATOR" VARCHAR(64) DEFAULT '' NOT NULL, + "CREATOR" VARCHAR(64) DEFAULT NULL, "CREATE_TIME" DATETIME(6) DEFAULT CURRENT_TIMESTAMP NOT NULL, - "UPDATER" VARCHAR(64) DEFAULT '' NOT NULL, + "UPDATER" VARCHAR(64) DEFAULT NULL, "UPDATE_TIME" DATETIME(6) DEFAULT CURRENT_TIMESTAMP NOT NULL, "DELETED" BIT DEFAULT '0' NOT NULL, "TENANT_ID" BIGINT DEFAULT 0 NOT NULL, NOT CLUSTER PRIMARY KEY("ID")) STORAGE(ON "MAIN", CLUSTERBTR) ; -COMMENT ON TABLE "RUOYI-VUE-PRO".DATABUS_API_ACCESS_LOG IS 'Databus API 访问日志表'; -COMMENT ON COLUMN "RUOYI-VUE-PRO".DATABUS_API_ACCESS_LOG."API_CODE" IS 'API 编码'; -COMMENT ON COLUMN "RUOYI-VUE-PRO".DATABUS_API_ACCESS_LOG."API_VERSION" IS 'API 版本'; -COMMENT ON COLUMN "RUOYI-VUE-PRO".DATABUS_API_ACCESS_LOG."CLIENT_IP" IS '客户端 IP'; -COMMENT ON COLUMN "RUOYI-VUE-PRO".DATABUS_API_ACCESS_LOG."CREATE_TIME" IS '创建时间'; -COMMENT ON COLUMN "RUOYI-VUE-PRO".DATABUS_API_ACCESS_LOG."CREATOR" IS '创建者'; -COMMENT ON COLUMN "RUOYI-VUE-PRO".DATABUS_API_ACCESS_LOG."DELETED" IS '是否删除'; -COMMENT ON COLUMN "RUOYI-VUE-PRO".DATABUS_API_ACCESS_LOG."DURATION" IS '请求耗时(毫秒)'; -COMMENT ON COLUMN "RUOYI-VUE-PRO".DATABUS_API_ACCESS_LOG."ERROR_CODE" IS '业务错误码'; -COMMENT ON COLUMN "RUOYI-VUE-PRO".DATABUS_API_ACCESS_LOG."ERROR_MESSAGE" IS '错误信息'; -COMMENT ON COLUMN "RUOYI-VUE-PRO".DATABUS_API_ACCESS_LOG."EXCEPTION_STACK" IS '异常堆栈'; -COMMENT ON COLUMN "RUOYI-VUE-PRO".DATABUS_API_ACCESS_LOG."EXTRA" IS '额外调试信息(JSON 字符串)'; -COMMENT ON COLUMN "RUOYI-VUE-PRO".DATABUS_API_ACCESS_LOG."ID" IS '日志主键'; -COMMENT ON COLUMN "RUOYI-VUE-PRO".DATABUS_API_ACCESS_LOG."REQUEST_BODY" IS '请求体(JSON 字符串)'; -COMMENT ON COLUMN "RUOYI-VUE-PRO".DATABUS_API_ACCESS_LOG."REQUEST_HEADERS" IS '请求头(JSON 字符串)'; -COMMENT ON COLUMN "RUOYI-VUE-PRO".DATABUS_API_ACCESS_LOG."REQUEST_METHOD" IS '请求方法'; -COMMENT ON COLUMN "RUOYI-VUE-PRO".DATABUS_API_ACCESS_LOG."REQUEST_PATH" IS '请求路径'; -COMMENT ON COLUMN "RUOYI-VUE-PRO".DATABUS_API_ACCESS_LOG."REQUEST_QUERY" IS '请求查询参数(JSON 字符串)'; -COMMENT ON COLUMN "RUOYI-VUE-PRO".DATABUS_API_ACCESS_LOG."REQUEST_TIME" IS '请求时间'; -COMMENT ON COLUMN "RUOYI-VUE-PRO".DATABUS_API_ACCESS_LOG."RESPONSE_BODY" IS '响应体(JSON 字符串)'; -COMMENT ON COLUMN "RUOYI-VUE-PRO".DATABUS_API_ACCESS_LOG."RESPONSE_MESSAGE" IS '响应提示信息'; -COMMENT ON COLUMN "RUOYI-VUE-PRO".DATABUS_API_ACCESS_LOG."RESPONSE_STATUS" IS '响应 HTTP 状态码'; -COMMENT ON COLUMN "RUOYI-VUE-PRO".DATABUS_API_ACCESS_LOG."RESPONSE_TIME" IS '响应时间'; -COMMENT ON COLUMN "RUOYI-VUE-PRO".DATABUS_API_ACCESS_LOG."STATUS" IS '访问状态:0-成功 1-客户端错误 2-服务端错误 3-未知'; -COMMENT ON COLUMN "RUOYI-VUE-PRO".DATABUS_API_ACCESS_LOG."STEP_RESULTS" IS '执行步骤结果(JSON 字符串)'; -COMMENT ON COLUMN "RUOYI-VUE-PRO".DATABUS_API_ACCESS_LOG."TENANT_ID" IS '租户编号'; -COMMENT ON COLUMN "RUOYI-VUE-PRO".DATABUS_API_ACCESS_LOG."TRACE_ID" IS '追踪 ID'; -COMMENT ON COLUMN "RUOYI-VUE-PRO".DATABUS_API_ACCESS_LOG."UPDATER" IS '更新者'; -COMMENT ON COLUMN "RUOYI-VUE-PRO".DATABUS_API_ACCESS_LOG."UPDATE_TIME" IS '更新时间'; -COMMENT ON COLUMN "RUOYI-VUE-PRO".DATABUS_API_ACCESS_LOG."USER_AGENT" IS 'User-Agent'; +COMMENT ON TABLE DATABUS_API_ACCESS_LOG IS 'Databus API 访问日志表'; +COMMENT ON COLUMN DATABUS_API_ACCESS_LOG."API_CODE" IS 'API 编码'; +COMMENT ON COLUMN DATABUS_API_ACCESS_LOG."API_VERSION" IS 'API 版本'; +COMMENT ON COLUMN DATABUS_API_ACCESS_LOG."CLIENT_IP" IS '客户端 IP'; +COMMENT ON COLUMN DATABUS_API_ACCESS_LOG."CREATE_TIME" IS '创建时间'; +COMMENT ON COLUMN DATABUS_API_ACCESS_LOG."CREATOR" IS '创建者'; +COMMENT ON COLUMN DATABUS_API_ACCESS_LOG."DELETED" IS '是否删除'; +COMMENT ON COLUMN DATABUS_API_ACCESS_LOG."DURATION" IS '请求耗时(毫秒)'; +COMMENT ON COLUMN DATABUS_API_ACCESS_LOG."ERROR_CODE" IS '业务错误码'; +COMMENT ON COLUMN DATABUS_API_ACCESS_LOG."ERROR_MESSAGE" IS '错误信息'; +COMMENT ON COLUMN DATABUS_API_ACCESS_LOG."EXCEPTION_STACK" IS '异常堆栈'; +COMMENT ON COLUMN DATABUS_API_ACCESS_LOG."EXTRA" IS '额外调试信息(JSON 字符串)'; +COMMENT ON COLUMN DATABUS_API_ACCESS_LOG."ID" IS '日志主键'; +COMMENT ON COLUMN DATABUS_API_ACCESS_LOG."REQUEST_BODY" IS '请求体(JSON 字符串)'; +COMMENT ON COLUMN DATABUS_API_ACCESS_LOG."REQUEST_HEADERS" IS '请求头(JSON 字符串)'; +COMMENT ON COLUMN DATABUS_API_ACCESS_LOG."REQUEST_METHOD" IS '请求方法'; +COMMENT ON COLUMN DATABUS_API_ACCESS_LOG."REQUEST_PATH" IS '请求路径'; +COMMENT ON COLUMN DATABUS_API_ACCESS_LOG."REQUEST_QUERY" IS '请求查询参数(JSON 字符串)'; +COMMENT ON COLUMN DATABUS_API_ACCESS_LOG."REQUEST_TIME" IS '请求时间'; +COMMENT ON COLUMN DATABUS_API_ACCESS_LOG."RESPONSE_BODY" IS '响应体(JSON 字符串)'; +COMMENT ON COLUMN DATABUS_API_ACCESS_LOG."RESPONSE_MESSAGE" IS '响应提示信息'; +COMMENT ON COLUMN DATABUS_API_ACCESS_LOG."RESPONSE_STATUS" IS '响应 HTTP 状态码'; +COMMENT ON COLUMN DATABUS_API_ACCESS_LOG."RESPONSE_TIME" IS '响应时间'; +COMMENT ON COLUMN DATABUS_API_ACCESS_LOG."STATUS" IS '访问状态:0-成功 1-客户端错误 2-服务端错误 3-未知'; +COMMENT ON COLUMN DATABUS_API_ACCESS_LOG."STEP_RESULTS" IS '执行步骤结果(JSON 字符串)'; +COMMENT ON COLUMN DATABUS_API_ACCESS_LOG."TENANT_ID" IS '租户编号'; +COMMENT ON COLUMN DATABUS_API_ACCESS_LOG."TRACE_ID" IS '追踪 ID'; +COMMENT ON COLUMN DATABUS_API_ACCESS_LOG."UPDATER" IS '更新者'; +COMMENT ON COLUMN DATABUS_API_ACCESS_LOG."UPDATE_TIME" IS '更新时间'; +COMMENT ON COLUMN DATABUS_API_ACCESS_LOG."USER_AGENT" IS 'User-Agent'; -CREATE OR REPLACE INDEX "IDX_DATABUS_API_ACCESS_LOG_TRACE" ON "RUOYI-VUE-PRO"."DATABUS_API_ACCESS_LOG"("TRACE_ID" ASC) STORAGE(ON "MAIN", CLUSTERBTR) ; -CREATE OR REPLACE INDEX "IDX_DATABUS_API_ACCESS_LOG_CODE" ON "RUOYI-VUE-PRO"."DATABUS_API_ACCESS_LOG"("API_CODE" ASC) STORAGE(ON "MAIN", CLUSTERBTR) ; -CREATE OR REPLACE INDEX "IDX_DATABUS_API_ACCESS_LOG_METHOD" ON "RUOYI-VUE-PRO"."DATABUS_API_ACCESS_LOG"("REQUEST_METHOD" ASC) STORAGE(ON "MAIN", CLUSTERBTR) ; -CREATE OR REPLACE INDEX "IDX_DATABUS_API_ACCESS_LOG_STATUS" ON "RUOYI-VUE-PRO"."DATABUS_API_ACCESS_LOG"("STATUS" ASC) STORAGE(ON "MAIN", CLUSTERBTR) ; -CREATE OR REPLACE INDEX "IDX_DATABUS_API_ACCESS_LOG_RESP_STATUS" ON "RUOYI-VUE-PRO"."DATABUS_API_ACCESS_LOG"("RESPONSE_STATUS" ASC) STORAGE(ON "MAIN", CLUSTERBTR) ; -CREATE OR REPLACE INDEX "IDX_DATABUS_API_ACCESS_LOG_REQUEST_TIME" ON "RUOYI-VUE-PRO"."DATABUS_API_ACCESS_LOG"("REQUEST_TIME" ASC) STORAGE(ON "MAIN", CLUSTERBTR) ; -CREATE OR REPLACE INDEX "IDX_DATABUS_API_ACCESS_LOG_CLIENT_IP" ON "RUOYI-VUE-PRO"."DATABUS_API_ACCESS_LOG"("CLIENT_IP" ASC) STORAGE(ON "MAIN", CLUSTERBTR) ; -CREATE OR REPLACE INDEX "IDX_DATABUS_API_ACCESS_LOG_TENANT" ON "RUOYI-VUE-PRO"."DATABUS_API_ACCESS_LOG"("TENANT_ID" ASC) STORAGE(ON "MAIN", CLUSTERBTR) ; +CREATE OR REPLACE INDEX "IDX_DATABUS_API_ACCESS_LOG_TRACE" ON "DATABUS_API_ACCESS_LOG"("TRACE_ID" ASC) STORAGE(ON "MAIN", CLUSTERBTR) ; +CREATE OR REPLACE INDEX "IDX_DATABUS_API_ACCESS_LOG_CODE" ON "DATABUS_API_ACCESS_LOG"("API_CODE" ASC) STORAGE(ON "MAIN", CLUSTERBTR) ; +CREATE OR REPLACE INDEX "IDX_DATABUS_API_ACCESS_LOG_METHOD" ON "DATABUS_API_ACCESS_LOG"("REQUEST_METHOD" ASC) STORAGE(ON "MAIN", CLUSTERBTR) ; +CREATE OR REPLACE INDEX "IDX_DATABUS_API_ACCESS_LOG_STATUS" ON "DATABUS_API_ACCESS_LOG"("STATUS" ASC) STORAGE(ON "MAIN", CLUSTERBTR) ; +CREATE OR REPLACE INDEX "IDX_DATABUS_API_ACCESS_LOG_RESP_STATUS" ON "DATABUS_API_ACCESS_LOG"("RESPONSE_STATUS" ASC) STORAGE(ON "MAIN", CLUSTERBTR) ; +CREATE OR REPLACE INDEX "IDX_DATABUS_API_ACCESS_LOG_REQUEST_TIME" ON "DATABUS_API_ACCESS_LOG"("REQUEST_TIME" ASC) STORAGE(ON "MAIN", CLUSTERBTR) ; +CREATE OR REPLACE INDEX "IDX_DATABUS_API_ACCESS_LOG_CLIENT_IP" ON "DATABUS_API_ACCESS_LOG"("CLIENT_IP" ASC) STORAGE(ON "MAIN", CLUSTERBTR) ; +CREATE OR REPLACE INDEX "IDX_DATABUS_API_ACCESS_LOG_TENANT" ON "DATABUS_API_ACCESS_LOG"("TENANT_ID" ASC) STORAGE(ON "MAIN", CLUSTERBTR) ; diff --git a/zt-module-databus/zt-module-databus-server/src/main/java/com/zt/plat/module/databus/framework/integration/gateway/core/ApiGatewayAccessLogger.java b/zt-module-databus/zt-module-databus-server/src/main/java/com/zt/plat/module/databus/framework/integration/gateway/core/ApiGatewayAccessLogger.java index b0ed9987..741db3f2 100644 --- a/zt-module-databus/zt-module-databus-server/src/main/java/com/zt/plat/module/databus/framework/integration/gateway/core/ApiGatewayAccessLogger.java +++ b/zt-module-databus/zt-module-databus-server/src/main/java/com/zt/plat/module/databus/framework/integration/gateway/core/ApiGatewayAccessLogger.java @@ -128,6 +128,8 @@ public class ApiGatewayAccessLogger { logDO.setUserAgent(request.getHeader(HttpHeaders.USER_AGENT)); logDO.setStatus(3); logDO.setRequestTime(LocalDateTime.now()); + logDO.setCreator(""); + logDO.setUpdater(""); Long logId = apiAccessLogService.create(logDO); request.setAttribute(ATTR_LOG_ID, logId); request.setAttribute(ATTR_REQUEST_START, Instant.now()); From b2c2cca798ecdcdce334bc8bf952433529a78687 Mon Sep 17 00:00:00 2001 From: wuzongyong <13203449218@163.com> Date: Thu, 8 Jan 2026 09:16:44 +0800 Subject: [PATCH 02/10] =?UTF-8?q?feat(file):=20=E4=B8=BAS3=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=AE=A2=E6=88=B7=E7=AB=AF=E6=B7=BB=E5=8A=A0=E9=A2=84?= =?UTF-8?q?=E7=AD=BE=E5=90=8DURL=E7=BC=93=E5=AD=98=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 引入RedisTemplate依赖用于缓存预签名URL - 添加Redis缓存配置,设置缓存前缀和50分钟过期时间 - 实现预签名URL的缓存读取和存储逻辑 - 添加延迟加载RedisTemplate的方法避免循环依赖 - 在文件删除时同步清除对应的缓存项 - 优化预签名URL生成流程,优先从缓存获取 --- .../file/core/client/s3/S3FileClient.java | 56 ++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/zt-module-infra/zt-module-infra-server/src/main/java/com/zt/plat/module/infra/framework/file/core/client/s3/S3FileClient.java b/zt-module-infra/zt-module-infra-server/src/main/java/com/zt/plat/module/infra/framework/file/core/client/s3/S3FileClient.java index 7b716ba8..7e9fd653 100644 --- a/zt-module-infra/zt-module-infra-server/src/main/java/com/zt/plat/module/infra/framework/file/core/client/s3/S3FileClient.java +++ b/zt-module-infra/zt-module-infra-server/src/main/java/com/zt/plat/module/infra/framework/file/core/client/s3/S3FileClient.java @@ -6,6 +6,7 @@ import cn.hutool.http.HttpUtil; import com.zt.plat.framework.common.util.spring.SpringUtils; import com.zt.plat.module.infra.framework.file.core.client.AbstractFileClient; import org.apache.commons.lang3.StringUtils; +import org.springframework.data.redis.core.RedisTemplate; import software.amazon.awssdk.auth.credentials.AwsBasicCredentials; import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider; import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider; @@ -22,6 +23,7 @@ import software.amazon.awssdk.services.s3.presigner.model.PutObjectPresignReques import java.net.URI; import java.time.Duration; +import java.util.concurrent.TimeUnit; /** * 基于 S3 协议的文件客户端,实现 MinIO、阿里云、腾讯云、七牛云、华为云等云服务 @@ -32,6 +34,15 @@ public class S3FileClient extends AbstractFileClient { private static final Duration DEFAULT_PRESIGNED_EXPIRATION = Duration.ofHours(24); private static final String PRESIGN_EXPIRE_SECONDS_PROPERTY = "zt.file.download-expire-seconds"; + /** + * Redis 缓存 key 前缀:文件预签名 URL + */ + private static final String CACHE_KEY_PREFIX = "file:presigned:url:"; + /** + * Redis 缓存时间:50 分钟 + */ + private static final long CACHE_EXPIRE_MINUTES = 50L; + /** * 生成临时下载地址(预签名下载 URL) * @param path 文件路径 @@ -45,6 +56,17 @@ public class S3FileClient extends AbstractFileClient { return StringUtils.EMPTY; } + // 1. 尝试从 Redis 缓存中获取 + String cacheKey = CACHE_KEY_PREFIX + path; + RedisTemplate redis = getRedisTemplate(); + if (redis != null) { + Object cachedUrl = redis.opsForValue().get(cacheKey); + if (cachedUrl instanceof String) { + return (String) cachedUrl; + } + } + + // 2. 缓存未命中,调用 S3 生成预签名 URL // 使用 S3 官方支持的 responseCacheControl 参数,强制浏览器和代理不缓存 GetObjectRequest.Builder getObjectRequestBuilder = GetObjectRequest.builder() .bucket(config.getBucket()) @@ -54,12 +76,37 @@ public class S3FileClient extends AbstractFileClient { .signatureDuration(realExpiration) .getObjectRequest(getObjectRequestBuilder.build()) .build(); - return presigner.presignGetObject(getObjectPresignRequest).url().toString(); + String presignedUrl = presigner.presignGetObject(getObjectPresignRequest).url().toString(); + + // 3. 将生成的 URL 存入 Redis 缓存 + if (redis != null && presignedUrl != null && !presignedUrl.isEmpty()) { + redis.opsForValue().set(cacheKey, presignedUrl, CACHE_EXPIRE_MINUTES, TimeUnit.MINUTES); + } + + return presignedUrl; + } + + /** + * 获取 RedisTemplate 实例(延迟加载,避免初始化时循环依赖) + */ + @SuppressWarnings("unchecked") + private RedisTemplate getRedisTemplate() { + if (redisTemplate == null) { + try { + redisTemplate = SpringUtils.getBean("redisTemplate", RedisTemplate.class); + } catch (Exception e) { + // Redis 不可用时,不影响正常功能,只是不使用缓存 + return null; + } + } + return redisTemplate; } private S3Client client; private S3Presigner presigner; + private RedisTemplate redisTemplate; + public S3FileClient(Long id, S3FileClientConfig config) { super(id, config); } @@ -115,6 +162,13 @@ public class S3FileClient extends AbstractFileClient { .key(path) .build(); client.deleteObject(deleteRequest); + + // 删除文件后,清除对应的缓存 + String cacheKey = CACHE_KEY_PREFIX + path; + RedisTemplate redis = getRedisTemplate(); + if (redis != null) { + redis.delete(cacheKey); + } } @Override From c2f38608e73ee53b33332a0173462fc8c6e54d15 Mon Sep 17 00:00:00 2001 From: chenbowen Date: Thu, 8 Jan 2026 17:05:12 +0800 Subject: [PATCH 03/10] =?UTF-8?q?1.=E6=96=B0=E5=A2=9E=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E7=9A=84=E7=94=A8=E6=88=B7=E6=9D=A5=E6=BA=90?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/controller/admin/user/vo/user/UserRespVO.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zt-module-system/zt-module-system-server/src/main/java/com/zt/plat/module/system/controller/admin/user/vo/user/UserRespVO.java b/zt-module-system/zt-module-system-server/src/main/java/com/zt/plat/module/system/controller/admin/user/vo/user/UserRespVO.java index c20e1ebd..4fc49f77 100644 --- a/zt-module-system/zt-module-system-server/src/main/java/com/zt/plat/module/system/controller/admin/user/vo/user/UserRespVO.java +++ b/zt-module-system/zt-module-system-server/src/main/java/com/zt/plat/module/system/controller/admin/user/vo/user/UserRespVO.java @@ -58,6 +58,10 @@ public class UserRespVO{ @DictFormat(DictTypeConstants.USER_SEX) private Integer sex; + @Schema(description = "用户来源,参见 UserSourceEnum 枚举类", example = "1") + @ExcelProperty("用户来源") + private Integer userSource; + @Schema(description = "用户头像", example = "123456789") private String avatar; From 30029e0fd61f1ea28538bc0de39c68ea399ebc63 Mon Sep 17 00:00:00 2001 From: chenbowen Date: Fri, 9 Jan 2026 11:44:57 +0800 Subject: [PATCH 04/10] =?UTF-8?q?1.=E6=96=B0=E5=A2=9E=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E7=9A=84=E7=94=A8=E6=88=B7=E6=9D=A5=E6=BA=90?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/controller/admin/user/vo/user/UserRespVO.java | 5 ++++- .../com/zt/plat/module/system/convert/user/UserConvert.java | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/zt-module-system/zt-module-system-server/src/main/java/com/zt/plat/module/system/controller/admin/user/vo/user/UserRespVO.java b/zt-module-system/zt-module-system-server/src/main/java/com/zt/plat/module/system/controller/admin/user/vo/user/UserRespVO.java index 4fc49f77..e86723bd 100644 --- a/zt-module-system/zt-module-system-server/src/main/java/com/zt/plat/module/system/controller/admin/user/vo/user/UserRespVO.java +++ b/zt-module-system/zt-module-system-server/src/main/java/com/zt/plat/module/system/controller/admin/user/vo/user/UserRespVO.java @@ -59,9 +59,12 @@ public class UserRespVO{ private Integer sex; @Schema(description = "用户来源,参见 UserSourceEnum 枚举类", example = "1") - @ExcelProperty("用户来源") private Integer userSource; + @Schema(description = "用户来源标签", example = "外部用户") + @ExcelProperty("用户来源") + private String userSourceLabel; + @Schema(description = "用户头像", example = "123456789") private String avatar; diff --git a/zt-module-system/zt-module-system-server/src/main/java/com/zt/plat/module/system/convert/user/UserConvert.java b/zt-module-system/zt-module-system-server/src/main/java/com/zt/plat/module/system/convert/user/UserConvert.java index d424c824..73d94ca4 100644 --- a/zt-module-system/zt-module-system-server/src/main/java/com/zt/plat/module/system/convert/user/UserConvert.java +++ b/zt-module-system/zt-module-system-server/src/main/java/com/zt/plat/module/system/convert/user/UserConvert.java @@ -12,6 +12,7 @@ import com.zt.plat.module.system.dal.dataobject.dept.DeptDO; import com.zt.plat.module.system.dal.dataobject.dept.PostDO; import com.zt.plat.module.system.dal.dataobject.permission.RoleDO; import com.zt.plat.module.system.dal.dataobject.user.AdminUserDO; +import com.zt.plat.module.system.enums.user.UserSourceEnum; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; @@ -32,6 +33,10 @@ public interface UserConvert { default UserRespVO convert(AdminUserDO user) { UserRespVO vo = BeanUtils.toBean(user, UserRespVO.class); vo.setAvatar(user.getAvatar()); + if (user.getUserSource() != null) { + UserSourceEnum sourceEnum = UserSourceEnum.of(user.getUserSource()); + vo.setUserSourceLabel(sourceEnum != null ? sourceEnum.getName() : null); + } if (user.getDeptIds() != null) { vo.setDeptIds(CollectionUtils.convertList(user.getDeptIds(), Long::longValue)); } From 5b660f5a11107cbdb0eaa98e9e1a8d6e9d4567bd Mon Sep 17 00:00:00 2001 From: chenbowen Date: Fri, 9 Jan 2026 11:46:59 +0800 Subject: [PATCH 05/10] =?UTF-8?q?1.=E4=B8=8D=E5=86=8D=E8=BF=87=E6=BB=A4=20?= =?UTF-8?q?get=20=E5=BC=80=E5=A4=B4=E7=9A=84=20url?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/config/ZtBusinessAutoConfiguration.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/zt-framework/zt-spring-boot-starter-biz-business/src/main/java/com/zt/plat/framework/business/config/ZtBusinessAutoConfiguration.java b/zt-framework/zt-spring-boot-starter-biz-business/src/main/java/com/zt/plat/framework/business/config/ZtBusinessAutoConfiguration.java index e42bd4f8..868a0f6d 100644 --- a/zt-framework/zt-spring-boot-starter-biz-business/src/main/java/com/zt/plat/framework/business/config/ZtBusinessAutoConfiguration.java +++ b/zt-framework/zt-spring-boot-starter-biz-business/src/main/java/com/zt/plat/framework/business/config/ZtBusinessAutoConfiguration.java @@ -21,9 +21,11 @@ public class ZtBusinessAutoConfiguration implements WebMvcConfigurer { public void addInterceptors(InterceptorRegistry registry) { // 拦截所有 url,统一进行业务与文件上传请求头校验 registry.addInterceptor(new BusinessHeaderInterceptor()) - .addPathPatterns("/**"); + .addPathPatterns("/**") + .excludePathPatterns("/get*"); registry.addInterceptor(new FileUploadHeaderInterceptor()) - .addPathPatterns("/**"); + .addPathPatterns("/**") + .excludePathPatterns("/get*"); } @Bean From c3502e78c80e69abf819b1edcf4e606f73091cbd Mon Sep 17 00:00:00 2001 From: chenbowen Date: Fri, 9 Jan 2026 15:25:42 +0800 Subject: [PATCH 06/10] =?UTF-8?q?1.=20=E8=B0=83=E6=95=B4=20databus=20?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E7=9A=84=E9=87=8D=E8=AF=95=E7=AD=96=E7=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../integration/gateway/step/impl/HttpStepHandler.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zt-module-databus/zt-module-databus-server/src/main/java/com/zt/plat/module/databus/framework/integration/gateway/step/impl/HttpStepHandler.java b/zt-module-databus/zt-module-databus-server/src/main/java/com/zt/plat/module/databus/framework/integration/gateway/step/impl/HttpStepHandler.java index 7f00b6ce..db205143 100644 --- a/zt-module-databus/zt-module-databus-server/src/main/java/com/zt/plat/module/databus/framework/integration/gateway/step/impl/HttpStepHandler.java +++ b/zt-module-databus/zt-module-databus-server/src/main/java/com/zt/plat/module/databus/framework/integration/gateway/step/impl/HttpStepHandler.java @@ -46,9 +46,9 @@ public class HttpStepHandler implements ApiStepHandler { private final WebClient.Builder webClientBuilder; private final ExpressionExecutor expressionExecutor; - private static final Duration RETRY_DELAY = Duration.ofMillis(200); - private static final int RETRY_ATTEMPTS = 3; - private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(20); + private static final Duration RETRY_DELAY = Duration.ofSeconds(5); + private static final int RETRY_ATTEMPTS = 5; + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(40); private static final Set DEFAULT_FORWARDED_HEADERS = Set.of( "authorization", From 1fd704fe9d3df706d2def4fb341c41a2b62a56b5 Mon Sep 17 00:00:00 2001 From: lzx <1234> Date: Fri, 9 Jan 2026 15:33:33 +0800 Subject: [PATCH 07/10] =?UTF-8?q?fix(databus):=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=90=8C=E6=AD=A5=E7=9A=84=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=BA=90=E8=BF=87=E6=BB=A4=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将用户同步的数据源从 userSource = 2 更新为 userSource = 3 - 修正了数据总线用户提供者API中的查询条件配置 --- .../module/system/api/databus/DatabusUserProviderApiImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zt-module-system/zt-module-system-server/src/main/java/com/zt/plat/module/system/api/databus/DatabusUserProviderApiImpl.java b/zt-module-system/zt-module-system-server/src/main/java/com/zt/plat/module/system/api/databus/DatabusUserProviderApiImpl.java index f6b9050a..4e2f53e8 100644 --- a/zt-module-system/zt-module-system-server/src/main/java/com/zt/plat/module/system/api/databus/DatabusUserProviderApiImpl.java +++ b/zt-module-system/zt-module-system-server/src/main/java/com/zt/plat/module/system/api/databus/DatabusUserProviderApiImpl.java @@ -54,8 +54,8 @@ public class DatabusUserProviderApiImpl implements DatabusUserProviderApi { // 构建游标查询条件 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - // ⚠️ 只同步 userSource = 2 的用户 - queryWrapper.eq(AdminUserDO::getUserSource, 2); + // ⚠️ 只同步 userSource = 3 的用户 + queryWrapper.eq(AdminUserDO::getUserSource, 3); // 游标条件:create_time > cursorTime OR (create_time = cursorTime AND id > cursorId) if (!reqDTO.isFirstPage()) { From f8f584b9ff41405173060c4f616e3090b08cc334 Mon Sep 17 00:00:00 2001 From: lzx <1234> Date: Fri, 9 Jan 2026 15:50:18 +0800 Subject: [PATCH 08/10] =?UTF-8?q?fix(databus):=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=90=8C=E6=AD=A5=E7=9A=84=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=BA=90=E8=BF=87=E6=BB=A4=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将用户同步的数据源从 userSource = 2 更新为 userSource = 3 - 修正了数据总线用户提供者API中的查询条件配置 --- .../system/api/databus/DatabusUserProviderApiImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/zt-module-system/zt-module-system-server/src/main/java/com/zt/plat/module/system/api/databus/DatabusUserProviderApiImpl.java b/zt-module-system/zt-module-system-server/src/main/java/com/zt/plat/module/system/api/databus/DatabusUserProviderApiImpl.java index 4e2f53e8..3157ad2c 100644 --- a/zt-module-system/zt-module-system-server/src/main/java/com/zt/plat/module/system/api/databus/DatabusUserProviderApiImpl.java +++ b/zt-module-system/zt-module-system-server/src/main/java/com/zt/plat/module/system/api/databus/DatabusUserProviderApiImpl.java @@ -103,8 +103,8 @@ public class DatabusUserProviderApiImpl implements DatabusUserProviderApi { Long total = null; if (reqDTO.isFirstPage()) { LambdaQueryWrapper countWrapper = new LambdaQueryWrapper<>(); - // ⚠️ 只统计 userSource = 2 的用户 - countWrapper.eq(AdminUserDO::getUserSource, 2); + // ⚠️ 只统计 userSource = 3 的用户 + countWrapper.eq(AdminUserDO::getUserSource, 3); if (reqDTO.getTenantId() != null) { countWrapper.eq(AdminUserDO::getTenantId, reqDTO.getTenantId()); } @@ -148,8 +148,8 @@ public class DatabusUserProviderApiImpl implements DatabusUserProviderApi { @Override public CommonResult count(Long tenantId) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - // ⚠️ 只统计 userSource = 2 的用户 - queryWrapper.eq(AdminUserDO::getUserSource, 2); + // ⚠️ 只统计 userSource = 3 的用户 + queryWrapper.eq(AdminUserDO::getUserSource, 3); if (tenantId != null) { queryWrapper.eq(AdminUserDO::getTenantId, tenantId); } From 43c4c8a94ecb310edba5481a57b388ae6994fa6f Mon Sep 17 00:00:00 2001 From: lzx <1234> Date: Fri, 9 Jan 2026 17:02:02 +0800 Subject: [PATCH 09/10] =?UTF-8?q?fix(databus):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E9=83=A8=E9=97=A8=E6=95=B0=E6=8D=AE=E6=9F=A5=E8=AF=A2=E4=B8=AD?= =?UTF-8?q?=E7=BC=BA=E5=B0=91=E6=95=B0=E6=8D=AE=E6=BA=90=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在游标分页查询中添加部门数据源过滤条件 - 在总数统计查询中添加部门数据源过滤条件 - 在计数接口中添加部门数据源过滤条件 --- .../module/system/api/databus/DatabusDeptProviderApiImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zt-module-system/zt-module-system-server/src/main/java/com/zt/plat/module/system/api/databus/DatabusDeptProviderApiImpl.java b/zt-module-system/zt-module-system-server/src/main/java/com/zt/plat/module/system/api/databus/DatabusDeptProviderApiImpl.java index 909845dc..9c5e55b7 100644 --- a/zt-module-system/zt-module-system-server/src/main/java/com/zt/plat/module/system/api/databus/DatabusDeptProviderApiImpl.java +++ b/zt-module-system/zt-module-system-server/src/main/java/com/zt/plat/module/system/api/databus/DatabusDeptProviderApiImpl.java @@ -41,7 +41,7 @@ public class DatabusDeptProviderApiImpl implements DatabusDeptProviderApi { public CommonResult> getPageByCursor(CursorPageReqDTO reqDTO) { // 构建游标查询条件 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - + queryWrapper.eq(DeptDO::getDeptSource, 3); // 游标条件:create_time > cursorTime OR (create_time = cursorTime AND id > cursorId) if (!reqDTO.isFirstPage()) { queryWrapper.and(w -> w @@ -105,6 +105,7 @@ public class DatabusDeptProviderApiImpl implements DatabusDeptProviderApi { Long total = null; if (reqDTO.isFirstPage()) { LambdaQueryWrapper countWrapper = new LambdaQueryWrapper<>(); + countWrapper.eq(DeptDO::getDeptSource, 3); if (reqDTO.getTenantId() != null) { countWrapper.eq(DeptDO::getTenantId, reqDTO.getTenantId()); } @@ -175,6 +176,7 @@ public class DatabusDeptProviderApiImpl implements DatabusDeptProviderApi { @Override public CommonResult count(Long tenantId) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(DeptDO::getDeptSource, 3); if (tenantId != null) { queryWrapper.eq(DeptDO::getTenantId, tenantId); } From 041a89bb5984438f045f40ec619ca0264816b0b0 Mon Sep 17 00:00:00 2001 From: lzx <1234> Date: Fri, 9 Jan 2026 17:46:43 +0800 Subject: [PATCH 10/10] =?UTF-8?q?fix(user-dept):=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=9D=A5=E6=BA=90=E7=AD=9B=E9=80=89=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将用户来源筛选条件从 user_source = 2 更新为 user_source = 3 - 更新了查询用户部门关系的SQL条件 - 更新了统计用户部门关系数量的SQL条件 - 修正了相关注释说明 --- .../module/system/dal/mysql/userdept/UserDeptMapper.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/zt-module-system/zt-module-system-server/src/main/java/com/zt/plat/module/system/dal/mysql/userdept/UserDeptMapper.java b/zt-module-system/zt-module-system-server/src/main/java/com/zt/plat/module/system/dal/mysql/userdept/UserDeptMapper.java index bf21f41d..2ec5ad18 100644 --- a/zt-module-system/zt-module-system-server/src/main/java/com/zt/plat/module/system/dal/mysql/userdept/UserDeptMapper.java +++ b/zt-module-system/zt-module-system-server/src/main/java/com/zt/plat/module/system/dal/mysql/userdept/UserDeptMapper.java @@ -59,7 +59,7 @@ public interface UserDeptMapper extends BaseMapperX { @Select("") Long countWithUserSource(@Param("tenantId") Long tenantId); -} \ No newline at end of file +}