refact: mens-api에서 batch 제거

dev
gitea-관리자 1 year ago
parent 5bb9354b43
commit fbbbf55be1

@ -44,20 +44,10 @@ public class SpringDocsApiConfig {
.build(); .build();
} }
@Bean
public GroupedOpenApi kakaopayEltrcDocBatch() {
return GroupedOpenApi.builder()
.group("3. 전자고지 통합발송 연계 Batch WEB")
.pathsToMatch(
"/api/batch/v1/**"
)
.build();
}
@Bean @Bean
public GroupedOpenApi bizDoc() { public GroupedOpenApi bizDoc() {
return GroupedOpenApi.builder() return GroupedOpenApi.builder()
.group("4. 전자고지 통합발송 연계 API") .group("3. 전자고지 통합발송 연계 API")
.pathsToMatch( .pathsToMatch(
"/api/ens/v1/**" "/api/ens/v1/**"
) )

@ -1,113 +0,0 @@
package kr.xit.ens.support.batch.job;
import kr.xit.biz.ens.service.IEnsCctvFileService;
import kr.xit.core.biz.batch.CustomRunIdIncrementer;
import kr.xit.core.biz.batch.listener.CustomJobListener;
import kr.xit.core.biz.batch.listener.CustomStepListener;
import kr.xit.core.biz.batch.listener.NoWorkFoundStepListener;
import kr.xit.core.biz.batch.service.IBatchCmmService;
import kr.xit.core.biz.batch.task.BatchEndTasklet;
import kr.xit.core.biz.batch.task.BatchFailEndTasklet;
import kr.xit.core.biz.batch.task.BatchStartTasklet;
import kr.xit.ens.support.batch.task.EnsCctvAcceptTasklet;
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.configuration.annotation.JobBuilderFactory;
import org.springframework.batch.core.configuration.annotation.JobScope;
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* <pre>
* description : CCTV accept
*
* packageName : kr.xit.ens.support.batch.job
* fileName : EnsCctvAcceptJobConfg
* author : seojh
* date : 2023-07-17
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-07-17 seojh
*
* </pre>
*/
@Slf4j
@RequiredArgsConstructor
@Configuration
public class EnsCctvAcceptJobConfg {
private static final String JOB_NAME = "EnsCctvAcceptJob";
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
private final JobBuilderFactory jobBuilderFactory;
private final StepBuilderFactory stepBuilderFactory;
private final IBatchCmmService lockService;
private final IEnsCctvFileService service;
@Bean(name = JOB_NAME)
public Job ensCctvAcceptJob() {
return jobBuilderFactory.get(JOB_NAME)
.incrementer(new CustomRunIdIncrementer())
.listener(new CustomJobListener())
.listener(new CustomStepListener())
.listener(new NoWorkFoundStepListener())
// JOB 시작
// start() 결과가 FAILED 인경우 종료
.start(start())
.on("FAILED")
.end()
// start()의 결과로 부터 FAILED를 제외한 모든 경우 to() 실행
//.from(start())
.on("*")
.to(execution())
.on("FAILED")
.to(fail())
.from(execution())
// to() 실행 결과와 상관 없이 end() 실행
.on("*")
.to(end())
// JOB 종료
.end()
.build();
}
@Bean(name = JOB_NAME + "_step")
public Step execution() {
return stepBuilderFactory.get(JOB_NAME + "_step")
.tasklet(new EnsCctvAcceptTasklet(service))
.build();
}
@JobScope
@Bean(name = JOB_NAME + "_start_step")
protected Step start() {
return stepBuilderFactory.get("Job_Locking")
.tasklet(new BatchStartTasklet(lockService))
.build();
}
@JobScope
@Bean(name = JOB_NAME + "_end_step")
protected Step end() {
return stepBuilderFactory.get("Lock_Release")
.tasklet(new BatchEndTasklet(lockService))
.build();
}
@JobScope
@Bean(name = JOB_NAME + "_fail_step")
protected Step fail() {
return stepBuilderFactory.get("Lock_Release")
.tasklet(new BatchFailEndTasklet(lockService))
.build();
}
}

@ -1,113 +0,0 @@
package kr.xit.ens.support.batch.job;
import kr.xit.biz.ens.service.IEnsCctvFileService;
import kr.xit.core.biz.batch.CustomRunIdIncrementer;
import kr.xit.core.biz.batch.listener.CustomJobListener;
import kr.xit.core.biz.batch.listener.CustomStepListener;
import kr.xit.core.biz.batch.listener.NoWorkFoundStepListener;
import kr.xit.core.biz.batch.service.IBatchCmmService;
import kr.xit.core.biz.batch.task.BatchEndTasklet;
import kr.xit.core.biz.batch.task.BatchFailEndTasklet;
import kr.xit.core.biz.batch.task.BatchStartTasklet;
import kr.xit.ens.support.batch.task.EnsCctvFileTasklet;
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.configuration.annotation.JobBuilderFactory;
import org.springframework.batch.core.configuration.annotation.JobScope;
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* <pre>
* description : CCTV ()
*
* packageName : kr.xit.ens.support.batch.job
* fileName : EnsCctvFileJobConfg
* author : seojh
* date : 2023-07-17
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-07-17 seojh
*
* </pre>
*/
@Slf4j
@RequiredArgsConstructor
@Configuration
public class EnsCctvFileJobConfg {
private static final String JOB_NAME = "EnsCctvFileJob";
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
private final JobBuilderFactory jobBuilderFactory;
private final StepBuilderFactory stepBuilderFactory;
private final IBatchCmmService lockService;
private final IEnsCctvFileService service;
@Bean(name = JOB_NAME)
public Job ensCctvFileJob() {
return jobBuilderFactory.get(JOB_NAME)
.incrementer(new CustomRunIdIncrementer())
.listener(new CustomJobListener())
.listener(new CustomStepListener())
.listener(new NoWorkFoundStepListener())
// JOB 시작
// start() 결과가 FAILED 인경우 종료
.start(start())
.on("FAILED")
.end()
// start()의 결과로 부터 FAILED를 제외한 모든 경우 to() 실행
//.from(start())
.on("*")
.to(execution())
.on("FAILED")
.to(fail())
.from(execution())
// to() 실행 결과와 상관 없이 end() 실행
.on("*")
.to(end())
// JOB 종료
.end()
.build();
}
@Bean(name = JOB_NAME + "_step")
public Step execution() {
return stepBuilderFactory.get(JOB_NAME + "_step")
.tasklet(new EnsCctvFileTasklet(service))
.build();
}
@JobScope
@Bean(name = JOB_NAME + "_start_step")
protected Step start() {
return stepBuilderFactory.get("Job_Locking")
.tasklet(new BatchStartTasklet(lockService))
.build();
}
@JobScope
@Bean(name = JOB_NAME + "_end_step")
protected Step end() {
return stepBuilderFactory.get("Lock_Release")
.tasklet(new BatchEndTasklet(lockService))
.build();
}
@JobScope
@Bean(name = JOB_NAME + "_fail_step")
protected Step fail() {
return stepBuilderFactory.get("Lock_Release")
.tasklet(new BatchFailEndTasklet(lockService))
.build();
}
}

@ -1,114 +0,0 @@
package kr.xit.ens.support.batch.job;
import kr.xit.biz.pni.service.IPniCctvFileService;
import kr.xit.core.biz.batch.CustomRunIdIncrementer;
import kr.xit.core.biz.batch.listener.CustomJobListener;
import kr.xit.core.biz.batch.listener.CustomStepListener;
import kr.xit.core.biz.batch.listener.NoWorkFoundStepListener;
import kr.xit.core.biz.batch.service.IBatchCmmService;
import kr.xit.core.biz.batch.task.BatchEndTasklet;
import kr.xit.core.biz.batch.task.BatchFailEndTasklet;
import kr.xit.core.biz.batch.task.BatchStartTasklet;
import kr.xit.ens.support.batch.task.PniCctvAcceptTasklet;
import kr.xit.ens.support.batch.task.PniCctvFileTasklet;
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.configuration.annotation.JobBuilderFactory;
import org.springframework.batch.core.configuration.annotation.JobScope;
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* <pre>
* description : CCTV accept
*
* packageName : kr.xit.ens.support.batch.job
* fileName : PniCctvAcceptJobConfg
* author : limju
* date : 2023-07-11
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-07-11 limju
*
* </pre>
*/
@Slf4j
@RequiredArgsConstructor
@Configuration
public class PniCctvAcceptJobConfg {
private static final String JOB_NAME = "PniCctvAcceptJob";
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
private final JobBuilderFactory jobBuilderFactory;
private final StepBuilderFactory stepBuilderFactory;
private final IBatchCmmService lockService;
private final IPniCctvFileService service;
@Bean(name = JOB_NAME)
public Job pniCctvAcceptJob() {
return jobBuilderFactory.get(JOB_NAME)
.incrementer(new CustomRunIdIncrementer())
.listener(new CustomJobListener())
.listener(new CustomStepListener())
.listener(new NoWorkFoundStepListener())
// JOB 시작
// start() 결과가 FAILED 인경우 종료
.start(start())
.on("FAILED")
.end()
// start()의 결과로 부터 FAILED를 제외한 모든 경우 to() 실행
//.from(start())
.on("*")
.to(execution())
.on("FAILED")
.to(fail())
.from(execution())
// to() 실행 결과와 상관 없이 end() 실행
.on("*")
.to(end())
// JOB 종료
.end()
.build();
}
@Bean(name = JOB_NAME + "_step")
public Step execution() {
return stepBuilderFactory.get(JOB_NAME + "_step")
.tasklet(new PniCctvAcceptTasklet(service))
.build();
}
@JobScope
@Bean(name = JOB_NAME + "_start_step")
protected Step start() {
return stepBuilderFactory.get("Job_Locking")
.tasklet(new BatchStartTasklet(lockService))
.build();
}
@JobScope
@Bean(name = JOB_NAME + "_end_step")
protected Step end() {
return stepBuilderFactory.get("Lock_Release")
.tasklet(new BatchEndTasklet(lockService))
.build();
}
@JobScope
@Bean(name = JOB_NAME + "_fail_step")
protected Step fail() {
return stepBuilderFactory.get("Lock_Release")
.tasklet(new BatchFailEndTasklet(lockService))
.build();
}
}

@ -1,113 +0,0 @@
package kr.xit.ens.support.batch.job;
import kr.xit.biz.pni.service.IPniCctvFileService;
import kr.xit.core.biz.batch.CustomRunIdIncrementer;
import kr.xit.core.biz.batch.listener.CustomJobListener;
import kr.xit.core.biz.batch.listener.CustomStepListener;
import kr.xit.core.biz.batch.listener.NoWorkFoundStepListener;
import kr.xit.core.biz.batch.service.IBatchCmmService;
import kr.xit.core.biz.batch.task.BatchEndTasklet;
import kr.xit.core.biz.batch.task.BatchFailEndTasklet;
import kr.xit.core.biz.batch.task.BatchStartTasklet;
import kr.xit.ens.support.batch.task.PniCctvFileTasklet;
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.configuration.annotation.JobBuilderFactory;
import org.springframework.batch.core.configuration.annotation.JobScope;
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* <pre>
* description : CCTV ()
*
* packageName : kr.xit.ens.support.batch.job
* fileName : PniCctvFileJobConfg
* author : limju
* date : 2023-07-10
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-07-10 limju
*
* </pre>
*/
@Slf4j
@RequiredArgsConstructor
@Configuration
public class PniCctvFileJobConfg {
private static final String JOB_NAME = "PniCctvFileJob";
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
private final JobBuilderFactory jobBuilderFactory;
private final StepBuilderFactory stepBuilderFactory;
private final IBatchCmmService lockService;
private final IPniCctvFileService service;
@Bean(name = JOB_NAME)
public Job pniCctvFileJob() {
return jobBuilderFactory.get(JOB_NAME)
.incrementer(new CustomRunIdIncrementer())
.listener(new CustomJobListener())
.listener(new CustomStepListener())
.listener(new NoWorkFoundStepListener())
// JOB 시작
// start() 결과가 FAILED 인경우 종료
.start(start())
.on("FAILED")
.end()
// start()의 결과로 부터 FAILED를 제외한 모든 경우 to() 실행
//.from(start())
.on("*")
.to(execution())
.on("FAILED")
.to(fail())
.from(execution())
// to() 실행 결과와 상관 없이 end() 실행
.on("*")
.to(end())
// JOB 종료
.end()
.build();
}
@Bean(name = JOB_NAME + "_step")
public Step execution() {
return stepBuilderFactory.get(JOB_NAME + "_step")
.tasklet(new PniCctvFileTasklet(service))
.build();
}
@JobScope
@Bean(name = JOB_NAME + "_start_step")
protected Step start() {
return stepBuilderFactory.get("Job_Locking")
.tasklet(new BatchStartTasklet(lockService))
.build();
}
@JobScope
@Bean(name = JOB_NAME + "_end_step")
protected Step end() {
return stepBuilderFactory.get("Lock_Release")
.tasklet(new BatchEndTasklet(lockService))
.build();
}
@JobScope
@Bean(name = JOB_NAME + "_fail_step")
protected Step fail() {
return stepBuilderFactory.get("Lock_Release")
.tasklet(new BatchFailEndTasklet(lockService))
.build();
}
}

@ -1,113 +0,0 @@
package kr.xit.ens.support.batch.job;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
import org.springframework.batch.core.configuration.annotation.JobScope;
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import kr.xit.biz.ens.service.ISendMessageLinkService;
import kr.xit.core.biz.batch.CustomRunIdIncrementer;
import kr.xit.core.biz.batch.listener.CustomJobListener;
import kr.xit.core.biz.batch.listener.CustomStepListener;
import kr.xit.core.biz.batch.service.IBatchCmmService;
import kr.xit.core.biz.batch.task.BatchEndTasklet;
import kr.xit.core.biz.batch.task.BatchFailEndTasklet;
import kr.xit.core.biz.batch.task.BatchStartTasklet;
import kr.xit.ens.support.batch.task.SndngAcceptTasklet;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
/**
* <pre>
* description : -
*
* packageName : kr.xit.ens.support.batch.job
* fileName : SndngAcceptJobConfig
* author : limju
* date : 2023-06-12
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-06-12 limju
*
* </pre>
*/
@Slf4j
@RequiredArgsConstructor
@Configuration
public class SndngAcceptJobConfig {
private static final String JOB_NAME = "SndngAcceptJob";
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
private final JobBuilderFactory jobBuilderFactory;
private final StepBuilderFactory stepBuilderFactory;
private final IBatchCmmService lockService;
private final ISendMessageLinkService linkService;
@Bean(name = JOB_NAME)
public Job sndngAcceptJob() {
return jobBuilderFactory.get(JOB_NAME)
.incrementer(new CustomRunIdIncrementer())
.listener(new CustomJobListener())
.listener(new CustomStepListener())
//.listener(new NoWorkFoundStepListener())
// JOB 시작
// start() 결과가 FAILED 인경우 종료
.start(start())
.on("FAILED")
.end()
// start()의 결과로 부터 FAILED를 제외한 모든 경우 to() 실행
//.from(start())
.on("*")
.to(execution())
.on("FAILED")
.to(fail())
.from(execution())
// to() 실행 결과와 상관 없이 end() 실행
.on("*")
.to(end())
// JOB 종료
.end()
.build();
}
@Bean(name = JOB_NAME + "_step")
public Step execution() {
return stepBuilderFactory.get(JOB_NAME + "_step")
.tasklet(new SndngAcceptTasklet(linkService))
.build();
}
@JobScope
@Bean(name = JOB_NAME + "_start_step")
protected Step start() {
return stepBuilderFactory.get("Job_Locking")
.tasklet(new BatchStartTasklet(lockService))
.build();
}
@JobScope
@Bean(name = JOB_NAME + "_end_step")
protected Step end() {
return stepBuilderFactory.get("Lock_Release")
.tasklet(new BatchEndTasklet(lockService))
.build();
}
@JobScope
@Bean(name = JOB_NAME + "_fail_step")
protected Step fail() {
return stepBuilderFactory.get("Lock_Release")
.tasklet(new BatchFailEndTasklet(lockService))
.build();
}
}

@ -1,114 +0,0 @@
package kr.xit.ens.support.batch.job;
import kr.xit.biz.ens.service.ISendMessageLinkService;
import kr.xit.core.biz.batch.CustomRunIdIncrementer;
import kr.xit.core.biz.batch.listener.CustomJobListener;
import kr.xit.core.biz.batch.listener.CustomStepListener;
import kr.xit.core.biz.batch.listener.NoWorkFoundStepListener;
import kr.xit.core.biz.batch.service.IBatchCmmService;
import kr.xit.core.biz.batch.task.BatchEndTasklet;
import kr.xit.core.biz.batch.task.BatchFailEndTasklet;
import kr.xit.core.biz.batch.task.BatchStartTasklet;
import kr.xit.ens.support.batch.task.SndngCloseTasklet;
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.configuration.annotation.JobBuilderFactory;
import org.springframework.batch.core.configuration.annotation.JobScope;
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
/**
* <pre>
* description :
*
* packageName : kr.xit.ens.support.batch.job
* fileName : SndngCloseJobConfig
* author : seojh
* date : 2023-06-14
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-06-14 seojh
*
* </pre>
*/
@Slf4j
@RequiredArgsConstructor
@Configuration
public class SndngCloseJobConfig {
private static final String JOB_NAME = "SndngCloseJob";
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
private final JobBuilderFactory jobBuilderFactory;
private final StepBuilderFactory stepBuilderFactory;
private final IBatchCmmService lockService;
private final ISendMessageLinkService linkService;
@Bean(name = JOB_NAME)
public Job sndngCloseJob() {
return jobBuilderFactory.get(JOB_NAME)
.incrementer(new CustomRunIdIncrementer())
.listener(new CustomJobListener())
.listener(new CustomStepListener())
.listener(new NoWorkFoundStepListener())
// JOB 시작
// start() 결과가 FAILED 인경우 종료
.start(start())
.on("FAILED")
.end()
// start()의 결과로 부터 FAILED를 제외한 모든 경우 to() 실행
//.from(start())
.on("*")
.to(execution())
.on("FAILED")
.to(fail())
.from(execution())
// to() 실행 결과와 상관 없이 end() 실행
.on("*")
.to(end())
// JOB 종료
.end()
.build();
}
@Bean(name = JOB_NAME + "_step")
public Step execution() {
return stepBuilderFactory.get(JOB_NAME + "_step")
.tasklet(new SndngCloseTasklet(linkService))
.build();
}
@JobScope
@Bean(name = JOB_NAME + "_start_step")
protected Step start() {
return stepBuilderFactory.get("Job_Locking")
.tasklet(new BatchStartTasklet(lockService))
.build();
}
@JobScope
@Bean(name = JOB_NAME + "_end_step")
protected Step end() {
return stepBuilderFactory.get("Lock_Release")
.tasklet(new BatchEndTasklet(lockService))
.build();
}
@JobScope
@Bean(name = JOB_NAME + "_fail_step")
protected Step fail() {
return stepBuilderFactory.get("Lock_Release")
.tasklet(new BatchFailEndTasklet(lockService))
.build();
}
}

@ -1,114 +0,0 @@
package kr.xit.ens.support.batch.job;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
import org.springframework.batch.core.configuration.annotation.JobScope;
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import kr.xit.biz.ens.service.ISendMessageLinkService;
import kr.xit.core.biz.batch.CustomRunIdIncrementer;
import kr.xit.core.biz.batch.listener.CustomJobListener;
import kr.xit.core.biz.batch.listener.CustomStepListener;
import kr.xit.core.biz.batch.listener.NoWorkFoundStepListener;
import kr.xit.core.biz.batch.service.IBatchCmmService;
import kr.xit.core.biz.batch.task.BatchEndTasklet;
import kr.xit.core.biz.batch.task.BatchFailEndTasklet;
import kr.xit.core.biz.batch.task.BatchStartTasklet;
import kr.xit.ens.support.batch.task.SndngMakeTasklet;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
/**
* <pre>
* description : -
*
* packageName : kr.xit.ens.support.batch.job
* fileName : SndngMakeJobConfig
* author : limju
* date : 2023-06-12
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-06-12 limju
*
* </pre>
*/
@Slf4j
@RequiredArgsConstructor
@Configuration
public class SndngMakeJobConfig {
private static final String JOB_NAME = "SndngMakeJob";
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
private final JobBuilderFactory jobBuilderFactory;
private final StepBuilderFactory stepBuilderFactory;
private final IBatchCmmService lockService;
private final ISendMessageLinkService linkService;
@Bean(name = JOB_NAME)
public Job sndngMakeJob() {
return jobBuilderFactory.get(JOB_NAME)
.incrementer(new CustomRunIdIncrementer())
.listener(new CustomJobListener())
.listener(new CustomStepListener())
.listener(new NoWorkFoundStepListener())
// JOB 시작
// start() 결과가 FAILED 인경우 종료
.start(start())
.on("FAILED")
.end()
// start()의 결과로 부터 FAILED를 제외한 모든 경우 to() 실행
.from(start())
.on("*")
.to(execution())
.on("FAILED")
.to(fail())
.from(execution())
// to() 실행 결과와 상관 없이 end() 실행
.on("*")
.to(end())
// JOB 종료
.end()
.build();
}
@Bean(name = JOB_NAME + "_step")
public Step execution() {
return stepBuilderFactory.get(JOB_NAME + "_step")
.tasklet(new SndngMakeTasklet(linkService))
.build();
}
@JobScope
@Bean(name = JOB_NAME + "_start_step")
protected Step start() {
return stepBuilderFactory.get("Job_Locking")
.tasklet(new BatchStartTasklet(lockService))
.build();
}
@JobScope
@Bean(name = JOB_NAME + "_end_step")
protected Step end() {
return stepBuilderFactory.get("Lock_Release")
.tasklet(new BatchEndTasklet(lockService))
.build();
}
@JobScope
@Bean(name = JOB_NAME + "_fail_step")
protected Step fail() {
return stepBuilderFactory.get("Lock_Release")
.tasklet(new BatchFailEndTasklet(lockService))
.build();
}
}

@ -1,114 +0,0 @@
package kr.xit.ens.support.batch.job;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
import org.springframework.batch.core.configuration.annotation.JobScope;
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import kr.xit.biz.ens.service.ISendMessageLinkService;
import kr.xit.core.biz.batch.CustomRunIdIncrementer;
import kr.xit.core.biz.batch.listener.CustomJobListener;
import kr.xit.core.biz.batch.listener.CustomStepListener;
import kr.xit.core.biz.batch.listener.NoWorkFoundStepListener;
import kr.xit.core.biz.batch.service.IBatchCmmService;
import kr.xit.core.biz.batch.task.BatchEndTasklet;
import kr.xit.core.biz.batch.task.BatchFailEndTasklet;
import kr.xit.core.biz.batch.task.BatchStartTasklet;
import kr.xit.ens.support.batch.task.SndngSendBulksTasklet;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
/**
* <pre>
* description : -
*
* packageName : kr.xit.ens.support.batch.job
* fileName : SndngSnedBulksJobConfig
* author : limju
* date : 2023-06-12
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-06-12 limju
*
* </pre>
*/
@Slf4j
@RequiredArgsConstructor
@Configuration
public class SndngSnedBulksJobConfig {
private static final String JOB_NAME = "SndngSendBulksJob";
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
private final JobBuilderFactory jobBuilderFactory;
private final StepBuilderFactory stepBuilderFactory;
private final IBatchCmmService lockService;
private final ISendMessageLinkService linkService;
@Bean(name = JOB_NAME)
public Job sndngSendBulksJob() {
return jobBuilderFactory.get(JOB_NAME)
.incrementer(new CustomRunIdIncrementer())
.listener(new CustomJobListener())
.listener(new CustomStepListener())
.listener(new NoWorkFoundStepListener())
// JOB 시작
// start() 결과가 FAILED 인경우 종료
.start(start())
.on("FAILED")
.end()
// start()의 결과로 부터 FAILED를 제외한 모든 경우 to() 실행
//.from(start())
.on("*")
.to(execution())
.on("FAILED")
.to(fail())
.from(execution())
// to() 실행 결과와 상관 없이 end() 실행
.on("*")
.to(end())
// JOB 종료
.end()
.build();
}
@Bean(name = JOB_NAME + "_step")
public Step execution() {
return stepBuilderFactory.get(JOB_NAME + "_step")
.tasklet(new SndngSendBulksTasklet(linkService))
.build();
}
@JobScope
@Bean(name = JOB_NAME + "_start_step")
protected Step start() {
return stepBuilderFactory.get("Job_Locking")
.tasklet(new BatchStartTasklet(lockService))
.build();
}
@JobScope
@Bean(name = JOB_NAME + "_end_step")
protected Step end() {
return stepBuilderFactory.get("Lock_Release")
.tasklet(new BatchEndTasklet(lockService))
.build();
}
@JobScope
@Bean(name = JOB_NAME + "_fail_step")
protected Step fail() {
return stepBuilderFactory.get("Lock_Release")
.tasklet(new BatchFailEndTasklet(lockService))
.build();
}
}

@ -1,114 +0,0 @@
package kr.xit.ens.support.batch.job;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
import org.springframework.batch.core.configuration.annotation.JobScope;
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import kr.xit.biz.ens.service.ISendMessageLinkService;
import kr.xit.core.biz.batch.CustomRunIdIncrementer;
import kr.xit.core.biz.batch.listener.CustomJobListener;
import kr.xit.core.biz.batch.listener.CustomStepListener;
import kr.xit.core.biz.batch.listener.NoWorkFoundStepListener;
import kr.xit.core.biz.batch.service.IBatchCmmService;
import kr.xit.core.biz.batch.task.BatchEndTasklet;
import kr.xit.core.biz.batch.task.BatchFailEndTasklet;
import kr.xit.core.biz.batch.task.BatchStartTasklet;
import kr.xit.ens.support.batch.task.SndngStatusBulksTasklet;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
/**
* <pre>
* description : -
*
* packageName : kr.xit.ens.support.batch.job
* fileName : SndngStatusBulksJobConfig
* author : limju
* date : 2023-06-13
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-06-13 limju
*
* </pre>
*/
@Slf4j
@RequiredArgsConstructor
@Configuration
public class SndngStatusBulksJobConfig {
private static final String JOB_NAME = "SndngStatusBulksJob";
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
private final JobBuilderFactory jobBuilderFactory;
private final StepBuilderFactory stepBuilderFactory;
private final IBatchCmmService lockService;
private final ISendMessageLinkService linkService;
@Bean(name = JOB_NAME)
public Job sndngStatusBulksJob() {
return jobBuilderFactory.get(JOB_NAME)
.incrementer(new CustomRunIdIncrementer())
.listener(new CustomJobListener())
.listener(new CustomStepListener())
.listener(new NoWorkFoundStepListener())
// JOB 시작
// start() 결과가 FAILED 인경우 종료
.start(start())
.on("FAILED")
.end()
// start()의 결과로 부터 FAILED를 제외한 모든 경우 to() 실행
.from(start())
.on("*")
.to(execution())
.on("FAILED")
.to(fail())
.from(execution())
// to() 실행 결과와 상관 없이 end() 실행
.on("*")
.to(end())
// JOB 종료
.end()
.build();
}
@Bean(name = JOB_NAME + "_step")
public Step execution() {
return stepBuilderFactory.get(JOB_NAME + "_step")
.tasklet(new SndngStatusBulksTasklet(linkService))
.build();
}
@JobScope
@Bean(name = JOB_NAME + "_start_step")
protected Step start() {
return stepBuilderFactory.get("Job_Locking")
.tasklet(new BatchStartTasklet(lockService))
.build();
}
@JobScope
@Bean(name = JOB_NAME + "_end_step")
protected Step end() {
return stepBuilderFactory.get("Lock_Release")
.tasklet(new BatchEndTasklet(lockService))
.build();
}
@JobScope
@Bean(name = JOB_NAME + "_fail_step")
protected Step fail() {
return stepBuilderFactory.get("Lock_Release")
.tasklet(new BatchFailEndTasklet(lockService))
.build();
}
}

@ -1,33 +0,0 @@
package kr.xit.ens.support.batch.rowmapper;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.springframework.jdbc.core.RowMapper;
import kr.xit.core.biz.model.LoggingDTO;
/**
* <pre>
* description :
*
* packageName : kr.xit.ens.support.batch.rowmapper
* fileName : LoggingRowMapper
* author : limju
* date : 2023-05-16
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-05-16 limju
*
* </pre>
*/
public class LoggingRowMapper implements RowMapper<LoggingDTO> {
@Override
public LoggingDTO mapRow(ResultSet rs, int rowNum) throws SQLException {
LoggingDTO dto = new LoggingDTO();
dto.setRequestId(rs.getString("requestId"));
return dto;
}
}

@ -1,67 +0,0 @@
package kr.xit.ens.support.batch.scheduler;
import kr.xit.ens.support.batch.job.EnsCctvAcceptJobConfg;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.core.JobParameter;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.JobParametersInvalidException;
import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
import org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* <pre>
* description : CCTV accept
*
* packageName : kr.xit.ens.support.batch.scheduler
* fileName : EnsCctvAcceptJobScheduler
* author : seojh
* date : 2023-07-17
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-07-17 seojh
*
* </pre>
*/
@Slf4j
@RequiredArgsConstructor
@Component
public class EnsCctvAcceptJobScheduler {
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
private final JobLauncher jobLauncher;
private final EnsCctvAcceptJobConfg jobConfiguration;
@Value("${app.slack-webhook.enabled:false}")
private String isSlackEnabled;
//FIXME : 전자 고지 CCTV 파일 처리(서광) 실행 간격 정의
private final static int RUN_EXEC_MIS = 10000;
//@Scheduled(initialDelay = RUN_EXEC_MIS, fixedDelay = RUN_EXEC_MIS)
public void runJob() {
Map<String, JobParameter> confMap = new HashMap<>();
confMap.put("startDate", new JobParameter(new Date()));
confMap.put("isSlackEnabled", new JobParameter(isSlackEnabled));
JobParameters jobParameters = new JobParameters(confMap);
try {
jobLauncher.run(jobConfiguration.ensCctvAcceptJob(), jobParameters);
} catch (JobExecutionAlreadyRunningException | JobInstanceAlreadyCompleteException
| JobParametersInvalidException | org.springframework.batch.core.repository.JobRestartException e) {
log.error(e.getMessage());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}

@ -1,67 +0,0 @@
package kr.xit.ens.support.batch.scheduler;
import kr.xit.ens.support.batch.job.EnsCctvFileJobConfg;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.core.JobParameter;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.JobParametersInvalidException;
import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
import org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* <pre>
* description : CCTV ()
*
* packageName : kr.xit.ens.support.batch.scheduler
* fileName : EnsCctvFileJobScheduler
* author : seojh
* date : 2023-07-17
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-07-17 seojh
*
* </pre>
*/
@Slf4j
@RequiredArgsConstructor
@Component
public class EnsCctvFileJobScheduler {
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
private final JobLauncher jobLauncher;
private final EnsCctvFileJobConfg jobConfiguration;
@Value("${app.slack-webhook.enabled:false}")
private String isSlackEnabled;
//FIXME : 전자 고지 CCTV 파일 처리(서광) 실행 간격 정의
private final static int RUN_EXEC_MIS = 10000;
//@Scheduled(initialDelay = RUN_EXEC_MIS, fixedDelay = RUN_EXEC_MIS)
public void runJob() {
Map<String, JobParameter> confMap = new HashMap<>();
confMap.put("startDate", new JobParameter(new Date()));
confMap.put("isSlackEnabled", new JobParameter(isSlackEnabled));
JobParameters jobParameters = new JobParameters(confMap);
try {
jobLauncher.run(jobConfiguration.ensCctvFileJob(), jobParameters);
} catch (JobExecutionAlreadyRunningException | JobInstanceAlreadyCompleteException
| JobParametersInvalidException | org.springframework.batch.core.repository.JobRestartException e) {
log.error(e.getMessage());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}

@ -1,68 +0,0 @@
package kr.xit.ens.support.batch.scheduler;
import kr.xit.ens.support.batch.job.PniCctvAcceptJobConfg;
import kr.xit.ens.support.batch.job.PniCctvFileJobConfg;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.core.JobParameter;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.JobParametersInvalidException;
import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
import org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* <pre>
* description : CCTV accept
*
* packageName : kr.xit.ens.support.batch.scheduler
* fileName : PniCctvAcceptJobScheduler
* author : limju
* date : 2023-07-11
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-07-11 limju
*
* </pre>
*/
@Slf4j
@RequiredArgsConstructor
@Component
public class PniCctvAcceptJobScheduler {
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
private final JobLauncher jobLauncher;
private final PniCctvAcceptJobConfg jobConfiguration;
@Value("${app.slack-webhook.enabled:false}")
private String isSlackEnabled;
//FIXME : 사전고지 CCTV 파일 처리(서광) 실행 간격 정의
private final static int RUN_EXEC_MIS = 10000;
//@Scheduled(initialDelay = RUN_EXEC_MIS, fixedDelay = RUN_EXEC_MIS)
public void runJob() {
Map<String, JobParameter> confMap = new HashMap<>();
confMap.put("startDate", new JobParameter(new Date()));
confMap.put("isSlackEnabled", new JobParameter(isSlackEnabled));
JobParameters jobParameters = new JobParameters(confMap);
try {
jobLauncher.run(jobConfiguration.pniCctvAcceptJob(), jobParameters);
} catch (JobExecutionAlreadyRunningException | JobInstanceAlreadyCompleteException
| JobParametersInvalidException | org.springframework.batch.core.repository.JobRestartException e) {
log.error(e.getMessage());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}

@ -1,67 +0,0 @@
package kr.xit.ens.support.batch.scheduler;
import kr.xit.ens.support.batch.job.PniCctvFileJobConfg;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.core.JobParameter;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.JobParametersInvalidException;
import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
import org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* <pre>
* description : CCTV ()
*
* packageName : kr.xit.ens.support.batch.scheduler
* fileName : PniCctvFileJobScheduler
* author : limju
* date : 2023-07-10
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-07-10 limju
*
* </pre>
*/
@Slf4j
@RequiredArgsConstructor
@Component
public class PniCctvFileJobScheduler {
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
private final JobLauncher jobLauncher;
private final PniCctvFileJobConfg jobConfiguration;
@Value("${app.slack-webhook.enabled:false}")
private String isSlackEnabled;
//FIXME : 사전고지 CCTV 파일 처리(서광) 실행 간격 정의
private final static int RUN_EXEC_MIS = 10000;
//@Scheduled(initialDelay = RUN_EXEC_MIS, fixedDelay = RUN_EXEC_MIS)
public void runJob() {
Map<String, JobParameter> confMap = new HashMap<>();
confMap.put("startDate", new JobParameter(new Date()));
confMap.put("isSlackEnabled", new JobParameter(isSlackEnabled));
JobParameters jobParameters = new JobParameters(confMap);
try {
jobLauncher.run(jobConfiguration.pniCctvFileJob(), jobParameters);
} catch (JobExecutionAlreadyRunningException | JobInstanceAlreadyCompleteException
| JobParametersInvalidException | org.springframework.batch.core.repository.JobRestartException e) {
log.error(e.getMessage());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}

@ -1,71 +0,0 @@
package kr.xit.ens.support.batch.scheduler;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import org.springframework.batch.core.JobParameter;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.JobParametersInvalidException;
import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
import org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import kr.xit.ens.support.batch.job.SndngAcceptJobConfig;
import kr.xit.ens.support.common.ApiConstants;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
/**
* <pre>
* description : -
* : (tb_cntc_sndng_mastr) : sndng_process_sttus = 'accept'
* (tb_cntc_sndng_detail)
* -> (tb_ens_unity_sndng_mastr)
* (tb_ens_unity_sndng_detail)
* : and tb_ens_unity_sndng_mastr - sndng_process_sttus = 'accept-ok'
* packageName : kr.xit.ens.support.batch.scheduler
* fileName : SndngAcceptJobScheduler
* author : limju
* date : 2023-06-12
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-06-12 limju
*
* </pre>
*/
@Slf4j
@RequiredArgsConstructor
@Component
public class SndngAcceptJobScheduler {
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
private final JobLauncher jobLauncher;
private final SndngAcceptJobConfig jobConfiguration;
@Value("${app.slack-webhook.enabled:false}")
private String isSlackEnabled;
//@Scheduled(cron = "${app.batch.cron.ens.accept}")
public void runJob() {
Map<String, JobParameter> confMap = new HashMap<>();
confMap.put("startDate", new JobParameter(new Date()));
confMap.put("isSlackEnabled", new JobParameter(isSlackEnabled));
confMap.put("sndngProcessSttus", new JobParameter(ApiConstants.SndngProcessStatus.ACCEPT.getCode()));
JobParameters jobParameters = new JobParameters(confMap);
try {
jobLauncher.run(jobConfiguration.sndngAcceptJob(), jobParameters);
} catch (JobExecutionAlreadyRunningException | JobInstanceAlreadyCompleteException
| JobParametersInvalidException | org.springframework.batch.core.repository.JobRestartException e) {
log.error(e.getMessage());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}

@ -1,70 +0,0 @@
package kr.xit.ens.support.batch.scheduler;
import kr.xit.ens.support.batch.job.SndngAcceptJobConfig;
import kr.xit.ens.support.batch.job.SndngCloseJobConfig;
import kr.xit.ens.support.common.ApiConstants;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.core.JobParameter;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.JobParametersInvalidException;
import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
import org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* <pre>
* description : close - send-ok
* : (tb_cntc_sndng_mastr)
* -> (tb_cntc_sndng_mastr)
* (tb_ens_unity_sndng_mastr)
* (tb_ens_sndng_mastr)
* packageName : kr.xit.ens.support.batch.scheduler
* fileName : SndngCloseJobScheduler
* author : seojh
* date : 2023-06-14
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-06-14 seojh
*
* </pre>
*/
@Slf4j
@RequiredArgsConstructor
@Component
public class SndngCloseJobScheduler {
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
private final JobLauncher jobLauncher;
private final SndngCloseJobConfig jobConfiguration;
@Value("${app.slack-webhook.enabled:false}")
private String isSlackEnabled;
//@Scheduled(cron = "${app.batch.cron.ens.close}")
public void runJob() {
Map<String, JobParameter> confMap = new HashMap<>();
confMap.put("startDate", new JobParameter(new Date()));
confMap.put("isSlackEnabled", new JobParameter(isSlackEnabled));
confMap.put("sndngProcessSttus", new JobParameter(ApiConstants.SndngProcessStatus.SEND_OK.getCode()));
JobParameters jobParameters = new JobParameters(confMap);
try {
jobLauncher.run(jobConfiguration.sndngCloseJob(), jobParameters);
} catch (JobExecutionAlreadyRunningException | JobInstanceAlreadyCompleteException
| JobParametersInvalidException | org.springframework.batch.core.repository.JobRestartException e) {
log.error(e.getMessage());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}

@ -1,70 +0,0 @@
package kr.xit.ens.support.batch.scheduler;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import org.springframework.batch.core.JobParameter;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.JobParametersInvalidException;
import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
import org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import kr.xit.ens.support.batch.job.SndngMakeJobConfig;
import kr.xit.ens.support.common.ApiConstants;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
/**
* <pre>
* description : -
* : (tb_ens_unity_sndng_mastr)
* * (tb_ens_unity_sndng_detail)
* -> (tb_ens_sndng_mastr)
* (tb_ens_kakao_my_doc)
* packageName : kr.xit.ens.support.batch.scheduler
* fileName : SndngMakeJobScheduler
* author : limju
* date : 2023-06-12
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-06-12 limju
*
* </pre>
*/
@Slf4j
@RequiredArgsConstructor
@Component
public class SndngMakeJobScheduler {
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
private final JobLauncher jobLauncher;
private final SndngMakeJobConfig jobConfiguration;
@Value("${app.slack-webhook.enabled:false}")
private String isSlackEnabled;
//@Scheduled(cron = "${app.batch.cron.ens.make}")
public void runJob() {
Map<String, JobParameter> confMap = new HashMap<>();
confMap.put("startDate", new JobParameter(new Date()));
confMap.put("isSlackEnabled", new JobParameter(isSlackEnabled));
confMap.put("sndngProcessSttus", new JobParameter(ApiConstants.SndngProcessStatus.ACCETP_OK.getCode()));
JobParameters jobParameters = new JobParameters(confMap);
try {
jobLauncher.run(jobConfiguration.sndngMakeJob(), jobParameters);
} catch (JobExecutionAlreadyRunningException | JobInstanceAlreadyCompleteException
| JobParametersInvalidException | org.springframework.batch.core.repository.JobRestartException e) {
log.error(e.getMessage());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}

@ -1,69 +0,0 @@
package kr.xit.ens.support.batch.scheduler;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import org.springframework.batch.core.JobParameter;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.JobParametersInvalidException;
import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
import org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import kr.xit.ens.support.batch.job.SndngSnedBulksJobConfig;
import kr.xit.ens.support.common.ApiConstants;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
/**
* <pre>
* description : -
* : (tb_ens_sndng_mastr)
* (tb_ens_kakao_my_doc)
* (tb_cntc_sndng_result)
* packageName : kr.xit.ens.support.batch.scheduler
* fileName : SndngSendBulksJobScheduler
* author : limju
* date : 2023-06-12
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-06-12 limju
*
* </pre>
*/
@Slf4j
@RequiredArgsConstructor
@Component
public class SndngSendBulksJobScheduler {
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
private final JobLauncher jobLauncher;
private final SndngSnedBulksJobConfig jobConfiguration;
@Value("${app.slack-webhook.enabled:false}")
private String isSlackEnabled;
//@Scheduled(cron = "${app.batch.cron.ens.send}")
public void runJob() {
Map<String, JobParameter> confMap = new HashMap<>();
confMap.put("startDate", new JobParameter(new Date()));
confMap.put("isSlackEnabled", new JobParameter(isSlackEnabled));
confMap.put("sndngProcessSttus", new JobParameter(ApiConstants.SndngProcessStatus.MAKE_OK.getCode()));
JobParameters jobParameters = new JobParameters(confMap);
try {
jobLauncher.run(jobConfiguration.sndngSendBulksJob(), jobParameters);
} catch (JobExecutionAlreadyRunningException | JobInstanceAlreadyCompleteException
| JobParametersInvalidException | org.springframework.batch.core.repository.JobRestartException e) {
log.error(e.getMessage());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}

@ -1,70 +0,0 @@
package kr.xit.ens.support.batch.scheduler;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import org.springframework.batch.core.JobParameter;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.JobParametersInvalidException;
import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
import org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import kr.xit.ens.support.batch.job.SndngSnedBulksJobConfig;
import kr.xit.ens.support.batch.job.SndngStatusBulksJobConfig;
import kr.xit.ens.support.common.ApiConstants;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
/**
* <pre>
* description : -
* : (tb_cntc_sndng_result)
* (tb_ens_kakao_my_doc)
* packageName : kr.xit.ens.support.batch.scheduler
* fileName : SndngStatusBulksJobScheduler
* author : limju
* date : 2023-06-13
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-06-13 limju
*
* </pre>
*/
@Slf4j
@RequiredArgsConstructor
@Component
public class SndngStatusBulksJobScheduler {
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
private final JobLauncher jobLauncher;
private final SndngStatusBulksJobConfig jobConfiguration;
@Value("${app.slack-webhook.enabled:false}")
private String isSlackEnabled;
//@Scheduled(cron = "${app.batch.cron.ens.kko-status}")
public void runJob() {
Map<String, JobParameter> confMap = new HashMap<>();
confMap.put("startDate", new JobParameter(new Date()));
confMap.put("isSlackEnabled", new JobParameter(isSlackEnabled));
confMap.put("sndngProcessSttus", new JobParameter(ApiConstants.SndngProcessStatus.SEND_OK.getCode()));
JobParameters jobParameters = new JobParameters(confMap);
try {
jobLauncher.run(jobConfiguration.sndngStatusBulksJob(), jobParameters);
} catch (JobExecutionAlreadyRunningException | JobInstanceAlreadyCompleteException
| JobParametersInvalidException | org.springframework.batch.core.repository.JobRestartException e) {
log.error(e.getMessage());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}

@ -1,61 +0,0 @@
package kr.xit.ens.support.batch.task;
import kr.xit.biz.ens.service.IEnsCctvFileService;
import kr.xit.ens.support.batch.task.cmm.TaskCmmUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.StepContribution;
import org.springframework.batch.core.configuration.annotation.JobScope;
import org.springframework.batch.core.scope.context.ChunkContext;
import org.springframework.batch.core.step.tasklet.Tasklet;
import org.springframework.batch.repeat.RepeatStatus;
/**
* <pre>
* description : CCTV accept
*
* packageName : kr.xit.ens.support.batch.task
* fileName : EnsCctvAcceptTasklet
* author : seojh
* date : 2023-07-17
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-07-17 seojh
*
* </pre>
*/
@Slf4j
@RequiredArgsConstructor
public class EnsCctvAcceptTasklet implements Tasklet {
private final IEnsCctvFileService service;
@Override
@JobScope
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) {
final String isSlackEnabled = contribution.getStepExecution().getJobParameters().getString("isSlackEnabled");
try {
service.acceptEnsNtnccntcSndng();
}catch(Exception e){
log.error("EnsCctvAcceptTasklet error :: {}", e.getMessage());
TaskCmmUtils.taskBatchErrorLog(
contribution.getStepExecution().getJobExecution().getJobInstance().getJobName(),
e.getMessage(),
isSlackEnabled
);
TaskCmmUtils.taskEnsMessageLinkServiceUpdateErrorLog(
contribution.getStepExecution().getJobExecution().getJobInstance().getJobName(),
e.getMessage(),
isSlackEnabled
);
contribution.setExitStatus(ExitStatus.FAILED);
return RepeatStatus.FINISHED;
}
contribution.setExitStatus(ExitStatus.COMPLETED);
return RepeatStatus.FINISHED;
}
}

@ -1,55 +0,0 @@
package kr.xit.ens.support.batch.task;
import kr.xit.biz.ens.service.IEnsCctvFileService;
import kr.xit.ens.support.batch.task.cmm.TaskCmmUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.StepContribution;
import org.springframework.batch.core.configuration.annotation.JobScope;
import org.springframework.batch.core.scope.context.ChunkContext;
import org.springframework.batch.core.step.tasklet.Tasklet;
import org.springframework.batch.repeat.RepeatStatus;
/**
* <pre>
* description : CCTV ()
*
* packageName : kr.xit.ens.support.batch.task
* fileName : EnsCctvFileTasklet
* author : seojh
* date : 2023-07-17
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-07-17 seojh
*
* </pre>
*/
@Slf4j
@RequiredArgsConstructor
public class EnsCctvFileTasklet implements Tasklet {
private final IEnsCctvFileService service;
@Override
@JobScope
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) {
final String isSlackEnabled = contribution.getStepExecution().getJobParameters().getString("isSlackEnabled");
try {
service.createCctvFileOfSg();
}catch(Exception e){
log.error("EnsCctvFileTasklet error :: {}", e.getMessage());
TaskCmmUtils.taskBatchErrorLog(
contribution.getStepExecution().getJobExecution().getJobInstance().getJobName(),
e.getMessage(),
isSlackEnabled
);
contribution.setExitStatus(ExitStatus.FAILED);
return RepeatStatus.FINISHED;
}
contribution.setExitStatus(ExitStatus.COMPLETED);
return RepeatStatus.FINISHED;
}
}

@ -1,61 +0,0 @@
package kr.xit.ens.support.batch.task;
import kr.xit.biz.pni.service.IPniCctvFileService;
import kr.xit.ens.support.batch.task.cmm.TaskCmmUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.StepContribution;
import org.springframework.batch.core.configuration.annotation.JobScope;
import org.springframework.batch.core.scope.context.ChunkContext;
import org.springframework.batch.core.step.tasklet.Tasklet;
import org.springframework.batch.repeat.RepeatStatus;
/**
* <pre>
* description : CCTV accept
*
* packageName : kr.xit.ens.support.batch.task
* fileName : PniCctvAcceptTasklet
* author : limju
* date : 2023-07-11
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-07-11 limju
*
* </pre>
*/
@Slf4j
@RequiredArgsConstructor
public class PniCctvAcceptTasklet implements Tasklet {
private final IPniCctvFileService service;
@Override
@JobScope
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) {
final String isSlackEnabled = contribution.getStepExecution().getJobParameters().getString("isSlackEnabled");
try {
service.acceptPniNtnccntcSndng();
}catch(Exception e){
log.error("PniCctvAcceptTasklet error :: {}", e.getMessage());
TaskCmmUtils.taskBatchErrorLog(
contribution.getStepExecution().getJobExecution().getJobInstance().getJobName(),
e.getMessage(),
isSlackEnabled
);
TaskCmmUtils.taskEnsMessageLinkServiceUpdateErrorLog(
contribution.getStepExecution().getJobExecution().getJobInstance().getJobName(),
e.getMessage(),
isSlackEnabled
);
contribution.setExitStatus(ExitStatus.FAILED);
return RepeatStatus.FINISHED;
}
contribution.setExitStatus(ExitStatus.COMPLETED);
return RepeatStatus.FINISHED;
}
}

@ -1,55 +0,0 @@
package kr.xit.ens.support.batch.task;
import kr.xit.biz.pni.service.IPniCctvFileService;
import kr.xit.ens.support.batch.task.cmm.TaskCmmUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.StepContribution;
import org.springframework.batch.core.configuration.annotation.JobScope;
import org.springframework.batch.core.scope.context.ChunkContext;
import org.springframework.batch.core.step.tasklet.Tasklet;
import org.springframework.batch.repeat.RepeatStatus;
/**
* <pre>
* description : CCTV ()
*
* packageName : kr.xit.ens.support.batch.task
* fileName : PniCctvFileTasklet
* author : limju
* date : 2023-07-10
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-07-10 limju
*
* </pre>
*/
@Slf4j
@RequiredArgsConstructor
public class PniCctvFileTasklet implements Tasklet {
private final IPniCctvFileService service;
@Override
@JobScope
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) {
final String isSlackEnabled = contribution.getStepExecution().getJobParameters().getString("isSlackEnabled");
try {
service.createCctvFileOfSg();
}catch(Exception e){
log.error("PniCctvFileTasklet error :: {}", e.getMessage());
TaskCmmUtils.taskBatchErrorLog(
contribution.getStepExecution().getJobExecution().getJobInstance().getJobName(),
e.getMessage(),
isSlackEnabled
);
contribution.setExitStatus(ExitStatus.FAILED);
return RepeatStatus.FINISHED;
}
contribution.setExitStatus(ExitStatus.COMPLETED);
return RepeatStatus.FINISHED;
}
}

@ -1,62 +0,0 @@
package kr.xit.ens.support.batch.task;
import kr.xit.ens.support.batch.task.cmm.TaskCmmUtils;
import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.StepContribution;
import org.springframework.batch.core.configuration.annotation.JobScope;
import org.springframework.batch.core.scope.context.ChunkContext;
import org.springframework.batch.core.step.tasklet.Tasklet;
import org.springframework.batch.repeat.RepeatStatus;
import kr.xit.biz.ens.service.ISendMessageLinkService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
/**
* <pre>
* description :
*
* packageName : kr.xit.ens.support.batch.task
* fileName : SndngAcceptTasklet
* author : limju
* date : 2023-06-12
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-06-12 limju
*
* </pre>
*/
@Slf4j
@RequiredArgsConstructor
public class SndngAcceptTasklet implements Tasklet {
private final ISendMessageLinkService service;
@Override
@JobScope
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) {
String sndngProcessSttus = contribution.getStepExecution().getJobParameters().getString("sndngProcessSttus");
final String isSlackEnabled = contribution.getStepExecution().getJobParameters().getString("isSlackEnabled");
try {
service.accept(sndngProcessSttus);
}catch(Exception e){
log.error("SndngAcceptTasklet error :: {}", e.getMessage());
TaskCmmUtils.taskBatchErrorLog(
contribution.getStepExecution().getJobExecution().getJobInstance().getJobName(),
e.getMessage(),
isSlackEnabled
);
TaskCmmUtils.taskEnsMessageLinkServiceUpdateErrorLog(
contribution.getStepExecution().getJobExecution().getJobInstance().getJobName(),
e.getMessage(),
isSlackEnabled
);
contribution.setExitStatus(ExitStatus.FAILED);
return RepeatStatus.FINISHED;
}
contribution.setExitStatus(ExitStatus.COMPLETED);
return RepeatStatus.FINISHED;
}
}

@ -1,59 +0,0 @@
package kr.xit.ens.support.batch.task;
import kr.xit.biz.ens.service.ISendMessageLinkService;
import kr.xit.ens.support.batch.task.cmm.TaskCmmUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.StepContribution;
import org.springframework.batch.core.configuration.annotation.JobScope;
import org.springframework.batch.core.scope.context.ChunkContext;
import org.springframework.batch.core.step.tasklet.Tasklet;
import org.springframework.batch.repeat.RepeatStatus;
/**
* <pre>
* description :
*
* packageName : kr.xit.ens.support.batch.task
* fileName : SndngCloseTasklet
* author : seojh
* date : 2023-06-14
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-06-14 seojh
*
* </pre>
*/
@Slf4j
public class SndngCloseTasklet implements Tasklet {
private final ISendMessageLinkService service;
public SndngCloseTasklet(ISendMessageLinkService service) {
this.service = service;
}
@Override
@JobScope
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) {
String sndngProcessSttus = contribution.getStepExecution().getJobParameters().getString("sndngProcessSttus");
final String isSlackEnabled = contribution.getStepExecution().getJobParameters().getString("isSlackEnabled");
try {
service.close(sndngProcessSttus);
}catch(Exception e){
log.error("SndngCloseTasklet error :: {}", e.getMessage());
TaskCmmUtils.taskBatchErrorLog(
contribution.getStepExecution().getJobExecution().getJobInstance().getJobName(),
e.getMessage(),
isSlackEnabled
);
contribution.setExitStatus(ExitStatus.FAILED);
return RepeatStatus.FINISHED;
}
contribution.setExitStatus(ExitStatus.COMPLETED);
return RepeatStatus.FINISHED;
}
}

@ -1,62 +0,0 @@
package kr.xit.ens.support.batch.task;
import kr.xit.ens.support.batch.task.cmm.TaskCmmUtils;
import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.StepContribution;
import org.springframework.batch.core.configuration.annotation.JobScope;
import org.springframework.batch.core.scope.context.ChunkContext;
import org.springframework.batch.core.step.tasklet.Tasklet;
import org.springframework.batch.repeat.RepeatStatus;
import kr.xit.biz.ens.service.ISendMessageLinkService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
/**
* <pre>
* description :
*
* packageName : kr.xit.ens.support.batch.task
* fileName : SndngMakeTasklet
* author : limju
* date : 2023-06-12
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-06-12 limju
*
* </pre>
*/
@Slf4j
@RequiredArgsConstructor
public class SndngMakeTasklet implements Tasklet {
private final ISendMessageLinkService service;
@Override
@JobScope
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) {
String sndngProcessSttus = contribution.getStepExecution().getJobParameters().getString("sndngProcessSttus");
final String isSlackEnabled = contribution.getStepExecution().getJobParameters().getString("isSlackEnabled");
try {
service.make(sndngProcessSttus);
}catch(Exception e){
log.error("SndngMakeTasklet error :: {}", e.getMessage());
TaskCmmUtils.taskBatchErrorLog(
contribution.getStepExecution().getJobExecution().getJobInstance().getJobName(),
e.getMessage(),
isSlackEnabled
);
TaskCmmUtils.taskEnsMessageLinkServiceUpdateErrorLog(
contribution.getStepExecution().getJobExecution().getJobInstance().getJobName(),
e.getMessage(),
isSlackEnabled
);
contribution.setExitStatus(ExitStatus.FAILED);
return RepeatStatus.FINISHED;
}
contribution.setExitStatus(ExitStatus.COMPLETED);
return RepeatStatus.FINISHED;
}
}

@ -1,69 +0,0 @@
package kr.xit.ens.support.batch.task;
import java.util.UUID;
import kr.xit.ens.support.batch.task.cmm.TaskCmmUtils;
import org.slf4j.MDC;
import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.StepContribution;
import org.springframework.batch.core.configuration.annotation.JobScope;
import org.springframework.batch.core.scope.context.ChunkContext;
import org.springframework.batch.core.step.tasklet.Tasklet;
import org.springframework.batch.repeat.RepeatStatus;
import kr.xit.biz.ens.service.ISendMessageLinkService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
/**
* <pre>
* description :
*
* packageName : kr.xit.ens.support.batch.task
* fileName : SndngSendBulksTasklet
* author : limju
* date : 2023-06-12
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-06-12 limju
*
* </pre>
*/
@Slf4j
@RequiredArgsConstructor
public class SndngSendBulksTasklet implements Tasklet {
private final ISendMessageLinkService service;
@Override
@JobScope
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) {
String sndngProcessSttus = contribution.getStepExecution().getJobParameters().getString("sndngProcessSttus");
final String isSlackEnabled = contribution.getStepExecution().getJobParameters().getString("isSlackEnabled");
try {
MDC.put("request_trace_batch_id", UUID.randomUUID().toString().replace("-", ""));
MDC.put("uri", "/v1/documents/bulk");
MDC.put("method", "POST");
service.sendBulks(sndngProcessSttus);
}catch(Exception e){
log.error("SndngSendBulksTasklet error :: {}", e.getMessage());
TaskCmmUtils.taskBatchErrorLog(
contribution.getStepExecution().getJobExecution().getJobInstance().getJobName(),
e.getMessage(),
isSlackEnabled
);
TaskCmmUtils.taskEnsMessageLinkServiceUpdateErrorLog(
contribution.getStepExecution().getJobExecution().getJobInstance().getJobName(),
e.getMessage(),
isSlackEnabled
);
contribution.setExitStatus(ExitStatus.FAILED);
return RepeatStatus.FINISHED;
}
contribution.setExitStatus(ExitStatus.COMPLETED);
return RepeatStatus.FINISHED;
}
}

@ -1,63 +0,0 @@
package kr.xit.ens.support.batch.task;
import kr.xit.ens.support.batch.task.cmm.TaskCmmUtils;
import org.slf4j.MDC;
import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.StepContribution;
import org.springframework.batch.core.configuration.annotation.JobScope;
import org.springframework.batch.core.scope.context.ChunkContext;
import org.springframework.batch.core.step.tasklet.Tasklet;
import org.springframework.batch.repeat.RepeatStatus;
import kr.xit.biz.ens.service.ISendMessageLinkService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import java.util.UUID;
/**
* <pre>
* description :
*
* packageName : kr.xit.ens.support.batch.task
* fileName : SndngStatusBulksTasklet
* author : limju
* date : 2023-06-13
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-06-13 limju
*
* </pre>
*/
@Slf4j
@RequiredArgsConstructor
public class SndngStatusBulksTasklet implements Tasklet {
private final ISendMessageLinkService service;
@Override
@JobScope
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) {
final String sndngProcessSttus = contribution.getStepExecution().getJobParameters().getString("sndngProcessSttus");
final String isSlackEnabled = contribution.getStepExecution().getJobParameters().getString("isSlackEnabled");
try {
MDC.put("request_trace_batch_id", UUID.randomUUID().toString().replace("-", ""));
MDC.put("uri", "/v1/documents/bulk/status");
MDC.put("method", "POST");
service.findKkoMyDocStatusBulks(sndngProcessSttus);
}catch(Exception e){
log.error("SndngStatusBulksTasklet error :: {}", e.getMessage());
TaskCmmUtils.taskBatchErrorLog(
contribution.getStepExecution().getJobExecution().getJobInstance().getJobName(),
e.getMessage(),
isSlackEnabled
);
contribution.setExitStatus(ExitStatus.FAILED);
return RepeatStatus.FINISHED;
}
contribution.setExitStatus(ExitStatus.COMPLETED);
return RepeatStatus.FINISHED;
}
}

@ -1,83 +0,0 @@
package kr.xit.ens.support.batch.task.cmm;
import kr.xit.biz.ens.model.EnsDTO;
import kr.xit.core.biz.batch.model.BatchCmmDTO;
import kr.xit.core.spring.util.ApiSpringUtils;
import kr.xit.ens.support.common.ApiConstants;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.slf4j.MDC;
import static egovframework.com.cmm.util.EgovStringUtil.cutString;
/**
* <pre>
* description :
*
* packageName : kr.xit.ens.support.batch.task.cmm
* fileName : TaskCmmUtils
* author : limju
* date : 2023-06-19
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-06-19 limju
*
* </pre>
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class TaskCmmUtils {
public static void taskBatchErrorLog(final String instanceId, final String errorMsg, final String isSlackEnabled){
ApiSpringUtils.getBatchCmmService().modifyBatchLog(
BatchCmmDTO
.builder()
.batchLogId(MDC.get("batch_log_id"))
.instanceId(instanceId)
.traceId(MDC.get("request_trace_id"))
.message(errorMsg)
.build()
);
if(Boolean.parseBoolean(isSlackEnabled)) {
ApiSpringUtils.getSlackWebhookPush().sendSlackAlertLog(
errorMsg,
MDC.get("uri"),
"batch call");
}
}
/**
*
* <p>
* @param instanceId String
* @param errorMsg String
* @param isSlackEnabled boolean push
*/
public static void taskEnsMessageLinkServiceUpdateErrorLog(final String instanceId, final String errorMsg, final String isSlackEnabled){
final String UNITY_SNDNG_MASTR_ID = "unitySndngMastrId";
String unitySndngMastrId = null;
String sndngProcessSttus = null;
String sndngMastrId = null;
if("SndngAcceptJob".equals(instanceId) || "PniCctvAcceptJob".equals(instanceId)){
unitySndngMastrId = MDC.get(UNITY_SNDNG_MASTR_ID);
sndngProcessSttus = ApiConstants.SndngProcessStatus.ACCETP_FAIL.getCode();
} else if ("SndngMakeJob".equals(instanceId)) {
unitySndngMastrId = MDC.get(UNITY_SNDNG_MASTR_ID);
sndngProcessSttus = MDC.get("sndngProcessSttus");
} else if ("SndngSendBulksJob".equals(instanceId)) {
unitySndngMastrId = MDC.get(UNITY_SNDNG_MASTR_ID);
sndngMastrId = MDC.get("sndngMastrId");
sndngProcessSttus = MDC.get("sndngProcessSttus");
}
ApiSpringUtils.getSendMessageLinkService().updateErrorLog(
EnsDTO.SndngMssageParam.builder()
.unitySndngMastrId(unitySndngMastrId)
.sndngMastrId(sndngMastrId)
.newSndngProcessSttus(sndngProcessSttus)
.errorCode(instanceId)
.errorMssage(cutString(errorMsg, 300))
.build()
);
}
}

@ -1,224 +0,0 @@
package kr.xit.ens.support.batch.web;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import kr.xit.core.support.utils.Checks;
import kr.xit.ens.support.batch.job.*;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobParameter;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.JobParametersInvalidException;
import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
import org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import kr.xit.core.model.ApiResponseDTO;
import kr.xit.ens.support.batch.scheduler.SndngSendBulksJobScheduler;
import kr.xit.ens.support.common.ApiConstants;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
/**
* <pre>
* description :
*
* packageName : kr.xit.ens.support.batch.web
* fileName : KkopayEltrcDocBatchController
* author : limju
* date : 2023-05-16
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-05-16 limju
*
* </pre>
*/
@Tag(name = "KkopayEltrcDocBatchController", description = "전자고지 통합발송 연계 배치 WEB")
@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping(value = "/api/batch/v1")
public class KkopayEltrcDocBatchController {
@Value("${app.slack-webhook.enabled:false}")
private String isSlackEnabled;
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
private final JobLauncher jobLauncher;
private final SndngAcceptJobConfig acceptJobConfig;
private final SndngMakeJobConfig makeJobConfig;
private final SndngSnedBulksJobConfig sendBulksJobConfig;
private final SndngStatusBulksJobConfig statusJobConfig;
private final SndngCloseJobConfig closeJobConfig;
private final PniCctvFileJobConfg pniCctvFileJobConfg;
private final PniCctvAcceptJobConfg pniCctvAcceptJobConfg;
@Operation(summary = "accept", description = "accept")
@GetMapping(value = "/accept", produces = MediaType.APPLICATION_JSON_VALUE)
public ApiResponseDTO<?> accept() {
try {
JobExecution jobExecution = jobLauncher.run(acceptJobConfig.sndngAcceptJob(), getJobParameters(ApiConstants.SndngProcessStatus.ACCEPT.getCode()));
while(jobExecution.isRunning()){
log.info("...");
}
printLog(jobExecution);
} catch (JobExecutionAlreadyRunningException | JobInstanceAlreadyCompleteException
| JobParametersInvalidException | org.springframework.batch.core.repository.JobRestartException e) {
log.error(e.getMessage());
}
return ApiResponseDTO.success(HttpStatus.OK);
}
@Operation(summary = "make", description = "make")
@GetMapping(value = "/make", produces = MediaType.APPLICATION_JSON_VALUE)
public ApiResponseDTO<?> make() {
try {
JobExecution jobExecution = jobLauncher.run(makeJobConfig.sndngMakeJob(), getJobParameters(ApiConstants.SndngProcessStatus.ACCETP_OK.getCode()));
while(jobExecution.isRunning()){
log.info("...");
}
printLog(jobExecution);
} catch (JobExecutionAlreadyRunningException | JobInstanceAlreadyCompleteException
| JobParametersInvalidException | org.springframework.batch.core.repository.JobRestartException e) {
log.error(e.getMessage());
}
return ApiResponseDTO.success(HttpStatus.OK);
}
@Operation(summary = "close", description = "close")
@GetMapping(value = "/close", produces = MediaType.APPLICATION_JSON_VALUE)
public ApiResponseDTO<?> close() {
try {
JobExecution jobExecution = jobLauncher.run(closeJobConfig.sndngCloseJob(), getJobParameters(ApiConstants.SndngProcessStatus.SEND_OK.getCode()));
while(jobExecution.isRunning()){
log.info("...");
}
printLog(jobExecution);
} catch (JobExecutionAlreadyRunningException | JobInstanceAlreadyCompleteException
| JobParametersInvalidException | org.springframework.batch.core.repository.JobRestartException e) {
log.error(e.getMessage());
}
return ApiResponseDTO.success(HttpStatus.OK);
}
@Operation(summary = "sendBulks", description = "sendBulks")
@GetMapping(value = "/sendBulks", produces = MediaType.APPLICATION_JSON_VALUE)
public ApiResponseDTO<?> sendBulks() {
try {
JobExecution jobExecution = jobLauncher.run(sendBulksJobConfig.sndngSendBulksJob(), getJobParameters(ApiConstants.SndngProcessStatus.MAKE_OK.getCode()));
while(jobExecution.isRunning()){
log.info("...");
}
printLog(jobExecution);
} catch (JobExecutionAlreadyRunningException | JobInstanceAlreadyCompleteException
| JobParametersInvalidException | org.springframework.batch.core.repository.JobRestartException e) {
log.error(e.getMessage());
}
return ApiResponseDTO.success(HttpStatus.OK);
}
@Operation(summary = "statusBulks", description = "statusBulks")
@GetMapping(value = "/statusBulks", produces = MediaType.APPLICATION_JSON_VALUE)
public ApiResponseDTO<?> statusBulks() {
try {
JobExecution jobExecution = jobLauncher.run(statusJobConfig.sndngStatusBulksJob(), getJobParameters(ApiConstants.SndngProcessStatus.SEND_OK.getCode()));
while(jobExecution.isRunning()){
log.info("...");
}
printLog(jobExecution);
} catch (JobExecutionAlreadyRunningException | JobInstanceAlreadyCompleteException
| JobParametersInvalidException | org.springframework.batch.core.repository.JobRestartException e) {
log.error(e.getMessage());
}
return ApiResponseDTO.success(HttpStatus.OK);
}
@Operation(summary = "pniCctvFileService", description = "CCTV 사전알림(서광)")
@GetMapping(value = "/pniCctvFileService", produces = MediaType.APPLICATION_JSON_VALUE)
public ApiResponseDTO<?> pniCctvFileService() {
try {
JobExecution jobExecution = jobLauncher.run(pniCctvFileJobConfg.pniCctvFileJob(), getJobParameters(null));
while(jobExecution.isRunning()){
log.info("...");
}
printLog(jobExecution);
} catch (JobExecutionAlreadyRunningException | JobInstanceAlreadyCompleteException
| JobParametersInvalidException | org.springframework.batch.core.repository.JobRestartException e) {
log.error(e.getMessage());
}
return ApiResponseDTO.success(HttpStatus.OK);
}
@Operation(summary = "pniCctvAccept", description = "CCTV 단속 사전알림 accept")
@GetMapping(value = "/pniCctvAccept", produces = MediaType.APPLICATION_JSON_VALUE)
public ApiResponseDTO<?> pniCctvAccept() {
try {
JobExecution jobExecution = jobLauncher.run(pniCctvAcceptJobConfg.pniCctvAcceptJob(), getJobParameters(null));
while(jobExecution.isRunning()){
log.info("...");
}
printLog(jobExecution);
} catch (JobExecutionAlreadyRunningException | JobInstanceAlreadyCompleteException
| JobParametersInvalidException | org.springframework.batch.core.repository.JobRestartException e) {
log.error(e.getMessage());
}
return ApiResponseDTO.success(HttpStatus.OK);
}
private JobParameters getJobParameters(final String processStatus){
Map<String, JobParameter> confMap = new HashMap<>();
confMap.put("startDate", new JobParameter(new Date()));
confMap.put("isSlackEnabled", new JobParameter(isSlackEnabled));
if(Checks.isNotEmpty(processStatus)) confMap.put("sndngProcessSttus", new JobParameter(processStatus));
return new JobParameters(confMap);
}
private static void printLog(JobExecution jobExecution) {
log.info("Job Execution: " + jobExecution.getStatus());
log.info("Job getJobConfigurationName: " + jobExecution.getJobConfigurationName());
log.info("Job getJobId: " + jobExecution.getJobId());
log.info("Job getExitStatus: " + jobExecution.getExitStatus());
log.info("Job getJobInstance: " + jobExecution.getJobInstance());
log.info("Job getStepExecutions: " + jobExecution.getStepExecutions());
log.info("Job getLastUpdated: " + jobExecution.getLastUpdated());
log.info("Job getFailureExceptions: " + jobExecution.getFailureExceptions());
}
}

@ -1,56 +0,0 @@
package kr.xit.ens.support.common.code;
import lombok.Getter;
import org.springframework.http.HttpStatus;
/**
* <pre>
* description :
* packageName : kr.xit.ens.support.common.code
* fileName : KkoReponseCode
* author : minuk
* date : 2023/05/07
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023/05/07 minuk
*
* </pre>
*/
//TODO:: KakaoConstants 로 통합
public class KkoReponseCode {
public enum ErrorCode {
// INVALID_VALUE("INVALID_VALUE", "INVALID_VALUE", "유효하지 않은 값입니다."),
// UNIDENTIFIED_USER("UNIDENTIFIED_USER", "INVALID_VALUE", "유효하지 않은 값입니다."),
// UNAUTHORIZED("UNAUTHORIZED", "UNAUTHORIZED", "접근 권한이 없습니다."),
// FORBIDDEN("FORBIDDEN", "FORBIDDEN", "허용되지 않는 요청입니다. 수신거부된 사용자 입니다."),
// NOT_FOUND("NOT_FOUND", "NOT_FOUND", "요청 정보를 찾을 수 없습니다."),
// INTERNAL_ERROR("INTERNAL_ERROR", "INTERNAL_SERVER_ERROR", "서버 에러입니다. 다시 시도해 주세요."),
// ;
INVALID_VALUE(400, "INVALID_VALUE", "유효하지 않은 값입니다."),
UNIDENTIFIED_USER(400, "INVALID_VALUE", "유효하지 않은 값입니다."),
UNAUTHORIZED(401, "UNAUTHORIZED", "접근 권한이 없습니다."),
FORBIDDEN(403, "FORBIDDEN", "허용되지 않는 요청입니다. 수신거부된 사용자 입니다."),
NOT_FOUND(404, "NOT_FOUND", "요청 정보를 찾을 수 없습니다."),
INTERNAL_ERROR(500, "INTERNAL_SERVER_ERROR", "서버 에러입니다. 다시 시도해 주세요."),
;
@Getter
private int errorCode;
@Getter
private String errorString;
@Getter
private String message;
ErrorCode(int errorCode, String errorString, String message){
this.errorCode = errorCode;
this.errorString = errorString;
this.message = message;
}
}
}
Loading…
Cancel
Save