From 560e61f5348aa726a19edd1ab380c84938cabd49 Mon Sep 17 00:00:00 2001 From: zhijie <1003392067@qq.com> Date: 星期三, 15 十一月 2023 23:23:45 +0800 Subject: [PATCH] 新增perfomance参数 --- src/main/java/com/ots/project/tool/report/LAQ/chart/LAQChart.java | 77 ++++++++++++++++++++++++++++---------- 1 files changed, 56 insertions(+), 21 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 96f6808..4ff2859 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 @@ -48,7 +48,7 @@ public static void main(String[] args) throws Exception { - String dataPath = "D:\\娴嬭瘎绯荤粺\\闇�姹俓\2023\\5.棰嗗娼滃姏鎶ュ憡\\report\\LAQ琛ㄥご鏁版嵁鏂囦欢.xlsx"; + /*String dataPath = "D:\\娴嬭瘎绯荤粺\\闇�姹俓\LAQ\\report\\LAQ琛ㄥご鏁版嵁鏂囦欢.xlsx"; // 鑾峰彇瀵煎叆鏁版嵁 File file = new File(dataPath); InputStream in = new FileInputStream(file); @@ -60,18 +60,30 @@ for (int i = 0; i < laqTemplateList.size(); i++) { LAQTemplate laqTemplate = laqTemplateList.get(i); //缁勮鎶ュ憡鎵�鐢ㄦ暟鎹� - Map<String, String> textMap = new HashMap<>(); - textMap.put("sendEmailFileName",laqTemplate.getName()); - textMap.put("nowDate", DateUtils.getDate()); - MapDataUtil.objectToMap(laqTemplate,textMap); + Map<String, Object> textMap = new HashMap<>(); +// textMap.put("sendEmailFileName",laqTemplate.getName()); +// textMap.put("nowDate", DateUtils.getDate()); +// MapDataUtil.objectToMap(laqTemplate,textMap); + textMap.put("olas","50"); + textMap.put("ca","32"); + textMap.put("bla","34"); + textMap.put("nr","3"); + textMap.put("ar","45"); + textMap.put("open","67"); + textMap.put("cons","12"); + textMap.put("extra","48"); + textMap.put("agree","90"); + textMap.put("emosta","23"); + textMap.put("perfomance","80"); + LAQReport report = new LAQReport(); - ReportResultData resultData = report.getTemplateParameters(textMap, ReportTypeEnum.LAQ, LangTypeEnum.codeOf("English")); +// 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:\\娴嬭瘎绯荤粺\\闇�姹俓\2023\\5.棰嗗娼滃姏鎶ュ憡\\report\\LAQ.docx");XWPFDocument document = new XWPFDocument(POIXMLDocument.openPackage("D:\\娴嬭瘎绯荤粺\\闇�姹俓\2023\\5.棰嗗娼滃姏鎶ュ憡\\report\\LAQ鑻辨枃鎶ュ憡-20230926.docx"))){ + try (OutputStream os = new FileOutputStream("D:\\娴嬭瘎绯荤粺\\闇�姹俓\LAQ\\report\\LAQ鑻辨枃妯℃澘-wzp-淇敼鐗�-1.docx");XWPFDocument document = new XWPFDocument(POIXMLDocument.openPackage("D:\\娴嬭瘎绯荤粺\\闇�姹俓\LAQ\\report\\LAQ鑻辨枃妯℃澘-wzp-淇敼鐗�.docx"))){ Map<Integer,List<SeriesData>> seriesDatas = initData(textMap); changeChart(document,seriesDatas,textMap); document.write(os); @@ -81,7 +93,17 @@ log.info("鍒犻櫎鐨勬枃浠跺悕:{}", JSON.toJSONString(deleteStrList)); WordUtil.deleteFileByStr(deleteStrList); - } + }*/ + } + + /** + * 鏇挎崲LAQ鍥捐〃鏁版嵁 + * @param document 鏂囨。瀵硅薄 + * @param textMap 鏁版嵁婧� + */ + public static void changeChart(XWPFDocument document, Map<String, Object> textMap) { + Map<Integer,List<SeriesData>> seriesDatas = initData(textMap); + changeChart(document,seriesDatas,textMap); } /** @@ -89,19 +111,20 @@ * @param textMap * @return */ - public static Map<Integer,List<SeriesData>> initData(Map<String, String> textMap){ + public static Map<Integer,List<SeriesData>> initData(Map<String, Object> textMap){ Map<Integer,List<SeriesData>> seriesDataMap = new HashMap<>(); //鑾峰彇鍛戒腑鏁板�� - 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")); + Double olas = Double.valueOf((String)textMap.get("olas")); + Double ca = Double.valueOf((String)textMap.get("ca")); + Double bla = Double.valueOf((String)textMap.get("bla")); + Double nr = Double.valueOf((String)textMap.get("nr")); + Double ar = Double.valueOf((String)textMap.get("ar")); + Double open = Double.valueOf((String)textMap.get("open")); + Double cons = Double.valueOf((String)textMap.get("cons")); + Double extra = Double.valueOf((String)textMap.get("extra")); + Double agree = Double.valueOf((String)textMap.get("agree")); + Double emosta = Double.valueOf((String)textMap.get("emosta")); + Double perfomance = Double.valueOf((String)textMap.get("perfomance")); // 鍥捐〃1 List<SeriesData> seriesDatas = Arrays.asList( @@ -257,6 +280,17 @@ ); seriesDataMap.put(10,seriesDatas); + // 鍥捐〃11 + seriesDatas = Arrays.asList( + new SeriesData("X 鍊�", Arrays.asList( + new RowData("X 鍊�", olas.doubleValue()) + )), + new SeriesData("Y 鍊�", Arrays.asList( + new RowData("Y 鍊�", perfomance.doubleValue()) + )) + ); + seriesDataMap.put(11,seriesDatas); + return seriesDataMap; } @@ -266,7 +300,7 @@ * @param seriesDataMap * @param textMap 鏁版嵁婧� */ - public static void changeChart(XWPFDocument document, Map<Integer,List<SeriesData>> seriesDataMap, Map<String, String> textMap) { + public static void changeChart(XWPFDocument document, Map<Integer,List<SeriesData>> seriesDataMap, Map<String, Object> textMap) { if(StringUtils.isEmpty(textMap)){ return; } @@ -308,7 +342,7 @@ //鏁g偣鍥� if (!plot.getScatterChartList().isEmpty()) { - List<SeriesData> seriesDatas = seriesDataMap.get(10); + List<SeriesData> seriesDatas = seriesDataMap.get(barIndex); CTScatterChart scatterChart = plot.getScatterChartArray(0); //System.out.println("鏁g偣鍥緖"+plot.getScatterChartList().size()+"}"); //鍒锋柊鍐呯疆excel鏁版嵁 @@ -325,6 +359,7 @@ updateScatterChart(seriesDatas, ser.getXVal(), ser.getYVal()); ++i; } + barIndex++; } } } -- Gitblit v1.9.1