Commit 46ea78e6 by weijiguang

test

parent 94a04f1a
...@@ -231,11 +231,19 @@ public class CouponUserServiceImpl implements ICouponUserService { ...@@ -231,11 +231,19 @@ public class CouponUserServiceImpl implements ICouponUserService {
orderDetails.forEach(orderDetail -> { orderDetails.forEach(orderDetail -> {
BigDecimal couponAmount = couponAmountMap.get(orderDetail.getSkuId()); BigDecimal couponAmount = couponAmountMap.get(orderDetail.getSkuId());
orderDetail.setCouponAmount(couponAmount == null ? BigDecimal.ZERO : couponAmount.negate()); orderDetail.setCouponAmount(couponAmount == null ? BigDecimal.ZERO : couponAmount.negate());
if (couponAmount.compareTo(BigDecimal.ZERO) > 0) {
if (orderDetail.getOriAmount().add(orderDetail.getCouponAmount()).compareTo(BigDecimal.ZERO) < 0) {
orderDetail.setRealAmount(BigDecimal.ZERO);
} else {
orderDetail.setRealAmount(orderDetail.getOriAmount().add(orderDetail.getCouponAmount()));
}
} else {
if (orderDetail.getAmountShould().add(orderDetail.getCouponAmount()).compareTo(BigDecimal.ZERO) < 0) { if (orderDetail.getAmountShould().add(orderDetail.getCouponAmount()).compareTo(BigDecimal.ZERO) < 0) {
orderDetail.setRealAmount(BigDecimal.ZERO); orderDetail.setRealAmount(BigDecimal.ZERO);
} else { } else {
orderDetail.setRealAmount(orderDetail.getAmountShould().add(orderDetail.getCouponAmount())); orderDetail.setRealAmount(orderDetail.getAmountShould().add(orderDetail.getCouponAmount()));
} }
}
}); });
} }
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment