| | |
| | | import com.rongyichuang.rating.entity.RatingScheme; |
| | | import com.rongyichuang.rating.repository.RatingSchemeRepository; |
| | | import com.rongyichuang.common.entity.Media; |
| | | import com.rongyichuang.common.enums.MediaTargetType; |
| | | import com.rongyichuang.common.repository.MediaRepository; |
| | | import jakarta.persistence.EntityManager; |
| | | import jakarta.persistence.PersistenceContext; |
| | |
| | | SELECT ap.id, ap.description, ap.activity_id, |
| | | p.id as player_id, p.name as player_name, p.phone, p.description as player_desc, |
| | | a.name as activity_name, a.rating_scheme_id |
| | | FROM t_avtivity_player ap |
| | | FROM t_activity_player ap |
| | | JOIN t_player p ON p.id = ap.player_id |
| | | JOIN t_activity a ON a.id = ap.activity_id |
| | | WHERE ap.id = ? |
| | |
| | | |
| | | // 构建学员信息 |
| | | PlayerInfoResponse playerInfo = new PlayerInfoResponse(); |
| | | playerInfo.setId(row[3] != null ? Long.valueOf(row[3].toString()) : null); |
| | | playerInfo.setId(row[3] != null ? ((Number) row[3]).longValue() : null); |
| | | playerInfo.setName(row[4] != null ? row[4].toString() : ""); |
| | | playerInfo.setPhone(row[5] != null ? row[5].toString() : ""); |
| | | playerInfo.setDescription(row[6] != null ? row[6].toString() : ""); |
| | | |
| | | // 查询学员头像(target_type=5) |
| | | // 查询学员头像(使用枚举常量表示学员头像类型) |
| | | if (playerInfo.getId() != null) { |
| | | List<Media> avatarMedias = mediaRepository.findByTargetTypeAndTargetIdAndState(5, playerInfo.getId(), 1); |
| | | List<Media> avatarMedias = mediaRepository.findByTargetTypeAndTargetIdAndState( |
| | | MediaTargetType.STUDENT_AVATAR.getValue(), playerInfo.getId(), 1); |
| | | if (!avatarMedias.isEmpty()) { |
| | | Media avatar = avatarMedias.get(0); |
| | | String avatarUrl = avatar.getPath(); |
| | |
| | | } |
| | | response.setPlayerInfo(playerInfo); |
| | | |
| | | // 查询提交的资料(target_type=4) |
| | | List<Media> submissionMedias = mediaRepository.findByTargetTypeAndTargetIdAndState(4, activityPlayerId, 1); |
| | | // 查询提交的资料(使用枚举常量表示参赛报名资料类型) |
| | | List<Media> submissionMedias = mediaRepository.findByTargetTypeAndTargetIdAndState( |
| | | MediaTargetType.ACTIVITY_PLAYER_SUBMISSION.getValue(), activityPlayerId, 1); |
| | | List<SubmissionMediaResponse> submissionFiles = submissionMedias.stream() |
| | | .map(this::convertToSubmissionMedia) |
| | | .collect(Collectors.toList()); |
| | |
| | | log.info("找到提交资料 {} 个", submissionFiles.size()); |
| | | |
| | | // 查询评分模板 |
| | | Long ratingSchemeId = row[8] != null ? Long.valueOf(row[8].toString()) : null; |
| | | Long ratingSchemeId = row[8] != null ? ((Number) row[8]).longValue() : null; |
| | | if (ratingSchemeId != null) { |
| | | RatingFormResponse ratingForm = buildRatingForm(ratingSchemeId); |
| | | response.setRatingForm(ratingForm); |