|
|
|
@ -202,13 +202,7 @@ public class BsOrderServiceImpl implements BsOrderService { |
|
|
|
|
childOrder.setSurplusRefundCount(childOrder.getProductCount()); |
|
|
|
|
|
|
|
|
|
// 计算 子订单 在交易订单金额中的占比
|
|
|
|
|
BigDecimal ratio = childOrder.getProductTotalPrice().divide(order.getTotalPrice(), 2, BigDecimal.ROUND_DOWN).setScale(2); |
|
|
|
|
// 计算子订单退款金额。
|
|
|
|
|
if (order.getPayRealPrice().compareTo(new BigDecimal("0")) == 1) { |
|
|
|
|
childOrder.setSurplusRefundPrice(order.getPayRealPrice().multiply(ratio).setScale(2, BigDecimal.ROUND_DOWN)); |
|
|
|
|
} else { |
|
|
|
|
childOrder.setSurplusRefundPrice(new BigDecimal("0")); |
|
|
|
|
} |
|
|
|
|
BigDecimal ratio = childOrder.getProductTotalPrice().divide(order.getTotalPrice(), 2, BigDecimal.ROUND_DOWN); |
|
|
|
|
|
|
|
|
|
// 计算子订单退款积分
|
|
|
|
|
if (order.getDeduction().getIntegralDiscountPrice() > 0) { |
|
|
|
@ -217,10 +211,27 @@ public class BsOrderServiceImpl implements BsOrderService { |
|
|
|
|
childOrder.setSurplusRefundIntegral(0L); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (order.getDeduction().getCouponDiscountActualPrice().compareTo(BigDecimal.ZERO) == 1) { |
|
|
|
|
// 计算子订单退款金额。
|
|
|
|
|
if (order.getPayRealPrice().compareTo(BigDecimal.ZERO) == 1) { |
|
|
|
|
// 计算实付金额中的占比
|
|
|
|
|
childOrder.setSurplusRefundPrice(order.getPayRealPrice().multiply(ratio).setScale(2, BigDecimal.ROUND_DOWN)); |
|
|
|
|
} else { |
|
|
|
|
childOrder.setSurplusRefundPrice(new BigDecimal("0")); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
childOrder.setSurplusRefundPrice( |
|
|
|
|
// 商品总金额 - 积分抵扣金额
|
|
|
|
|
childOrder.getProductTotalPrice().subtract( |
|
|
|
|
new BigDecimal(childOrder.getSurplusRefundIntegral().toString()).multiply(new BigDecimal("100")) |
|
|
|
|
)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
childOrder.setCouponDiscountPrice(childOrder.getProductTotalPrice().subtract(childOrder.getSurplusRefundPrice())); |
|
|
|
|
childOrder.setIntegralDiscountPrice(childOrder.getSurplusRefundIntegral()); |
|
|
|
|
childOrder.setTotalDeductionPrice( |
|
|
|
|
childOrder.getCouponDiscountPrice().add(new BigDecimal(childOrder.getIntegralDiscountPrice().toString()).multiply(new BigDecimal("100"))) |
|
|
|
|
childOrder.getCouponDiscountPrice() |
|
|
|
|
.add(new BigDecimal(childOrder.getIntegralDiscountPrice().toString()).multiply(new BigDecimal("100"))) |
|
|
|
|
); |
|
|
|
|
childOrder.setProductActualPrice(childOrder.getProductTotalPrice().subtract(childOrder.getTotalDeductionPrice())); |
|
|
|
|
orderChildService.editData(childOrder); |
|
|
|
|