Commit 0a8cb56f authored by 廖旭伟's avatar 廖旭伟

避免文件路径不存在发生异常

parent 5bb63f86
......@@ -574,8 +574,13 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
throw new AppException("图片不能为空");
}
String imageName = new Date().getTime() + ".png";
String imagePath = "/file/uploadfile/"+imageName;
String imagePath = "file/uploadfile/";
String filePath = this.filePath.endsWith("/") ? this.filePath : this.filePath + "/" + imagePath;
File pathDir = new File(filePath);
if (!pathDir.exists()) {
pathDir.mkdirs();
}
filePath = filePath+imageName;
try{
ImageBase64.convertImg(base64.trim(),filePath);
formMap.put(key,imagePath);
......
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