Commit 633533ef by huluobin

update

parent c6ba23e7
...@@ -21,8 +21,6 @@ import java.io.FileOutputStream; ...@@ -21,8 +21,6 @@ import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.UUID; import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/** /**
* 费用模块文件上传、下载工具类 * 费用模块文件上传、下载工具类
...@@ -35,14 +33,11 @@ public class CostFileUtil { ...@@ -35,14 +33,11 @@ public class CostFileUtil {
public static String upload(MultipartFile file, String filePath) { public static String upload(MultipartFile file, String filePath) {
// 获取文件名 // 获取文件名
String fileName = file.getOriginalFilename(); String[] fileNames = file.getOriginalFilename().split(".");
// 去除中文 String suffix = fileNames[fileNames.length - 1];
Pattern pat = Pattern.compile(REGEX_CHINESE);
Matcher mat = pat.matcher(fileName);
fileName = mat.replaceAll("");
// fileName处理 // fileName处理
fileName = filePath + UUID.randomUUID() + "&" + fileName; String fileName = filePath + IdWorker.getIdStr() + "&" + IdWorker.getIdStr() + "." + suffix;
// 文件对象 // 文件对象
File dest = new File(fileName); File dest = new File(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