回填退款前置

This commit is contained in:
2025-03-06 14:43:39 +08:00
parent f8793b483a
commit f340e84876
3 changed files with 14 additions and 12 deletions

View File

@@ -30,6 +30,7 @@ dubbo:
name: account-server name: account-server
qos-port: 22222 qos-port: 22222
qos-enable: true qos-enable: true
serialize-check-status: DISABLE
registry: registry:
address: nacos://121.40.109.122:8848 # Nacos 服务地址 address: nacos://121.40.109.122:8848 # Nacos 服务地址
group: server-test group: server-test

View File

@@ -32,6 +32,7 @@ dubbo:
name: order-server name: order-server
qos-port: 22232 qos-port: 22232
qos-enable: true qos-enable: true
serialize-check-status: DISABLE
registry: registry:
address: nacos://121.40.109.122:8848 # Nacos 服务地址 address: nacos://121.40.109.122:8848 # Nacos 服务地址
group: server-test group: server-test

View File

@@ -300,18 +300,18 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
//减去满减优惠券 //减去满减优惠券
newTotalAmount = newTotalAmount.subtract(discountAmount.getPrice()); newTotalAmount = newTotalAmount.subtract(discountAmount.getPrice());
//积分抵扣 金额范围校验 抵扣金额校验 //积分抵扣 金额范围校验 抵扣金额校验
if (param.getPointsNum() > 0) { // if (param.getPointsNum() > 0) {
if (pointSetting.getMinPaymentAmount().compareTo(newTotalAmount) > 0) { // if (pointSetting.getMinPaymentAmount().compareTo(newTotalAmount) > 0) {
throw new ValidateException("生成支付订单失败,未满足积分抵扣最低门槛"); // throw new ValidateException("生成支付订单失败,未满足积分抵扣最低门槛");
} // }
if (pointSetting.getMaxDeductionRatio().multiply(newTotalAmount).compareTo(param.getPointsDiscountAmount()) < 0) { // if (pointSetting.getMaxDeductionRatio().multiply(newTotalAmount).compareTo(param.getPointsDiscountAmount()) < 0) {
throw new ValidateException("生成支付订单失败,积分抵扣金额已超出最大抵扣金额"); // throw new ValidateException("生成支付订单失败,积分抵扣金额已超出最大抵扣金额");
} // }
BigDecimal pointAmount = new BigDecimal(param.getPointsNum()).divide(new BigDecimal(pointSetting.getEquivalentPoints()), 2, RoundingMode.DOWN); // BigDecimal pointAmount = new BigDecimal(param.getPointsNum()).divide(new BigDecimal(pointSetting.getEquivalentPoints()), 2, RoundingMode.DOWN);
if (pointAmount.compareTo(param.getPointsDiscountAmount()) != 0) { // if (pointAmount.compareTo(param.getPointsDiscountAmount()) != 0) {
throw new ValidateException("生成支付订单失败,积分抵扣金额不正确"); // throw new ValidateException("生成支付订单失败,积分抵扣金额不正确");
} // }
} // }
log.info("支付前置2订单金额{} ", newTotalAmount); log.info("支付前置2订单金额{} ", newTotalAmount);
newTotalAmount = newTotalAmount.subtract(param.getPointsDiscountAmount()); newTotalAmount = newTotalAmount.subtract(param.getPointsDiscountAmount());
log.info("支付前置3订单金额{} ", newTotalAmount); log.info("支付前置3订单金额{} ", newTotalAmount);