|
@@ -1,5 +1,6 @@
|
|
|
package org.dromara.system.service.impl.app;
|
|
|
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
@@ -202,9 +203,10 @@ public class UserEventServiceImpl implements IUserEventService {
|
|
|
if (athlete == null) {
|
|
|
throw new RuntimeException("用户未关联运动员信息");
|
|
|
}
|
|
|
+ athlete.setUserId(userId);
|
|
|
|
|
|
// 步骤3:查询运动员参与的项目ID列表
|
|
|
- List<Long> projectIds = gameScoreMapper.selectProjectIdsByAthleteId(athlete.getAthleteId());
|
|
|
+ List<Long> projectIds = JSONUtil.toList(athlete.getProjectValue(), Long.class);
|
|
|
if (CollectionUtils.isEmpty(projectIds)) {
|
|
|
// 用户没有参与任何项目
|
|
|
return buildEmptyUserEventInfo(user, athlete);
|
|
@@ -214,7 +216,7 @@ public class UserEventServiceImpl implements IUserEventService {
|
|
|
List<GameEventProject> projects = gameEventProjectMapper.selectBatchIds(projectIds);
|
|
|
|
|
|
// 步骤5:查询赛事信息
|
|
|
- GameEvent event = gameEventMapper.selectById(projects.get(0).getEventId());
|
|
|
+ GameEvent event = gameEventMapper.selectById(athlete.getEventId());
|
|
|
|
|
|
// 步骤6:查询运动员在各项目中的成绩
|
|
|
List<GameScore> scores = gameScoreMapper.selectByAthleteAndProjects(athlete.getAthleteId(), projectIds);
|
|
@@ -282,8 +284,9 @@ public class UserEventServiceImpl implements IUserEventService {
|
|
|
projectList.add(projectInfo);
|
|
|
}
|
|
|
|
|
|
- // 按项目开始时间排序
|
|
|
- projectList.sort(Comparator.comparing(GameEventProjectVo::getStartTime));
|
|
|
+ // 按项目开始时间排序,处理startTime为null的情况
|
|
|
+ projectList.sort(Comparator.comparing(GameEventProjectVo::getStartTime,
|
|
|
+ Comparator.nullsLast(Comparator.naturalOrder())));
|
|
|
result.setProjectList(projectList);
|
|
|
|
|
|
return result;
|