优化文件获取异常处理
This commit is contained in:
@@ -21,6 +21,7 @@ import xtools.core.extend.TemplateUtils;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* <p>Title : SysCommonFileController</p>
|
||||
@@ -51,7 +52,7 @@ public class SysCommonFileController {
|
||||
) {
|
||||
try (ServletOutputStream outputStream = response.getOutputStream()) {
|
||||
response.setHeader("Cache-Control", "max-age=604800");
|
||||
sysFileOptService.download(id, outputStream, new SysFileDownloadCallback() {
|
||||
SysFileResp resp = sysFileOptService.download(id, outputStream, new SysFileDownloadCallback() {
|
||||
@Override
|
||||
public boolean before(SysFileResp fileInfo) {
|
||||
// 判断文件权限
|
||||
@@ -67,6 +68,9 @@ public class SysCommonFileController {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
if (Objects.isNull(resp)) {
|
||||
log.warn("文件获取失败,id={}", id);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("文件下载失败", e);
|
||||
throw new BizError("文件下载失败");
|
||||
|
||||
Reference in New Issue
Block a user