From d6b11e01e89fb3148b30d3763bed06ab0b7689d3 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Tue, 25 Oct 2022 10:52:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/OrderCreateHandleServiceImpl.java | 11 +++++------ .../com/hai/order/service/impl/OrderServiceImpl.java | 7 +++++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java index 62e5fb5d..369d92c7 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java @@ -201,7 +201,7 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { childOrder.setTotalPrice(childOrder.getGoodsPrice().multiply(new BigDecimal(childOrder.getSaleCount().toString()))); childOrder.setTotalActualPrice(childOrder.getGoodsActualPrice().multiply(new BigDecimal(childOrder.getSaleCount().toString()))); - childOrder.setTotalDeductionPrice(childOrder.getTotalPrice().subtract(childOrder.getTotalActualPrice())); + childOrder.setTotalDeductionPrice(childOrder.getGoodsPrice().subtract(childOrder.getTotalActualPrice())); childOrderList.add(childOrder); // 是否赠送卡卷 @@ -237,7 +237,7 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { childOrder.setPraiseStatus(0); childOrder.setTotalPrice(childOrder.getGoodsPrice().multiply(new BigDecimal(childOrder.getSaleCount().toString()))); childOrder.setTotalActualPrice(new BigDecimal("0")); - childOrder.setTotalDeductionPrice(childOrder.getTotalPrice().subtract(childOrder.getTotalActualPrice())); + childOrder.setTotalDeductionPrice(new BigDecimal("0")); childOrder.setCreateTime(new Date()); childOrderList.add(childOrder); } @@ -380,11 +380,10 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { throw ErrorHelp.genException(SysCode.System, ErrorCode.UN_MEMBER_ERROR, "订单未达到"+discountUserRel.getHighDiscount().getDiscountCondition()+"元,无法使用此优惠券"); } gasOrder.setDeductionCouponPrice(discountUserRel.getHighDiscount().getDiscountPrice()); - } - else if (discountUserRel.getHighDiscount().getDiscountType() == 2) { + } else if (discountUserRel.getHighDiscount().getDiscountType() == 2) { gasOrder.setDeductionCouponPrice(discountUserRel.getHighDiscount().getDiscountPrice()); - } - else if (discountUserRel.getHighDiscount().getDiscountType() == 3) { + + } else if (discountUserRel.getHighDiscount().getDiscountType() == 3) { // 加油金额 * 折扣 BigDecimal deductionPrice = gasOrder.getGasRefuelPrice() .multiply(discountUserRel.getHighDiscount().getDiscountPrice()) diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java index 9ac08f2e..8b52c974 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java @@ -145,6 +145,7 @@ public class OrderServiceImpl implements OrderService { order.setCreateTime(new Date()); order.setPayGold(0); order.setDeductionCouponPrice(new BigDecimal("0")); + order.setDeductionProductPrice(new BigDecimal("0")); order.setCompanyId(createOrderModel.getCompanyId()); @@ -321,8 +322,10 @@ public class OrderServiceImpl implements OrderService { // 计算订单金额 Map calculateOrderPrice = OrderUtil.calculateOrderPrice(order.getHighChildOrderList()); order.setTotalPrice(new BigDecimal(calculateOrderPrice.get("totalPrice").toString())); - order.setTotalDeductionPrice(new BigDecimal(calculateOrderPrice.get("deductionPrice").toString()).add(order.getDeductionCouponPrice())); - order.setPayablePrice(order.getTotalPrice().subtract(order.getTotalDeductionPrice())); + order.setDeductionCouponPrice(order.getDeductionCouponPrice()); + order.setDeductionProductPrice(new BigDecimal(calculateOrderPrice.get("deductionPrice").toString())); + order.setTotalDeductionPrice(order.getDeductionCouponPrice().add(order.getDeductionProductPrice())); + order.setPayablePrice(new BigDecimal(calculateOrderPrice.get("payablePrice").toString())); order.setPayPrice(order.getPayablePrice()); // 积分抵扣