From d75dcb2123b382f2286f257e7e2980713ddd7fd7 Mon Sep 17 00:00:00 2001
From: Iamasoldier <1272745473@qq.com>
Date: Fri, 27 Jun 2025 10:01:21 +0800
Subject: [PATCH] =?UTF-8?q?feat(=E6=96=87=E4=BB=B6=E4=B8=AD=E5=BF=83):?=
=?UTF-8?q?=E5=86=B7=E7=83=AD=E6=95=B0=E6=8D=AE=E5=88=87=E6=8D=A2=E8=AE=BF?=
=?UTF-8?q?=E9=97=AE=E6=96=87=E4=BB=B6=E8=B5=84=E6=BA=90=E5=8A=9F=E8=83=BD?=
=?UTF-8?q?=E5=A2=9E=E5=8A=A0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
zlt-business/file-center/pom.xml | 8 +-
.../file/controller/FileController.java | 52 ++-
.../controller/FileMigrationController.java | 119 ++++++
.../file/service/FileMigrationService.java | 263 +++++++++++++
.../service/StorageHealthCheckService.java | 82 +++++
.../service/TimeWindowStorageService.java | 305 ++++++++++++++++
.../central/file/service/impl/OssService.java | 2 +
.../central/file/service/impl/S3Service.java | 6 +-
.../src/main/resources/application.yml | 120 +++---
.../com/central/common/model/FileInfo.java | 7 +
.../com/central/oss/template/OssTemplate.java | 52 +++
.../com/central/oss/template/S3Template.java | 72 ++++
.../main/resources/application-dev.properties | 7 +-
.../resources/application-prod.properties | 5 +
.../src/main/resources/bootstrap.properties | 10 +-
zlt-doc/S3-MinIO配置说明.md | 269 ++++++++++++++
zlt-doc/启动问题修复说明.md | 320 ++++++++++++++++
zlt-doc/时间窗口智能存储方案.md | 345 ++++++++++++++++++
18 files changed, 1959 insertions(+), 85 deletions(-)
create mode 100644 zlt-business/file-center/src/main/java/com/central/file/controller/FileMigrationController.java
create mode 100644 zlt-business/file-center/src/main/java/com/central/file/service/FileMigrationService.java
create mode 100644 zlt-business/file-center/src/main/java/com/central/file/service/StorageHealthCheckService.java
create mode 100644 zlt-business/file-center/src/main/java/com/central/file/service/TimeWindowStorageService.java
create mode 100644 zlt-doc/S3-MinIO配置说明.md
create mode 100644 zlt-doc/启动问题修复说明.md
create mode 100644 zlt-doc/时间窗口智能存储方案.md
diff --git a/zlt-business/file-center/pom.xml b/zlt-business/file-center/pom.xml
index d7fefb8a..f86a25e6 100644
--- a/zlt-business/file-center/pom.xml
+++ b/zlt-business/file-center/pom.xml
@@ -79,13 +79,11 @@
com.github.tobato
fastdfs-client
-->
-
-
+
com.amazonaws
aws-java-sdk-s3
- -->
-
-
+
javax.xml.bind
diff --git a/zlt-business/file-center/src/main/java/com/central/file/controller/FileController.java b/zlt-business/file-center/src/main/java/com/central/file/controller/FileController.java
index 9b6a83f3..bdf610e0 100644
--- a/zlt-business/file-center/src/main/java/com/central/file/controller/FileController.java
+++ b/zlt-business/file-center/src/main/java/com/central/file/controller/FileController.java
@@ -4,6 +4,8 @@ import com.central.common.model.FileInfo;
import com.central.common.model.PageResult;
import com.central.common.model.Result;
import com.central.file.service.IFileService;
+import com.central.file.service.StorageHealthCheckService;
+import com.central.file.service.TimeWindowStorageService;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils;
@@ -34,6 +36,12 @@ public class FileController {
@Autowired
private IFileService fileService;
+ @Autowired
+ private TimeWindowStorageService timeWindowStorageService;
+
+ @Autowired
+ private StorageHealthCheckService storageHealthCheckService;
+
@Value("${zlt.security.tencent.accessTokenUrl}")
private String accessTokenUrl;
@@ -69,7 +77,7 @@ public class FileController {
@PostMapping(value = "/files-anon/file",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public String uploadFile(@RequestParam("file") MultipartFile file) throws Exception {
FileInfo fileInfo = fileService.upload(file);
- return fileService.getViewUrlByPath(fileInfo.getPath());
+ return timeWindowStorageService.getSmartViewUrlByPath(fileInfo.getPath());
}
/**
@@ -98,7 +106,7 @@ public class FileController {
PageResult pageResult = fileService.findList(params);
if(pageResult.getCount() >0){
for (FileInfo fileInfo: pageResult.getData()){
- fileInfo.setUrl(getViewUrlByPath(fileInfo.getName()));
+ fileInfo.setUrl(timeWindowStorageService.getSmartViewUrlByPath(fileInfo.getName()));
}
}
return pageResult;
@@ -107,24 +115,24 @@ public class FileController {
@GetMapping("/file/{id}")
public String getFileViewUrl(@PathVariable String id) {
log.info("请求文件可访问链接,参数文件Id:{}",id);
- String viewUrl = fileService.getViewUrl(id);
+ String viewUrl = timeWindowStorageService.getSmartViewUrl(id);
log.info("请求文件可访问链接,链接值:{}",viewUrl);
return viewUrl;
}
@GetMapping("/files/{id}")
public Result getViewUrl(@PathVariable String id) {
- return Result.succeed(fileService.getViewUrl(id),"获取成功");
+ return Result.succeed(timeWindowStorageService.getSmartViewUrl(id),"获取成功");
}
@GetMapping("/file/path")
public Result getFileViewUrlByPath(@RequestParam String path) {
- return Result.succeed(fileService.getViewUrlByPath(path),"获取成功");
+ return Result.succeed(timeWindowStorageService.getSmartViewUrlByPath(path),"获取成功");
}
@GetMapping("/files/path")
public String getViewUrlByPath(@RequestParam String path) {
- return fileService.getViewUrlByPath(path);
+ return timeWindowStorageService.getSmartViewUrlByPath(path);
}
@GetMapping("/files/path/style")
@@ -198,29 +206,41 @@ public class FileController {
HttpEntity