提交 734f077b authored 作者: zhangshuang's avatar zhangshuang

文件前后缀

上级 0c9066ae
......@@ -31,4 +31,8 @@ public class FileSave {
private String path;//文件存储路径
@ApiModelProperty(name = "fileSize",value = "文件大小",notes = "文件大小",example = "973kb")
private String fileSize;//文件大小
@ApiModelProperty(name = "suffix",value = "文件名后缀",notes = "文件名后缀",example = "png")
private String suffix;//文件名后缀
@ApiModelProperty(name = "prefix",value = "文件名前缀",notes = "文件名前缀",example = "1")
private String prefix;//文件名前缀
}
......@@ -44,7 +44,7 @@ public interface FileUploadService {
ServerResponse merge(List<MergeRequest> uploadRequests);
/**
* 扫描仪
* 扫描仪文件接收
* @param httpServletRequest
* @return
*/
......
......@@ -124,10 +124,9 @@ public class FileUploadServiceImpl implements FileUploadService {
@Override
public ServerResponse upload(MultipartFile file, String md5File, Integer chunk) {
log.info("开始文件上传");
log.info("文件:" + file);
log.info("md5File" + md5File);
log.info("当前分片" + chunk);
log.info("文件名称" + file.getOriginalFilename());
log.info("md5File:" + md5File);
log.info("当前分片:" + chunk);
log.info("文件名称:" + file.getOriginalFilename());
String chunkPath = fileAddress + "/" + md5File + "/";//分片存放目录
File dirFile = new File(chunkPath);
if (!dirFile.exists()) {//目录不存在,创建目录
......@@ -169,7 +168,12 @@ public class FileUploadServiceImpl implements FileUploadService {
fileSave.setPath(savePath);//文件存储地址
long size = 0;
try {
fileSave.setRealName(new File(savePath).getName());
String realName = new File(savePath).getName();
fileSave.setRealName(realName);
String prefix = realName.substring(0,realName.lastIndexOf("."));
String suffix = realName.substring(realName.lastIndexOf("."));
fileSave.setPrefix(prefix);//文件名前缀
fileSave.setSuffix(suffix);//文件名后缀
fileOutputStream = new FileOutputStream(savePath);
} catch (FileNotFoundException e) {
e.printStackTrace();
......
......@@ -32,7 +32,7 @@ public class UnionApplication {
SpringApplication.run(UnionApplication.class, args);
}
@Bean
/* @Bean
public ServletWebServerFactory servletContainer() {
TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory() {
@Override
......@@ -57,5 +57,5 @@ public class UnionApplication {
connector.setRedirectPort(8082);
connector.setMaxPostSize(100*1024*1024);
return connector;
}
}*/
}
......@@ -26,10 +26,10 @@ spring.servlet.multipart.max-request-size=100MB
file.address=/Users/ljj/software/ftp
# SSL config f
server.ssl.key-store=classpath:3725333_filetransfer.products.zjtys.com.cn.pfx
# 证书密码,请修改为您自己证书的密码.
server.ssl.key-store-password=lR4072XF
# 秘钥库类型
server.ssl.keyStoreType=PKCS12
# 证书别名
server.ssl.keyAlias= alias
\ No newline at end of file
#server.ssl.key-store=classpath:3725333_filetransfer.products.zjtys.com.cn.pfx
## 证书密码,请修改为您自己证书的密码.
#server.ssl.key-store-password=lR4072XF
## 秘钥库类型
#server.ssl.keyStoreType=PKCS12
## 证书别名
#server.ssl.keyAlias= alias
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论