From 025ae10f17cf5cdb2b4b8e698053dd8dc23c7c94 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Mon, 5 Apr 2021 22:38:53 +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 --- .../java/com/cweb/controller/HighOrderController.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java b/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java index eadd2bf2..d831c4a3 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java @@ -164,8 +164,9 @@ public class HighOrderController { totalPrice = totalPrice.add(childOrder.getTotalPrice()); } + highOrder.setTotalPrice(totalPrice); highOrder.setPayPrice(highOrder.getTotalPrice()); - + // 是否使用了优惠券 if (highDiscountUserRel != null) { highOrder.setMemDiscountName(highDiscountUserRel.getHighDiscount().getDiscountName()); @@ -209,7 +210,7 @@ public class HighOrderController { BigDecimal discountPrice = highDiscountUserRel.getHighDiscount().getDiscountPrice().divide(new BigDecimal("10")); // 订单总额 * 折扣 BigDecimal payPrice = highOrder.getTotalPrice().multiply(discountPrice); - highOrder.setDeductionPrice(highDiscountUserRel.getHighDiscount().getDiscountPrice()); + highOrder.setDeductionPrice(highOrder.getTotalPrice().subtract(payPrice)); highOrder.setPayPrice(payPrice); } } @@ -218,13 +219,12 @@ public class HighOrderController { highOrder.setMemId(userInfoModel.getHighUser().getId()); highOrder.setMemName(userInfoModel.getHighUser().getName()); highOrder.setMemPhone(userInfoModel.getHighUser().getPhone()); - highOrder.setTotalPrice(totalPrice); highOrder.setCreateTime(new Date()); highOrder.setOrderStatus(1); highOrderService.insertOrder(highOrder); - return ResponseMsgUtil.success(getOrderById(highOrder.getId())); + return ResponseMsgUtil.success(highOrderService.getOrderById(highOrder.getId())); } catch (Exception e) { log.error("HighOrderController -> addOrder() error!",e);