Authored by LUOXC

fixbug

... ... @@ -19,4 +19,8 @@ public class InviteSettlementItemStats {
BigDecimal totalSettleAmount;
BigDecimal totalPaidAmount;
BigDecimal totalWaitPayAmount;
}
... ...
... ... @@ -114,8 +114,8 @@
seller_uid, count(buyer_order_code) order_num
from invite_settlement_item
where uid = #{inviterUid,jdbcType=INTEGER}
and status in (1,3)
and type = 1
and status in (1,3,4)
GROUP by seller_uid
</select>
... ... @@ -123,11 +123,13 @@
select
count(1) as 'totalElements',
sum(order_amount) as 'totalOrderAmount',
sum(settle_amount) as 'totalSettleAmount'
sum(settle_amount) as 'totalSettleAmount',
sum(if(status=4,settle_amount,0)) as 'totalPaidAmount',
sum(if(status!=4,settle_amount,0)) as 'totalWaitPayAmount'
from invite_settlement_item
where uid = #{uid,jdbcType=INTEGER}
and type = #{type,jdbcType=INTEGER}
and status in (1,3)
and status in (1,3,4)
and order_create_time between #{startTime,jdbcType=INTEGER} and #{endTime,jdbcType=INTEGER}
</select>
... ... @@ -137,7 +139,7 @@
from invite_settlement_item
where uid = #{uid,jdbcType=INTEGER}
and type = #{type,jdbcType=INTEGER}
and status in (1,3)
and status in (1,3,4)
and order_create_time between #{startTime,jdbcType=INTEGER} and #{endTime,jdbcType=INTEGER}
order by order_create_time desc
limit #{start,jdbcType=INTEGER},#{limit,jdbcType=INTEGER}
... ...
... ... @@ -99,17 +99,20 @@ public class InviteSettlementServiceImpl implements IInviteSettlementService {
int totalElements = Objects.isNull(stats.getTotalElements()) ? 0 : stats.getTotalElements();
BigDecimal totalOrderAmount = Objects.isNull(stats.getTotalOrderAmount()) ? BigDecimal.ZERO : stats.getTotalOrderAmount();
BigDecimal totalSettleAmount = Objects.isNull(stats.getTotalSettleAmount()) ? BigDecimal.ZERO : stats.getTotalSettleAmount();
BigDecimal totalPaidAmount = Objects.isNull(stats.getTotalPaidAmount()) ? BigDecimal.ZERO : stats.getTotalPaidAmount();
BigDecimal totalWaitPayAmount = Objects.isNull(stats.getTotalWaitPayAmount()) ? BigDecimal.ZERO : stats.getTotalWaitPayAmount();
InviteSettlementItemListVO.InviteSettlementItemListVOBuilder builder = InviteSettlementItemListVO.builder();
builder.page(page)
.pageSize(limit)
.pageTotal((totalElements % limit == 0) ? (totalElements / limit) : (totalElements / limit + 1))
.totalElements(totalElements)
.totalOrderAmount(formatAmount("¥%s", totalOrderAmount))
.totalSettleAmount(formatAmount("¥%s", totalSettleAmount));
.totalSettleAmount(formatAmount("¥%s", totalSettleAmount))
.totalPaidAmount(formatAmount("¥%s", totalPaidAmount))
.totalWaitPayAmount(formatAmount("¥%s", totalWaitPayAmount));
if (totalElements == 0) {
return builder
.totalPaidAmount(formatAmount("¥%s", BigDecimal.ZERO))
.totalWaitPayAmount(formatAmount("¥%s", BigDecimal.ZERO))
.list(Lists.newArrayList())
.build();
}
... ... @@ -128,14 +131,6 @@ public class InviteSettlementServiceImpl implements IInviteSettlementService {
};
return builder
.totalPaidAmount(formatAmount("¥%s", list.stream()
.filter(itemHasPaid)
.map(InviteSettlementItem::getSettleAmount)
.reduce(BigDecimal.ZERO, BigDecimal::add)))
.totalWaitPayAmount(formatAmount("¥%s", list.stream()
.filter(itemHasPaid.negate())
.map(InviteSettlementItem::getSettleAmount)
.reduce(BigDecimal.ZERO, BigDecimal::add)))
.list(list.stream()
.map(item -> new InviteSettlementItemListVO.InviteSettlementItemVO()
.setBuyerOrderCode(item.getBuyerOrderCode().toString())
... ...