Эх сурвалжийг харах

演练登记簿代码提交

jingyuanchao 1 жил өмнө
parent
commit
ffb64dc906

+ 33 - 4
soc-modules/soc-modules-file/src/main/java/com/xunmei/file/utils/PdfUtil.java

@@ -344,13 +344,12 @@ public class PdfUtil {
         createPDFCell(tableFont, table, data.get("drillTime").toString(), Element.ALIGN_CENTER, 2, 1);
         createPDFCell(tableFont, table, "演练项目", Element.ALIGN_CENTER, 1, 1);
         createPDFCell(tableFont, table, data.get("typeText").toString(), Element.ALIGN_CENTER, 2, 1);
-
         //第三行
         createPDFCell(tableFont, table, "指挥人", Element.ALIGN_CENTER, 1, 1);
         createPDFCell(tableFont, table, data.get("hostName").toString(), Element.ALIGN_CENTER, 2, 1);
-        //第三行
         createPDFCell(tableFont, table, "记录人", Element.ALIGN_CENTER, 1, 1);
         createPDFCell(tableFont, table, data.get("recorderName").toString(), Element.ALIGN_CENTER, 2, 1);
+
         //预设案由
         PdfPCell contentCell = new PdfPCell();
         contentCell.setColspan(6);
@@ -359,7 +358,9 @@ public class PdfUtil {
         contentCell.addElement(presetCase);
         contentCell.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.BOTTOM);
         table.addCell(contentCell);
-        //演练情况
+        dealDrillImageCell(data.get("drillSituation").toString(), tableFont, (List<String>) data.get("imageData"), table);
+        dealDrillImageCell("参会演练人员(签字):", tableFont, (List<String>) data.get("image"), table);
+       /* //演练情况
         PdfPCell noteCell = new PdfPCell();
         noteCell.setColspan(6);
         Paragraph noteParagraph = new Paragraph(new Chunk(data.get("drillSituation").toString(), tableFont));
@@ -411,7 +412,7 @@ public class PdfUtil {
             imageInnerTable.addCell(cell);
         }
         signCell.addElement(imageInnerTable);
-        table.addCell(signCell);
+        table.addCell(signCell);*/
 
 
         //点评总结
@@ -422,6 +423,34 @@ public class PdfUtil {
         document.add(table);
     }
 
+    public static void dealDrillImageCell(String chunk, Font tableFont, List<String> imageList, PdfPTable table) throws Exception {
+        //签字区域
+        PdfPCell outCell = new PdfPCell();
+        outCell.setColspan(6);
+        final Paragraph paragraph1 = new Paragraph(new Chunk(chunk, tableFont));
+        paragraph1.setSpacingAfter(8F);
+        outCell.addElement(paragraph1);
+        outCell.setBorder(Rectangle.LEFT | Rectangle.RIGHT| Rectangle.BOTTOM);
+        final int imageAddNums = imageList.size() % 3;
+        for (int i = 0; i < 3 - imageAddNums; i++) {
+            imageList.add("black.png");
+        }
+        PdfPTable imageInnerTable = new PdfPTable(3);
+        for (String image : imageList) {
+            Image imageData = convertFileToByteArray(new File(image));
+            if (imageData != null) {
+                imageData.scaleAbsolute(120, 120);
+            }
+            PdfPCell innerCell = new PdfPCell(imageData);
+            innerCell.setBorder(Rectangle.NO_BORDER);
+            innerCell.setHorizontalAlignment(Element.ALIGN_CENTER);
+            innerCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
+            imageInnerTable.addCell(innerCell);
+        }
+        outCell.addElement(imageInnerTable);
+        table.addCell(outCell);
+    }
+
 
     private static PdfPTable getImage(List<String> images, int totalImages, float imageWidth, float imageHeight, Integer ImageNumsOfRow) throws Exception {
         if (images == null) {