Skip to content

Commit

Permalink
Merge pull request #125 from kakao-tech-campus-2nd-step3/Develop
Browse files Browse the repository at this point in the history
[Master] [지원] feat : ν•„μˆ˜μ •λ³΄ λ°˜ν™˜κ°’ λ³€κ²½
  • Loading branch information
LeeTaek2T authored Nov 10, 2024
2 parents 70f7e13 + cb6e194 commit 6561e87
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package team18.team18_be.apply.dto.response;

public record MandatoryResponse(boolean resumeExistence, boolean visaExistence,
boolean foreignerIdNumberExistence) {
boolean foreignerIdNumberExistence,boolean signExistence) {

}
29 changes: 16 additions & 13 deletions src/main/java/team18/team18_be/apply/service/ApplyService.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

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;
Expand All @@ -21,8 +22,10 @@
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;

@Service
public class ApplyService {
Expand All @@ -33,18 +36,20 @@ public class ApplyService {
private final ResumeRepository resumeRepository;
private final CompanyRepository companyRepository;
private final ForeignerInformationRepository foreignerInformationRepository;
private final SignRepository signRepository;


public ApplyService(ApplicationFormRepository applicationFormRepository,
ApplyRepository applyRepository, RecruitmentRepository recruitmentRepository,
ResumeRepository resumeRepository, CompanyRepository companyRepository,
ForeignerInformationRepository foreignerInformationRepository) {
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;
}

public Long createApplicationForm(ApplicationFormRequest applicationFormRequest,
Expand Down Expand Up @@ -112,14 +117,17 @@ private RecruitmentsOfApplierResponse createMyAppliedRecruitments(Apply apply) {
}

public MandatoryResponse checkMandatory(User user) {
ForeignerInformation foreignerInformation = foreignerInformationRepository.findByUser(user)
.orElseThrow(() -> new NoSuchElementException("ν•΄λ‹Ή 외ꡭ인 정보가 μ—†μŠ΅λ‹ˆλ‹€."));
Resume resume = resumeRepository.findByUser(user);
boolean visaExistence = checkNull(foreignerInformation.getForeignerIdNumber());
boolean resumeExistence = checkNull(foreignerInformation.getVisaGenerateDate());
boolean foreignerIdNumberExistence = checkNull(resume);
boolean visaExistence = foreignerInformationRepository.findByUser(user)
.map(info -> info.getVisaGenerateDate() != null)
.orElse(false);
boolean foreignerIdNumberExistence = foreignerInformationRepository.findByUser(user)
.map(info -> info.getForeignerIdNumber() != null)
.orElse(false);
boolean resumeExistence = resumeRepository.findByUser(user) != null;
boolean signExistence = signRepository.findByUser(user).isPresent();

MandatoryResponse mandatoryResponse = new MandatoryResponse(resumeExistence, visaExistence,
foreignerIdNumberExistence);
foreignerIdNumberExistence,signExistence);
return mandatoryResponse;
}

Expand All @@ -128,9 +136,4 @@ private Recruitment findRecruitment(Long recruitmentId) {
.orElseThrow(() -> new NoSuchElementException("ν•΄λ‹Ήλ˜λŠ” ꡬ인글이 μ—†μŠ΅λ‹ˆλ‹€."));
return recruitment;
}

private boolean checkNull(Object object) {
return object != null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ public ResponseEntity<SignResponse> findSign(@LoginUser User user) {
public ResponseEntity<Void> createCompany(
@RequestPart("companyRequest") String companyRequestJson,
@RequestPart MultipartFile logoImage, @LoginUser User user) {
System.out.println(companyRequestJson);
ObjectMapper objectMapper = new ObjectMapper();
CompanyRequest companyRequest = null;
try {
Expand Down

0 comments on commit 6561e87

Please sign in to comment.