|
|
@@ -573,12 +573,12 @@ public class CmsOrderDonServiceImpl extends ServiceImpl<OrderDonMapper,OrderDon>
|
|
|
|
|
|
//余额现金混合退款
|
|
|
if (OrderRefundReq.RefundType.bxj.name().equals(refundType)) {
|
|
|
- userBenefitsService.addUserBalance(orderDon.getUserId(), orderDon.getBalance(), UserBalanceSourceRecord.Source.refund, 0L, orderDon.getId(), upgradePackage.getName() + UserBalanceSourceRecord.Source.refund.getDesc(), true);
|
|
|
+ userBenefitsService.addUserBalance(orderDon.getUserId(), refundBalance, UserBalanceSourceRecord.Source.refund, 0L, orderDon.getId(), upgradePackage.getName() + UserBalanceSourceRecord.Source.refund.getDesc(), true);
|
|
|
}
|
|
|
|
|
|
if (UpgradeOrderDon.Type.BALANCE.getType().equals(refundType)) {
|
|
|
if (isOnly == null && orderDon.getMoney().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
- userBenefitsService.addUserBalance(orderDon.getUserId(), orderDon.getRefundBalance(), UserBalanceSourceRecord.Source.refund, 0L, orderDon.getId(), upgradePackage.getName() + UserBalanceSourceRecord.Source.refund.getDesc(), true);
|
|
|
+ userBenefitsService.addUserBalance(orderDon.getUserId(), refundMoney, UserBalanceSourceRecord.Source.refund, 0L, orderDon.getId(), upgradePackage.getName() + UserBalanceSourceRecord.Source.refund.getDesc(), true);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -593,9 +593,9 @@ public class CmsOrderDonServiceImpl extends ServiceImpl<OrderDonMapper,OrderDon>
|
|
|
BigDecimal orderDonRefundMoney = Optional.ofNullable(orderDon.getRefundMoney()).orElse(BigDecimal.ZERO);
|
|
|
BigDecimal orderDonRefundBalance = Optional.ofNullable(orderDon.getRefundBalance()).orElse(BigDecimal.ZERO);
|
|
|
String refundType = refundReq.getRefundType();
|
|
|
- if (orderDon.getType() == UpgradeOrderDon.Type.BALANCE && !UpgradeOrderDon.Type.BALANCE.getType().equals(refundType)) {
|
|
|
- throw BusinessRuntimeException.getInstance("余额支付的订单不支持金额退款");
|
|
|
- }
|
|
|
+// if (orderDon.getType() == UpgradeOrderDon.Type.BALANCE && !UpgradeOrderDon.Type.BALANCE.getType().equals(refundType)) {
|
|
|
+// throw BusinessRuntimeException.getInstance("余额支付的订单不支持金额退款");
|
|
|
+// }
|
|
|
if (UpgradeOrderDon.Status.refund == orderDon.getStatus()) {
|
|
|
throw BusinessRuntimeException.getInstance("该订单已退款");
|
|
|
}
|
|
|
@@ -610,15 +610,13 @@ public class CmsOrderDonServiceImpl extends ServiceImpl<OrderDonMapper,OrderDon>
|
|
|
//余额退款
|
|
|
if (UpgradeOrderDon.Type.BALANCE.getType().equals(refundType)) {
|
|
|
refundMoney = orderDonRefundBalance.add(refundMoney);
|
|
|
- if (UpgradeOrderDon.Type.BALANCE == orderDon.getType() && refundMoney.compareTo(balance) > 0) {
|
|
|
- throw BusinessRuntimeException.getInstance("退款余额大于订单支付余额");
|
|
|
- }
|
|
|
if (UpgradeOrderDon.Type.BALANCE != orderDon.getType() && refundMoney.compareTo(money) > 0) {
|
|
|
throw BusinessRuntimeException.getInstance("退款余额大于订单支付金额");
|
|
|
}
|
|
|
orderDon.setRefundBalance(refundMoney);
|
|
|
orderDon.setRefundMoney(BigDecimal.ZERO);
|
|
|
} else if (OrderRefundReq.RefundType.bxj.name().equals(refundType)) {
|
|
|
+ balance = balance.add(money);
|
|
|
if (refundBalance.compareTo(balance) > 0) {
|
|
|
throw BusinessRuntimeException.getInstance("退款余额大于订单支付余额");
|
|
|
}
|
|
|
@@ -939,9 +937,9 @@ public class CmsOrderDonServiceImpl extends ServiceImpl<OrderDonMapper,OrderDon>
|
|
|
BigDecimal orderDonRefundMoney = Optional.ofNullable(orderDon.getRefundMoney()).orElse(BigDecimal.ZERO);
|
|
|
BigDecimal orderDonRefundBalance = Optional.ofNullable(orderDon.getRefundBalance()).orElse(BigDecimal.ZERO);
|
|
|
String refundType = refundReq.getRefundType();
|
|
|
- if (orderDon.getType() == OrderDon.Type.BALANCE && !OrderDon.Type.BALANCE.getType().equals(refundType)) {
|
|
|
- throw BusinessRuntimeException.getInstance("余额支付的订单不支持金额退款");
|
|
|
- }
|
|
|
+// if (orderDon.getType() == OrderDon.Type.BALANCE && !OrderDon.Type.BALANCE.getType().equals(refundType)) {
|
|
|
+// throw BusinessRuntimeException.getInstance("余额支付的订单不支持金额退款");
|
|
|
+// }
|
|
|
if (OrderDon.Status.refund == orderDon.getStatus()) {
|
|
|
throw BusinessRuntimeException.getInstance("该订单已退款");
|
|
|
}
|
|
|
@@ -992,16 +990,14 @@ public class CmsOrderDonServiceImpl extends ServiceImpl<OrderDonMapper,OrderDon>
|
|
|
//余额退款
|
|
|
if (OrderDon.Type.BALANCE.getType().equals(refundType)) {
|
|
|
refundMoney = orderDonRefundBalance.add(refundMoney);
|
|
|
- if (OrderDon.Type.BALANCE == orderDon.getType() && refundMoney.compareTo(balance) > 0) {
|
|
|
- throw BusinessRuntimeException.getInstance("退款余额大于订单支付余额");
|
|
|
- }
|
|
|
if (OrderDon.Type.BALANCE != orderDon.getType() && refundMoney.compareTo(money) > 0) {
|
|
|
throw BusinessRuntimeException.getInstance("退款余额大于订单支付金额");
|
|
|
}
|
|
|
orderDon.setRefundBalance(refundMoney);
|
|
|
} else if (OrderRefundReq.RefundType.bxj.name().equals(refundType)) {
|
|
|
+ balance = balance.add(money);
|
|
|
if (refundBalance.compareTo(balance) > 0) {
|
|
|
- throw BusinessRuntimeException.getInstance("退款余额大于订单支付余额");
|
|
|
+ throw BusinessRuntimeException.getInstance("退款余额大于订单总金额");
|
|
|
}
|
|
|
refundBalance = refundBalance.add(orderDonRefundBalance);
|
|
|
orderDon.setRefundBalance(refundBalance);
|
|
|
@@ -1094,7 +1090,7 @@ public class CmsOrderDonServiceImpl extends ServiceImpl<OrderDonMapper,OrderDon>
|
|
|
}
|
|
|
if (OrderDon.Type.BALANCE.getType().equals(refundType)) {
|
|
|
if (isOnly == null && orderDon.getMoney().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
- userBenefitsService.addUserBalance(orderDon.getUserId(), orderDon.getRefundBalance(), UserBalanceSourceRecord.Source.refund, orderDon.getYhsId(), orderDon.getId(), goodsDon.getTitle() + UserBalanceSourceRecord.Source.refund.getDesc(), true);
|
|
|
+ userBenefitsService.addUserBalance(orderDon.getUserId(), refundMoney, UserBalanceSourceRecord.Source.refund, orderDon.getYhsId(), orderDon.getId(), goodsDon.getTitle() + UserBalanceSourceRecord.Source.refund.getDesc(), true);
|
|
|
}
|
|
|
} else {
|
|
|
//余额退款不需要扣除积分
|