Skip to content

Commit

Permalink
Merge pull request #278 from WE-ARE-RACCOONS/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
ywj9811 authored May 27, 2024
2 parents 2e52edc + ec82b0e commit aebd42e
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ public class DoneMentoringSkipListener implements SkipListener<DoneMentoring, Do

@Override
public void onSkipInRead(Throwable t) {
log.info("λ©˜ν† λ§ μžλ™ μ™„λ£Œ ItemReader Skip message : {}", t.getMessage());
log.error("λ©˜ν† λ§ μžλ™ μ™„λ£Œ ItemReader Skip message : {}", t.getMessage());
}

@Override
public void onSkipInProcess(DoneMentoring doneMentoring, Throwable t) {
log.info("mentoringId : {} μžλ™ μ™„λ£Œ μ‹€νŒ¨, message : {}", doneMentoring.mentoringId(), t.getMessage());
log.error("mentoringId : {} μžλ™ μ™„λ£Œ μ‹€νŒ¨, message : {}", doneMentoring.mentoringId(), t.getMessage());
slackErrorMessage.sendSlackMentoringError(doneMentoring.mentoringId(), t);
}

@Override
public void onSkipInWrite(DoneMentoring doneMentoring, Throwable t) {
log.info("mentoringId : {} μžλ™ μ™„λ£Œ μ‹€νŒ¨, message : {}", doneMentoring.mentoringId(), t.getMessage());
log.error("mentoringId : {} μžλ™ μ™„λ£Œ μ‹€νŒ¨, message : {}", doneMentoring.mentoringId(), t.getMessage());
slackErrorMessage.sendSlackMentoringError(doneMentoring.mentoringId(), t);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class CreateSalaryItemWriter implements ItemWriter<CreateSalary> {
private final CreateSalaryRepository createSalaryRepository;

@Override
public void write(Chunk<? extends CreateSalary> chunk) throws Exception {
public void write(Chunk<? extends CreateSalary> chunk) {
List<CreateSalary> createSalaries = new ArrayList<>();
chunk.forEach(createSalaries::add);
createSalaryRepository.insertAllSalary(createSalaries);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -19,13 +20,15 @@
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;

import static com.postgraduate.domain.salary.util.SalaryUtil.getSalaryDate;

@Configuration
@Slf4j
@RequiredArgsConstructor
public class CreateSalaryJobConfig {
private final JobRepository jobRepository;
Expand Down Expand Up @@ -73,7 +76,9 @@ public Step createSalaryStep() throws Exception {
@Bean(name = "salaryReader")
public JdbcPagingItemReader<CreateSalary> salaryReader() throws Exception {
Map<String, Object> 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<CreateSalary>()
.pageSize(CHUNK_SIZE)
.fetchSize(CHUNK_SIZE)
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -14,6 +15,7 @@

@Component
@RequiredArgsConstructor
@Slf4j
public class CreateSalaryRepository {
private final NamedParameterJdbcTemplate jdbcTemplate;
private static final String INSERT_SALARY = "insert into salary " +
Expand All @@ -32,6 +34,7 @@ private SqlParameterSource[] generateParameterSource(List<CreateSalary> createSa
}

private Map<String, Object> generateEntityParams(CreateSalary createSalary) {
log.info("create salary for seniorId : {}", createSalary.seniorId());
HashMap<String, Object> parameter = new HashMap<>();
parameter.put("salaryDate", getSalaryDate().plusDays(7));
parameter.put("seniorId", createSalary.seniorId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ public class CreateSalarySkipListener implements SkipListener<CreateSalary, Crea

@Override
public void onSkipInRead(Throwable t) {
log.info("μ •μ‚° μžλ™ 생성 ItemReader Skip message : {}", t.getMessage());
log.error("μ •μ‚° μžλ™ 생성 ItemReader Skip message : {}", t.getMessage());
}

@Override
public void onSkipInProcess(CreateSalary createSalary, Throwable t) {
log.info("seniorId : {} μ •μ‚° μžλ™ 생성, message : {}", createSalary.seniorId(), t.getMessage());
log.error("seniorId : {} μ •μ‚° μžλ™ 생성, message : {}", createSalary.seniorId(), t.getMessage());
slackErrorMessage.sendSlackSalaryError(createSalary.seniorId(), t);
}

@Override
public void onSkipInWrite(CreateSalary createSalary, Throwable t) {
log.info("seniorId : {} μ •μ‚° μžλ™ 생성, message : {}", createSalary.seniorId(), t.getMessage());
log.error("seniorId : {} μ •μ‚° μžλ™ 생성, message : {}", createSalary.seniorId(), t.getMessage());
slackErrorMessage.sendSlackSalaryError(createSalary.seniorId(), t);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ public Page<Senior> 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public ResponseDto<AllSeniorSearchResponse> 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<AllSeniorSearchResponse> getFieldSenior(@RequestParam String field,
@RequestParam String postgradu,
@RequestParam(required = false) Integer page) {
Expand Down

0 comments on commit aebd42e

Please sign in to comment.