feat: batch scheduler 부서별 실행 반영

dev
gitea-관리자 1 year ago
parent 525ea4f8b4
commit 0d5d5ece4e

@ -5,6 +5,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import kr.xit.batch.ens.job.SndngAcceptJobConfig; import kr.xit.batch.ens.job.SndngAcceptJobConfig;
import kr.xit.biz.common.ApiConstants; import kr.xit.biz.common.ApiConstants;
import kr.xit.biz.common.ApiConstants.SignguCode;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.core.JobParameter; import org.springframework.batch.core.JobParameter;
@ -46,17 +47,21 @@ public class SndngAcceptJobScheduler {
@Value("${app.slack-webhook.enabled:false}") @Value("${app.slack-webhook.enabled:false}")
private String isSlackEnabled; private String isSlackEnabled;
//@Scheduled(cron = "${app.batch.cron.ens.accept}") @Scheduled(cron = "${app.batch.cron.ens.accept}")
public void runJob() { public void runJob() {
Map<String, JobParameter> confMap = new HashMap<>(); Map<String, JobParameter> confMap = new HashMap<>();
confMap.put("startDate", new JobParameter(new Date())); confMap.put("startDate", new JobParameter(new Date()));
confMap.put("isSlackEnabled", new JobParameter(isSlackEnabled)); confMap.put("isSlackEnabled", new JobParameter(isSlackEnabled));
confMap.put("sndngProcessSttus", new JobParameter(ApiConstants.SndngProcessStatus.ACCEPT.getCode())); confMap.put("sndngProcessSttus", new JobParameter(ApiConstants.SndngProcessStatus.ACCEPT.getCode()));
JobParameters jobParameters = new JobParameters(confMap);
try { try {
jobLauncher.run(jobConfiguration.sndngAcceptJob(), jobParameters); for(SignguCode signguCode : SignguCode.values()) {
confMap.put("signguCode", new JobParameter(signguCode.getCode()));
confMap.put("ffnlgCode", new JobParameter(ApiConstants.FFNLN_CODE));
JobParameters jobParameters = new JobParameters(confMap);
jobLauncher.run(jobConfiguration.sndngAcceptJob(), jobParameters);
}
} catch (JobExecutionAlreadyRunningException | JobInstanceAlreadyCompleteException } catch (JobExecutionAlreadyRunningException | JobInstanceAlreadyCompleteException
| JobParametersInvalidException | org.springframework.batch.core.repository.JobRestartException e) { | JobParametersInvalidException | org.springframework.batch.core.repository.JobRestartException e) {

@ -5,6 +5,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import kr.xit.batch.ens.job.SndngCloseJobConfig; import kr.xit.batch.ens.job.SndngCloseJobConfig;
import kr.xit.biz.common.ApiConstants; import kr.xit.biz.common.ApiConstants;
import kr.xit.biz.common.ApiConstants.SignguCode;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.core.JobParameter; import org.springframework.batch.core.JobParameter;
@ -14,7 +15,6 @@ import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException; import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
import org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException; import org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
@ -52,10 +52,14 @@ public class SndngCloseJobScheduler {
confMap.put("startDate", new JobParameter(new Date())); confMap.put("startDate", new JobParameter(new Date()));
confMap.put("isSlackEnabled", new JobParameter(isSlackEnabled)); confMap.put("isSlackEnabled", new JobParameter(isSlackEnabled));
confMap.put("sndngProcessSttus", new JobParameter(ApiConstants.SndngProcessStatus.SEND_OK.getCode())); confMap.put("sndngProcessSttus", new JobParameter(ApiConstants.SndngProcessStatus.SEND_OK.getCode()));
JobParameters jobParameters = new JobParameters(confMap);
try { try {
jobLauncher.run(jobConfiguration.sndngCloseJob(), jobParameters); for(SignguCode signguCode : SignguCode.values()) {
confMap.put("signguCode", new JobParameter(signguCode.getCode()));
confMap.put("ffnlgCode", new JobParameter(ApiConstants.FFNLN_CODE));
JobParameters jobParameters = new JobParameters(confMap);
jobLauncher.run(jobConfiguration.sndngCloseJob(), jobParameters);
}
} catch (JobExecutionAlreadyRunningException | JobInstanceAlreadyCompleteException } catch (JobExecutionAlreadyRunningException | JobInstanceAlreadyCompleteException
| JobParametersInvalidException | org.springframework.batch.core.repository.JobRestartException e) { | JobParametersInvalidException | org.springframework.batch.core.repository.JobRestartException e) {

@ -5,6 +5,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import kr.xit.batch.ens.job.SndngMakeJobConfig; import kr.xit.batch.ens.job.SndngMakeJobConfig;
import kr.xit.biz.common.ApiConstants; import kr.xit.biz.common.ApiConstants;
import kr.xit.biz.common.ApiConstants.SignguCode;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.core.JobParameter; import org.springframework.batch.core.JobParameter;
@ -51,10 +52,14 @@ public class SndngMakeJobScheduler {
confMap.put("startDate", new JobParameter(new Date())); confMap.put("startDate", new JobParameter(new Date()));
confMap.put("isSlackEnabled", new JobParameter(isSlackEnabled)); confMap.put("isSlackEnabled", new JobParameter(isSlackEnabled));
confMap.put("sndngProcessSttus", new JobParameter(ApiConstants.SndngProcessStatus.ACCEPT_OK.getCode())); confMap.put("sndngProcessSttus", new JobParameter(ApiConstants.SndngProcessStatus.ACCEPT_OK.getCode()));
JobParameters jobParameters = new JobParameters(confMap);
try { try {
jobLauncher.run(jobConfiguration.sndngMakeJob(), jobParameters); for(SignguCode signguCode : SignguCode.values()) {
confMap.put("signguCode", new JobParameter(signguCode.getCode()));
confMap.put("ffnlgCode", new JobParameter(ApiConstants.FFNLN_CODE));
JobParameters jobParameters = new JobParameters(confMap);
jobLauncher.run(jobConfiguration.sndngMakeJob(), jobParameters);
}
} catch (JobExecutionAlreadyRunningException | JobInstanceAlreadyCompleteException } catch (JobExecutionAlreadyRunningException | JobInstanceAlreadyCompleteException
| JobParametersInvalidException | org.springframework.batch.core.repository.JobRestartException e) { | JobParametersInvalidException | org.springframework.batch.core.repository.JobRestartException e) {

@ -5,6 +5,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import kr.xit.batch.ens.job.SndngSnedBulksJobConfig; import kr.xit.batch.ens.job.SndngSnedBulksJobConfig;
import kr.xit.biz.common.ApiConstants; import kr.xit.biz.common.ApiConstants;
import kr.xit.biz.common.ApiConstants.SignguCode;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.core.JobParameter; import org.springframework.batch.core.JobParameter;
@ -14,7 +15,6 @@ import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException; import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
import org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException; import org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
@ -51,10 +51,14 @@ public class SndngSendBulksJobScheduler {
confMap.put("startDate", new JobParameter(new Date())); confMap.put("startDate", new JobParameter(new Date()));
confMap.put("isSlackEnabled", new JobParameter(isSlackEnabled)); confMap.put("isSlackEnabled", new JobParameter(isSlackEnabled));
confMap.put("sndngProcessSttus", new JobParameter(ApiConstants.SndngProcessStatus.MAKE_OK.getCode())); confMap.put("sndngProcessSttus", new JobParameter(ApiConstants.SndngProcessStatus.MAKE_OK.getCode()));
JobParameters jobParameters = new JobParameters(confMap);
try { try {
jobLauncher.run(jobConfiguration.sndngSendBulksJob(), jobParameters); for(SignguCode signguCode : SignguCode.values()) {
confMap.put("signguCode", new JobParameter(signguCode.getCode()));
confMap.put("ffnlgCode", new JobParameter(ApiConstants.FFNLN_CODE));
JobParameters jobParameters = new JobParameters(confMap);
jobLauncher.run(jobConfiguration.sndngSendBulksJob(), jobParameters);
}
} catch (JobExecutionAlreadyRunningException | JobInstanceAlreadyCompleteException } catch (JobExecutionAlreadyRunningException | JobInstanceAlreadyCompleteException
| JobParametersInvalidException | org.springframework.batch.core.repository.JobRestartException e) { | JobParametersInvalidException | org.springframework.batch.core.repository.JobRestartException e) {

@ -5,6 +5,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import kr.xit.batch.ens.job.SndngStatusBulksJobConfig; import kr.xit.batch.ens.job.SndngStatusBulksJobConfig;
import kr.xit.biz.common.ApiConstants; import kr.xit.biz.common.ApiConstants;
import kr.xit.biz.common.ApiConstants.SignguCode;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.core.JobParameter; import org.springframework.batch.core.JobParameter;
@ -14,7 +15,6 @@ import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException; import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
import org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException; import org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
@ -51,10 +51,14 @@ public class SndngStatusBulksJobScheduler {
confMap.put("startDate", new JobParameter(new Date())); confMap.put("startDate", new JobParameter(new Date()));
confMap.put("isSlackEnabled", new JobParameter(isSlackEnabled)); confMap.put("isSlackEnabled", new JobParameter(isSlackEnabled));
confMap.put("sndngProcessSttus", new JobParameter(ApiConstants.SndngProcessStatus.SEND_OK.getCode())); confMap.put("sndngProcessSttus", new JobParameter(ApiConstants.SndngProcessStatus.SEND_OK.getCode()));
JobParameters jobParameters = new JobParameters(confMap);
try { try {
jobLauncher.run(jobConfiguration.sndngStatusBulksJob(), jobParameters); for(SignguCode signguCode : SignguCode.values()) {
confMap.put("signguCode", new JobParameter(signguCode.getCode()));
confMap.put("ffnlgCode", new JobParameter(ApiConstants.FFNLN_CODE));
JobParameters jobParameters = new JobParameters(confMap);
jobLauncher.run(jobConfiguration.sndngStatusBulksJob(), jobParameters);
}
} catch (JobExecutionAlreadyRunningException | JobInstanceAlreadyCompleteException } catch (JobExecutionAlreadyRunningException | JobInstanceAlreadyCompleteException
| JobParametersInvalidException | org.springframework.batch.core.repository.JobRestartException e) { | JobParametersInvalidException | org.springframework.batch.core.repository.JobRestartException e) {

Loading…
Cancel
Save