feat(printer): 打印订单成功后自动发放优惠券

- 在打印订单成功后调用自动发券服务
- 添加对自动发券异常的捕获与日志记录
- 确保发券失败不影响主业务流程
This commit is contained in:
2025-12-06 17:32:21 +08:00
parent c92ea20575
commit a2378053a8

View File

@@ -481,6 +481,19 @@ public class PrinterServiceImpl implements PrinterService {
memberId, faceId, scenicId, e.getMessage());
}
}
if (normalCount > 0) {
try {
autoCouponService.autoGrantCoupon(
memberId,
faceId,
scenicId,
ProductType.PHOTO_PRINT
);
} catch (Exception e) {
log.warn("自动发券失败,不影响下单流程: memberId={}, faceId={}, scenicId={}, error={}",
memberId, faceId, scenicId, e.getMessage());
}
}
request.setAutoUseCoupon(true);
request.setPreviewOnly(true); // 仅查询价格,不实际使用优惠