66import com .mjsec .lms .service .AssignmentSubmissionService ;
77import com .mjsec .lms .service .PlanService ;
88import com .mjsec .lms .type .ResponseMessage ;
9+ import com .mjsec .lms .type .SubmissionStatus ;
910import com .mjsec .lms .util .IpUtils ;
1011import com .mjsec .lms .util .ValidationUtils ;
1112import jakarta .servlet .http .HttpServletRequest ;
@@ -291,7 +292,7 @@ public ResponseEntity<SuccessResponse<Void>> leaveFeedback(
291292 @ PathVariable Long groupId ,
292293 @ PathVariable Long planId ,
293294 @ PathVariable Long submitId ,
294- @ RequestBody SubmissionFeedbackDto dto ,
295+ @ Valid @ RequestBody SubmissionFeedbackDto dto ,
295296 Authentication authentication ){
296297
297298 // JwtFilter에서 설정한 studentNumber를 가져옴
@@ -313,7 +314,7 @@ public ResponseEntity<SuccessResponse<SubmissionFeedbackDto>> updateFeedback(
313314 @ PathVariable Long groupId ,
314315 @ PathVariable Long planId ,
315316 @ PathVariable Long submitId ,
316- @ RequestBody SubmissionFeedbackDto dto ,
317+ @ Valid @ RequestBody SubmissionFeedbackDto dto ,
317318 Authentication authentication ){
318319
319320 // JwtFilter에서 설정한 studentNumber를 가져옴
@@ -323,7 +324,8 @@ public ResponseEntity<SuccessResponse<SubmissionFeedbackDto>> updateFeedback(
323324
324325 return ResponseEntity .ok (
325326 SuccessResponse .of (
326- ResponseMessage .FEEDBACK_UPDATE_SUCCESS
327+ ResponseMessage .FEEDBACK_UPDATE_SUCCESS ,
328+ submissionFeedbackDto
327329 )
328330 );
329331 }
@@ -347,4 +349,67 @@ public ResponseEntity<SuccessResponse<Void>> deleteFeedback(
347349 )
348350 );
349351 }
352+
353+ //과제 상태별 조회 API
354+ @ GetMapping ("/{groupId}/assignment/submit/{planId}/status/{status}" )
355+ public ResponseEntity <SuccessResponse <List <SubmissionResponse >>> getSubmissionsByStatus (
356+ @ PathVariable Long groupId ,
357+ @ PathVariable Long planId ,
358+ @ PathVariable SubmissionStatus status ,
359+ Authentication authentication ) {
360+
361+ Long currentUserStudentNumber = (Long ) authentication .getPrincipal ();
362+
363+ List <SubmissionResponse > submissionResponseList = assignmentSubmissionService .getSubmissionsByStatus (
364+ groupId , planId , status , currentUserStudentNumber );
365+
366+ return ResponseEntity .ok (
367+ SuccessResponse .of (
368+ ResponseMessage .ASSIGNMENT_SUBMIT_CHECK_SUCCESS ,
369+ submissionResponseList
370+ )
371+ );
372+ }
373+
374+ // 멘티용 수정 필요한 과제 조회 API <- 필요할까 싶기도 함 일단 추가함.
375+ @ GetMapping ("/{groupId}/assignment/submit/{planId}/revision-required" )
376+ public ResponseEntity <SuccessResponse <List <SubmissionResponse >>> getRevisionRequiredSubmissions (
377+ @ PathVariable Long groupId ,
378+ @ PathVariable Long planId ,
379+ Authentication authentication ) {
380+
381+ Long currentUserStudentNumber = (Long ) authentication .getPrincipal ();
382+
383+ // REVISION_REQUIRED 상태인 과제들 조회
384+ List <SubmissionResponse > submissionResponseList = assignmentSubmissionService .getSubmissionsByStatus (
385+ groupId , planId , SubmissionStatus .REVISION_REQUIRED , currentUserStudentNumber );
386+
387+ return ResponseEntity .ok (
388+ SuccessResponse .of (
389+ ResponseMessage .REVISION_REQUIRED_SUBMISSIONS_SUCCESS ,
390+ submissionResponseList
391+ )
392+ );
393+ }
394+
395+ // 과제 상태 통계 조회 API (멘토용)
396+ @ GetMapping ("/{groupId}/assignment/submit/{planId}/statistics" )
397+ public ResponseEntity <SuccessResponse <SubmissionStatisticsResponse >> getSubmissionStatistics (
398+ @ PathVariable Long groupId ,
399+ @ PathVariable Long planId ,
400+ Authentication authentication ) {
401+
402+ // JwtFilter에서 설정한 studentNumber를 가져옴
403+ Long currentUserStudentNumber = (Long ) authentication .getPrincipal ();
404+
405+ SubmissionStatisticsResponse statistics = assignmentSubmissionService .getSubmissionStatistics (
406+ groupId , planId , currentUserStudentNumber );
407+
408+ return ResponseEntity .ok (
409+ SuccessResponse .of (
410+ ResponseMessage .SUBMISSION_STATISTICS_SUCCESS ,
411+ statistics
412+ )
413+ );
414+ }
350415}
0 commit comments