diff --git a/src/main/java/com/example/nexus/app/participation/controller/doc/ParticipationControllerDoc.java b/src/main/java/com/example/nexus/app/participation/controller/doc/ParticipationControllerDoc.java index 060ee6c..e478ba0 100644 --- a/src/main/java/com/example/nexus/app/participation/controller/doc/ParticipationControllerDoc.java +++ b/src/main/java/com/example/nexus/app/participation/controller/doc/ParticipationControllerDoc.java @@ -133,6 +133,7 @@ ResponseEntity> completeParticipant( - approvedCount: 진행중 인원 - feedbackCompletedCount: 피드백 완료 인원 - testCompletedCount: 테스트 완료 인원 + - paidCount: 리워드 지급 완료 인원 - rejectedCount: 거절됨 인원 - totalCount: 전체 신청 인원 """ diff --git a/src/main/java/com/example/nexus/app/participation/controller/dto/response/ParticipationStatisticsResponse.java b/src/main/java/com/example/nexus/app/participation/controller/dto/response/ParticipationStatisticsResponse.java index 8392dd2..eae0a6d 100644 --- a/src/main/java/com/example/nexus/app/participation/controller/dto/response/ParticipationStatisticsResponse.java +++ b/src/main/java/com/example/nexus/app/participation/controller/dto/response/ParticipationStatisticsResponse.java @@ -13,24 +13,35 @@ public record ParticipationStatisticsResponse( @Schema(description = "피드백 완료 인원", example = "7") Long feedbackCompletedCount, - @Schema(description = "테스트 완료 인원", example = "8") + @Schema(description = "테스트 완료 (지급 대기) 인원", example = "5") Long testCompletedCount, + @Schema(description = "리워드 지급 완료 인원", example = "3") + Long paidCount, + @Schema(description = "거절됨 인원", example = "3") Long rejectedCount, @Schema(description = "전체 신청 인원", example = "33") Long totalCount ) { - public static ParticipationStatisticsResponse of(Long pendingCount, Long approvedCount, - Long feedbackCompletedCount, Long testCompletedCount, - Long rejectedCount) { - Long total = pendingCount + approvedCount + feedbackCompletedCount + testCompletedCount + rejectedCount; + public static ParticipationStatisticsResponse of( + Long pendingCount, + Long approvedCount, + Long feedbackCompletedCount, + Long testCompletedCount, + Long paidCount, + Long rejectedCount) { + + Long total = pendingCount + approvedCount + feedbackCompletedCount + + testCompletedCount + paidCount + rejectedCount; + return new ParticipationStatisticsResponse( pendingCount, approvedCount, feedbackCompletedCount, testCompletedCount, + paidCount, rejectedCount, total ); diff --git a/src/main/java/com/example/nexus/app/participation/repository/ParticipationRepository.java b/src/main/java/com/example/nexus/app/participation/repository/ParticipationRepository.java index 377abe8..1915610 100644 --- a/src/main/java/com/example/nexus/app/participation/repository/ParticipationRepository.java +++ b/src/main/java/com/example/nexus/app/participation/repository/ParticipationRepository.java @@ -164,7 +164,8 @@ Long countByPostIdAndStatusAndIsPaid( "COALESCE(COUNT(CASE WHEN status = 'PENDING' THEN 1 END), 0) as pendingCount, " + "COALESCE(COUNT(CASE WHEN status = 'APPROVED' THEN 1 END), 0) as approvedCount, " + "COALESCE(COUNT(CASE WHEN status = 'FEEDBACK_COMPLETED' THEN 1 END), 0) as feedbackCompletedCount, " + - "COALESCE(COUNT(CASE WHEN status = 'TEST_COMPLETED' THEN 1 END), 0) as testCompletedCount, " + + "COALESCE(COUNT(CASE WHEN status = 'TEST_COMPLETED' AND is_paid = false THEN 1 END), 0) as testCompletedCount, " + + "COALESCE(COUNT(CASE WHEN status = 'TEST_COMPLETED' AND is_paid = true THEN 1 END), 0) as paidCount, " + "COALESCE(COUNT(CASE WHEN status = 'REJECTED' THEN 1 END), 0) as rejectedCount " + "FROM participations " + "WHERE post_id = :postId", diff --git a/src/main/java/com/example/nexus/app/participation/service/ParticipationService.java b/src/main/java/com/example/nexus/app/participation/service/ParticipationService.java index ced47a5..424c763 100644 --- a/src/main/java/com/example/nexus/app/participation/service/ParticipationService.java +++ b/src/main/java/com/example/nexus/app/participation/service/ParticipationService.java @@ -249,6 +249,7 @@ public ParticipationStatisticsResponse getPostApplicationStatistics(Long postId, stats.approvedCount(), stats.feedbackCompletedCount(), stats.testCompletedCount(), + stats.paidCount(), stats.rejectedCount() ); } @@ -380,7 +381,7 @@ private ParticipationStatsDto extractParticipationStats(Long postId) { List resultList = participationRepository.getParticipationStatsByPostId(postId); if (resultList.isEmpty()) { - return new ParticipationStatsDto(0L, 0L, 0L, 0L, 0L); + return new ParticipationStatsDto(0L, 0L, 0L, 0L, 0L, 0L); } Object[] result = resultList.get(0); @@ -389,8 +390,9 @@ private ParticipationStatsDto extractParticipationStats(Long postId) { extractLongValue(result[0]), // pendingCount extractLongValue(result[1]), // approvedCount extractLongValue(result[2]), // feedbackCompletedCount - extractLongValue(result[3]), // testCompletedCount - extractLongValue(result[4]) // rejectedCount + extractLongValue(result[3]), // testCompletedCount (지급 대기) + extractLongValue(result[4]), // paidCount (지급 완료) + extractLongValue(result[5]) // rejectedCount ); } diff --git a/src/main/java/com/example/nexus/app/participation/service/dto/ParticipationStatsDto.java b/src/main/java/com/example/nexus/app/participation/service/dto/ParticipationStatsDto.java index e0b4dbb..783454d 100644 --- a/src/main/java/com/example/nexus/app/participation/service/dto/ParticipationStatsDto.java +++ b/src/main/java/com/example/nexus/app/participation/service/dto/ParticipationStatsDto.java @@ -5,6 +5,7 @@ public record ParticipationStatsDto( Long approvedCount, Long feedbackCompletedCount, Long testCompletedCount, + Long paidCount, Long rejectedCount ) { }