Skip to content

Commit

Permalink
Merge pull request #311 from WE-ARE-RACCOONS/RAC-419
Browse files Browse the repository at this point in the history
RAC-419 fix : 배치 μˆ˜λ™ μ‹€ν–‰μ‹œ μŠ¬λž™ μ•Œλ¦Ό μ‚­μ œ
  • Loading branch information
ywj9811 authored Aug 17, 2024
2 parents 5dcc64b + e4be6f5 commit 37d2ca8
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class AdminBatchUseCase {

public void startSalaryBatch() {
try {
jobSchedulerConfig.launchSalaryJob();
jobSchedulerConfig.launchSalaryJobWithAdmin();
} catch (Exception e) {
log.error("Create Salary Batch Exception : {}", e.getStackTrace());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ public Job salaryJob() {
.build();
}

@Bean(name = "salaryJobWithAdmin")
public Job salaryJobWithAdmin() {
return new JobBuilder("salaryJobWithAdmin", jobRepository)
.start(createSalaryStep())
.build();
}

@Bean(name = "sendSlackStep")
public Step sendSlackStep() {
return new StepBuilder("sendSlackStep", jobRepository)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public class JobSchedulerConfig {
private final Job doneJob;
@Qualifier("salaryJob")
private final Job salaryJob;
@Qualifier("salaryJobWithAdmin")
private final Job salaryJobWithAdmin;

@Scheduled(cron = "0 59 23 * * *", zone = "Asia/Seoul")
public void launchCancelJob() throws JobInstanceAlreadyCompleteException, JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException {
Expand All @@ -36,19 +38,26 @@ public void launchCancelJob() throws JobInstanceAlreadyCompleteException, JobExe
jobLauncher.run(cancelJob, jobParameters);
}

@Scheduled(cron = "0 59 23 * * *", zone = "Asia/Seoul")
@Scheduled(cron = "0 58 23 * * *", zone = "Asia/Seoul")
public void launchDoneJob() throws JobInstanceAlreadyCompleteException, JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException {
JobParameters jobParameters = new JobParametersBuilder()
.addLocalDateTime("date", LocalDateTime.now())
.toJobParameters();
jobLauncher.run(doneJob, jobParameters);
}

@Scheduled(cron = "0 0 0 * * 4", zone = "Asia/Seoul")
@Scheduled(cron = "0 10 0 * * 4", zone = "Asia/Seoul")
public void launchSalaryJob() throws JobInstanceAlreadyCompleteException, JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException {
JobParameters jobParameters = new JobParametersBuilder()
.addLocalDateTime("date", LocalDateTime.now())
.toJobParameters();
jobLauncher.run(salaryJob, jobParameters);
}

public void launchSalaryJobWithAdmin() throws JobInstanceAlreadyCompleteException, JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException {
JobParameters jobParameters = new JobParametersBuilder()
.addLocalDateTime("date", LocalDateTime.now())
.toJobParameters();
jobLauncher.run(salaryJobWithAdmin, jobParameters);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@
import com.postgraduate.domain.user.user.exception.UserNotFoundException;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@RequiredArgsConstructor
@Transactional
@Slf4j
public class KakaoSignInUseCase implements SignInUseCase {
private final KakaoAccessTokenUseCase kakaoTokenUseCase;
private final UserGetService userGetService;
Expand All @@ -41,7 +39,6 @@ public AuthUserResponse getDevUser(CodeRequest codeRequest) {
@Override
public AuthUserResponse getUserWithToken(TokenRequest request) {
KakaoUserInfoResponse userInfo = kakaoTokenUseCase.getUserInfo(request.accessToken());
log.info("user : {}", userInfo.id());
return getAuthUserResponse(userInfo);
}

Expand All @@ -50,7 +47,6 @@ private AuthUserResponse getAuthUserResponse(KakaoUserInfoResponse userInfo) {
Long socialId = userInfo.id();
try {
User user = userGetService.bySocialId(socialId);
log.info("check user {} ", user.getUserId());
checkDelete(user);
return AuthMapper.mapToAuthUser(user, socialId);
} catch (UserNotFoundException e) {
Expand Down

0 comments on commit 37d2ca8

Please sign in to comment.