feat(voucher): 电子凭证打印增加预约功能

- 在 AppClaimController 中添加了对 morphId 的非空判断,只有在 morphId 存在时才进行打印操作
- 在 VoucherPrintServiceImpl 中增加了景点配置的检查,包括预约功能是否启用和指定的经纪人 ID
This commit is contained in:
2025-08-30 12:59:03 +08:00
parent b1deabc7c1
commit fc8818a595
2 changed files with 18 additions and 2 deletions

View File

@@ -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);

View File

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