diff --git a/src/main/java/com/wooribound/api/corporate/controller/EnterpriseInfoController.java b/src/main/java/com/wooribound/api/corporate/controller/EnterpriseInfoController.java index e063be2..25f2a30 100644 --- a/src/main/java/com/wooribound/api/corporate/controller/EnterpriseInfoController.java +++ b/src/main/java/com/wooribound/api/corporate/controller/EnterpriseInfoController.java @@ -35,8 +35,8 @@ public String updateEnterpriseInfo(@RequestBody EnterpriseInfoReqDTO enterpriseI @Operation(summary = "고용 직원 목록 조회", description = "고용 직원 목록 조회") @GetMapping("/employee") - public List getJobEmployees(@RequestParam String entId) { - return enterpriseInfoFacade.getEmployees(entId); + public List getJobEmployees(Authentication authentication) { + return enterpriseInfoFacade.getEmployees(authentication); } @Operation(summary = "고용 직원 평가", description = "고용 직원 평가") diff --git a/src/main/java/com/wooribound/api/corporate/controller/EnterpriseJobPostingController.java b/src/main/java/com/wooribound/api/corporate/controller/EnterpriseJobPostingController.java index 8682b0d..317c84d 100644 --- a/src/main/java/com/wooribound/api/corporate/controller/EnterpriseJobPostingController.java +++ b/src/main/java/com/wooribound/api/corporate/controller/EnterpriseJobPostingController.java @@ -5,7 +5,7 @@ import com.wooribound.api.corporate.dto.JobPostingReqDTO; import com.wooribound.api.corporate.facade.EnterpriseJobPostingFacade; import com.wooribound.domain.jobposting.dto.JobPostingDetailDTO; -import com.wooribound.domain.resume.dto.ResumeDTO; +import com.wooribound.domain.resume.dto.ResumeDetailDTO; import com.wooribound.domain.userapply.dto.ApplicantResultReqDTO; import com.wooribound.global.util.AuthenticateUtil; import lombok.RequiredArgsConstructor; @@ -49,8 +49,8 @@ public List getJobApplicants(@RequestParam int postId) { // 5. 공고 지원자 이력서 조회 @GetMapping("/applicant/detail") - public ResumeDTO getApplicantResume(Authentication authentication) { - return enterpriseJobPostingFacade.getApplicantResume(authentication); + public ResumeDetailDTO getApplicantResume(@RequestParam String userId) { + return enterpriseJobPostingFacade.getApplicantResume(userId); } // TODO: 합격여부 설정 시 버튼 컴포넌트 비활성화 diff --git a/src/main/java/com/wooribound/api/corporate/dto/ApplicantsDTO.java b/src/main/java/com/wooribound/api/corporate/dto/ApplicantsDTO.java index 80fab2e..daccd58 100644 --- a/src/main/java/com/wooribound/api/corporate/dto/ApplicantsDTO.java +++ b/src/main/java/com/wooribound/api/corporate/dto/ApplicantsDTO.java @@ -1,5 +1,6 @@ package com.wooribound.api.corporate.dto; +import com.wooribound.global.constant.ApplyResult; import com.wooribound.global.constant.Gender; import lombok.AllArgsConstructor; import lombok.Builder; @@ -15,4 +16,7 @@ public class ApplicantsDTO { private String applicantName; private Gender applicantGender; private int applicantAge; + private String userId; + private Long applyId; + private ApplyResult result; } diff --git a/src/main/java/com/wooribound/api/corporate/dto/EmployeeDTO.java b/src/main/java/com/wooribound/api/corporate/dto/EmployeeDTO.java index 6dd7c2b..783b4a1 100644 --- a/src/main/java/com/wooribound/api/corporate/dto/EmployeeDTO.java +++ b/src/main/java/com/wooribound/api/corporate/dto/EmployeeDTO.java @@ -15,5 +15,6 @@ public class EmployeeDTO { private String userName; private String jobName; private YN empRecomm; + private Long empId; } diff --git a/src/main/java/com/wooribound/api/corporate/facade/EnterpriseInfoFacade.java b/src/main/java/com/wooribound/api/corporate/facade/EnterpriseInfoFacade.java index 964a343..a159801 100644 --- a/src/main/java/com/wooribound/api/corporate/facade/EnterpriseInfoFacade.java +++ b/src/main/java/com/wooribound/api/corporate/facade/EnterpriseInfoFacade.java @@ -39,7 +39,8 @@ public String updateEnterpriseInfo(EnterpriseInfoReqDTO enterpriseInfoReqDTO ) { // 3. 고용 직원 목록 조회 @Transactional(readOnly = true) - public List getEmployees(String entId) { + public List getEmployees(Authentication authentication) { + String entId = authenticateUtil.CheckEnterpriseAuthAndGetUserId(authentication); return employmentService.getEmployees(entId); } diff --git a/src/main/java/com/wooribound/api/corporate/facade/EnterpriseJobPostingFacade.java b/src/main/java/com/wooribound/api/corporate/facade/EnterpriseJobPostingFacade.java index c43d6b5..18239c7 100644 --- a/src/main/java/com/wooribound/api/corporate/facade/EnterpriseJobPostingFacade.java +++ b/src/main/java/com/wooribound/api/corporate/facade/EnterpriseJobPostingFacade.java @@ -7,6 +7,7 @@ import com.wooribound.domain.jobposting.dto.JobPostingDetailProjection; import com.wooribound.domain.resume.ResumeService; import com.wooribound.domain.resume.dto.ResumeDTO; +import com.wooribound.domain.resume.dto.ResumeDetailDTO; import com.wooribound.domain.userapply.dto.ApplicantResultReqDTO; import com.wooribound.global.util.AuthenticateUtil; import lombok.RequiredArgsConstructor; @@ -52,8 +53,8 @@ public List getJobApplicants(int postId) { // 4. 공고 지원자 이력서 조회 @Transactional(readOnly = true) - public ResumeDTO getApplicantResume(Authentication authentication) { - return resumeService.getResume(authentication); + public ResumeDetailDTO getApplicantResume(String userId) { + return resumeService.getWbUserResume(userId); } // 5. 지원자 결과 설정 diff --git a/src/main/java/com/wooribound/domain/employment/EmploymentServiceImpl.java b/src/main/java/com/wooribound/domain/employment/EmploymentServiceImpl.java index 1ead5a9..0d7bb14 100644 --- a/src/main/java/com/wooribound/domain/employment/EmploymentServiceImpl.java +++ b/src/main/java/com/wooribound/domain/employment/EmploymentServiceImpl.java @@ -2,7 +2,9 @@ import com.wooribound.api.corporate.dto.EmployeeDTO; import com.wooribound.api.corporate.dto.EmploymentReqDTO; +import com.wooribound.domain.userapply.Service.UserApplyServiceImpl; import lombok.RequiredArgsConstructor; +import org.slf4j.Logger; import org.springframework.stereotype.Service; import java.util.List; @@ -14,12 +16,14 @@ public class EmploymentServiceImpl implements EmploymentService{ private final EmploymentRepository employmentRepository; + Logger logger = org.slf4j.LoggerFactory.getLogger(UserApplyServiceImpl.class); // 1. 고용 직원 목록 조회 @Override public List getEmployees(String entId) { return employmentRepository.findByEnterprise_EntId(entId).stream() .map(employment -> EmployeeDTO.builder() + .empId(employment.getEmpId()) .hireDate(employment.getHireDate()) .userName(employment.getWbUser().getName()) .jobName(employment.getJob().getJobName()) @@ -31,6 +35,7 @@ public List getEmployees(String entId) { // 2. 고용 직원 평가 @Override public String evaluateEmployee(EmploymentReqDTO employmentReqDTO) { + logger.info("고용 직원 평가 시작, empId: {}, empRecomm: {}", employmentReqDTO.getEmpId(), employmentReqDTO.getEmpRecomm()); Long empId = employmentReqDTO.getEmpId(); Optional employee = employmentRepository.findById(empId); if (employee.isEmpty()) { diff --git a/src/main/java/com/wooribound/domain/jobposting/JobPostingRepository.java b/src/main/java/com/wooribound/domain/jobposting/JobPostingRepository.java index 57cc1ac..9870bb8 100644 --- a/src/main/java/com/wooribound/domain/jobposting/JobPostingRepository.java +++ b/src/main/java/com/wooribound/domain/jobposting/JobPostingRepository.java @@ -74,10 +74,15 @@ List findJobPostingsNew(@Param("exJobs") List exJo // 3. 내 기업 공고 목록 조회 // JOBPOSTING + COUNT(쿼리연산) 반환해야해서 프로젝션 인터페이스로 리턴값 설정 JobPostingDetailProjection - @Query("SELECT jp.postTitle AS postTitle, jp.enterprise.entName AS entName, jp.postImg AS postImg, " + + @Query("SELECT jp.postId AS postId, jp.postTitle AS postTitle, jp.enterprise.entName AS entName, jp.postImg AS postImg, " + "jp.startDate AS startDate, jp.endDate AS endDate, " + "jp.job.jobName AS jobName, jp.enterprise.entAddr1 AS entAddr1, jp.enterprise.entAddr2 AS entAddr2, " + - "(SELECT COUNT(ua) FROM UserApply ua WHERE ua.jobPosting = jp) AS applicantCount " + + "(SELECT COUNT(ua) FROM UserApply ua WHERE ua.jobPosting = jp) AS applicantCount, " + + "CASE " + + "WHEN jp.startDate > CURRENT_DATE THEN 'PENDING' " + + "WHEN jp.startDate <= CURRENT_DATE AND jp.endDate >= CURRENT_DATE THEN 'ACTIVE' " + + "WHEN jp.endDate < CURRENT_DATE THEN 'CLOSED' " + + "END AS postState " + "FROM JobPosting jp " + "WHERE jp.enterprise.entId = :entId") List getMyJobPostings(@Param("entId") String entId); diff --git a/src/main/java/com/wooribound/domain/jobposting/Service/EntJobPostingServiceImpl.java b/src/main/java/com/wooribound/domain/jobposting/Service/EntJobPostingServiceImpl.java index de69bef..3eef31e 100644 --- a/src/main/java/com/wooribound/domain/jobposting/Service/EntJobPostingServiceImpl.java +++ b/src/main/java/com/wooribound/domain/jobposting/Service/EntJobPostingServiceImpl.java @@ -91,17 +91,18 @@ public JobPostingDetailDTO getJobPostingDetail(Long postId) { JobPosting jobPosting = jobPostingOptional.get(); // log4j - 조회된 공고 상세 로그 - logger.info("공고 상세 조회 결과 - ID: {}, Title: {}", jobPosting.getPostId(), jobPosting.getPostTitle()); + logger.info("공고 상세 조회 결과 - ID: {}, Title: {}, entName: {}, postImg: {}, startDate: {}, endDate: {}, jobName: {}, entAddr1: {}, entAddr2: {}", + jobPosting.getPostId(), jobPosting.getPostTitle(), jobPosting.getEnterprise().getEntName(), jobPosting.getPostImg(), jobPosting.getStartDate(), jobPosting.getEndDate(), jobPosting.getJob().getJobName(), jobPosting.getEnterprise().getEntAddr1(), jobPosting.getEnterprise().getEntAddr2()); return JobPostingDetailDTO.builder() .postTitle(jobPosting.getPostTitle()) .entName(jobPosting.getEnterprise().getEntName()) .postImg(jobPosting.getPostImg()) .startDate(jobPosting.getStartDate()) .endDate(jobPosting.getEndDate()) - // .postState(jobPosting.getPostState()) .jobName(jobPosting.getJob().getJobName()) .entAddr1(jobPosting.getEnterprise().getEntAddr1()) .entAddr2(jobPosting.getEnterprise().getEntAddr2()) + .jobId(jobPosting.getJob().getJobId()) .build(); } else { // 공고가 존재하지 않는 경우 예외 로그 @@ -114,8 +115,10 @@ public JobPostingDetailDTO getJobPostingDetail(Long postId) { // 3. 내 기업 공고 목록 조회 @Override public List getJobPostingList(String entId) { + logger.info(entId + " - 내 기업 공고 목록 조회 시작"); List jobPostings = jobPostingRepository.getMyJobPostings(entId); - return jobPostings.stream().map(jp -> JobPostingDetailDTO.builder() + List response = jobPostings.stream().map(jp -> JobPostingDetailDTO.builder() + .postId(jp.getPostId()) .entAddr1(jp.getEntAddr1()) .entAddr2(jp.getEntAddr2()) .entName(jp.getEntName()) @@ -125,9 +128,12 @@ public List getJobPostingList(String entId) { .startDate(jp.getStartDate()) .endDate(jp.getEndDate()) .applicantCount(jp.getApplicantCount()) + .postState(jp.getPostState()) .build() ) .collect(Collectors.toList()); + logger.info(response.toString()); + return response; } // 4. 공고 지원자 전체 조회 @@ -151,9 +157,12 @@ public List getJobApplicants(int postId) { // DTO 생성 return ApplicantsDTO.builder() + .userId(applicant.getWbUser().getUserId()) .applicantName(applicant.getWbUser().getName()) .applicantGender(applicant.getWbUser().getGender()) .applicantAge(age) + .applyId(applicant.getApplyId()) + .result(applicant.getResult()) .build(); }).collect(Collectors.toList()); } @@ -161,9 +170,10 @@ public List getJobApplicants(int postId) { // 5. 지원자 결과 설정 @Override public String setApplicantResult(ApplicantResultReqDTO applicantResultReqDTO) { - int applyId = applicantResultReqDTO.getApplyId(); + Long applyId = applicantResultReqDTO.getApplyId(); ApplyResult applyResult = applicantResultReqDTO.getApplyResult(); + logger.info("지원자 결과 설정 START, applyId: {}, applyResult: {}", applyId, applyResult); if (userApplyRepository.setApplicantResult(applyId, applyResult) == 1) { UserApply userApply = userApplyRepository.findById((long)applyId) @@ -174,13 +184,19 @@ public String setApplicantResult(ApplicantResultReqDTO applicantResultReqDTO) { String applyResultKorean = switch (applyResult.name()) { case "PENDING" -> "발표 전"; case "ACCEPTED" -> "합격"; - case "FAILED" -> "탈락"; + case "REJECTED" -> "탈락"; case "CANCELED" -> "지원취소됨"; default -> ""; }; + Long maxId = notificationRepository.findMaxId(); + Long nextId = maxId + 1; + logger.info("nextId: {}", nextId.toString()); + // 알림 생성 + logger.info("알림 생성 시작"); Notification notification = Notification.builder() + .notiId(nextId) .wbUser(wbUser) .userApply(userApply) .notice(entName+" 지원결과 : "+ applyResultKorean) @@ -200,6 +216,7 @@ public String setApplicantResult(ApplicantResultReqDTO applicantResultReqDTO) { @Override public List getApplicantRecommendation(int jobId) { + logger.info("공고 직무별 지원자 추천 시작 - jobId: {}", jobId); List recommendedUsers = jobPostingRepository.findApplicantRecommendation(jobId); return recommendedUsers.stream().map(user -> { @@ -218,6 +235,7 @@ public List getApplicantRecommendation(int jobId) { .applicantName(user.getName()) .applicantGender(user.getGender()) .applicantAge(age) + .userId(user.getUserId()) .build(); }).collect(Collectors.toList()); diff --git a/src/main/java/com/wooribound/domain/jobposting/dto/JobPostingDetailDTO.java b/src/main/java/com/wooribound/domain/jobposting/dto/JobPostingDetailDTO.java index f481ad2..28a09ca 100644 --- a/src/main/java/com/wooribound/domain/jobposting/dto/JobPostingDetailDTO.java +++ b/src/main/java/com/wooribound/domain/jobposting/dto/JobPostingDetailDTO.java @@ -12,13 +12,16 @@ @Setter @AllArgsConstructor public class JobPostingDetailDTO { + private Long postId; // 공고 id private String postTitle; // 공고 제목 private String entName; // 기업 이름 private String postImg; // 공고 이미지 private Date startDate; // 공고 시작 날짜 private Date endDate; // 공고 종료 날짜 private String jobName; // 직무 이름 + private Long jobId; // 직무 id private String entAddr1; // 기업 주소 1 private String entAddr2; // 기업 주소 2 private int applicantCount; // 지원자 수 + private String postState; // 공고 상태 } \ No newline at end of file diff --git a/src/main/java/com/wooribound/domain/jobposting/dto/JobPostingDetailProjection.java b/src/main/java/com/wooribound/domain/jobposting/dto/JobPostingDetailProjection.java index 71588a6..59f91e7 100644 --- a/src/main/java/com/wooribound/domain/jobposting/dto/JobPostingDetailProjection.java +++ b/src/main/java/com/wooribound/domain/jobposting/dto/JobPostingDetailProjection.java @@ -3,6 +3,7 @@ import java.util.Date; public interface JobPostingDetailProjection { + Long getPostId(); String getPostTitle(); String getEntName(); String getPostImg(); @@ -12,4 +13,5 @@ public interface JobPostingDetailProjection { String getEntAddr1(); String getEntAddr2(); int getApplicantCount(); + String getPostState(); } diff --git a/src/main/java/com/wooribound/domain/notification/Notification.java b/src/main/java/com/wooribound/domain/notification/Notification.java index fc0e6c3..1db4a03 100644 --- a/src/main/java/com/wooribound/domain/notification/Notification.java +++ b/src/main/java/com/wooribound/domain/notification/Notification.java @@ -28,10 +28,10 @@ ) public class Notification { @Id - @GeneratedValue( - strategy = GenerationType.AUTO, - generator = "notification_seq_generator" - ) +// @GeneratedValue( +// strategy = GenerationType.AUTO, +// generator = "notification_seq_generator" +// ) @Column(name = "noti_id") private Long notiId; diff --git a/src/main/java/com/wooribound/domain/notification/NotificationRepository.java b/src/main/java/com/wooribound/domain/notification/NotificationRepository.java index 7f6bf32..de0ccd5 100644 --- a/src/main/java/com/wooribound/domain/notification/NotificationRepository.java +++ b/src/main/java/com/wooribound/domain/notification/NotificationRepository.java @@ -11,4 +11,7 @@ public interface NotificationRepository extends JpaRepository findByUserId(@Param("userId") String userId); + @Query("SELECT COALESCE(MAX(n.notiId), 0) FROM Notification n") + Long findMaxId(); + } diff --git a/src/main/java/com/wooribound/domain/userapply/UserApplyRepository.java b/src/main/java/com/wooribound/domain/userapply/UserApplyRepository.java index 425eb34..5f34562 100644 --- a/src/main/java/com/wooribound/domain/userapply/UserApplyRepository.java +++ b/src/main/java/com/wooribound/domain/userapply/UserApplyRepository.java @@ -21,7 +21,7 @@ public interface UserApplyRepository extends JpaRepository { // 3. 지원자 결과 설정 @Modifying @Query("UPDATE UserApply ua SET ua.result = :applyResult WHERE ua.applyId = :applyId") - int setApplicantResult(@Param("applyId") int applyId, + int setApplicantResult(@Param("applyId") Long applyId, @Param("applyResult") ApplyResult applyResult); // 4. 지원 결과 대기 중인 지원현황 조회 diff --git a/src/main/java/com/wooribound/domain/userapply/dto/ApplicantResultReqDTO.java b/src/main/java/com/wooribound/domain/userapply/dto/ApplicantResultReqDTO.java index bbaa9a6..a5de91e 100644 --- a/src/main/java/com/wooribound/domain/userapply/dto/ApplicantResultReqDTO.java +++ b/src/main/java/com/wooribound/domain/userapply/dto/ApplicantResultReqDTO.java @@ -12,6 +12,6 @@ @AllArgsConstructor public class ApplicantResultReqDTO { - private int applyId; + private Long applyId; private ApplyResult applyResult; } diff --git a/src/main/java/com/wooribound/global/constant/ApplyResult.java b/src/main/java/com/wooribound/global/constant/ApplyResult.java index eaf7926..7e8bbfb 100644 --- a/src/main/java/com/wooribound/global/constant/ApplyResult.java +++ b/src/main/java/com/wooribound/global/constant/ApplyResult.java @@ -1,5 +1,5 @@ package com.wooribound.global.constant; public enum ApplyResult { - PENDING, ACCEPTED, FAILED, CANCELED + PENDING, ACCEPTED, REJECTED, CANCELED }