From 375c18a6d2713ff19b22093eec57315992d8333f Mon Sep 17 00:00:00 2001
From: Codex Assistant <codex@example.com>
Date: 星期四, 06 十一月 2025 13:33:52 +0800
Subject: [PATCH] 增加评审下载
---
backend/src/main/java/com/rongyichuang/player/service/ActivityPlayerRatingService.java | 446 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 417 insertions(+), 29 deletions(-)
diff --git a/backend/src/main/java/com/rongyichuang/player/service/ActivityPlayerRatingService.java b/backend/src/main/java/com/rongyichuang/player/service/ActivityPlayerRatingService.java
index 80845c9..94615e1 100644
--- a/backend/src/main/java/com/rongyichuang/player/service/ActivityPlayerRatingService.java
+++ b/backend/src/main/java/com/rongyichuang/player/service/ActivityPlayerRatingService.java
@@ -1,7 +1,20 @@
package com.rongyichuang.player.service;
+import com.rongyichuang.activity.entity.ActivityPlayerRating;
+import com.rongyichuang.activity.entity.ActivityPlayerRatingItem;
+import com.rongyichuang.activity.repository.ActivityPlayerRatingRepository;
+import com.rongyichuang.activity.repository.ActivityPlayerRatingItemRepository;
+import com.rongyichuang.common.util.UserContextUtil;
+import com.rongyichuang.judge.entity.Judge;
+import com.rongyichuang.judge.repository.JudgeRepository;
+import com.rongyichuang.activity.repository.ActivityJudgeRepository;
import com.rongyichuang.player.dto.input.ActivityPlayerRatingInput;
import com.rongyichuang.player.dto.input.ActivityPlayerRatingItemInput;
+import com.rongyichuang.player.dto.response.JudgeRatingStatusResponse;
+import com.rongyichuang.player.dto.response.CurrentJudgeRatingResponse;
+import com.rongyichuang.player.dto.response.CurrentJudgeInfoResponse;
+import com.rongyichuang.rating.entity.RatingItem;
+import com.rongyichuang.rating.repository.RatingItemRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -9,7 +22,11 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import java.math.BigDecimal;
import java.time.LocalDateTime;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
@Service
public class ActivityPlayerRatingService {
@@ -18,44 +35,415 @@
@Autowired
private JdbcTemplate jdbcTemplate;
+
+ @Autowired
+ private ActivityPlayerRatingRepository activityPlayerRatingRepository;
+
+ @Autowired
+ private ActivityPlayerRatingItemRepository activityPlayerRatingItemRepository;
+
+ @Autowired
+ private RatingItemRepository ratingItemRepository;
+
+ @Autowired
+ private JudgeRepository judgeRepository;
+
+ @Autowired
+ private UserContextUtil userContextUtil;
+
+ @Autowired
+ private ActivityJudgeRepository activityJudgeRepository;
@Transactional
public boolean saveRating(ActivityPlayerRatingInput input) {
try {
- log.info("寮�濮嬩繚瀛樿瘎鍒嗭紝activityPlayerId: {}", input.getActivityPlayerId());
+ log.info("寮�濮嬩繚瀛樺璇勫璇勫垎锛宎ctivityPlayerId: {}", input.getActivityPlayerId());
- // 鍏堝垹闄ゅ凡鏈夌殑璇勫垎璁板綍锛堝鏋滃瓨鍦級
- String deleteSql = "DELETE FROM t_activity_player_rating_item WHERE activity_player_id = ?";
- int deletedCount = jdbcTemplate.update(deleteSql, input.getActivityPlayerId());
- log.info("鍒犻櫎宸叉湁璇勫垎璁板綍: {} 鏉�", deletedCount);
-
- // 鎻掑叆鏂扮殑璇勫垎璁板綍
- String insertSql = "INSERT INTO t_activity_player_rating_item " +
- "(activity_player_id, rating_item_id, score, comment, create_time, update_time) " +
- "VALUES (?, ?, ?, ?, ?, ?)";
-
- LocalDateTime now = LocalDateTime.now();
- int totalInserted = 0;
-
- for (ActivityPlayerRatingItemInput ratingItem : input.getRatings()) {
- int inserted = jdbcTemplate.update(insertSql,
- input.getActivityPlayerId(),
- ratingItem.getItemId(),
- ratingItem.getScore(),
- input.getComment(),
- now,
- now
- );
- totalInserted += inserted;
- log.info("淇濆瓨璇勫垎椤圭洰: itemId={}, score={}", ratingItem.getItemId(), ratingItem.getScore());
+ // 鑾峰彇褰撳墠璇勫淇℃伅
+ Long currentJudgeId = userContextUtil.getCurrentJudgeId();
+ if (currentJudgeId == null) {
+ throw new RuntimeException("褰撳墠鐢ㄦ埛涓嶆槸璇勫锛屾棤娉曡繘琛岃瘎鍒�");
}
- log.info("璇勫垎淇濆瓨瀹屾垚锛屽叡鎻掑叆 {} 鏉¤褰�", totalInserted);
+ Long activityPlayerId = input.getActivityPlayerId();
+ Long stageId = input.getStageId();
+
+ // 楠岃瘉鍓嶇浼犻�掔殑stageId
+ if (stageId == null) {
+ throw new RuntimeException("stageId涓嶈兘涓虹┖");
+ }
+
+ // 鏌ヨ activity_id, player_id
+ String queryPlayerSql = "SELECT activity_id, player_id FROM t_activity_player WHERE id = ?";
+ Map<String, Object> playerData = jdbcTemplate.queryForMap(queryPlayerSql, activityPlayerId);
+ Long activityId = ((Number) playerData.get("activity_id")).longValue();
+ Long playerId = ((Number) playerData.get("player_id")).longValue();
+ log.info("鏌ヨ鍒扮殑鏁版嵁 - activityId: {}, playerId: {}, judgeId: {}, stageId: {}", activityId, playerId, currentJudgeId, stageId);
+
+ // 楠岃瘉璇勫鏄惁鏈夋潈闄愯瘎鍒嗘娲诲姩鍜岄樁娈�
+ if (!userContextUtil.isCurrentUserJudgeForActivity(activityId)) {
+ throw new RuntimeException("褰撳墠璇勫鏃犳潈闄愯瘎鍒嗘娲诲姩");
+ }
+
+ // 楠岃瘉璇勫鏄惁鏈夋潈闄愯瘎鍒嗘闃舵
+ String verifyJudgeStageIdSql = "SELECT COUNT(*) FROM t_activity_judge WHERE activity_id = ? AND judge_id = ? AND stage_id = ?";
+ Number judgeStageCountNumber = jdbcTemplate.queryForObject(verifyJudgeStageIdSql, Number.class, activityId, currentJudgeId, stageId);
+ Integer judgeStageCount = judgeStageCountNumber != null ? judgeStageCountNumber.intValue() : 0;
+ if (judgeStageCount == null || judgeStageCount == 0) {
+ throw new RuntimeException("褰撳墠璇勫鏃犳潈闄愯瘎鍒嗘闃舵锛宻tageId: " + stageId);
+ }
+
+ // 鏌ヨ娲诲姩鐨勮瘎鍒嗘ā鏉縄D
+ String queryActivitySql = "SELECT rating_scheme_id FROM t_activity WHERE id = ?";
+ Number ratingSchemeIdNumber = jdbcTemplate.queryForObject(queryActivitySql, Number.class, activityId);
+ Long ratingSchemeId = ratingSchemeIdNumber != null ? ratingSchemeIdNumber.longValue() : null;
+ log.info("鏌ヨ鍒扮殑ratingSchemeId: {}", ratingSchemeId);
+
+ if (ratingSchemeId == null) {
+ throw new RuntimeException("娲诲姩鏈厤缃瘎鍒嗘ā鏉匡紝activityId: " + activityId);
+ }
+
+ // 鏌ユ壘鎴栧垱寤篈ctivityPlayerRating璁板綍
+ Optional<ActivityPlayerRating> existingRating = activityPlayerRatingRepository
+ .findByActivityPlayerIdAndJudgeId(activityPlayerId, currentJudgeId);
+
+ ActivityPlayerRating rating;
+ if (existingRating.isPresent()) {
+ rating = existingRating.get();
+ log.info("鎵惧埌宸叉湁璇勫垎璁板綍锛孖D: {}", rating.getId());
+ // 鍒犻櫎宸叉湁鐨勮瘎鍒嗛」
+ activityPlayerRatingItemRepository.deleteByActivityPlayerRatingId(rating.getId());
+ } else {
+ // 鍒涘缓鏂扮殑璇勫垎璁板綍锛屼娇鐢ㄥ墠绔紶閫掔殑stageId
+ rating = new ActivityPlayerRating(activityId, activityPlayerId, stageId, playerId, currentJudgeId, ratingSchemeId);
+ rating = activityPlayerRatingRepository.save(rating);
+ log.info("鍒涘缓鏂扮殑璇勫垎璁板綍锛孖D: {}, stageId: {}", rating.getId(), stageId);
+ }
+
+ // 淇濆瓨璇勫垎椤�
+ BigDecimal totalScore = BigDecimal.ZERO;
+ for (ActivityPlayerRatingItemInput ratingItemInput : input.getRatings()) {
+ Long itemId = ratingItemInput.getItemId();
+ BigDecimal score = BigDecimal.valueOf(ratingItemInput.getScore());
+
+ // 鏌ヨ璇勫垎椤逛俊鎭�
+ Optional<RatingItem> ratingItemOpt = ratingItemRepository.findById(itemId);
+ if (ratingItemOpt.isEmpty()) {
+ log.warn("璇勫垎椤逛笉瀛樺湪锛宨temId: {}", itemId);
+ continue;
+ }
+
+ RatingItem ratingItem = ratingItemOpt.get();
+
+ // 鍒涘缓璇勫垎椤硅褰�
+ ActivityPlayerRatingItem ratingItemEntity = new ActivityPlayerRatingItem(
+ activityId,
+ activityPlayerId,
+ rating.getId(),
+ stageId, // 浣跨敤鍓嶇浼犻�掔殑stageId
+ playerId,
+ currentJudgeId,
+ ratingSchemeId,
+ itemId,
+ score
+ );
+
+ activityPlayerRatingItemRepository.save(ratingItemEntity);
+
+ // 绱姞寰楀垎
+ if (score != null) {
+ totalScore = totalScore.add(score);
+ }
+
+ log.info("淇濆瓨璇勫垎椤圭洰: itemId={}, score={}",
+ itemId, score);
+ }
+
+ // 鏇存柊鎬诲垎鍜岀姸鎬�
+ rating.setTotalScore(totalScore);
+ rating.setState(1); // 宸茶瘎鍒�
+ rating.setFeedback(input.getComment());
+ activityPlayerRatingRepository.save(rating);
+
+ log.info("璇勫垎淇濆瓨瀹屾垚锛屾�诲垎: {}", totalScore);
return true;
} catch (Exception e) {
- log.error("淇濆瓨璇勫垎澶辫触", e);
- throw new RuntimeException("淇濆瓨璇勫垎澶辫触: " + e.getMessage());
+ log.error("淇濆瓨璇勫垎澶辫触锛屽紓甯哥被鍨�: {}, 寮傚父淇℃伅: {}", e.getClass().getSimpleName(), e.getMessage(), e);
+ e.printStackTrace();
+ throw new RuntimeException("淇濆瓨璇勫垎澶辫触: " + e.getClass().getSimpleName() + " - " + e.getMessage(), e);
}
}
-}
\ No newline at end of file
+
+ /**
+ * 鑾峰彇鎸囧畾娲诲姩閫夋墜鐨勬墍鏈夎瘎濮旇瘎鍒�
+ */
+ public List<ActivityPlayerRating> getAllRatingsForPlayer(Long activityPlayerId) {
+ return activityPlayerRatingRepository.findByActivityPlayerId(activityPlayerId);
+ }
+
+ /**
+ * 鑾峰彇鎸囧畾娲诲姩閫夋墜鐨勫钩鍧囧垎
+ */
+ public BigDecimal getAverageScoreForPlayer(Long activityPlayerId) {
+ List<ActivityPlayerRating> ratings = activityPlayerRatingRepository
+ .findCompletedRatingsByActivityPlayerId(activityPlayerId);
+
+ if (ratings.isEmpty()) {
+ return BigDecimal.ZERO;
+ }
+
+ BigDecimal totalScore = ratings.stream()
+ .map(ActivityPlayerRating::getTotalScore)
+ .filter(score -> score != null)
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
+
+ return totalScore.divide(BigDecimal.valueOf(ratings.size()), 2, BigDecimal.ROUND_HALF_UP);
+ }
+
+ /**
+ * 鑾峰彇褰撳墠璇勫瀵规寚瀹氶�夋墜鐨勮瘎鍒�
+ */
+ public CurrentJudgeRatingResponse getCurrentJudgeRating(Long activityPlayerId) {
+ Long currentJudgeId = userContextUtil.getCurrentJudgeId();
+ log.info("getCurrentJudgeRating - activityPlayerId: {}, currentJudgeId: {}", activityPlayerId, currentJudgeId);
+
+ if (currentJudgeId == null) {
+ log.warn("getCurrentJudgeRating - currentJudgeId is null");
+ return null;
+ }
+
+ Optional<ActivityPlayerRating> ratingOpt = activityPlayerRatingRepository
+ .findByActivityPlayerIdAndJudgeId(activityPlayerId, currentJudgeId);
+
+ if (!ratingOpt.isPresent()) {
+ log.info("getCurrentJudgeRating - No rating found for activityPlayerId: {} and judgeId: {}", activityPlayerId, currentJudgeId);
+ return null;
+ }
+
+ log.info("getCurrentJudgeRating - Found rating with id: {}", ratingOpt.get().getId());
+
+ ActivityPlayerRating rating = ratingOpt.get();
+ CurrentJudgeRatingResponse response = new CurrentJudgeRatingResponse();
+ response.setId(rating.getId());
+ response.setTotalScore(rating.getTotalScore());
+ response.setStatus(rating.getState());
+ response.setRemark(rating.getFeedback());
+
+ // 鑾峰彇璇勫垎椤�
+ List<ActivityPlayerRatingItem> items = activityPlayerRatingItemRepository
+ .findByActivityPlayerRatingId(rating.getId());
+
+ List<Long> ratingItemIds = items.stream()
+ .map(ActivityPlayerRatingItem::getRatingItemId)
+ .filter(java.util.Objects::nonNull)
+ .distinct()
+ .collect(java.util.stream.Collectors.toList());
+
+ java.util.Map<Long, RatingItem> ratingItemMap = ratingItemIds.isEmpty()
+ ? java.util.Collections.emptyMap()
+ : ratingItemRepository.findAllById(ratingItemIds).stream()
+ .collect(java.util.stream.Collectors.toMap(RatingItem::getId, java.util.function.Function.identity()));
+
+ List<CurrentJudgeRatingResponse.CurrentJudgeRatingItemResponse> itemResponses = items.stream()
+ .map(item -> {
+ RatingItem ratingItem = ratingItemMap.get(item.getRatingItemId());
+ String name = ratingItem != null ? ratingItem.getName() : "";
+ BigDecimal maxScore = ratingItem != null && ratingItem.getMaxScore() != null
+ ? BigDecimal.valueOf(ratingItem.getMaxScore()) : null;
+ return new CurrentJudgeRatingResponse.CurrentJudgeRatingItemResponse(
+ item.getRatingItemId(),
+ name,
+ item.getScore(),
+ item.getScore(),
+ maxScore
+ );
+ })
+ .collect(java.util.stream.Collectors.toList());
+
+ response.setRatedAt(rating.getUpdateTime() != null ? rating.getUpdateTime().toString() : null);
+ response.setItems(itemResponses);
+ return response;
+ }
+
+ /**
+ * 妫�鏌ュ綋鍓嶈瘎濮旀槸鍚﹀凡瀵规寚瀹氶�夋墜璇勫垎
+ */
+ public boolean hasCurrentJudgeRated(Long activityPlayerId) {
+ Long currentJudgeId = userContextUtil.getCurrentJudgeId();
+ if (currentJudgeId == null) {
+ return false;
+ }
+
+ return activityPlayerRatingRepository.existsByActivityPlayerIdAndJudgeId(activityPlayerId, currentJudgeId);
+ }
+
+ /**
+ * 鑾峰彇鎸囧畾閫夋墜鐨勬墍鏈夎瘎濮旇瘎鍒嗙姸鎬�
+ */
+ public List<JudgeRatingStatusResponse> getAllJudgeRatingsForPlayer(Long activityPlayerId) {
+ log.info("寮�濮嬭幏鍙栭�夋墜璇勫璇勫垎鐘舵�侊紝activityPlayerId: {}", activityPlayerId);
+
+ // 棣栧厛鑾峰彇娲诲姩ID鍜岄樁娈礗D
+ String activityPlayerSql = "SELECT activity_id, stage_id FROM t_activity_player WHERE id = ?";
+ Map<String, Object> activityPlayerData = jdbcTemplate.queryForMap(activityPlayerSql, activityPlayerId);
+
+ if (activityPlayerData == null) {
+ throw new RuntimeException("鏈壘鍒版椿鍔ㄩ�夋墜璁板綍锛宎ctivityPlayerId: " + activityPlayerId);
+ }
+
+ Long activityId = ((Number) activityPlayerData.get("activity_id")).longValue();
+ Long stageId = ((Number) activityPlayerData.get("stage_id")).longValue();
+
+ log.info("鎵惧埌娲诲姩ID: {}, 闃舵ID: {}", activityId, stageId);
+
+ // 鑾峰彇鎸囧畾闃舵鐨勮瘎濮旓紙閫氳繃stageId杩囨护锛岀‘淇濆敮涓�鎬э級
+ String judgesSql = "SELECT j.id, j.name FROM t_judge j " +
+ "JOIN t_activity_judge aj ON j.id = aj.judge_id " +
+ "WHERE aj.activity_id = ? AND aj.stage_id = ? ORDER BY j.name";
+
+ List<Map<String, Object>> judgeRows = jdbcTemplate.queryForList(judgesSql, activityId, stageId);
+ log.info("鎵惧埌璇勫鏁伴噺: {}", judgeRows.size());
+
+ Long currentJudgeId = userContextUtil.getCurrentJudgeId();
+
+ List<JudgeRatingStatusResponse> result = judgeRows.stream().map(row -> {
+ Long judgeId = ((Number) row.get("id")).longValue();
+ String judgeName = (String) row.get("name");
+
+ // 鍙煡鎵炬湁鏁堢殑璇勫垎璁板綍锛坰tate=1锛夛紝閬垮厤閲嶅璁$畻
+ String ratingCountSql = "SELECT COUNT(*) FROM t_activity_player_rating WHERE activity_player_id = ? AND judge_id = ? AND state = 1";
+ Integer ratingCount = jdbcTemplate.queryForObject(ratingCountSql, Integer.class, activityPlayerId, judgeId);
+
+ Boolean hasRated = ratingCount != null && ratingCount > 0; // 璇勫娆℃暟>0琛ㄧず宸茶瘎瀹�
+ String ratingTime = null;
+ BigDecimal totalScore = null;
+
+ // 濡傛灉宸茶瘎鍒嗭紝鑾峰彇鏈�鏂扮殑鏈夋晥璇勫垎璁板綍
+ if (hasRated) {
+ // 鑾峰彇鏈�鏂扮殑鏈夋晥璇勫垎璁板綍锛堟寜鏇存柊鏃堕棿鍊掑簭锛屽彇绗竴鏉★級
+ String latestRatingSql = "SELECT * FROM t_activity_player_rating " +
+ "WHERE activity_player_id = ? AND judge_id = ? AND state = 1 " +
+ "ORDER BY update_time DESC LIMIT 1";
+
+ try {
+ Map<String, Object> ratingRow = jdbcTemplate.queryForMap(latestRatingSql, activityPlayerId, judgeId);
+ if (ratingRow != null) {
+ totalScore = (BigDecimal) ratingRow.get("total_score");
+ Object updateTimeObj = ratingRow.get("update_time");
+ if (updateTimeObj != null) {
+ ratingTime = updateTimeObj.toString();
+ }
+ }
+ } catch (Exception e) {
+ // 濡傛灉鏌ヨ澶辫触锛屼娇鐢╮epository鏂规硶浣滀负澶囬��
+ Optional<ActivityPlayerRating> ratingOpt = activityPlayerRatingRepository
+ .findByActivityPlayerIdAndJudgeId(activityPlayerId, judgeId);
+
+ if (ratingOpt.isPresent()) {
+ ActivityPlayerRating rating = ratingOpt.get();
+ // 鍙湁褰撹褰曠姸鎬佷负1鏃舵墠浣跨敤
+ if (rating.getState() != null && rating.getState() == 1) {
+ totalScore = rating.getTotalScore();
+ if (rating.getUpdateTime() != null) {
+ ratingTime = rating.getUpdateTime().toString();
+ }
+ }
+ }
+ }
+ }
+
+ JudgeRatingStatusResponse response = new JudgeRatingStatusResponse(judgeId, judgeName, hasRated, ratingTime, totalScore);
+ log.info("璇勫 {} (ID: {}) 璇勫垎鐘舵��: hasRated={}, totalScore={}, ratingTime={}",
+ judgeName, judgeId, hasRated, totalScore, ratingTime);
+ return response;
+ }).collect(java.util.stream.Collectors.toList());
+
+ log.info("杩斿洖璇勫璇勫垎鐘舵�佸垪琛紝鎬绘暟: {}", result.size());
+ return result;
+ }
+
+ /**
+ * 鑾峰彇褰撳墠璇勫淇℃伅
+ */
+ public CurrentJudgeInfoResponse getCurrentJudgeInfo() {
+ Optional<Judge> currentJudgeOpt = userContextUtil.getCurrentJudge();
+ if (!currentJudgeOpt.isPresent()) {
+ return null;
+ }
+
+ Judge currentJudge = currentJudgeOpt.get();
+ return new CurrentJudgeInfoResponse(
+ currentJudge.getId(),
+ currentJudge.getName(),
+ currentJudge.getTitle(),
+ currentJudge.getCompany()
+ );
+ }
+
+ /**
+ * 妫�鏌ヨ瘎濮旀槸鍚﹀湪鎸囧畾姣旇禌闃舵鐨勮瘎濮斿垪琛ㄤ腑
+ */
+ public boolean isJudgeInActivity(Long stageId, Long judgeId) {
+ try {
+ return activityJudgeRepository.existsByStageIdAndJudgeId(stageId, judgeId);
+ } catch (Exception e) {
+ log.error("妫�鏌ヨ瘎濮旀潈闄愭椂鍙戠敓寮傚父: stageId={}, judgeId={}, error={}", stageId, judgeId, e.getMessage(), e);
+ return false;
+ }
+ }
+
+ /**
+ * 鑾峰彇鎸囧畾璇勫瀵规寚瀹氶�夋墜鐨勮瘎鍒嗘槑缁�
+ */
+ public CurrentJudgeRatingResponse getJudgeRatingDetail(Long activityPlayerId, Long judgeId) {
+ try {
+ Optional<ActivityPlayerRating> ratingOpt = activityPlayerRatingRepository
+ .findByActivityPlayerIdAndJudgeId(activityPlayerId, judgeId);
+
+ if (!ratingOpt.isPresent()) {
+ return null;
+ }
+
+ ActivityPlayerRating rating = ratingOpt.get();
+
+ // 鏌ヨ璇勫垎鏄庣粏椤�
+ String itemsSql = "SELECT ri.id as rating_item_id, ri.name as rating_item_name, " +
+ "apri.score, ri.max_score " +
+ "FROM t_activity_player_rating_item apri " +
+ "JOIN t_rating_item ri ON apri.rating_item_id = ri.id " +
+ "WHERE apri.activity_player_rating_id = ? " +
+ "ORDER BY ri.order_no";
+
+ List<Map<String, Object>> itemRows = jdbcTemplate.queryForList(itemsSql, rating.getId());
+
+ List<CurrentJudgeRatingResponse.CurrentJudgeRatingItemResponse> items = itemRows.stream()
+ .map(row -> new CurrentJudgeRatingResponse.CurrentJudgeRatingItemResponse(
+ ((Number) row.get("rating_item_id")).longValue(),
+ (String) row.get("rating_item_name"),
+ (BigDecimal) row.get("score"),
+ (BigDecimal) row.get("score"),
+ row.get("max_score") instanceof BigDecimal
+ ? (BigDecimal) row.get("max_score")
+ : row.get("max_score") instanceof Number
+ ? BigDecimal.valueOf(((Number) row.get("max_score")).doubleValue())
+ : null
+ ))
+ .collect(java.util.stream.Collectors.toList());
+
+ CurrentJudgeRatingResponse response = new CurrentJudgeRatingResponse();
+ response.setId(rating.getId());
+ response.setTotalScore(rating.getTotalScore());
+ response.setStatus(rating.getState());
+ response.setRemark(rating.getFeedback());
+ response.setRatedAt(rating.getUpdateTime() != null ? rating.getUpdateTime().toString() : null);
+ response.setItems(items);
+
+ return response;
+ } catch (Exception e) {
+ log.error("鑾峰彇璇勫璇勫垎鏄庣粏澶辫触: activityPlayerId={}, judgeId={}, error={}",
+ activityPlayerId, judgeId, e.getMessage(), e);
+ return null;
+ }
+ }
+}
--
Gitblit v1.8.0