更新新增三个模块
This commit is contained in:
+3
-2
@@ -46,8 +46,9 @@ public class FileUploadController {
|
||||
})
|
||||
public ApiResponse<UploadFileVo> upload(
|
||||
@Parameter(name = "file", description = "待上传的 Excel 或业务源文件", required = true, in = ParameterIn.QUERY)
|
||||
MultipartFile file) throws Exception {
|
||||
return ApiResponse.success(localFileStorageService.saveTempFile(file));
|
||||
MultipartFile file,
|
||||
@RequestParam(required = false) String relativePath) throws Exception {
|
||||
return ApiResponse.success(localFileStorageService.saveTempFile(file, relativePath));
|
||||
}
|
||||
|
||||
@GetMapping("/excel-info")
|
||||
|
||||
@@ -18,4 +18,7 @@ public class UploadFileVo {
|
||||
|
||||
@Schema(description = "文件大小")
|
||||
private Long size;
|
||||
|
||||
@Schema(description = "相对上传目录路径")
|
||||
private String relativePath;
|
||||
}
|
||||
|
||||
+2
-1
@@ -29,7 +29,7 @@ public class LocalFileStorageService {
|
||||
|
||||
private final StorageProperties storageProperties;
|
||||
|
||||
public UploadFileVo saveTempFile(MultipartFile file) throws IOException {
|
||||
public UploadFileVo saveTempFile(MultipartFile file, String relativePath) throws IOException {
|
||||
File tempDir = FileUtil.file(storageProperties.getLocalTempDir());
|
||||
File parentDir = tempDir.getParentFile();
|
||||
if (parentDir != null) {
|
||||
@@ -46,6 +46,7 @@ public class LocalFileStorageService {
|
||||
vo.setOriginalFilename(file.getOriginalFilename());
|
||||
vo.setLocalPath(target.getAbsolutePath());
|
||||
vo.setSize(file.getSize());
|
||||
vo.setRelativePath(relativePath);
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user