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是否属于当前用户