Authored by LUOXC

fix bug

@@ -68,11 +68,16 @@ public class HkAccountSettlement { @@ -68,11 +68,16 @@ public class HkAccountSettlement {
68 log.info("{} settle fail, it already in the process", uid); 68 log.info("{} settle fail, it already in the process", uid);
69 return; 69 return;
70 } 70 }
71 - List<TradeBills> tradeBills = tradeBillsMapper.selectByUidTradeStatusAndDealTime(uid, HK_AMOUNT_PAYING.getCode(), dealTime);  
72 - Integer sumIncome = tradeBills.stream().mapToInt(TradeBills::getIncomeOutcome).sum(); 71 + List<TradeBills> tradeBills = tradeBillsMapper.selectByUidTradeStatusAndDealTime(uid, HK_AMOUNT_PAYING.getCode(), dealTime).stream()
  72 + // 用户收入
  73 + .filter(e -> e.getIncomeOutcome() == 1)
  74 + .collect(Collectors.toList());
  75 + BigDecimal sumIncome = tradeBills.stream()
  76 + .map(TradeBills::getAmount)
  77 + .reduce(BigDecimal.ZERO, BigDecimal::add);
73 log.info("{} settle, sum income is {}", uid, sumIncome); 78 log.info("{} settle, sum income is {}", uid, sumIncome);
74 // 满足打款条件,通知财务打款 79 // 满足打款条件,通知财务打款
75 - if (sumIncome > 100) { 80 + if (sumIncome.compareTo(BigDecimal.valueOf(100)) > 0) {
76 try { 81 try {
77 log.info("{} settle, send email", uid, sumIncome); 82 log.info("{} settle, send email", uid, sumIncome);
78 List<TradeBillResult> tradeBillResults = getTradeBillResults(uid, tradeBills); 83 List<TradeBillResult> tradeBillResults = getTradeBillResults(uid, tradeBills);
@@ -115,7 +120,7 @@ public class HkAccountSettlement { @@ -115,7 +120,7 @@ public class HkAccountSettlement {
115 .productName(product.getProductName()) 120 .productName(product.getProductName())
116 .rate(BigDecimal.ZERO) 121 .rate(BigDecimal.ZERO)
117 .platformServiceAmount(tradeBill.getSystemAmount()) 122 .platformServiceAmount(tradeBill.getSystemAmount())
118 - .payAmount(BigDecimal.valueOf(tradeBill.getIncomeOutcome())) 123 + .payAmount(tradeBill.getAmount())
119 .payType(tradeBill.getTradeType() == 1 ? "保证金" 124 .payType(tradeBill.getTradeType() == 1 ? "保证金"
120 : tradeBill.getTradeType() == 2 ? "货款" 125 : tradeBill.getTradeType() == 2 ? "货款"
121 : tradeBill.getTradeType() == 3 ? "补偿款" : "") 126 : tradeBill.getTradeType() == 3 ? "补偿款" : "")