|
|
@@ -853,7 +853,7 @@ public class LifeUserOrderService extends ServiceImpl<LifeUserOrderMapper, LifeU
|
|
|
private static void calcExpectIncome(LifeUserOrderVo lifeUserOrderVo) {
|
|
|
// 退款记录
|
|
|
List<OrderCouponMiddle> orderCouponMiddleList = lifeUserOrderVo.getOrderCouponMiddleList();
|
|
|
- List<OrderCouponMiddle> refundList = orderCouponMiddleList.stream().filter(x -> x.getStatus() == 5).collect(Collectors.toList());
|
|
|
+ List<OrderCouponMiddle> refundList = orderCouponMiddleList.stream().filter(x -> x.getStatus() == OrderStatusEnum.REFUND.getStatus()).collect(Collectors.toList());
|
|
|
lifeUserOrderVo.setRefundList(refundList);
|
|
|
// 预计收入
|
|
|
// 退款金额
|
|
|
@@ -862,14 +862,14 @@ public class LifeUserOrderService extends ServiceImpl<LifeUserOrderMapper, LifeU
|
|
|
refundAmount = refundList.stream().map(OrderCouponMiddle::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
}
|
|
|
// 预计收入
|
|
|
- BigDecimal expectIncome = new BigDecimal(lifeUserOrderVo.getPrice()).subtract(refundAmount);
|
|
|
+ BigDecimal expectIncome = new BigDecimal(lifeUserOrderVo.getFinalPrice()).subtract(refundAmount);
|
|
|
String commissionRateStr = lifeUserOrderVo.getCommissionRate();
|
|
|
BigDecimal commissionRate = BigDecimal.ZERO;
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(commissionRateStr)) {
|
|
|
try {
|
|
|
// 将字符串转换为 BigDecimal,并除以 100(转换为小数)
|
|
|
commissionRate = new BigDecimal(commissionRateStr)
|
|
|
- .divide(new BigDecimal("100"), 4, RoundingMode.HALF_UP);
|
|
|
+ .divide(new BigDecimal("100"), 4, RoundingMode.DOWN);
|
|
|
// 保留 4 位小数,四舍五入(确保计算精度)
|
|
|
} catch (NumberFormatException e) {
|
|
|
// 处理非数字格式的异常(如 commissionRate 为空或非法字符)
|