From ad58ba3d20b080ef113cbd196000028f83308bb3 Mon Sep 17 00:00:00 2001
From: wzp <2040239371@qq.com>
Date: 星期三, 31 一月 2024 11:59:09 +0800
Subject: [PATCH] 多表要按sheet名获取数据,多表每次读取随机修正

---
 src/main/java/com/ots/common/utils/poi/WordUtil.java |   46 +++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 39 insertions(+), 7 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 937c127..549121a 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,15 @@
 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.APIFan.chart.APIFanChart;
+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;
@@ -1178,9 +1182,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銆丄PIFan鏂扮殑doc杞琾df
+            if(ReportTypeEnum.PAQ.getCode().equals(reportType) || ReportTypeEnum.MAQTR.getCode().equals(reportType)
+                    || ReportTypeEnum.CIAQ.getCode().equals(reportType) ||ReportTypeEnum.APIFan.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 shellTool = ShellTool.builder();
@@ -1280,14 +1287,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);
@@ -1407,7 +1431,15 @@
                 PAQChart.changeChart(document, textMap);
             } else if (StringUtils.equals(reportType, ReportTypeEnum.MAQTR.getCode())) {
                 MAQTRChart.changeMAQTRChart(document, dataPath);
-            } else {
+            } 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 if(StringUtils.equals(reportType, ReportTypeEnum.APIFan.getCode()))
+            {
+                APIFanChart.changeChart(document,textMap);
+            }
+            else {
                 return;
             }
         }catch (Exception e){

--
Gitblit v1.9.1