From 93eb6b470773bc49ea6e1a9d4cbd914eb95d525b Mon Sep 17 00:00:00 2001
From: lrj <owen.stl@gmail.com>
Date: 星期二, 30 九月 2025 17:38:04 +0800
Subject: [PATCH] feat: 完善比赛晋级功能并清理测试文件

---
 backend/src/main/java/com/rongyichuang/player/api/PlayerGraphqlApi.java |  134 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 132 insertions(+), 2 deletions(-)

diff --git a/backend/src/main/java/com/rongyichuang/player/api/PlayerGraphqlApi.java b/backend/src/main/java/com/rongyichuang/player/api/PlayerGraphqlApi.java
index 1bbe844..adce16f 100644
--- a/backend/src/main/java/com/rongyichuang/player/api/PlayerGraphqlApi.java
+++ b/backend/src/main/java/com/rongyichuang/player/api/PlayerGraphqlApi.java
@@ -9,10 +9,16 @@
 import com.rongyichuang.player.dto.response.CurrentJudgeRatingResponse;
 import com.rongyichuang.player.dto.response.CurrentJudgeInfoResponse;
 import com.rongyichuang.player.dto.response.PlayerRegistrationResponse;
+import com.rongyichuang.player.dto.PromotionCompetitionResponse;
+import com.rongyichuang.player.dto.CompetitionParticipantResponse;
+import com.rongyichuang.player.dto.PromotionInput;
+import com.rongyichuang.player.dto.PromotionResult;
+import com.rongyichuang.player.dto.PromotableParticipantsResponse;
 import com.rongyichuang.player.service.PlayerApplicationService;
 import com.rongyichuang.player.service.ActivityPlayerDetailService;
 import com.rongyichuang.player.service.ActivityPlayerRatingService;
 import com.rongyichuang.player.service.ActivityPlayerService;
+import com.rongyichuang.player.service.PromotionService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.graphql.data.method.annotation.Argument;
@@ -32,25 +38,29 @@
     private final ActivityPlayerDetailService detailService;
     private final ActivityPlayerRatingService ratingService;
     private final ActivityPlayerService activityPlayerService;
+    private final PromotionService promotionService;
 
     public PlayerGraphqlApi(PlayerApplicationService service,
                            ActivityPlayerDetailService detailService,
                            ActivityPlayerRatingService ratingService,
-                           ActivityPlayerService activityPlayerService) {
+                           ActivityPlayerService activityPlayerService,
+                           PromotionService promotionService) {
         this.service = service;
         this.detailService = detailService;
         this.ratingService = ratingService;
         this.activityPlayerService = activityPlayerService;
+        this.promotionService = promotionService;
     }
 
     @QueryMapping
     public List<ActivityPlayerApplicationResponse> activityPlayerApplications(
             @Argument String name,
             @Argument Long activityId,
+            @Argument Integer state,
             @Argument Integer page,
             @Argument Integer size
     ) {
-        return service.listApplications(name, activityId, page, size);
+        return service.listApplications(name, activityId, state, page, size);
     }
 
     /**
@@ -142,4 +152,124 @@
             return response;
         }
     }
+
+    /**
+     * 瀹℃牳閫氳繃
+     */
+    @MutationMapping
+    public Boolean approveActivityPlayer(@Argument Long activityPlayerId, @Argument String feedback) {
+        log.info("瀹℃牳閫氳繃璇锋眰锛宎ctivityPlayerId: {}, feedback: {}", activityPlayerId, feedback);
+        try {
+            return activityPlayerService.approveActivityPlayer(activityPlayerId, feedback);
+        } catch (Exception e) {
+            log.error("瀹℃牳閫氳繃澶辫触: {}", e.getMessage(), e);
+            throw e;
+        }
+    }
+
+    /**
+     * 瀹℃牳椹冲洖
+     */
+    @MutationMapping
+    public Boolean rejectActivityPlayer(@Argument Long activityPlayerId, @Argument String feedback) {
+        log.info("瀹℃牳椹冲洖璇锋眰锛宎ctivityPlayerId: {}, feedback: {}", activityPlayerId, feedback);
+        try {
+            return activityPlayerService.rejectActivityPlayer(activityPlayerId, feedback);
+        } catch (Exception e) {
+            log.error("瀹℃牳椹冲洖澶辫触: {}", e.getMessage(), e);
+            throw e;
+        }
+    }
+
+    /**
+     * 鏇存柊瀹℃牳鎰忚
+     */
+    @MutationMapping
+    public Boolean updatePlayerFeedback(@Argument Long activityPlayerId, @Argument String feedback) {
+        log.info("鏇存柊瀹℃牳鎰忚璇锋眰锛宎ctivityPlayerId: {}, feedback: {}", activityPlayerId, feedback);
+        try {
+            return activityPlayerService.updateFeedback(activityPlayerId, feedback);
+        } catch (Exception e) {
+            log.error("鏇存柊瀹℃牳鎰忚澶辫触: {}", e.getMessage(), e);
+            throw e;
+        }
+    }
+
+    @MutationMapping
+    public ActivityRegistrationResponse updateActivityRegistration(@Argument Long activityPlayerId, @Argument ActivityRegistrationInput input) {
+        try {
+            log.info("鏀跺埌鏇存柊鎶ュ悕璇锋眰锛屾姤鍚岻D: {}", activityPlayerId);
+            return activityPlayerService.updateActivityRegistration(activityPlayerId, input);
+        } catch (Exception e) {
+            log.error("鏇存柊鎶ュ悕澶辫触", e);
+            ActivityRegistrationResponse response = new ActivityRegistrationResponse();
+            response.setSuccess(false);
+            response.setMessage("鏇存柊鎶ュ悕澶辫触: " + e.getMessage());
+            return response;
+        }
+    }
+
+    /**
+     * 鑾峰彇姣旇禌鏅嬬骇鍒楄〃
+     */
+    @QueryMapping
+    public List<PromotionCompetitionResponse> promotionCompetitions(
+            @Argument String name,
+            @Argument Integer page,
+            @Argument Integer size) {
+        try {
+            log.info("鑾峰彇姣旇禌鏅嬬骇鍒楄〃锛屽悕绉拌繃婊�: {}, 椤电爜: {}, 椤靛ぇ灏�: {}", name, page, size);
+            return promotionService.getPromotionCompetitions(name, page, size);
+        } catch (Exception e) {
+            log.error("鑾峰彇姣旇禌鏅嬬骇鍒楄〃澶辫触: {}", e.getMessage(), e);
+            throw e;
+        }
+    }
+
+    /**
+     * 鑾峰彇姣旇禌鍙傝禌浜哄憳
+     */
+    @QueryMapping
+    public List<CompetitionParticipantResponse> competitionParticipants(
+            @Argument Long competitionId,
+            @Argument Integer page,
+            @Argument Integer size) {
+        try {
+            log.info("鑾峰彇姣旇禌鍙傝禌浜哄憳锛屾瘮璧汭D: {}, 椤电爜: {}, 椤靛ぇ灏�: {}", competitionId, page, size);
+            return promotionService.getCompetitionParticipants(competitionId, page, size);
+        } catch (Exception e) {
+            log.error("鑾峰彇姣旇禌鍙傝禌浜哄憳澶辫触: {}", e.getMessage(), e);
+            throw e;
+        }
+    }
+
+    /**
+     * 鑾峰彇鍙檵绾у弬璧涜�呭垪琛�
+     */
+    @QueryMapping
+    public PromotableParticipantsResponse promotableParticipants(@Argument Long currentStageId) {
+        try {
+            log.info("鑾峰彇鍙檵绾у弬璧涜�呭垪琛紝褰撳墠闃舵ID: {}", currentStageId);
+            return promotionService.getPromotableParticipants(currentStageId);
+        } catch (Exception e) {
+            log.error("鑾峰彇鍙檵绾у弬璧涜�呭垪琛ㄥけ璐�: {}", e.getMessage(), e);
+            throw e;
+        }
+    }
+
+    /**
+     * 鎵ц鏅嬬骇鎿嶄綔
+     */
+    @MutationMapping
+    public PromotionResult promoteParticipants(@Argument PromotionInput input) {
+        try {
+            log.info("鎵ц鏅嬬骇鎿嶄綔锛屾瘮璧汭D: {}, 鍙傝禌鑰呮暟閲�: {}", 
+                input.getCompetitionId(), 
+                input.getParticipantIds() != null ? input.getParticipantIds().size() : 0);
+            return promotionService.promoteParticipants(input);
+        } catch (Exception e) {
+            log.error("鎵ц鏅嬬骇鎿嶄綔澶辫触: {}", e.getMessage(), e);
+            return PromotionResult.failure("鏅嬬骇鎿嶄綔澶辫触: " + e.getMessage());
+        }
+    }
 }
\ No newline at end of file

--
Gitblit v1.8.0