Skip to content

Commit

Permalink
Merge pull request #154 from kakao-tech-campus-2nd-step3/Develop
Browse files Browse the repository at this point in the history
[Master] ์ด์Šˆ ํ•ด๊ฒฐ
  • Loading branch information
minsu-cnu authored Nov 12, 2024
2 parents 79ae857 + f4706cb commit 0236e11
Show file tree
Hide file tree
Showing 21 changed files with 260 additions and 168 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
@@ -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) {

}
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,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()
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,11 @@ public ResponseEntity<ExceptionResponse> handleIllegalCallerException(
ExceptionResponse exceptionResponse = new ExceptionResponse(e.getMessage());
return new ResponseEntity<>(exceptionResponse, HttpStatus.BAD_REQUEST);
}

@ExceptionHandler(value = ResumeAlreadyExistsException.class)
public ResponseEntity<ExceptionResponse> handleResumeAlreadyExistsException(
ResumeAlreadyExistsException e) {
ExceptionResponse exceptionResponse = new ExceptionResponse(e.getMessage());
return new ResponseEntity<>(exceptionResponse, HttpStatus.BAD_REQUEST);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package team18.team18_be.exception;

public class ResumeAlreadyExistsException extends RuntimeException {

public ResumeAlreadyExistsException() {
}

public ResumeAlreadyExistsException(String message) {
super(message);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public ResponseEntity<List<RecruitmentResponseForCompany>> getAllRecruitmentByCo
}

@Operation(summary = "๊ตฌ์ธ๊ธ€ ๋งˆ๊ฐ ๋ฉ”์„œ๋“œ")
@GetMapping("/hiringClose/{recruitmentId}")
@PostMapping("/hiringClose/{recruitmentId}")
public ResponseEntity<Void> setRecruitmentHiringFalse(
@PathVariable Long recruitmentId
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public record RecruitmentRequest(
String title,
String companySize,
String companyScale,
String area,
Long salary,
String workDuration,
Expand Down
Loading

0 comments on commit 0236e11

Please sign in to comment.