|
@@ -413,4 +413,19 @@ public class AssetService {
|
|
|
});
|
|
});
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 排行榜
|
|
|
|
|
+ */
|
|
|
|
|
+ public void leaderboard(Long userId, int size) {
|
|
|
|
|
+ List<TokenHistory> all = tokenHistoryRepo.findAllByPriceIsNotNullAndOperationLike("出售");
|
|
|
|
|
+ Map<Long, Long> countMap = all.stream()
|
|
|
|
|
+ .collect(Collectors.groupingBy(TokenHistory::getToUserId, Collectors.counting()));
|
|
|
|
|
+ Map<Long, Long> result = new HashMap<>();
|
|
|
|
|
+ countMap.entrySet()
|
|
|
|
|
+ .stream()
|
|
|
|
|
+ .sorted(Map.Entry.comparingByValue())
|
|
|
|
|
+ .forEachOrdered(b -> result.put(b.getKey(), b.getValue()));
|
|
|
|
|
+ if (result.entrySet().size() > size){}
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|