From abea608e7f5eac87b8ba05f0f327cef5cd43f89c Mon Sep 17 00:00:00 2001 From: Sanghoon Jeong <67852689+wjdtkdgns@users.noreply.github.com> Date: Sun, 30 Jul 2023 21:02:42 +0900 Subject: [PATCH] =?UTF-8?q?[refact]=20=ED=95=A9=EA=B2=A9=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20response=20=EC=88=98=EC=A0=95=20(#120)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [refact] 결과 보기 response 수정 * [chore] spotless 적용 --- .../application/domain/ApplicantInfo.java | 4 +- .../dto/response/GetResultResponse.java | 44 +++++++++++++------ .../application/mapper/ApplicationMapper.java | 3 +- .../service/ApplicationService.java | 1 - 4 files changed, 34 insertions(+), 18 deletions(-) diff --git a/src/main/java/ceos/backend/domain/application/domain/ApplicantInfo.java b/src/main/java/ceos/backend/domain/application/domain/ApplicantInfo.java index e3ef5f67..aaa33dd4 100644 --- a/src/main/java/ceos/backend/domain/application/domain/ApplicantInfo.java +++ b/src/main/java/ceos/backend/domain/application/domain/ApplicantInfo.java @@ -8,7 +8,6 @@ import jakarta.persistence.EnumType; import jakarta.persistence.Enumerated; import jakarta.validation.constraints.NotNull; -import jakarta.validation.constraints.Positive; import jakarta.validation.constraints.PositiveOrZero; import jakarta.validation.constraints.Size; import java.time.LocalDate; @@ -54,8 +53,7 @@ public class ApplicantInfo { @Column(unique = true) private String uuid; - @NotNull @PositiveOrZero - private int semestersLeftNumber; + @NotNull @PositiveOrZero private int semestersLeftNumber; @Builder private ApplicantInfo( diff --git a/src/main/java/ceos/backend/domain/application/dto/response/GetResultResponse.java b/src/main/java/ceos/backend/domain/application/dto/response/GetResultResponse.java index 944aa507..21462178 100644 --- a/src/main/java/ceos/backend/domain/application/dto/response/GetResultResponse.java +++ b/src/main/java/ceos/backend/domain/application/dto/response/GetResultResponse.java @@ -7,11 +7,10 @@ import ceos.backend.global.common.dto.ParsedDuration; import ceos.backend.global.util.ParsedDurationConvertor; import com.fasterxml.jackson.annotation.JsonUnwrapped; +import java.time.LocalDate; import lombok.Builder; import lombok.Getter; -import java.time.LocalDate; - @Getter public class GetResultResponse { private Pass pass; @@ -20,32 +19,51 @@ public class GetResultResponse { private String name; - @JsonUnwrapped - private ParsedDuration parsedDuration; + @JsonUnwrapped private ParsedDuration parsedDuration; private LocalDate otDate; + private boolean attendanceStatus; + @Builder - private GetResultResponse(Pass pass, int generation, String name, ParsedDuration parsedDuration, LocalDate otDate) { + private GetResultResponse( + Pass pass, + int generation, + String name, + ParsedDuration parsedDuration, + LocalDate otDate, + boolean attendanceStatus) { this.pass = pass; this.generation = generation; this.name = name; this.parsedDuration = parsedDuration; this.otDate = otDate; + this.attendanceStatus = attendanceStatus; } - public static GetResultResponse toDocumentResult(Application application, Recruitment recruitment) { - return GetResultResponse.builder().pass(application.getDocumentPass()) + public static GetResultResponse toDocumentResult( + Application application, Recruitment recruitment) { + return GetResultResponse.builder() + .pass(application.getDocumentPass()) .generation(recruitment.getGeneration()) .name(application.getApplicantInfo().getName()) - .parsedDuration(ParsedDurationConvertor.parsingDuration(application.getInterviewDatetime())) - .otDate(recruitment.getOtDate()).build(); + .parsedDuration( + ParsedDurationConvertor.parsingDuration(application.getInterviewDatetime())) + .otDate(recruitment.getOtDate()) + .attendanceStatus(application.isInterviewCheck()) + .build(); } - public static GetResultResponse toFinalResult(Application application, Recruitment recruitment) { - return GetResultResponse.builder().pass(application.getFinalPass()).generation(recruitment.getGeneration()) + public static GetResultResponse toFinalResult( + Application application, Recruitment recruitment) { + return GetResultResponse.builder() + .pass(application.getFinalPass()) + .generation(recruitment.getGeneration()) .name(application.getApplicantInfo().getName()) - .parsedDuration(ParsedDurationConvertor.parsingDuration(application.getInterviewDatetime())) - .otDate(recruitment.getOtDate()).build(); + .parsedDuration( + ParsedDurationConvertor.parsingDuration(application.getInterviewDatetime())) + .otDate(recruitment.getOtDate()) + .attendanceStatus(application.isFinalCheck()) + .build(); } } diff --git a/src/main/java/ceos/backend/domain/application/mapper/ApplicationMapper.java b/src/main/java/ceos/backend/domain/application/mapper/ApplicationMapper.java index 790f0b9f..e6d399a3 100644 --- a/src/main/java/ceos/backend/domain/application/mapper/ApplicationMapper.java +++ b/src/main/java/ceos/backend/domain/application/mapper/ApplicationMapper.java @@ -93,7 +93,8 @@ public List toApplicationInterviewList( return applicationInterviews; } - public GetResultResponse toGetResultResponse(Application application, Recruitment recruitment, boolean isDocument) { + public GetResultResponse toGetResultResponse( + Application application, Recruitment recruitment, boolean isDocument) { if (isDocument) { return GetResultResponse.toDocumentResult(application, recruitment); } diff --git a/src/main/java/ceos/backend/domain/application/service/ApplicationService.java b/src/main/java/ceos/backend/domain/application/service/ApplicationService.java index 919642f4..9962fbbb 100644 --- a/src/main/java/ceos/backend/domain/application/service/ApplicationService.java +++ b/src/main/java/ceos/backend/domain/application/service/ApplicationService.java @@ -13,7 +13,6 @@ import ceos.backend.domain.application.vo.QuestionListVo; import ceos.backend.domain.recruitment.domain.Recruitment; import ceos.backend.domain.recruitment.helper.RecruitmentHelper; -import ceos.backend.domain.recruitment.repository.RecruitmentRepository; import ceos.backend.domain.recruitment.validator.RecruitmentValidator; import ceos.backend.global.common.dto.PageInfo; import ceos.backend.global.util.InterviewDateTimeConvertor;