diff --git a/m2pool-modules/m2pool-file/src/main/java/com/m2pool/file/controller/SysFileController.java b/m2pool-modules/m2pool-file/src/main/java/com/m2pool/file/controller/SysFileController.java index 3f6265a..72dd388 100644 --- a/m2pool-modules/m2pool-file/src/main/java/com/m2pool/file/controller/SysFileController.java +++ b/m2pool-modules/m2pool-file/src/main/java/com/m2pool/file/controller/SysFileController.java @@ -38,7 +38,7 @@ public class SysFileController /** * 文件上传请求 */ - @PostMapping("upload") + @PostMapping("/upload") public R upload(MultipartFile file) { try diff --git a/m2pool-modules/m2pool-file/src/main/java/com/m2pool/file/service/LocalSysFileServiceImpl.java b/m2pool-modules/m2pool-file/src/main/java/com/m2pool/file/service/LocalSysFileServiceImpl.java index e9a871c..aedf812 100644 --- a/m2pool-modules/m2pool-file/src/main/java/com/m2pool/file/service/LocalSysFileServiceImpl.java +++ b/m2pool-modules/m2pool-file/src/main/java/com/m2pool/file/service/LocalSysFileServiceImpl.java @@ -20,7 +20,7 @@ public class LocalSysFileServiceImpl implements ISysFileService /** * 资源映射路径 前缀 */ - @Value("${file.prefix") + @Value("${file.prefix}") public String localFilePrefix; /** diff --git a/m2pool-modules/m2pool-file/src/main/java/com/m2pool/file/utils/FileUploadUtils.java b/m2pool-modules/m2pool-file/src/main/java/com/m2pool/file/utils/FileUploadUtils.java index 07ff888..f17f183 100644 --- a/m2pool-modules/m2pool-file/src/main/java/com/m2pool/file/utils/FileUploadUtils.java +++ b/m2pool-modules/m2pool-file/src/main/java/com/m2pool/file/utils/FileUploadUtils.java @@ -1,11 +1,5 @@ package com.m2pool.file.utils; -import java.io.File; -import java.io.IOException; -import java.nio.file.Paths; -import java.util.Objects; -import org.apache.commons.io.FilenameUtils; -import org.springframework.web.multipart.MultipartFile; import com.m2pool.common.core.exception.file.FileNameLengthLimitExceededException; import com.m2pool.common.core.exception.file.FileSizeLimitExceededException; import com.m2pool.common.core.exception.file.InvalidExtensionException; @@ -13,8 +7,13 @@ import com.m2pool.common.core.utils.DateUtils; import com.m2pool.common.core.utils.StringUtils; import com.m2pool.common.core.utils.file.MimeTypeUtils; import com.m2pool.common.core.utils.uuid.Seq; +import org.apache.commons.io.FilenameUtils; +import org.springframework.web.multipart.MultipartFile; -import javax.sound.midi.Soundbank; +import java.io.File; +import java.io.IOException; +import java.nio.file.Paths; +import java.util.Objects; /** * 文件上传工具类 @@ -81,6 +80,7 @@ public class FileUploadUtils String absPath = getAbsoluteFile(baseDir, fileName).getAbsolutePath(); file.transferTo(Paths.get(absPath)); + return getPathFileName(fileName); } diff --git a/m2pool-modules/m2pool-file/src/main/resources/bootstrap-test.yml b/m2pool-modules/m2pool-file/src/main/resources/bootstrap-test.yml index 22df5a2..ed9a36f 100644 --- a/m2pool-modules/m2pool-file/src/main/resources/bootstrap-test.yml +++ b/m2pool-modules/m2pool-file/src/main/resources/bootstrap-test.yml @@ -1,18 +1,19 @@ # Tomcat server: - port: 9300 + port: 9504 # Spring spring: application: # 应用名称 name: m2pool-file - cloud: nacos: discovery: # 服务注册地址 server-addr: 127.0.0.1:8808 + namespace: m2_test + group: m2_test_group config: # 配置中心地址 server-addr: 127.0.0.1:8808 @@ -22,8 +23,8 @@ spring: shared-configs: - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} file: - domain: https://www.m2pool.com - path: /var/www/html/web-test + domain: https://test.m2pool.com + path: /var/www/html/web_test # img: /img filepath: /home/ubuntu/web prefix: /statics \ No newline at end of file