From dfd7f4c7edf47e0bdb79b86041f0a5cc8ff3963b Mon Sep 17 00:00:00 2001 From: shinyurim <103302201+yoursin0330@users.noreply.github.com> Date: Fri, 29 Nov 2024 20:15:34 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20OCR=20=EC=9A=94=EC=B2=AD=20=EC=8B=9C=20?= =?UTF-8?q?=EB=A6=AC=ED=84=B4=20=ED=98=95=EC=8B=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../assignment/controller/AssignmentController.java | 4 ++-- ...SpecificCompareDTO.java => AssignmentSavedDto.java} | 10 +++++----- .../domain/assignment/service/AssignmentService.java | 7 +++---- 3 files changed, 10 insertions(+), 11 deletions(-) rename src/main/java/com/hangeulbada/domain/assignment/dto/{SpecificCompareDTO.java => AssignmentSavedDto.java} (63%) diff --git a/src/main/java/com/hangeulbada/domain/assignment/controller/AssignmentController.java b/src/main/java/com/hangeulbada/domain/assignment/controller/AssignmentController.java index 3b52753..6b2e77a 100644 --- a/src/main/java/com/hangeulbada/domain/assignment/controller/AssignmentController.java +++ b/src/main/java/com/hangeulbada/domain/assignment/controller/AssignmentController.java @@ -1,8 +1,8 @@ package com.hangeulbada.domain.assignment.controller; import com.hangeulbada.domain.annotation.StudentTag; +import com.hangeulbada.domain.assignment.dto.AssignmentSavedDto; import com.hangeulbada.domain.assignment.dto.AssignmentSummaryDto; -import com.hangeulbada.domain.assignment.dto.ScoreDTO; import com.hangeulbada.domain.assignment.dto.SpecificAssignmentDTO; import com.hangeulbada.domain.assignment.service.AssignmentService; import com.hangeulbada.domain.group.dto.GroupAssignmentDTO; @@ -29,7 +29,7 @@ public class AssignmentController { @PostMapping("/assignment/submit") @Operation(summary="OCR 요청", description="OCR 요청 전송") @ApiResponse(responseCode = "200", description = "OCR 후 문항별 점수 반환") - public ResponseEntity> submit( + public ResponseEntity submit( @RequestBody @Parameter(description = "OCR 요청 데이터", required = true, content = @Content(schema = @Schema(implementation = OCRRequest.class))) OCRRequest ocrRequest, Principal principal diff --git a/src/main/java/com/hangeulbada/domain/assignment/dto/SpecificCompareDTO.java b/src/main/java/com/hangeulbada/domain/assignment/dto/AssignmentSavedDto.java similarity index 63% rename from src/main/java/com/hangeulbada/domain/assignment/dto/SpecificCompareDTO.java rename to src/main/java/com/hangeulbada/domain/assignment/dto/AssignmentSavedDto.java index 7990924..45e3707 100644 --- a/src/main/java/com/hangeulbada/domain/assignment/dto/SpecificCompareDTO.java +++ b/src/main/java/com/hangeulbada/domain/assignment/dto/AssignmentSavedDto.java @@ -5,13 +5,13 @@ import lombok.Data; import lombok.NoArgsConstructor; +import java.util.List; + @Builder @Data @NoArgsConstructor @AllArgsConstructor -public class SpecificCompareDTO { - String number; - String answer; - String studentAnswer; - boolean isCorrect; +public class AssignmentSavedDto { + String id; + List scoreDtoList; } diff --git a/src/main/java/com/hangeulbada/domain/assignment/service/AssignmentService.java b/src/main/java/com/hangeulbada/domain/assignment/service/AssignmentService.java index 6455d37..ae2d724 100644 --- a/src/main/java/com/hangeulbada/domain/assignment/service/AssignmentService.java +++ b/src/main/java/com/hangeulbada/domain/assignment/service/AssignmentService.java @@ -43,7 +43,7 @@ public SpecificAssignmentDTO getAssignment(String studentId, String workbookId) } - public List requestOCR(OCRRequest ocrRequest, String studentId){ + public AssignmentSavedDto requestOCR(OCRRequest ocrRequest, String studentId){ String wId = ocrRequest.getWorkbookId(); List questionIds = workbookService.getQuestionIdsByWorkbookId(wId); @@ -92,12 +92,11 @@ public List requestOCR(OCRRequest ocrRequest, String studentId){ for(AssignmentContent content: newAssignment.getAnswers()){ content.setQuestionFull(questions.get(idx++)); } - assignmentRepository.save(newAssignment); + Assignment savedAssignment = assignmentRepository.save(newAssignment); //오답 태그 저장 saveIncorrectTag(assignmentDto, qIdMap, studentId); - - return scoreDTOS; + return AssignmentSavedDto.builder().id(savedAssignment.getId()).scoreDtoList(scoreDTOS).build(); }