From 6620dc7b245127616cb580700eb026da03e96de5 Mon Sep 17 00:00:00 2001
From: wzp <2040239371@qq.com>
Date: 星期一, 30 十二月 2024 17:06:48 +0800
Subject: [PATCH] fix:PAQ报告增加当前年度时间

---
 src/main/java/com/ots/project/tool/report/APIFan/chart/APIFanChart.java |   37 +++++++++++++++++++++++++++++++++----
 1 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/ots/project/tool/report/APIFan/chart/APIFanChart.java b/src/main/java/com/ots/project/tool/report/APIFan/chart/APIFanChart.java
index afbcdb7..a9206b4 100644
--- a/src/main/java/com/ots/project/tool/report/APIFan/chart/APIFanChart.java
+++ b/src/main/java/com/ots/project/tool/report/APIFan/chart/APIFanChart.java
@@ -13,11 +13,13 @@
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.apache.poi.xwpf.usermodel.*;
 import org.openxmlformats.schemas.drawingml.x2006.chart.*;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
 
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
+import java.math.BigInteger;
 import java.util.*;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -73,7 +75,7 @@
             textMap.put("P_Impmg11","65");
             textMap.put("BST1","66");
             textMap.put("BST2","67");
-            textMap.put("box","1");
+            textMap.put("Box","1");
             changeChart(document,textMap);
             document.write(os);
         }catch (Exception e){
@@ -106,6 +108,11 @@
             String selectedPic = EssConfig.getReportTemplates()+"apifanSelected.png";
             String defaultPic =EssConfig.getReportTemplates()+"apifanDefalut.png";
 
+            //娴嬭瘯鐢ㄧ殑
+//            String selectedPic = "C:\\娴嬭瘎绯荤粺\\home\\reportTemplates\\apifanSelected.png";
+//            String defaultPic ="C:\\娴嬭瘎绯荤粺\\home\\reportTemplates\\apifanDefalut.png";
+
+
             // 閬嶅巻娈佃惤杩涜鏇挎崲鎿嶄綔
             synchronized (paragraphs) {
                 for (XWPFParagraph paragraph : paragraphs) {
@@ -115,7 +122,7 @@
                     if (text.contains("{{box0}}")) {  // 妫�鏌ユ槸鍚﹀寘鍚鏇挎崲鐨勬枃瀛楀彉閲�
                         String picturePath = ""; // 鍥剧墖璺緞
 
-                        String Box = (String) textMap.get("box");
+                        String Box = (String) textMap.get("Box");
                         int box = Integer.parseInt(Box);
                         if(box== 0)
                         {
@@ -142,13 +149,21 @@
                         int width = Units.toEMU(20); // 鍥剧墖瀹藉害
                         int height = Units.toEMU(20); // 鍥剧墖楂樺害
                         run.addPicture(new FileInputStream(picturePath), pictureType, "image.png", width, height);
+
+                        // 娣诲姞绌烘牸鎴栧埗琛ㄧ锛屼娇鏂囨湰灞呬腑瀵归綈
+                        int numberOfSpaces = 3;
+                        for (int i = 0; i < numberOfSpaces; i++) {
+                            run.setText(" ");
+                        }
+                        // 璁剧疆瀛楃闂磋窛涓哄眳涓榻�
+                        paragraph.setVerticalAlignment(TextAlignment.CENTER);
                         run.setText("缁撴灉鍙俊锛屽彲浠ョ洿鎺ヨВ璇伙紙娴嬭瘯涓湭鍙戠幇鏄庢樉鐨勨�滀吉瑁呭ソ鈥濆�惧悜锛�");
 
                     }
                     if (text.contains("{{box1}}")) {  // 妫�鏌ユ槸鍚﹀寘鍚鏇挎崲鐨勬枃瀛楀彉閲�
                         String picturePath = ""; // 鍥剧墖璺緞
 
-                        String Box = (String) textMap.get("box");
+                        String Box = (String) textMap.get("Box");
                         int box = Integer.parseInt(Box);
                         if(box== 1)
                         {
@@ -175,13 +190,20 @@
                         int width = Units.toEMU(20); // 鍥剧墖瀹藉害
                         int height = Units.toEMU(20); // 鍥剧墖楂樺害
                         run.addPicture(new FileInputStream(picturePath), pictureType, "image.png", width, height);
+                        // 娣诲姞绌烘牸鎴栧埗琛ㄧ锛屼娇鏂囨湰灞呬腑瀵归綈
+                        int numberOfSpaces = 3;
+                        for (int i = 0; i < numberOfSpaces; i++) {
+                            run.setText(" ");
+                        }
+                        // 璁剧疆瀛楃闂磋窛涓哄眳涓榻�
+                        paragraph.setVerticalAlignment(TextAlignment.CENTER);
                         run.setText("缁撴灉涓嶅彲淇★紙娴嬭瘯涓湁鏄庢樉鐨勨�滀吉瑁呭ソ鈥濆�惧悜锛�");
 
                     }
                     if (text.contains("{{box2}}")) {  // 妫�鏌ユ槸鍚﹀寘鍚鏇挎崲鐨勬枃瀛楀彉閲�
                         String picturePath = ""; // 鍥剧墖璺緞
 
-                        String Box = (String) textMap.get("box");
+                        String Box = (String) textMap.get("Box");
                         int box = Integer.parseInt(Box);
                         if(box== 2)
                         {
@@ -208,6 +230,13 @@
                         int width = Units.toEMU(20); // 鍥剧墖瀹藉害
                         int height = Units.toEMU(20); // 鍥剧墖楂樺害
                         run.addPicture(new FileInputStream(picturePath), pictureType, "image.png", width, height);
+                        // 娣诲姞绌烘牸鎴栧埗琛ㄧ锛屼娇鏂囨湰灞呬腑瀵归綈
+                        int numberOfSpaces = 3;
+                        for (int i = 0; i < numberOfSpaces; i++) {
+                            run.setText(" ");
+                        }
+                        // 璁剧疆瀛楃闂磋窛涓哄眳涓榻�
+                        paragraph.setVerticalAlignment(TextAlignment.CENTER);
                         run.setText("缁撴灉鍙兘鍙俊锛岃В璇绘椂瑕佽皑鎱庯紙娴嬭瘯涓湁涓�瀹氱殑鈥滀吉瑁呭ソ鍊惧悜鈥濓級");
 
                     }

--
Gitblit v1.9.1