|
|
@@ -2529,14 +2529,14 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
int month = DateUtil.month(orderDon.getCreatedTime()) + 1;
|
|
|
BigDecimal refundBalance = BigDecimal.ZERO;
|
|
|
BigDecimal refundMoney = BigDecimal.ZERO;
|
|
|
+ //订单金额
|
|
|
+ BigDecimal money = orderDon.getMoney();
|
|
|
+ BigDecimal balance = Optional.ofNullable(orderDon.getBalance()).orElse(BigDecimal.ZERO);
|
|
|
+ BigDecimal orderTotalMoney = money.add(balance);
|
|
|
//2年
|
|
|
if ((sku.getDays() != null && sku.getDays() == 730) || (sku.getMonths() != null && sku.getMonths() == 24)) {
|
|
|
//第二年未生效
|
|
|
if (orderDon.getCreatedTime().after(DateUtil.offsetMonth(DateTime.now(), -12))) {
|
|
|
- //将第二年的金额 按订单金额折算一半
|
|
|
- BigDecimal money = orderDon.getMoney();
|
|
|
- BigDecimal balance = Optional.ofNullable(orderDon.getBalance()).orElse(BigDecimal.ZERO);
|
|
|
- BigDecimal orderTotalMoney = money.add(balance);
|
|
|
//兑换码订单
|
|
|
if (orderTotalMoney.compareTo(BigDecimal.ZERO) == 0) {
|
|
|
orderTotalMoney = sku.getPrice();
|
|
|
@@ -2547,6 +2547,7 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
} else {
|
|
|
if (thisRefundMoney.compareTo(money) > 0) {
|
|
|
refundMoney = money;
|
|
|
+ refundBalance = thisRefundMoney.subtract(money);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -2561,6 +2562,10 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
//12月买的 退200余额
|
|
|
refundBalance = refundBalance.add(BigDecimal.valueOf(20000));
|
|
|
}
|
|
|
+ //超过订单金额 计算剩余的余额
|
|
|
+ if (refundMoney.add(refundBalance).compareTo(orderTotalMoney) > 0) {
|
|
|
+ refundBalance = orderTotalMoney.subtract(refundMoney);
|
|
|
+ }
|
|
|
orderRefundDto.setRefundMoney(refundMoney);
|
|
|
orderRefundDto.setRefundBalance(refundBalance);
|
|
|
return orderRefundDto;
|