diff --git a/src/main/kotlin/com/example/cmc_be/attendance/controller/AdminAttendanceController.kt b/src/main/kotlin/com/example/cmc_be/attendance/controller/AdminAttendanceController.kt index 01dfdea..9644a8b 100644 --- a/src/main/kotlin/com/example/cmc_be/attendance/controller/AdminAttendanceController.kt +++ b/src/main/kotlin/com/example/cmc_be/attendance/controller/AdminAttendanceController.kt @@ -76,7 +76,7 @@ class AdminAttendanceController( } @GetMapping("/code/page") - @Operation(summary = "03-03-01 모든 코드 정보 조회") + @Operation(summary = "03-03-01 모든 코드 정보 조회 페이징") fun getCodeInfoPage( @AuthenticationPrincipal user: User, @RequestParam("page") page: Int, @@ -85,13 +85,16 @@ class AdminAttendanceController( return CommonResponse.onSuccess(qrCodeService.getAllCodePage(page, size)) } - @GetMapping("/all") - @Operation(summary = "03-04 기수별 모든 출석 현황 체크") - fun getParticipantsAttendance( + + @GetMapping("/all/page") + @Operation(summary = "03-04 특정 기수 전체 유저 출석 정보 조회") + fun getUserAttendanceDashboard( @AuthenticationPrincipal user: User, - @Parameter(description = "기수", example = "13") @RequestParam generation: Int, - ): CommonResponse> { - return CommonResponse.onSuccess(attendanceService.getParticipantsAttendance(generation)) + @RequestParam generation: Int, + @RequestParam page: Int, + @RequestParam size: Int, + ): CommonResponse> { + return CommonResponse.onSuccess(attendanceService.getParticipantsAttendance(generation, page, size)) } @DeleteMapping("/code") diff --git a/src/main/kotlin/com/example/cmc_be/attendance/service/AttendanceService.kt b/src/main/kotlin/com/example/cmc_be/attendance/service/AttendanceService.kt index 56ca5e8..dab8de2 100644 --- a/src/main/kotlin/com/example/cmc_be/attendance/service/AttendanceService.kt +++ b/src/main/kotlin/com/example/cmc_be/attendance/service/AttendanceService.kt @@ -5,6 +5,7 @@ import com.example.cmc_be.attendance.dto.res.AllAttendanceInfos import com.example.cmc_be.attendance.dto.res.AttendanceDashboardInfo import com.example.cmc_be.attendance.dto.res.AttendanceInfo import com.example.cmc_be.attendance.dto.res.AttendancesDashboard +import com.example.cmc_be.common.dto.response.PageResponse import com.example.cmc_be.common.exeption.NotFoundException import com.example.cmc_be.domain.attendance.entity.Attendance import com.example.cmc_be.domain.attendance.enums.AttendanceCategory @@ -14,6 +15,8 @@ import com.example.cmc_be.domain.generation.repository.GenerationWeeksInfoReposi import com.example.cmc_be.domain.notification.exception.NotificationExceptionErrorCode import com.example.cmc_be.domain.user.entity.User import com.example.cmc_be.domain.user.repository.UserRepository +import org.springframework.data.domain.PageRequest +import org.springframework.data.domain.Sort import org.springframework.stereotype.Service import java.time.ZoneId import java.time.ZonedDateTime @@ -73,11 +76,12 @@ class AttendanceService( return "${attendanceCategory.status}하였습니다." } - fun getParticipantsAttendance(generation: Int): List { + fun getParticipantsAttendance(generation: Int, page: Int, size: Int): PageResponse { + val pageable = PageRequest.of(page, size, Sort.by("id").descending()) val allGeneration = generationWeeksInfoRepository.findAllByGeneration(generation).sortedBy { it.week } - val allUsers = userRepository.findAllByNowGeneration(generation) + val allUsers = userRepository.findAllByNowGeneration(generation, pageable) val allAttendances = attendanceRepository.findAllByGenerationWeeksInfoGeneration(generation) - return allUsers.map { user -> + return PageResponse.from(allUsers.map { user -> val userAttandances = allAttendances.filter { it.user.id == user.id } val attendanceInfos = allGeneration.map { generationWeekInfo -> val userAllAttendanceData = @@ -104,6 +108,6 @@ class AttendanceService( attendanceStatus = AttendanceDashboardInfo.from(attendanceInfos), attandances = attendanceInfos ) - } + }) } } \ No newline at end of file diff --git a/src/main/kotlin/com/example/cmc_be/user/controller/UserAdminController.kt b/src/main/kotlin/com/example/cmc_be/user/controller/UserAdminController.kt index acecc07..22f78ea 100644 --- a/src/main/kotlin/com/example/cmc_be/user/controller/UserAdminController.kt +++ b/src/main/kotlin/com/example/cmc_be/user/controller/UserAdminController.kt @@ -33,7 +33,7 @@ class UserAdminController( } @GetMapping("/management/user") - @Operation(summary = "05-01 특정 기수 유저 회원가입 수락") + @Operation(summary = "05-02 특정 기수 유저 회원가입 수락") fun handleSignUpApprove( @RequestParam userId: Long, @RequestParam approve: Boolean