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/review/resolver/ReviewResolver.java |   66 ++++++++++++++++++++++++++++----
 1 files changed, 57 insertions(+), 9 deletions(-)

diff --git a/backend/src/main/java/com/rongyichuang/review/resolver/ReviewResolver.java b/backend/src/main/java/com/rongyichuang/review/resolver/ReviewResolver.java
index 0f513a3..aa7f6a6 100644
--- a/backend/src/main/java/com/rongyichuang/review/resolver/ReviewResolver.java
+++ b/backend/src/main/java/com/rongyichuang/review/resolver/ReviewResolver.java
@@ -4,13 +4,19 @@
 import com.rongyichuang.review.dto.response.ReviewProjectPageResponse;
 import com.rongyichuang.review.dto.response.ReviewProjectResponse;
 import com.rongyichuang.review.dto.response.ReviewStatisticsResponse;
+import com.rongyichuang.review.dto.response.ReviewExportResponse;
+import com.rongyichuang.review.dto.response.ReviewExportJobStatus;
 import com.rongyichuang.review.service.ReviewService;
+import com.rongyichuang.review.service.ReviewExportService;
+import com.rongyichuang.review.service.ReviewExportJobService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.graphql.data.method.annotation.Argument;
+import org.springframework.graphql.data.method.annotation.MutationMapping;
 import org.springframework.graphql.data.method.annotation.QueryMapping;
 import org.springframework.stereotype.Controller;
+import java.util.List;
 
 /**
  * 璇勫绠$悊GraphQL瑙f瀽鍣�
@@ -26,15 +32,21 @@
     @Autowired
     private UserContextUtil userContextUtil;
 
+    @Autowired
+    private ReviewExportService reviewExportService;
+
+    @Autowired
+    private ReviewExportJobService reviewExportJobService;
+
     /**
      * 鏌ヨ鎴戞湭璇勫鐨勯」鐩垪琛�
      */
     @QueryMapping
     public ReviewProjectPageResponse unReviewedProjects(
+            @Argument String searchKeyword,
             @Argument int page,
-            @Argument int pageSize,
-            @Argument String searchKeyword) {
-        log.info("鏌ヨ鎴戞湭璇勫鐨勯」鐩垪琛紝page: {}, pageSize: {}, searchKeyword: {}", page, pageSize, searchKeyword);
+            @Argument int pageSize) {
+        log.info("鏌ヨ鎴戞湭璇勫鐨勯」鐩垪琛紝searchKeyword: {}, page: {}, pageSize: {}", searchKeyword, page, pageSize);
         
         Long currentJudgeId = userContextUtil.getCurrentJudgeId();
         if (currentJudgeId == null) {
@@ -49,10 +61,10 @@
      */
     @QueryMapping
     public ReviewProjectPageResponse reviewedProjects(
+            @Argument String searchKeyword,
             @Argument int page,
-            @Argument int pageSize,
-            @Argument String searchKeyword) {
-        log.info("鏌ヨ鎴戝凡璇勫鐨勯」鐩垪琛紝page: {}, pageSize: {}, searchKeyword: {}", page, pageSize, searchKeyword);
+            @Argument int pageSize) {
+        log.info("鏌ヨ鎴戝凡璇勫鐨勯」鐩垪琛紝searchKeyword: {}, page: {}, pageSize: {}", searchKeyword, page, pageSize);
         
         Long currentJudgeId = userContextUtil.getCurrentJudgeId();
         if (currentJudgeId == null) {
@@ -67,10 +79,10 @@
      */
     @QueryMapping
     public ReviewProjectPageResponse studentUnReviewedProjects(
+            @Argument String searchKeyword,
             @Argument int page,
-            @Argument int pageSize,
-            @Argument String searchKeyword) {
-        log.info("鏌ヨ瀛﹀憳鏈瘎瀹$殑椤圭洰鍒楄〃锛宲age: {}, pageSize: {}, searchKeyword: {}", page, pageSize, searchKeyword);
+            @Argument int pageSize) {
+        log.info("鏌ヨ瀛﹀憳鏈瘎瀹$殑椤圭洰鍒楄〃锛宻earchKeyword: {}, page: {}, pageSize: {}", searchKeyword, page, pageSize);
         
         Long currentJudgeId = userContextUtil.getCurrentJudgeId();
         if (currentJudgeId == null) {
@@ -94,4 +106,40 @@
         
         return reviewService.getReviewStatistics(currentJudgeId);
     }
+
+    /**
+     * 瀵煎嚭璇勫ZIP锛岃繑鍥炰笅杞介摼鎺�
+     */
+    @MutationMapping
+    public ReviewExportResponse exportReviewZip(@Argument Long activityId, @Argument List<Long> stageIds) {
+        log.info("瀵煎嚭璇勫ZIP锛宎ctivityId: {}, stageIds: {}", activityId, stageIds);
+        // 鏉冮檺鏍¢獙锛氫粎鍛樺伐锛堢鐞嗗憳/涓诲姙鏂癸級鍙墽琛屽鍑�
+        if (!userContextUtil.isCurrentUserEmployee()) {
+            log.warn("瀵煎嚭璇勫ZIP琚嫆缁濓紝褰撳墠鐢ㄦ埛鏃犲憳宸ユ潈闄愶紝activityId: {}", activityId);
+            return new ReviewExportResponse(false, null, "褰撳墠鐢ㄦ埛鏃犳潈闄愬鍑鸿瘎瀹℃暟鎹�");
+        }
+
+        return reviewExportService.exportReviewZip(activityId, stageIds);
+    }
+
+    /**
+     * 寮傛瀵煎嚭锛氬惎鍔ㄨ瘎瀹″鍑轰换鍔★紝杩斿洖浠诲姟ID
+     */
+    @MutationMapping
+    public String startReviewExportJob(@Argument Long activityId, @Argument List<Long> stageIds) {
+        log.info("鍚姩璇勫瀵煎嚭浠诲姟锛宎ctivityId: {}, stageIds: {}", activityId, stageIds);
+        if (!userContextUtil.isCurrentUserEmployee()) {
+            log.warn("鍚姩璇勫瀵煎嚭浠诲姟琚嫆缁濓紝褰撳墠鐢ㄦ埛鏃犲憳宸ユ潈闄愶紝activityId: {}", activityId);
+            return null;
+        }
+        return reviewExportJobService.startJob(activityId, stageIds);
+    }
+
+    /**
+     * 鏌ヨ瀵煎嚭浠诲姟鐘舵��
+     */
+    @QueryMapping
+    public ReviewExportJobStatus getReviewExportJobStatus(@Argument String jobId) {
+        return reviewExportJobService.getStatus(jobId);
+    }
 }
\ No newline at end of file

--
Gitblit v1.8.0