From df19dcb31b846d96e26ab2c161652c51a0ec7de4 Mon Sep 17 00:00:00 2001
From: wzp <2040239371@qq.com>
Date: 星期三, 04 九月 2024 08:36:51 +0800
Subject: [PATCH] 优化日志提示文件

---
 src/main/java/com/ots/common/utils/poi/WordUtil.java |  151 ++++++++++++++++++++++++++++----------------------
 1 files changed, 84 insertions(+), 67 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 53c83c4..47f50ec 100644
--- a/src/main/java/com/ots/common/utils/poi/WordUtil.java
+++ b/src/main/java/com/ots/common/utils/poi/WordUtil.java
@@ -23,6 +23,7 @@
 import com.ots.project.tool.report.CIAQ.chart.CIAQChart;
 import com.ots.project.tool.report.JAQ.condition.JAQTeam;
 import com.ots.project.tool.report.LAQ.chart.LAQAllChart;
+import com.ots.project.tool.report.LAQ.chart.LAQAllPng;
 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;
@@ -1286,7 +1287,17 @@
                 // 鑾峰彇寮�濮嬫椂闂�
                 long startTime = System.currentTimeMillis();
 
+//                if(textMap.containsKey("allList"))
+//                {
+//                    PdfUtil.convertPDF(EssConfig.getProfile() + "/" + reportName);
+//                }
+//                else
+//                {
+//
+//                }
+
                 PdfUtil.dockerConvertPDF(EssConfig.getProfile(),EssConfig.getDocx2pdfPath(),reportName);
+
                 // 鑾峰彇缁撴潫鏃堕棿
                 long endTime = System.currentTimeMillis();
                 // 璁$畻鑰楁椂锛堝崟浣嶏細姣锛�
@@ -1326,69 +1337,69 @@
      * @return
      */
     private static List<String> reportNameList = new ArrayList<>();
-    public static String makeReportFileForLAQ(String fileName, TReportTemplate tReportTemplate, Map<String, Object> textMap, Map<Integer, Map<Integer, List<String[]>>> autoTableMap, List<String> deleteFileStrList,Integer index,Integer totalNum,Boolean cleanFlag) {
-        String returnMessage = "瀵煎嚭妯℃澘杞Щ閿欒:";
-        InputStream in = null;
-        FileOutputStream out = null;
-        String zipFilePath = "";
-        String reportName = "";
-
-        if(cleanFlag)
-        {
-            reportNameList = new ArrayList<>();
-        }
-
-        try {
-
-            String reportType = tReportTemplate.getReportType();
-            reportName = textMap.get("sendEmailFileName") + "_" + reportType + "_" + ReportTypeNameEnum.valueOf(tReportTemplate.getTemplateType()).getCode() + "_" + ReportTypeNameEnum.valueOf(tReportTemplate.getLangType()).getCode() + ".docx";
-            reportName = reportName.replaceAll(" ", "_");
-
-            reportNameList.add(reportName);
-
-            //妯℃澘鏂囦欢闇�瑕佸姞閿�
-            out = getDownLoadFileOutputStream(reportName);
-
-            long startTime1 = System.currentTimeMillis();
-            setChageWord(fileName, out, textMap, tReportTemplate.getReportType(), tReportTemplate.getDataPath(), autoTableMap);
-            // 鑾峰彇缁撴潫鏃堕棿
-            long endTime1 = System.currentTimeMillis();
-            // 璁$畻鑰楁椂锛堝崟浣嶏細姣锛�
-            long duration1 = endTime1 - startTime1;
-            log.info("setChageWord 绋嬪簭鎵ц鑰楁椂锛�" + duration1 + " 姣锛岀敓鎴愭姤鍛婏細"+reportName);
-
-            out.flush();
-
-//            if(ReportTypeEnum.LAQ.getCode().equals(reportType)){
-//                // 鑾峰彇寮�濮嬫椂闂�
-//                long startTime = System.currentTimeMillis();
+//    public static String makeReportFileForLAQ(String fileName, TReportTemplate tReportTemplate, Map<String, Object> textMap, Map<Integer, Map<Integer, List<String[]>>> autoTableMap, List<String> deleteFileStrList,Integer index,Integer totalNum,Boolean cleanFlag) {
+//        String returnMessage = "瀵煎嚭妯℃澘杞Щ閿欒:";
+//        InputStream in = null;
+//        FileOutputStream out = null;
+//        String zipFilePath = "";
+//        String reportName = "";
 //
-//                PdfUtil.dockerConvertPDF(EssConfig.getProfile(),EssConfig.getDocx2pdfPath(),reportName);
-//                // 鑾峰彇缁撴潫鏃堕棿
-//                long endTime = System.currentTimeMillis();
-//                // 璁$畻鑰楁椂锛堝崟浣嶏細姣锛�
-//                long duration = endTime - startTime;
-//                log.info("dockerConvertPDF 绋嬪簭鎵ц鑰楁椂锛�" + duration + " 姣锛岀敓鎴愭姤鍛婏細"+reportName);
+//        if(cleanFlag)
+//        {
+//            reportNameList = new ArrayList<>();
+//        }
+//
+//        try {
+//
+//            String reportType = tReportTemplate.getReportType();
+//            reportName = textMap.get("sendEmailFileName") + "_" + reportType + "_" + ReportTypeNameEnum.valueOf(tReportTemplate.getTemplateType()).getCode() + "_" + ReportTypeNameEnum.valueOf(tReportTemplate.getLangType()).getCode() + ".docx";
+//            reportName = reportName.replaceAll(" ", "_");
+//
+//            reportNameList.add(reportName);
+//
+//            //妯℃澘鏂囦欢闇�瑕佸姞閿�
+//            out = getDownLoadFileOutputStream(reportName);
+//
+//            long startTime1 = System.currentTimeMillis();
+//            setChageWord(fileName, out, textMap, tReportTemplate.getReportType(), tReportTemplate.getDataPath(), autoTableMap);
+//            // 鑾峰彇缁撴潫鏃堕棿
+//            long endTime1 = System.currentTimeMillis();
+//            // 璁$畻鑰楁椂锛堝崟浣嶏細姣锛�
+//            long duration1 = endTime1 - startTime1;
+//            log.info("setChageWord 绋嬪簭鎵ц鑰楁椂锛�" + duration1 + " 姣锛岀敓鎴愭姤鍛婏細"+reportName);
+//
+//            out.flush();
+//
+////            if(ReportTypeEnum.LAQ.getCode().equals(reportType)){
+////                // 鑾峰彇寮�濮嬫椂闂�
+////                long startTime = System.currentTimeMillis();
+////
+////                PdfUtil.dockerConvertPDF(EssConfig.getProfile(),EssConfig.getDocx2pdfPath(),reportName);
+////                // 鑾峰彇缁撴潫鏃堕棿
+////                long endTime = System.currentTimeMillis();
+////                // 璁$畻鑰楁椂锛堝崟浣嶏細姣锛�
+////                long duration = endTime - startTime;
+////                log.info("dockerConvertPDF 绋嬪簭鎵ц鑰楁椂锛�" + duration + " 姣锛岀敓鎴愭姤鍛婏細"+reportName);
+////            }
+//            if(Objects.equals(index, totalNum))
+//            {
+//                //骞惰杞崲
+//                execLAQ2PDF(reportNameList);
 //            }
-            if(Objects.equals(index, totalNum))
-            {
-                //骞惰杞崲
-                execLAQ2PDF(reportNameList);
-            }
-
-            zipFilePath = getPdfPath(reportName);
-
-            deleteFileStrList.add(EssConfig.getProfile() + "/" + reportName);
-        } catch (Exception ex) {
-            returnMessage = returnMessage + ex.getMessage();
-            deleteFileStrList.add(EssConfig.getProfile() + "/" + reportName);
-            log.error("瀵煎嚭妯℃澘杞Щ閿欒锛歿}\n妫�鏌ユ枃浠讹細" + fileName, returnMessage, ex);
-        } finally {
-            closeChannel(out);
-            closeChannel(in);
-        }
-        return zipFilePath;
-    }
+//
+//            zipFilePath = getPdfPath(reportName);
+//
+//            deleteFileStrList.add(EssConfig.getProfile() + "/" + reportName);
+//        } catch (Exception ex) {
+//            returnMessage = returnMessage + ex.getMessage();
+//            deleteFileStrList.add(EssConfig.getProfile() + "/" + reportName);
+//            log.error("瀵煎嚭妯℃澘杞Щ閿欒锛歿}\n妫�鏌ユ枃浠讹細" + fileName, returnMessage, ex);
+//        } finally {
+//            closeChannel(out);
+//            closeChannel(in);
+//        }
+//        return zipFilePath;
+//    }
 
 
     private static void execLAQ2PDF(List<String> reportNames)
@@ -1553,6 +1564,12 @@
 
         //璁剧疆鍥捐〃鎺т欢
         changChart(textMap, document, reportType,dataPath);
+
+        //濡傛灉鏄疞AQ鐨勫叏鏅浘锛岃缃浘琛�
+        if (StringUtils.equals(reportType, ReportTypeEnum.LAQ.getCode())&& textMap.containsKey("allList")){
+            LAQAllPng.changeChart(document,textMap);
+        }
+
         document.write(out);
     }
 
@@ -1709,16 +1726,16 @@
             } else if (StringUtils.equals(reportType, ReportTypeEnum.CIAQ.getCode())) {
                 CIAQChart.changeChart(document, textMap);
             } else if (StringUtils.equals(reportType, ReportTypeEnum.LAQ.getCode())) {
-                if(!textMap.containsKey("allList"))
+                if(textMap.containsKey("allList"))
                 {
-                    System.out.println("涓汉鐢ㄦ埛鎶ュ憡");
-                    LAQChart.changeChart(document, textMap);
+                    log.info("銆愮敓鎴愬叏鏅浘鎶ュ憡銆�");
+                    //濡傛灉鍖呭惈allList锛屽垯娓叉煋鍏ㄦ櫙鍥惧浘琛�
+                    LAQAllChart.changeChart(document,textMap);
                 }
                 else
                 {
-                    System.out.println("鍏ㄦ櫙鍥炬姤鍛�");
-                    //濡傛灉鍖呭惈allList锛屽垯娓叉煋鍏ㄦ櫙鍥惧浘琛�
-                    LAQAllChart.changeChart(document,textMap);
+                    log.info("鐢熸垚鐨勬槸涓汉鐢ㄦ埛鎶ュ憡");
+                    LAQChart.changeChart(document, textMap);
                 }
             } else if(StringUtils.equals(reportType, ReportTypeEnum.API_Fan.getCode()))
             {

--
Gitblit v1.9.1