修复:PPT预览使用PDF模式无效
This commit is contained in:
@ -81,7 +81,7 @@ public class FileConvertQueueTask {
|
||||
}
|
||||
|
||||
public boolean isNeedConvert(FileType fileType) {
|
||||
return fileType.equals(FileType.COMPRESS) || fileType.equals(FileType.OFFICE) || fileType.equals(FileType.CAD) || fileType.equals(FileType.PPT);
|
||||
return fileType.equals(FileType.COMPRESS) || fileType.equals(FileType.OFFICE) || fileType.equals(FileType.CAD);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,6 +73,8 @@ public class OfficeFilePreviewImpl implements FilePreview {
|
||||
}
|
||||
|
||||
static String getPreviewType(Model model, FileAttribute fileAttribute, String officePreviewType, String baseUrl, String pdfName, String outFilePath, FileHandlerService fileHandlerService, String officePreviewTypeImage, OtherFilePreviewImpl otherFilePreview) {
|
||||
String suffix = fileAttribute.getSuffix();
|
||||
boolean isPPT = suffix.equalsIgnoreCase("ppt") || suffix.equalsIgnoreCase("pptx");
|
||||
List<String> imageUrls = fileHandlerService.pdf2jpg(outFilePath, pdfName, baseUrl);
|
||||
if (imageUrls == null || imageUrls.size() < 1) {
|
||||
return otherFilePreview.notSupportedFile(model, fileAttribute, "office转图片异常,请联系管理员");
|
||||
@ -80,7 +82,8 @@ public class OfficeFilePreviewImpl implements FilePreview {
|
||||
model.addAttribute("imgurls", imageUrls);
|
||||
model.addAttribute("currentUrl", imageUrls.get(0));
|
||||
if (officePreviewTypeImage.equals(officePreviewType)) {
|
||||
return OFFICE_PICTURE_FILE_PREVIEW_PAGE;
|
||||
// PPT 图片模式使用专用预览页面
|
||||
return (isPPT ? PPT_FILE_PREVIEW_PAGE : OFFICE_PICTURE_FILE_PREVIEW_PAGE);
|
||||
} else {
|
||||
return PICTURE_FILE_PREVIEW_PAGE;
|
||||
}
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
package cn.keking.service.impl;
|
||||
|
||||
import cn.keking.model.FileAttribute;
|
||||
import cn.keking.service.FilePreview;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.ui.Model;
|
||||
|
||||
/**
|
||||
* @author kl (http://kailing.pub)
|
||||
* @since 2021/6/17
|
||||
*/
|
||||
@Service
|
||||
public class PptFilePreviewImpl implements FilePreview {
|
||||
|
||||
private final OfficeFilePreviewImpl officeFilePreview;
|
||||
|
||||
public PptFilePreviewImpl(OfficeFilePreviewImpl officeFilePreview) {
|
||||
this.officeFilePreview = officeFilePreview;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String filePreviewHandle(String url, Model model, FileAttribute fileAttribute) {
|
||||
officeFilePreview.filePreviewHandle(url,model,fileAttribute);
|
||||
return PPT_FILE_PREVIEW_PAGE;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user