From fc4b3139aa3cc1a704e8f91f7a896e81538c6ffa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=BE=E6=96=87=E8=B1=AA?= <980287353@qq.com> Date: Tue, 7 Mar 2023 18:16:31 +0800 Subject: [PATCH] =?UTF-8?q?perf=EF=BC=9A=20=E8=B0=83=E6=95=B4=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=B8=8A=E4=BC=A0=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/controller/ToolController.java | 15 ++++++---- .../core/pojos/dto/ChunkCheckDTO.java | 30 +++++++++++++++++++ .../core/pojos/dto/ChunkMergeDTO.java | 30 +++++++++++++++++++ .../core/pojos/dto/ChunkStartDTO.java | 21 +++++++++++++ 4 files changed, 90 insertions(+), 6 deletions(-) create mode 100644 springboot-web/src/main/java/com/tiesheng/core/pojos/dto/ChunkCheckDTO.java create mode 100644 springboot-web/src/main/java/com/tiesheng/core/pojos/dto/ChunkMergeDTO.java create mode 100644 springboot-web/src/main/java/com/tiesheng/core/pojos/dto/ChunkStartDTO.java 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 b4ad741..129671e 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 @@ -4,6 +4,9 @@ package com.tiesheng.core.controller; import cn.hutool.captcha.LineCaptcha; import cn.hutool.core.util.IdUtil; import com.tiesheng.annotation.token.TokenIgnore; +import com.tiesheng.core.pojos.dto.ChunkCheckDTO; +import com.tiesheng.core.pojos.dto.ChunkMergeDTO; +import com.tiesheng.core.pojos.dto.ChunkStartDTO; import com.tiesheng.core.pojos.dto.ImageCodeDTO; import com.tiesheng.core.pojos.vo.PicVerifyVo; import com.tiesheng.core.service.FileUploadService; @@ -68,8 +71,8 @@ public class ToolController { */ @TokenIgnore @PostMapping(value = "/file/chunk_start") - public ApiResp fileChunkStart(String fileExt) { - fileUploadService.chunkStart(fileExt); + public ApiResp fileChunkStart(@RequestBody ChunkStartDTO dto) { + fileUploadService.chunkStart(dto.getFileExt()); return ApiResp.respOK(""); } @@ -81,8 +84,8 @@ public class ToolController { */ @TokenIgnore @PostMapping("/file/chunk_check") - public ApiResp fileChunkCheck(String fileMd5, Integer chunk) { - boolean exist = fileUploadService.chunkCheck(fileMd5, chunk); + public ApiResp fileChunkCheck(@RequestBody ChunkCheckDTO dto) { + boolean exist = fileUploadService.chunkCheck(dto.getFileMd5(), dto.getChunk()); return ApiResp.respOK(exist); } @@ -108,8 +111,8 @@ public class ToolController { */ @TokenIgnore @PostMapping("/file/chunk_merge") - public ApiResp fileChunkMerge(String fileMd5, String fileExt) { - String path = fileUploadService.chunkMerge(fileMd5, fileExt); + public ApiResp fileChunkMerge(@RequestBody ChunkMergeDTO dto) { + String path = fileUploadService.chunkMerge(dto.getFileMd5(), dto.getFileExt()); return ApiResp.respOK(path); } diff --git a/springboot-web/src/main/java/com/tiesheng/core/pojos/dto/ChunkCheckDTO.java b/springboot-web/src/main/java/com/tiesheng/core/pojos/dto/ChunkCheckDTO.java new file mode 100644 index 0000000..993b412 --- /dev/null +++ b/springboot-web/src/main/java/com/tiesheng/core/pojos/dto/ChunkCheckDTO.java @@ -0,0 +1,30 @@ +package com.tiesheng.core.pojos.dto; + +/** + * @author hao + */ +public class ChunkCheckDTO { + + private String fileMd5; + private Integer chunk; + + /////////////////////////////////////////////////////////////////////////// + // setter\getter + /////////////////////////////////////////////////////////////////////////// + + public String getFileMd5() { + return fileMd5; + } + + public void setFileMd5(String fileMd5) { + this.fileMd5 = fileMd5; + } + + public Integer getChunk() { + return chunk; + } + + public void setChunk(Integer chunk) { + this.chunk = chunk; + } +} diff --git a/springboot-web/src/main/java/com/tiesheng/core/pojos/dto/ChunkMergeDTO.java b/springboot-web/src/main/java/com/tiesheng/core/pojos/dto/ChunkMergeDTO.java new file mode 100644 index 0000000..49cb32d --- /dev/null +++ b/springboot-web/src/main/java/com/tiesheng/core/pojos/dto/ChunkMergeDTO.java @@ -0,0 +1,30 @@ +package com.tiesheng.core.pojos.dto; + +/** + * @author hao + */ +public class ChunkMergeDTO { + + private String fileMd5; + private String fileExt; + + /////////////////////////////////////////////////////////////////////////// + // setter\getter + /////////////////////////////////////////////////////////////////////////// + + public String getFileMd5() { + return fileMd5; + } + + public void setFileMd5(String fileMd5) { + this.fileMd5 = fileMd5; + } + + public String getFileExt() { + return fileExt; + } + + public void setFileExt(String fileExt) { + this.fileExt = fileExt; + } +} diff --git a/springboot-web/src/main/java/com/tiesheng/core/pojos/dto/ChunkStartDTO.java b/springboot-web/src/main/java/com/tiesheng/core/pojos/dto/ChunkStartDTO.java new file mode 100644 index 0000000..d99501f --- /dev/null +++ b/springboot-web/src/main/java/com/tiesheng/core/pojos/dto/ChunkStartDTO.java @@ -0,0 +1,21 @@ +package com.tiesheng.core.pojos.dto; + +/** + * @author hao + */ +public class ChunkStartDTO { + + private String fileExt; + + /////////////////////////////////////////////////////////////////////////// + // setter\getter + /////////////////////////////////////////////////////////////////////////// + + public String getFileExt() { + return fileExt; + } + + public void setFileExt(String fileExt) { + this.fileExt = fileExt; + } +}