diff --git a/jobis-application/src/main/java/team/retum/jobis/common/util/StringUtil.java b/jobis-application/src/main/java/team/retum/jobis/common/util/StringUtil.java index 57035ddb8..f64732406 100644 --- a/jobis-application/src/main/java/team/retum/jobis/common/util/StringUtil.java +++ b/jobis-application/src/main/java/team/retum/jobis/common/util/StringUtil.java @@ -4,6 +4,8 @@ import lombok.NoArgsConstructor; import net.bytebuddy.utility.RandomString; +import java.util.ArrayList; +import java.util.Arrays; import java.util.List; @NoArgsConstructor(access = AccessLevel.PRIVATE) @@ -13,15 +15,14 @@ public static String joinStringList(List request, String key) { return request == null ? null : String.join(key, request.stream().map(Object::toString).toList()); } - public static String mergeString(String str1, String str2) { - return str1 + " " + str2; - } - public static List divideString(String content, String key) { - if (content == null || content.isEmpty()) { + if (content == null || content.isEmpty() || content.isBlank()) { return List.of(); } - return List.of(content.split(key)); + + List dividedList = Arrays.asList(content.split(key)); + + return new ArrayList<>(dividedList); } public static String generateRandomCode(int size) { diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/acceptance/model/Acceptance.java b/jobis-application/src/main/java/team/retum/jobis/domain/acceptance/model/Acceptance.java index 685f6391e..0d4e9ee24 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/acceptance/model/Acceptance.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/acceptance/model/Acceptance.java @@ -16,15 +16,13 @@ public class Acceptance { private final Integer year; - private final String studentName; - private final String businessArea; private final List tech; - private final String studentGcn; - private final LocalDate contractDate; private final Long companyId; + + private final Long studentId; } diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/acceptance/spi/QueryAcceptancePort.java b/jobis-application/src/main/java/team/retum/jobis/domain/acceptance/spi/QueryAcceptancePort.java index 277c441c4..3dbc2389a 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/acceptance/spi/QueryAcceptancePort.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/acceptance/spi/QueryAcceptancePort.java @@ -1,11 +1,11 @@ package team.retum.jobis.domain.acceptance.spi; -import team.retum.jobis.domain.acceptance.model.Acceptance; +import team.retum.jobis.domain.acceptance.spi.vo.AcceptanceVO; import java.util.List; public interface QueryAcceptancePort { - List queryAcceptancesByCompanyIdAndYear(Long companyId, Integer year); + List queryAcceptancesByCompanyIdAndYear(Long companyId, Integer year); } diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/acceptance/spi/vo/AcceptanceVO.java b/jobis-application/src/main/java/team/retum/jobis/domain/acceptance/spi/vo/AcceptanceVO.java new file mode 100644 index 000000000..70984754d --- /dev/null +++ b/jobis-application/src/main/java/team/retum/jobis/domain/acceptance/spi/vo/AcceptanceVO.java @@ -0,0 +1,18 @@ +package team.retum.jobis.domain.acceptance.spi.vo; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.time.LocalDate; + +@Getter +@AllArgsConstructor +public class AcceptanceVO { + + private final Long acceptanceId; + private final Integer grade; + private final Integer classRoom; + private final Integer number; + private final String studentName; + private final LocalDate contractDate; +} diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/acceptance/usecase/RegisterEmploymentContractUseCase.java b/jobis-application/src/main/java/team/retum/jobis/domain/acceptance/usecase/RegisterEmploymentContractUseCase.java index 4c2ca8ecd..922c670b8 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/acceptance/usecase/RegisterEmploymentContractUseCase.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/acceptance/usecase/RegisterEmploymentContractUseCase.java @@ -11,7 +11,6 @@ import team.retum.jobis.domain.application.spi.CommandApplicationPort; import team.retum.jobis.domain.application.spi.QueryApplicationPort; import team.retum.jobis.domain.application.spi.vo.ApplicationDetailVO; -import team.retum.jobis.domain.student.model.Student; import java.time.LocalDate; import java.time.Year; @@ -39,23 +38,19 @@ public void execute(RegisterEmploymentContractRequest request) { } return Acceptance.builder() - .studentName(application.getStudentName()) - .companyId(application.getId()) - .studentGcn(Student.processGcn( - application.getStudentGrade(), - application.getStudentClassNumber(), - application.getStudentNumber() - )) + .companyId(application.getCompanyId()) .contractDate(LocalDate.now()) .year(Year.now().getValue()) .tech(request.getCodeKeywords()) .businessArea(application.getBusinessArea()) + .studentId(application.getStudentId()) .build(); } ).toList(); commandAcceptancePort.saveAllAcceptance(acceptances); - commandApplicationPort.deleteApplicationByIds( + commandApplicationPort.changeApplicationStatus( + ApplicationStatus.ACCEPTANCE, applications.stream().map(ApplicationDetailVO::getId).toList() ); } diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/acceptance/usecase/TeacherQueryFieldTraineesAndContractWorkersUseCase.java b/jobis-application/src/main/java/team/retum/jobis/domain/acceptance/usecase/TeacherQueryFieldTraineesAndContractWorkersUseCase.java index a45d4b67e..e4006f30f 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/acceptance/usecase/TeacherQueryFieldTraineesAndContractWorkersUseCase.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/acceptance/usecase/TeacherQueryFieldTraineesAndContractWorkersUseCase.java @@ -5,8 +5,8 @@ import team.retum.jobis.domain.acceptance.dto.response.TeacherQueryFieldTraineesAndContractWorkersResponse; import team.retum.jobis.domain.acceptance.dto.response.TeacherQueryFieldTraineesAndContractWorkersResponse.TeacherQueryContractWorkersResponse; import team.retum.jobis.domain.acceptance.dto.response.TeacherQueryFieldTraineesAndContractWorkersResponse.TeacherQueryFieldTraineesResponse; -import team.retum.jobis.domain.acceptance.model.Acceptance; import team.retum.jobis.domain.acceptance.spi.QueryAcceptancePort; +import team.retum.jobis.domain.acceptance.spi.vo.AcceptanceVO; import team.retum.jobis.domain.application.spi.QueryApplicationPort; import team.retum.jobis.domain.application.spi.vo.FieldTraineesVO; import team.retum.jobis.domain.student.model.Student; @@ -22,54 +22,54 @@ public class TeacherQueryFieldTraineesAndContractWorkersUseCase { private final QueryAcceptancePort queryAcceptancePort; public TeacherQueryFieldTraineesAndContractWorkersResponse execute(Long companyId) { - - List queryFieldTraineesVOs = - queryApplicationPort.queryApplicationsFieldTraineesByCompanyId(companyId); - - List acceptanceEntities = - queryAcceptancePort.queryAcceptancesByCompanyIdAndYear(companyId, Year.now().getValue()); + List fieldTrainees = queryApplicationPort.queryApplicationsFieldTraineesByCompanyId(companyId); + List acceptances = queryAcceptancePort.queryAcceptancesByCompanyIdAndYear(companyId, Year.now().getValue()); return new TeacherQueryFieldTraineesAndContractWorkersResponse( - buildFieldTrainees(queryFieldTraineesVOs), - buildContractWorkers(acceptanceEntities) + buildFieldTrainees(fieldTrainees), + buildContractWorkers(acceptances) ); } private List buildFieldTrainees( - List queryFieldTraineesVOs + List fieldTrainees ) { - return queryFieldTraineesVOs.stream() - .map(vo -> TeacherQueryFieldTraineesResponse - .builder() - .applicationId(vo.getApplicationId()) - .studentGcn( - Student.processGcn( - vo.getGrade(), - vo.getClassRoom(), - vo.getNumber() + return fieldTrainees.stream() + .map( + fieldTrainee -> TeacherQueryFieldTraineesResponse + .builder() + .applicationId(fieldTrainee.getApplicationId()) + .studentGcn( + Student.processGcn( + fieldTrainee.getGrade(), + fieldTrainee.getClassRoom(), + fieldTrainee.getNumber() + ) ) - ) - .studentName(vo.getStudentName()) - .startDate(vo.getStartDate()) - .endDate(vo.getEndDate()) - .build()) - .toList(); + .studentName(fieldTrainee.getStudentName()) + .startDate(fieldTrainee.getStartDate()) + .endDate(fieldTrainee.getEndDate()) + .build() + ).toList(); } private List buildContractWorkers( - List acceptanceEntities + List acceptances ) { - return acceptanceEntities - .stream() + return acceptances.stream() .map( acceptance -> TeacherQueryContractWorkersResponse .builder() - .acceptanceId(acceptance.getId()) - .studentGcn(acceptance.getStudentGcn()) + .acceptanceId(acceptance.getAcceptanceId()) + .studentGcn( + Student.processGcn( + acceptance.getGrade(), + acceptance.getClassRoom(), + acceptance.getNumber() + )) .studentName(acceptance.getStudentName()) .contractDate(acceptance.getContractDate()) .build() - ) - .toList(); + ).toList(); } } diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/application/model/Application.java b/jobis-application/src/main/java/team/retum/jobis/domain/application/model/Application.java index 6b162bd63..2e7f49292 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/application/model/Application.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/application/model/Application.java @@ -44,10 +44,6 @@ public Application toFieldTrain(LocalDate startDate, LocalDate endDate) { } public Application rejectApplication(String reason) { - if (applicationStatus != ApplicationStatus.REQUESTED) { - throw ApplicationStatusCannotChangeException.EXCEPTION; - } - return this.toBuilder() .applicationStatus(ApplicationStatus.REJECTED) .rejectionReason(reason) diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/application/model/ApplicationStatus.java b/jobis-application/src/main/java/team/retum/jobis/domain/application/model/ApplicationStatus.java index 5670639a5..930402f77 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/application/model/ApplicationStatus.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/application/model/ApplicationStatus.java @@ -8,7 +8,8 @@ public enum ApplicationStatus { APPROVED, // 승인 FAILED, // 탈락 PASS, // 통과 - FIELD_TRAIN, // 현장실습, + FIELD_TRAIN, // 현장실습 + ACCEPTANCE, // 근로계약 REJECTED; // 거부 public static final List DUPLICATE_CHECK = List.of(APPROVED, PASS, FIELD_TRAIN); diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/application/spi/vo/ApplicationDetailVO.java b/jobis-application/src/main/java/team/retum/jobis/domain/application/spi/vo/ApplicationDetailVO.java index 6a2bfc33a..f8012e064 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/application/spi/vo/ApplicationDetailVO.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/application/spi/vo/ApplicationDetailVO.java @@ -10,13 +10,7 @@ public class ApplicationDetailVO { private final Long id; - private final String studentName; - - private final int studentGrade; - - private final int studentClassNumber; - - private final int studentNumber; + private final Long studentId; private final Long companyId; diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/application/usecase/CreateApplicationUseCase.java b/jobis-application/src/main/java/team/retum/jobis/domain/application/usecase/CreateApplicationUseCase.java index 79208238c..f4b460a49 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/application/usecase/CreateApplicationUseCase.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/application/usecase/CreateApplicationUseCase.java @@ -28,11 +28,9 @@ public class CreateApplicationUseCase { public void execute(CreateApplicationRequest request, Long recruitmentId) { Student student = securityPort.getCurrentStudent(); - student.checkIs3rdGrade(); - Recruitment recruitment = queryRecruitmentPort.queryRecruitmentById(recruitmentId) .orElseThrow(() -> RecruitmentNotFoundException.EXCEPTION); - recruitment.checkIsApplicable(); + recruitment.checkIsApplicable(student.getGrade()); if (queryApplicationPort.existsApplicationByStudentIdAndApplicationStatusIn( student.getId(), ApplicationStatus.DUPLICATE_CHECK diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/code/model/RecruitAreaCode.java b/jobis-application/src/main/java/team/retum/jobis/domain/code/model/RecruitAreaCode.java index 45a8fb55b..ab97ce608 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/code/model/RecruitAreaCode.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/code/model/RecruitAreaCode.java @@ -11,6 +11,8 @@ public class RecruitAreaCode { private final Long recruitAreaId; - private final Long codeId; + private final Long code; + + private final CodeType type; } diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/code/service/GetKeywordsService.java b/jobis-application/src/main/java/team/retum/jobis/domain/code/service/GetKeywordsService.java new file mode 100644 index 000000000..6590431de --- /dev/null +++ b/jobis-application/src/main/java/team/retum/jobis/domain/code/service/GetKeywordsService.java @@ -0,0 +1,38 @@ +package team.retum.jobis.domain.code.service; + +import lombok.RequiredArgsConstructor; +import team.retum.jobis.common.annotation.Service; +import team.retum.jobis.common.util.StringUtil; +import team.retum.jobis.domain.code.exception.CodeNotFoundException; +import team.retum.jobis.domain.code.model.Code; +import team.retum.jobis.domain.code.spi.QueryCodePort; + +import java.util.List; + +@RequiredArgsConstructor +@Service +public class GetKeywordsService { + + private final QueryCodePort queryCodePort; + + public String getKeywordsAsJoinedString(String jobCodes) { + return StringUtil.joinStringList( + queryCodePort.queryCodesByIdIn( + StringUtil.divideString(jobCodes, ",").stream().map(Long::parseLong).toList() + ).stream().map(Code::getKeyword).toList(), + "/" + ); + } + + public List getKeywordsAsList(List jobCodes) { + return queryCodePort.queryCodesByIdIn( + jobCodes.stream().map(Long::parseLong).toList() + ).stream().map(Code::getKeyword).toList(); + } + + public String getCodeKeyword(Long code) { + return queryCodePort.queryCodeById(code) + .orElseThrow(() -> CodeNotFoundException.EXCEPTION) + .getKeyword(); + } +} diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/dto/RecruitmentFilter.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/dto/RecruitmentFilter.java index 4de437d55..d9dc548ea 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/dto/RecruitmentFilter.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/dto/RecruitmentFilter.java @@ -27,8 +27,7 @@ public class RecruitmentFilter { private final Long studentId; - private final Long jobCode; - + private final Boolean winterIntern; @Builder.Default private int limit = 11; diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/dto/request/ApplyRecruitmentRequest.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/dto/request/ApplyRecruitmentRequest.java index e98f35128..de6d56541 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/dto/request/ApplyRecruitmentRequest.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/dto/request/ApplyRecruitmentRequest.java @@ -40,5 +40,7 @@ public class ApplyRecruitmentRequest { private LocalDate endDate; + private boolean winterIntern; + private String etc; } diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/dto/response/RecruitAreaResponse.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/dto/response/RecruitAreaResponse.java index 22950688f..29b10e968 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/dto/response/RecruitAreaResponse.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/dto/response/RecruitAreaResponse.java @@ -1,12 +1,14 @@ package team.retum.jobis.domain.recruitment.dto.response; import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Getter; import java.util.List; @Getter @AllArgsConstructor +@Builder public class RecruitAreaResponse { private final Long id; diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/model/RecruitArea.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/model/RecruitArea.java index f9eb2144b..7d29a3f54 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/model/RecruitArea.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/model/RecruitArea.java @@ -4,8 +4,6 @@ import lombok.Getter; import team.retum.jobis.common.annotation.Aggregate; -import java.util.List; - @Getter @Builder @Aggregate @@ -17,8 +15,6 @@ public class RecruitArea { private final String majorTask; - private final List jobCodes; - private final String preferentialTreatment; private final Long recruitmentId; diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/model/Recruitment.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/model/Recruitment.java index 17ef7fd3b..9c50425e1 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/model/Recruitment.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/model/Recruitment.java @@ -3,6 +3,7 @@ import lombok.Builder; import lombok.Getter; import team.retum.jobis.common.annotation.Aggregate; +import team.retum.jobis.domain.application.exception.InvalidGradeException; import team.retum.jobis.domain.recruitment.exception.CompanyMismatchException; import team.retum.jobis.domain.recruitment.exception.InvalidRecruitmentStatusException; @@ -49,6 +50,8 @@ public class Recruitment { private final boolean personalContract; + private final boolean winterIntern; + private final Long companyId; public Recruitment update(Integer trainPay, String pay, LocalTime startTime, LocalTime endTime, String submitDocument, @@ -84,9 +87,13 @@ public void checkCompany(Long companyId) { } } - public void checkIsApplicable() { + public void checkIsApplicable(Integer studentGrade) { if (this.status != RecruitStatus.RECRUITING) { throw InvalidRecruitmentStatusException.EXCEPTION; } + + if (studentGrade == 1 || (!this.winterIntern && studentGrade == 2)) { + throw InvalidGradeException.EXCEPTION; + } } } diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/service/GetRecruitmentDetailService.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/service/GetRecruitmentDetailService.java new file mode 100644 index 000000000..37f02a4b5 --- /dev/null +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/service/GetRecruitmentDetailService.java @@ -0,0 +1,36 @@ +package team.retum.jobis.domain.recruitment.service; + +import lombok.RequiredArgsConstructor; +import team.retum.jobis.common.annotation.Service; +import team.retum.jobis.domain.code.service.GetKeywordsService; +import team.retum.jobis.domain.recruitment.dto.response.QueryRecruitmentDetailResponse; +import team.retum.jobis.domain.recruitment.dto.response.RecruitAreaResponse; +import team.retum.jobis.domain.recruitment.exception.RecruitmentNotFoundException; +import team.retum.jobis.domain.recruitment.model.Recruitment; +import team.retum.jobis.domain.recruitment.spi.QueryRecruitmentPort; +import team.retum.jobis.domain.recruitment.spi.vo.RecruitmentDetailVO; + +import java.util.List; + +@RequiredArgsConstructor +@Service +public class GetRecruitmentDetailService { + + private final QueryRecruitmentPort queryRecruitmentPort; + + public QueryRecruitmentDetailResponse execute(Recruitment recruitment) { + RecruitmentDetailVO recruitmentDetail = queryRecruitmentPort.queryRecruitmentDetailById(recruitment.getId()); + List recruitAreaResponses = queryRecruitmentPort.queryRecruitAreasByRecruitmentId(recruitment.getId()) + .stream().map(recruitAreaResponse -> RecruitAreaResponse.builder() + .id(recruitAreaResponse.getId()) + .job(recruitAreaResponse.getJob()) + .tech(recruitAreaResponse.getTech()) + .hiring(recruitAreaResponse.getHiring()) + .majorTask(recruitAreaResponse.getMajorTask()) + .preferentialTreatment(recruitAreaResponse.getPreferentialTreatment()) + .build() + ).toList(); + + return QueryRecruitmentDetailResponse.of(recruitmentDetail, recruitAreaResponses); + } +} diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/service/SaveRecruitmentAreaService.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/service/SaveRecruitmentAreaService.java index 10bedd706..5b8c10eba 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/service/SaveRecruitmentAreaService.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/service/SaveRecruitmentAreaService.java @@ -2,12 +2,13 @@ import lombok.RequiredArgsConstructor; import team.retum.jobis.common.annotation.Service; +import team.retum.jobis.domain.code.model.CodeType; import team.retum.jobis.domain.code.model.RecruitAreaCode; -import team.retum.jobis.domain.code.spi.QueryCodePort; import team.retum.jobis.domain.recruitment.dto.request.CreateRecruitAreaRequest; import team.retum.jobis.domain.recruitment.model.RecruitArea; import team.retum.jobis.domain.recruitment.spi.CommandRecruitmentPort; +import java.util.ArrayList; import java.util.List; @RequiredArgsConstructor @@ -17,25 +18,34 @@ public class SaveRecruitmentAreaService { private final CommandRecruitmentPort commandRecruitmentPort; public void execute(CreateRecruitAreaRequest request, Long recruitmentId) { - List jobCodes = request.getJobCodes().stream().map(Object::toString).toList(); - RecruitArea savedRecruitArea = commandRecruitmentPort.saveRecruitmentArea( RecruitArea.builder() .recruitmentId(recruitmentId) .hiredCount(request.getHiring()) - .jobCodes(jobCodes) .majorTask(request.getMajorTask()) .preferentialTreatment(request.getPreferentialTreatment()) .build() ); - List recruitAreaCodes = request.getTechCodes().stream() + List recruitAreaCodes = new ArrayList<>(); + recruitAreaCodes.addAll(request.getTechCodes().stream() .map( code -> RecruitAreaCode.builder() .recruitAreaId(savedRecruitArea.getId()) - .codeId(code) + .code(code) + .type(CodeType.TECH) .build() - ).toList(); + ).toList() + ); + recruitAreaCodes.addAll(request.getJobCodes().stream() + .map( + code -> RecruitAreaCode.builder() + .recruitAreaId(savedRecruitArea.getId()) + .code(code) + .type(CodeType.JOB) + .build() + ).toList() + ); commandRecruitmentPort.saveAllRecruitmentAreaCodes(recruitAreaCodes); } diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/spi/vo/RecruitmentVO.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/spi/vo/RecruitmentVO.java index 6bc894e0c..ddf87d92d 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/spi/vo/RecruitmentVO.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/spi/vo/RecruitmentVO.java @@ -24,7 +24,7 @@ public class RecruitmentVO { private final Integer totalHiring; private final Long requestedApplicationCount; private final Long approvedApplicationCount; - private final Long isBookmarked; + private final Boolean isBookmarked; private final Long companyId; } diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/ApplyRecruitmentUseCase.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/ApplyRecruitmentUseCase.java index e44f05319..c47fd9c19 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/ApplyRecruitmentUseCase.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/ApplyRecruitmentUseCase.java @@ -45,6 +45,7 @@ public void execute(ApplyRecruitmentRequest request) { .benefits(request.getBenefits()) .etc(request.getEtc()) .hiringProgress(request.getHiringProgress()) + .winterIntern(request.isWinterIntern()) .build() ); diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/QueryMyRecruitmentUseCase.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/QueryMyRecruitmentUseCase.java index 04a426b14..b770811d2 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/QueryMyRecruitmentUseCase.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/QueryMyRecruitmentUseCase.java @@ -4,31 +4,24 @@ import team.retum.jobis.common.annotation.ReadOnlyUseCase; import team.retum.jobis.common.spi.SecurityPort; import team.retum.jobis.domain.recruitment.dto.response.QueryRecruitmentDetailResponse; -import team.retum.jobis.domain.recruitment.dto.response.RecruitAreaResponse; import team.retum.jobis.domain.recruitment.exception.RecruitmentNotFoundException; import team.retum.jobis.domain.recruitment.model.Recruitment; +import team.retum.jobis.domain.recruitment.service.GetRecruitmentDetailService; import team.retum.jobis.domain.recruitment.spi.QueryRecruitmentPort; -import team.retum.jobis.domain.recruitment.spi.vo.RecruitmentDetailVO; - -import java.util.List; @RequiredArgsConstructor @ReadOnlyUseCase public class QueryMyRecruitmentUseCase { private final SecurityPort securityPort; + private final GetRecruitmentDetailService getRecruitmentDetailService; private final QueryRecruitmentPort queryRecruitmentPort; public QueryRecruitmentDetailResponse execute() { Long currentUserId = securityPort.getCurrentUserId(); - Recruitment recruitment = queryRecruitmentPort.queryRecentRecruitmentByCompanyId(currentUserId) .orElseThrow(() -> RecruitmentNotFoundException.EXCEPTION); - - RecruitmentDetailVO recruitmentDetail = queryRecruitmentPort.queryRecruitmentDetailById(recruitment.getId()); - List recruitAreaResponses = - queryRecruitmentPort.queryRecruitAreasByRecruitmentId(recruitment.getId()); - return QueryRecruitmentDetailResponse.of(recruitmentDetail, recruitAreaResponses); + return getRecruitmentDetailService.execute(recruitment); } } diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/QueryRecruitmentDetailUseCase.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/QueryRecruitmentDetailUseCase.java index 4049cf776..43e3fa465 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/QueryRecruitmentDetailUseCase.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/QueryRecruitmentDetailUseCase.java @@ -2,44 +2,23 @@ import lombok.RequiredArgsConstructor; import team.retum.jobis.common.annotation.ReadOnlyUseCase; -import team.retum.jobis.domain.code.model.Code; -import team.retum.jobis.domain.code.spi.QueryCodePort; import team.retum.jobis.domain.recruitment.dto.response.QueryRecruitmentDetailResponse; -import team.retum.jobis.domain.recruitment.dto.response.RecruitAreaResponse; import team.retum.jobis.domain.recruitment.exception.RecruitmentNotFoundException; import team.retum.jobis.domain.recruitment.model.Recruitment; +import team.retum.jobis.domain.recruitment.service.GetRecruitmentDetailService; import team.retum.jobis.domain.recruitment.spi.QueryRecruitmentPort; -import team.retum.jobis.domain.recruitment.spi.vo.RecruitmentDetailVO; - -import java.util.List; @RequiredArgsConstructor @ReadOnlyUseCase public class QueryRecruitmentDetailUseCase { + private final GetRecruitmentDetailService getRecruitmentDetailService; private final QueryRecruitmentPort queryRecruitmentPort; - private final QueryCodePort queryCodePort; public QueryRecruitmentDetailResponse execute(Long recruitId) { Recruitment recruitment = queryRecruitmentPort.queryRecruitmentById(recruitId) .orElseThrow(() -> RecruitmentNotFoundException.EXCEPTION); - RecruitmentDetailVO recruitmentDetail = queryRecruitmentPort.queryRecruitmentDetailById(recruitment.getId()); - List recruitAreaResponses = - queryRecruitmentPort.queryRecruitAreasByRecruitmentId(recruitment.getId()).stream() - .map(area -> - new RecruitAreaResponse( - area.getId(), - queryCodePort.queryCodesByIdIn(area.getJob().stream().map(Long::parseLong).toList()).stream() - .map(Code::getKeyword) - .toList(), - area.getTech(), - area.getHiring(), - area.getMajorTask(), - area.getPreferentialTreatment() - ) - ).toList(); - - return QueryRecruitmentDetailResponse.of(recruitmentDetail, recruitAreaResponses); + return getRecruitmentDetailService.execute(recruitment); } } diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/StudentQueryRecruitmentsUseCase.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/StudentQueryRecruitmentsUseCase.java index 9ea09074b..9b56ebac8 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/StudentQueryRecruitmentsUseCase.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/StudentQueryRecruitmentsUseCase.java @@ -5,9 +5,6 @@ import team.retum.jobis.common.dto.response.TotalPageCountResponse; import team.retum.jobis.common.spi.SecurityPort; import team.retum.jobis.common.util.NumberUtil; -import team.retum.jobis.common.util.StringUtil; -import team.retum.jobis.domain.code.model.Code; -import team.retum.jobis.domain.code.spi.QueryCodePort; import team.retum.jobis.domain.recruitment.dto.RecruitmentFilter; import team.retum.jobis.domain.recruitment.dto.response.StudentQueryRecruitmentsResponse; import team.retum.jobis.domain.recruitment.dto.response.StudentQueryRecruitmentsResponse.StudentRecruitmentResponse; @@ -23,13 +20,12 @@ public class StudentQueryRecruitmentsUseCase { private final QueryRecruitmentPort queryRecruitmentPort; private final SecurityPort securityPort; - private final QueryCodePort queryCodePort; public StudentQueryRecruitmentsResponse execute( String name, Long page, - Long jobCode, - List codeIds + List codeIds, + Boolean winterIntern ) { Long currentStudentId = securityPort.getCurrentUserId(); RecruitmentFilter recruitmentFilter = RecruitmentFilter.builder() @@ -40,7 +36,7 @@ public StudentQueryRecruitmentsResponse execute( .limit(12) .codes(codeIds) .studentId(currentStudentId) - .jobCode(jobCode) + .winterIntern(winterIntern) .build(); List recruitments = @@ -50,18 +46,18 @@ public StudentQueryRecruitmentsResponse execute( .recruitId(recruitment.getRecruitmentId()) .companyName(recruitment.getCompanyName()) .trainPay(recruitment.getTrainPay()) - .jobCodeList(getJobKeywords(recruitment.getJobCodes())) + .jobCodeList(recruitment.getJobCodes()) .military(recruitment.isMilitarySupport()) .companyProfileUrl(recruitment.getCompanyLogoUrl()) .totalHiring(recruitment.getTotalHiring()) - .isBookmarked(recruitment.getIsBookmarked() != 0) + .isBookmarked(recruitment.getIsBookmarked()) .build() ).toList(); return new StudentQueryRecruitmentsResponse(recruitments); } - public TotalPageCountResponse getTotalPageCount(String name, Long jobCode, List codeIds) { + public TotalPageCountResponse getTotalPageCount(String name, List codeIds, Boolean winterIntern) { Long currentStudentId = securityPort.getCurrentUserId(); RecruitmentFilter filter = RecruitmentFilter.builder() @@ -71,7 +67,7 @@ public TotalPageCountResponse getTotalPageCount(String name, Long jobCode, List< .limit(12) .codes(codeIds) .studentId(currentStudentId) - .jobCode(jobCode) + .winterIntern(winterIntern) .build(); int totalPageCount = NumberUtil.getTotalPageCount( @@ -80,13 +76,4 @@ public TotalPageCountResponse getTotalPageCount(String name, Long jobCode, List< return new TotalPageCountResponse(totalPageCount); } - - private String getJobKeywords(String jobCodes) { - return StringUtil.joinStringList( - queryCodePort.queryCodesByIdIn( - StringUtil.divideString(jobCodes, ",").stream().map(Long::parseLong).toList() - ).stream().map(Code::getKeyword).toList(), - "/" - ); - } } diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/TeacherQueryRecruitmentsUseCase.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/TeacherQueryRecruitmentsUseCase.java index 74c639abf..0a4b1bd8a 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/TeacherQueryRecruitmentsUseCase.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/TeacherQueryRecruitmentsUseCase.java @@ -4,9 +4,6 @@ import team.retum.jobis.common.annotation.ReadOnlyUseCase; import team.retum.jobis.common.dto.response.TotalPageCountResponse; import team.retum.jobis.common.util.NumberUtil; -import team.retum.jobis.common.util.StringUtil; -import team.retum.jobis.domain.code.model.Code; -import team.retum.jobis.domain.code.spi.QueryCodePort; import team.retum.jobis.domain.recruitment.dto.RecruitmentFilter; import team.retum.jobis.domain.recruitment.dto.response.TeacherQueryRecruitmentsResponse; import team.retum.jobis.domain.recruitment.dto.response.TeacherQueryRecruitmentsResponse.TeacherRecruitmentResponse; @@ -21,10 +18,9 @@ public class TeacherQueryRecruitmentsUseCase { private final QueryRecruitmentPort queryRecruitmentPort; - private final QueryCodePort queryCodePort; public TeacherQueryRecruitmentsResponse execute(String companyName, LocalDate start, LocalDate end, - Integer year, RecruitStatus status, Long page) { + Integer year, RecruitStatus status, Long page, Boolean winterIntern) { RecruitmentFilter filter = RecruitmentFilter.builder() .companyName(companyName) .status(status) @@ -33,6 +29,7 @@ public TeacherQueryRecruitmentsResponse execute(String companyName, LocalDate st .codes(List.of()) .year(year) .page(page) + .winterIntern(winterIntern) .build(); List recruitments = @@ -49,7 +46,7 @@ public TeacherQueryRecruitmentsResponse execute(String companyName, LocalDate st .applicationRequestedCount(recruitment.getRequestedApplicationCount()) .applicationApprovedCount(recruitment.getApprovedApplicationCount()) .recruitmentCount(recruitment.getTotalHiring()) - .recruitmentJob(getJobKeywords(recruitment.getJobCodes())) + .recruitmentJob(recruitment.getJobCodes()) .companyId(recruitment.getCompanyId()) .build() ).toList(); @@ -58,7 +55,7 @@ public TeacherQueryRecruitmentsResponse execute(String companyName, LocalDate st } public TotalPageCountResponse getTotalPageCount(String companyName, LocalDate start, LocalDate end, - Integer year, RecruitStatus status) { + Integer year, RecruitStatus status, Boolean winterIntern) { RecruitmentFilter filter = RecruitmentFilter.builder() .companyName(companyName) .status(status) @@ -66,6 +63,7 @@ public TotalPageCountResponse getTotalPageCount(String companyName, LocalDate st .endDate(end) .codes(List.of()) .year(year) + .winterIntern(winterIntern) .build(); int totalPageCount = NumberUtil.getTotalPageCount( @@ -74,13 +72,4 @@ public TotalPageCountResponse getTotalPageCount(String companyName, LocalDate st return new TotalPageCountResponse(totalPageCount); } - - private String getJobKeywords(String jobCodes) { - return StringUtil.joinStringList( - queryCodePort.queryCodesByIdIn( - StringUtil.divideString(jobCodes, ",").stream().map(Long::parseLong).toList() - ).stream().map(Code::getKeyword).toList(), - "/" - ); - } } diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/student/model/Student.java b/jobis-application/src/main/java/team/retum/jobis/domain/student/model/Student.java index 0e990f46c..8819e8490 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/student/model/Student.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/student/model/Student.java @@ -3,11 +3,12 @@ import lombok.Builder; import lombok.Getter; import team.retum.jobis.common.annotation.Aggregate; -import team.retum.jobis.domain.application.exception.InvalidGradeException; import team.retum.jobis.domain.student.exception.ClassRoomNotFoundException; +import java.time.Period; +import java.time.Year; + @Getter -@Builder(toBuilder = true) @Aggregate public class Student { @@ -27,6 +28,22 @@ public class Student { private final String profileImageUrl; + private final Integer entranceYear; + + @Builder(toBuilder = true) + public Student(Long id, String name, Integer grade, Integer classRoom, Integer number, Gender gender, + Department department, String profileImageUrl, Integer entranceYear) { + this.id = id; + this.name = name; + this.grade = grade; + this.classRoom = classRoom; + this.number = number; + this.gender = gender; + this.department = department; + this.profileImageUrl = profileImageUrl; + this.entranceYear = entranceYear == null ? getEntranceYear(grade) : entranceYear; + } + public static String processGcn(int grade, int classNumber, int number) { return String.valueOf(grade) + classNumber + @@ -46,15 +63,18 @@ public static Department getDepartment(Integer grade, Integer classRoom) { }; } - public void checkIs3rdGrade() { - if (!this.grade.equals(3)) { - throw InvalidGradeException.EXCEPTION; - } - } - public Student changeStudentProfile(String profileImageUrl) { return this.toBuilder() .profileImageUrl(profileImageUrl) .build(); } + + private Integer getEntranceYear(Integer grade) { + int year = Year.now().getValue(); + return switch (grade) { + case 2 -> year - 1; + case 3 -> year - 2; + default -> year; + }; + } } diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/acceptance/persistence/AcceptancePersistenceAdapter.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/acceptance/persistence/AcceptancePersistenceAdapter.java index 5109868a2..bf3bc2dc5 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/acceptance/persistence/AcceptancePersistenceAdapter.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/acceptance/persistence/AcceptancePersistenceAdapter.java @@ -6,12 +6,15 @@ import team.retum.jobis.domain.acceptance.model.Acceptance; import team.retum.jobis.domain.acceptance.persistence.mapper.AcceptanceMapper; import team.retum.jobis.domain.acceptance.persistence.repository.AcceptanceJpaRepository; +import team.retum.jobis.domain.acceptance.persistence.repository.vo.QQueryAcceptanceVO; import team.retum.jobis.domain.acceptance.spi.AcceptancePort; +import team.retum.jobis.domain.acceptance.spi.vo.AcceptanceVO; import java.time.LocalDate; import java.util.List; import static team.retum.jobis.domain.acceptance.persistence.entity.QAcceptanceEntity.acceptanceEntity; +import static team.retum.jobis.domain.student.persistence.entity.QStudentEntity.studentEntity; @RequiredArgsConstructor @Repository @@ -19,18 +22,34 @@ public class AcceptancePersistenceAdapter implements AcceptancePort { private final AcceptanceJpaRepository acceptanceJpaRepository; private final AcceptanceMapper acceptanceMapper; - private final JPAQueryFactory jpaQueryFactory; + private final JPAQueryFactory queryFactory; @Override - public List queryAcceptancesByCompanyIdAndYear(Long companyId, Integer year) { - return acceptanceJpaRepository.findByCompanyIdAndYear(companyId, year).stream() - .map(acceptanceMapper::toDomain) + public List queryAcceptancesByCompanyIdAndYear(Long companyId, Integer year) { + return queryFactory + .select( + new QQueryAcceptanceVO( + acceptanceEntity.id, + studentEntity.grade, + studentEntity.classRoom, + studentEntity.number, + studentEntity.name, + acceptanceEntity.contractDate + ) + ) + .from(acceptanceEntity) + .join(acceptanceEntity.student, studentEntity) + .where( + acceptanceEntity.company.id.eq(companyId), + acceptanceEntity.year.eq(year) + ).fetch().stream() + .map(AcceptanceVO.class::cast) .toList(); } @Override public void updateContractDate(LocalDate contractDate, List acceptanceIds) { - jpaQueryFactory + queryFactory .update(acceptanceEntity) .set(acceptanceEntity.contractDate, contractDate) .where(acceptanceEntity.id.in(acceptanceIds)) diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/acceptance/persistence/entity/AcceptanceEntity.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/acceptance/persistence/entity/AcceptanceEntity.java index 093eb3eef..306a1f398 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/acceptance/persistence/entity/AcceptanceEntity.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/acceptance/persistence/entity/AcceptanceEntity.java @@ -5,6 +5,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; import team.retum.jobis.domain.company.persistence.entity.CompanyEntity; +import team.retum.jobis.domain.student.persistence.entity.StudentEntity; import team.retum.jobis.global.converter.StringListConverter; import javax.persistence.Column; @@ -60,9 +61,13 @@ public class AcceptanceEntity { @JoinColumn(name = "company_id", nullable = false) private CompanyEntity company; + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "student_id", nullable = false) + private StudentEntity student; + @Builder public AcceptanceEntity(Long id, Integer year, String studentName, String businessArea, List tech, - String studentGcn, LocalDate contractDate, CompanyEntity companyEntity) { + String studentGcn, LocalDate contractDate, CompanyEntity companyEntity, StudentEntity student) { this.id = id; this.year = year; this.studentName = studentName; @@ -71,5 +76,6 @@ public AcceptanceEntity(Long id, Integer year, String studentName, String busine this.studentGcn = studentGcn; this.contractDate = contractDate; this.company = companyEntity; + this.student = student; } } diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/acceptance/persistence/mapper/AcceptanceMapper.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/acceptance/persistence/mapper/AcceptanceMapper.java index 879cb4dd1..b71bfad60 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/acceptance/persistence/mapper/AcceptanceMapper.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/acceptance/persistence/mapper/AcceptanceMapper.java @@ -7,16 +7,22 @@ import team.retum.jobis.domain.company.exception.CompanyNotFoundException; import team.retum.jobis.domain.company.persistence.entity.CompanyEntity; import team.retum.jobis.domain.company.persistence.repository.CompanyJpaRepository; +import team.retum.jobis.domain.student.exception.StudentNotFoundException; +import team.retum.jobis.domain.student.persistence.entity.StudentEntity; +import team.retum.jobis.domain.student.persistence.repository.StudentJpaRepository; @RequiredArgsConstructor @Component public class AcceptanceMapper { private final CompanyJpaRepository companyJpaRepository; + private final StudentJpaRepository studentJpaRepository; public AcceptanceEntity toEntity(Acceptance domain) { CompanyEntity company = companyJpaRepository.findById(domain.getCompanyId()) .orElseThrow(() -> CompanyNotFoundException.EXCEPTION); + StudentEntity student = studentJpaRepository.findById(domain.getStudentId()) + .orElseThrow(() -> StudentNotFoundException.EXCEPTION); return AcceptanceEntity.builder() .id(domain.getId()) @@ -24,9 +30,8 @@ public AcceptanceEntity toEntity(Acceptance domain) { .contractDate(domain.getContractDate()) .businessArea(domain.getBusinessArea()) .year(domain.getYear()) - .studentName(domain.getStudentName()) - .studentGcn(domain.getStudentGcn()) .tech(domain.getTech()) + .student(student) .build(); } @@ -35,10 +40,9 @@ public Acceptance toDomain(AcceptanceEntity entity) { .contractDate(entity.getContractDate()) .businessArea(entity.getBusinessArea()) .tech(entity.getTech()) - .studentName(entity.getStudentName()) - .studentGcn(entity.getStudentGcn()) .id(entity.getId()) .companyId(entity.getCompany().getId()) + .studentId(entity.getStudent().getId()) .build(); } } diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/acceptance/persistence/repository/vo/QueryAcceptanceVO.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/acceptance/persistence/repository/vo/QueryAcceptanceVO.java new file mode 100644 index 000000000..9d3a6b00a --- /dev/null +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/acceptance/persistence/repository/vo/QueryAcceptanceVO.java @@ -0,0 +1,16 @@ +package team.retum.jobis.domain.acceptance.persistence.repository.vo; + +import com.querydsl.core.annotations.QueryProjection; +import lombok.Getter; +import team.retum.jobis.domain.acceptance.spi.vo.AcceptanceVO; + +import java.time.LocalDate; + +@Getter +public class QueryAcceptanceVO extends AcceptanceVO { + + @QueryProjection + public QueryAcceptanceVO(Long acceptanceId, Integer grade, Integer classRoom, Integer number, String studentName, LocalDate contractDate) { + super(acceptanceId, grade, classRoom, number, studentName, contractDate); + } +} diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/acceptance/persistence/repository/vo/QueryApplicationDetailVO.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/acceptance/persistence/repository/vo/QueryApplicationDetailVO.java deleted file mode 100644 index 6335c9a1e..000000000 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/acceptance/persistence/repository/vo/QueryApplicationDetailVO.java +++ /dev/null @@ -1,16 +0,0 @@ -package team.retum.jobis.domain.acceptance.persistence.repository.vo; - -import com.querydsl.core.annotations.QueryProjection; -import lombok.Getter; -import team.retum.jobis.domain.application.model.ApplicationStatus; -import team.retum.jobis.domain.application.spi.vo.ApplicationDetailVO; - -@Getter -public class QueryApplicationDetailVO extends ApplicationDetailVO { - - @QueryProjection - public QueryApplicationDetailVO(Long id, String studentName, int studentGrade, int studentClassNumber, - int studentNumber, Long companyId, String businessArea, ApplicationStatus status) { - super(id, studentName, studentGrade, studentClassNumber, studentNumber, companyId, businessArea, status); - } -} diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/application/persistence/ApplicationPersistenceAdapter.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/application/persistence/ApplicationPersistenceAdapter.java index e75e49318..67393984a 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/application/persistence/ApplicationPersistenceAdapter.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/application/persistence/ApplicationPersistenceAdapter.java @@ -4,12 +4,12 @@ import com.querydsl.jpa.impl.JPAQueryFactory; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Repository; -import team.retum.jobis.domain.acceptance.persistence.repository.vo.QQueryApplicationDetailVO; import team.retum.jobis.domain.application.model.Application; import team.retum.jobis.domain.application.model.ApplicationAttachment; import team.retum.jobis.domain.application.model.ApplicationStatus; import team.retum.jobis.domain.application.persistence.mapper.ApplicationMapper; import team.retum.jobis.domain.application.persistence.repository.ApplicationJpaRepository; +import team.retum.jobis.domain.application.persistence.repository.vo.QQueryApplicationDetailVO; import team.retum.jobis.domain.application.persistence.repository.vo.QQueryApplicationVO; import team.retum.jobis.domain.application.persistence.repository.vo.QQueryFieldTraineesVO; import team.retum.jobis.domain.application.persistence.repository.vo.QQueryPassedApplicationStudentsVO; @@ -175,11 +175,14 @@ public QueryTotalApplicationCountVO queryTotalApplicationCount() { ) .from(applicationEntity) .leftJoin(applicationEntity.student, approvedStudent) - .on(approvedStudent.applications.any().applicationStatus.eq(APPROVED)) + .on( + applicationEntity.applicationStatus.eq(APPROVED), + applicationEntity.student.id.eq(approvedStudent.id) + ) .leftJoin(applicationEntity.student, passedStudent) .on( - passedStudent.applications.any().applicationStatus.eq(PASS) - .or(passedStudent.applications.any().applicationStatus.eq(FIELD_TRAIN)) + applicationEntity.applicationStatus.in(PASS, FIELD_TRAIN), + applicationEntity.student.id.eq(passedStudent.id) ) .rightJoin(applicationEntity.student, studentEntity) .on(studentEntity.grade.eq(3)) @@ -211,10 +214,7 @@ public List queryApplicationDetailsByIds(List applica .select( new QQueryApplicationDetailVO( applicationEntity.id, - studentEntity.name, - studentEntity.grade, - studentEntity.classRoom, - studentEntity.number, + studentEntity.id, companyEntity.id, companyEntity.businessArea, applicationEntity.applicationStatus diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/application/persistence/repository/vo/QueryApplicationDetailVO.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/application/persistence/repository/vo/QueryApplicationDetailVO.java new file mode 100644 index 000000000..cfca86c6d --- /dev/null +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/application/persistence/repository/vo/QueryApplicationDetailVO.java @@ -0,0 +1,15 @@ +package team.retum.jobis.domain.application.persistence.repository.vo; + +import com.querydsl.core.annotations.QueryProjection; +import lombok.Getter; +import team.retum.jobis.domain.application.model.ApplicationStatus; +import team.retum.jobis.domain.application.spi.vo.ApplicationDetailVO; + +@Getter +public class QueryApplicationDetailVO extends ApplicationDetailVO { + + @QueryProjection + public QueryApplicationDetailVO(Long id, Long studentId, Long companyId, String businessArea, ApplicationStatus status) { + super(id, studentId, companyId, businessArea, status); + } +} diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/code/persistence/CodePersistenceAdapter.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/code/persistence/CodePersistenceAdapter.java index da13ab748..b220fdee5 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/code/persistence/CodePersistenceAdapter.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/code/persistence/CodePersistenceAdapter.java @@ -28,7 +28,7 @@ public List queryCodesByKeywordAndType(String keyword, CodeType codeType, return jpaQueryFactory .selectFrom(codeEntity) .where( - codeEntity.codeType.eq(codeType), + codeEntity.type.eq(codeType), containsKeyword(keyword), eqParentCode(parentCode) ).fetch().stream() @@ -38,13 +38,13 @@ public List queryCodesByKeywordAndType(String keyword, CodeType codeType, @Override public Optional queryCodeById(Long codeId) { - return codeJpaRepository.findById(codeId) + return codeJpaRepository.findById(codeId) .map(codeMapper::toDomain); } @Override public List queryCodesByIdIn(List codes) { - return codeJpaRepository.findCodesByIdIn(codes).stream() + return codeJpaRepository.findCodesByCodeIn(codes).stream() .map(codeMapper::toDomain) .toList(); } @@ -56,6 +56,6 @@ private BooleanExpression containsKeyword(String keyword) { } private BooleanExpression eqParentCode(Long parentCode) { - return parentCode == null ? null : codeEntity.parentCode.id.eq(parentCode); + return parentCode == null ? null : codeEntity.parentCode.code.eq(parentCode); } } \ No newline at end of file diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/code/persistence/entity/CodeEntity.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/code/persistence/entity/CodeEntity.java index 832c48156..f7f248812 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/code/persistence/entity/CodeEntity.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/code/persistence/entity/CodeEntity.java @@ -28,12 +28,12 @@ public class CodeEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - private Long id; + private Long code; @NotNull @Enumerated(EnumType.STRING) @Column(columnDefinition = "VARCHAR(13)") - private CodeType codeType; + private CodeType type; @Enumerated(EnumType.STRING) @Column(columnDefinition = "VARCHAR(8)") @@ -48,9 +48,9 @@ public class CodeEntity { private CodeEntity parentCode; @Builder - public CodeEntity(Long id, CodeType codeType, JobType jobType, String keyword, CodeEntity parentCodeEntity) { - this.id = id; - this.codeType = codeType; + public CodeEntity(Long code, CodeType codeType, JobType jobType, String keyword, CodeEntity parentCodeEntity) { + this.code = code; + this.type = codeType; this.jobType = jobType; this.keyword = keyword; this.parentCode = parentCodeEntity; diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/code/persistence/entity/RecruitAreaCodeEntity.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/code/persistence/entity/RecruitAreaCodeEntity.java index 7afaa58e2..4884d2651 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/code/persistence/entity/RecruitAreaCodeEntity.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/code/persistence/entity/RecruitAreaCodeEntity.java @@ -4,32 +4,41 @@ import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; +import team.retum.jobis.domain.code.model.CodeType; import team.retum.jobis.domain.recruitment.persistence.entity.RecruitAreaEntity; +import javax.persistence.EmbeddedId; import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; import javax.persistence.FetchType; -import javax.persistence.Id; -import javax.persistence.IdClass; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; +import javax.persistence.MapsId; import javax.persistence.Table; @Getter @AllArgsConstructor @NoArgsConstructor(access = AccessLevel.PROTECTED) -@IdClass(RecruitAreaCodeId.class) @Table(name = "tbl_recruit_area_code") @Entity public class RecruitAreaCodeEntity { - @Id + @EmbeddedId + private RecruitAreaCodeId recruitAreaCodeId; + + @MapsId("recruitAreaId") @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "recruit_area_id", nullable = false) private RecruitAreaEntity recruitArea; - @Id + + @MapsId("code") @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "code_id", nullable = false) private CodeEntity code; + + @Enumerated(EnumType.STRING) + private CodeType type; } \ No newline at end of file diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/code/persistence/entity/RecruitAreaCodeId.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/code/persistence/entity/RecruitAreaCodeId.java index 1174f485e..6440e54ea 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/code/persistence/entity/RecruitAreaCodeId.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/code/persistence/entity/RecruitAreaCodeId.java @@ -5,12 +5,18 @@ import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; +import javax.persistence.Column; +import javax.persistence.Embeddable; import java.io.Serializable; @AllArgsConstructor @NoArgsConstructor(access = AccessLevel.PROTECTED) +@Embeddable @EqualsAndHashCode public class RecruitAreaCodeId implements Serializable { - private Long recruitArea; + @Column + private Long recruitAreaId; + + @Column private Long code; } diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/code/persistence/mapper/CodeMapper.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/code/persistence/mapper/CodeMapper.java index a131b01e8..9c86944ca 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/code/persistence/mapper/CodeMapper.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/code/persistence/mapper/CodeMapper.java @@ -19,7 +19,7 @@ public CodeEntity toEntity(Code domain) { .orElseThrow(() -> CodeNotFoundException.EXCEPTION); return CodeEntity.builder() - .id(domain.getId()) + .code(domain.getId()) .codeType(domain.getCodeType()) .keyword(domain.getKeyword()) .jobType(domain.getJobType()) @@ -29,11 +29,11 @@ public CodeEntity toEntity(Code domain) { public Code toDomain(CodeEntity entity) { return Code.builder() - .id(entity.getId()) - .codeType(entity.getCodeType()) + .id(entity.getCode()) + .codeType(entity.getType()) .jobType(entity.getJobType()) .keyword(entity.getKeyword()) - .parentCodeId(entity.getParentCode() == null ? null : entity.getParentCode().getId()) + .parentCodeId(entity.getParentCode() == null ? null : entity.getParentCode().getCode()) .build(); } } diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/code/persistence/mapper/RecruitAreaCodeMapper.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/code/persistence/mapper/RecruitAreaCodeMapper.java index dc416a449..5f5fe4f63 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/code/persistence/mapper/RecruitAreaCodeMapper.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/code/persistence/mapper/RecruitAreaCodeMapper.java @@ -6,6 +6,7 @@ import team.retum.jobis.domain.code.model.RecruitAreaCode; import team.retum.jobis.domain.code.persistence.entity.CodeEntity; import team.retum.jobis.domain.code.persistence.entity.RecruitAreaCodeEntity; +import team.retum.jobis.domain.code.persistence.entity.RecruitAreaCodeId; import team.retum.jobis.domain.code.persistence.repository.CodeJpaRepository; import team.retum.jobis.domain.recruitment.exception.RecruitAreaNotFoundException; import team.retum.jobis.domain.recruitment.persistence.entity.RecruitAreaEntity; @@ -22,16 +23,22 @@ public RecruitAreaCodeEntity toEntity(RecruitAreaCode domain) { RecruitAreaEntity recruitArea = recruitAreaJpaRepository.findById(domain.getRecruitAreaId()) .orElseThrow(() -> RecruitAreaNotFoundException.EXCEPTION); - CodeEntity code = codeJpaRepository.findById(domain.getCodeId()) + CodeEntity code = codeJpaRepository.findById(domain.getCode()) .orElseThrow(() -> CodeNotFoundException.EXCEPTION); - return new RecruitAreaCodeEntity(recruitArea, code); + return new RecruitAreaCodeEntity( + new RecruitAreaCodeId(domain.getRecruitAreaId(), domain.getCode()), + recruitArea, + code, + domain.getType() + ); } public RecruitAreaCode toDomain(RecruitAreaCodeEntity entity) { return RecruitAreaCode.builder() .recruitAreaId(entity.getRecruitArea().getId()) - .codeId(entity.getCode().getId()) + .code(entity.getCode().getCode()) + .type(entity.getType()) .build(); } } diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/code/persistence/repository/CodeJpaRepository.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/code/persistence/repository/CodeJpaRepository.java index cbf87e334..34a4f7a03 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/code/persistence/repository/CodeJpaRepository.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/code/persistence/repository/CodeJpaRepository.java @@ -7,5 +7,5 @@ public interface CodeJpaRepository extends CrudRepository { - List findCodesByIdIn(List ids); + List findCodesByCodeIn(List codes); } diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/company/persistence/CompanyPersistenceAdapter.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/company/persistence/CompanyPersistenceAdapter.java index 907d29cd9..bf44fc4c6 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/company/persistence/CompanyPersistenceAdapter.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/company/persistence/CompanyPersistenceAdapter.java @@ -200,14 +200,19 @@ public List queryEmployCompanies(CompanyFilter filter) ) ) .from(companyEntity) - .leftJoin(companyEntity.acceptances, acceptanceEntity) - .leftJoin(companyEntity.recruitments, recruitmentEntity) + .leftJoin(acceptanceEntity) + .on(acceptanceEntity.company.id.eq(companyEntity.id)) + .leftJoin(recruitmentEntity) + .on(recruitmentEntity.company.id.eq(companyEntity.id)) .on( recruitmentEntity.company.id.eq(companyEntity.id), recentRecruitment(null) ) - .leftJoin(recruitmentEntity.applications, applicationEntity) - .on(applicationEntity.applicationStatus.eq(FIELD_TRAIN)) + .leftJoin(applicationEntity) + .on( + applicationEntity.applicationStatus.eq(FIELD_TRAIN), + applicationEntity.recruitment.id.eq(recruitmentEntity.id) + ) .where( containsName(filter.getName()), eqCompanyType(filter.getType()), diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/company/persistence/entity/CompanyEntity.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/company/persistence/entity/CompanyEntity.java index a0482af7d..4a99a80b6 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/company/persistence/entity/CompanyEntity.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/company/persistence/entity/CompanyEntity.java @@ -7,11 +7,9 @@ import org.hibernate.annotations.ColumnDefault; import org.hibernate.annotations.DynamicInsert; import org.hibernate.annotations.DynamicUpdate; -import team.retum.jobis.domain.acceptance.persistence.entity.AcceptanceEntity; import team.retum.jobis.domain.company.model.CompanyType; import team.retum.jobis.domain.company.persistence.entity.type.Address; import team.retum.jobis.domain.company.persistence.entity.type.Manager; -import team.retum.jobis.domain.recruitment.persistence.entity.RecruitmentEntity; import team.retum.jobis.domain.user.persistence.entity.UserEntity; import team.retum.jobis.global.converter.StringListConverter; import team.retum.jobis.global.util.ImageProperty; @@ -27,12 +25,10 @@ import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.MapsId; -import javax.persistence.OneToMany; import javax.persistence.OneToOne; import javax.persistence.Table; import javax.validation.constraints.NotNull; import java.time.LocalDate; -import java.util.ArrayList; import java.util.List; @Getter @@ -66,8 +62,8 @@ public class CompanyEntity { private CompanyType type; @NotNull - @Column(columnDefinition = "BIT(1)") - private Boolean isMou; + @Column(columnDefinition = "TINYINT(1)") + private boolean isMou; @Embedded private Address address; @@ -122,12 +118,6 @@ public class CompanyEntity { @Column(columnDefinition = "VARCHAR(1000)") private List attachmentUrls; - @OneToMany(mappedBy = "company") - private final List recruitments = new ArrayList<>(); - - @OneToMany(mappedBy = "company") - private final List acceptances = new ArrayList<>(); - @Builder public CompanyEntity(Long id, UserEntity userEntity, String name, String mainAddress, String mainAddressDetail, String mainZipCode, String subAddress, String subAddressDetail, String subZipCode, List attachmentUrls, diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/company/persistence/mapper/CompanyMapper.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/company/persistence/mapper/CompanyMapper.java index 3b5877515..6d1484532 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/company/persistence/mapper/CompanyMapper.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/company/persistence/mapper/CompanyMapper.java @@ -57,7 +57,7 @@ public Company toDomain(CompanyEntity entity) { .email(entity.getEmail()) .bizNo(entity.getBizNo()) .type(entity.getType()) - .isMou(entity.getIsMou()) + .isMou(entity.isMou()) .companyIntroduce(entity.getCompanyIntroduce()) .businessArea(entity.getBusinessArea()) .companyLogoUrl(entity.getCompanyLogoUrl()) diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/company/presentation/dto/request/RegisterCompanyWebRequest.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/company/presentation/dto/request/RegisterCompanyWebRequest.java index eaec3f77e..151284cd2 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/company/presentation/dto/request/RegisterCompanyWebRequest.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/company/presentation/dto/request/RegisterCompanyWebRequest.java @@ -27,8 +27,7 @@ public class RegisterCompanyWebRequest { @Size(min = 10, max = 10) private String businessNumber; - @NotNull - @Pattern(regexp = RegexProperty.COMPANY_PASSWORD) + @Pattern(regexp = RegexProperty.PASSWORD) private String password; @NotEmpty diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/RecruitmentPersistenceAdapter.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/RecruitmentPersistenceAdapter.java index 5cdb27498..b58ea52b2 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/RecruitmentPersistenceAdapter.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/RecruitmentPersistenceAdapter.java @@ -1,7 +1,9 @@ package team.retum.jobis.domain.recruitment.persistence; +import com.querydsl.core.types.ExpressionUtils; import com.querydsl.core.types.dsl.BooleanExpression; import com.querydsl.core.types.dsl.Expressions; +import com.querydsl.core.types.dsl.StringExpression; import com.querydsl.jpa.impl.JPAQueryFactory; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Repository; @@ -32,7 +34,9 @@ import static com.querydsl.core.group.GroupBy.groupBy; import static com.querydsl.core.group.GroupBy.list; +import static com.querydsl.jpa.JPAExpressions.select; import static team.retum.jobis.domain.bookmark.persistence.entity.QBookmarkEntity.bookmarkEntity; +import static team.retum.jobis.domain.code.model.CodeType.JOB; import static team.retum.jobis.domain.code.persistence.entity.QCodeEntity.codeEntity; import static team.retum.jobis.domain.code.persistence.entity.QRecruitAreaCodeEntity.recruitAreaCodeEntity; import static team.retum.jobis.domain.company.persistence.entity.QCompanyEntity.companyEntity; @@ -56,6 +60,7 @@ public List queryRecruitmentsByFilter(RecruitmentFilter filter) { QApplicationEntity requestedApplication = new QApplicationEntity("requestedApplication"); QApplicationEntity approvedApplication = new QApplicationEntity("approvedApplication"); + StringExpression recruitJobsPath = Expressions.stringTemplate("group_concat({0})", codeEntity.keyword); return queryFactory .select( new QQueryRecruitmentsVO( @@ -68,30 +73,49 @@ public List queryRecruitmentsByFilter(RecruitmentFilter filter) { recruitmentEntity.payInfo.trainPay, recruitmentEntity.militarySupport, companyEntity.companyLogoUrl, - Expressions.stringTemplate("group_concat({0})", recruitAreaEntity.jobCodes), + recruitJobsPath, recruitAreaEntity.hiredCount.sum(), requestedApplication.countDistinct(), approvedApplication.countDistinct(), - bookmarkEntity.count(), + filter.getStudentId() != null ? + ExpressionUtils.as( + select(bookmarkEntity.count().gt(0)) + .from(bookmarkEntity) + .where( + bookmarkEntity.student.id.eq(filter.getStudentId()), + bookmarkEntity.recruitment.id.eq(recruitmentEntity.id) + ), "isBookmarked") + : Expressions.asBoolean(false), companyEntity.id ) ) .from(recruitmentEntity) - .join(recruitmentEntity.recruitAreas, recruitAreaEntity) .join(recruitmentEntity.company, companyEntity) - .leftJoin(recruitmentEntity.applications, requestedApplication) - .on(requestedApplication.applicationStatus.eq(ApplicationStatus.REQUESTED)) - .leftJoin(recruitmentEntity.applications, approvedApplication) - .on(approvedApplication.applicationStatus.eq(ApplicationStatus.APPROVED)) - .leftJoin(bookmarkEntity) - .on(eqStudentId(filter.getStudentId())) + .join(recruitAreaEntity) + .on(recruitAreaEntity.recruitment.id.eq(recruitmentEntity.id)) + .join(recruitAreaCodeEntity) + .on( + recruitAreaCodeEntity.recruitArea.id.eq(recruitAreaEntity.id), + recruitAreaCodeEntity.type.eq(JOB) + ) + .join(recruitAreaCodeEntity.code, codeEntity) + .leftJoin(requestedApplication) + .on( + requestedApplication.recruitment.id.eq(recruitmentEntity.id), + requestedApplication.applicationStatus.eq(ApplicationStatus.REQUESTED) + ) + .leftJoin(approvedApplication) + .on( + approvedApplication.recruitment.id.eq(recruitmentEntity.id), + approvedApplication.applicationStatus.eq(ApplicationStatus.APPROVED) + ) .where( eqYear(filter.getYear()), betweenRecruitDate(filter.getStartDate(), filter.getEndDate()), eqRecruitStatus(filter.getStatus()), containsName(filter.getCompanyName()), containsCodes(filter.getCodes()), - containsJobCode(filter.getJobCode()) + eqWinterIntern(filter.getWinterIntern()) ) .offset(filter.getOffset()) .limit(filter.getLimit()) @@ -137,23 +161,32 @@ public Long getRecruitmentCountByFilter(RecruitmentFilter filter) { return queryFactory .select(recruitmentEntity.count()) .from(recruitmentEntity) + .join(recruitAreaEntity) + .on(recruitAreaEntity.recruitment.id.eq(recruitmentEntity.id)) + .join(recruitAreaCodeEntity) + .on( + recruitAreaCodeEntity.recruitArea.id.eq(recruitAreaEntity.id), + recruitAreaCodeEntity.type.eq(JOB) + ) + .join(recruitAreaCodeEntity.code, codeEntity) .join(recruitmentEntity.company, companyEntity) - .join(recruitmentEntity.recruitAreas, recruitAreaEntity) .where( eqYear(filter.getYear()), betweenRecruitDate(filter.getStartDate(), filter.getEndDate()), eqRecruitStatus(filter.getStatus()), containsName(filter.getCompanyName()), containsCodes(filter.getCodes()), - containsJobCode(filter.getJobCode()) - ).fetchOne(); + eqWinterIntern(filter.getWinterIntern()) + ) + .fetchOne(); } @Override public List queryRecruitAreasByRecruitmentId(Long recruitmentId) { return queryFactory .selectFrom(recruitAreaEntity) - .join(recruitAreaEntity.recruitAreaCodes, recruitAreaCodeEntity) + .join(recruitAreaCodeEntity) + .on(recruitAreaCodeEntity.recruitArea.id.eq(recruitAreaEntity.id)) .join(recruitAreaCodeEntity.code, codeEntity) .where(recruitAreaEntity.recruitment.id.eq(recruitmentId)) .transform( @@ -163,7 +196,6 @@ public List queryRecruitAreasByRecruitmentId(Long recruitme recruitAreaEntity.id, recruitAreaEntity.hiredCount, recruitAreaEntity.majorTask, - recruitAreaEntity.jobCodes, recruitAreaEntity.preferentialTreatment, list(codeEntity) ) @@ -298,14 +330,9 @@ private BooleanExpression containsName(String name) { } private BooleanExpression containsCodes(List codes) { - return codes.isEmpty() ? null : recruitAreaEntity.recruitAreaCodes.any().code.id.in(codes); + return codes.isEmpty() ? null : recruitAreaCodeEntity.code.code.in(codes); } - - private BooleanExpression eqStudentId(Long studentId) { - return studentId == null ? bookmarkEntity.recruitment.eq(recruitmentEntity) : bookmarkEntity.student.id.eq(studentId).and(bookmarkEntity.recruitment.eq(recruitmentEntity)); - } - - private BooleanExpression containsJobCode(Long jobCode) { - return jobCode == null ? null : Expressions.stringTemplate("cast({0} as string)", recruitAreaEntity.jobCodes).contains(jobCode.toString()); + private BooleanExpression eqWinterIntern(Boolean winterIntern) { + return winterIntern == null ? null : recruitmentEntity.winterIntern.eq(winterIntern); } } \ No newline at end of file diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/entity/RecruitAreaEntity.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/entity/RecruitAreaEntity.java index 0dea6c307..70347bc04 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/entity/RecruitAreaEntity.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/entity/RecruitAreaEntity.java @@ -4,11 +4,8 @@ import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; -import team.retum.jobis.domain.code.persistence.entity.RecruitAreaCodeEntity; -import team.retum.jobis.global.converter.StringListConverter; import javax.persistence.Column; -import javax.persistence.Convert; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; @@ -16,11 +13,8 @@ import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; -import javax.persistence.OneToMany; import javax.persistence.Table; import javax.validation.constraints.NotNull; -import java.util.ArrayList; -import java.util.List; @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) @@ -40,11 +34,6 @@ public class RecruitAreaEntity { @Column(columnDefinition = "VARCHAR(3500)") private String majorTask; - @NotNull - @Convert(converter = StringListConverter.class) - @Column(columnDefinition = "VARCHAR(40)") - private List jobCodes; - @Column(columnDefinition = "VARCHAR(500)") private String preferentialTreatment; @@ -52,16 +41,12 @@ public class RecruitAreaEntity { @JoinColumn(name = "recruitment_id", nullable = false) private RecruitmentEntity recruitment; - @OneToMany(mappedBy = "recruitArea", orphanRemoval = true) - private List recruitAreaCodes = new ArrayList<>(); - @Builder public RecruitAreaEntity(Long id, Integer hiredCount, String majorTask, String preferentialTreatment, - List jobCodes, RecruitmentEntity recruitmentEntity) { + RecruitmentEntity recruitmentEntity) { this.id = id; this.hiredCount = hiredCount; this.majorTask = majorTask; - this.jobCodes = jobCodes; this.preferentialTreatment = preferentialTreatment; this.recruitment = recruitmentEntity; } diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/entity/RecruitmentEntity.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/entity/RecruitmentEntity.java index 6c3f662e8..5d84f47d7 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/entity/RecruitmentEntity.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/entity/RecruitmentEntity.java @@ -73,8 +73,8 @@ public class RecruitmentEntity extends BaseTimeEntity { private String benefits; @NotNull - @Column(columnDefinition = "BIT(1)") - private Boolean militarySupport; + @Column(columnDefinition = "TINYINT(1)") + private boolean militarySupport; @NotNull @Convert(converter = HiringProgressConverter.class) @@ -95,25 +95,23 @@ public class RecruitmentEntity extends BaseTimeEntity { private PayInfo payInfo; @NotNull - @Column(columnDefinition = "BIT(1)") - private Boolean personalContact; + @Column(columnDefinition = "TINYINT(1)") + private boolean personalContact; + + @NotNull + @Column(columnDefinition = "TINYINT(1)") + private boolean winterIntern; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "company_id", nullable = false) private CompanyEntity company; - @OneToMany(mappedBy = "recruitment", orphanRemoval = true) - private final List recruitAreas = new ArrayList<>(); - - @OneToMany(mappedBy = "recruitment") - private final List applications = new ArrayList<>(); - @Builder public RecruitmentEntity(Long id, int recruitYear, RecruitStatus status, Integer trainPay, String pay, LocalTime startTime, LocalTime endTime, String submitDocument, LocalDate startDate, LocalDate endDate, CompanyEntity companyEntity, String benefits, boolean militarySupport, List requiredLicenses, String etc, List hiringProgress, - Integer requiredGrade, Boolean personalContact) { + Integer requiredGrade, boolean personalContact, boolean winterIntern) { this.id = id; this.workingHour = new WorkingHour(startTime, endTime); this.hiringProgress = hiringProgress; @@ -128,6 +126,7 @@ public RecruitmentEntity(Long id, int recruitYear, RecruitStatus status, Integer this.company = companyEntity; this.requiredLicenses = requiredLicenses; this.militarySupport = militarySupport; + this.winterIntern = winterIntern; this.etc = etc; } } diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/mapper/RecruitAreaMapper.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/mapper/RecruitAreaMapper.java index d53d3454c..f165f63d9 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/mapper/RecruitAreaMapper.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/mapper/RecruitAreaMapper.java @@ -22,7 +22,6 @@ public RecruitAreaEntity toEntity(RecruitArea domain) { .id(domain.getId()) .recruitmentEntity(recruitment) .hiredCount(domain.getHiredCount()) - .jobCodes(domain.getJobCodes()) .majorTask(domain.getMajorTask()) .preferentialTreatment(domain.getPreferentialTreatment()) .build(); @@ -33,8 +32,6 @@ public RecruitArea toDomain(RecruitAreaEntity entity) { .id(entity.getId()) .recruitmentId(entity.getRecruitment().getId()) .majorTask(entity.getMajorTask()) - .jobCodes(entity.getJobCodes()) - .majorTask(entity.getMajorTask()) .preferentialTreatment(entity.getPreferentialTreatment()) .build(); } diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/mapper/RecruitmentMapper.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/mapper/RecruitmentMapper.java index 32e652723..7eb5443c3 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/mapper/RecruitmentMapper.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/mapper/RecruitmentMapper.java @@ -38,6 +38,7 @@ public RecruitmentEntity toEntity(Recruitment domain) { .submitDocument(domain.getSubmitDocument()) .startTime(domain.getStartTime()) .endTime(domain.getEndTime()) + .winterIntern(domain.isWinterIntern()) .build(); } @@ -49,8 +50,8 @@ public Recruitment toDomain(RecruitmentEntity entity) { .recruitYear(entity.getRecruitYear()) .benefits(entity.getBenefits()) .hiringProgress(entity.getHiringProgress()) - .personalContract(entity.getPersonalContact()) - .militarySupport(entity.getMilitarySupport()) + .personalContract(entity.isPersonalContact()) + .militarySupport(entity.isMilitarySupport()) .status(entity.getStatus()) .startDate(entity.getRecruitDate().getStartDate()) .endDate(entity.getRecruitDate().getFinishDate()) @@ -62,6 +63,7 @@ public Recruitment toDomain(RecruitmentEntity entity) { .submitDocument(entity.getSubmitDocument()) .startTime(entity.getWorkingHour().getStartTime()) .endTime(entity.getWorkingHour().getEndTime()) + .winterIntern(entity.isWinterIntern()) .build(); } } diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/repository/converter/HiringProgressConverter.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/repository/converter/HiringProgressConverter.java index 485a1a785..68f621bf1 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/repository/converter/HiringProgressConverter.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/repository/converter/HiringProgressConverter.java @@ -3,10 +3,12 @@ import team.retum.jobis.domain.recruitment.model.ProgressType; import javax.persistence.AttributeConverter; +import javax.persistence.Converter; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; +@Converter public class HiringProgressConverter implements AttributeConverter, String> { @Override diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/repository/vo/QueryRecruitAreaVO.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/repository/vo/QueryRecruitAreaVO.java index b82f8bf59..4862218b1 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/repository/vo/QueryRecruitAreaVO.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/repository/vo/QueryRecruitAreaVO.java @@ -2,6 +2,7 @@ import com.querydsl.core.annotations.QueryProjection; import lombok.Getter; +import team.retum.jobis.domain.code.model.CodeType; import team.retum.jobis.domain.code.persistence.entity.CodeEntity; import team.retum.jobis.domain.recruitment.dto.response.RecruitAreaResponse; @@ -12,11 +13,15 @@ public class QueryRecruitAreaVO extends RecruitAreaResponse { @QueryProjection public QueryRecruitAreaVO(Long id, Integer hiredCount, String majorTask, - List jobCodes, String preferentialTreatment, List techCode) { + String preferentialTreatment, List codes) { super( id, - jobCodes, - techCode.stream() + codes.stream() + .filter(code -> code.getType().equals(CodeType.JOB)) + .map(CodeEntity::getKeyword) + .toList(), + codes.stream() + .filter(code -> code.getType().equals(CodeType.TECH)) .map(CodeEntity::getKeyword) .toList(), hiredCount, diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/repository/vo/QueryRecruitmentsVO.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/repository/vo/QueryRecruitmentsVO.java index acf2237f9..c36a6da71 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/repository/vo/QueryRecruitmentsVO.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/repository/vo/QueryRecruitmentsVO.java @@ -16,7 +16,7 @@ public QueryRecruitmentsVO(Long recruitmentId, RecruitStatus recruitStatus, Loca LocalDate endDate, String companyName, CompanyType companyType, Integer trainPay, boolean militarySupport, String companyLogoUrl, String jobCodes, Integer totalHiring, Long requestedApplicationCount, - Long approvedApplicationCount, Long isBookmarked, Long companyId) { + Long approvedApplicationCount, Boolean isBookmarked, Long companyId) { super(recruitmentId, recruitStatus, startDate, endDate, companyName, companyType, trainPay, militarySupport, companyLogoUrl, jobCodes, totalHiring, requestedApplicationCount, approvedApplicationCount, isBookmarked, companyId); diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/presentation/RecruitmentWebAdapter.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/presentation/RecruitmentWebAdapter.java index 10b2cc610..014ebb076 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/presentation/RecruitmentWebAdapter.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/presentation/RecruitmentWebAdapter.java @@ -39,6 +39,7 @@ import javax.validation.Valid; import javax.validation.constraints.Positive; import java.time.LocalDate; +import java.util.ArrayList; import java.util.List; @RestController @@ -96,21 +97,40 @@ public void createRecruitArea( public StudentQueryRecruitmentsResponse studentQueryRecruitments( @RequestParam(value = "name", required = false) String companyName, @RequestParam(value = "page", required = false, defaultValue = "1") @Positive Long page, - @RequestParam(value = "job_code", required = false) Long jobCode, - @RequestParam(value = "tech_code", required = false) String techCode + @RequestParam(value = "tech_code", required = false) String techCodes, + @RequestParam(value = "job_code", required = false) String jobCode, + @RequestParam(value = "winter_intern", required = false) Boolean winterIntern ) { - List techCodes = StringUtil.divideString(techCode, ",").stream().map(Long::parseLong).toList(); - return studentQueryRecruitmentsUseCase.execute(companyName, page - 1, jobCode, techCodes); + List codes = new ArrayList<>(StringUtil.divideString(techCodes, ",")); + if (jobCode != null) codes.add(jobCode); + + return studentQueryRecruitmentsUseCase.execute( + companyName, + page - 1, + codes.stream() + .map(Long::parseLong) + .toList(), + winterIntern + ); } @GetMapping("/student/count") public TotalPageCountResponse studentQueryRecruitmentCount( @RequestParam(value = "name", required = false) String companyName, - @RequestParam(value = "job_code", required = false) Long jobCode, - @RequestParam(value = "tech_code", required = false) String techCode + @RequestParam(value = "tech_code", required = false) String techCodes, + @RequestParam(value = "job_code", required = false) String jobCode, + @RequestParam(value = "winter_intern", required = false) Boolean winterIntern ) { - List techCodes = StringUtil.divideString(techCode, ",").stream().map(Long::parseLong).toList(); - return studentQueryRecruitmentsUseCase.getTotalPageCount(companyName, jobCode, techCodes); + List codes = new ArrayList<>(StringUtil.divideString(techCodes, ",")); + if (jobCode != null) codes.add(jobCode); + + return studentQueryRecruitmentsUseCase.getTotalPageCount( + companyName, + codes.stream() + .map(Long::parseLong) + .toList(), + winterIntern + ); } @GetMapping("/teacher") @@ -120,9 +140,10 @@ public TeacherQueryRecruitmentsResponse queryRecruitmentList( @RequestParam(value = "end", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate end, @RequestParam(value = "status", required = false) RecruitStatus status, @RequestParam(value = "year", required = false) Integer year, - @RequestParam(value = "page", defaultValue = "1") @Positive Long page + @RequestParam(value = "page", defaultValue = "1") @Positive Long page, + @RequestParam(value = "winter_intern", required = false) Boolean winterIntern ) { - return teacherQueryRecruitmentsUseCase.execute(companyName, start, end, year, status, page - 1); + return teacherQueryRecruitmentsUseCase.execute(companyName, start, end, year, status, page - 1, winterIntern); } @GetMapping("/teacher/count") @@ -131,9 +152,10 @@ public TotalPageCountResponse queryRecruitmentCount( @RequestParam(value = "start", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate start, @RequestParam(value = "end", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate end, @RequestParam(value = "status", required = false) RecruitStatus status, - @RequestParam(value = "year", required = false) Integer year + @RequestParam(value = "year", required = false) Integer year, + @RequestParam(value = "winter_intern", required = false) Boolean winterIntern ) { - return teacherQueryRecruitmentsUseCase.getTotalPageCount(companyName, start, end, year, status); + return teacherQueryRecruitmentsUseCase.getTotalPageCount(companyName, start, end, year, status, winterIntern); } @ResponseStatus(HttpStatus.NO_CONTENT) diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/presentation/dto/request/ApplyRecruitmentWebRequest.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/presentation/dto/request/ApplyRecruitmentWebRequest.java index f47ee5b15..041a01ba1 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/presentation/dto/request/ApplyRecruitmentWebRequest.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/presentation/dto/request/ApplyRecruitmentWebRequest.java @@ -58,6 +58,9 @@ public class ApplyRecruitmentWebRequest { @NotNull private LocalDate endDate; + @NotNull + private boolean winterIntern; + @Size(max = 350) private String etc; @@ -80,6 +83,7 @@ public ApplyRecruitmentRequest toDomainRequest() { .submitDocument(this.submitDocument) .startDate(this.startDate) .endDate(this.endDate) + .winterIntern(this.winterIntern) .etc(this.etc) .build(); } diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/review/persistence/mapper/QnAMapper.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/review/persistence/mapper/QnAMapper.java index 5cc347367..02c45c5a8 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/review/persistence/mapper/QnAMapper.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/review/persistence/mapper/QnAMapper.java @@ -38,7 +38,7 @@ public QnA toDomain(QnAEntity entity) { .answer(entity.getAnswer()) .question(entity.getQuestion()) .reviewId(entity.getReview().getId()) - .codeId(entity.getCode().getId()) + .codeId(entity.getCode().getCode()) .build(); } } diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/student/persistence/entity/StudentEntity.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/student/persistence/entity/StudentEntity.java index a46026271..d7d87c106 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/student/persistence/entity/StudentEntity.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/student/persistence/entity/StudentEntity.java @@ -6,8 +6,6 @@ import lombok.NoArgsConstructor; import org.hibernate.annotations.ColumnDefault; import org.hibernate.annotations.DynamicInsert; -import team.retum.jobis.domain.application.persistence.entity.ApplicationEntity; -import team.retum.jobis.domain.bookmark.persistence.entity.BookmarkEntity; import team.retum.jobis.domain.student.model.Department; import team.retum.jobis.domain.student.model.Gender; import team.retum.jobis.domain.user.persistence.entity.UserEntity; @@ -22,13 +20,10 @@ import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.MapsId; -import javax.persistence.OneToMany; import javax.persistence.OneToOne; import javax.persistence.Table; import javax.persistence.UniqueConstraint; import javax.validation.constraints.NotNull; -import java.util.ArrayList; -import java.util.List; @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) @@ -83,16 +78,14 @@ public class StudentEntity { @Column(columnDefinition = "VARCHAR(300)", nullable = false) private String profileImageUrl; - @OneToMany(mappedBy = "student", orphanRemoval = true) - private final List applications = new ArrayList<>(); - - @OneToMany(mappedBy = "student", orphanRemoval = true) - private List bookmarks = new ArrayList<>(); + @NotNull + @Column(columnDefinition = "YEAR") + private Integer entranceYear; @Builder public StudentEntity(Long id, UserEntity userEntity, String name, Integer grade, Integer classRoom, Integer number, Gender gender, - Department department, String profileImageUrl) { + Department department, String profileImageUrl, Integer entranceYear) { this.id = id; this.userEntity = userEntity; this.name = name; @@ -102,5 +95,6 @@ public StudentEntity(Long id, UserEntity userEntity, String name, Integer grade, this.gender = gender; this.department = department; this.profileImageUrl = profileImageUrl; + this.entranceYear = entranceYear; } } diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/student/persistence/mapper/StudentMapper.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/student/persistence/mapper/StudentMapper.java index 2bcc196bb..50d40076e 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/student/persistence/mapper/StudentMapper.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/student/persistence/mapper/StudentMapper.java @@ -27,6 +27,7 @@ public StudentEntity toEntity(Student domain) { .department(domain.getDepartment()) .profileImageUrl(domain.getProfileImageUrl()) .number(domain.getNumber()) + .entranceYear(domain.getEntranceYear()) .userEntity(user) .build(); } @@ -41,6 +42,7 @@ public Student toDomain(StudentEntity entity) { .classRoom(entity.getClassRoom()) .department(entity.getDepartment()) .grade(entity.getGrade()) + .entranceYear(entity.getEntranceYear()) .build(); } } diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/student/presentation/dto/request/UpdateForgottenPasswordWebRequest.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/student/presentation/dto/request/UpdateForgottenPasswordWebRequest.java index e783b5f11..982e3f179 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/student/presentation/dto/request/UpdateForgottenPasswordWebRequest.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/student/presentation/dto/request/UpdateForgottenPasswordWebRequest.java @@ -18,7 +18,6 @@ public class UpdateForgottenPasswordWebRequest { @Pattern(regexp = RegexProperty.EMAIL) private String email; - @NotBlank @Pattern(regexp = RegexProperty.PASSWORD) private String password; diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/student/presentation/dto/request/UpdatePasswordWebRequest.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/student/presentation/dto/request/UpdatePasswordWebRequest.java index bcc8e8587..57a7bc789 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/student/presentation/dto/request/UpdatePasswordWebRequest.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/student/presentation/dto/request/UpdatePasswordWebRequest.java @@ -5,18 +5,15 @@ import team.retum.jobis.domain.student.dto.UpdatePasswordRequest; import team.retum.jobis.global.util.RegexProperty; -import javax.validation.constraints.NotBlank; import javax.validation.constraints.Pattern; @Getter @NoArgsConstructor public class UpdatePasswordWebRequest { - @NotBlank @Pattern(regexp = RegexProperty.PASSWORD) private String currentPassword; - @NotBlank @Pattern(regexp = RegexProperty.PASSWORD) private String newPassword; diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/user/presentation/dto/request/LoginWebRequest.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/user/presentation/dto/request/LoginWebRequest.java index 22318e022..cc2851f41 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/user/presentation/dto/request/LoginWebRequest.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/user/presentation/dto/request/LoginWebRequest.java @@ -3,8 +3,10 @@ import lombok.Getter; import lombok.NoArgsConstructor; import team.retum.jobis.domain.user.dto.LoginRequest; +import team.retum.jobis.global.util.RegexProperty; import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; @Getter @@ -15,7 +17,7 @@ public class LoginWebRequest { @NotBlank private String accountId; - @NotBlank + @Pattern(regexp = RegexProperty.PASSWORD) private String password; public LoginRequest toDomainRequest() { diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/global/util/RegexProperty.java b/jobis-infrastructure/src/main/java/team/retum/jobis/global/util/RegexProperty.java index de6dcac5b..8b2faf66a 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/global/util/RegexProperty.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/global/util/RegexProperty.java @@ -8,6 +8,4 @@ public class RegexProperty { public static final String EMAIL = "^.+@dsm.hs.kr$"; public static final String PASSWORD = "^(?=.*[A-Za-z])(?=.*\\d)(?=.*[~!@#$%^&*()+|=])[A-Za-z\\d~!@#$%^&*()+|=]{8,16}$"; - - public static final String COMPANY_PASSWORD = "^[0-9]{4}"; } diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/global/web/WebSecurityConfig.java b/jobis-infrastructure/src/main/java/team/retum/jobis/global/web/WebSecurityConfig.java index e7a2bdae5..5fe30f2dc 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/global/web/WebSecurityConfig.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/global/web/WebSecurityConfig.java @@ -19,7 +19,7 @@ public void addCorsMappings(CorsRegistry registry) { "http://lcoalhost:3001", "http://localhost:4000" ) - .allowedMethods("GET", "POST", "PUT", "PATCH", "DELETE") + .allowedMethods("GET", "POST", "PUT", "PATCH", "DELETE", "HEAD") .allowedHeaders("*"); } } diff --git a/jobis-infrastructure/src/main/resources/application.yml b/jobis-infrastructure/src/main/resources/application.yml index eab91368f..c4bfe2bf5 100644 --- a/jobis-infrastructure/src/main/resources/application.yml +++ b/jobis-infrastructure/src/main/resources/application.yml @@ -1,14 +1,14 @@ spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://${DB_URL:localhost}:3306/${DB_NAME:jobis}?useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&characterEncoding=UTF-8&serverTimezone=Asia/Seoul&rewriteBatchedStatements=true + url: jdbc:mysql://${DB_URL:localhost}:3306/${DB_NAME:jobis}?useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Seoul&allowPublicKeyRetrieval=true&tinyInt1isBit=false&rewriteBatchedStatements=true username: ${DB_USERNAME:root} password: ${DB_PASSWORD:11111111} jpa: database-platform: team.retum.jobis.global.config.MysqlDialectConfig hibernate: - ddl-auto: validate + ddl-auto: ${DDL:validate} properties.hibernate: format_sql: true show_sql: ${SHOW_SQL:true}