feat: 1:文件访问分oss和s3 2:去掉定时任务去同步每天的数据

This commit is contained in:
2025-10-20 11:35:49 +08:00
parent a7f9338a71
commit fee28d98ef
31 changed files with 1076 additions and 3611 deletions
@@ -1,6 +1,6 @@
spring:
datasource:
url: jdbc:mysql://${zlt.datasource.ip}/file-center?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai
url: jdbc:mysql://${zlt.datasource.ip}/file-center-test?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai
username: ${zlt.datasource.username}
password: ${zlt.datasource.password}
driver-class-name: com.mysql.cj.jdbc.Driver
@@ -28,7 +28,7 @@ zlt:
file-server:
type: oss # 主存储类型(用于文件上传)
s3:
enabled: true # 启用S3服务(用于冷数据存储)
enabled: true
access-key: ${zlt.s3.access-key}
accessKeySecret: ${zlt.s3.accessKeySecret}
endpoint: ${zlt.s3.endpoint}
@@ -45,9 +45,12 @@ zlt:
secretKey: ${zlt.oss.secretKey}
endpoint: ${zlt.oss.endpoint}
bucketName: ${zlt.oss.bucketName}
# 时间窗口存储配置
storage:
hot-data-days: 30 # 热数据保留天数
time-router:
# 开启按时间路由
enabled: true
# 阈值天数;<=90 天走 OSS,>90 天走 MinIO
days: 10
#多租户配置
tenant:
enable: false
@@ -75,9 +78,15 @@ aliyun:
default-batch-size: 100
# 任务等待超时时间(秒)
task-timeout: 300
cdn:
enabled: true
oss:
domain: cdn.goflytec.com
s3:
domain: minicdn.goflytec.com
# 日志配置
logging:
level:
com.central.file.service.impl.CdnServiceImpl: DEBUG
com.central.file.schedule.CdnScheduleTask: INFO
com.central.file.schedule.CdnScheduleTask: INFO
@@ -1,6 +1,3 @@
server:
port: 5000
spring:
application:
name: file-center
@@ -50,34 +50,6 @@
ORDER BY createTime DESC
</select>
<!-- 查询热数据文件列表 -->
<select id="selectHotDataFiles" resultType="com.central.common.model.FileInfo">
SELECT * FROM file_info
WHERE create_time >= #{hotDataThreshold}
AND size > 0
AND (storage_type IS NULL OR storage_type NOT LIKE '%S3%' OR storage_type NOT LIKE '%MINIO%')
AND (path IS NULL OR path NOT LIKE '%s3://%' OR path NOT LIKE '%minio%')
ORDER BY create_time DESC
LIMIT #{limit}
</select>
<!-- 根据存储类型查询文件 -->
<select id="selectFilesByStorageType" resultType="com.central.common.model.FileInfo">
SELECT * FROM file_info
WHERE storage_type = #{storageType}
AND size > 0
ORDER BY create_time DESC
LIMIT #{limit}
</select>
<!-- 查询需要同步的文件(不在S3中的OSS文件) -->
<select id="selectFilesNeedSync" resultType="com.central.common.model.FileInfo">
SELECT * FROM file_info
WHERE (storage_type IS NULL OR storage_type NOT LIKE '%S3%' OR storage_type NOT LIKE '%MINIO%')
AND (path IS NULL OR path NOT LIKE '%s3://%' OR path NOT LIKE '%minio%')
AND size > 0
ORDER BY create_time DESC
LIMIT #{limit}
</select>
<!-- 热数据同步相关查询已移除(外部同步) -->
</mapper>