Commit 46ea78e6 by weijiguang

test

parent 94a04f1a
...@@ -231,10 +231,18 @@ public class CouponUserServiceImpl implements ICouponUserService { ...@@ -231,10 +231,18 @@ 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 (orderDetail.getAmountShould().add(orderDetail.getCouponAmount()).compareTo(BigDecimal.ZERO) < 0) { if (couponAmount.compareTo(BigDecimal.ZERO) > 0) {
orderDetail.setRealAmount(BigDecimal.ZERO); if (orderDetail.getOriAmount().add(orderDetail.getCouponAmount()).compareTo(BigDecimal.ZERO) < 0) {
orderDetail.setRealAmount(BigDecimal.ZERO);
} else {
orderDetail.setRealAmount(orderDetail.getOriAmount().add(orderDetail.getCouponAmount()));
}
} else { } else {
orderDetail.setRealAmount(orderDetail.getAmountShould().add(orderDetail.getCouponAmount())); if (orderDetail.getAmountShould().add(orderDetail.getCouponAmount()).compareTo(BigDecimal.ZERO) < 0) {
orderDetail.setRealAmount(BigDecimal.ZERO);
} else {
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