diff --git a/src/main/java/com/postgraduate/batch/done/DoneMentoringSkipListener.java b/src/main/java/com/postgraduate/batch/done/DoneMentoringSkipListener.java index 6f75a1df..7901e59c 100644 --- a/src/main/java/com/postgraduate/batch/done/DoneMentoringSkipListener.java +++ b/src/main/java/com/postgraduate/batch/done/DoneMentoringSkipListener.java @@ -14,18 +14,18 @@ public class DoneMentoringSkipListener implements SkipListener { private final CreateSalaryRepository createSalaryRepository; @Override - public void write(Chunk chunk) throws Exception { + public void write(Chunk chunk) { List createSalaries = new ArrayList<>(); chunk.forEach(createSalaries::add); createSalaryRepository.insertAllSalary(createSalaries); diff --git a/src/main/java/com/postgraduate/batch/salary/CreateSalaryJobConfig.java b/src/main/java/com/postgraduate/batch/salary/CreateSalaryJobConfig.java index bfcdb05c..198a9894 100644 --- a/src/main/java/com/postgraduate/batch/salary/CreateSalaryJobConfig.java +++ b/src/main/java/com/postgraduate/batch/salary/CreateSalaryJobConfig.java @@ -4,6 +4,7 @@ import com.postgraduate.domain.salary.domain.service.SalaryGetService; import com.postgraduate.global.slack.SlackSalaryMessage; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.batch.core.Job; import org.springframework.batch.core.Step; import org.springframework.batch.core.job.builder.JobBuilder; @@ -19,6 +20,7 @@ import org.springframework.transaction.PlatformTransactionManager; import javax.sql.DataSource; +import java.time.LocalDate; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -26,6 +28,7 @@ import static com.postgraduate.domain.salary.util.SalaryUtil.getSalaryDate; @Configuration +@Slf4j @RequiredArgsConstructor public class CreateSalaryJobConfig { private final JobRepository jobRepository; @@ -73,7 +76,9 @@ public Step createSalaryStep() throws Exception { @Bean(name = "salaryReader") public JdbcPagingItemReader salaryReader() throws Exception { Map parameters = new HashMap<>(); - parameters.put("salaryDate", getSalaryDate().plusDays(7)); + LocalDate salaryDate = getSalaryDate().plusDays(7); + parameters.put("salaryDate", salaryDate); + log.info("salaryReader salaryDate : {}", salaryDate); return new JdbcPagingItemReaderBuilder() .pageSize(CHUNK_SIZE) .fetchSize(CHUNK_SIZE) diff --git a/src/main/java/com/postgraduate/batch/salary/CreateSalaryRepository.java b/src/main/java/com/postgraduate/batch/salary/CreateSalaryRepository.java index 2a50b27d..a1b4878d 100644 --- a/src/main/java/com/postgraduate/batch/salary/CreateSalaryRepository.java +++ b/src/main/java/com/postgraduate/batch/salary/CreateSalaryRepository.java @@ -1,6 +1,7 @@ package com.postgraduate.batch.salary; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; import org.springframework.jdbc.core.namedparam.SqlParameterSource; @@ -14,6 +15,7 @@ @Component @RequiredArgsConstructor +@Slf4j public class CreateSalaryRepository { private final NamedParameterJdbcTemplate jdbcTemplate; private static final String INSERT_SALARY = "insert into salary " + @@ -32,6 +34,7 @@ private SqlParameterSource[] generateParameterSource(List createSa } private Map generateEntityParams(CreateSalary createSalary) { + log.info("create salary for seniorId : {}", createSalary.seniorId()); HashMap parameter = new HashMap<>(); parameter.put("salaryDate", getSalaryDate().plusDays(7)); parameter.put("seniorId", createSalary.seniorId()); diff --git a/src/main/java/com/postgraduate/batch/salary/CreateSalarySkipListener.java b/src/main/java/com/postgraduate/batch/salary/CreateSalarySkipListener.java index b3396e5c..edaacd25 100644 --- a/src/main/java/com/postgraduate/batch/salary/CreateSalarySkipListener.java +++ b/src/main/java/com/postgraduate/batch/salary/CreateSalarySkipListener.java @@ -14,18 +14,18 @@ public class CreateSalarySkipListener implements SkipListener findAllByFieldSenior(String field, String postgradu, Pageabl } private BooleanExpression fieldSpecifier(String fields) { + if (fields.contains(ALL)) + return TRUE; + String[] field = fields.split(","); if (fields.contains(ETC)) return Arrays.stream(field) diff --git a/src/main/java/com/postgraduate/domain/senior/presentation/SeniorController.java b/src/main/java/com/postgraduate/domain/senior/presentation/SeniorController.java index 4b7500df..17479a0a 100644 --- a/src/main/java/com/postgraduate/domain/senior/presentation/SeniorController.java +++ b/src/main/java/com/postgraduate/domain/senior/presentation/SeniorController.java @@ -128,7 +128,7 @@ public ResponseDto getSearchSenior(@RequestParam String } @GetMapping("/field") - @Operation(summary = "대학원생 필드 검색", description = "분야 (분야1,분야2 이런식으로, 다른분야 : others), 대학원 필수 (대학원1,대학원2 이런식으로, 다른학교 : others, 전체 : all), 페이지 선택 ") + @Operation(summary = "대학원생 필드 검색", description = "분야 (분야1,분야2 이런식으로, 다른분야 : others, 전체 : all), 대학원 필수 (대학원1,대학원2 이런식으로, 다른학교 : others, 전체 : all), 페이지 선택 ") public ResponseDto getFieldSenior(@RequestParam String field, @RequestParam String postgradu, @RequestParam(required = false) Integer page) {