fix: 集体项目展开后显示队员列表

- 添加 MartialTeamMapper 和 MartialTeam 依赖
- 修改查询逻辑:通过 team_name 关联 martial_team 表
- 正确查询 martial_team_member 获取队员信息

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
2026-01-16 13:46:36 +08:00
co-authored by factory-droid[bot]
parent b95c038971
commit 03074c381b
2 changed files with 67 additions and 13 deletions
+14
View File
@@ -0,0 +1,14 @@
FROM eclipse-temurin:17-jre-alpine
RUN apk add --no-cache curl
WORKDIR /app
COPY target/blade-api.jar /app/blade-api.jar
HEALTHCHECK --interval=30s --timeout=3s --start-period=60s --retries=3 CMD curl -f http://localhost:8123/actuator/health || exit 1
ENV JAVA_OPTS="-Xms512m -Xmx1024m -XX:+UseG1GC"
ENV SPRING_PROFILE=dev
CMD ["sh", "-c", "java ${JAVA_OPTS} -jar /app/blade-api.jar --spring.profiles.active=${SPRING_PROFILE}"]
@@ -8,8 +8,12 @@ import org.springblade.modules.martial.mapper.MartialScheduleDetailMapper;
import org.springblade.modules.martial.mapper.MartialScheduleGroupMapper; import org.springblade.modules.martial.mapper.MartialScheduleGroupMapper;
import org.springblade.modules.martial.mapper.MartialScheduleParticipantMapper; import org.springblade.modules.martial.mapper.MartialScheduleParticipantMapper;
import org.springblade.modules.martial.mapper.MartialAthleteMapper; import org.springblade.modules.martial.mapper.MartialAthleteMapper;
import org.springblade.modules.martial.mapper.MartialTeamMemberMapper;
import org.springblade.modules.martial.pojo.entity.MartialAthlete; import org.springblade.modules.martial.pojo.entity.MartialAthlete;
import org.springblade.modules.martial.mapper.MartialTeamMapper;
import org.springblade.modules.martial.pojo.entity.MartialTeamMember;
import org.springblade.modules.martial.pojo.dto.CompetitionGroupDTO; import org.springblade.modules.martial.pojo.dto.CompetitionGroupDTO;
import org.springblade.modules.martial.pojo.entity.MartialTeam;
import org.springblade.modules.martial.pojo.dto.ParticipantDTO; import org.springblade.modules.martial.pojo.dto.ParticipantDTO;
import org.springblade.modules.martial.pojo.dto.SaveScheduleDraftDTO; import org.springblade.modules.martial.pojo.dto.SaveScheduleDraftDTO;
import org.springblade.modules.martial.pojo.dto.ScheduleResultDTO; import org.springblade.modules.martial.pojo.dto.ScheduleResultDTO;
@@ -58,6 +62,10 @@ public class MartialScheduleServiceImpl extends ServiceImpl<MartialScheduleMappe
private MartialScheduleParticipantMapper scheduleParticipantMapper; private MartialScheduleParticipantMapper scheduleParticipantMapper;
@Autowired @Autowired
private MartialAthleteMapper athleteMapper; private MartialAthleteMapper athleteMapper;
@Autowired
private MartialTeamMemberMapper teamMemberMapper;
@Autowired
private MartialTeamMapper teamMapper;
/** /**
* Task 3.3: 导出赛程表 * Task 3.3: 导出赛程表
@@ -248,19 +256,51 @@ public class MartialScheduleServiceImpl extends ServiceImpl<MartialScheduleMappe
groupDTO.setEstimatedDuration(firstDetail.getEstimatedDuration()); groupDTO.setEstimatedDuration(firstDetail.getEstimatedDuration());
// 获取参赛者列表 // 获取参赛者列表
List<ParticipantDTO> participantDTOs = groupDetails.stream() boolean isCollective = firstDetail.getProjectType() != null && firstDetail.getProjectType() == 2;
.filter(d -> d.getParticipantId() != null) List<ParticipantDTO> participantDTOs = new ArrayList<>();
.map(d -> { for (ScheduleGroupDetailVO d : groupDetails) {
if (d.getParticipantId() == null) continue;
ParticipantDTO dto = new ParticipantDTO(); ParticipantDTO dto = new ParticipantDTO();
dto.setId(d.getParticipantId()); dto.setId(d.getParticipantId());
dto.setSchoolUnit(d.getOrganization()); dto.setSchoolUnit(d.getOrganization());
dto.setStatus(d.getCheckInStatus() != null ? d.getCheckInStatus() : "未签到"); dto.setStatus(d.getCheckInStatus() != null ? d.getCheckInStatus() : "未签到");
dto.setSortOrder(d.getPerformanceOrder()); dto.setSortOrder(d.getPerformanceOrder());
dto.setPlayerName(d.getPlayerName()); dto.setPlayerName(d.getPlayerName());
return dto;
})
.collect(Collectors.toList());
// For collective projects, query team members
if (isCollective) {
List<Map<String, Object>> memberList = new ArrayList<>();
// Step 1: Get athlete record to find team_name
MartialAthlete participantAthlete = athleteMapper.selectById(d.getParticipantId());
if (participantAthlete != null && participantAthlete.getTeamName() != null) {
// Step 2: Find team by team_name
QueryWrapper<MartialTeam> teamWrapper = new QueryWrapper<>();
teamWrapper.eq("team_name", participantAthlete.getTeamName());
teamWrapper.eq("is_deleted", 0);
MartialTeam team = teamMapper.selectOne(teamWrapper);
if (team != null) {
// Step 3: Query team members
QueryWrapper<MartialTeamMember> memberWrapper = new QueryWrapper<>();
memberWrapper.eq("team_id", team.getId());
memberWrapper.eq("is_deleted", 0);
List<MartialTeamMember> members = teamMemberMapper.selectList(memberWrapper);
// Step 4: Get member athlete info
for (MartialTeamMember member : members) {
Map<String, Object> memberData = new HashMap<>();
memberData.put("id", member.getId());
MartialAthlete athlete = athleteMapper.selectById(member.getAthleteId());
memberData.put("name", athlete != null ? athlete.getPlayerName() : "");
memberData.put("gender", athlete != null ? athlete.getGender() : "");
memberList.add(memberData);
}
}
}
dto.setMembers(memberList);
}
participantDTOs.add(dto);
}
groupDTO.setParticipants(participantDTOs); groupDTO.setParticipants(participantDTOs);
groupDTO.setStatus(calculateGroupStatus(participantDTOs)); groupDTO.setStatus(calculateGroupStatus(participantDTOs));
groupDTOs.add(groupDTO); groupDTOs.add(groupDTO);