diff --git a/dcsoft-modules/dcsoft-system/src/main/java/com/dcsoft/system/visitor/controller/VisCarryStuffController.java b/dcsoft-modules/dcsoft-system/src/main/java/com/dcsoft/system/visitor/controller/VisCarryStuffController.java index 7024915..ea21bb3 100644 --- a/dcsoft-modules/dcsoft-system/src/main/java/com/dcsoft/system/visitor/controller/VisCarryStuffController.java +++ b/dcsoft-modules/dcsoft-system/src/main/java/com/dcsoft/system/visitor/controller/VisCarryStuffController.java @@ -588,8 +588,8 @@ public class VisCarryStuffController extends BaseController { PdfWriter writer = PdfWriter.getInstance(document, baos); // 添加水印事件处理器 - PdfWatermark pdfWatermark = new PdfWatermark(watermarkUrl); - writer.setPageEvent(pdfWatermark); +// PdfWatermark pdfWatermark = new PdfWatermark(watermarkUrl); +// writer.setPageEvent(pdfWatermark); document.open(); @@ -649,16 +649,61 @@ public class VisCarryStuffController extends BaseController { } document.add(dataTable); + document.add(new Paragraph("\n")); // 增加空行间距 - // 生成二维码图片 + // 创建底部表格(2列:左边二维码+文字,右边水印+文字) + PdfPTable footerTable = new PdfPTable(2); + footerTable.setWidthPercentage(80); // 调整表格宽度为80% + footerTable.setHorizontalAlignment(Element.ALIGN_CENTER); // 表格整体居中 + footerTable.setSpacingBefore(20f); + + // 左边列:二维码和文字(水平排列) + PdfPTable qrColumn = new PdfPTable(2); + qrColumn.setWidths(new float[]{1, 2}); + qrColumn.setWidthPercentage(100); + + // 添加二维码文字(左)并设置垂直居中 + Paragraph qrText = new Paragraph("出门证二维码:", contentFont); + PdfPCell qrTextCell = new PdfPCell(qrText); + qrTextCell.setVerticalAlignment(Element.ALIGN_MIDDLE); + qrTextCell.setHorizontalAlignment(Element.ALIGN_CENTER); // 文字水平居中 + qrTextCell.setBorder(Rectangle.NO_BORDER); + qrTextCell.setPaddingRight(-100); // 减小右边距 + qrColumn.addCell(qrTextCell); + + // 生成二维码图片(右) CheckCodeVo checkCodeVo = visCarryStuffService.selectStuffCheckCode(id); if (ObjectUtil.isNotNull(checkCodeVo) && StrUtil.isNotBlank(checkCodeVo.getCode())) { BarcodeQRCode qrCode = new BarcodeQRCode(checkCodeVo.getCode(), 120, 120, null); Image qrCodeImage = qrCode.getImage(); qrCodeImage.scaleAbsolute(100, 100); - qrCodeImage.setAlignment(Element.ALIGN_CENTER); + qrColumn.addCell(createCell(qrCodeImage, Element.ALIGN_CENTER)); // 图片居中 } + // 右边列:水印和文字(水平排列) + PdfPTable watermarkColumn = new PdfPTable(2); + watermarkColumn.setWidths(new float[]{1, 2}); + watermarkColumn.setWidthPercentage(100); + + // 添加水印文字(左)并设置垂直居中 + Paragraph watermarkText = new Paragraph("出厂许可授权章:", contentFont); + PdfPCell watermarkTextCell = new PdfPCell(watermarkText); + watermarkTextCell.setVerticalAlignment(Element.ALIGN_MIDDLE); + watermarkTextCell.setHorizontalAlignment(Element.ALIGN_CENTER); // 文字水平居中 + watermarkTextCell.setBorder(Rectangle.NO_BORDER); + watermarkTextCell.setPaddingRight(-80); // 减小右边距 + watermarkColumn.addCell(watermarkTextCell); + + // 添加水印图片(右) + Image watermarkImage = Image.getInstance(watermarkUrl); + watermarkImage.scaleAbsolute(90, 90); + watermarkColumn.addCell(createCell(watermarkImage, Element.ALIGN_CENTER)); // 图片居中 + + // 将左右列添加到底部表格 + footerTable.addCell(createCell(qrColumn, Element.ALIGN_CENTER)); // 左列居中 + footerTable.addCell(createCell(watermarkColumn, Element.ALIGN_CENTER)); // 右列居中 + + document.add(footerTable); document.close(); diff --git a/dcsoft-modules/dcsoft-system/src/main/resources/mapper/system/visitor/VisCarryStuffMapper.xml b/dcsoft-modules/dcsoft-system/src/main/resources/mapper/system/visitor/VisCarryStuffMapper.xml index aae82fa..c4714e6 100644 --- a/dcsoft-modules/dcsoft-system/src/main/resources/mapper/system/visitor/VisCarryStuffMapper.xml +++ b/dcsoft-modules/dcsoft-system/src/main/resources/mapper/system/visitor/VisCarryStuffMapper.xml @@ -161,7 +161,7 @@ and e.user_id = #{userId} and e.vis_time = ]]> #{visTimeStart} and e.vis_time #{visTimeEnd} - and e.exitPermit_no = #{exitPermitNo} + and e.exit_permit_no = #{exitPermitNo} and e.examine_state = #{examineState} and e.is_exist_back = #{isExistBack} and e.create_by = #{createBy} @@ -279,7 +279,7 @@ and e.`name` like concat('%', #{name}, '%') and e.vis_time = ]]> #{visTimeStart} and e.vis_time #{visTimeEnd} - and e.exitPermit_no = #{exitPermitNo} + and e.exit_permit_no = #{exitPermitNo} and e.examine_state = #{examineState} and e.is_exist_back = #{isExistBack} diff --git a/dcsoft-modules/dcsoft-system/src/main/resources/mapper/system/visitor/VisExitOutRecordMapper.xml b/dcsoft-modules/dcsoft-system/src/main/resources/mapper/system/visitor/VisExitOutRecordMapper.xml index d13291e..3f2b619 100644 --- a/dcsoft-modules/dcsoft-system/src/main/resources/mapper/system/visitor/VisExitOutRecordMapper.xml +++ b/dcsoft-modules/dcsoft-system/src/main/resources/mapper/system/visitor/VisExitOutRecordMapper.xml @@ -61,7 +61,7 @@ and e.vis_time #{visTimeEnd} and r.create_time = ]]> #{createTimeStr} and r.create_time #{createTimeEnd} - and e.exitPermit_no = #{exitPermitNo} + and e.exit_permit_no = #{exitPermitNo} and e.`name` like concat('%', #{applyName}, '%') and r.`exit_id` = #{exitId}