修复:PPT预览使用PDF模式无效
parent
d4b72b06e9
commit
31187ccb69
|
@ -24,12 +24,10 @@ public enum FileType {
|
|||
FLV("flvFilePreviewImpl"),
|
||||
CAD("cadFilePreviewImpl"),
|
||||
TIFF("tiffFilePreviewImpl"),
|
||||
PPT("pptFilePreviewImpl"),
|
||||
OFD("ofdFilePreviewImpl");
|
||||
|
||||
|
||||
private static final String[] OFFICE_TYPES = {"docx", "wps", "doc", "xls", "xlsx"};
|
||||
private static final String[] PPT_TYPES = {"ppt", "pptx"};
|
||||
private static final String[] OFFICE_TYPES = {"docx", "wps", "doc", "xls", "xlsx", "ppt", "pptx"};
|
||||
private static final String[] PICTURE_TYPES = {"jpg", "jpeg", "png", "gif", "bmp", "ico", "raw"};
|
||||
private static final String[] ARCHIVE_TYPES = {"rar", "zip", "jar", "7-zip", "tar", "gzip", "7z"};
|
||||
private static final String[] TIFF_TYPES = {"tif", "tiff"};
|
||||
|
@ -68,9 +66,6 @@ public enum FileType {
|
|||
for (String ofd : OFD_TYPES) {
|
||||
FILE_TYPE_MAPPER.put(ofd, FileType.OFD);
|
||||
}
|
||||
for (String ppt : PPT_TYPES) {
|
||||
FILE_TYPE_MAPPER.put(ppt, FileType.PPT);
|
||||
}
|
||||
FILE_TYPE_MAPPER.put("md", FileType.MARKDOWN);
|
||||
FILE_TYPE_MAPPER.put("xml", FileType.XML);
|
||||
FILE_TYPE_MAPPER.put("pdf", FileType.PDF);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue