|
@@ -123,8 +123,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
|
|
BigDecimal discountAmount = dto.getDiscountAmount() != null ? dto.getDiscountAmount() : BigDecimal.ZERO;
|
|
BigDecimal discountAmount = dto.getDiscountAmount() != null ? dto.getDiscountAmount() : BigDecimal.ZERO;
|
|
|
BigDecimal payAmount = dto.getPayAmount() != null ? dto.getPayAmount() : BigDecimal.ZERO;
|
|
BigDecimal payAmount = dto.getPayAmount() != null ? dto.getPayAmount() : BigDecimal.ZERO;
|
|
|
|
|
|
|
|
- // 验证优惠券(可选,couponId 可以为 null)
|
|
|
|
|
- // 注意:订单总金额、优惠金额、实付金额都由前端计算并传入,后端不再验证
|
|
|
|
|
|
|
+ // 优惠券仅校验是否存在及是否属于该门店,不做金额校验;订单总金额、餐具费、优惠金额、实付金额完全采用前端传参
|
|
|
LifeDiscountCoupon coupon = null;
|
|
LifeDiscountCoupon coupon = null;
|
|
|
|
|
|
|
|
if (dto.getCouponId() != null) {
|
|
if (dto.getCouponId() != null) {
|
|
@@ -209,15 +208,15 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
|
|
Integer addDishCountBefore = orderDetailMapper.selectCount(checkBeforeAddDishWrapper);
|
|
Integer addDishCountBefore = orderDetailMapper.selectCount(checkBeforeAddDishWrapper);
|
|
|
isFirstAddDish = (addDishCountBefore == null || addDishCountBefore == 0);
|
|
isFirstAddDish = (addDishCountBefore == null || addDishCountBefore == 0);
|
|
|
|
|
|
|
|
- // 更新订单信息(使用前端计算的金额,但经过后端验证)
|
|
|
|
|
|
|
+ // 更新订单信息(完全采用前端传参,不做金额校验)
|
|
|
order.setDinerCount(dto.getDinerCount());
|
|
order.setDinerCount(dto.getDinerCount());
|
|
|
order.setContactPhone(dto.getContactPhone());
|
|
order.setContactPhone(dto.getContactPhone());
|
|
|
order.setTablewareFee(tablewareFee);
|
|
order.setTablewareFee(tablewareFee);
|
|
|
- order.setTotalAmount(totalAmount); // 使用验证后的订单总金额
|
|
|
|
|
|
|
+ order.setTotalAmount(totalAmount);
|
|
|
order.setCouponId(dto.getCouponId());
|
|
order.setCouponId(dto.getCouponId());
|
|
|
order.setCurrentCouponId(dto.getCouponId());
|
|
order.setCurrentCouponId(dto.getCouponId());
|
|
|
- order.setDiscountAmount(discountAmount); // 使用验证后的优惠金额
|
|
|
|
|
- order.setPayAmount(payAmount); // 使用验证后的实付金额
|
|
|
|
|
|
|
+ order.setDiscountAmount(discountAmount);
|
|
|
|
|
+ order.setPayAmount(payAmount);
|
|
|
order.setRemark(dto.getRemark());
|
|
order.setRemark(dto.getRemark());
|
|
|
order.setUpdatedUserId(userId);
|
|
order.setUpdatedUserId(userId);
|
|
|
order.setUpdatedTime(now);
|
|
order.setUpdatedTime(now);
|
|
@@ -257,11 +256,11 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
|
|
order.setPayUserId(userId);
|
|
order.setPayUserId(userId);
|
|
|
order.setPayUserPhone(userPhone);
|
|
order.setPayUserPhone(userPhone);
|
|
|
order.setOrderStatus(0); // 待支付
|
|
order.setOrderStatus(0); // 待支付
|
|
|
- order.setTotalAmount(totalAmount); // 使用验证后的订单总金额
|
|
|
|
|
|
|
+ order.setTotalAmount(totalAmount);
|
|
|
order.setCouponId(dto.getCouponId());
|
|
order.setCouponId(dto.getCouponId());
|
|
|
- order.setCurrentCouponId(dto.getCouponId()); // 记录当前使用的优惠券
|
|
|
|
|
- order.setDiscountAmount(discountAmount); // 使用验证后的优惠金额
|
|
|
|
|
- order.setPayAmount(payAmount); // 使用验证后的实付金额
|
|
|
|
|
|
|
+ order.setCurrentCouponId(dto.getCouponId());
|
|
|
|
|
+ order.setDiscountAmount(discountAmount);
|
|
|
|
|
+ order.setPayAmount(payAmount);
|
|
|
|
|
|
|
|
// 如果immediatePay为0,只创建订单不支付;为1则创建订单并支付
|
|
// 如果immediatePay为0,只创建订单不支付;为1则创建订单并支付
|
|
|
// 暂时不实现立即支付,由前端调用支付接口
|
|
// 暂时不实现立即支付,由前端调用支付接口
|
|
@@ -323,7 +322,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 创建订单明细
|
|
|
|
|
|
|
+ // 创建订单明细(单价、小计来自购物车)
|
|
|
// 如果是更新订单,需要判断哪些商品是新增的或数量增加的,标记为加餐
|
|
// 如果是更新订单,需要判断哪些商品是新增的或数量增加的,标记为加餐
|
|
|
// 餐具的特殊ID(用于标识餐具项)
|
|
// 餐具的特殊ID(用于标识餐具项)
|
|
|
final Integer TABLEWARE_CUISINE_ID = -1;
|
|
final Integer TABLEWARE_CUISINE_ID = -1;
|