From 17e79b16f252d46deffb9e0223a45cb14f930448 Mon Sep 17 00:00:00 2001
From: 孔祥富 <kongxf@daryun.com>
Date: 星期二, 09 三月 2021 21:47:17 +0800
Subject: [PATCH] xx

---
 febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/util/CreatePdf.java |  117 ++++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 76 insertions(+), 41 deletions(-)

diff --git a/febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/util/CreatePdf.java b/febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/util/CreatePdf.java
index 8d30cae..a17eabf 100644
--- a/febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/util/CreatePdf.java
+++ b/febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/util/CreatePdf.java
@@ -78,7 +78,7 @@
 		}
 	}
 
-	int maxWidth = 842;
+	int maxWidth = 800;
 
 	/**
 	 * 为表格添加一个内容
@@ -138,39 +138,7 @@
 		return cell;
 	}
 
-	/**
-	 * 为表格添加一个内容
-	 * 
-	 * @param value
-	 *            值
-	 * @param font
-	 *            字体
-	 * @param align
-	 *            对齐方式
-	 * @param colspan
-	 *            占多少列
-	 * @param boderFlag
-	 *            是否有有边框
-	 * @return 添加的文本框
-	 */
-	public PdfPCell createCell(String value, Font font, int align, int colspan, boolean boderFlag) {
-		PdfPCell cell = new PdfPCell();
-		cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
-		cell.setHorizontalAlignment(align);
-		cell.setColspan(colspan);
-		cell.setPhrase(new Phrase(value, font));
-		cell.setPadding(3.0f);
-		if (!boderFlag) {
-			cell.setBorderColorBottom(BaseColor.GRAY);
-			cell.setBorderColorLeft(BaseColor.GRAY);
-			cell.setBorderColorRight(BaseColor.GRAY);
-			cell.setBorderColorTop(BaseColor.GRAY);
-			cell.setBorder(0);
-			cell.setPaddingTop(15.0f);
-			cell.setPaddingBottom(8.0f);
-		}
-		return cell;
-	}
+
 
 	/**
 	 * 创建一个表格对象
@@ -219,6 +187,40 @@
 		Font fontChinese = new Font(bfChinese, 12, Font.NORMAL);
 		return fontChinese;
 	}
+	/**
+	 * 为表格添加一个内容
+	 *
+	 * @param value
+	 *            值
+	 * @param font
+	 *            字体
+	 * @param align
+	 *            对齐方式
+	 * @param colspan
+	 *            占多少列
+	 * @param boderFlag
+	 *            是否有有边框
+	 * @return 添加的文本框
+	 */
+	public PdfPCell createCell(String value, Font font, int align, int colspan, boolean boderFlag) {
+		PdfPCell cell = new PdfPCell();
+		cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
+		cell.setHorizontalAlignment(align);
+		cell.setColspan(colspan);
+		cell.setPhrase(new Phrase(value, font));
+		cell.setPadding(3.0f);
+		cell.setMinimumHeight(30);
+		cell.setBorderColorBottom(BaseColor.BLACK);
+		cell.setBorderColorLeft(BaseColor.BLACK);
+		cell.setBorderColorRight(BaseColor.BLACK);
+		cell.setBorderColorTop(BaseColor.BLACK);
+		if (!boderFlag) {
+			cell.setBorder(0);
+			cell.setPaddingTop(15.0f);
+			cell.setPaddingBottom(8.0f);
+		}
+		return cell;
+	}
 	public static void setTableStyle(PdfPTable table, PdfPCell cell) {
 // 设置表格样式
 		table.setLockedWidth(true);
@@ -234,10 +236,10 @@
 		cell.setBorderWidthBottom(0.1f);
 		cell.setBorderWidthLeft(0.1f);
 		cell.setBorderWidthRight(0.1f);
-		cell.setBorderColorBottom(BaseColor.GRAY);
-		cell.setBorderColorLeft(BaseColor.GRAY);
-		cell.setBorderColorRight(BaseColor.GRAY);
-		cell.setBorderColorTop(BaseColor.GRAY);
+		cell.setBorderColorBottom(BaseColor.BLACK);
+		cell.setBorderColorLeft(BaseColor.BLACK);
+		cell.setBorderColorRight(BaseColor.BLACK);
+		cell.setBorderColorTop(BaseColor.BLACK);
 		cell.setPadding(3);
 	}
 	/**
@@ -332,7 +334,7 @@
 		PdfPTable badRecordtable = createTable(badRecordlength);
 		PdfPTable remarkInfotable = createTable(remarkInfolength);
 		Object[][] basicDatas = {
-				{"档案号",empBaseInfo.getEmpNumb(),
+				{"编号",empBaseInfo.getEmpNumb(),
 						"姓名",empBaseInfo.getEmpName(),
 						"性别",empBaseInfo.getSexName()},
 				{"部门(护卫点)",empBaseInfo.getDeptName(),
@@ -343,7 +345,7 @@
 						"婚姻状态",empBaseInfo.getMarriageName()==null?"":empBaseInfo.getMarriageName()},
 				{"身份证有效期",empBaseInfo.getCertificateValidity()==null?"":format1.format(empBaseInfo.getCertificateValidity()),
 						"身高(cm)",empBaseInfo.getStature()==null?"":empBaseInfo.getStature(),
-						"政治面貌",empBaseInfo.getNativePlaceName()==null?"":empBaseInfo.getNativePlaceName()},
+						"政治面貌",empBaseInfo.getPoliticsName()==null?"":empBaseInfo.getPoliticsName()},
 				{"出生日期",empBaseInfo.getBirthdate()==null?"":format1.format(empBaseInfo.getBirthdate()),
 						"最高学历",empBaseInfo.getEducationName()==null?"":empBaseInfo.getEducationName(),
 						"籍贯",empBaseInfo.getNativePlaceName()==null?"":empBaseInfo.getNativePlaceName()},
@@ -351,7 +353,7 @@
 						"现住址",empBaseInfo.getCurrentAddress()==null?"":empBaseInfo.getCurrentAddress(),
 						"保安员回执",empBaseInfo.getReturnReceipt()==null?"":empBaseInfo.getReturnReceipt()},
 				{"保安员证号",empBaseInfo.getGuardNumb()==null?"":empBaseInfo.getGuardNumb(),
-						"档案情况",empBaseInfo.getArchivesStatus()==null?"":empBaseInfo.getArchivesStatus(),
+						"档案情况",empBaseInfo.getArchivesStatusName()==null?"":empBaseInfo.getArchivesStatusName(),
 						"银行名称",empBaseInfo.getBankName()==null?"":empBaseInfo.getBankName()},
 				{"银行账号",empBaseInfo.getBankNumb()==null?"":empBaseInfo.getBankNumb(),
 						"电话号码",empBaseInfo.getTelePhone()==null?"":empBaseInfo.getTelePhone(),
@@ -366,6 +368,38 @@
 						"员工手册",empBaseInfo.getHandbookStatusName()==null?"":empBaseInfo.getHandbookStatusName(),
 						"相关证件",empBaseInfo.getCertificateListName()==null?"":empBaseInfo.getCertificateListName()},
 				{"身份证号码",empBaseInfo.getCertificateNumb()==null?"":empBaseInfo.getCertificateNumb()}};
+
+
+
+
+		//生成三列表格
+		PdfPTable table1 = new PdfPTable(1);
+		PdfPCell cell1 = new PdfPCell();
+		cell1.setBorderWidthTop(0);
+		cell1.setBorderWidthRight(0);
+		cell1.setBorderWidthBottom(0);
+		cell1.setBorderWidthLeft(0);
+		cell1.setUseAscender(true);
+
+		cell1.setUseDescender(true);
+		cell1.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);//水平居中
+		Paragraph para = null;
+		try {
+			para = new Paragraph(empBaseInfo.getEmpName()+"的档案", getPdfChineseFont());
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		//设置该段落为居中显示
+		cell1.setPhrase(para);
+		table1.addCell(cell1);
+
+
+
+
+
+
+
+
 //			每个cell的宽度
 		float[] widthss = {400, 400, 400, 400,400, 400};
 //          创建一个表格,每一行有四个cell
@@ -669,6 +703,7 @@
 			}
 		}
 		try {
+			document.add(table1);
 			// 将表格添加到文档中
 			document.add(basicTable);
 			document.add(workheadtable);

--
Gitblit v1.8.0