抓取失败返回优化
This commit is contained in:
@@ -418,7 +418,7 @@ public class MaterialInfoServiceImpl extends BaseServiceImpl<MaterialInfoMapper,
|
||||
public String catchPhoto(MultipartFile file){
|
||||
String photoStoragePath = "catch" + DateUtil.today() + "/";
|
||||
FileInfo fileInfo = fileService.upload(file, photoStoragePath, null, true, true);
|
||||
CheckUtils.throwIfEmpty(fileInfo.getUrl(),"上传失败,请重新上传");
|
||||
CheckUtils.throwIfNull(fileInfo,"照片上传失败");
|
||||
return fileInfo.getUrl();
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +100,9 @@ public class FileServiceImpl extends BaseServiceImpl<FileMapper, FileDO, FileRes
|
||||
}
|
||||
});
|
||||
// 处理本地存储文件 URL
|
||||
FileInfo fileInfo = uploadPretreatment.upload();
|
||||
FileInfo fileInfo = null;
|
||||
try {
|
||||
fileInfo = uploadPretreatment.upload();
|
||||
String domain = StrUtil.appendIfMissing(storage.getDomain(), StringConstants.SLASH);
|
||||
fileInfo.setUrl(URLUtil.normalize(domain + fileInfo.getPath() + fileInfo.getFilename()));
|
||||
if (StrUtil.isNotBlank(fileInfo.getThFilename())) {
|
||||
@@ -108,6 +110,9 @@ public class FileServiceImpl extends BaseServiceImpl<FileMapper, FileDO, FileRes
|
||||
} else {
|
||||
fileInfo.setThUrl(fileInfo.getUrl());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
return fileInfo;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user