From fc8818a59583a13ca3f55221264a445c566a9ae3 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Sat, 30 Aug 2025 12:59:03 +0800 Subject: [PATCH] =?UTF-8?q?feat(voucher):=20=E7=94=B5=E5=AD=90=E5=87=AD?= =?UTF-8?q?=E8=AF=81=E6=89=93=E5=8D=B0=E5=A2=9E=E5=8A=A0=E9=A2=84=E7=BA=A6?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 AppClaimController 中添加了对 morphId 的非空判断,只有在 morphId 存在时才进行打印操作 - 在 VoucherPrintServiceImpl 中增加了景点配置的检查,包括预约功能是否启用和指定的经纪人 ID --- .../basic/controller/mobile/AppClaimController.java | 8 ++++++-- .../service/impl/VoucherPrintServiceImpl.java | 12 ++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/ycwl/basic/controller/mobile/AppClaimController.java b/src/main/java/com/ycwl/basic/controller/mobile/AppClaimController.java index a9cd6d6..d7766fd 100644 --- a/src/main/java/com/ycwl/basic/controller/mobile/AppClaimController.java +++ b/src/main/java/com/ycwl/basic/controller/mobile/AppClaimController.java @@ -42,7 +42,9 @@ public class AppClaimController { VoucherPrintResp voucherPrintResp = voucherPrintService.queryPrintedVoucher(face.getId()); if (voucherPrintResp == null) { // 打印 - voucherPrintResp = voucherPrintService.printVoucherTicket(new VoucherPrintReq(face.getId(), req.getMorphId(), face.getScenicId())); + if (req.getMorphId() != null) { + voucherPrintResp = voucherPrintService.printVoucherTicket(new VoucherPrintReq(face.getId(), req.getMorphId(), face.getScenicId())); + } } if (voucherPrintResp != null) { claimResp.setHasCoupon(false); @@ -57,7 +59,9 @@ public class AppClaimController { VoucherPrintResp voucherPrintResp = voucherPrintService.queryPrintedVoucher(face.getId()); if (voucherPrintResp == null) { // 打印 - voucherPrintResp = voucherPrintService.printBookingTicket(new VoucherPrintReq(face.getId(), req.getMorphId(), face.getScenicId())); + if (req.getMorphId() != null) { + voucherPrintResp = voucherPrintService.printBookingTicket(new VoucherPrintReq(face.getId(), req.getMorphId(), face.getScenicId())); + } } if (voucherPrintResp != null) { claimResp.setHasCoupon(false); diff --git a/src/main/java/com/ycwl/basic/pricing/service/impl/VoucherPrintServiceImpl.java b/src/main/java/com/ycwl/basic/pricing/service/impl/VoucherPrintServiceImpl.java index f911c12..8108f31 100644 --- a/src/main/java/com/ycwl/basic/pricing/service/impl/VoucherPrintServiceImpl.java +++ b/src/main/java/com/ycwl/basic/pricing/service/impl/VoucherPrintServiceImpl.java @@ -16,6 +16,7 @@ import com.ycwl.basic.pricing.service.VoucherPrintService; import com.ycwl.basic.printer.ticket.FeiETicketPrinter; import com.ycwl.basic.repository.FaceRepository; import com.ycwl.basic.repository.ScenicRepository; +import com.ycwl.basic.util.ScenicConfigManager; import com.ycwl.basic.utils.WxMpUtil; import lombok.extern.slf4j.Slf4j; import org.apache.logging.log4j.util.Strings; @@ -183,6 +184,17 @@ public class VoucherPrintServiceImpl implements VoucherPrintService { } request.setScenicId(face.getScenicId()); + ScenicConfigManager config = scenicRepository.getScenicConfigManager(face.getScenicId()); + if (!Boolean.TRUE.equals(config.getBoolean("booking_enable"))) { + return null; + } + Long brokerId = config.getLong("booking_broker_id"); + if (brokerId != null) { + if (!request.getBrokerId().equals(brokerId)) { + return null; + } + } + Long currentUserId = Long.valueOf(BaseContextHandler.getUserId()); // 验证faceId是否属于当前用户