Commit a1ecb4bc by huluobin

update

parent 18bd2ade
......@@ -22,8 +22,6 @@ import java.io.IOException;
import java.io.OutputStream;
import java.util.UUID;
import static com.baomidou.mybatisplus.core.toolkit.StringPool.DOT;
/**
* 费用模块文件上传、下载工具类
*/
......@@ -35,11 +33,10 @@ public class CostFileUtil {
public static String upload(MultipartFile file, String filePath) {
// 获取文件名
String[] fileNames = file.getOriginalFilename().split(DOT);
String suffix = fileNames[fileNames.length - 1];
String fileName = file.getOriginalFilename().replaceAll("_", "");
// fileName处理
String fileName = filePath + IdWorker.getIdStr() + "&" + IdWorker.getIdStr() + "." + suffix;
fileName = filePath + UUID.randomUUID() + "&" + fileName;
// 文件对象
File dest = new File(fileName);
// 创建路径
......@@ -48,7 +45,8 @@ public class CostFileUtil {
}
try {
file.transferTo(dest);
} catch (IOException ignored) {
} catch (IOException e) {
// logger.error("affirmFile 发生错误",e);
}
return fileName;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment