From 0a48616045ddce1562584543a0e89e5144051fde Mon Sep 17 00:00:00 2001
From: Codex Assistant <codex@example.com>
Date: 星期日, 05 十月 2025 14:52:44 +0800
Subject: [PATCH] 报名审核
---
backend/src/main/java/com/rongyichuang/activity/service/ActivityService.java | 47 +++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 43 insertions(+), 4 deletions(-)
diff --git a/backend/src/main/java/com/rongyichuang/activity/service/ActivityService.java b/backend/src/main/java/com/rongyichuang/activity/service/ActivityService.java
index b692385..c5254f0 100644
--- a/backend/src/main/java/com/rongyichuang/activity/service/ActivityService.java
+++ b/backend/src/main/java/com/rongyichuang/activity/service/ActivityService.java
@@ -16,6 +16,8 @@
import com.rongyichuang.common.dto.PageResponse;
import com.rongyichuang.rating.entity.RatingScheme;
import com.rongyichuang.rating.repository.RatingSchemeRepository;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.ExampleMatcher;
@@ -37,6 +39,8 @@
@Service
@Transactional
public class ActivityService {
+
+ private static final Logger log = LoggerFactory.getLogger(ActivityService.class);
@Autowired
private ActivityRepository activityRepository;
@@ -67,6 +71,16 @@
page = activityRepository.findByPidOrderByCreateTimeDesc(0L, pageable);
}
+ // 璋冭瘯锛氭墦鍗板垎椤靛師濮嬫椿鍔ㄧ殑鎶ュ悕鎴鏃堕棿
+ try {
+ log.info("鍒嗛〉鏌ヨ姣旇禌鍒楄〃锛氭�绘暟={}, 褰撳墠椤�={}, 姣忛〉={}", page.getTotalElements(), page.getNumber(), page.getSize());
+ page.getContent().stream().limit(10).forEach(a ->
+ log.info("Activity(id={}, name={}) signupDeadline={}, matchTime={}", a.getId(), a.getName(), a.getSignupDeadline(), a.getMatchTime())
+ );
+ } catch (Exception e) {
+ log.warn("鎵撳嵃娲诲姩鎶ュ悕鎴鏃堕棿鏃ュ織澶辫触: {}", e.getMessage());
+ }
+
List<ActivityResponse> content = page.getContent().stream()
.map(activity -> {
ActivityResponse response = new ActivityResponse(activity);
@@ -86,6 +100,15 @@
return response;
})
.collect(Collectors.toList());
+
+ // 璋冭瘯锛氭墦鍗拌繑鍥炵粰鍓嶇鐨勫搷搴斿璞′腑鐨勬姤鍚嶆埅姝�
+ try {
+ content.stream().limit(10).forEach(r ->
+ log.info("Response(id={}, name={}) signupDeadline={}, matchTime={}", r.getId(), r.getName(), r.getSignupDeadline(), r.getMatchTime())
+ );
+ } catch (Exception e) {
+ log.warn("鎵撳嵃ActivityResponse鏃ュ織澶辫触: {}", e.getMessage());
+ }
return new PageResponse<>(content, page.getTotalElements(), page.getNumber(), page.getSize());
}
@@ -185,6 +208,9 @@
// 淇濆瓨姣旇禌
activity = activityRepository.save(activity);
+ // 璁板綍鏃ュ織浠ヤ究璋冭瘯
+ log.info("淇濆瓨姣旇禌鎴愬姛锛屾瘮璧汭D: {}, 姣旇禌鍚嶇О: {}", activity.getId(), activity.getName());
+
// 濡傛灉鏄瘮璧涗笖鏈夐樁娈典俊鎭紝淇濆瓨闃舵
if (input.isMainActivity() && input.getStages() != null && !input.getStages().isEmpty()) {
saveActivityStages(activity.getId(), input.getStages());
@@ -264,7 +290,11 @@
stage.setRatingSchemeId(activity.getRatingSchemeId());
}
- activityRepository.save(stage);
+ // 淇濆瓨闃舵骞惰幏鍙栬嚜澧濱D
+ stage = activityRepository.save(stage);
+
+ // 璁板綍鏃ュ織浠ヤ究璋冭瘯
+ log.info("淇濆瓨闃舵鎴愬姛锛岄樁娈礗D: {}, 闃舵鍚嶇О: {}", stage.getId(), stage.getName());
}
}
@@ -273,14 +303,20 @@
*/
private void saveActivityJudges(Long activityId, List<ActivityJudgeInput> judgeInputs) {
if (judgeInputs == null || judgeInputs.isEmpty()) {
+ log.info("娌℃湁璇勫闇�瑕佷繚瀛橈紝姣旇禌ID: {}", activityId);
return;
}
+
+ log.info("寮�濮嬩繚瀛樿瘎濮旓紝姣旇禌ID: {}, 璇勫鏁伴噺: {}", activityId, judgeInputs.size());
// 鑾峰彇姣旇禌鐨勬墍鏈夐樁娈碉紙濡傛灉鏈夌殑璇濓級
List<Activity> stages = activityRepository.findByPidAndStateOrderByCreateTimeAsc(activityId, 1);
// 淇濆瓨璇勫鍏宠仈
for (ActivityJudgeInput judgeInput : judgeInputs) {
+ log.info("澶勭悊璇勫: ID={}, 濮撳悕={}, 闃舵IDs={}",
+ judgeInput.getJudgeId(), judgeInput.getJudgeName(), judgeInput.getStageIds());
+
// 鍏堝垹闄よ璇勫鐨勭幇鏈夊叧鑱�
activityJudgeRepository.deleteByActivityIdAndJudgeId(activityId, judgeInput.getJudgeId());
@@ -289,12 +325,14 @@
if (stages.isEmpty()) {
// 姣旇禌娌℃湁闃舵锛岀洿鎺ュ叧鑱斿埌姣旇禌锛坰tage_id涓簄ull琛ㄧず鎵�鏈夐樁娈碉級
ActivityJudge activityJudge = new ActivityJudge(activityId, judgeInput.getJudgeId(), null);
- activityJudgeRepository.save(activityJudge);
+ activityJudge = activityJudgeRepository.save(activityJudge);
+ log.info("淇濆瓨璇勫鍏宠仈鎴愬姛: 姣旇禌ID={}, 璇勫ID={}, 闃舵ID=null", activityId, judgeInput.getJudgeId());
} else {
// 涓烘瘡涓樁娈靛垱寤哄叧鑱�
for (Activity stage : stages) {
ActivityJudge activityJudge = new ActivityJudge(activityId, judgeInput.getJudgeId(), stage.getId());
- activityJudgeRepository.save(activityJudge);
+ activityJudge = activityJudgeRepository.save(activityJudge);
+ log.info("淇濆瓨璇勫鍏宠仈鎴愬姛: 姣旇禌ID={}, 璇勫ID={}, 闃舵ID={}", activityId, judgeInput.getJudgeId(), stage.getId());
}
}
} else {
@@ -303,7 +341,8 @@
// 濡傛灉stageId绛変簬褰撳墠姣旇禌ID锛岃〃绀鸿瘎濮旇礋璐f暣涓瘮璧涳紝stage_id璁句负null
Long actualStageId = stageId.equals(activityId) ? null : stageId;
ActivityJudge activityJudge = new ActivityJudge(activityId, judgeInput.getJudgeId(), actualStageId);
- activityJudgeRepository.save(activityJudge);
+ activityJudge = activityJudgeRepository.save(activityJudge);
+ log.info("淇濆瓨璇勫鍏宠仈鎴愬姛: 姣旇禌ID={}, 璇勫ID={}, 闃舵ID={}", activityId, judgeInput.getJudgeId(), actualStageId);
}
}
}
--
Gitblit v1.8.0