fix:修复Bug【69865】
报告管理-上传了ppt或PPT文件后,该文件无法预览
This commit is contained in:
@@ -37,6 +37,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
@@ -45,6 +46,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -429,7 +431,7 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
|||||||
@Override
|
@Override
|
||||||
public String reportHtml(String reportId, String fileId) {
|
public String reportHtml(String reportId, String fileId) {
|
||||||
try {
|
try {
|
||||||
String key = reportId + fileId;
|
String key = reportId + "-" + fileId;
|
||||||
String html = stringRedisTemplate.boundValueOps(key).get();
|
String html = stringRedisTemplate.boundValueOps(key).get();
|
||||||
//没有的话就生成
|
//没有的话就生成
|
||||||
if (StrUtil.isBlank(html)) {
|
if (StrUtil.isBlank(html)) {
|
||||||
@@ -833,7 +835,13 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
|||||||
} else if (ReportConstants.FILE_EXTENSIONS_DOCX.equalsIgnoreCase(fileEntity.getFileType())) {
|
} else if (ReportConstants.FILE_EXTENSIONS_DOCX.equalsIgnoreCase(fileEntity.getFileType())) {
|
||||||
html = WordUtil.doc2pdf(new FileInputStream(path), uploadFile, ipAddress);
|
html = WordUtil.doc2pdf(new FileInputStream(path), uploadFile, ipAddress);
|
||||||
} else if (ReportConstants.FILE_EXTENSIONS_PPT.equalsIgnoreCase(fileEntity.getFileType())) {
|
} else if (ReportConstants.FILE_EXTENSIONS_PPT.equalsIgnoreCase(fileEntity.getFileType())) {
|
||||||
html = PptUtil.doPpt2003toImage(new FileInputStream(path), uploadFile, ipAddress);
|
try {
|
||||||
|
html = PptUtil.doPpt2003toImage(new FileInputStream(path), uploadFile, ipAddress);
|
||||||
|
} catch (OfficeXmlFileException e) {
|
||||||
|
String newPath = path + "x";
|
||||||
|
cn.hutool.core.io.FileUtil.rename(new File(path), newPath, false, false);
|
||||||
|
html = PptUtil.doPpt2007toImage(new FileInputStream(newPath), uploadFile, ipAddress);
|
||||||
|
}
|
||||||
} else if (ReportConstants.FILE_EXTENSIONS_PPTX.equalsIgnoreCase(fileEntity.getFileType())) {
|
} else if (ReportConstants.FILE_EXTENSIONS_PPTX.equalsIgnoreCase(fileEntity.getFileType())) {
|
||||||
html = PptUtil.doPpt2007toImage(new FileInputStream(path), uploadFile, ipAddress);
|
html = PptUtil.doPpt2007toImage(new FileInputStream(path), uploadFile, ipAddress);
|
||||||
} else if (ReportConstants.FILE_EXTENSIONS_PDF.equalsIgnoreCase(fileEntity.getFileType())) {
|
} else if (ReportConstants.FILE_EXTENSIONS_PDF.equalsIgnoreCase(fileEntity.getFileType())) {
|
||||||
|
|||||||
Reference in New Issue
Block a user