|
@@ -683,21 +683,23 @@ public class PurchaseApCheckServiceImpl implements PurchaseApCheckService {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public List<ApCheckAmount> groupCountByCurrency(List<ApCheckAmount> totalTrades) {
|
|
public List<ApCheckAmount> groupCountByCurrency(List<ApCheckAmount> totalTrades) {
|
|
|
- Double rmbCount = totalTrades.stream().filter(tradeCount -> RMB.equals(tradeCount.getCurrency()))
|
|
|
|
|
- .mapToDouble(ApCheckAmount::getCount).sum();
|
|
|
|
|
- Double usdCount = totalTrades.stream().filter(tradeCount -> USD.equals(tradeCount.getCurrency()))
|
|
|
|
|
- .mapToDouble(ApCheckAmount::getCount).sum();
|
|
|
|
|
- Double hkdCount = totalTrades.stream().filter(tradeCount -> HKD.equals(tradeCount.getCurrency()))
|
|
|
|
|
- .mapToDouble(ApCheckAmount::getCount).sum();
|
|
|
|
|
List<ApCheckAmount> resultCounts = new ArrayList<>();
|
|
List<ApCheckAmount> resultCounts = new ArrayList<>();
|
|
|
- if (rmbCount > 0) {
|
|
|
|
|
- resultCounts.add(new ApCheckAmount(RMB, DecimalUtils.decimalPoint(rmbCount, 2)));
|
|
|
|
|
- }
|
|
|
|
|
- if (usdCount > 0) {
|
|
|
|
|
- resultCounts.add(new ApCheckAmount(USD, DecimalUtils.decimalPoint(usdCount, 2)));
|
|
|
|
|
- }
|
|
|
|
|
- if (hkdCount > 0) {
|
|
|
|
|
- resultCounts.add(new ApCheckAmount(HKD, DecimalUtils.decimalPoint(hkdCount, 2)));
|
|
|
|
|
|
|
+ if (null != totalTrades && !CollectionUtils.isEmpty(totalTrades)) {
|
|
|
|
|
+ Double rmbCount = totalTrades.stream().filter(tradeCount -> null != tradeCount && RMB.equals(tradeCount.getCurrency()))
|
|
|
|
|
+ .mapToDouble(ApCheckAmount::getCount).sum();
|
|
|
|
|
+ Double usdCount = totalTrades.stream().filter(tradeCount -> null != tradeCount && USD.equals(tradeCount.getCurrency()))
|
|
|
|
|
+ .mapToDouble(ApCheckAmount::getCount).sum();
|
|
|
|
|
+ Double hkdCount = totalTrades.stream().filter(tradeCount -> null != tradeCount && HKD.equals(tradeCount.getCurrency()))
|
|
|
|
|
+ .mapToDouble(ApCheckAmount::getCount).sum();
|
|
|
|
|
+ if (rmbCount > 0) {
|
|
|
|
|
+ resultCounts.add(new ApCheckAmount(RMB, DecimalUtils.decimalPoint(rmbCount, 2)));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (usdCount > 0) {
|
|
|
|
|
+ resultCounts.add(new ApCheckAmount(USD, DecimalUtils.decimalPoint(usdCount, 2)));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (hkdCount > 0) {
|
|
|
|
|
+ resultCounts.add(new ApCheckAmount(HKD, DecimalUtils.decimalPoint(hkdCount, 2)));
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
return resultCounts;
|
|
return resultCounts;
|
|
|
}
|
|
}
|
|
@@ -841,6 +843,7 @@ public class PurchaseApCheckServiceImpl implements PurchaseApCheckService {
|
|
|
totalTrades.addAll(trades);
|
|
totalTrades.addAll(trades);
|
|
|
threadsSignal.countDown();
|
|
threadsSignal.countDown();
|
|
|
});
|
|
});
|
|
|
|
|
+ threadsSignal.await();
|
|
|
return groupCountByCurrency(totalTrades);
|
|
return groupCountByCurrency(totalTrades);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|