You've already forked FrameTour-BE
refactor(pricing): 重构自动发券服务方法命名及逻辑
- 将 autoGrantFirstPrintCoupon 方法重命名为 autoGrantCoupon - 修改 findFirstPrintCouponId 方法名为 findFirstCouponId - 调整优惠券名称匹配逻辑,移除对"first"关键字的检查 - 更新调用方 PrinterServiceImpl 中的方法引用 - 优化自动发券异常处理,确保不影响主流程
This commit is contained in:
@@ -441,6 +441,20 @@ public class PrinterServiceImpl implements PrinterService {
|
||||
|
||||
request.setProducts(productItems);
|
||||
|
||||
if (mobileCount > 0) {
|
||||
try {
|
||||
autoCouponService.autoGrantCoupon(
|
||||
memberId,
|
||||
faceId,
|
||||
scenicId,
|
||||
ProductType.PHOTO_PRINT_MU
|
||||
);
|
||||
} catch (Exception e) {
|
||||
log.warn("自动发券失败,不影响下单流程: memberId={}, faceId={}, scenicId={}, error={}",
|
||||
memberId, faceId, scenicId, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 使用统一价格计算服务
|
||||
PriceCalculationResult result = priceCalculationService.calculatePrice(request);
|
||||
|
||||
@@ -589,21 +603,6 @@ public class PrinterServiceImpl implements PrinterService {
|
||||
throw new BaseException("没有可打印的照片");
|
||||
}
|
||||
|
||||
// 【新增】检测并自动发放首次打印优惠券
|
||||
if (mobileCount > 0) {
|
||||
try {
|
||||
autoCouponService.autoGrantFirstPrintCoupon(
|
||||
memberId,
|
||||
faceId,
|
||||
scenicId,
|
||||
ProductType.PHOTO_PRINT_MU
|
||||
);
|
||||
} catch (Exception e) {
|
||||
log.warn("自动发券失败,不影响下单流程: memberId={}, faceId={}, scenicId={}, error={}",
|
||||
memberId, faceId, scenicId, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
OrderEntity order = new OrderEntity();
|
||||
Long orderId = SnowFlakeUtil.getLongId();
|
||||
redisTemplate.opsForValue().set("printer_size:"+orderId, printer.getPreferPaper(), 60, TimeUnit.SECONDS);
|
||||
|
||||
Reference in New Issue
Block a user