From 42c34e349db892553f11323b5ab8d7ea289ea172 Mon Sep 17 00:00:00 2001 From: Minji Kim <101392857+alsswl@users.noreply.github.com> Date: Tue, 12 Nov 2024 00:43:39 +0900 Subject: [PATCH 1/8] =?UTF-8?q?fix=20:=20=EA=B5=AC=EC=9D=B8=EA=B8=80=20?= =?UTF-8?q?=ED=95=84=EB=93=9C=20=EB=88=84=EB=9D=BD=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../recruitment/dto/response/RecruitmentResponse.java | 1 + .../dto/response/RecruitmentResponseForCompany.java | 2 +- .../dto/response/RecruitmentSummationResponse.java | 5 +++-- .../recruitment/mapper/RecruitmentMapper.java | 2 +- .../recruitment/service/RecruitmentService.java | 11 +++++++---- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/main/java/team18/team18_be/recruitment/dto/response/RecruitmentResponse.java b/src/main/java/team18/team18_be/recruitment/dto/response/RecruitmentResponse.java index 8a6da3b8..ac46ba9a 100644 --- a/src/main/java/team18/team18_be/recruitment/dto/response/RecruitmentResponse.java +++ b/src/main/java/team18/team18_be/recruitment/dto/response/RecruitmentResponse.java @@ -4,6 +4,7 @@ public record RecruitmentResponse( String koreanTitle, String vietnameseTitle, String companySize, + String imageUrl, String area, Long salary, String workDuration, diff --git a/src/main/java/team18/team18_be/recruitment/dto/response/RecruitmentResponseForCompany.java b/src/main/java/team18/team18_be/recruitment/dto/response/RecruitmentResponseForCompany.java index 54222c2f..e983c2b1 100644 --- a/src/main/java/team18/team18_be/recruitment/dto/response/RecruitmentResponseForCompany.java +++ b/src/main/java/team18/team18_be/recruitment/dto/response/RecruitmentResponseForCompany.java @@ -2,7 +2,7 @@ public record RecruitmentResponseForCompany( Long recruitmentId, - String image, + String imageUrl, String koreanTitle, String vietnameseTitle, String companyName, diff --git a/src/main/java/team18/team18_be/recruitment/dto/response/RecruitmentSummationResponse.java b/src/main/java/team18/team18_be/recruitment/dto/response/RecruitmentSummationResponse.java index c932985e..cd3477bf 100644 --- a/src/main/java/team18/team18_be/recruitment/dto/response/RecruitmentSummationResponse.java +++ b/src/main/java/team18/team18_be/recruitment/dto/response/RecruitmentSummationResponse.java @@ -2,12 +2,13 @@ public record RecruitmentSummationResponse( Long recruitmentId, - String image, + String imageUrl, String koreanTitle, String vietnameseTitle, String companyName, Long salary, - String area + String area, + String workHours ) { } diff --git a/src/main/java/team18/team18_be/recruitment/mapper/RecruitmentMapper.java b/src/main/java/team18/team18_be/recruitment/mapper/RecruitmentMapper.java index 3b8d3051..e1df8ba7 100644 --- a/src/main/java/team18/team18_be/recruitment/mapper/RecruitmentMapper.java +++ b/src/main/java/team18/team18_be/recruitment/mapper/RecruitmentMapper.java @@ -21,5 +21,5 @@ Recruitment toRecruitment(String koreanTitle, String vietnameseTitle, Date uploadDate); RecruitmentResponse toRecruitmentResponse(Recruitment recruitment, - RecruitmentContent recruitmentContent); + RecruitmentContent recruitmentContent,String imageUrl); } diff --git a/src/main/java/team18/team18_be/recruitment/service/RecruitmentService.java b/src/main/java/team18/team18_be/recruitment/service/RecruitmentService.java index 48cc1be4..29faf024 100644 --- a/src/main/java/team18/team18_be/recruitment/service/RecruitmentService.java +++ b/src/main/java/team18/team18_be/recruitment/service/RecruitmentService.java @@ -71,7 +71,8 @@ public RecruitmentAllResponse getAllRecruitment(Pageable pageable) { recruitment.getVietnameseTitle(), recruitment.getCompanyName(), recruitment.getSalary(), - recruitment.getArea() + recruitment.getArea(), + recruitment.getWorkHours() )) .collect(Collectors.toList()); int totalPage = recruitments.getTotalPages(); @@ -90,7 +91,8 @@ public RecruitmentAllResponse getAllRecruitmentAndSortBySalary(Pageable pageable recruitment.getVietnameseTitle(), recruitment.getCompanyName(), recruitment.getSalary(), - recruitment.getArea() + recruitment.getArea(), + recruitment.getWorkHours() )) .collect(Collectors.toList()); int totalPage = recruitments.getTotalPages(); @@ -109,7 +111,8 @@ public RecruitmentAllResponse getAllRecruitmentAndSortByDate(Pageable pageable) recruitment.getVietnameseTitle(), recruitment.getCompanyName(), recruitment.getSalary(), - recruitment.getArea() + recruitment.getArea(), + recruitment.getWorkHours() )) .collect(Collectors.toList()); int totalPage = recruitments.getTotalPages(); @@ -120,7 +123,7 @@ public RecruitmentResponse getRecruitmentResponseByRecruitmentId(Long userId) { Recruitment recruitment = recruitmentRepository.findById(userId) .orElseThrow(() -> new NoSuchElementException("해당하는 이력서가 존재하지 않습니다.")); return recruitmentMapper.toRecruitmentResponse(recruitment, - recruitment.getRecruitmentContent()); + recruitment.getRecruitmentContent(),recruitment.getCompany().getLogoImage()); } public List getRecruitmentResponseByCompanyId(Long companyId) { From cde60314fd2d771b4baf629f7ebcd46d32fb1376 Mon Sep 17 00:00:00 2001 From: Minji Kim <101392857+alsswl@users.noreply.github.com> Date: Tue, 12 Nov 2024 01:44:24 +0900 Subject: [PATCH 2/8] =?UTF-8?q?fix=20:=20companySize=20->=20companyScale?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../recruitment/dto/request/RecruitmentRequest.java | 2 +- .../recruitment/dto/response/RecruitmentResponse.java | 4 +++- .../team18/team18_be/recruitment/entity/Recruitment.java | 6 +++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/team18/team18_be/recruitment/dto/request/RecruitmentRequest.java b/src/main/java/team18/team18_be/recruitment/dto/request/RecruitmentRequest.java index c3965951..768a5606 100644 --- a/src/main/java/team18/team18_be/recruitment/dto/request/RecruitmentRequest.java +++ b/src/main/java/team18/team18_be/recruitment/dto/request/RecruitmentRequest.java @@ -2,7 +2,7 @@ public record RecruitmentRequest( String title, - String companySize, + String companyScale, String area, Long salary, String workDuration, diff --git a/src/main/java/team18/team18_be/recruitment/dto/response/RecruitmentResponse.java b/src/main/java/team18/team18_be/recruitment/dto/response/RecruitmentResponse.java index ac46ba9a..d738e3a1 100644 --- a/src/main/java/team18/team18_be/recruitment/dto/response/RecruitmentResponse.java +++ b/src/main/java/team18/team18_be/recruitment/dto/response/RecruitmentResponse.java @@ -1,9 +1,11 @@ package team18.team18_be.recruitment.dto.response; +import com.mysql.cj.util.DnsSrv.SrvRecord; + public record RecruitmentResponse( String koreanTitle, String vietnameseTitle, - String companySize, + String companyScale, String imageUrl, String area, Long salary, diff --git a/src/main/java/team18/team18_be/recruitment/entity/Recruitment.java b/src/main/java/team18/team18_be/recruitment/entity/Recruitment.java index 1b0a8c8b..6668fe82 100644 --- a/src/main/java/team18/team18_be/recruitment/entity/Recruitment.java +++ b/src/main/java/team18/team18_be/recruitment/entity/Recruitment.java @@ -26,7 +26,7 @@ public class Recruitment { @NotNull private String vietnameseTitle; @NotNull - private String companySize; + private String companyScale; @NotNull private String area; @NotNull @@ -65,7 +65,7 @@ public class Recruitment { @NotNull private RecruitmentContent recruitmentContent; - public Recruitment(String koreanTitle, String vietnameseTitle, String companySize, String area, + public Recruitment(String koreanTitle, String vietnameseTitle, String companyScale, String area, Long salary, String workDuration, String workDays, String workType, String workHours, String requestedCareer, String majorBusiness, String eligibilityCriteria, String preferredConditions, @@ -73,7 +73,7 @@ public Recruitment(String koreanTitle, String vietnameseTitle, String companySiz RecruitmentContent recruitmentContent) { this.koreanTitle = koreanTitle; this.vietnameseTitle = vietnameseTitle; - this.companySize = companySize; + this.companyScale = companyScale; this.area = area; this.salary = salary; this.workDuration = workDuration; From ac7f0822431ff0c815c75eba56e9838d75c15989 Mon Sep 17 00:00:00 2001 From: Minji Kim <101392857+alsswl@users.noreply.github.com> Date: Tue, 12 Nov 2024 01:44:35 +0900 Subject: [PATCH 3/8] =?UTF-8?q?fix=20:=20=EA=B5=AC=EC=9D=B8=EB=A7=88?= =?UTF-8?q?=EA=B0=90=20=EC=97=90=EB=9F=AC=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../team18_be/recruitment/controller/RecruitmentController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/team18/team18_be/recruitment/controller/RecruitmentController.java b/src/main/java/team18/team18_be/recruitment/controller/RecruitmentController.java index 8f4e4a4b..e29dbb41 100644 --- a/src/main/java/team18/team18_be/recruitment/controller/RecruitmentController.java +++ b/src/main/java/team18/team18_be/recruitment/controller/RecruitmentController.java @@ -73,7 +73,7 @@ public ResponseEntity> getAllRecruitmentByCo } @Operation(summary = "구인글 마감 메서드") - @GetMapping("/hiringClose/{recruitmentId}") + @PostMapping("/hiringClose/{recruitmentId}") public ResponseEntity setRecruitmentHiringFalse( @PathVariable Long recruitmentId ) { From 2e4e0c29bebca7fa1335df56f78de70e1b65f2c1 Mon Sep 17 00:00:00 2001 From: Minji Kim <101392857+alsswl@users.noreply.github.com> Date: Tue, 12 Nov 2024 01:57:54 +0900 Subject: [PATCH 4/8] =?UTF-8?q?feat=20:=20=EA=B5=AC=EC=9D=B8=EA=B8=80?= =?UTF-8?q?=EC=9D=B4=20=EB=A7=88=EA=B0=90=EB=90=98=EC=97=88=EC=9D=84=20?= =?UTF-8?q?=EB=95=8C=20=ED=95=B4=EB=8B=B9=20=EA=B5=AC=EC=9D=B8=EA=B8=80?= =?UTF-8?q?=EA=B3=BC=20=EA=B4=80=EB=A0=A8=EB=90=9C=20=EC=A7=80=EC=9B=90?= =?UTF-8?q?=EC=9D=98=20status=EB=A5=BC=20=EC=B1=84=EC=9A=A9=EB=A7=88?= =?UTF-8?q?=EA=B0=90=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/RecruitmentService.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main/java/team18/team18_be/recruitment/service/RecruitmentService.java b/src/main/java/team18/team18_be/recruitment/service/RecruitmentService.java index 29faf024..e01cc7e3 100644 --- a/src/main/java/team18/team18_be/recruitment/service/RecruitmentService.java +++ b/src/main/java/team18/team18_be/recruitment/service/RecruitmentService.java @@ -8,6 +8,9 @@ import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; +import team18.team18_be.apply.ApplyStatusEnum.ApplyStatus; +import team18.team18_be.apply.entity.Apply; +import team18.team18_be.apply.repository.ApplyRepository; import team18.team18_be.config.infrastructure.OpenAiService; import team18.team18_be.recruitment.dto.request.RecruitmentRequest; import team18.team18_be.recruitment.dto.response.PageDto; @@ -30,15 +33,18 @@ public class RecruitmentService { private final CompanyRepository companyRepository; private final OpenAiService openAiService; private final RecruitmentMapper recruitmentMapper; + private final ApplyRepository applyRepository; public RecruitmentService(RecruitmentRepository recruitmentRepository, RecruitmentContentRepository recruitmentContentRepository, OpenAiService openAiService, - CompanyRepository companyRepository, RecruitmentMapper recruitmentMapper) { + CompanyRepository companyRepository, RecruitmentMapper recruitmentMapper, + ApplyRepository applyRepository) { this.recruitmentRepository = recruitmentRepository; this.recruitmentContentRepository = recruitmentContentRepository; this.openAiService = openAiService; this.companyRepository = companyRepository; this.recruitmentMapper = recruitmentMapper; + this.applyRepository = applyRepository; } public Long saveRecruitment(RecruitmentRequest recruitmentRequest) @@ -143,10 +149,20 @@ public List getRecruitmentResponseByCompanyId(Lon .collect(Collectors.toList()); } + public void setApplyHiringFalse(Recruitment recruitment){ + List applyList = applyRepository.findByRecruitment(recruitment) + .orElseThrow(() -> new NoSuchElementException("해당하는 지원이 존재하지 않습니다.")); + ApplyStatus status = ApplyStatus.HIRING_CLOSED; + for (Apply apply : applyList) { + applyRepository.save(new Apply(apply.getId(),status.getKoreanName(),apply.getUser(),apply.getRecruitment())); + } + } + public void setRecruitmentHiringFalse(Long recruitmentId) { Recruitment recruitment = recruitmentRepository.findById(recruitmentId) .orElseThrow(() -> new NoSuchElementException("해당하는 회사가 존재하지 않습니다.")); recruitment.setHiring(false); + setApplyHiringFalse(recruitment); recruitmentRepository.save(recruitment); } From ab550e3f9917d3c92b40a41d6f49beeb801d93fe Mon Sep 17 00:00:00 2001 From: Minji Kim <101392857+alsswl@users.noreply.github.com> Date: Tue, 12 Nov 2024 02:52:11 +0900 Subject: [PATCH 5/8] =?UTF-8?q?fix=20:=20=ED=95=84=EB=93=9C=EB=AA=85=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ApplierPerRecruitmentResponse.java | 2 +- .../team18_be/apply/service/ApplyService.java | 2 +- .../dto/response/RecruitmentResponse.java | 1 + .../resume/dto/request/ResumeRequest.java | 4 +-- .../dto/response/ResumeAndApplyResponse.java | 4 +-- .../resume/dto/response/ResumeResponse.java | 4 +-- .../team18_be/resume/entity/Resume.java | 30 ++++++++++++++----- 7 files changed, 31 insertions(+), 16 deletions(-) diff --git a/src/main/java/team18/team18_be/apply/dto/response/ApplierPerRecruitmentResponse.java b/src/main/java/team18/team18_be/apply/dto/response/ApplierPerRecruitmentResponse.java index 5ce12899..ff854be3 100644 --- a/src/main/java/team18/team18_be/apply/dto/response/ApplierPerRecruitmentResponse.java +++ b/src/main/java/team18/team18_be/apply/dto/response/ApplierPerRecruitmentResponse.java @@ -1,6 +1,6 @@ package team18.team18_be.apply.dto.response; public record ApplierPerRecruitmentResponse(Long userId, String name, Long resumeId, Long applyId, - String applicantNation, String korean) { + String applicantNation, String koreanLanguageLevel) { } diff --git a/src/main/java/team18/team18_be/apply/service/ApplyService.java b/src/main/java/team18/team18_be/apply/service/ApplyService.java index a1e7a9a9..61aa8ebd 100644 --- a/src/main/java/team18/team18_be/apply/service/ApplyService.java +++ b/src/main/java/team18/team18_be/apply/service/ApplyService.java @@ -92,7 +92,7 @@ private ApplierPerRecruitmentResponse createApplierPerRecruitmentResponse(Apply Resume resume = resumeRepository.findByUser(applicantUser); //그 지원자의 이력서 가져오기 return new ApplierPerRecruitmentResponse( applicantUser.getId(), applicantUser.getName(), resume.getResumeId(), apply.getId(), - "베트남", resume.getKorean() + "베트남", resume.getKoreanLanguageLevel() ); } diff --git a/src/main/java/team18/team18_be/recruitment/dto/response/RecruitmentResponse.java b/src/main/java/team18/team18_be/recruitment/dto/response/RecruitmentResponse.java index d738e3a1..8aa2a3be 100644 --- a/src/main/java/team18/team18_be/recruitment/dto/response/RecruitmentResponse.java +++ b/src/main/java/team18/team18_be/recruitment/dto/response/RecruitmentResponse.java @@ -18,6 +18,7 @@ public record RecruitmentResponse( String eligibilityCriteria, String preferredConditions, String employerName, + String companyName, String koreanDetailedDescription, String vietnameseDetailedDescription diff --git a/src/main/java/team18/team18_be/resume/dto/request/ResumeRequest.java b/src/main/java/team18/team18_be/resume/dto/request/ResumeRequest.java index 257a7e3d..a16039d7 100644 --- a/src/main/java/team18/team18_be/resume/dto/request/ResumeRequest.java +++ b/src/main/java/team18/team18_be/resume/dto/request/ResumeRequest.java @@ -5,8 +5,8 @@ public record ResumeRequest( String address, String phoneNumber, String career, - String korean, - String selfIntroduction + String koreanLanguageLevel, + String introduction ) { } diff --git a/src/main/java/team18/team18_be/resume/dto/response/ResumeAndApplyResponse.java b/src/main/java/team18/team18_be/resume/dto/response/ResumeAndApplyResponse.java index 9eaaa815..b2b793ce 100644 --- a/src/main/java/team18/team18_be/resume/dto/response/ResumeAndApplyResponse.java +++ b/src/main/java/team18/team18_be/resume/dto/response/ResumeAndApplyResponse.java @@ -6,8 +6,8 @@ public record ResumeAndApplyResponse( String address, String phoneNumber, String career, - String korean, - String selfIntroduction, + String koreanLanguageLevel, + String introduction, String motivation ) { diff --git a/src/main/java/team18/team18_be/resume/dto/response/ResumeResponse.java b/src/main/java/team18/team18_be/resume/dto/response/ResumeResponse.java index e99f3f5f..e13d4a06 100644 --- a/src/main/java/team18/team18_be/resume/dto/response/ResumeResponse.java +++ b/src/main/java/team18/team18_be/resume/dto/response/ResumeResponse.java @@ -6,8 +6,8 @@ public record ResumeResponse( String address, String phoneNumber, String career, - String korean, - String selfIntroduction + String koreanLanguageLevel, + String introduction ) { } diff --git a/src/main/java/team18/team18_be/resume/entity/Resume.java b/src/main/java/team18/team18_be/resume/entity/Resume.java index b88f87dc..e641ad49 100644 --- a/src/main/java/team18/team18_be/resume/entity/Resume.java +++ b/src/main/java/team18/team18_be/resume/entity/Resume.java @@ -9,6 +9,7 @@ import jakarta.persistence.Lob; import jakarta.persistence.ManyToOne; import jakarta.validation.constraints.NotNull; +import java.util.Objects; import lombok.Getter; import lombok.Setter; import team18.team18_be.auth.entity.User; @@ -30,11 +31,11 @@ public class Resume { @NotNull private String career; @NotNull - private String korean; + private String koreanLanguageLevel; @Lob @Column(columnDefinition = "TEXT") @NotNull - private String selfIntroduction; + private String introduction; @ManyToOne @JoinColumn(name = "userId") @@ -42,28 +43,41 @@ public class Resume { private User user; public Resume(String applicantName, String address, String phoneNumber, String career, - String korean, String selfIntroduction, User user) { + String koreanLanguageLevel, String selfIntroduction, User user) { this.applicantName = applicantName; this.address = address; this.phoneNumber = phoneNumber; this.career = career; - this.korean = korean; - this.selfIntroduction = selfIntroduction; + this.koreanLanguageLevel = koreanLanguageLevel; + this.introduction = selfIntroduction; this.user = user; } public Resume(Long resumeId, String applicantName, String address, String phoneNumber, - String career, String korean, String selfIntroduction, User user) { + String career, String koreanLanguageLevel, String selfIntroduction, User user) { this.resumeId = resumeId; this.applicantName = applicantName; this.address = address; this.phoneNumber = phoneNumber; this.career = career; - this.korean = korean; - this.selfIntroduction = selfIntroduction; + this.koreanLanguageLevel = koreanLanguageLevel; + this.introduction = selfIntroduction; this.user = user; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Resume resume = (Resume) o; + return Objects.equals(user.getId(), resume.user.getId()); + } + + @Override + public int hashCode() { + return Objects.hash(user); + } + public Resume() { } From 95661a55a975312ee00f8d3c7ef113a7ab214774 Mon Sep 17 00:00:00 2001 From: Minji Kim <101392857+alsswl@users.noreply.github.com> Date: Tue, 12 Nov 2024 03:16:33 +0900 Subject: [PATCH 6/8] =?UTF-8?q?feat=20:=20=EC=9D=B4=EB=A0=A5=EC=84=9C=20?= =?UTF-8?q?=EC=A1=B4=EC=9E=AC=20=EC=97=AC=EB=B6=80=20api=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../team18_be/exception/GlobalExceptionHandler.java | 7 +++++++ .../exception/ResumeAlreadyExistsException.java | 10 ++++++++++ .../team18_be/resume/controller/ResumeController.java | 9 +++++++++ .../team18/team18_be/resume/service/ResumeService.java | 6 ++++++ 4 files changed, 32 insertions(+) create mode 100644 src/main/java/team18/team18_be/exception/ResumeAlreadyExistsException.java diff --git a/src/main/java/team18/team18_be/exception/GlobalExceptionHandler.java b/src/main/java/team18/team18_be/exception/GlobalExceptionHandler.java index 54ddab8e..d480bde3 100644 --- a/src/main/java/team18/team18_be/exception/GlobalExceptionHandler.java +++ b/src/main/java/team18/team18_be/exception/GlobalExceptionHandler.java @@ -80,4 +80,11 @@ public ResponseEntity handleIllegalCallerException( ExceptionResponse exceptionResponse = new ExceptionResponse(e.getMessage()); return new ResponseEntity<>(exceptionResponse, HttpStatus.BAD_REQUEST); } + + @ExceptionHandler(value = ResumeAlreadyExistsException.class) + public ResponseEntity handleResumeAlreadyExistsException( + ResumeAlreadyExistsException e) { + ExceptionResponse exceptionResponse = new ExceptionResponse(e.getMessage()); + return new ResponseEntity<>(exceptionResponse, HttpStatus.BAD_REQUEST); + } } diff --git a/src/main/java/team18/team18_be/exception/ResumeAlreadyExistsException.java b/src/main/java/team18/team18_be/exception/ResumeAlreadyExistsException.java new file mode 100644 index 00000000..9fe29bd2 --- /dev/null +++ b/src/main/java/team18/team18_be/exception/ResumeAlreadyExistsException.java @@ -0,0 +1,10 @@ +package team18.team18_be.exception; + +public class ResumeAlreadyExistsException extends RuntimeException{ + public ResumeAlreadyExistsException() { + } + + public ResumeAlreadyExistsException(String message) { + super(message); + } +} diff --git a/src/main/java/team18/team18_be/resume/controller/ResumeController.java b/src/main/java/team18/team18_be/resume/controller/ResumeController.java index 584799e0..28b43374 100644 --- a/src/main/java/team18/team18_be/resume/controller/ResumeController.java +++ b/src/main/java/team18/team18_be/resume/controller/ResumeController.java @@ -57,4 +57,13 @@ public ResponseEntity getResumeById( return ResponseEntity.ok().body(resumeService.findResumeById(resumeId, applyId)); } + @Operation(summary = "해당 유저의 이력서 존재 여부 확인") + @GetMapping("/existence") + public ResponseEntity existence( + @LoginUser User user + ) { + resumeService.existence(user); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + } diff --git a/src/main/java/team18/team18_be/resume/service/ResumeService.java b/src/main/java/team18/team18_be/resume/service/ResumeService.java index 5407da37..78ac9d51 100644 --- a/src/main/java/team18/team18_be/resume/service/ResumeService.java +++ b/src/main/java/team18/team18_be/resume/service/ResumeService.java @@ -7,6 +7,7 @@ import team18.team18_be.apply.repository.ApplicationFormRepository; import team18.team18_be.apply.repository.ApplyRepository; import team18.team18_be.auth.entity.User; +import team18.team18_be.exception.ResumeAlreadyExistsException; import team18.team18_be.resume.dto.request.ResumeRequest; import team18.team18_be.resume.dto.response.ResumeAndApplyResponse; import team18.team18_be.resume.dto.response.ResumeResponse; @@ -49,4 +50,9 @@ public ResumeAndApplyResponse findResumeById(Long resumeId, Long applyId) { return resumeMapper.toResumeAndApplyResponse(resume, applicationForm.getMotivation()); } + public void existence(User user) { + if(resumeRepository.findByUser(user) != null){ + throw new ResumeAlreadyExistsException("해당 유저에 대한 이력서가 존재합니다."); + } + } } From 4984884126f397c7a65e8468a5d0bf453d0ab922 Mon Sep 17 00:00:00 2001 From: Minji Kim <101392857+alsswl@users.noreply.github.com> Date: Tue, 12 Nov 2024 03:27:30 +0900 Subject: [PATCH 7/8] =?UTF-8?q?refactor=20:=20=EC=BD=94=EB=93=9C=EC=A0=95?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/RecruitmentMapperImpl.java | 153 +++++++++--------- .../resume/mapper/ResumeMapperImpl.java | 130 +++++++-------- .../apply/dto/response/MandatoryResponse.java | 2 +- .../team18_be/apply/service/ApplyService.java | 10 +- .../ResumeAlreadyExistsException.java | 3 +- .../dto/response/RecruitmentResponse.java | 2 - .../recruitment/mapper/RecruitmentMapper.java | 2 +- .../service/RecruitmentService.java | 37 ++--- .../team18_be/resume/entity/Resume.java | 14 +- .../resume/service/ResumeService.java | 2 +- 10 files changed, 183 insertions(+), 172 deletions(-) diff --git a/src/main/generated/team18/team18_be/recruitment/mapper/RecruitmentMapperImpl.java b/src/main/generated/team18/team18_be/recruitment/mapper/RecruitmentMapperImpl.java index 93bc3f89..23c23e27 100644 --- a/src/main/generated/team18/team18_be/recruitment/mapper/RecruitmentMapperImpl.java +++ b/src/main/generated/team18/team18_be/recruitment/mapper/RecruitmentMapperImpl.java @@ -17,84 +17,91 @@ @Component public class RecruitmentMapperImpl implements RecruitmentMapper { - @Override - public Recruitment toRecruitment(String koreanTitle, String vietnameseTitle, RecruitmentRequest recruitmentRequest, RecruitmentContent recruitmentContent, Company company, Boolean hiring, Date uploadDate) { - if ( koreanTitle == null && vietnameseTitle == null && recruitmentRequest == null && recruitmentContent == null && company == null && hiring == null && uploadDate == null ) { - return null; - } - - Recruitment recruitment = new Recruitment(); + @Override + public Recruitment toRecruitment(String koreanTitle, String vietnameseTitle, + RecruitmentRequest recruitmentRequest, RecruitmentContent recruitmentContent, Company company, + Boolean hiring, Date uploadDate) { + if (koreanTitle == null && vietnameseTitle == null && recruitmentRequest == null + && recruitmentContent == null && company == null && hiring == null && uploadDate == null) { + return null; + } - if ( recruitmentRequest != null ) { - recruitment.setCompanySize( recruitmentRequest.companySize() ); - recruitment.setArea( recruitmentRequest.area() ); - recruitment.setSalary( recruitmentRequest.salary() ); - recruitment.setWorkDuration( recruitmentRequest.workDuration() ); - recruitment.setWorkDays( recruitmentRequest.workDays() ); - recruitment.setWorkType( recruitmentRequest.workType() ); - recruitment.setWorkHours( recruitmentRequest.workHours() ); - recruitment.setRequestedCareer( recruitmentRequest.requestedCareer() ); - recruitment.setMajorBusiness( recruitmentRequest.majorBusiness() ); - recruitment.setEligibilityCriteria( recruitmentRequest.eligibilityCriteria() ); - recruitment.setPreferredConditions( recruitmentRequest.preferredConditions() ); - recruitment.setEmployerName( recruitmentRequest.employerName() ); - recruitment.setCompanyName( recruitmentRequest.companyName() ); - } - recruitment.setKoreanTitle( koreanTitle ); - recruitment.setVietnameseTitle( vietnameseTitle ); - recruitment.setRecruitmentContent( recruitmentContent ); - recruitment.setCompany( company ); - recruitment.setHiring( hiring ); - recruitment.setUploadDate( uploadDate ); + Recruitment recruitment = new Recruitment(); - return recruitment; + if (recruitmentRequest != null) { + recruitment.setCompanySize(recruitmentRequest.companySize()); + recruitment.setArea(recruitmentRequest.area()); + recruitment.setSalary(recruitmentRequest.salary()); + recruitment.setWorkDuration(recruitmentRequest.workDuration()); + recruitment.setWorkDays(recruitmentRequest.workDays()); + recruitment.setWorkType(recruitmentRequest.workType()); + recruitment.setWorkHours(recruitmentRequest.workHours()); + recruitment.setRequestedCareer(recruitmentRequest.requestedCareer()); + recruitment.setMajorBusiness(recruitmentRequest.majorBusiness()); + recruitment.setEligibilityCriteria(recruitmentRequest.eligibilityCriteria()); + recruitment.setPreferredConditions(recruitmentRequest.preferredConditions()); + recruitment.setEmployerName(recruitmentRequest.employerName()); + recruitment.setCompanyName(recruitmentRequest.companyName()); } + recruitment.setKoreanTitle(koreanTitle); + recruitment.setVietnameseTitle(vietnameseTitle); + recruitment.setRecruitmentContent(recruitmentContent); + recruitment.setCompany(company); + recruitment.setHiring(hiring); + recruitment.setUploadDate(uploadDate); - @Override - public RecruitmentResponse toRecruitmentResponse(Recruitment recruitment, RecruitmentContent recruitmentContent) { - if ( recruitment == null && recruitmentContent == null ) { - return null; - } + return recruitment; + } - String koreanTitle = null; - String vietnameseTitle = null; - String companySize = null; - String area = null; - Long salary = null; - String workDuration = null; - String workDays = null; - String workType = null; - String workHours = null; - String requestedCareer = null; - String majorBusiness = null; - String eligibilityCriteria = null; - String preferredConditions = null; - String employerName = null; - if ( recruitment != null ) { - koreanTitle = recruitment.getKoreanTitle(); - vietnameseTitle = recruitment.getVietnameseTitle(); - companySize = recruitment.getCompanySize(); - area = recruitment.getArea(); - salary = recruitment.getSalary(); - workDuration = recruitment.getWorkDuration(); - workDays = recruitment.getWorkDays(); - workType = recruitment.getWorkType(); - workHours = recruitment.getWorkHours(); - requestedCareer = recruitment.getRequestedCareer(); - majorBusiness = recruitment.getMajorBusiness(); - eligibilityCriteria = recruitment.getEligibilityCriteria(); - preferredConditions = recruitment.getPreferredConditions(); - employerName = recruitment.getEmployerName(); - } - String koreanDetailedDescription = null; - String vietnameseDetailedDescription = null; - if ( recruitmentContent != null ) { - koreanDetailedDescription = recruitmentContent.getKoreanDetailedDescription(); - vietnameseDetailedDescription = recruitmentContent.getVietnameseDetailedDescription(); - } - - RecruitmentResponse recruitmentResponse = new RecruitmentResponse( koreanTitle, vietnameseTitle, companySize, area, salary, workDuration, workDays, workType, workHours, requestedCareer, majorBusiness, eligibilityCriteria, preferredConditions, employerName, koreanDetailedDescription, vietnameseDetailedDescription ); + @Override + public RecruitmentResponse toRecruitmentResponse(Recruitment recruitment, + RecruitmentContent recruitmentContent) { + if (recruitment == null && recruitmentContent == null) { + return null; + } - return recruitmentResponse; + String koreanTitle = null; + String vietnameseTitle = null; + String companySize = null; + String area = null; + Long salary = null; + String workDuration = null; + String workDays = null; + String workType = null; + String workHours = null; + String requestedCareer = null; + String majorBusiness = null; + String eligibilityCriteria = null; + String preferredConditions = null; + String employerName = null; + if (recruitment != null) { + koreanTitle = recruitment.getKoreanTitle(); + vietnameseTitle = recruitment.getVietnameseTitle(); + companySize = recruitment.getCompanySize(); + area = recruitment.getArea(); + salary = recruitment.getSalary(); + workDuration = recruitment.getWorkDuration(); + workDays = recruitment.getWorkDays(); + workType = recruitment.getWorkType(); + workHours = recruitment.getWorkHours(); + requestedCareer = recruitment.getRequestedCareer(); + majorBusiness = recruitment.getMajorBusiness(); + eligibilityCriteria = recruitment.getEligibilityCriteria(); + preferredConditions = recruitment.getPreferredConditions(); + employerName = recruitment.getEmployerName(); } + String koreanDetailedDescription = null; + String vietnameseDetailedDescription = null; + if (recruitmentContent != null) { + koreanDetailedDescription = recruitmentContent.getKoreanDetailedDescription(); + vietnameseDetailedDescription = recruitmentContent.getVietnameseDetailedDescription(); + } + + RecruitmentResponse recruitmentResponse = new RecruitmentResponse(koreanTitle, vietnameseTitle, + companySize, area, salary, workDuration, workDays, workType, workHours, requestedCareer, + majorBusiness, eligibilityCriteria, preferredConditions, employerName, + koreanDetailedDescription, vietnameseDetailedDescription); + + return recruitmentResponse; + } } diff --git a/src/main/generated/team18/team18_be/resume/mapper/ResumeMapperImpl.java b/src/main/generated/team18/team18_be/resume/mapper/ResumeMapperImpl.java index 006af9e9..b6e5b56c 100644 --- a/src/main/generated/team18/team18_be/resume/mapper/ResumeMapperImpl.java +++ b/src/main/generated/team18/team18_be/resume/mapper/ResumeMapperImpl.java @@ -16,81 +16,83 @@ @Component public class ResumeMapperImpl implements ResumeMapper { - @Override - public ResumeResponse toResumeResponse(Resume resume) { - if ( resume == null ) { - return null; - } + @Override + public ResumeResponse toResumeResponse(Resume resume) { + if (resume == null) { + return null; + } + + Long resumeId = null; + String applicantName = null; + String address = null; + String phoneNumber = null; + String career = null; + String korean = null; + String selfIntroduction = null; - Long resumeId = null; - String applicantName = null; - String address = null; - String phoneNumber = null; - String career = null; - String korean = null; - String selfIntroduction = null; + resumeId = resume.getResumeId(); + applicantName = resume.getApplicantName(); + address = resume.getAddress(); + phoneNumber = resume.getPhoneNumber(); + career = resume.getCareer(); + korean = resume.getKorean(); + selfIntroduction = resume.getSelfIntroduction(); - resumeId = resume.getResumeId(); - applicantName = resume.getApplicantName(); - address = resume.getAddress(); - phoneNumber = resume.getPhoneNumber(); - career = resume.getCareer(); - korean = resume.getKorean(); - selfIntroduction = resume.getSelfIntroduction(); + ResumeResponse resumeResponse = new ResumeResponse(resumeId, applicantName, address, + phoneNumber, career, korean, selfIntroduction); - ResumeResponse resumeResponse = new ResumeResponse( resumeId, applicantName, address, phoneNumber, career, korean, selfIntroduction ); + return resumeResponse; + } - return resumeResponse; + @Override + public ResumeAndApplyResponse toResumeAndApplyResponse(Resume resume, String motivation) { + if (resume == null && motivation == null) { + return null; } - @Override - public ResumeAndApplyResponse toResumeAndApplyResponse(Resume resume, String motivation) { - if ( resume == null && motivation == null ) { - return null; - } + Long resumeId = null; + String applicantName = null; + String address = null; + String phoneNumber = null; + String career = null; + String korean = null; + String selfIntroduction = null; + if (resume != null) { + resumeId = resume.getResumeId(); + applicantName = resume.getApplicantName(); + address = resume.getAddress(); + phoneNumber = resume.getPhoneNumber(); + career = resume.getCareer(); + korean = resume.getKorean(); + selfIntroduction = resume.getSelfIntroduction(); + } + String motivation1 = null; + motivation1 = motivation; - Long resumeId = null; - String applicantName = null; - String address = null; - String phoneNumber = null; - String career = null; - String korean = null; - String selfIntroduction = null; - if ( resume != null ) { - resumeId = resume.getResumeId(); - applicantName = resume.getApplicantName(); - address = resume.getAddress(); - phoneNumber = resume.getPhoneNumber(); - career = resume.getCareer(); - korean = resume.getKorean(); - selfIntroduction = resume.getSelfIntroduction(); - } - String motivation1 = null; - motivation1 = motivation; + ResumeAndApplyResponse resumeAndApplyResponse = new ResumeAndApplyResponse(resumeId, + applicantName, address, phoneNumber, career, korean, selfIntroduction, motivation1); - ResumeAndApplyResponse resumeAndApplyResponse = new ResumeAndApplyResponse( resumeId, applicantName, address, phoneNumber, career, korean, selfIntroduction, motivation1 ); + return resumeAndApplyResponse; + } - return resumeAndApplyResponse; + @Override + public Resume toResume(ResumeRequest resumeRequest, User user) { + if (resumeRequest == null && user == null) { + return null; } - @Override - public Resume toResume(ResumeRequest resumeRequest, User user) { - if ( resumeRequest == null && user == null ) { - return null; - } + Resume resume = new Resume(); - Resume resume = new Resume(); - - if ( resumeRequest != null ) { - resume.setApplicantName( resumeRequest.applicantName() ); - resume.setAddress( resumeRequest.address() ); - resume.setPhoneNumber( resumeRequest.phoneNumber() ); - resume.setCareer( resumeRequest.career() ); - resume.setKorean( resumeRequest.korean() ); - resume.setSelfIntroduction( resumeRequest.selfIntroduction() ); - } - resume.setUser( user ); - - return resume; + if (resumeRequest != null) { + resume.setApplicantName(resumeRequest.applicantName()); + resume.setAddress(resumeRequest.address()); + resume.setPhoneNumber(resumeRequest.phoneNumber()); + resume.setCareer(resumeRequest.career()); + resume.setKorean(resumeRequest.korean()); + resume.setSelfIntroduction(resumeRequest.selfIntroduction()); } + resume.setUser(user); + + return resume; + } } diff --git a/src/main/java/team18/team18_be/apply/dto/response/MandatoryResponse.java b/src/main/java/team18/team18_be/apply/dto/response/MandatoryResponse.java index b1ae8003..6b4e8dd5 100644 --- a/src/main/java/team18/team18_be/apply/dto/response/MandatoryResponse.java +++ b/src/main/java/team18/team18_be/apply/dto/response/MandatoryResponse.java @@ -1,6 +1,6 @@ package team18.team18_be.apply.dto.response; public record MandatoryResponse(boolean resumeExistence, boolean visaExistence, - boolean foreignerIdNumberExistence,boolean signExistence) { + boolean foreignerIdNumberExistence, boolean signExistence) { } diff --git a/src/main/java/team18/team18_be/apply/service/ApplyService.java b/src/main/java/team18/team18_be/apply/service/ApplyService.java index 61aa8ebd..804fd73f 100644 --- a/src/main/java/team18/team18_be/apply/service/ApplyService.java +++ b/src/main/java/team18/team18_be/apply/service/ApplyService.java @@ -2,7 +2,6 @@ import java.util.List; import java.util.NoSuchElementException; -import java.util.Optional; import java.util.stream.Collectors; import org.springframework.stereotype.Service; import team18.team18_be.apply.ApplyStatusEnum.ApplyStatus; @@ -21,8 +20,6 @@ import team18.team18_be.resume.entity.Resume; import team18.team18_be.resume.repository.ResumeRepository; import team18.team18_be.userInformation.entity.Company; -import team18.team18_be.userInformation.entity.ForeignerInformation; -import team18.team18_be.userInformation.entity.Sign; import team18.team18_be.userInformation.repository.CompanyRepository; import team18.team18_be.userInformation.repository.ForeignerInformationRepository; import team18.team18_be.userInformation.repository.SignRepository; @@ -42,14 +39,15 @@ public class ApplyService { public ApplyService(ApplicationFormRepository applicationFormRepository, ApplyRepository applyRepository, RecruitmentRepository recruitmentRepository, ResumeRepository resumeRepository, CompanyRepository companyRepository, - ForeignerInformationRepository foreignerInformationRepository,SignRepository signRepository) { + ForeignerInformationRepository foreignerInformationRepository, + SignRepository signRepository) { this.applicationFormRepository = applicationFormRepository; this.applyRepository = applyRepository; this.recruitmentRepository = recruitmentRepository; this.resumeRepository = resumeRepository; this.companyRepository = companyRepository; this.foreignerInformationRepository = foreignerInformationRepository; - this.signRepository=signRepository; + this.signRepository = signRepository; } public Long createApplicationForm(ApplicationFormRequest applicationFormRequest, @@ -127,7 +125,7 @@ public MandatoryResponse checkMandatory(User user) { boolean signExistence = signRepository.findByUser(user).isPresent(); MandatoryResponse mandatoryResponse = new MandatoryResponse(resumeExistence, visaExistence, - foreignerIdNumberExistence,signExistence); + foreignerIdNumberExistence, signExistence); return mandatoryResponse; } diff --git a/src/main/java/team18/team18_be/exception/ResumeAlreadyExistsException.java b/src/main/java/team18/team18_be/exception/ResumeAlreadyExistsException.java index 9fe29bd2..d968761e 100644 --- a/src/main/java/team18/team18_be/exception/ResumeAlreadyExistsException.java +++ b/src/main/java/team18/team18_be/exception/ResumeAlreadyExistsException.java @@ -1,6 +1,7 @@ package team18.team18_be.exception; -public class ResumeAlreadyExistsException extends RuntimeException{ +public class ResumeAlreadyExistsException extends RuntimeException { + public ResumeAlreadyExistsException() { } diff --git a/src/main/java/team18/team18_be/recruitment/dto/response/RecruitmentResponse.java b/src/main/java/team18/team18_be/recruitment/dto/response/RecruitmentResponse.java index 8aa2a3be..f5380459 100644 --- a/src/main/java/team18/team18_be/recruitment/dto/response/RecruitmentResponse.java +++ b/src/main/java/team18/team18_be/recruitment/dto/response/RecruitmentResponse.java @@ -1,7 +1,5 @@ package team18.team18_be.recruitment.dto.response; -import com.mysql.cj.util.DnsSrv.SrvRecord; - public record RecruitmentResponse( String koreanTitle, String vietnameseTitle, diff --git a/src/main/java/team18/team18_be/recruitment/mapper/RecruitmentMapper.java b/src/main/java/team18/team18_be/recruitment/mapper/RecruitmentMapper.java index e1df8ba7..fce7033d 100644 --- a/src/main/java/team18/team18_be/recruitment/mapper/RecruitmentMapper.java +++ b/src/main/java/team18/team18_be/recruitment/mapper/RecruitmentMapper.java @@ -21,5 +21,5 @@ Recruitment toRecruitment(String koreanTitle, String vietnameseTitle, Date uploadDate); RecruitmentResponse toRecruitmentResponse(Recruitment recruitment, - RecruitmentContent recruitmentContent,String imageUrl); + RecruitmentContent recruitmentContent, String imageUrl); } diff --git a/src/main/java/team18/team18_be/recruitment/service/RecruitmentService.java b/src/main/java/team18/team18_be/recruitment/service/RecruitmentService.java index e01cc7e3..b69ddbef 100644 --- a/src/main/java/team18/team18_be/recruitment/service/RecruitmentService.java +++ b/src/main/java/team18/team18_be/recruitment/service/RecruitmentService.java @@ -57,7 +57,7 @@ public Long saveRecruitment(RecruitmentRequest recruitmentRequest) koreanDetailedDescription); RecruitmentContent recruitmentContent = recruitmentContentRepository.save( new RecruitmentContent(koreanDetailedDescription, vietnameseDetailedDescription)); - return recruitmentRepository.save( + return recruitmentRepository.save( recruitmentMapper.toRecruitment(koreanTitle, vietnameseTitle, recruitmentRequest, recruitmentContent, companyRepository.findById(recruitmentRequest.companyId()) .orElseThrow(() -> new NoSuchElementException("해당하는 회사가 존재하지 않습니다.")), true, @@ -70,19 +70,19 @@ public RecruitmentAllResponse getAllRecruitment(Pageable pageable) { Page recruitments = recruitmentRepository.findAllByHiringTrue(pageable); List recruitmentSummationResponseList = recruitments.stream() - .map(recruitment -> new RecruitmentSummationResponse( - recruitment.getRecruitmentId(), - recruitment.getCompany().getLogoImage(), - recruitment.getKoreanTitle(), - recruitment.getVietnameseTitle(), - recruitment.getCompanyName(), - recruitment.getSalary(), - recruitment.getArea(), - recruitment.getWorkHours() - )) - .collect(Collectors.toList()); + .map(recruitment -> new RecruitmentSummationResponse( + recruitment.getRecruitmentId(), + recruitment.getCompany().getLogoImage(), + recruitment.getKoreanTitle(), + recruitment.getVietnameseTitle(), + recruitment.getCompanyName(), + recruitment.getSalary(), + recruitment.getArea(), + recruitment.getWorkHours() + )) + .collect(Collectors.toList()); int totalPage = recruitments.getTotalPages(); - return new RecruitmentAllResponse(recruitmentSummationResponseList,new PageDto(totalPage)); + return new RecruitmentAllResponse(recruitmentSummationResponseList, new PageDto(totalPage)); } public RecruitmentAllResponse getAllRecruitmentAndSortBySalary(Pageable pageable) { @@ -102,7 +102,7 @@ public RecruitmentAllResponse getAllRecruitmentAndSortBySalary(Pageable pageable )) .collect(Collectors.toList()); int totalPage = recruitments.getTotalPages(); - return new RecruitmentAllResponse(recruitmentSummationResponseList,new PageDto(totalPage)); + return new RecruitmentAllResponse(recruitmentSummationResponseList, new PageDto(totalPage)); } public RecruitmentAllResponse getAllRecruitmentAndSortByDate(Pageable pageable) { @@ -122,14 +122,14 @@ public RecruitmentAllResponse getAllRecruitmentAndSortByDate(Pageable pageable) )) .collect(Collectors.toList()); int totalPage = recruitments.getTotalPages(); - return new RecruitmentAllResponse(recruitmentSummationResponseList,new PageDto(totalPage)); + return new RecruitmentAllResponse(recruitmentSummationResponseList, new PageDto(totalPage)); } public RecruitmentResponse getRecruitmentResponseByRecruitmentId(Long userId) { Recruitment recruitment = recruitmentRepository.findById(userId) .orElseThrow(() -> new NoSuchElementException("해당하는 이력서가 존재하지 않습니다.")); return recruitmentMapper.toRecruitmentResponse(recruitment, - recruitment.getRecruitmentContent(),recruitment.getCompany().getLogoImage()); + recruitment.getRecruitmentContent(), recruitment.getCompany().getLogoImage()); } public List getRecruitmentResponseByCompanyId(Long companyId) { @@ -149,12 +149,13 @@ public List getRecruitmentResponseByCompanyId(Lon .collect(Collectors.toList()); } - public void setApplyHiringFalse(Recruitment recruitment){ + public void setApplyHiringFalse(Recruitment recruitment) { List applyList = applyRepository.findByRecruitment(recruitment) .orElseThrow(() -> new NoSuchElementException("해당하는 지원이 존재하지 않습니다.")); ApplyStatus status = ApplyStatus.HIRING_CLOSED; for (Apply apply : applyList) { - applyRepository.save(new Apply(apply.getId(),status.getKoreanName(),apply.getUser(),apply.getRecruitment())); + applyRepository.save(new Apply(apply.getId(), status.getKoreanName(), apply.getUser(), + apply.getRecruitment())); } } diff --git a/src/main/java/team18/team18_be/resume/entity/Resume.java b/src/main/java/team18/team18_be/resume/entity/Resume.java index e641ad49..91fe168d 100644 --- a/src/main/java/team18/team18_be/resume/entity/Resume.java +++ b/src/main/java/team18/team18_be/resume/entity/Resume.java @@ -65,10 +65,17 @@ public Resume(Long resumeId, String applicantName, String address, String phoneN this.user = user; } + public Resume() { + } + @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } Resume resume = (Resume) o; return Objects.equals(user.getId(), resume.user.getId()); } @@ -78,7 +85,4 @@ public int hashCode() { return Objects.hash(user); } - public Resume() { - } - } diff --git a/src/main/java/team18/team18_be/resume/service/ResumeService.java b/src/main/java/team18/team18_be/resume/service/ResumeService.java index 78ac9d51..953a7810 100644 --- a/src/main/java/team18/team18_be/resume/service/ResumeService.java +++ b/src/main/java/team18/team18_be/resume/service/ResumeService.java @@ -51,7 +51,7 @@ public ResumeAndApplyResponse findResumeById(Long resumeId, Long applyId) { } public void existence(User user) { - if(resumeRepository.findByUser(user) != null){ + if (resumeRepository.findByUser(user) != null) { throw new ResumeAlreadyExistsException("해당 유저에 대한 이력서가 존재합니다."); } } From 0b9e92a2b0356aa981d4526312b0e347845cdeee Mon Sep 17 00:00:00 2001 From: EunKyung Lee <2dmsrud2002@naver.com> Date: Tue, 12 Nov 2024 17:15:21 +0900 Subject: [PATCH 8/8] =?UTF-8?q?Feat:=20=EA=B7=BC=EB=A1=9C=EA=B3=84?= =?UTF-8?q?=EC=95=BD=EC=84=9C=20=EC=9E=91=EC=84=B1=20=EC=8B=9C=20=EC=A7=80?= =?UTF-8?q?=EC=9B=90=20=EC=83=81=ED=83=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../team18_be/contract/service/ContractService.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/team18/team18_be/contract/service/ContractService.java b/src/main/java/team18/team18_be/contract/service/ContractService.java index ce10ee81..e2d380e4 100644 --- a/src/main/java/team18/team18_be/contract/service/ContractService.java +++ b/src/main/java/team18/team18_be/contract/service/ContractService.java @@ -4,6 +4,7 @@ import jakarta.transaction.Transactional; import java.io.IOException; import org.springframework.stereotype.Service; +import team18.team18_be.apply.ApplyStatusEnum.ApplyStatus; import team18.team18_be.apply.entity.Apply; import team18.team18_be.apply.repository.ApplyRepository; import team18.team18_be.auth.entity.User; @@ -98,8 +99,16 @@ public void createContract(ContractRequest request, String pdfUrl, String pdfUrl @Transactional private void updateContractFiles(ContractRequest request, String pdfUrl, String imageUrl, String pdfUrlV, String imageUrlV) { + Apply apply = applyRepository.findById(request.applyId()) + .orElseThrow(() -> new NotFoundException("해당 applyId가 존재하지 않습니다.")); Contract contract = contractRepository.findByApplyId(request.applyId()) .orElseThrow(() -> new NotFoundException("해당 applyId의 Contract가 존재하지 않습니다.")); + + // 채용 완료로 지원 상태 변경 + ApplyStatus status = ApplyStatus.HIRED; + applyRepository.save( + new Apply(apply.getId(), status.getKoreanName(), apply.getUser(), apply.getRecruitment())); + contract.updatePdfFileUrl(pdfUrl); contract.updateImageFileUrl(imageUrl); contract.updatePdfFileUrlV(pdfUrlV);