diff --git a/src/main/java/com/kusithm/hdmedi_server/domain/survey/controller/SurveyController.java b/src/main/java/com/kusithm/hdmedi_server/domain/survey/controller/SurveyController.java index c00ed55..d37e2f9 100644 --- a/src/main/java/com/kusithm/hdmedi_server/domain/survey/controller/SurveyController.java +++ b/src/main/java/com/kusithm/hdmedi_server/domain/survey/controller/SurveyController.java @@ -34,7 +34,7 @@ public ResponseEntity> submitSurvey(@AuthenticatedUserId final H public ResponseEntity> getAllSurveys(@AuthenticatedUserId final HDmediUser hDmediUser) { final AllSurveyResponseDto responseDto = surveyService.getAllSurvey(hDmediUser); return ResponseEntity.status(HttpStatus.OK) - .body(BaseResponse.of(SuccessCode.OK, null)); + .body(BaseResponse.of(SuccessCode.OK, responseDto)); } @GetMapping("/result") diff --git a/src/main/java/com/kusithm/hdmedi_server/domain/survey/domain/Respondent.java b/src/main/java/com/kusithm/hdmedi_server/domain/survey/domain/Respondent.java index 83eff35..74fc915 100644 --- a/src/main/java/com/kusithm/hdmedi_server/domain/survey/domain/Respondent.java +++ b/src/main/java/com/kusithm/hdmedi_server/domain/survey/domain/Respondent.java @@ -4,18 +4,22 @@ import lombok.Builder; import lombok.Data; +import java.time.LocalDate; +import java.time.LocalDateTime; import java.util.List; @Builder @Data -public class Respondent extends BaseTimeEntity { +public class Respondent{ private List baseSurveyList; private int totalScore; + private LocalDate createDate; - public static Respondent createRespondent(List baseSurveyList, int totalScore) { + public static Respondent createRespondent(List baseSurveyList, int totalScore, LocalDate localDate) { return Respondent.builder() .baseSurveyList(baseSurveyList) .totalScore(totalScore) + .createDate(localDate) .build(); } diff --git a/src/main/java/com/kusithm/hdmedi_server/domain/survey/service/SurveyService.java b/src/main/java/com/kusithm/hdmedi_server/domain/survey/service/SurveyService.java index 8fc0851..cd8314c 100644 --- a/src/main/java/com/kusithm/hdmedi_server/domain/survey/service/SurveyService.java +++ b/src/main/java/com/kusithm/hdmedi_server/domain/survey/service/SurveyService.java @@ -13,6 +13,7 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import java.time.LocalDate; import java.util.List; import java.util.stream.Collectors; import java.util.stream.IntStream; @@ -26,7 +27,7 @@ public class SurveyService { public SurveyResultResponseDto processSurvey(HDmediUser hDmediUser, CreateSurveyDto createSurveyDto) { List baseSurveyList = createBaseSurvey(createSurveyDto.getQuestionList()); - Respondent respondent = Respondent.createRespondent(baseSurveyList, createSurveyDto.getTotalScore()); + Respondent respondent = Respondent.createRespondent(baseSurveyList, createSurveyDto.getTotalScore(), LocalDate.now()); Survey currentSurvey = findSurvey(hDmediUser.getId()); addRespondentSurvey(hDmediUser.getIsGuest(), currentSurvey, respondent); saveSurvey(currentSurvey); @@ -62,14 +63,13 @@ private List getBaseAllSurveyResponseDtoList(Survey cu List respondentList = currentSurvey.getEachSurvey().getParentsSurveyList(); List responseDtoList = IntStream.range(0, respondentList.size()) .mapToObj(idx -> BaseAllSurveyResponseDto.of( - respondentList.get(idx).getLastModifiedDate().toLocalDate(), + respondentList.get(idx).getCreateDate(), Long.valueOf(idx) )) .collect(Collectors.toList()); return responseDtoList; } - private List getBaseSurveyDtoListFor(Respondent respondent) { return respondent.getBaseSurveyList().stream() .map(baseSurvey -> @@ -94,7 +94,7 @@ private Respondent getParentsRespondent(Survey currentSurvey, int id) { private Respondent getTeacherRespondent(Survey currentSurvey, int id) { List teacherSurveyList = currentSurvey.getEachSurvey().getTeacherSurveyList(); - if (teacherSurveyList.size() <= id) return Respondent.createRespondent(null, -1); + if (teacherSurveyList.size() <= id) return Respondent.createRespondent(null, -1, LocalDate.now()); return teacherSurveyList.get(id); } diff --git a/src/main/resources/messages_ko_KR.properties b/src/main/resources/messages_ko_KR.properties index 82d8164..148c8a2 100644 --- a/src/main/resources/messages_ko_KR.properties +++ b/src/main/resources/messages_ko_KR.properties @@ -1,3 +1,3 @@ emergency.content = ????? ? ???? ??? ???? ????. ??? ?? ???? ??? ????? ????? ??? ?? ??? ?? ?? ???? ?? ?? ????? ???? ??? ??? ??? ??? ???? ??? ??? ?? ???? ??? ?? ?? ????. non.emergency.content = ?? ??? ?? ????. ??? ??? ???? ??? ??? ?? ? ???? ???? ??? ??? ?? ?? ??????. ADHD? ?? ? ??? ??? ???? ?? www.adhd.or.kr? ?????! -non.Survey.content = ???? ??? ????? ???? ???? ?????? \ No newline at end of file +non.Survey.content = ???? ??? ????? ???? ???? ??????. \ No newline at end of file