From 77f6cf1868777a27c033af7d6d4f2fe9d2afc30d Mon Sep 17 00:00:00 2001 From: 林致杰 <1003392067@qq.com> Date: 星期四, 19 十月 2023 18:26:43 +0800 Subject: [PATCH] LAQ支持,新增python转换 --- src/main/java/com/ots/common/utils/poi/WordUtil.java | 19 +++++++++++++------ 1 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/ots/common/utils/poi/WordUtil.java b/src/main/java/com/ots/common/utils/poi/WordUtil.java index c3b47de..18156be 100644 --- a/src/main/java/com/ots/common/utils/poi/WordUtil.java +++ b/src/main/java/com/ots/common/utils/poi/WordUtil.java @@ -18,11 +18,13 @@ 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.CIAQ.chart.CIAQChart; 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; import org.apache.poi.ooxml.POIXMLDocument; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; +import org.apache.poi.openxml4j.util.ZipSecureFile; import org.apache.poi.util.Units; import org.apache.poi.xwpf.usermodel.*; import org.apache.xmlbeans.XmlCursor; @@ -903,9 +905,8 @@ if (checkText(runValue)) { runValue = runValue.replaceAll("%.*%", ""); - runValue = runValue.replaceAll("N/A NONE", ""); - } + runValue = runValue.replaceAll("N/A NONE", ""); return runValue; } @@ -1179,9 +1180,12 @@ changColorIfJAQ(textMap, out, reportName, tReportTemplate.getReportType()); //} - //PAQ銆丮AQTR閲囩敤鏂扮殑doc杞琾df - if(ReportTypeEnum.PAQ.getCode().equals(reportType) || ReportTypeEnum.MAQTR.getCode().equals(reportType)){ + //PAQ銆丮AQTR閲囩敤銆丆IAQ鏂扮殑doc杞琾df + if(ReportTypeEnum.PAQ.getCode().equals(reportType) || ReportTypeEnum.MAQTR.getCode().equals(reportType) + || ReportTypeEnum.CIAQ.getCode().equals(reportType)){ PdfUtil.convertPDF(EssConfig.getProfile() + "/" + reportName); + }else if(ReportTypeEnum.LAQ.getCode().equals(reportType)){ + PdfUtil.convertPythonPDF(EssConfig.getDocx2pdf(),EssConfig.getProfile() + "/" + reportName); }else{ ShellTool.execLibreofficeCommand("pdf", EssConfig.getProfile() + "/" + reportName, EssConfig.getProfile() + "/"); // ShellTool shellTool = ShellTool.builder(); @@ -1281,6 +1285,7 @@ */ private static void setChageWord(String fileName, OutputStream out, Map<String, Object> textMap, String reportType,String dataPath, Map<Integer, Map<Integer, List<String[]>>> autoTableMap) throws IOException, InvalidFormatException, DocumentException { //String filePath = getTemplateDownLoadPathByUpLoad(fileName); + ZipSecureFile.setMinInflateRatio(0.001); XWPFDocument document = new XWPFDocument(POIXMLDocument.openPackage(getTemplateDownLoadPathByUpLoad(fileName))); @@ -1348,9 +1353,9 @@ repText = repText.replaceAll("<BoldText>", ""); repText = repText.replaceAll("</BoldText>", ""); } - if (repText.indexOf("N/A NONE") != -1) { +/* if (repText.indexOf("N/A NONE") != -1) { repText = repText.replaceAll("N/A NONE", ""); - } + }*/ return repText; } public static void changTableColor(String fileName, OutputStream out, List<JAQTableStyle> jaqTableStyleList) throws IOException { @@ -1408,6 +1413,8 @@ PAQChart.changeChart(document, textMap); } else if (StringUtils.equals(reportType, ReportTypeEnum.MAQTR.getCode())) { MAQTRChart.changeMAQTRChart(document, dataPath); + } else if (StringUtils.equals(reportType, ReportTypeEnum.CIAQ.getCode())) { + CIAQChart.changeChart(document, textMap); } else { return; } -- Gitblit v1.9.1