From 2e8969f249c7278e0e923fdce4090ffd6d070dc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=BE=E6=96=87=E8=B1=AA?= <980287353@qq.com> Date: Thu, 12 Jan 2023 11:58:23 +0800 Subject: [PATCH] =?UTF-8?q?perf=EF=BC=9A=E6=96=87=E4=BB=B6=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E4=BF=9D=E7=95=99=E5=90=8E=E7=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/tiesheng/core/controller/ToolController.java | 4 ++-- .../java/com/tiesheng/core/service/FileUploadService.java | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/springboot-web/src/main/java/com/tiesheng/core/controller/ToolController.java b/springboot-web/src/main/java/com/tiesheng/core/controller/ToolController.java index a428e57..b4ad741 100644 --- a/springboot-web/src/main/java/com/tiesheng/core/controller/ToolController.java +++ b/springboot-web/src/main/java/com/tiesheng/core/controller/ToolController.java @@ -108,8 +108,8 @@ public class ToolController { */ @TokenIgnore @PostMapping("/file/chunk_merge") - public ApiResp fileChunkMerge(String fileMd5) { - String path = fileUploadService.chunkMerge(fileMd5); + public ApiResp fileChunkMerge(String fileMd5, String fileExt) { + String path = fileUploadService.chunkMerge(fileMd5, fileExt); return ApiResp.respOK(path); } diff --git a/springboot-web/src/main/java/com/tiesheng/core/service/FileUploadService.java b/springboot-web/src/main/java/com/tiesheng/core/service/FileUploadService.java index e7de5aa..c72945f 100644 --- a/springboot-web/src/main/java/com/tiesheng/core/service/FileUploadService.java +++ b/springboot-web/src/main/java/com/tiesheng/core/service/FileUploadService.java @@ -40,7 +40,7 @@ public class FileUploadService { String fileType = FileTypeUtil.getType(file.getInputStream(), file.getOriginalFilename()); tieshengWebConfigurer.uploadFileCheck(fileType); - FileUploadPath filePath = FileUploadPath.random(); + FileUploadPath filePath = FileUploadPath.random(fileType); InputStream stream = file.getInputStream(); FileUtil.writeFromStream(stream, filePath.getAbsolutePath()); @@ -107,7 +107,7 @@ public class FileUploadService { * * @param fileMd5 */ - public String chunkMerge(String fileMd5) { + public String chunkMerge(String fileMd5, String fileExt) { // 1,获取文件块的目录 FileUploadPath folder = FileUploadPath.folder(fileMd5); @@ -118,7 +118,7 @@ public class FileUploadService { } // 3,生成保存文件的路径 - FileUploadPath uploadPath = FileUploadPath.random(); + FileUploadPath uploadPath = FileUploadPath.random(fileExt); // 4,获取块文件,此列表是已经排好序的列表 List chunkFiles = getSortedChunkFiles(new File(folder.getAbsolutePath()));