perf: 调整文件上传的接口
This commit is contained in:
@@ -4,6 +4,9 @@ package com.tiesheng.core.controller;
|
|||||||
import cn.hutool.captcha.LineCaptcha;
|
import cn.hutool.captcha.LineCaptcha;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import com.tiesheng.annotation.token.TokenIgnore;
|
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.dto.ImageCodeDTO;
|
||||||
import com.tiesheng.core.pojos.vo.PicVerifyVo;
|
import com.tiesheng.core.pojos.vo.PicVerifyVo;
|
||||||
import com.tiesheng.core.service.FileUploadService;
|
import com.tiesheng.core.service.FileUploadService;
|
||||||
@@ -68,8 +71,8 @@ public class ToolController {
|
|||||||
*/
|
*/
|
||||||
@TokenIgnore
|
@TokenIgnore
|
||||||
@PostMapping(value = "/file/chunk_start")
|
@PostMapping(value = "/file/chunk_start")
|
||||||
public ApiResp<String> fileChunkStart(String fileExt) {
|
public ApiResp<String> fileChunkStart(@RequestBody ChunkStartDTO dto) {
|
||||||
fileUploadService.chunkStart(fileExt);
|
fileUploadService.chunkStart(dto.getFileExt());
|
||||||
return ApiResp.respOK("");
|
return ApiResp.respOK("");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,8 +84,8 @@ public class ToolController {
|
|||||||
*/
|
*/
|
||||||
@TokenIgnore
|
@TokenIgnore
|
||||||
@PostMapping("/file/chunk_check")
|
@PostMapping("/file/chunk_check")
|
||||||
public ApiResp<Boolean> fileChunkCheck(String fileMd5, Integer chunk) {
|
public ApiResp<Boolean> fileChunkCheck(@RequestBody ChunkCheckDTO dto) {
|
||||||
boolean exist = fileUploadService.chunkCheck(fileMd5, chunk);
|
boolean exist = fileUploadService.chunkCheck(dto.getFileMd5(), dto.getChunk());
|
||||||
return ApiResp.respOK(exist);
|
return ApiResp.respOK(exist);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,8 +111,8 @@ public class ToolController {
|
|||||||
*/
|
*/
|
||||||
@TokenIgnore
|
@TokenIgnore
|
||||||
@PostMapping("/file/chunk_merge")
|
@PostMapping("/file/chunk_merge")
|
||||||
public ApiResp<String> fileChunkMerge(String fileMd5, String fileExt) {
|
public ApiResp<String> fileChunkMerge(@RequestBody ChunkMergeDTO dto) {
|
||||||
String path = fileUploadService.chunkMerge(fileMd5, fileExt);
|
String path = fileUploadService.chunkMerge(dto.getFileMd5(), dto.getFileExt());
|
||||||
return ApiResp.respOK(path);
|
return ApiResp.respOK(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user