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,
public String uploadAListFile(@RequestParam("file") MultipartFile file,
@RequestParam("filePath") String filePath) {
aListService.uploadFile(file, 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);

View File

@@ -6,7 +6,11 @@ spring:
name: @project.artifactId@
version: @project.version@
profiles:
active: docker
active: dev
servlet:
multipart:
max-file-size: 500MB
max-request-size: 500MB
mail:
host: smtp.163.com
port: 465
@@ -29,7 +33,7 @@ mybatis-plus:
mapper-locations: classpath*:/mapper/**/*.xml
configuration:
log-impl:
org.apache.ibatis.logging.stdout.StdOutImpl
# org.apache.ibatis.logging.stdout.StdOutImpl
web-starter:
base-package: com.cxx.home