Authored by LUOXC

fixbug

@@ -19,4 +19,8 @@ public class InviteSettlementItemStats { @@ -19,4 +19,8 @@ public class InviteSettlementItemStats {
19 19
20 BigDecimal totalSettleAmount; 20 BigDecimal totalSettleAmount;
21 21
  22 + BigDecimal totalPaidAmount;
  23 +
  24 + BigDecimal totalWaitPayAmount;
  25 +
22 } 26 }
@@ -114,8 +114,8 @@ @@ -114,8 +114,8 @@
114 seller_uid, count(buyer_order_code) order_num 114 seller_uid, count(buyer_order_code) order_num
115 from invite_settlement_item 115 from invite_settlement_item
116 where uid = #{inviterUid,jdbcType=INTEGER} 116 where uid = #{inviterUid,jdbcType=INTEGER}
117 - and status in (1,3)  
118 and type = 1 117 and type = 1
  118 + and status in (1,3,4)
119 GROUP by seller_uid 119 GROUP by seller_uid
120 </select> 120 </select>
121 121
@@ -123,11 +123,13 @@ @@ -123,11 +123,13 @@
123 select 123 select
124 count(1) as 'totalElements', 124 count(1) as 'totalElements',
125 sum(order_amount) as 'totalOrderAmount', 125 sum(order_amount) as 'totalOrderAmount',
126 - sum(settle_amount) as 'totalSettleAmount' 126 + sum(settle_amount) as 'totalSettleAmount',
  127 + sum(if(status=4,settle_amount,0)) as 'totalPaidAmount',
  128 + sum(if(status!=4,settle_amount,0)) as 'totalWaitPayAmount'
127 from invite_settlement_item 129 from invite_settlement_item
128 where uid = #{uid,jdbcType=INTEGER} 130 where uid = #{uid,jdbcType=INTEGER}
129 and type = #{type,jdbcType=INTEGER} 131 and type = #{type,jdbcType=INTEGER}
130 - and status in (1,3) 132 + and status in (1,3,4)
131 and order_create_time between #{startTime,jdbcType=INTEGER} and #{endTime,jdbcType=INTEGER} 133 and order_create_time between #{startTime,jdbcType=INTEGER} and #{endTime,jdbcType=INTEGER}
132 </select> 134 </select>
133 135
@@ -137,7 +139,7 @@ @@ -137,7 +139,7 @@
137 from invite_settlement_item 139 from invite_settlement_item
138 where uid = #{uid,jdbcType=INTEGER} 140 where uid = #{uid,jdbcType=INTEGER}
139 and type = #{type,jdbcType=INTEGER} 141 and type = #{type,jdbcType=INTEGER}
140 - and status in (1,3) 142 + and status in (1,3,4)
141 and order_create_time between #{startTime,jdbcType=INTEGER} and #{endTime,jdbcType=INTEGER} 143 and order_create_time between #{startTime,jdbcType=INTEGER} and #{endTime,jdbcType=INTEGER}
142 order by order_create_time desc 144 order by order_create_time desc
143 limit #{start,jdbcType=INTEGER},#{limit,jdbcType=INTEGER} 145 limit #{start,jdbcType=INTEGER},#{limit,jdbcType=INTEGER}
@@ -99,17 +99,20 @@ public class InviteSettlementServiceImpl implements IInviteSettlementService { @@ -99,17 +99,20 @@ public class InviteSettlementServiceImpl implements IInviteSettlementService {
99 int totalElements = Objects.isNull(stats.getTotalElements()) ? 0 : stats.getTotalElements(); 99 int totalElements = Objects.isNull(stats.getTotalElements()) ? 0 : stats.getTotalElements();
100 BigDecimal totalOrderAmount = Objects.isNull(stats.getTotalOrderAmount()) ? BigDecimal.ZERO : stats.getTotalOrderAmount(); 100 BigDecimal totalOrderAmount = Objects.isNull(stats.getTotalOrderAmount()) ? BigDecimal.ZERO : stats.getTotalOrderAmount();
101 BigDecimal totalSettleAmount = Objects.isNull(stats.getTotalSettleAmount()) ? BigDecimal.ZERO : stats.getTotalSettleAmount(); 101 BigDecimal totalSettleAmount = Objects.isNull(stats.getTotalSettleAmount()) ? BigDecimal.ZERO : stats.getTotalSettleAmount();
  102 + BigDecimal totalPaidAmount = Objects.isNull(stats.getTotalPaidAmount()) ? BigDecimal.ZERO : stats.getTotalPaidAmount();
  103 + BigDecimal totalWaitPayAmount = Objects.isNull(stats.getTotalWaitPayAmount()) ? BigDecimal.ZERO : stats.getTotalWaitPayAmount();
102 InviteSettlementItemListVO.InviteSettlementItemListVOBuilder builder = InviteSettlementItemListVO.builder(); 104 InviteSettlementItemListVO.InviteSettlementItemListVOBuilder builder = InviteSettlementItemListVO.builder();
103 builder.page(page) 105 builder.page(page)
104 .pageSize(limit) 106 .pageSize(limit)
105 .pageTotal((totalElements % limit == 0) ? (totalElements / limit) : (totalElements / limit + 1)) 107 .pageTotal((totalElements % limit == 0) ? (totalElements / limit) : (totalElements / limit + 1))
106 .totalElements(totalElements) 108 .totalElements(totalElements)
107 .totalOrderAmount(formatAmount("¥%s", totalOrderAmount)) 109 .totalOrderAmount(formatAmount("¥%s", totalOrderAmount))
108 - .totalSettleAmount(formatAmount("¥%s", totalSettleAmount)); 110 + .totalSettleAmount(formatAmount("¥%s", totalSettleAmount))
  111 + .totalPaidAmount(formatAmount("¥%s", totalPaidAmount))
  112 + .totalWaitPayAmount(formatAmount("¥%s", totalWaitPayAmount));
109 if (totalElements == 0) { 113 if (totalElements == 0) {
110 return builder 114 return builder
111 - .totalPaidAmount(formatAmount("¥%s", BigDecimal.ZERO))  
112 - .totalWaitPayAmount(formatAmount("¥%s", BigDecimal.ZERO)) 115 +
113 .list(Lists.newArrayList()) 116 .list(Lists.newArrayList())
114 .build(); 117 .build();
115 } 118 }
@@ -128,14 +131,6 @@ public class InviteSettlementServiceImpl implements IInviteSettlementService { @@ -128,14 +131,6 @@ public class InviteSettlementServiceImpl implements IInviteSettlementService {
128 }; 131 };
129 132
130 return builder 133 return builder
131 - .totalPaidAmount(formatAmount("¥%s", list.stream()  
132 - .filter(itemHasPaid)  
133 - .map(InviteSettlementItem::getSettleAmount)  
134 - .reduce(BigDecimal.ZERO, BigDecimal::add)))  
135 - .totalWaitPayAmount(formatAmount("¥%s", list.stream()  
136 - .filter(itemHasPaid.negate())  
137 - .map(InviteSettlementItem::getSettleAmount)  
138 - .reduce(BigDecimal.ZERO, BigDecimal::add)))  
139 .list(list.stream() 134 .list(list.stream()
140 .map(item -> new InviteSettlementItemListVO.InviteSettlementItemVO() 135 .map(item -> new InviteSettlementItemListVO.InviteSettlementItemVO()
141 .setBuyerOrderCode(item.getBuyerOrderCode().toString()) 136 .setBuyerOrderCode(item.getBuyerOrderCode().toString())