| | |
| | | } |
| | | |
| | | @Override |
| | | public List<AnalyticStatisticsThreeVo> analyticStatisticsThree(AnalyticStatisticsQuery query, List<Complaint> complaints) { |
| | | public List<AnalyticStatisticsThreeVo> analyticStatisticsThree(Integer rank, List<Complaint> complaints) { |
| | | Map<String, List<Complaint>> groupedByProblemType = complaints.stream() |
| | | .collect(Collectors.groupingBy(Complaint::getProblemType)); |
| | | List<AnalyticStatisticsThreeVo> analyticStatisticsThreeVos = groupedByProblemType.entrySet().stream() |
| | |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | analyticStatisticsThreeVos = analyticStatisticsThreeVos.stream().sorted(Comparator.comparing(AnalyticStatisticsThreeVo::getAllTotal).reversed()).collect(Collectors.toList()); |
| | | if (query.getRank() == null) { |
| | | if (rank == null) { |
| | | return analyticStatisticsThreeVos; |
| | | } else if (query.getRank() == 5) { |
| | | } else if (rank == 5) { |
| | | return analyticStatisticsThreeVos.stream().limit(5).collect(Collectors.toList()); |
| | | } else if (query.getRank() == 10) { |
| | | } else if (rank == 10) { |
| | | return analyticStatisticsThreeVos.stream().limit(10).collect(Collectors.toList()); |
| | | } |
| | | return Collections.emptyList(); |