|
|
@@ -81,14 +81,17 @@ public class PdfUtil {
|
|
|
if (rowspan != null && rowspan > 0) {
|
|
|
cell.setRowspan(rowspan);
|
|
|
}
|
|
|
- cell.setPaddingTop(8f);
|
|
|
+ // cell.setPaddingTop(8f);
|
|
|
cell.setPaddingLeft(8f);
|
|
|
cell.setPaddingRight(8f);
|
|
|
cell.setPaddingBottom(8f);
|
|
|
+ cell.setLeading(1F,1.5F);
|
|
|
if (PdfPCell.ALIGN_MIDDLE != align) {
|
|
|
cell.setHorizontalAlignment(align);
|
|
|
} else {
|
|
|
- cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);//设置单元格的垂直对齐方式
|
|
|
+ //设置单元格的垂直方向对齐方式
|
|
|
+ cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
|
|
|
+ //设置单元格的水平方向对齐方式
|
|
|
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
|
|
|
}
|
|
|
return cell;
|
|
|
@@ -102,6 +105,7 @@ public class PdfUtil {
|
|
|
if (rowspan != null && rowspan > 0) {
|
|
|
cell.setRowspan(rowspan);
|
|
|
}
|
|
|
+ cell.setNoWrap(false);
|
|
|
cell.setLeading(lineSpacing, 0);
|
|
|
if (PdfPCell.ALIGN_MIDDLE != align) {
|
|
|
cell.setHorizontalAlignment(align);
|
|
|
@@ -175,11 +179,11 @@ public class PdfUtil {
|
|
|
createPDFCell(tableFont, table, data.get("recorderName").toString(), Element.ALIGN_MIDDLE, 2, 1);
|
|
|
|
|
|
//内容
|
|
|
- createPDFCell(tableFont, table, "内容", Element.ALIGN_MIDDLE, 1, 140);
|
|
|
- createPDFCell(tableFont, table, data.get("content").toString(), Element.ALIGN_LEFT, 5, 140);
|
|
|
- createPDFCell(tableFont, table, "总结", Element.ALIGN_MIDDLE, 1, 140);
|
|
|
- createPDFCell(tableFont, table, data.get("note").toString(), Element.ALIGN_LEFT, 5, 140);
|
|
|
- createPDFCell(tableFont, table, "参会人员签字", Element.ALIGN_MIDDLE, 1, 140);
|
|
|
+ createPDFCell(tableFont, table, "内容", Element.ALIGN_MIDDLE, 1, 1);
|
|
|
+ createPDFCell(tableFont, table, data.get("content").toString(), Element.ALIGN_LEFT, 5, 1);
|
|
|
+ createPDFCell(tableFont, table, "总结", Element.ALIGN_MIDDLE, 1, 1);
|
|
|
+ createPDFCell(tableFont, table, data.get("note").toString(), Element.ALIGN_LEFT, 5, 1);
|
|
|
+ createPDFCell(tableFont, table, "参会人员签字", Element.ALIGN_MIDDLE, 1, 1);
|
|
|
dealEduImageCell((List<String>) data.get("signImage"), table, 5, 30, 30);
|
|
|
document.add(table);
|
|
|
|
|
|
@@ -189,7 +193,6 @@ public class PdfUtil {
|
|
|
for (List<String> stringList : listList) {
|
|
|
PdfPTable innerTable = new PdfPTable(6);
|
|
|
createPDFCell(tableFont, innerTable, "图片附件", Element.ALIGN_MIDDLE, 1, 1);
|
|
|
- innerTable.setSpacingBefore(10f);
|
|
|
//一行展示一张图片
|
|
|
dealEduImageCell(new ArrayList<>(stringList), innerTable, 2, 150, 200);
|
|
|
document.newPage();
|
|
|
@@ -290,64 +293,69 @@ public class PdfUtil {
|
|
|
//证件图片
|
|
|
createPDFCell(tableFont, table, "证件图片", Element.ALIGN_MIDDLE, 1, 1);
|
|
|
//证件图片 图片填充
|
|
|
- final PdfPTable imageTable1 = getImage((List<String>) data.get("imageFile"), 2, 148, 108, 2);
|
|
|
+ final PdfPTable imageTable1 = getImage((List<String>) data.get("imageFile"), 2, 190, 130, 2);
|
|
|
final PdfPCell cell1 = new PdfPCell();
|
|
|
cell1.setNoWrap(false);
|
|
|
- cell1.setPaddingLeft(8f);
|
|
|
- cell1.setPaddingRight(8f);
|
|
|
- cell1.setPaddingBottom(8f);
|
|
|
- cell1.setPaddingTop(8f);
|
|
|
+ cell1.setPaddingLeft(4f);
|
|
|
+ cell1.setPaddingRight(4f);
|
|
|
+ cell1.setPaddingBottom(4f);
|
|
|
+ cell1.setPaddingTop(4f);
|
|
|
cell1.setColspan(5);
|
|
|
cell1.setRowspan(1);
|
|
|
//cell1.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.BOTTOM);
|
|
|
cell1.addElement(imageTable1);
|
|
|
table.addCell(cell1);
|
|
|
- createPDFCell(tableFont, table, "介绍信附件", Element.ALIGN_MIDDLE, 1, 1);
|
|
|
- final PdfPTable imageTable2 = getImage((List<String>) data.get("file"), 2, 148, 148, 2);
|
|
|
- final PdfPCell cell2 = new PdfPCell();
|
|
|
- cell2.setNoWrap(false);
|
|
|
- cell2.setPaddingLeft(8f);
|
|
|
- cell2.setPaddingRight(8f);
|
|
|
- cell2.setPaddingBottom(8f);
|
|
|
- cell2.setPaddingTop(8f);
|
|
|
- cell2.setColspan(5);
|
|
|
- cell2.setRowspan(1);
|
|
|
- //cell1.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.BOTTOM);
|
|
|
- cell2.addElement(imageTable2);
|
|
|
- table.addCell(cell2);
|
|
|
+
|
|
|
createPDFCell(tableFont, table, "身份核验材料", Element.ALIGN_MIDDLE, 1, 1);
|
|
|
- final PdfPTable imageTable3 = getImage((List<String>) data.get("checkImage"), 2, 148, 148, 2);
|
|
|
+ final PdfPTable imageTable3 = getImage((List<String>) data.get("checkImage"), 2, 190, 190, 2);
|
|
|
final PdfPCell cell3 = new PdfPCell();
|
|
|
cell3.setNoWrap(false);
|
|
|
- cell3.setPaddingLeft(8f);
|
|
|
- cell3.setPaddingRight(8f);
|
|
|
- cell3.setPaddingBottom(8f);
|
|
|
- cell3.setPaddingTop(8f);
|
|
|
+ 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);
|
|
|
+
|
|
|
+ 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);
|
|
|
}
|
|
|
|
|
|
public static void dealDrillBody(Document document, PdfPTable table, Font tableFont, Map<String, Object> data) throws Exception {
|
|
|
//第一行
|
|
|
- createPDFCell(tableFont, table, "演练单位", Element.ALIGN_CENTER, 1, 1);
|
|
|
- createPDFCell(tableFont, table, data.get("orgName").toString(), Element.ALIGN_CENTER, 2, 1);
|
|
|
- createPDFCell(tableFont, table, "地点", Element.ALIGN_CENTER, 1, 1);
|
|
|
- createPDFCell(tableFont, table, data.get("drillSite").toString(), Element.ALIGN_CENTER, 2, 1);
|
|
|
+ createPDFCell(tableFont, table, "演练单位", Element.ALIGN_MIDDLE, 1, 1);
|
|
|
+ createPDFCell(tableFont, table, data.get("orgName").toString(), Element.ALIGN_MIDDLE, 2, 1);
|
|
|
+ createPDFCell(tableFont, table, "地点", Element.ALIGN_MIDDLE, 1, 1);
|
|
|
+ createPDFCell(tableFont, table, data.get("drillSite").toString(), Element.ALIGN_MIDDLE, 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);
|
|
|
+ createPDFCell(tableFont, table, "指挥人", Element.ALIGN_MIDDLE, 1, 1);
|
|
|
+ createPDFCell(tableFont, table, data.get("hostName").toString(), Element.ALIGN_MIDDLE, 2, 1);
|
|
|
+ createPDFCell(tableFont, table, "记录人", Element.ALIGN_MIDDLE, 1, 1);
|
|
|
+ createPDFCell(tableFont, table, data.get("recorderName").toString(), Element.ALIGN_MIDDLE, 2, 1);
|
|
|
//第三行
|
|
|
- createPDFCell(tableFont, table, "演练时间", Element.ALIGN_CENTER, 1, 1);
|
|
|
+ createPDFCell(tableFont, table, "演练时间", Element.ALIGN_MIDDLE, 1, 1);
|
|
|
createPDFCell(tableFont, table, data.get("drillTime").toString(), Element.ALIGN_LEFT, 5, 1);
|
|
|
- createPDFCell(tableFont, table, "演练项目", Element.ALIGN_CENTER, 1, 1);
|
|
|
+ createPDFCell(tableFont, table, "演练项目", Element.ALIGN_MIDDLE, 1, 1);
|
|
|
createPDFCell(tableFont, table, data.get("typeText").toString(), Element.ALIGN_LEFT, 5, 1);
|
|
|
//预设案由
|
|
|
createPDFCell(tableFont, table, "预设案由", Element.ALIGN_MIDDLE, 1, 1);
|
|
|
@@ -419,6 +427,7 @@ public class PdfUtil {
|
|
|
PdfPTable imageInnerTable = new PdfPTable(imageNumsOfRow);
|
|
|
imageInnerTable.setSplitRows(true);
|
|
|
imageInnerTable.setSplitLate(false);
|
|
|
+ imageInnerTable.setWidthPercentage(100F);
|
|
|
for (String image : imageList) {
|
|
|
Image imageData = convertFileToByteArray(new File(image));
|
|
|
if (imageData != null) {
|
|
|
@@ -426,10 +435,11 @@ public class PdfUtil {
|
|
|
}
|
|
|
PdfPCell innerCell = new PdfPCell(imageData);
|
|
|
innerCell.setNoWrap(false);
|
|
|
- innerCell.setPaddingTop(8f);
|
|
|
+ /* innerCell.setPaddingTop(8f);
|
|
|
innerCell.setPaddingLeft(8f);
|
|
|
innerCell.setPaddingRight(8f);
|
|
|
- innerCell.setPaddingBottom(8f);
|
|
|
+ innerCell.setPaddingBottom(8f);*/
|
|
|
+
|
|
|
innerCell.setBorder(Rectangle.NO_BORDER);
|
|
|
innerCell.setHorizontalAlignment(Element.ALIGN_CENTER);
|
|
|
innerCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
|
|
@@ -439,12 +449,12 @@ public class PdfUtil {
|
|
|
table.addCell(outCell);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
private static PdfPTable getImage(List<String> images, int totalImages, float imageWidth, float imageHeight, Integer ImageNumsOfRow) throws Exception {
|
|
|
if (images == null) {
|
|
|
images = new ArrayList<>();
|
|
|
}
|
|
|
PdfPTable innerTable = new PdfPTable(ImageNumsOfRow);
|
|
|
+ innerTable.setWidthPercentage(100f);
|
|
|
innerTable.setSplitRows(true);
|
|
|
innerTable.setSplitLate(false);
|
|
|
//这里根据实际图片数量来判断是否需要补充白色图片,保证每行显示3张图片,用以填充空白
|
|
|
@@ -481,6 +491,7 @@ public class PdfUtil {
|
|
|
outerTable.setSplitRows(true);
|
|
|
outerTable.setSplitLate(false);
|
|
|
outerTable.addCell(innerCell);
|
|
|
+ outerTable.setWidthPercentage(100f);
|
|
|
return outerTable;
|
|
|
}
|
|
|
|
|
|
@@ -513,45 +524,45 @@ public class PdfUtil {
|
|
|
|
|
|
public static void dealAccessPBody(Document document, PdfPTable table, Font tableFont, Font tableTitleFont, List<AccessDataVo> data) throws DocumentException {
|
|
|
|
|
|
- PdfUtil.createPDFCell(tableTitleFont, table, "序号", Element.ALIGN_MIDDLE, 3, 0);
|
|
|
- PdfUtil.createPDFCell(tableTitleFont, table, "硬盘录像机", Element.ALIGN_MIDDLE, 16, 0);
|
|
|
+ PdfUtil.createPDFCell(tableTitleFont, table, "序号", Element.ALIGN_MIDDLE, 5, 0);
|
|
|
+ PdfUtil.createPDFCell(tableTitleFont, table, "硬盘录像机", Element.ALIGN_MIDDLE, 15, 0);
|
|
|
PdfUtil.createPDFCell(tableTitleFont, table, "通道名称", Element.ALIGN_MIDDLE, 9, 0);
|
|
|
- PdfUtil.createPDFCell(tableTitleFont, table, "检查项目", Element.ALIGN_MIDDLE, 9, 0);
|
|
|
+ PdfUtil.createPDFCell(tableTitleFont, table, "检查项目", Element.ALIGN_MIDDLE, 8, 0);
|
|
|
PdfUtil.createPDFCell(tableTitleFont, table, "存在问题", Element.ALIGN_MIDDLE, 9, 0);
|
|
|
for (int i = 1; i <= data.size(); i++) {
|
|
|
- PdfUtil.createPDFCell(tableFont, table, String.valueOf(i), Element.ALIGN_MIDDLE, 3, 0);
|
|
|
- PdfUtil.createPDFCell(tableFont, table, data.get(i - 1).getHostName(), Element.ALIGN_MIDDLE, 16, 0);
|
|
|
+ PdfUtil.createPDFCell(tableFont, table, String.valueOf(i), Element.ALIGN_MIDDLE, 5, 0);
|
|
|
+ PdfUtil.createPDFCell(tableFont, table, data.get(i - 1).getHostName(), Element.ALIGN_MIDDLE, 15, 0);
|
|
|
PdfUtil.createPDFCell(tableFont, table, data.get(i - 1).getVideoChannelName(), Element.ALIGN_MIDDLE, 9, 0);
|
|
|
- PdfUtil.createPDFCell(tableFont, table, data.get(i - 1).getProject(), Element.ALIGN_MIDDLE, 9, 0);
|
|
|
+ PdfUtil.createPDFCell(tableFont, table, data.get(i - 1).getProject(), Element.ALIGN_MIDDLE, 8, 0);
|
|
|
PdfUtil.createPDFCell(tableFont, table, data.get(i - 1).getAbnormalIllustrate(), Element.ALIGN_MIDDLE, 9, 0);
|
|
|
}
|
|
|
document.add(table);
|
|
|
}
|
|
|
|
|
|
public static void dealSafeCheckPBody(Document document, PdfPTable table, Font tableFont, SafeCheckTaskRegisterBookVo data) throws DocumentException {
|
|
|
- PdfUtil.createPDFCell(tableFont, table, "被查单位", Element.ALIGN_CENTER, 3, 1);
|
|
|
- PdfUtil.createPDFCell(tableFont, table, data.getOrgName(), Element.ALIGN_CENTER, 4, 1);
|
|
|
- PdfUtil.createPDFCell(tableFont, table, "被查日期", Element.ALIGN_CENTER, 3, 1);
|
|
|
- PdfUtil.createPDFCell(tableFont, table, data.getDateStr(), Element.ALIGN_CENTER, 4, 1);
|
|
|
+ PdfUtil.createPDFCell(tableFont, table, "被查单位", Element.ALIGN_MIDDLE, 3, 1);
|
|
|
+ PdfUtil.createPDFCell(tableFont, table, data.getOrgName(), Element.ALIGN_MIDDLE, 4, 1);
|
|
|
+ PdfUtil.createPDFCell(tableFont, table, "检查日期", Element.ALIGN_MIDDLE, 3, 1);
|
|
|
+ PdfUtil.createPDFCell(tableFont, table, data.getDateStr(), Element.ALIGN_MIDDLE, 4, 1);
|
|
|
|
|
|
- PdfUtil.createPDFCell(tableFont, table, "检查类型", Element.ALIGN_CENTER, 3, 1);
|
|
|
- PdfUtil.createPDFCell(tableFont, table, data.getCheckTypeText(), Element.ALIGN_CENTER, 4, 1);
|
|
|
- PdfUtil.createPDFCell(tableFont, table, "检查名称", Element.ALIGN_CENTER, 3, 1);
|
|
|
- PdfUtil.createPDFCell(tableFont, table, data.getTaskTitle(), Element.ALIGN_CENTER, 4, 1);
|
|
|
+ PdfUtil.createPDFCell(tableFont, table, "检查类型", Element.ALIGN_MIDDLE, 3, 1);
|
|
|
+ PdfUtil.createPDFCell(tableFont, table, data.getCheckTypeText(), Element.ALIGN_MIDDLE, 4, 1);
|
|
|
+ PdfUtil.createPDFCell(tableFont, table, "检查名称", Element.ALIGN_MIDDLE, 3, 1);
|
|
|
+ PdfUtil.createPDFCell(tableFont, table, data.getTaskTitle(), Element.ALIGN_MIDDLE, 4, 1);
|
|
|
|
|
|
- PdfUtil.createPDFCell(tableFont, table, "检查单位", Element.ALIGN_CENTER, 3, 1);
|
|
|
- PdfUtil.createPDFCell(tableFont, table, data.getCheckOrgName(), Element.ALIGN_CENTER, 4, 1);
|
|
|
- PdfUtil.createPDFCell(tableFont, table, "检查人", Element.ALIGN_CENTER, 3, 1);
|
|
|
- PdfUtil.createPDFCell(tableFont, table, data.getCheckUserInfo(), Element.ALIGN_CENTER, 4, 1);
|
|
|
+ PdfUtil.createPDFCell(tableFont, table, "检查单位", Element.ALIGN_MIDDLE, 3, 1);
|
|
|
+ PdfUtil.createPDFCell(tableFont, table, data.getCheckOrgName(), Element.ALIGN_MIDDLE, 4, 1);
|
|
|
+ PdfUtil.createPDFCell(tableFont, table, "检查人", Element.ALIGN_MIDDLE, 3, 1);
|
|
|
+ PdfUtil.createPDFCell(tableFont, table, data.getCheckUserInfo(), Element.ALIGN_MIDDLE, 4, 1);
|
|
|
|
|
|
- PdfUtil.createPDFCell(tableFont, table, "检查组成员", Element.ALIGN_CENTER, 3, 1);
|
|
|
- PdfUtil.createPDFCell(tableFont, table, data.getCheckTeam(), Element.ALIGN_CENTER, 11, 1);
|
|
|
+ PdfUtil.createPDFCell(tableFont, table, "检查组成员", Element.ALIGN_MIDDLE, 3, 1);
|
|
|
+ PdfUtil.createPDFCell(tableFont, table, data.getCheckTeam(), Element.ALIGN_MIDDLE, 11, 1);
|
|
|
|
|
|
- PdfUtil.createPDFCell(tableFont, table, "发现问题情况", Element.ALIGN_CENTER, 14, 1);
|
|
|
+ PdfUtil.createPDFCell(tableFont, table, "发现问题情况", Element.ALIGN_MIDDLE, 14, 1);
|
|
|
|
|
|
- PdfUtil.createPDFCell(tableFont, table, "序号", Element.ALIGN_CENTER, 2, 1);
|
|
|
- PdfUtil.createPDFCell(tableFont, table, "检查项目", Element.ALIGN_CENTER, 6, 1);
|
|
|
- PdfUtil.createPDFCell(tableFont, table, "存在问题", Element.ALIGN_CENTER, 6, 1);
|
|
|
+ PdfUtil.createPDFCell(tableFont, table, "序号", Element.ALIGN_MIDDLE, 2, 1);
|
|
|
+ PdfUtil.createPDFCell(tableFont, table, "检查项目", Element.ALIGN_MIDDLE, 6, 1);
|
|
|
+ PdfUtil.createPDFCell(tableFont, table, "存在问题", Element.ALIGN_MIDDLE, 6, 1);
|
|
|
final Optional<CheckDataVo> optional = data.getCheckDatas().stream().filter(res -> ObjectUtil.isNotEmpty(res.getResRemark())).findAny();
|
|
|
if (!optional.isPresent()) {
|
|
|
PdfUtil.createPDFCell(tableFont, table, "1", Element.ALIGN_MIDDLE, 2, 1);
|