From 1cdef28ea38056e03e8a4785d19982c50ac64092 Mon Sep 17 00:00:00 2001 From: weizhihong Date: Sun, 9 Oct 2022 13:27:11 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90MINIO=E8=8E=B7=E5=8F=96=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E5=9C=B0=E5=9D=80=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/club/joylink/rtss/controller/MinioController.java | 5 +++++ src/main/java/club/joylink/rtss/services/MinioService.java | 2 ++ .../java/club/joylink/rtss/services/MinioServiceImpl.java | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/src/main/java/club/joylink/rtss/controller/MinioController.java b/src/main/java/club/joylink/rtss/controller/MinioController.java index 88c44d421..ab2e16325 100644 --- a/src/main/java/club/joylink/rtss/controller/MinioController.java +++ b/src/main/java/club/joylink/rtss/controller/MinioController.java @@ -23,6 +23,11 @@ public class MinioController { return minioService.preSignedObjectUrl(directory, fileName, method); } + @GetMapping("/downloadUrl") + public String downloadUrl(String directory, String fileName) { + return minioService.downloadObjectUrl(directory, fileName); + } + @PostMapping("/file/save") public void saveFile(@RequestAttribute AccountVO user, @RequestBody MinioFileInfo fileInfo) { minioService.saveFileInfo(user, fileInfo); diff --git a/src/main/java/club/joylink/rtss/services/MinioService.java b/src/main/java/club/joylink/rtss/services/MinioService.java index 4d50201d4..1141921a9 100644 --- a/src/main/java/club/joylink/rtss/services/MinioService.java +++ b/src/main/java/club/joylink/rtss/services/MinioService.java @@ -34,4 +34,6 @@ public interface MinioService { * 更新文件信息 */ void update(MinioFileInfo fileInfo); + + String downloadObjectUrl(String directory, String fileName); } diff --git a/src/main/java/club/joylink/rtss/services/MinioServiceImpl.java b/src/main/java/club/joylink/rtss/services/MinioServiceImpl.java index 20066b45c..1f7e9a780 100644 --- a/src/main/java/club/joylink/rtss/services/MinioServiceImpl.java +++ b/src/main/java/club/joylink/rtss/services/MinioServiceImpl.java @@ -80,4 +80,10 @@ public class MinioServiceImpl implements MinioService { public void update(MinioFileInfo fileInfo) { minioFileInfoDao.updateByPrimaryKeySelective(fileInfo); } + + @Override + public String downloadObjectUrl(String directory, String fileName) { + MinioClientUtil minioClientUtil = createMinioClientUtil(directory); + return minioClientUtil.getDownLoadPath(fileName); + } }