diff --git a/server/Recruit-Api/src/main/java/com/econovation/recruit/api/card/service/CardService.java b/server/Recruit-Api/src/main/java/com/econovation/recruit/api/card/service/CardService.java index b8419cbb..91d81c6b 100644 --- a/server/Recruit-Api/src/main/java/com/econovation/recruit/api/card/service/CardService.java +++ b/server/Recruit-Api/src/main/java/com/econovation/recruit/api/card/service/CardService.java @@ -11,6 +11,7 @@ import com.econovation.recruitdomain.common.aop.domainEvent.Events; import com.econovation.recruitdomain.common.events.WorkCardDeletedEvent; import com.econovation.recruitdomain.domains.applicant.adaptor.AnswerAdaptor; +import com.econovation.recruitdomain.domains.applicant.domain.ApplicantState; import com.econovation.recruitdomain.domains.applicant.domain.MongoAnswer; import com.econovation.recruitdomain.domains.applicant.domain.MongoAnswerAdaptor; import com.econovation.recruitdomain.domains.applicant.exception.ApplicantProhibitDeleteException; @@ -70,6 +71,10 @@ public List getByNavigationId(Integer navigationId, Intege Map yearByAnswerIdMap = mongoAnswers.stream() .collect(Collectors.toMap(MongoAnswer::getId, MongoAnswer::getYear)); + Map stateByAnswerIdMap = mongoAnswers.stream() + .collect(Collectors.toMap(MongoAnswer::getId, + answer -> answer.getApplicantState()!=null ? answer.getApplicantState() : new ApplicantState())); + List cards = cardLoadPort.findAll(); Map answerIdByCardIdMap = cards.stream() @@ -108,7 +113,7 @@ public List getByNavigationId(Integer navigationId, Intege for (Board board : boards) { if (board.getCardType().equals(CardType.INVISIBLE)) { - result.add(BoardCardResponseDto.from(Card.empty(), board, "", "", "", false)); + result.add(BoardCardResponseDto.from(Card.empty(), board, "", "", "", false, new ApplicantState())); continue; } Card card = cardByBoardIdMap.get(board.getCardId()); @@ -118,7 +123,7 @@ public List getByNavigationId(Integer navigationId, Intege if (answers.isEmpty()) { result.add( BoardCardResponseDto.from( - card, board, firstPriority, secondPriority, "", false)); + card, board, firstPriority, secondPriority, "", false, new ApplicantState())); continue; } Map applicantAnswers = answers.get(card.getApplicantId()); @@ -138,9 +143,11 @@ public List getByNavigationId(Integer navigationId, Intege label.getCardId().equals(card.getId()) && label.getIdpId().equals(userId)); + ApplicantState state = stateByAnswerIdMap.getOrDefault(card.getApplicantId(), new ApplicantState()); + result.add( BoardCardResponseDto.from( - card, board, firstPriority, secondPriority, major, isLabeled)); + card, board, firstPriority, secondPriority, major, isLabeled, state)); } return result; } diff --git a/server/Recruit-Common/src/main/java/com/econovation/recruitcommon/consts/RecruitStatic.java b/server/Recruit-Common/src/main/java/com/econovation/recruitcommon/consts/RecruitStatic.java index 4dc98394..30ba45ca 100644 --- a/server/Recruit-Common/src/main/java/com/econovation/recruitcommon/consts/RecruitStatic.java +++ b/server/Recruit-Common/src/main/java/com/econovation/recruitcommon/consts/RecruitStatic.java @@ -35,6 +35,8 @@ public class RecruitStatic { public static Set CRETERIA_SET = new HashSet<>(Arrays.asList("열정/실천력", "동아리 애착", "협업", "태도")); + public static final String PASS_STATE_KEY = "passState"; + public static final String APPLICANT_SUCCESS_REGISTER_MESSAGE = "성공적으로 지원됐습니다"; public static final String NO_MATCH_INTERVIEWER_MESSAGE = "해당하는 면접관이 없습니다."; public static final String BOARD_SUCCESS_REGISTER_MESSAGE = "성공적으로 업무카드가 등록됐습니다"; diff --git a/server/Recruit-Domain/src/main/java/com/econovation/recruitdomain/domains/applicant/domain/PassStates.java b/server/Recruit-Domain/src/main/java/com/econovation/recruitdomain/domains/applicant/domain/PassStates.java index 23a566d1..c8395d32 100644 --- a/server/Recruit-Domain/src/main/java/com/econovation/recruitdomain/domains/applicant/domain/PassStates.java +++ b/server/Recruit-Domain/src/main/java/com/econovation/recruitdomain/domains/applicant/domain/PassStates.java @@ -6,7 +6,7 @@ import java.util.Arrays; @Getter -public enum PassStates { +public enum PassStates{ NONPASSED("non-passed"){ @Override @@ -43,4 +43,8 @@ public static PassStates findStatus(String status){ .orElseThrow(ApplicantWrongStateException::new); } + @Override + public String toString() { + return this.status; + } } diff --git a/server/Recruit-Domain/src/main/java/com/econovation/recruitdomain/domains/card/dto/BoardCardResponseDto.java b/server/Recruit-Domain/src/main/java/com/econovation/recruitdomain/domains/card/dto/BoardCardResponseDto.java index 1ab2876b..eb62aecd 100644 --- a/server/Recruit-Domain/src/main/java/com/econovation/recruitdomain/domains/card/dto/BoardCardResponseDto.java +++ b/server/Recruit-Domain/src/main/java/com/econovation/recruitdomain/domains/card/dto/BoardCardResponseDto.java @@ -1,5 +1,7 @@ package com.econovation.recruitdomain.domains.card.dto; +import com.econovation.recruitdomain.domains.applicant.domain.ApplicantState; +import com.econovation.recruitdomain.domains.applicant.domain.PassStates; import com.econovation.recruitdomain.domains.board.domain.Board; import com.econovation.recruitdomain.domains.board.domain.CardType; import com.econovation.recruitdomain.domains.card.domain.Card; @@ -7,6 +9,12 @@ import lombok.Data; import lombok.Getter; +import java.util.HashMap; +import java.util.Map; +import java.util.stream.Collectors; + +import static com.econovation.recruitcommon.consts.RecruitStatic.PASS_STATE_KEY; + @Getter @Data @Builder @@ -25,6 +33,7 @@ public class BoardCardResponseDto { private String firstPriority; private String secondPriority; private Boolean isLabeled; + private Map state; public static BoardCardResponseDto from( Card card, @@ -32,7 +41,8 @@ public static BoardCardResponseDto from( String firstPriority, String secondPriority, String major, - Boolean isLabeled) { + Boolean isLabeled, + ApplicantState state) { return BoardCardResponseDto.builder() .boardId(board.getId()) .applicantId(card.getApplicantId()) @@ -48,6 +58,13 @@ public static BoardCardResponseDto from( .firstPriority(firstPriority) .secondPriority(secondPriority) .isLabeled(isLabeled) + .state(toMap(state)) .build(); } + + private static Map toMap(ApplicantState state){ + Map stateMap = new HashMap<>(); + stateMap.put(PASS_STATE_KEY, state.getPassState()); + return stateMap; + } }