diff --git a/zkh-common/pom.xml b/zkh-common/pom.xml
index 604acc3..78185f5 100644
--- a/zkh-common/pom.xml
+++ b/zkh-common/pom.xml
@@ -14,6 +14,14 @@
Common utilities and base classes for ZKH framework
+
+ jakarta.validation
+ jakarta.validation-api
+
+
+ jakarta.annotation
+ jakarta.annotation-api
+
jakarta.persistence
jakarta.persistence-api
@@ -32,12 +40,23 @@
org.springdoc
- springdoc-openapi-common
+ springdoc-openapi-starter-webmvc-ui
+ 2.8.14
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.14.1
+
+
+ -parameters
+
+
+
org.apache.maven.plugins
maven-source-plugin
diff --git a/zkh-data/pom.xml b/zkh-data/pom.xml
index c3b7075..caf900b 100644
--- a/zkh-data/pom.xml
+++ b/zkh-data/pom.xml
@@ -46,6 +46,9 @@
1.18.42
+
+ -parameters
+
diff --git a/zkh-file/pom.xml b/zkh-file/pom.xml
index 3aad25f..1b4d9d4 100644
--- a/zkh-file/pom.xml
+++ b/zkh-file/pom.xml
@@ -39,12 +39,6 @@
hutool-all
5.8.41
-
- org.springdoc
- springdoc-openapi-starter-webmvc-ui
- 2.8.14
- provided
-
@@ -60,6 +54,9 @@
spring-boot-configuration-processor
+
+ -parameters
+
diff --git a/zkh-file/src/main/java/vip/jcfd/file/controller/FileController.java b/zkh-file/src/main/java/vip/jcfd/file/controller/FileController.java
index 5087420..030db38 100644
--- a/zkh-file/src/main/java/vip/jcfd/file/controller/FileController.java
+++ b/zkh-file/src/main/java/vip/jcfd/file/controller/FileController.java
@@ -9,6 +9,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.Resource;
+import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@@ -25,49 +26,49 @@ import java.nio.file.Paths;
@RestController("_fileController")
@RequestMapping("/file")
public class FileController {
- private final static Logger log = LoggerFactory.getLogger(FileController.class);
- private final IFileUploadService fileUploadService;
- private final IFileDownloadService fileDownloadService;
+ private final static Logger log = LoggerFactory.getLogger(FileController.class);
+ private final IFileUploadService fileUploadService;
+ private final IFileDownloadService fileDownloadService;
- public FileController(IFileUploadService fileUploadService, IFileDownloadService fileDownloadService) {
- this.fileUploadService = fileUploadService;
- this.fileDownloadService = fileDownloadService;
- }
+ public FileController(IFileUploadService fileUploadService, IFileDownloadService fileDownloadService) {
+ this.fileUploadService = fileUploadService;
+ this.fileDownloadService = fileDownloadService;
+ }
- @Operation(summary = "上传文件", description = "上传文件到服务器")
- @ApiResponse(responseCode = "200", description = "上传成功",
- content = @Content(mediaType = "application/json",
- schema = @Schema(implementation = R.class)))
- @PostMapping
- public R upload(
- @Parameter(description = "要上传的文件", required = true)
- MultipartFile file) {
- try {
- FileInfo upload = fileUploadService.upload(file);
- return R.success(upload);
- } catch (IOException e) {
- log.error("上传失败", e);
- return R.serverError("上传失败");
- }
- }
+ @Operation(summary = "上传文件", description = "上传文件到服务器")
+ @ApiResponse(responseCode = "200", description = "上传成功",
+ content = @Content(mediaType = "application/json",
+ schema = @Schema(implementation = R.class)))
+ @PostMapping(consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
+ public R upload(
+ @Parameter(description = "要上传的文件", required = true, name = "file")
+ @RequestPart("file") MultipartFile file) {
+ try {
+ FileInfo upload = fileUploadService.upload(file);
+ return R.success(upload);
+ } catch (IOException e) {
+ log.error("上传失败", e);
+ return R.serverError("上传失败");
+ }
+ }
- @Operation(summary = "下载文件", description = "根据文件路径下载文件")
- @ApiResponse(responseCode = "200", description = "下载成功")
- @ApiResponse(responseCode = "404", description = "文件未找到")
- @GetMapping("{path}")
- public ResponseEntity download(
- @Parameter(description = "文件路径", required = true)
- @PathVariable String path) {
- Path normalize = Paths.get(path).normalize();
- try {
- Resource download = fileDownloadService.download(normalize.toString());
- return ResponseEntity.ok()
- .header("Content-Disposition", "attachment; filename=\"" + download.getFilename() + "\"")
- .body(download);
- } catch (IOException e) {
- log.error("下载失败", e);
- return ResponseEntity.notFound().build();
- }
- }
+ @Operation(summary = "下载文件", description = "根据文件路径下载文件")
+ @ApiResponse(responseCode = "200", description = "下载成功")
+ @ApiResponse(responseCode = "404", description = "文件未找到")
+ @GetMapping
+ public ResponseEntity download(
+ @Parameter(description = "文件路径", required = true)
+ @RequestParam("path") String path) {
+ Path normalize = Paths.get(path).normalize();
+ try {
+ Resource download = fileDownloadService.download(normalize.toString());
+ return ResponseEntity.ok()
+ .header("Content-Disposition", "attachment; filename=\"" + download.getFilename() + "\"")
+ .body(download);
+ } catch (IOException e) {
+ log.error("下载失败", e);
+ return ResponseEntity.notFound().build();
+ }
+ }
}
diff --git a/zkh-log/pom.xml b/zkh-log/pom.xml
index 74a32e8..5d6874c 100644
--- a/zkh-log/pom.xml
+++ b/zkh-log/pom.xml
@@ -26,6 +26,16 @@
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.14.1
+
+
+ -parameters
+
+
+
org.apache.maven.plugins
maven-source-plugin
diff --git a/zkh-web/pom.xml b/zkh-web/pom.xml
index dff30b3..d895c40 100644
--- a/zkh-web/pom.xml
+++ b/zkh-web/pom.xml
@@ -43,11 +43,6 @@
com.fasterxml.jackson.datatype
jackson-datatype-jsr310
-
- org.springdoc
- springdoc-openapi-starter-webmvc-ui
- 2.8.14
-
@@ -63,6 +58,9 @@
spring-boot-configuration-processor
+
+ -parameters
+