-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #290 from WE-ARE-RACCOONS/RAC-401
- Loading branch information
Showing
8 changed files
with
165 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
src/main/java/com/postgraduate/admin/application/usecase/AdminBatchUseCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.postgraduate.admin.application.usecase; | ||
|
||
import com.postgraduate.batch.scheduler.JobSchedulerConfig; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
@Slf4j | ||
@RequiredArgsConstructor | ||
public class AdminBatchUseCase { | ||
private final JobSchedulerConfig jobSchedulerConfig; | ||
|
||
public void startSalaryBatch() { | ||
try { | ||
jobSchedulerConfig.launchSalaryJob(); | ||
} catch (Exception e) { | ||
log.error("Create Salary Batch Exception : {}", e.getStackTrace()); | ||
} | ||
} | ||
|
||
public void startMentoringDoneBatch() { | ||
try { | ||
jobSchedulerConfig.launchDoneJob(); | ||
} catch (Exception e) { | ||
log.error("Create Salary Batch Exception : {}", e.getStackTrace()); | ||
} | ||
} | ||
|
||
public void startMentoringCancelBatch() { | ||
try { | ||
jobSchedulerConfig.launchCancelJob(); | ||
} catch (Exception e) { | ||
log.error("Create Salary Batch Exception : {}", e.getStackTrace()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/main/java/com/postgraduate/batch/cancel/CancelMentoringSkipListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.postgraduate.batch.cancel; | ||
|
||
import com.postgraduate.domain.mentoring.domain.entity.Mentoring; | ||
import com.postgraduate.global.slack.SlackErrorMessage; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.batch.core.SkipListener; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
@Slf4j | ||
public class CancelMentoringSkipListener implements SkipListener<Mentoring, CancelMentoring> { | ||
private final SlackErrorMessage slackErrorMessage; | ||
|
||
@Override | ||
public void onSkipInRead(Throwable t) { | ||
log.error("멘토링 자동 완료 ItemReader Skip message : {}", t.getMessage()); | ||
} | ||
|
||
@Override | ||
public void onSkipInProcess(Mentoring mentoring, Throwable t) { | ||
log.error("mentoringId : {} 자동 취소 실패, message : {}", mentoring.getMentoringId(), t.getMessage()); | ||
slackErrorMessage.sendSlackMentoringError(mentoring.getMentoringId(), t); | ||
} | ||
|
||
@Override | ||
public void onSkipInWrite(CancelMentoring cancelMentoring, Throwable t) { | ||
log.error("mentoringId : {} 자동 취소 실패, message : {}", cancelMentoring.mentoringId(), t.getMessage()); | ||
slackErrorMessage.sendSlackMentoringError(cancelMentoring.mentoringId(), t); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/main/java/com/postgraduate/batch/salary/CreateSalaryStepListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.postgraduate.batch.salary; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.batch.core.*; | ||
|
||
@Slf4j | ||
public class CreateSalaryStepListener implements StepExecutionListener { | ||
@Override | ||
public void beforeStep(StepExecution stepExecution) { | ||
log.info("createSalaryStep Start"); | ||
} | ||
|
||
@Override | ||
public ExitStatus afterStep(StepExecution stepExecution) { | ||
log.info("salary total read : {} and total write : {}", stepExecution.getReadCount(), stepExecution.getWriteCount()); | ||
return stepExecution.getExitStatus(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<!DOCTYPE html> | ||
<html xmlns:th="http://www.thymeleaf.org"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<link th:href="@{/css/bootstrap.min.css}" href="css/bootstrap.min.css" rel="stylesheet"> | ||
<style> | ||
.outer { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100%; | ||
width: 100%; | ||
padding-top: 30px; | ||
} | ||
|
||
.inner { | ||
text-align: center; | ||
} | ||
|
||
label, input { | ||
display: block; | ||
margin: 0 auto 10px; | ||
} | ||
|
||
input { | ||
margin-top: 10px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="outer"> | ||
<div class="inner"> | ||
<label><h1>정산 자동 생성 배치 재시도</h1></label> | ||
<button th:onclick="goToPost('정산 자동 생성 배치를 재시도 하시겠습니까?', '/adminServer/batch/salary')"><h3>정산 자동 생성</h3></button> | ||
<label><h1>멘토링 자동 완료 배치 재시도</h1></label> | ||
<button th:onclick="goToPost('정산 자동 생성 배치를 재시도 하시겠습니까?', '/adminServer/batch/mentoring/done')"><h3>멘토링 자동 완료</h3></button> | ||
<label><h1>멘토링 자동 취소 배치 재시도</h1></label> | ||
<button th:onclick="goToPost('정산 자동 생성 배치를 재시도 하시겠습니까?', '/adminServer/batch/mentoring/cancel')"><h3>멘토링 자동 취소</h3></button> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters