update 文件上传服务完成
This commit is contained in:
parent
bcdbb2b538
commit
de4788319b
|
@ -38,7 +38,7 @@ public class SysFileController
|
||||||
/**
|
/**
|
||||||
* 文件上传请求
|
* 文件上传请求
|
||||||
*/
|
*/
|
||||||
@PostMapping("upload")
|
@PostMapping("/upload")
|
||||||
public R<SysFile> upload(MultipartFile file)
|
public R<SysFile> upload(MultipartFile file)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class LocalSysFileServiceImpl implements ISysFileService
|
||||||
/**
|
/**
|
||||||
* 资源映射路径 前缀
|
* 资源映射路径 前缀
|
||||||
*/
|
*/
|
||||||
@Value("${file.prefix")
|
@Value("${file.prefix}")
|
||||||
public String localFilePrefix;
|
public String localFilePrefix;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
package com.m2pool.file.utils;
|
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.FileNameLengthLimitExceededException;
|
||||||
import com.m2pool.common.core.exception.file.FileSizeLimitExceededException;
|
import com.m2pool.common.core.exception.file.FileSizeLimitExceededException;
|
||||||
import com.m2pool.common.core.exception.file.InvalidExtensionException;
|
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.StringUtils;
|
||||||
import com.m2pool.common.core.utils.file.MimeTypeUtils;
|
import com.m2pool.common.core.utils.file.MimeTypeUtils;
|
||||||
import com.m2pool.common.core.utils.uuid.Seq;
|
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();
|
String absPath = getAbsoluteFile(baseDir, fileName).getAbsolutePath();
|
||||||
file.transferTo(Paths.get(absPath));
|
file.transferTo(Paths.get(absPath));
|
||||||
|
|
||||||
return getPathFileName(fileName);
|
return getPathFileName(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,19 @@
|
||||||
# Tomcat
|
# Tomcat
|
||||||
server:
|
server:
|
||||||
port: 9300
|
port: 9504
|
||||||
|
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
# 应用名称
|
# 应用名称
|
||||||
name: m2pool-file
|
name: m2pool-file
|
||||||
|
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 127.0.0.1:8808
|
server-addr: 127.0.0.1:8808
|
||||||
|
namespace: m2_test
|
||||||
|
group: m2_test_group
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 127.0.0.1:8808
|
server-addr: 127.0.0.1:8808
|
||||||
|
@ -22,8 +23,8 @@ spring:
|
||||||
shared-configs:
|
shared-configs:
|
||||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
file:
|
file:
|
||||||
domain: https://www.m2pool.com
|
domain: https://test.m2pool.com
|
||||||
path: /var/www/html/web-test
|
path: /var/www/html/web_test
|
||||||
# img: /img
|
# img: /img
|
||||||
filepath: /home/ubuntu/web
|
filepath: /home/ubuntu/web
|
||||||
prefix: /statics
|
prefix: /statics
|
Loading…
Reference in New Issue