|
|
@@ -133,7 +133,7 @@ public class GameEventProjectServiceImpl implements IGameEventProjectService {
|
|
|
});
|
|
|
|
|
|
// 批量计算统计数据
|
|
|
- calculateProjectStats(result.getRecords());
|
|
|
+ calculateProjectStats(bo.getEventId(), result.getRecords());
|
|
|
|
|
|
return TableDataInfo.build(result);
|
|
|
}
|
|
|
@@ -141,7 +141,7 @@ public class GameEventProjectServiceImpl implements IGameEventProjectService {
|
|
|
/**
|
|
|
* 批量计算项目的统计数据(参赛总数、完赛数、未完赛数)
|
|
|
*/
|
|
|
- private void calculateProjectStats(List<GameEventProjectVo> projectList) {
|
|
|
+ private void calculateProjectStats(Long eventId, List<GameEventProjectVo> projectList) {
|
|
|
if (CollectionUtils.isEmpty(projectList)) {
|
|
|
return;
|
|
|
}
|
|
|
@@ -156,7 +156,7 @@ public class GameEventProjectServiceImpl implements IGameEventProjectService {
|
|
|
}
|
|
|
|
|
|
// 数据库聚合查询统计数据
|
|
|
- List<GameProjectStatsVo> statsList = gameScoreMapper.selectStatsByProjectIds(projectIds);
|
|
|
+ List<GameProjectStatsVo> statsList = gameScoreMapper.selectStatsByProjectIds(eventId, projectIds);
|
|
|
|
|
|
// 转换为 Map 方便查找
|
|
|
Map<Long, GameProjectStatsVo> statsMap = statsList.stream()
|
|
|
@@ -166,15 +166,8 @@ public class GameEventProjectServiceImpl implements IGameEventProjectService {
|
|
|
projectList.forEach(vo -> {
|
|
|
GameProjectStatsVo stats = statsMap.get(vo.getProjectId());
|
|
|
if (stats != null) {
|
|
|
- // 根据归类决定总数
|
|
|
- if ("0".equals(vo.getClassification())) {
|
|
|
- // 个人项目
|
|
|
- vo.setTotalParticipants(stats.getAthleteCount());
|
|
|
- } else {
|
|
|
- // 团体项目
|
|
|
- vo.setTotalParticipants(stats.getTeamCount());
|
|
|
- }
|
|
|
- vo.setCompletedParticipants(stats.getCompletedCount());
|
|
|
+ vo.setTotalParticipants(stats.getTotalParticipants());
|
|
|
+ vo.setCompletedParticipants(stats.getCompletedParticipants());
|
|
|
} else {
|
|
|
vo.setTotalParticipants(0);
|
|
|
vo.setCompletedParticipants(0);
|
|
|
@@ -262,6 +255,8 @@ public class GameEventProjectServiceImpl implements IGameEventProjectService {
|
|
|
vo.setRefereeGroups(refereeList);
|
|
|
});
|
|
|
});
|
|
|
+ // 批量计算统计数据
|
|
|
+ calculateProjectStats(bo.getEventId(), list);
|
|
|
return list;
|
|
|
}
|
|
|
|