Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -348,16 +348,30 @@ private void validateSameMeetingParticipants(Long reviewerId, Long targetUserId,
// 참가자 ID 목록만 조회 (현재 Meeting API가 제공하는 방식)
List<Long> participantIds = meetingClient.getParticipantIds(meetingId);

// 디버그 로그 추가
log.info("=== 모임 참가자 검증 시작 ===");
log.info("meetingId: {}", meetingId);
log.info("reviewerId: {}", reviewerId);
log.info("targetUserId: {}", targetUserId);
log.info("participantIds from API: {}", participantIds);

if (participantIds == null || participantIds.isEmpty()) {
log.error("참가자 목록이 비어있음!");
throw new UserException(UserErrorCode.NOT_SAME_MEETING_PARTICIPANTS);
}

boolean reviewerParticipated = participantIds.contains(reviewerId);
boolean targetParticipated = participantIds.contains(targetUserId);

log.info("reviewerParticipated: {}", reviewerParticipated);
log.info("targetParticipated: {}", targetParticipated);

if (!reviewerParticipated || !targetParticipated) {
log.error("참가 검증 실패!");
throw new UserException(UserErrorCode.NOT_SAME_MEETING_PARTICIPANTS);
}

log.info("=== 모임 참가자 검증 완료 ===");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.example.momo.global.infrastructure.client.meeting;

import java.time.Duration;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;

Expand All @@ -18,8 +19,6 @@
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import java.time.LocalDateTime;

@Slf4j
@Component
@RequiredArgsConstructor
Expand Down Expand Up @@ -111,40 +110,66 @@ public List<ParticipantClientResponseDto> getParticipants(Long meetingId) {
}

/**
* 참가자 ID 목록 조회 (기존 API 그대로 사용)
* 현재 Meeting API는 List<Long> 참가자 ID만 반환함
* 참가자 ID 목록 조회 - UserService에서 평가 검증용으로 사용
* Meeting API에서 ParticipantResponseDto 리스트를 받아서 userId만 추출
*/
public List<Long> getParticipantIds(Long meetingId) {
try {
ApiResponse<List<Long>> response = webClient
log.info("=== MeetingClient.getParticipantIds 시작 ===");
log.info("요청 meetingId: {}", meetingId);
log.info("요청 URL: {}", MEETING_SERVICE_BASE_URI + "/" + meetingId + "/participants");

ApiResponse<List<ParticipantClientResponseDto>> response = webClient
.get()
.uri(MEETING_SERVICE_BASE_URI + "/{meetingId}/participants", meetingId)
.retrieve()
.bodyToMono(new ParameterizedTypeReference<ApiResponse<List<Long>>>() {
.bodyToMono(new ParameterizedTypeReference<ApiResponse<List<ParticipantClientResponseDto>>>() {
})
.timeout(REQUEST_TIMEOUT)
.block();

if (response == null || !response.isSuccess()) {
log.info("API 응답 전체: {}", response);

if (response == null) {
log.error("응답이 null!");
return List.of();
}

log.debug("참석자 ID 목록 조회 성공: meetingId={}, count={}", meetingId, response.getData().size());
return response.getData();
if (!response.isSuccess()) {
log.error("응답 실패: success={}, message={}", response.isSuccess(), response.getMessage());
return List.of();
}

} catch (WebClientResponseException e) {
if (e.getStatusCode().value() == 404) {
log.debug("참석자 목록을 찾을 수 없습니다: meetingId={}", meetingId);
if (response.getData() == null) {
log.error("응답 데이터가 null!");
return List.of();
}

log.error("참석자 목록 조회 실패: meetingId={}, status={}, error={}",
meetingId, e.getStatusCode(), e.getMessage());
throw new MeetingClientException("참석자 목록 조회 중 오류가 발생했습니다: " + e.getMessage());
log.info("응답 데이터 크기: {}", response.getData().size());
log.info("응답 데이터 내용: {}", response.getData());

List<Long> participantIds = response.getData().stream()
.map(participant -> {
log.info("참가자 정보: id={}, meetingId={}, participantId={}, attendance={}",
participant.getId(), participant.getMeetingId(),
participant.getParticipantId(),
participant.isAttendanceStatus()); // getUserId() -> getParticipantId()
return participant.getParticipantId(); // getUserId() -> getParticipantId()
})
.toList();

log.info("최종 추출된 participantIds: {}", participantIds);
log.info("=== MeetingClient.getParticipantIds 완료 ===");
return participantIds;

} catch (Exception e) {
log.error("=== MeetingClient.getParticipantIds 오류 ===", e);
return List.of();
}
}

public ParticipantCountClientResponseDto getParticipantCount(Long meetingId, Boolean attendance, LocalDateTime createdAt) {
public ParticipantCountClientResponseDto getParticipantCount(Long meetingId, Boolean attendance,
LocalDateTime createdAt) {
try {
ApiResponse<ParticipantCountClientResponseDto> response = webClient
.get()
Expand All @@ -154,7 +179,8 @@ public ParticipantCountClientResponseDto getParticipantCount(Long meetingId, Boo
.queryParam("createdAt", createdAt)
.build(meetingId))
.retrieve()
.bodyToMono(new ParameterizedTypeReference<ApiResponse<ParticipantCountClientResponseDto>>() {})
.bodyToMono(new ParameterizedTypeReference<ApiResponse<ParticipantCountClientResponseDto>>() {
})
.timeout(REQUEST_TIMEOUT)
.block();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
public class ParticipantClientResponseDto {
private Long id;
private Long meetingId;
private Long userId;
private Long participantId;
Comment thread
leeuihyun marked this conversation as resolved.
private boolean attendanceStatus;
}