'提交代码'

dev-discount
胡锐 4 years ago
parent 59c8627ce3
commit 025ae10f17
  1. 8
      hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java

@ -164,8 +164,9 @@ public class HighOrderController {
totalPrice = totalPrice.add(childOrder.getTotalPrice()); totalPrice = totalPrice.add(childOrder.getTotalPrice());
} }
highOrder.setTotalPrice(totalPrice);
highOrder.setPayPrice(highOrder.getTotalPrice()); highOrder.setPayPrice(highOrder.getTotalPrice());
// 是否使用了优惠券 // 是否使用了优惠券
if (highDiscountUserRel != null) { if (highDiscountUserRel != null) {
highOrder.setMemDiscountName(highDiscountUserRel.getHighDiscount().getDiscountName()); highOrder.setMemDiscountName(highDiscountUserRel.getHighDiscount().getDiscountName());
@ -209,7 +210,7 @@ public class HighOrderController {
BigDecimal discountPrice = highDiscountUserRel.getHighDiscount().getDiscountPrice().divide(new BigDecimal("10")); BigDecimal discountPrice = highDiscountUserRel.getHighDiscount().getDiscountPrice().divide(new BigDecimal("10"));
// 订单总额 * 折扣 // 订单总额 * 折扣
BigDecimal payPrice = highOrder.getTotalPrice().multiply(discountPrice); BigDecimal payPrice = highOrder.getTotalPrice().multiply(discountPrice);
highOrder.setDeductionPrice(highDiscountUserRel.getHighDiscount().getDiscountPrice()); highOrder.setDeductionPrice(highOrder.getTotalPrice().subtract(payPrice));
highOrder.setPayPrice(payPrice); highOrder.setPayPrice(payPrice);
} }
} }
@ -218,13 +219,12 @@ public class HighOrderController {
highOrder.setMemId(userInfoModel.getHighUser().getId()); highOrder.setMemId(userInfoModel.getHighUser().getId());
highOrder.setMemName(userInfoModel.getHighUser().getName()); highOrder.setMemName(userInfoModel.getHighUser().getName());
highOrder.setMemPhone(userInfoModel.getHighUser().getPhone()); highOrder.setMemPhone(userInfoModel.getHighUser().getPhone());
highOrder.setTotalPrice(totalPrice);
highOrder.setCreateTime(new Date()); highOrder.setCreateTime(new Date());
highOrder.setOrderStatus(1); highOrder.setOrderStatus(1);
highOrderService.insertOrder(highOrder); highOrderService.insertOrder(highOrder);
return ResponseMsgUtil.success(getOrderById(highOrder.getId())); return ResponseMsgUtil.success(highOrderService.getOrderById(highOrder.getId()));
} catch (Exception e) { } catch (Exception e) {
log.error("HighOrderController -> addOrder() error!",e); log.error("HighOrderController -> addOrder() error!",e);

Loading…
Cancel
Save