| | |
| | | |
| | | BigDecimal totalAmount = order.getFlowerAmount().add(p.getPacking()).add(transportFee);//使用优惠券之前的总价 |
| | | CouponRecordDO coupon = useCouponRecord(order.getId(), totalAmount, dto.getCouponRecordId()); |
| | | log.info("用户优惠券: " + coupon); |
| | | if(coupon != null){ |
| | | order.setMemberCouponId(coupon.getId()); |
| | | order.setMemberCouponCode(coupon.getCouponCode()); |
| | |
| | | } |
| | | |
| | | private CouponRecordDO useCouponRecord(String orderId, BigDecimal amount, String couponRecordId){ |
| | | log.info("使用用户优惠券id: " + couponRecordId + "; 订单id: " + orderId); |
| | | if(StringUtils.isNotEmpty(couponRecordId)){ |
| | | //优惠券使用和验证,如果不符合使用条件需要抛出异常。需调用优惠券使用方法 |
| | | couponRecordService.useCoupon(couponRecordId, orderId, amount); |