| | |
| | | List<ActivityResponse> content = page.getContent().stream() |
| | | .map(activity -> { |
| | | ActivityResponse response = new ActivityResponse(activity); |
| | | // 设置参赛人数(只统计第一阶段的审核通过学员人数) |
| | | // 设置参赛人数(统计第一阶段的待审核和审核通过学员人数) |
| | | int playerCount = 0; |
| | | Activity firstStage = activityRepository.findFirstStageByActivityId(activity.getId()); |
| | | if (firstStage != null) { |
| | | // 如果有第一阶段,统计第一阶段的审核通过人数 |
| | | Long playerCountLong = activityPlayerRepository.countByStageIdAndState(firstStage.getId(), 1); |
| | | // 如果有第一阶段,统计第一阶段的待审核和审核通过人数 |
| | | Long playerCountLong = activityPlayerRepository.countByStageId(firstStage.getId()); |
| | | playerCount = playerCountLong != null ? playerCountLong.intValue() : 0; |
| | | } else { |
| | | // 如果没有阶段,统计活动本身的审核通过人数 |
| | | Long playerCountLong = activityPlayerRepository.countByActivityIdAndState(activity.getId(), 1); |
| | | // 如果没有阶段,统计活动本身的待审核和审核通过人数 |
| | | Long playerCountLong = activityPlayerRepository.countByActivityId(activity.getId()); |
| | | playerCount = playerCountLong != null ? playerCountLong.intValue() : 0; |
| | | } |
| | | response.setPlayerCount(playerCount); |