| | |
| | | Optional<ActivityPlayerRating> ratingOpt = activityPlayerRatingRepository |
| | | .findByActivityPlayerIdAndJudgeId(activityPlayerId, judgeId); |
| | | |
| | | Boolean hasRated = false; |
| | | String ratingTime = null; |
| | | BigDecimal totalScore = null; |
| | | Integer status = 0; |
| | | |
| | | if (ratingOpt.isPresent()) { |
| | | ActivityPlayerRating rating = ratingOpt.get(); |
| | | hasRated = rating.getState() != null && rating.getState() == 1; // 使用state判断是否已评分 |
| | | totalScore = rating.getTotalScore(); |
| | | status = rating.getState(); |
| | | if (rating.getUpdateTime() != null) { |
| | | ratingTime = rating.getUpdateTime().toString(); |
| | | } |
| | | } |
| | | |
| | | Boolean isCurrentJudge = judgeId.equals(currentJudgeId); |
| | | |
| | | return new JudgeRatingStatusResponse(judgeId, judgeName, totalScore, status, isCurrentJudge); |
| | | return new JudgeRatingStatusResponse(judgeId, judgeName, hasRated, ratingTime, totalScore); |
| | | }).collect(java.util.stream.Collectors.toList()); |
| | | } |
| | | |