Selaa lähdekoodia

出入登记簿样式调整

zhulu 1 vuosi sitten
vanhempi
commit
36f4033481

+ 39 - 32
soc-modules/soc-modules-file/src/main/java/com/xunmei/file/utils/PdfUtil.java

@@ -440,39 +440,46 @@ public class PdfUtil {
         cell1.addElement(imageTable1);
         table.addCell(cell1);
 
-//        createPDFCell(tableFont, table, "联网核查结果", Element.ALIGN_MIDDLE, 1, 1);
-//        final PdfPTable imageTable3 = getImage((List<String>) data.get("checkImage"), 2, 190, 190, 2);
-//        final PdfPCell cell3 = new PdfPCell();
-//        cell3.setNoWrap(false);
-//        cell3.setPaddingLeft(4f);
-//        cell3.setPaddingRight(4f);
-//        cell3.setPaddingBottom(4f);
-//        cell3.setPaddingTop(4f);
-//        cell3.setColspan(5);
-//        cell3.setRowspan(1);
-//        //cell1.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.BOTTOM);
-//        cell3.addElement(imageTable3);
-//        table.addCell(cell3);
-//
-        document.add(table);
+        List<String> files= (List<String>) data.get("file");
+
+        List<String> files1= files.subList(0,1);
+        List<String> files2= files.subList(1,files.size());
+
+        createPDFCell(tableFont, table, "介绍信附件", Element.ALIGN_MIDDLE, 1, 1);
+        final PdfPTable imageTable3 = getImage(files1, 1, 380, 320, 1);
+        final PdfPCell cell3 = new PdfPCell();
+        cell3.setNoWrap(false);
+        cell3.setPaddingLeft(4f);
+        cell3.setPaddingRight(4f);
+        cell3.setPaddingBottom(4f);
+        cell3.setPaddingTop(4f);
+        cell3.setColspan(5);
+        cell3.setRowspan(1);
+        //cell1.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.BOTTOM);
+        cell3.addElement(imageTable3);
+        table.addCell(cell3);
 
-        PdfPTable innerTable = new PdfPTable(6);
-        createPDFCell(tableFont, innerTable, "介绍信附件", Element.ALIGN_MIDDLE, 1, 1);
-
-//        createPDFCell(tableFont, table, "介绍信附件", Element.ALIGN_MIDDLE, 1, 1);
-        final PdfPTable imageTable2 = getImage((List<String>) data.get("file"), 2, 380, 320, 1);
-        final PdfPCell cell2 = new PdfPCell();
-        cell2.setNoWrap(false);
-        cell2.setPaddingLeft(4f);
-        cell2.setPaddingRight(4f);
-        cell2.setPaddingBottom(4f);
-        cell2.setPaddingTop(4f);
-        cell2.setColspan(5);
-        cell2.setRowspan(1);
-        cell2.addElement(imageTable2);
-        innerTable.addCell(cell2);
-        document.newPage();
-        document.add(innerTable);
+        document.add(table);
+        if(files2.size()>0)
+        {
+            PdfPTable innerTable = new PdfPTable(6);
+            createPDFCell(tableFont, innerTable, "介绍信附件", Element.ALIGN_MIDDLE, 1, 1);
+
+    //        createPDFCell(tableFont, table, "介绍信附件", Element.ALIGN_MIDDLE, 1, 1);
+            final PdfPTable imageTable2 = getImage(files2, 2, 380, 320, 1);
+            final PdfPCell cell2 = new PdfPCell();
+            cell2.setNoWrap(false);
+            cell2.setPaddingLeft(4f);
+            cell2.setPaddingRight(4f);
+            cell2.setPaddingBottom(4f);
+            cell2.setPaddingTop(4f);
+            cell2.setColspan(5);
+            cell2.setRowspan(1);
+            cell2.addElement(imageTable2);
+            innerTable.addCell(cell2);
+            document.newPage();
+            document.add(innerTable);
+        }
     }
 
     public static void dealDrillBody(Document document, PdfPTable table, Font tableFont, Map<String, Object> data) throws Exception {