Add workflow bpmn file preview support (#441)

This commit is contained in:
kl
2023-03-09 21:00:03 +08:00
committed by GitHub
parent eb12ced77f
commit 09a3fd2db8
26 changed files with 64911 additions and 41 deletions

View File

@@ -18,12 +18,13 @@ import java.util.List;
* Content :图片文件处理
*/
@Service
public class PictureFilePreviewImpl implements FilePreview {
public class PictureFilePreviewImpl extends CommonPreviewImpl {
private final FileHandlerService fileHandlerService;
private final OtherFilePreviewImpl otherFilePreview;
public PictureFilePreviewImpl(FileHandlerService fileHandlerService, OtherFilePreviewImpl otherFilePreview) {
super(fileHandlerService, otherFilePreview);
this.fileHandlerService = fileHandlerService;
this.otherFilePreview = otherFilePreview;
}
@@ -39,21 +40,8 @@ public class PictureFilePreviewImpl implements FilePreview {
imgUrls.addAll(zipImgUrls);
}
// 不是http开头浏览器不能直接访问需下载到本地
if (url != null && !url.toLowerCase().startsWith("http")) {
ReturnResponse<String> response = DownloadUtils.downLoad(fileAttribute, null);
if (response.isFailure()) {
return otherFilePreview.notSupportedFile(model, fileAttribute, response.getMsg());
} else {
String file = fileHandlerService.getRelativePath(response.getContent());
imgUrls.clear();
imgUrls.add(file);
model.addAttribute("imgUrls", imgUrls);
model.addAttribute("currentUrl", file);
}
} else {
model.addAttribute("imgUrls", imgUrls);
model.addAttribute("currentUrl", url);
}
super.filePreviewHandle(url, model, fileAttribute);
model.addAttribute("imgUrls", imgUrls);
return PICTURE_FILE_PREVIEW_PAGE;
}
}