|
@@ -595,6 +595,12 @@ public class UserPaymentCoreServiceImpl implements UserPaymentCoreService {
|
|
|
.map(UserOrderDetail::getExpectPrice)
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
|
|
+
|
|
|
+ // 优惠金额
|
|
|
+ BigDecimal couponAmount = orderDetails.stream()
|
|
|
+ .map(UserOrderDetail::getCouponAmount)
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+
|
|
|
// 实际支付金额
|
|
|
BigDecimal cashAmount = orderDetails.stream()
|
|
|
.map(UserOrderDetail::getActualPrice)
|
|
@@ -603,12 +609,11 @@ public class UserPaymentCoreServiceImpl implements UserPaymentCoreService {
|
|
|
|
|
|
orderReq.originalPrice(originalPrice.setScale(2, RoundingMode.HALF_UP))
|
|
|
.currentPrice(currentPrice.setScale(2, RoundingMode.HALF_UP))
|
|
|
- .paymentCouponAmount(BigDecimal.ZERO)
|
|
|
+ .paymentCouponAmount(couponAmount)
|
|
|
.actualPrice(cashAmount.setScale(2, RoundingMode.HALF_UP));
|
|
|
|
|
|
// 验证支付金额是否匹配
|
|
|
- if (orderReq.getActualPrice().setScale(2, RoundingMode.HALF_UP)
|
|
|
- .compareTo(orderReq.getPaymentCashAmount().setScale(2, RoundingMode.HALF_UP)) != 0) {
|
|
|
+ if (orderReq.getActualPrice().compareTo(orderReq.getPaymentCashAmount()) != 0) {
|
|
|
log.info("executeOrder actualPrice={}", orderReq.getActualPrice());
|
|
|
throw new BizException(999,"支付金额不匹配");
|
|
|
}
|