[测评系统]--测评系统核心代码库
linzhijie
2023-02-14 07b356ba6331e4a0be8558d64bb3b5db804c4389
src/main/java/com/ots/common/utils/poi/WordUtil.java
@@ -17,6 +17,7 @@
import com.ots.project.tool.exam.ExamUtil;
import com.ots.project.tool.exam.ImageUtil;
import com.ots.project.tool.exam.ZipUtil;
import com.ots.project.tool.libreoffice.LibreOfficeUtil;
import com.ots.project.tool.report.MAQTR.chart.MAQTRChart;
import com.ots.project.tool.report.PAQ.chart.PAQChart;
import org.apache.commons.collections.map.HashedMap;
@@ -1171,20 +1172,23 @@
            //模板文件需要加锁
            out = getDownLoadFileOutputStream(reportName);
            synchronized (fileName.intern()){
            //synchronized (fileName.intern()){
                //String templateType = tReportTemplate.getTemplateType();
                setChageWord(fileName, out, textMap, tReportTemplate.getReportType(),tReportTemplate.getDataPath(), autoTableMap);
                out.flush();
                changColorIfJAQ(textMap, out, reportName, tReportTemplate.getReportType());
            }
            //}
            //PAQ、MAQTR采用新的doc转pdf
            if(ReportTypeEnum.PAQ.getCode().equals(reportType) || ReportTypeEnum.MAQTR.getCode().equals(reportType)){
                PdfUtil.convertPDF(EssConfig.getProfile() + "/" + reportName);
            }else{
                //ShellTool.execLibreofficeCommand("pdf", EssConfig.getProfile() + "/" + reportName, EssConfig.getProfile() + "/");
                ShellTool shellTool = ShellTool.builder();
                shellTool.execNewLibreofficeCommand("pdf", EssConfig.getProfile() + "/" + reportName, EssConfig.getProfile() + "/" + reportName.replace("docx","pdf"));
                ShellTool.execLibreofficeCommand("pdf", EssConfig.getProfile() + "/" + reportName, EssConfig.getProfile() + "/");
                // ShellTool shellTool = ShellTool.builder();
                // shellTool.execNewLibreofficeCommand("pdf", EssConfig.getProfile() + "/" + reportName, EssConfig.getProfile() + "/" + reportName.replace("docx","pdf"));
                //新方法测试
                //LibreOfficeUtil.convertOffice2PDFSyncIsSuccess(new File(EssConfig.getProfile() + "/" + reportName),new File(EssConfig.getProfile() + "/" + reportName.replace("docx","pdf")));
            }
            zipFilePath = getPdfPath(reportName);