feat:更新上传文件接口

This commit is contained in:
2026-02-03 23:17:00 +08:00
parent 3e83adf4f8
commit 20da1e064b
4 changed files with 13 additions and 7 deletions

View File

@@ -34,9 +34,9 @@ public class FileController {
@Operation(summary = "上传aList文件")
@PostMapping(value = "/alist", consumes = "multipart/form-data")
public void uploadAListFile(@RequestParam("file") MultipartFile file,
@RequestParam("filePath") String filePath) {
aListService.uploadFile(file, filePath);
public String uploadAListFile(@RequestParam("file") MultipartFile file,
@RequestParam("filePath") String filePath) {
return aListService.uploadFile(file, filePath);
}
@Operation(summary = "上传文件块")

View File

@@ -3,5 +3,5 @@ package com.cxx.home.service;
import org.springframework.web.multipart.MultipartFile;
public interface AListService {
void uploadFile(MultipartFile file, String filePath);
String uploadFile(MultipartFile file, String filePath);
}

View File

@@ -53,7 +53,7 @@ public class AListServiceImpl implements AListService {
}
@Override
public void uploadFile(MultipartFile file, String filePath) {
public String uploadFile(MultipartFile file, String filePath) {
try {
String token = getAccessToken();
@@ -81,6 +81,8 @@ public class AListServiceImpl implements AListService {
Files.deleteIfExists(compressFile.toPath());
Files.deleteIfExists(tempFile.toPath());
return filePath;
} catch (Exception e) {
log.error("文件上传失败{}", e.getMessage());
throw new RuntimeException("文件上传失败", e);