|
|
@@ -155,19 +155,6 @@ public class PdfUtil {
|
|
|
document.add(p);
|
|
|
}
|
|
|
|
|
|
- public static void dealEduHeader(PdfPTable table, BaseFont fs, String title, int fontSize) {
|
|
|
- //文件title
|
|
|
- PdfPCell pdfPCell = new PdfPCell();
|
|
|
- final Paragraph p = new Paragraph(new Chunk(title, new Font(fs, fontSize)));
|
|
|
- p.setAlignment(Paragraph.ALIGN_CENTER);
|
|
|
- // 文件title 段落下空白
|
|
|
- p.setSpacingAfter(10f);
|
|
|
- pdfPCell.setColspan(6);
|
|
|
- pdfPCell.addElement(p);
|
|
|
- pdfPCell.setBorder(Rectangle.BOTTOM);
|
|
|
- table.addCell(pdfPCell);
|
|
|
- }
|
|
|
-
|
|
|
public static void dealEduBody(Document document, PdfPTable table, Font tableFont, Map<String, Object> data) throws Exception {
|
|
|
//第一行
|
|
|
createPDFCell(tableFont, table, "时间", Element.ALIGN_MIDDLE, 1, 1);
|
|
|
@@ -423,24 +410,34 @@ public class PdfUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static void dealDrillImageCell(List<String> imageList, PdfPTable table) throws Exception {
|
|
|
+ public static void dealEduImageCell(List<String> imageList, PdfPTable table, Integer imageNumsOfRow, Integer imageWith, Integer imageHigh) throws Exception {
|
|
|
//签字区域
|
|
|
PdfPCell outCell = new PdfPCell();
|
|
|
- outCell.setColspan(5);
|
|
|
- outCell.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.BOTTOM);
|
|
|
- final int imageAddNums = imageList.size() % 3;
|
|
|
+ outCell.setNoWrap(false);
|
|
|
+ outCell.setColspan(6);
|
|
|
+ // outCell.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.BOTTOM);
|
|
|
+ final int imageAddNums = imageList.size() % imageNumsOfRow;
|
|
|
if (imageAddNums != 0) {
|
|
|
- for (int i = 0; i < 3 - imageAddNums; i++) {
|
|
|
+ for (int i = 0; i < imageNumsOfRow - imageAddNums; i++) {
|
|
|
imageList.add("black.png");
|
|
|
}
|
|
|
}
|
|
|
- PdfPTable imageInnerTable = new PdfPTable(3);
|
|
|
+ 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) {
|
|
|
- imageData.scaleAbsolute(120, 120);
|
|
|
+ imageData.scaleAbsolute(imageWith, imageHigh);
|
|
|
}
|
|
|
PdfPCell innerCell = new PdfPCell(imageData);
|
|
|
+ innerCell.setNoWrap(false);
|
|
|
+ innerCell.setPaddingTop(8f);
|
|
|
+ innerCell.setPaddingLeft(8f);
|
|
|
+ innerCell.setPaddingRight(8f);
|
|
|
+ innerCell.setPaddingBottom(8f);
|
|
|
+
|
|
|
innerCell.setBorder(Rectangle.NO_BORDER);
|
|
|
innerCell.setHorizontalAlignment(Element.ALIGN_CENTER);
|
|
|
innerCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
|
|
@@ -450,12 +447,12 @@ public class PdfUtil {
|
|
|
table.addCell(outCell);
|
|
|
}
|
|
|
|
|
|
- public static void dealEduImageCell(List<String> imageList, PdfPTable table, Integer imageNumsOfRow, Integer imageWith, Integer imageHigh) throws Exception {
|
|
|
+ public static void dealImageCell(List<String> imageList, PdfPTable table, Integer imageNumsOfRow, Integer imageWith, Integer imageHigh,Integer cosSpan,Integer rowSpan) throws Exception {
|
|
|
//签字区域
|
|
|
PdfPCell outCell = new PdfPCell();
|
|
|
outCell.setNoWrap(false);
|
|
|
- outCell.setColspan(6);
|
|
|
- // outCell.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.BOTTOM);
|
|
|
+ outCell.setColspan(cosSpan);
|
|
|
+ outCell.setRowspan(rowSpan);
|
|
|
final int imageAddNums = imageList.size() % imageNumsOfRow;
|
|
|
if (imageAddNums != 0) {
|
|
|
for (int i = 0; i < imageNumsOfRow - imageAddNums; i++) {
|
|
|
@@ -568,7 +565,7 @@ public class PdfUtil {
|
|
|
List<AccessDataVo> normalDataList = data.stream().filter(d -> ObjectUtil.equal(0, d.getStatus())).collect(Collectors.toList());
|
|
|
if (ObjectUtil.isNotEmpty(normalDataList)) {
|
|
|
for (int i = 1; i <= normalDataList.size(); i++) {
|
|
|
- AccessDataVo accessDataVo = data.get(i - 1);
|
|
|
+ AccessDataVo accessDataVo = normalDataList.get(i - 1);
|
|
|
PdfUtil.createPDFCell(tableFont, table, String.valueOf(i), Element.ALIGN_MIDDLE, 2, 1);
|
|
|
PdfUtil.createPDFCell(tableFont, table, accessDataVo.getAreaName(), Element.ALIGN_MIDDLE, 6, 1);
|
|
|
PdfUtil.createPDFCell(tableFont, table, accessDataVo.getProject(), Element.ALIGN_MIDDLE, 5, 1);
|
|
|
@@ -588,10 +585,10 @@ public class PdfUtil {
|
|
|
PdfUtil.createPDFCell(tableTitleFont, table, "调阅项目", Element.ALIGN_MIDDLE, 5, 1);
|
|
|
PdfUtil.createPDFCell(tableTitleFont, table, "存在问题", Element.ALIGN_MIDDLE, 6, 1);
|
|
|
|
|
|
- List<AccessDataVo> exceptionDataList = data.stream().filter(d -> ObjectUtil.equal(0, d.getStatus())).collect(Collectors.toList());
|
|
|
+ List<AccessDataVo> exceptionDataList = data.stream().filter(d -> ObjectUtil.equal(1, d.getStatus())).collect(Collectors.toList());
|
|
|
if (ObjectUtil.isNotEmpty(exceptionDataList)) {
|
|
|
for (int i = 1; i <= exceptionDataList.size(); i++) {
|
|
|
- AccessDataVo accessDataVo = data.get(i - 1);
|
|
|
+ AccessDataVo accessDataVo = exceptionDataList.get(i - 1);
|
|
|
PdfUtil.createPDFCell(tableFont, table, String.valueOf(i), Element.ALIGN_MIDDLE, 2, 1);
|
|
|
PdfUtil.createPDFCell(tableFont, table, accessDataVo.getAreaName(), Element.ALIGN_MIDDLE, 6, 1);
|
|
|
PdfUtil.createPDFCell(tableFont, table, accessDataVo.getProject(), Element.ALIGN_MIDDLE, 5, 1);
|