Cui Zhi Feng
2024-09-12 1052ecb244fbee754a6406abc54b98ae983f68ac
src/main/java/com/mzl/flower/service/payment/OrderService.java
@@ -444,6 +444,7 @@
        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());
@@ -563,6 +564,7 @@
    }
    private CouponRecordDO useCouponRecord(String orderId, BigDecimal amount, String couponRecordId){
        log.info("使用用户优惠券id: " + couponRecordId + "; 订单id: " + orderId);
        if(StringUtils.isNotEmpty(couponRecordId)){
            //优惠券使用和验证,如果不符合使用条件需要抛出异常。需调用优惠券使用方法
            couponRecordService.useCoupon(couponRecordId, orderId, amount);
@@ -908,6 +910,13 @@
                    result.add(llc);
                }
                BigDecimal t = llc.getTotalAmount();
                if(t == null){
                    t = new BigDecimal(0);
                }
                t = t.add(c.getTotalAmount());
                llc.setTotalAmount(t);
            }
            Map<Long, String> stationMap = prepareStationMap();