|
@@ -2,23 +2,15 @@ package com.yaoyicloud.template;
|
|
|
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
-import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
-
|
|
|
-import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
-
|
|
|
import com.deepoove.poi.XWPFTemplate;
|
|
|
import com.deepoove.poi.config.Configure;
|
|
|
import com.deepoove.poi.config.ConfigureBuilder;
|
|
|
-import com.deepoove.poi.data.NumberingFormat;
|
|
|
-import com.deepoove.poi.data.NumberingRenderData;
|
|
|
-import com.deepoove.poi.data.ParagraphRenderData;
|
|
|
-import com.deepoove.poi.data.PictureType;
|
|
|
-import com.deepoove.poi.data.Pictures;
|
|
|
+
|
|
|
import com.deepoove.poi.data.Texts;
|
|
|
import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
|
|
|
import com.deepoove.poi.policy.RenderPolicy;
|
|
@@ -126,117 +118,18 @@ public class AcademicAssociationReport extends AbstractReportExporter {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- List<Map<String, Object>> imageDataList = (List<Map<String, Object>>) processedData.get("files");
|
|
|
- List<ParagraphRenderData> paragraphImages = new ArrayList<>();
|
|
|
- if (CollectionUtils.isNotEmpty(imageDataList)) {
|
|
|
- for (Map<String, Object> imageData : imageDataList) {
|
|
|
- ParagraphRenderData paragraphRenderData = new ParagraphRenderData();
|
|
|
-
|
|
|
- if (imageData.containsKey("base64")) {
|
|
|
- String base64 = (String) imageData.get("base64");
|
|
|
-
|
|
|
- String fileExtension = (String) imageData.get("fileExtension");
|
|
|
- PictureType pictureType = PictureType.PNG; // 默认PNG
|
|
|
- if (fileExtension != null) {
|
|
|
- if (fileExtension.equalsIgnoreCase(".jpg") || fileExtension.equalsIgnoreCase(".jpeg")) {
|
|
|
- pictureType = PictureType.JPEG;
|
|
|
- } else if (fileExtension.equalsIgnoreCase(".gif")) {
|
|
|
- pictureType = PictureType.GIF;
|
|
|
- } else if (fileExtension.equalsIgnoreCase(".bmp")) {
|
|
|
- pictureType = PictureType.BMP;
|
|
|
- } else if (fileExtension.equalsIgnoreCase(".png")) {
|
|
|
- pictureType = PictureType.PNG;
|
|
|
- } else if (fileExtension.equalsIgnoreCase(".tiff")) {
|
|
|
- pictureType = PictureType.TIFF;
|
|
|
- }
|
|
|
- }
|
|
|
- paragraphRenderData.addPicture(
|
|
|
- Pictures.ofBase64(base64, pictureType)
|
|
|
- .size((Integer) imageData.get("width"), (Integer) imageData.get("height"))
|
|
|
- .create());
|
|
|
- }
|
|
|
- paragraphImages.add(paragraphRenderData);
|
|
|
- }
|
|
|
- NumberingFormat numberingFormat = new NumberingFormat(1, "");
|
|
|
- NumberingRenderData numberedImages = new NumberingRenderData(numberingFormat, paragraphImages);
|
|
|
- processedData.put("files", numberedImages);
|
|
|
- }
|
|
|
-
|
|
|
- List<Map<String, Object>> relatedEntitiesImage = (List<Map<String, Object>>) processedData.get("relatedEntitiesImage");
|
|
|
- List<ParagraphRenderData> relatedEntitiesImages = new ArrayList<>();
|
|
|
- if (CollectionUtils.isNotEmpty(relatedEntitiesImage)) {
|
|
|
- for (Map<String, Object> imageData : relatedEntitiesImage) {
|
|
|
- ParagraphRenderData paragraphRenderData = new ParagraphRenderData();
|
|
|
|
|
|
- if (imageData.containsKey("base64")) {
|
|
|
- String base64 = (String) imageData.get("base64");
|
|
|
|
|
|
- String fileExtension = (String) imageData.get("fileExtension");
|
|
|
- PictureType pictureType = PictureType.PNG; // 默认PNG
|
|
|
- if (fileExtension != null) {
|
|
|
- if (fileExtension.equalsIgnoreCase(".jpg") || fileExtension.equalsIgnoreCase(".jpeg")) {
|
|
|
- pictureType = PictureType.JPEG;
|
|
|
- } else if (fileExtension.equalsIgnoreCase(".gif")) {
|
|
|
- pictureType = PictureType.GIF;
|
|
|
- } else if (fileExtension.equalsIgnoreCase(".bmp")) {
|
|
|
- pictureType = PictureType.BMP;
|
|
|
- } else if (fileExtension.equalsIgnoreCase(".png")) {
|
|
|
- pictureType = PictureType.PNG;
|
|
|
- } else if (fileExtension.equalsIgnoreCase(".tiff")) {
|
|
|
- pictureType = PictureType.TIFF;
|
|
|
- }
|
|
|
- }
|
|
|
- paragraphRenderData.addPicture(
|
|
|
- Pictures.ofBase64(base64, pictureType)
|
|
|
- .size((Integer) imageData.get("width"), (Integer) imageData.get("height"))
|
|
|
- .create());
|
|
|
- }
|
|
|
- relatedEntitiesImages.add(paragraphRenderData);
|
|
|
- }
|
|
|
- NumberingFormat numberingFormat = new NumberingFormat(1, "");
|
|
|
- NumberingRenderData numberedImages = new NumberingRenderData(numberingFormat, relatedEntitiesImages);
|
|
|
- processedData.put("relatedEntitiesImage", numberedImages);
|
|
|
- }
|
|
|
-
|
|
|
- List<Map<String, Object>> interestConflictList = (List<Map<String, Object>>) processedData.get("interestConflict");
|
|
|
- List<ParagraphRenderData> interestConflictparagraphImages = new ArrayList<>();
|
|
|
- if (CollectionUtils.isNotEmpty(interestConflictList)) {
|
|
|
- for (Map<String, Object> imageData : interestConflictList) {
|
|
|
- ParagraphRenderData paragraphRenderData = new ParagraphRenderData();
|
|
|
- if (imageData.containsKey("base64")) {
|
|
|
- String base64 = (String) imageData.get("base64");
|
|
|
- String fileExtension = (String) imageData.get("fileExtension");
|
|
|
- PictureType pictureType = PictureType.PNG; // 默认PNG
|
|
|
- if (fileExtension != null) {
|
|
|
- if (fileExtension.equalsIgnoreCase(".jpg") || fileExtension.equalsIgnoreCase(".jpeg")) {
|
|
|
- pictureType = PictureType.JPEG;
|
|
|
- } else if (fileExtension.equalsIgnoreCase(".gif")) {
|
|
|
- pictureType = PictureType.GIF;
|
|
|
- } else if (fileExtension.equalsIgnoreCase(".bmp")) {
|
|
|
- pictureType = PictureType.BMP;
|
|
|
- } else if (fileExtension.equalsIgnoreCase(".png")) {
|
|
|
- pictureType = PictureType.PNG;
|
|
|
- } else if (fileExtension.equalsIgnoreCase(".tiff")) {
|
|
|
- pictureType = PictureType.TIFF;
|
|
|
- }
|
|
|
- }
|
|
|
- paragraphRenderData.addPicture(
|
|
|
- Pictures.ofBase64(base64, pictureType)
|
|
|
- .size((Integer) imageData.get("width"), (Integer) imageData.get("height"))
|
|
|
- .create());
|
|
|
- }
|
|
|
- interestConflictparagraphImages.add(paragraphRenderData);
|
|
|
- }
|
|
|
- NumberingFormat numberingFormat = new NumberingFormat(1, "");
|
|
|
- NumberingRenderData numberedImages = new NumberingRenderData(numberingFormat, interestConflictparagraphImages);
|
|
|
- processedData.put("files", numberedImages);
|
|
|
- }
|
|
|
// Process other specific links
|
|
|
processLink(processedData, "socialSecurityDetailsLink");
|
|
|
processLink(processedData, "taxDeclarationImage");
|
|
|
processLink(processedData, "financialInfoLink");
|
|
|
|
|
|
// Process image lists
|
|
|
+ processImageListToNumberedRenderData("files", processedData);
|
|
|
+ processImageListToNumberedRenderData("relatedEntitiesImage", processedData);
|
|
|
+ processImageListToNumberedRenderData("interestConflict", processedData);
|
|
|
+
|
|
|
processImageListToNumberedRenderData("businessLicenseImage", processedData);
|
|
|
processImageListToNumberedRenderData("legalRegistrationCertImages", processedData);
|
|
|
processImageListToNumberedRenderData("annualInspectionResultImage", processedData);
|