From 17011b3de2aa7d28c8d4016749c6c625a77ac1a8 Mon Sep 17 00:00:00 2001 From: 林致杰 <1003392067@qq.com> Date: 星期二, 17 十月 2023 18:23:32 +0800 Subject: [PATCH] LAQ支持 --- src/main/java/com/ots/common/utils/poi/WordUtil.java | 58 +++++++++++++++++++++++++++++++++++----------------------- 1 files changed, 35 insertions(+), 23 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 95c4305..4d7ec5d 100644 --- a/src/main/java/com/ots/common/utils/poi/WordUtil.java +++ b/src/main/java/com/ots/common/utils/poi/WordUtil.java @@ -17,6 +17,8 @@ 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.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; @@ -902,9 +904,8 @@ if (checkText(runValue)) { runValue = runValue.replaceAll("%.*%", ""); - runValue = runValue.replaceAll("N/A NONE", ""); - } + runValue = runValue.replaceAll("N/A NONE", ""); return runValue; } @@ -1171,20 +1172,24 @@ //妯℃澘鏂囦欢闇�瑕佸姞閿� 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銆丮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{ - //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); @@ -1344,9 +1349,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 { @@ -1393,19 +1398,26 @@ if (ExamUtil.isListEmpty(charts)) { return; } - if (StringUtils.equals(reportType, ReportTypeEnum.MAQ.getCode())) { - setMAQCompleteChars(textMap, charts); - } else if (StringUtils.equals(reportType, ReportTypeEnum.MAQV2.getCode()) || StringUtils.equals(reportType, ReportTypeEnum.MAQIAR.getCode())) { - setMAQ_V2CompleteChars(textMap, charts); - } else if (StringUtils.equals(reportType, ReportTypeEnum.RuiLin.getCode())) { - setRuiLinChar(textMap, charts); - } else if (StringUtils.equals(reportType, ReportTypeEnum.PAQ.getCode())) { - PAQChart.changeChart(document, textMap); - } else if (StringUtils.equals(reportType, ReportTypeEnum.MAQTR.getCode())) { - MAQTRChart.changeMAQTRChart(document, dataPath); - } else { - return; + try{ + if (StringUtils.equals(reportType, ReportTypeEnum.MAQ.getCode())) { + setMAQCompleteChars(textMap, charts); + } else if (StringUtils.equals(reportType, ReportTypeEnum.MAQV2.getCode()) || StringUtils.equals(reportType, ReportTypeEnum.MAQIAR.getCode())) { + setMAQ_V2CompleteChars(textMap, charts); + } else if (StringUtils.equals(reportType, ReportTypeEnum.RuiLin.getCode())) { + setRuiLinChar(textMap, charts); + } else if (StringUtils.equals(reportType, ReportTypeEnum.PAQ.getCode())) { + 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; + } + }catch (Exception e){ + e.printStackTrace(); } + } private static void setMAQ_V2CompleteChars(Map<String, Object> textMap, List<XWPFChart> charts) { String p_Task31 = textMap.get("P_Task31").toString(); -- Gitblit v1.9.1