From 62f198071393409f234e6d4843cd278fca96d014 Mon Sep 17 00:00:00 2001 From: zc Date: Thu, 24 Jul 2025 15:18:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B4=E5=AE=89pdf=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/VisCarryStuffController.java | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) 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 98798fc..8077265 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 @@ -567,10 +567,6 @@ public class VisCarryStuffController extends BaseController { }); } - //查询申请二维码 - CheckCodeVo checkCodeVo = visCarryStuffService.selectStuffCheckCode(id); - String code = checkCodeVo.getCode(); - // 创建PDF文档 Document document = new Document(new RectangleReadOnly(842F, 595F)); document.setMargins(60, 60, 72, 72); @@ -623,14 +619,17 @@ public class VisCarryStuffController extends BaseController { rightColumn.setWidthPercentage(100); // 生成二维码图片 - BarcodeQRCode qrCode = new BarcodeQRCode(code, 100, 100, null); - Image qrCodeImage = qrCode.getImage(); - qrCodeImage.scaleAbsolute(100, 100); - qrCodeImage.setAlignment(Element.ALIGN_CENTER); - - // 添加二维码到右边列 - rightColumn.addCell(createCell(qrCodeImage, Element.ALIGN_CENTER)); - rightColumn.addCell(createCell(new Paragraph("出门证二维码", contentFont), Element.ALIGN_CENTER)); + CheckCodeVo checkCodeVo = visCarryStuffService.selectStuffCheckCode(id); + if (ObjectUtil.isNotNull(checkCodeVo) && StrUtil.isNotBlank(checkCodeVo.getCode())) { + BarcodeQRCode qrCode = new BarcodeQRCode(checkCodeVo.getCode(), 100, 100, null); + Image qrCodeImage = qrCode.getImage(); + qrCodeImage.scaleAbsolute(100, 100); + qrCodeImage.setAlignment(Element.ALIGN_CENTER); + + // 添加二维码到右边列 + rightColumn.addCell(createCell(qrCodeImage, Element.ALIGN_CENTER)); + rightColumn.addCell(createCell(new Paragraph("出门证二维码", contentFont), Element.ALIGN_CENTER)); + } // 将左右列添加到主表格 mainTable.addCell(createCell(leftColumn, Element.ALIGN_LEFT));