兴安出门证样式优化
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@
|
||||
<if test="userId != null ">and e.user_id = #{userId}</if>
|
||||
<if test="visTimeStart != null">and e.vis_time <![CDATA[ >= ]]> #{visTimeStart}</if>
|
||||
<if test="visTimeEnd != null">and e.vis_time <![CDATA[ <= ]]> #{visTimeEnd}</if>
|
||||
<if test="exitPermitNo != null and exitPermitNo != ''">and e.exitPermit_no = #{exitPermitNo}</if>
|
||||
<if test="exitPermitNo != null and exitPermitNo != ''">and e.exit_permit_no = #{exitPermitNo}</if>
|
||||
<if test="examineState != null and examineState != '' and examineState != 3">and e.examine_state = #{examineState}</if>
|
||||
<if test="isExistBack != null">and e.is_exist_back = #{isExistBack}</if>
|
||||
<if test="createBy != null">and e.create_by = #{createBy}</if>
|
||||
@@ -279,7 +279,7 @@
|
||||
<if test="name != null and name != ''">and e.`name` like concat('%', #{name}, '%')</if>
|
||||
<if test="visTimeStart != null">and e.vis_time <![CDATA[ >= ]]> #{visTimeStart}</if>
|
||||
<if test="visTimeEnd != null">and e.vis_time <![CDATA[ <= ]]> #{visTimeEnd}</if>
|
||||
<if test="exitPermitNo != null and exitPermitNo != ''">and e.exitPermit_no = #{exitPermitNo}</if>
|
||||
<if test="exitPermitNo != null and exitPermitNo != ''">and e.exit_permit_no = #{exitPermitNo}</if>
|
||||
<if test="examineState != null and examineState != '' and examineState != 3">and e.examine_state = #{examineState}</if>
|
||||
<if test="isExistBack != null">and e.is_exist_back = #{isExistBack}</if>
|
||||
<if test="ids != null and ids.size() > 0">
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
<if test="visTimeEnd != null">and e.vis_time <![CDATA[ <= ]]> #{visTimeEnd}</if>
|
||||
<if test="createTimeStr != null">and r.create_time <![CDATA[ >= ]]> #{createTimeStr}</if>
|
||||
<if test="createTimeEnd != null">and r.create_time <![CDATA[ <= ]]> #{createTimeEnd}</if>
|
||||
<if test="exitPermitNo != null and exitPermitNo != ''">and e.exitPermit_no = #{exitPermitNo}</if>
|
||||
<if test="exitPermitNo != null and exitPermitNo != ''">and e.exit_permit_no = #{exitPermitNo}</if>
|
||||
<if test="applyName != null and applyName != ''">and e.`name` like concat('%', #{applyName}, '%')</if>
|
||||
<if test="exitId != null">and r.`exit_id` = #{exitId}</if>
|
||||
<if test="exitIds != null and exitIds.size() > 0">
|
||||
|
||||
Reference in New Issue
Block a user