|
@@ -182,6 +182,7 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
|
|
|
if (!hasStock(cartPromotionItemList)) {
|
|
|
Asserts.fail("库存不足,无法下单");
|
|
|
}
|
|
|
+ BigDecimal couponAmount = BigDecimal.ZERO;
|
|
|
//判断使用使用了优惠券
|
|
|
if (StringUtil.isEmpty(orderParam.getCouponId())) {
|
|
|
//不用优惠券
|
|
@@ -199,7 +200,6 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
|
|
|
currentMember.getId(), orderParam.getCouponId(), orderParam.getOrderAmount(),
|
|
|
orderParam.getPlatformType());
|
|
|
CouponInfoApi data = couponInfoApiHttpResponseResult.getData();
|
|
|
- BigDecimal couponAmount = BigDecimal.ZERO;
|
|
|
if(data != null) {
|
|
|
couponAmount = data.getDiscountedPrices();
|
|
|
}
|
|
@@ -260,7 +260,7 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
|
|
|
order.setIntegrationAmount(calcIntegrationAmount(orderItemList));
|
|
|
}
|
|
|
BigDecimal payAmount = calcPayAmount(order);
|
|
|
- if (payAmount.compareTo(orderParam.getOrderAmount()) != 0) {
|
|
|
+ if (payAmount.compareTo(order.getTotalAmount().subtract(couponAmount)) != 0) {
|
|
|
throw new BizException("订单金额校验不通过");
|
|
|
}
|
|
|
order.setPayAmount(payAmount);
|
|
@@ -1304,6 +1304,7 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
|
|
|
* @param orderItemList 可用优惠券的下单商品商品
|
|
|
*/
|
|
|
private void calcPerCouponAmount(List<OmsOrderItem> orderItemList, BigDecimal coupon) {
|
|
|
+
|
|
|
BigDecimal totalAmount = calcTotalAmount(orderItemList);
|
|
|
for (OmsOrderItem orderItem : orderItemList) {
|
|
|
//(商品价格/可用商品总价)*优惠券面额
|