From f891000086af5ac150fc120e1f3c781266f1d063 Mon Sep 17 00:00:00 2001 From: wzp <2040239371@qq.com> Date: 星期三, 21 八月 2024 17:13:57 +0800 Subject: [PATCH] 优化LAQ全景图图表,使用python生成 --- src/main/java/com/ots/common/utils/poi/WordUtil.java | 141 ++++++++++++++++++++++++---------------------- 1 files changed, 74 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..b9238b8 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; @@ -1326,69 +1327,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 +1554,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 +1716,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