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/project/tool/report/LAQ/chart/LAQChart.java | 37 ++++++++++++++++++++++--------------- 1 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/ots/project/tool/report/LAQ/chart/LAQChart.java b/src/main/java/com/ots/project/tool/report/LAQ/chart/LAQChart.java index b70254d..96f6808 100644 --- a/src/main/java/com/ots/project/tool/report/LAQ/chart/LAQChart.java +++ b/src/main/java/com/ots/project/tool/report/LAQ/chart/LAQChart.java @@ -2,6 +2,8 @@ import com.alibaba.fastjson.JSON; import com.ots.common.enums.CapabilityEnum; +import com.ots.common.enums.LangTypeEnum; +import com.ots.common.enums.ReportTypeEnum; import com.ots.common.utils.DateUtils; import com.ots.common.utils.MapDataUtil; import com.ots.common.utils.StringUtils; @@ -10,9 +12,12 @@ import com.ots.framework.config.EssConfig; import com.ots.project.exam.domain.TReportTemplate; import com.ots.project.tool.PdfUtil; +import com.ots.project.tool.report.LAQ.LAQReport; import com.ots.project.tool.report.LAQ.LAQTemplate; import com.ots.project.tool.report.MAQ.base.RowData; import com.ots.project.tool.report.MAQ.base.SeriesData; +import com.ots.project.tool.report.MAQNEW.MAQReport_V2; +import com.ots.project.tool.report.ReportResultData; import lombok.extern.slf4j.Slf4j; import org.apache.poi.ooxml.POIXMLDocument; import org.apache.poi.ooxml.POIXMLDocumentPart; @@ -43,7 +48,7 @@ public static void main(String[] args) throws Exception { - String dataPath = "D:\\娴嬭瘎绯荤粺\\闇�姹俓\LAQ\\report\\LAQ琛ㄥご鏁版嵁鏂囦欢.xlsx"; + String dataPath = "D:\\娴嬭瘎绯荤粺\\闇�姹俓\2023\\5.棰嗗娼滃姏鎶ュ憡\\report\\LAQ琛ㄥご鏁版嵁鏂囦欢.xlsx"; // 鑾峰彇瀵煎叆鏁版嵁 File file = new File(dataPath); InputStream in = new FileInputStream(file); @@ -55,16 +60,18 @@ for (int i = 0; i < laqTemplateList.size(); i++) { LAQTemplate laqTemplate = laqTemplateList.get(i); //缁勮鎶ュ憡鎵�鐢ㄦ暟鎹� - Map<String, Object> textMap = new HashMap<>(); + Map<String, String> textMap = new HashMap<>(); textMap.put("sendEmailFileName",laqTemplate.getName()); textMap.put("nowDate", DateUtils.getDate()); MapDataUtil.objectToMap(laqTemplate,textMap); + LAQReport report = new LAQReport(); + ReportResultData resultData = report.getTemplateParameters(textMap, ReportTypeEnum.LAQ, LangTypeEnum.codeOf("English")); // TReportTemplate template = null; // String zipFileName = WordUtil.makeReportFile("D:\\娴嬭瘎绯荤粺\\闇�姹俓\LAQ\\report\\LAQ鑻辨枃鎶ュ憡-20230926.docx", template, textMap, new HashMap<>(), deleteStrList); // fileNameList.add(zipFileName); ZipSecureFile.setMinInflateRatio(0.001); - try (OutputStream os = new FileOutputStream("D:\\娴嬭瘎绯荤粺\\闇�姹俓\LAQ\\report\\LAQ.docx");XWPFDocument document = new XWPFDocument(POIXMLDocument.openPackage("D:\\娴嬭瘎绯荤粺\\闇�姹俓\LAQ\\report\\LAQ鑻辨枃鎶ュ憡-20230926.docx"))){ + try (OutputStream os = new FileOutputStream("D:\\娴嬭瘎绯荤粺\\闇�姹俓\2023\\5.棰嗗娼滃姏鎶ュ憡\\report\\LAQ.docx");XWPFDocument document = new XWPFDocument(POIXMLDocument.openPackage("D:\\娴嬭瘎绯荤粺\\闇�姹俓\2023\\5.棰嗗娼滃姏鎶ュ憡\\report\\LAQ鑻辨枃鎶ュ憡-20230926.docx"))){ Map<Integer,List<SeriesData>> seriesDatas = initData(textMap); changeChart(document,seriesDatas,textMap); document.write(os); @@ -82,19 +89,19 @@ * @param textMap * @return */ - public static Map<Integer,List<SeriesData>> initData(Map<String, Object> textMap){ + public static Map<Integer,List<SeriesData>> initData(Map<String, String> textMap){ Map<Integer,List<SeriesData>> seriesDataMap = new HashMap<>(); //鑾峰彇鍛戒腑鏁板�� - BigDecimal olas = (BigDecimal) textMap.get("olas"); - BigDecimal ca = (BigDecimal) textMap.get("ca"); - BigDecimal bla = (BigDecimal) textMap.get("bla"); - BigDecimal nr = (BigDecimal) textMap.get("nr"); - BigDecimal ar = (BigDecimal) textMap.get("ar"); - BigDecimal open = (BigDecimal) textMap.get("open"); - BigDecimal cons = (BigDecimal) textMap.get("cons"); - BigDecimal extra = (BigDecimal) textMap.get("extra"); - BigDecimal agree = (BigDecimal) textMap.get("agree"); - BigDecimal emosta = (BigDecimal) textMap.get("emosta"); + Double olas = Double.valueOf(textMap.get("olas")); + Double ca = Double.valueOf(textMap.get("ca")); + Double bla = Double.valueOf(textMap.get("bla")); + Double nr = Double.valueOf(textMap.get("nr")); + Double ar = Double.valueOf(textMap.get("ar")); + Double open = Double.valueOf(textMap.get("open")); + Double cons = Double.valueOf(textMap.get("cons")); + Double extra = Double.valueOf(textMap.get("extra")); + Double agree = Double.valueOf(textMap.get("agree")); + Double emosta = Double.valueOf(textMap.get("emosta")); // 鍥捐〃1 List<SeriesData> seriesDatas = Arrays.asList( @@ -259,7 +266,7 @@ * @param seriesDataMap * @param textMap 鏁版嵁婧� */ - public static void changeChart(XWPFDocument document, Map<Integer,List<SeriesData>> seriesDataMap, Map<String, Object> textMap) { + public static void changeChart(XWPFDocument document, Map<Integer,List<SeriesData>> seriesDataMap, Map<String, String> textMap) { if(StringUtils.isEmpty(textMap)){ return; } -- Gitblit v1.9.1