Skip to content

Commit

Permalink
Merge pull request #10 from potenday-project/develop
Browse files Browse the repository at this point in the history
답변 재생성, 로그아웃, 면접 종료 상태 추가
  • Loading branch information
HwangHoYoon authored Dec 13, 2023
2 parents e4ac001 + 515fced commit a5a749c
Show file tree
Hide file tree
Showing 20 changed files with 346 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public class QInterview extends EntityPathBase<Interview> {

public static final QInterview interview = new QInterview("interview");

public final StringPath feedback = createString("feedback");

public final NumberPath<Long> interviewId = createNumber("interviewId", Long.class);

public final StringPath recruitSummary = createString("recruitSummary");
Expand All @@ -30,6 +32,8 @@ public class QInterview extends EntityPathBase<Interview> {

public final StringPath resumeSummary = createString("resumeSummary");

public final NumberPath<Integer> status = createNumber("status", Integer.class);

public final StringPath title = createString("title");

public final com.chwipoClova.user.entity.QUser user;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ public enum ExceptionCode {

INTERVIEW_LIST_OVER("881", "면접 최대 개수를 초과하였습니다."),

INTERVIEW_COMPLETE("882", "완료 된 면접 입니다."),

INTERVIEW_NOT_COMPLETE("883", "미완료 된 면접 입니다."),

QA_NULL("890", "질문 정보가 올바르지 않습니다."),

TOKEN_NULL("950", "토큰정보가 올바르지 않습니다.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,7 @@ public class FeedbackController {

private final FeedbackService feedbackService;

@Operation(summary = "피드백 재생성", description = "피드백 재생성")
@PostMapping("/generateFeedback")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = String.class)))
}
)
public CommonResponse generateFeedback (@RequestBody FeedbackGenerateReq feedbackGenerateReq) throws Exception {
return feedbackService.generateFeedback(feedbackGenerateReq);
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,12 @@ public CommonResponse generateFeedback(FeedbackGenerateReq feedbackGenerateReq)
Long userId = feedbackGenerateReq.getUserId();

userRepository.findById(userId).orElseThrow(() -> new CommonException(ExceptionCode.USER_NULL.getMessage(), ExceptionCode.USER_NULL.getCode()));
interviewRepository.findByUserUserIdAndInterviewId(userId, interviewId).orElseThrow(() -> new CommonException(ExceptionCode.INTERVIEW_NULL.getMessage(), ExceptionCode.INTERVIEW_NULL.getCode()));
Interview interview = interviewRepository.findByUserUserIdAndInterviewId(userId, interviewId).orElseThrow(() -> new CommonException(ExceptionCode.INTERVIEW_NULL.getMessage(), ExceptionCode.INTERVIEW_NULL.getCode()));
Integer status = interview.getStatus();

if (status != 1) {
throw new CommonException(ExceptionCode.INTERVIEW_NOT_COMPLETE.getMessage(), ExceptionCode.INTERVIEW_NOT_COMPLETE.getCode());
}

List<Qa> qaList = qaRepository.findByInterviewInterviewIdOrderByQaId(interviewId);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
package com.chwipoClova.interview.controller;

import com.chwipoClova.common.response.CommonResponse;
import com.chwipoClova.feedback.request.FeedbackGenerateReq;
import com.chwipoClova.interview.request.InterviewFeedbackGenerateReq;
import com.chwipoClova.interview.request.InterviewInitQaReq;
import com.chwipoClova.interview.request.InterviewInsertReq;
import com.chwipoClova.interview.request.InterviewQaAnswerInsertReq;
import com.chwipoClova.interview.response.InterviewInsertRes;
import com.chwipoClova.interview.response.InterviewListRes;
import com.chwipoClova.interview.response.InterviewNotCompRes;
import com.chwipoClova.interview.response.InterviewQaListRes;
import com.chwipoClova.interview.response.InterviewRes;
import com.chwipoClova.interview.service.InterviewService;
import com.chwipoClova.qa.request.QaAnswerInsertReq;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;

@Slf4j
Expand Down Expand Up @@ -64,18 +73,59 @@ public List<InterviewListRes> getInterviewList(@Schema(description = "userId", e
return interviewService.selectInterviewList(userId);
}

@Operation(summary = "미완료 면접 질문 조회", description = "미완료 면접 질문 조회")
@GetMapping(path = "/getNotCompInterview")
@Operation(summary = "면접 질문 조회", description = "면접 질문 조회")
@GetMapping(path = "/getQaList")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "OK")
}
)
public InterviewNotCompRes getNotCompInterview(
public InterviewQaListRes getQaList(
@Schema(description = "userId", example = "1", name = "userId") @RequestParam(name = "userId") Long userId,
@Schema(description = "interviewId", example = "1", name = "interviewId") @RequestParam(name = "interviewId") Long interviewId

) {
return interviewService.selectNotCompInterview(userId, interviewId);
return interviewService.selectQaList(userId, interviewId);
}


@Operation(summary = "답변 초기화", description = "답변 초기화")
@PostMapping("/initQa")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = String.class)))
}
)
public CommonResponse initQa(@RequestBody InterviewInitQaReq interviewInitQaReq) throws Exception {
return interviewService.initQa(interviewInitQaReq);
}

@Operation(summary = "면접 결과 내보내기", description = "면접 결과 내보내기")
@GetMapping("/downloadInterview")
public void downloadInterview(
@Schema(description = "userId", example = "1", name = "userId") @RequestParam(name = "userId") Long userId,
@Schema(description = "interviewId", example = "1", name = "interviewId") @RequestParam(name = "interviewId") Long interviewId,
HttpServletResponse response
) throws IOException {
interviewService.downloadInterview(userId, interviewId, response);
}


@Operation(summary = "피드백 재생성", description = "피드백 재생성")
@PostMapping("/generateFeedback")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = String.class)))
}
)
public CommonResponse generateFeedback (@RequestBody FeedbackGenerateReq feedbackGenerateReq) throws Exception {
return interviewService.generateFeedback(feedbackGenerateReq);
}

@Operation(summary = "답변 저장", description = "답변 저장")
@PostMapping("/insertAnswer")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = String.class)))
}
)
public CommonResponse insertAnswer(@RequestBody QaAnswerInsertReq qaAnswerInsertReq) throws Exception {
return interviewService.insertAnswer(qaAnswerInsertReq);
}
}
19 changes: 19 additions & 0 deletions src/main/java/com/chwipoClova/interview/entity/Interview.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.chwipoClova.interview.entity;

import com.chwipoClova.qa.entity.QaEditor;
import com.chwipoClova.user.entity.User;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
Expand Down Expand Up @@ -40,6 +41,14 @@ public class Interview {
@Schema(description = "채용공고 요약")
private String recruitSummary;

@Column(name = "status")
@Schema(description = "상태 (0 : 미완료, 1 : 완료)")
private Integer status;

@Column(name = "feedback")
@Schema(description = "면접관의속마음")
private String feedback;

@Column(name = "regDate")
@Schema(description = "등록일")
private Date regDate;
Expand All @@ -54,4 +63,14 @@ public void prePersist() {
this.regDate = new Date(); // 현재 날짜와 시간으로 등록일 설정
}


public InterviewEditor.InterviewEditorBuilder toEditor() {
return InterviewEditor.builder()
.status(status);
}

public void edit(InterviewEditor interviewEditor) {
status = interviewEditor.getStatus();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.chwipoClova.interview.entity;

import lombok.Builder;
import lombok.Getter;


@Getter
public class InterviewEditor {

private Integer status;

@Builder
public InterviewEditor(Integer status) {
this.status = status;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.chwipoClova.interview.request;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

@Data
public class InterviewFeedbackGenerateReq {

@Schema(description = "유저 ID", example = "1", name = "userId")
private Long userId;
@Schema(description = "면접 ID", example = "1", name = "interviewId")
private Long interviewId;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.chwipoClova.interview.request;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

@Data
public class InterviewInitQaReq {
@Schema(description = "유저 ID", example = "1", name = "userId")
private Long userId;
@Schema(description = "면접 ID", example = "1", name = "interviewId")
private Long interviewId;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.chwipoClova.interview.request;

import com.chwipoClova.qa.request.QaAnswerDataInsertReq;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.List;

@Data
public class InterviewQaAnswerInsertReq {

@Schema(description = "유저 ID", example = "1", name = "userId")
private Long userId;

@Schema(description = "면접 ID", example = "1", name = "interviewId")
private Long interviewId;

@Schema(description = "답변데이터", name = "answerData")
private List<QaAnswerDataInsertReq> answerData;
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ public class InterviewListRes {
@Schema(description = "답변개수", example = "1", name = "useCnt")
private Integer useCnt;

@Schema(description = "완료여부(0: 미완성, 1: 완성)", example = "1", name = "status")
private Integer status;

@Schema(description = "등록일", example = "2023-12-09T10:13:17.838+00:00", name = "regDate")
private Date regDate;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
import lombok.Builder;
import lombok.Data;

import java.util.Date;
import java.util.List;

@Data
@Builder
public class InterviewNotCompRes {
public class InterviewQaListRes {
@Schema(description = "면접 ID", example = "1", name = "interviewId")
private Long interviewId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ public class InterviewRes {
private Long userId;
@Schema(description = "면접 제목", example = "삼성채용", name = "title")
private String title;
@Schema(description = "완료여부(0 미완료, 1 완료)", example = "1", name = "status")
private Integer status;
@Schema(description = "등록일", example = "2023-12-09T10:13:17.838+00:00", name = "regDate")
private Date regDate;
@Schema(description = "면접관의속마음", example = "속마음1", name = "feedback")
private String feedback;
@Schema(description = "질문데이터", name = "qaData")
private List<QaListForFeedbackRes> qaData;

Expand Down
Loading

0 comments on commit a5a749c

Please sign in to comment.