From 7448455ac0568cbc5aca6b633f6eb4d82efac668 Mon Sep 17 00:00:00 2001
From: wzp <2040239371@qq.com>
Date: 星期二, 07 十一月 2023 09:17:10 +0800
Subject: [PATCH] 优化系统登录的信息

---
 src/main/java/com/ots/common/utils/poi/WordUtil.java |   54 ++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 40 insertions(+), 14 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 b8f1bd0..2912bf1 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,14 @@
 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.LAQ.chart.LAQChart;
 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 +906,8 @@
 
         if (checkText(runValue)) {
             runValue = runValue.replaceAll("%.*%", "");
-            runValue = runValue.replaceAll("N/A NONE", "");
-
         }
+        runValue = runValue.replaceAll("N/A NONE", "");
 
         return runValue;
     }
@@ -1172,23 +1174,26 @@
 
             //妯℃澘鏂囦欢闇�瑕佸姞閿�
             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 if(ReportTypeEnum.LAQ.getCode().equals(reportType)){
+                PdfUtil.dockerConvertPDF(EssConfig.getProfile(),EssConfig.getDocx2pdfPath(),reportName);
             }else{
-                // ShellTool.execLibreofficeCommand("pdf", EssConfig.getProfile() + "/" + reportName, EssConfig.getProfile() + "/");
+                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")));
+                //LibreOfficeUtil.convertOffice2PDFSyncIsSuccess(new File(EssConfig.getProfile() + "/" + reportName),new File(EssConfig.getProfile() + "/" + reportName.replace("docx","pdf")));
             }
             zipFilePath = getPdfPath(reportName);
 
@@ -1281,14 +1286,31 @@
      */
     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)));
 
-        //璁剧疆鏂囨湰
-        changeText(document, textMap);
+        if (StringUtils.equals(reportType, ReportTypeEnum.JAQ.getCode())) {
+            //璁剧疆鏂囨湰妗�
+            changeTextBox(document, textMap);
 
-        //璁剧疆鏂囨湰妗�
-        changeTextBox(document, textMap);
+            //璁剧疆鏂囨湰
+            changeText(document, textMap);
+        }else {
+            //璁剧疆鏂囨湰
+            changeText(document, textMap);
+
+            //璁剧疆鏂囨湰妗�
+            changeTextBox(document, textMap);
+        }
+
+//        //璁剧疆鏂囨湰妗�
+//        changeTextBox(document, textMap);
+//
+//        //璁剧疆鏂囨湰
+//        changeText(document, textMap);
+
+
 
         //鎻掑叆琛ㄦ牸
         addTableValue(document, autoTableMap);
@@ -1348,9 +1370,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 +1430,10 @@
                 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 if (StringUtils.equals(reportType, ReportTypeEnum.LAQ.getCode())) {
+                LAQChart.changeChart(document, textMap);
             } else {
                 return;
             }

--
Gitblit v1.9.1