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 | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 48 insertions(+), 0 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 e8c8503..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瀽鍣�
@@ -25,6 +31,12 @@
@Autowired
private UserContextUtil userContextUtil;
+
+ @Autowired
+ private ReviewExportService reviewExportService;
+
+ @Autowired
+ private ReviewExportJobService reviewExportJobService;
/**
* 鏌ヨ鎴戞湭璇勫鐨勯」鐩垪琛�
@@ -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