refactor: 미사용 클래스 제거

main
Jonguk. Lim 3 months ago
parent 5b71396f8f
commit 3adeba87a0

@ -1,113 +0,0 @@
package kr.xit.batch.ens.job;
import kr.xit.batch.ens.task.EnsCctvAcceptTasklet;
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 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.batch.ens.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.batch.ens.job;
import kr.xit.batch.ens.task.EnsCctvFileTasklet;
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 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.batch.ens.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,113 +0,0 @@
package kr.xit.batch.ens.job;
import kr.xit.batch.ens.task.OtherMergeTasklet;
import kr.xit.biz.ens.service.IEnsOtherMergeService;
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 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 :
*
* packageName : kr.xit.batch.ens.job
* fileName : OtherMergeJobConfig
* author : jhseo
* date : 2024-01-10
* ======================================================================
*
* ----------------------------------------------------------------------
* 2024-01-10 jhseo
*
* </pre>
*/
@Slf4j
@RequiredArgsConstructor
@Configuration
public class OtherMergeJobConfig {
private static final String JOB_NAME = "OtherMergeJob";
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
private final JobBuilderFactory jobBuilderFactory;
private final StepBuilderFactory stepBuilderFactory;
private final IBatchCmmService lockService;
private final IEnsOtherMergeService otherService;
@Bean(name = JOB_NAME)
public Job otherMergeJob() {
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 OtherMergeTasklet(otherService))
.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.batch.ens.job;
import kr.xit.batch.ens.task.PniCctvAcceptTasklet;
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 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.batch.ens.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.batch.ens.job;
import kr.xit.batch.ens.task.PniCctvFileTasklet;
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 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.batch.ens.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,66 +0,0 @@
package kr.xit.batch.ens.scheduler;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import kr.xit.batch.ens.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;
/**
* <pre>
* description : CCTV accept
*
* packageName : kr.xit.batch.ens.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,66 +0,0 @@
package kr.xit.batch.ens.scheduler;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import kr.xit.batch.ens.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;
/**
* <pre>
* description : CCTV ()
*
* packageName : kr.xit.batch.ens.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,66 +0,0 @@
package kr.xit.batch.ens.scheduler;
import kr.xit.batch.ens.job.OtherMergeJobConfig;
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 : Oracle Merge
* : Maria DB (tb_cntc_sndng_mastr, tb_cntc_sndng_detail, tb_cntc_sndng_result)
* -> (elecnoticemst)
* (elecnoticedtl)
* packageName : kr.xit.batch.ens.scheduler
* fileName : OtherMergeJobScheduler
* author : jhseo
* date : 2024-01-10
* ======================================================================
*
* ----------------------------------------------------------------------
* 2024-01-10 jhseo
*
* </pre>
*/
@Slf4j
@RequiredArgsConstructor
@Component
public class OtherMergeJobScheduler {
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
private final JobLauncher jobLauncher;
private final OtherMergeJobConfig jobConfiguration;
@Value("${app.slack-webhook.enabled:false}")
private String isSlackEnabled;
@Scheduled(cron = "${app.batch.cron.other.merge}")
public void runJob() {
Map<String, JobParameter> confMap = new HashMap<>();
confMap.put("startDate", new JobParameter(new Date()));
confMap.put("isSlackEnabled", new JobParameter(isSlackEnabled));
try {
JobParameters jobParameters = new JobParameters(confMap);
jobLauncher.run(jobConfiguration.otherMergeJob(), jobParameters);
} catch (JobExecutionAlreadyRunningException | JobInstanceAlreadyCompleteException
| JobParametersInvalidException | org.springframework.batch.core.repository.JobRestartException e) {
log.error(e.getMessage());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}

@ -1,66 +0,0 @@
package kr.xit.batch.ens.scheduler;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import kr.xit.batch.ens.job.PniCctvAcceptJobConfg;
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;
/**
* <pre>
* description : CCTV accept
*
* packageName : kr.xit.batch.ens.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,66 +0,0 @@
package kr.xit.batch.ens.scheduler;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import kr.xit.batch.ens.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;
/**
* <pre>
* description : CCTV ()
*
* packageName : kr.xit.batch.ens.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,67 +0,0 @@
package kr.xit.batch.ens.task;
import kr.xit.batch.ens.task.cmm.TaskCmmUtils;
import kr.xit.biz.ens.service.IEnsCctvFileService;
import kr.xit.core.exception.ErrorParse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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;
/**
* <pre>
* description : CCTV accept
*
* packageName : kr.xit.batch.ens.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 {
MDC.put("service_error_msg", "");
service.acceptEnsNtnccntcSndng();
}catch(Exception e){
String errMsg = ErrorParse.extractError(e).getMessage();
log.error("EnsCctvAcceptTasklet error :: {}", e.getMessage());
MDC.put("service_error_msg", errMsg);
TaskCmmUtils.taskBatchErrorLog(
contribution.getStepExecution().getJobExecution().getJobInstance().getJobName(),
errMsg,
isSlackEnabled
);
TaskCmmUtils.taskEnsBatchServiceUpdateErrorLog(
contribution.getStepExecution().getJobExecution().getJobInstance().getJobName(),
errMsg,
isSlackEnabled
);
contribution.setExitStatus(ExitStatus.FAILED);
return RepeatStatus.FINISHED;
}
contribution.setExitStatus(ExitStatus.COMPLETED);
return RepeatStatus.FINISHED;
}
}

@ -1,61 +0,0 @@
package kr.xit.batch.ens.task;
import kr.xit.batch.ens.task.cmm.TaskCmmUtils;
import kr.xit.biz.ens.service.IEnsCctvFileService;
import kr.xit.core.exception.ErrorParse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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;
/**
* <pre>
* description : CCTV ()
*
* packageName : kr.xit.batch.ens.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 {
MDC.put("service_error_msg", "");
service.createCctvFileOfSg();
}catch(Exception e){
String errMsg = ErrorParse.extractError(e).getMessage();
log.error("EnsCctvFileTasklet error :: {}", e.getMessage());
MDC.put("service_error_msg", errMsg);
TaskCmmUtils.taskBatchErrorLog(
contribution.getStepExecution().getJobExecution().getJobInstance().getJobName(),
errMsg,
isSlackEnabled
);
contribution.setExitStatus(ExitStatus.FAILED);
return RepeatStatus.FINISHED;
}
contribution.setExitStatus(ExitStatus.COMPLETED);
return RepeatStatus.FINISHED;
}
}

@ -1,60 +0,0 @@
package kr.xit.batch.ens.task;
import kr.xit.batch.ens.task.cmm.TaskCmmUtils;
import kr.xit.biz.ens.service.IEnsOtherMergeService;
import kr.xit.core.exception.ErrorParse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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;
/**
* <pre>
* description :
*
* packageName : kr.xit.batch.ens.task
* fileName : OtherMergeTasklet
* author : jhseo
* date : 2024-01-10
* ======================================================================
*
* ----------------------------------------------------------------------
* 2024-01-10 jhseo
*
* </pre>
*/
@Slf4j
@RequiredArgsConstructor
public class OtherMergeTasklet implements Tasklet {
private final IEnsOtherMergeService service;
@Override
@JobScope
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) {
final String isSlackEnabled = contribution.getStepExecution().getJobParameters().getString("isSlackEnabled");
try {
MDC.put("service_error_msg", "");
service.mergeData();
}catch(Exception e){
String errMsg = ErrorParse.extractError(e).getMessage();
log.error("OtherMergeTasklet error :: {}", e.getMessage());
MDC.put("service_error_msg", errMsg);
TaskCmmUtils.taskBatchErrorLog(
contribution.getStepExecution().getJobExecution().getJobInstance().getJobName(),
errMsg,
isSlackEnabled
);
contribution.setExitStatus(ExitStatus.FAILED);
return RepeatStatus.FINISHED;
}
contribution.setExitStatus(ExitStatus.COMPLETED);
return RepeatStatus.FINISHED;
}
}

@ -1,67 +0,0 @@
package kr.xit.batch.ens.task;
import kr.xit.batch.ens.task.cmm.TaskCmmUtils;
import kr.xit.biz.pni.service.IPniCctvFileService;
import kr.xit.core.exception.ErrorParse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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;
/**
* <pre>
* description : CCTV accept
*
* packageName : kr.xit.batch.ens.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 {
MDC.put("service_error_msg", "");
service.acceptPniNtnccntcSndng();
}catch(Exception e){
String errMsg = ErrorParse.extractError(e).getMessage();
log.error("PniCctvAcceptTasklet error :: {}", e.getMessage());
MDC.put("service_error_msg", errMsg);
TaskCmmUtils.taskBatchErrorLog(
contribution.getStepExecution().getJobExecution().getJobInstance().getJobName(),
errMsg,
isSlackEnabled
);
TaskCmmUtils.taskEnsBatchServiceUpdateErrorLog(
contribution.getStepExecution().getJobExecution().getJobInstance().getJobName(),
errMsg,
isSlackEnabled
);
contribution.setExitStatus(ExitStatus.FAILED);
return RepeatStatus.FINISHED;
}
contribution.setExitStatus(ExitStatus.COMPLETED);
return RepeatStatus.FINISHED;
}
}

@ -1,61 +0,0 @@
package kr.xit.batch.ens.task;
import kr.xit.batch.ens.task.cmm.TaskCmmUtils;
import kr.xit.biz.pni.service.IPniCctvFileService;
import kr.xit.core.exception.ErrorParse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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;
/**
* <pre>
* description : CCTV ()
*
* packageName : kr.xit.batch.ens.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 {
MDC.put("service_error_msg", "");
service.createCctvFileOfSg();
}catch(Exception e){
String errMsg = ErrorParse.extractError(e).getMessage();
log.error("PniCctvFileTasklet error :: {}", e.getMessage());
MDC.put("service_error_msg", errMsg);
TaskCmmUtils.taskBatchErrorLog(
contribution.getStepExecution().getJobExecution().getJobInstance().getJobName(),
errMsg,
isSlackEnabled
);
contribution.setExitStatus(ExitStatus.FAILED);
return RepeatStatus.FINISHED;
}
contribution.setExitStatus(ExitStatus.COMPLETED);
return RepeatStatus.FINISHED;
}
}

@ -1,19 +1,9 @@
package kr.xit.batch.ens.web;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import kr.xit.batch.ens.job.*;
import kr.xit.biz.common.ApiConstants;
import kr.xit.biz.ens.model.cmm.CmmEnsRequestDTO;
import kr.xit.core.model.ApiResponseDTO;
import kr.xit.core.model.IApiResponse;
import kr.xit.core.support.utils.Checks;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobParameter;
import org.springframework.batch.core.JobParameters;
@ -29,6 +19,21 @@ import org.springframework.web.bind.annotation.RequestBody;
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.batch.ens.job.SndngAcceptJobConfig;
import kr.xit.batch.ens.job.SndngCloseJobConfig;
import kr.xit.batch.ens.job.SndngMakeJobConfig;
import kr.xit.batch.ens.job.SndngSnedBulksJobConfig;
import kr.xit.batch.ens.job.SndngStatusBulksJobConfig;
import kr.xit.biz.common.ApiConstants;
import kr.xit.biz.ens.model.cmm.CmmEnsRequestDTO;
import kr.xit.core.model.ApiResponseDTO;
import kr.xit.core.model.IApiResponse;
import kr.xit.core.support.utils.Checks;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
/**
* <pre>
* description :
@ -60,9 +65,6 @@ public class BatchJobWebController {
private final SndngSnedBulksJobConfig sendBulksJobConfig;
private final SndngStatusBulksJobConfig statusJobConfig;
private final SndngCloseJobConfig closeJobConfig;
private final PniCctvFileJobConfg pniCctvFileJobConfg;
private final PniCctvAcceptJobConfg pniCctvAcceptJobConfg;
private final OtherMergeJobConfig otherMergeJobConfig;
@Operation(summary = "accept", description = "accept")
@PostMapping(value = "/accept", produces = MediaType.APPLICATION_JSON_VALUE)
@ -178,74 +180,6 @@ public class BatchJobWebController {
return ApiResponseDTO.success(HttpStatus.OK);
}
@Operation(summary = "pniCctvFileService", description = "CCTV 사전알림(서광)")
@PostMapping(value = "/pniCctvFileService", produces = MediaType.APPLICATION_JSON_VALUE)
public IApiResponse pniCctvFileService(@RequestBody final CmmEnsRequestDTO reqDTO) {
try {
JobExecution jobExecution = jobLauncher.run(
pniCctvFileJobConfg.pniCctvFileJob(),
getJobParameters(reqDTO, 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")
@PostMapping(value = "/pniCctvAccept", produces = MediaType.APPLICATION_JSON_VALUE)
public IApiResponse pniCctvAccept(@RequestBody final CmmEnsRequestDTO reqDTO) {
try {
JobExecution jobExecution = jobLauncher.run(
pniCctvAcceptJobConfg.pniCctvAcceptJob(),
getJobParameters(reqDTO, 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 = "otherMerge", description = "시설 오라클 DB로 Data Merge")
@PostMapping(value = "/otherMerge", produces = MediaType.APPLICATION_JSON_VALUE)
public IApiResponse otherMerge(@RequestBody final CmmEnsRequestDTO reqDTO) {
try {
JobExecution jobExecution = jobLauncher.run(
otherMergeJobConfig.otherMergeJob(),
getJobParameters(reqDTO, 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 CmmEnsRequestDTO reqDTO, final String processStatus){
Map<String, JobParameter> confMap = new HashMap<>();

@ -152,26 +152,6 @@ public interface IEnsBatchMapper {
*/
<T> int insertKtMobilePageManage(final T t);
/**
* <pre>
*
* - tb_ens_sms_sndng
* @param t T
* @return int
* </pre>
*/
<T> int insertSmsSndng(final T t);
/**
* <pre>
*
* - tb_ens_post_sndng
* @param t T
* @return int
* </pre>
*/
<T> int insertPostSndng(final T t);
/**
* <pre>
* Kt
@ -192,17 +172,6 @@ public interface IEnsBatchMapper {
*/
<T> int insertKtBcDetail(final T t);
/**
* <pre>
* Post plus
* - tb_ens_post_plus
* @param t T
* @return int
* </pre>
*/
<T> int insertPplus(final T t);
/**
* <pre>
*
@ -269,27 +238,6 @@ public interface IEnsBatchMapper {
*/
<T> List<EnsDTO.SendKakaoTgt> selectKakaoSendTgts(final T t);
/**
* <pre>
* E-GREEN
* - tb_ens_sndng_mastr, tb_ens_post_sndng
* @param t status
* @return List<EnsDTO.PostSndng>
* </pre>
*/
<T> List<EnsDTO.PostSndng> selectPostTgts(final T t);
/**
* <pre>
* SMS
* - tb_ens_sndng_mastr, tb_ens_sms_sndng
* @param t status
* @return List<EnsDTO.SmsSndng>
* </pre>
*/
<T> List<EnsDTO.SmsSndng> selectSmsSendTgts(final T t);
/**
* <pre>
* :
@ -388,13 +336,6 @@ public interface IEnsBatchMapper {
* @return int
*/
int updateCntcSndngResultByKkoMyDoc(final CntcDTO.SndngResult dto);
/**
* Post plus
* @param unitySndngMstId String
* @return List<String>
*/
List<String> selectPplusResultTgtsByUnitySndngMstId(final String unitySndngMstId);
//----------------------------------------------------------------------
// result
//----------------------------------------------------------------------

@ -1,33 +0,0 @@
package kr.xit.biz.ens.mapper;
import kr.xit.biz.ens.model.EnsDTO;
import kr.xit.biz.ens.model.EnsDTO.EnsNtncCntcSndngTgt;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import java.util.List;
/**
* <pre>
* description :
*
* packageName : kr.xit.biz.ens.mapper
* fileName : IEnsCctvFileMapper
* author : seojh
* date : 2023-07-17
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-07-17 seojh
*
* </pre>
*/
@Mapper
public interface IEnsCctvFileMapper {
int selectLicense(String jobSeCode);
int insertNtcnCntcData(EnsDTO.NtcnCntcData dto);
List<EnsNtncCntcSndngTgt> selectEnsNtncCntcSndngs();
int insertCntcSndngMst(EnsNtncCntcSndngTgt dto);
int insertCntcSndngDtl(EnsNtncCntcSndngTgt dto);
int updateEnsNtcnCntcData(EnsNtncCntcSndngTgt dto);
}

@ -175,16 +175,10 @@ public class EnsBatchMakeService extends AbstractService implements IEnsBatchMak
* - ( ), 1 , 2
* KAKAO - {@link IEnsBatchMapper#insertKakaoMyDocs(Object) insertKakaoMyDocs}
* - tb_ens_kakao_my_doc
* E_GREEN - {@link IEnsBatchMapper#insertPostSndng(Object) insertPostSndng}
* - tb_ens_post_sndng
* SMS - {@link IEnsBatchMapper#insertSmsSndng(Object) insertSmsSndng}
* - tb_ens_sms_sndng
* KT_BC - {@link IEnsBatchMapper#insertKtBcMastr(Object) insertKtBcMastr}
* - tb_ens_kt_bc_mastr FIXME::
* - {@link IEnsBatchMapper#insertKtBcDetail(Object) insertKtBcDetail}
* - tb_ens_kt_bc_detail FIXME::
* PPLUS - {@link IEnsBatchMapper#insertPplus(Object) insertPplus}
* - tb_ens_ FIXME::
* @param dto SndngMssageParam
* @return int
* </pre>

@ -1,311 +0,0 @@
package kr.xit.biz.ens.service;
import static egovframework.com.cmm.util.EgovDateUtil.formatDate;
import static egovframework.com.cmm.util.EgovDateUtil.formatTime;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import kr.xit.biz.ens.mapper.IEnsCctvFileMapper;
import kr.xit.biz.ens.model.EnsDTO;
import kr.xit.biz.ens.model.EnsDTO.EnsNtncCntcSndngTgt;
import kr.xit.core.service.AbstractService;
import kr.xit.core.support.utils.Checks;
import kr.xit.core.support.utils.DateUtils;
import kr.xit.core.support.utils.SFTPUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* <pre>
* description : CCTV
*
* packageName : kr.xit.biz.ens.service
* fileName : EnsCctvFileService
* author : seojh
* date : 2023-07-17
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-07-17 seojh
*
* </pre>
*/
@Slf4j
@RequiredArgsConstructor
@Service
public class EnsCctvFileService extends AbstractService implements IEnsCctvFileService {
@Value("${app.ssh.host}") private String host;
@Value("${app.ssh.port}") private int port;
@Value("${app.ssh.id}") private String id;
@Value("${app.ssh.passwd}") private String passwd;
@Value("${app.ssh.sg.ens-path}") private String ensPath;
@Value("${app.ssh.sg.rcv}") private String rcvPath;
@Value("${app.ssh.sg.backup}") private String backupPath;
@Value("${app.ssh.sg.err}") private String errPath;
private final IEnsCctvFileMapper mapper;
/**
* cctv ()
*/
@Override
@Transactional
public void createCctvFileOfSg() {
// 전자 고지 라이선스 유효성 체크
int licenseCnt = mapper.selectLicense("ENS");
if(licenseCnt == 0) return;
SFTPUtils sftp = null;
try {
// SFTP connect
sftp = new SFTPUtils();
sftp.init(host, port, id, passwd, StringUtils.EMPTY);
// 서광 CCTV 전자 고지 대상 조회
final String srcPath = ensPath + rcvPath;
ArrayList<String> fileNameList = sftp.findFileNameList(srcPath);
//if(fileNameList.size() == 0) throw BizRuntimeException.create("사전고지[서광] 처리 대상이 없습니다");
// 에러 파일 목록
ArrayList<String> errFileList = new ArrayList<>();
// 성공 파일 목록
ArrayList<String> rtnFileList = new ArrayList<>();
for (String fn : fileNameList) {
String[] arrFi = fn.split("_");
// 파일 이름 정보 오류시
if (arrFi.length != 4 || arrFi[0].length() != 14) {
errFileList.add(fn);
continue;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// FIXME :: GS 임시 소스
// 파일 다운로드
final String downLoadPath = "D:/ImageData/ENS" + "/" + DateUtils.getToday(StringUtils.EMPTY);
File Folder = new File(downLoadPath);
if (!Folder.exists()) Folder.mkdir(); //폴더 생성합니다.
sftp.fileDownload(srcPath + "/" + fn, downLoadPath);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// FIXME : 중복데이타(단속시간 + 차량번호)인 경우 데이타 skip 하도록 해야 할 듯
// 전자 고지 연계 데이타 생성
mapper.insertNtcnCntcData(
EnsDTO.NtcnCntcData.builder()
.regltDt(arrFi[0])
.vhcleNo(arrFi[1])
.sptNm(arrFi[2])
.sptAcctoCode(arrFi[3].split("\\.")[0])
.fileNm(fn)
.build()
);
rtnFileList.add(fn);
// FIXME :: sftp rm 기능 추후 제거
// 파일 삭제
sftp.rm(fn);
}
// FIXME :: sftp move 기능 추후 사용
// 처리한 데이타 backup
//fileBackup(sftp, srcPath, errFileList, rtnFileList);
} finally {
if(sftp != null) sftp.disconnect();
}
}
/**
* accept
* 1.
* 2.
* 3.
* 4.
*/
@Override
@Transactional
public void acceptEnsNtnccntcSndng() {
List<EnsNtncCntcSndngTgt> tgtList = mapper.selectEnsNtncCntcSndngs();
if(tgtList.isEmpty()) return;
// search 전자 고지 연계발송 데이타 생성 대상
Optional<EnsNtncCntcSndngTgt> first = tgtList.stream()
.filter(dto -> "Y".equals(dto.getTgtYn()))
.findFirst();
// 전자 고지 연계발송 master 생성
final String unitySndngMastrId;
final String closDt;
if(first.isPresent()){
EnsNtncCntcSndngTgt tgtDTO = first.get();
mapper.insertCntcSndngMst(tgtDTO);
unitySndngMastrId = tgtDTO.getUnitySndngMastrId();
closDt = tgtDTO.getClosDt();
MDC.put("unitySndngMastrId", unitySndngMastrId);
} else {
unitySndngMastrId = null;
closDt = null;
}
// 전자 고지 연계발송 상세 생성 및 결과 처리(전자 고지 연계 데이타 반영)
// 전자 고지 대상 -> 전자 고지 연계 발송 상세 생성
// 전자 고지 연계 데이타 -> 연계 결과 반영
// : 대상 : 연계대상-Y, 진행상태-Y, 통합발송상세ID
// 미대상 : 연계대상-N, 진행상태-Y, 통합발송상세ID = null
tgtList.forEach(dto -> {
dto.setProcessAt("Y");
if("Y".equals(dto.getTgtYn())){
dto.setUnitySndngMastrId(unitySndngMastrId);
dto.setClosDt(closDt);
dto.setMobilePageCn(jsonCn(dto));
mapper.insertCntcSndngDtl(dto);
}
mapper.updateEnsNtcnCntcData(dto);
});
}
private void fileBackup(SFTPUtils sftp, String srcPath, ArrayList<String> errFileList, ArrayList<String> rtnFileList) {
final String errorPath = ensPath + errPath;
String destPath = ensPath + backupPath;
destPath = destPath + "/" + DateUtils.getToday(StringUtils.EMPTY);
log.info("src path::[{}]", srcPath);
log.info("tgt path::[{}]", destPath);
// file backup
for (String fn : rtnFileList) {
log.info("fileName::[{}]", fn);
sftp.mv(srcPath + "/" + fn, destPath + "/" + fn);
}
// error file backup
for (String fn : errFileList) {
sftp.mv(srcPath + "/" + fn, errorPath + "/" + fn);
}
}
private String jsonCn(EnsNtncCntcSndngTgt dto){
String jsonCn = "{"
+ "\"details\": ["
+ "{"
+ "\"title\": \"주정차 위반 과태료 통지서\","
+ "\"item_type\": \"SUBJECT_TEXT\","
+ "\"elements\": ["
+ "\"\""
+ "]"
+ "},"
+ "{"
+ "\"title\": \"위반내역\","
+ "\"item_type\": \"KEY_VALUE\","
+ "\"properties\": {"
+ "},"
+ "\"elements\": ["
+ "{"
+ "\"key\": \"차량번호\","
+ "\"value\": \""+ Checks.checkVal(dto.getVhcleNo(),"") +"\","
+ "\"level\": 1"
+ "},"
+ "{"
+ "\"key\": \"성명\","
+ "\"value\": \""+ Checks.checkVal(dto.getNm(),"") +"\","
+ "\"level\": 1"
+ "},"
+ "{"
+ "\"key\": \"위반일시\","
+ "\"value\": \""+ Checks.checkVal(formatDate(dto.getRegltDt().substring(0,8), "-") + " " + formatTime(dto.getRegltDt().substring(8,14), ":"),"") +"\","
+ "\"level\": 1"
+ "},"
+ "{"
+ "\"key\": \"위반내용\","
+ "\"value\": \"주정차금지 구역\","
+ "\"level\": 1"
+ "},"
+ "{"
+ "\"key\": \"위반장소\","
+ "\"value\": \""+ Checks.checkVal(dto.getSptNm(),"") +"\","
+ "\"level\": 1"
+ "},"
+ "{"
+ "\"key\": \"납부금액\","
+ "\"value\": \"32,000원\","
+ "\"level\": 1"
+ "},"
+ "{"
+ "\"key\": \"단속구분\","
+ "\"value\": \"CCTV\","
+ "\"level\": 1"
+ "},"
+ "{"
+ "\"key\": \"자진납부 기한\","
+ "\"value\": \""+ Checks.checkVal(formatDate(dto.getClosDt().substring(0,8), "-"),"") +"\\\\n위 납부 기한이 경과 시에는 과태료 감경 혜택을 받으실 수 없습니다.\","
+ "\"level\": 1"
+ "}"
+ "]"
+ "},"
+ "{"
+ "\"title\": \"과태료 부과 및 감경\","
+ "\"item_type\": \"TABLE\","
+ "\"elements\": {"
+ "\"head\": ["
+ "\"구분\","
+ "\"승용 감경금액\\\\n(부과금액)\","
+ "\"승합 감경금액\\\\n(부과금액)\""
+ "],"
+ "\"rows\": ["
+ "["
+ "\"주정차금지구역\","
+ "\"32,000원\\\\n(40,000원)\","
+ "\"40,000원\\\\n(50,000원)\""
+ "],"
+ "["
+ "\"같은 장소 2시간 초과\","
+ "\"40,000원\\\\n(50,000원)\","
+ "\"48,000원\\\\n(60,000원)\""
+ "]"
+ "]"
+ "}"
+ "},"
+ "{"
+ "\"title\": \"질서위반행위 규제법 시행령 규정 감경 대상\","
+ "\"item_type\": \"KEY_VALUE\","
+ "\"elements\": ["
+ "{"
+ "\"key\": \"감경대상자\","
+ "\"value\": \"○ 국민기초생활 수급자\\\\n○ 한부모가족 보호대상자\\\\n○ 장애의 정도가 심한 장애인\\\\n○ 국가유공자(상이등급 3급 이상)\\\\n○ 미성년자\","
+ "\"level\": 1"
+ "},"
+ "{"
+ "\"key\": \"시행일\","
+ "\"value\": \"2010년 1월 16일 부터\\\\n○ 적용 : 시행일 이후 단속된 차량\","
+ "\"level\": 1"
+ "},"
+ "{"
+ "\"key\": \"감경율(%)\","
+ "\"value\": \"과태료 부과금액의 50%\","
+ "\"level\": 1"
+ "},"
+ "{"
+ "\"key\": \"비고\","
+ "\"value\": \"※ 자진 납부 시 추가감경 가능\","
+ "\"level\": 1"
+ "}"
+ "]"
+ "}"
+ "]"
+"}";
return jsonCn;
}
}

@ -1,68 +0,0 @@
package kr.xit.biz.ens.service;
import kr.xit.biz.ens.cmm.CmmEnsBizUtils;
import kr.xit.core.exception.BizRuntimeException;
import kr.xit.core.model.ApiResponseDTO;
import kr.xit.core.service.AbstractService;
import kr.xit.core.spring.util.ApiWebClientUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
/**
* <pre>
* description : Oracle DB Merge
* - Transaction
* - Transactional(propagation = Propagation.REQUIRES_NEW)
* packageName : kr.xit.biz.ens.service
* fileName : EnsOtherMergeService
* author : jhseo
* date : 2023-08-31
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-08-31 jhseo
*
* </pre>
*/
@Slf4j
@RequiredArgsConstructor
@Service
public class EnsOtherMergeService extends AbstractService implements IEnsOtherMergeService {
@Value("${app.contract.host}")
private String apiHost;
@Value("${app.contract.other.api.merge}")
private String apiOtherMerge;
private final ApiWebClientUtil apiWebClient;
/**
* <pre>
* () send bulks - send
* </pre>
*/
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void mergeData() {
final String url = apiHost + apiOtherMerge;
final ApiResponseDTO apiResult = apiWebClient.exchange(
url,
HttpMethod.POST,
"",
ApiResponseDTO.class,
CmmEnsBizUtils.getHeadeMap());
String errMsg = "";
if(apiResult.getData() != null) {
if(!"success".equals(apiResult.getData())){
errMsg = apiResult.getMessage();
throw BizRuntimeException.create(errMsg);
}
}
}
}

@ -1,28 +0,0 @@
package kr.xit.biz.ens.service;
/**
* <pre>
* description :
*
* packageName : kr.xit.biz.ens.service
* fileName : IEnsCctvFileService
* author : seojh
* date : 2023-07-17
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-07-17 seojh
*
* </pre>
*/
public interface IEnsCctvFileService {
/**
* cctv ()
*/
void createCctvFileOfSg();
/**
* accept
*/
void acceptEnsNtnccntcSndng();
}

@ -1,20 +0,0 @@
package kr.xit.biz.ens.service;
/**
* <pre>
* description : Oracle DB Merge
*
* packageName : kr.xit.biz.ens.service
* fileName : IEnsOtherMergeService
* author : jhseo
* date : 2024-01-10
* ======================================================================
*
* ----------------------------------------------------------------------
* 2024-01-10 jhseo
*
* </pre>
*/
public interface IEnsOtherMergeService {
void mergeData();
}

@ -1,49 +0,0 @@
package kr.xit.biz.ens.web;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import kr.xit.biz.ens.service.IEnsCctvFileService;
import kr.xit.core.model.ApiResponseDTO;
import kr.xit.core.model.IApiResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <pre>
* description :
*
* packageName : kr.xit.biz.pni.web
* fileName : PniCctvFileController
* author : limju
* date : 2023-07-07
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-07-07 limju
*
* </pre>
*/
@Tag(name = " EnsCctvFileController", description = "전자고지 CCTV 파일 연계 테스트")
@RequiredArgsConstructor
@RestController
@RequestMapping("/batch/ens/v1")
public class EnsCctvFileController {
private final IEnsCctvFileService service;
@Operation(summary = "전자고지 파일 연계 데이타 생성(서광)", description = "전자고지 파일 연계 데이타 생성(서광)")
@PostMapping(value = "/createCctvFileOfSg", produces = MediaType.APPLICATION_JSON_VALUE)
public IApiResponse createCctvFileOfSg() {
service.createCctvFileOfSg();
return ApiResponseDTO.success();
}
@Operation(summary = "전자고지 연계 데이타 생성(accept)", description = "전자고지 연계 데이타 생성(accept)")
@PostMapping(value = "/acceptEnsNtnccntcSndng", produces = MediaType.APPLICATION_JSON_VALUE)
public IApiResponse acceptEnsNtnccntcSndng() {
service.acceptEnsNtnccntcSndng();
return ApiResponseDTO.success();
}
}

@ -1,151 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="kr.xit.biz.pni.mapper.IPniCctvFileMapper">
<select id="selectLicense" resultType="int">
/** pni-mysql-mapper|selectEnsLicense-사전알림 라이선스 체크 */
SELECT count(1)
FROM tb_cmm_license_manage tcmls
WHERE tcmls.job_se_code = #{jobSeCode} AND tcmls.sptaccto_code IS NULL
</select>
<insert id="insertNtcnCntcData">
/** pni-mysql-mapper|insertNtcnCntcData-사전알림연계데이타 생성|julim */
<selectKey keyProperty="ntcnCntcDataId" resultType="string" order="BEFORE">
SELECT concat(date_format(now(), '%Y%m%d'), LPAD(NEXTVAL(tb_pni_ntcn_cntc_data_seq), 12, '0')) from dual
</selectKey>
INSERT
INTO tb_pni_ntcn_cntc_data (
ntcn_cntc_data_id, /* 사전알림연계데이타 ID*/
reglt_dt, /* 단속일시 */
vhcle_no, /* 차량번호 */
spt_nm, /* 현장명 */
spt_accto_code, /* 현장별코드 */
file_nm, /* 파일명 */
regist_dt,
register
) VALUES (
#{ntcnCntcDataId},
#{regltDt},
#{vhcleNo},
#{sptNm},
#{sptAcctoCode},
#{fileNm},
now(),
'batch'
)
</insert>
<select id="selectPniNtncCntcSndngs" resultType="kr.xit.biz.pni.model.PniDTO$PniNtncCntcSndngTgts">
/** pni-mysql-mapper|selectPniNtnccntcSndngs-사전알림 연계 발송 데이타 대상 조회|julim */
SELECT tpncd.ntcn_cntc_data_id /* 사전알림연계데이타 ID*/
, tpncd.vhcle_no /* 차량번호 */
, tpncd.process_at /* 진행상태 */
, tpnt.ntcn_trget_id /* 사전알림대상Id */
, tpnt.moblphon_no /* 핸드폰 번호 */
, tpnt.nm /* 이름 */
, tpnt.brthdy /* 생년월일 */
, tpnt.delete_yn /* 삭제여부(수신여부) */
, CASE WHEN tpnt.sndng_se_code='SMS' THEN 'JU201'
WHEN tpnt.sndng_se_code='KKO-MY-DOC' THEN 'JU202'
ELSE '' END AS tmplatId
, IF(((tpnt.vhcle_no != null OR tpnt.vhcle_no != '') AND tclm.license IS NOT NULL), 'Y', 'N') AS tgtYn /* 사전알림 대상 여부 */
, COUNT(*) OVER(PARTITION BY sndng_se_code, IF(((tpnt.vhcle_no != null OR tpnt.vhcle_no != '') AND tclm.license IS NOT NULL), 'Y', 'N')) AS sndngCo /* 발송 건수 */
FROM tb_pni_ntcn_cntc_data tpncd
LEFT OUTER JOIN tb_pni_ntcn_trget tpnt
ON (tpncd.vhcle_no = tpnt.vhcle_no AND IFNULL(tpnt.delete_yn, 'N') = 'N')
LEFT OUTER JOIN tb_cmm_license_manage tclm
ON (tpncd.spt_accto_code=tclm.sptaccto_code)
WHERE tpncd.process_at = 'N'
</select>
<insert id="insertCntcSndngMst">
/** pni-mysql-mapper|insertCntcSndngMst-연계발송마스터 생성|julim */
<selectKey keyProperty="unitySndngMastrId" resultType="string" order="BEFORE">
SELECT concat('P', signgu_code, ffnlg_code, RIGHT(date_format(now(), '%Y'),2), LPAD(NEXTVAL(tb_cntc_sndng_mastr_seq), 7, '0'))
FROM tb_ens_tmplat_manage
WHERE sndng_ty_code = #{sndngTyCode}
AND tmplat_id = #{tmplatId}
</selectKey>
INSERT
INTO tb_cntc_sndng_mastr (
unity_sndng_mastr_id, /* 통합발송마스터 id */
signgu_code, /* 시군구코드 */
ffnlg_code, /* 과태료코드 */
tmplat_id, /* 템플릿ID */
sndng_ty_code, /* 발송유형 코드 */
sndng_co, /* 발송 건수 */
sndng_process_sttus, /* 발송처리 상태 */
sndng_dt, /* 발송일시 */
clos_dt, /* 마감일시 */
regist_dt,
register
)
SELECT #{unitySndngMastrId}
, tetm.signgu_code
, tetm.ffnlg_code
, tetm.tmplat_id
, tetm.sndng_ty_code
, #{sndngCo}
, #{sndngProcessSttus}
, date_format(now(), '%Y%m%d%H%i%S')
, date_format(date_add(now(), interval +1 day), '%Y%m%d%H%i%S')
, now()
, 'batch'
FROM tb_ens_tmplat_manage tetm
WHERE sndng_ty_code = #{sndngTyCode}
AND tmplat_id = #{tmplatId}
</insert>
<insert id="insertCntcSndngDtl">
/** pni-mysql-mapper|insertCntcSndngDtl-연계발송상세 생성|julim */
<selectKey keyProperty="unitySndngDetailId" resultType="string" order="BEFORE">
SELECT concat('P', signgu_code, ffnlg_code, RIGHT(date_format(now(), '%Y'),2), LPAD(NEXTVAL(tb_cntc_sndng_detail_seq), 7, '0'))
FROM tb_ens_tmplat_manage
WHERE sndng_ty_code = #{sndngTyCode}
AND tmplat_id = #{tmplatId}
</selectKey>
INSERT
INTO tb_cntc_sndng_detail (
unity_sndng_detail_id, /* 통합발송 상세ID */
unity_sndng_mastr_id, /* 통합발송 마스터ID */
signgu_code, /* 시군구 코드 */
ffnlg_code, /* 과태료 코드 */
ihidnum, /* 주민번호 */
vhcle_no, /* 차량번호 */
moblphon_no, /* 핸드폰 번호 */
nm, /* 이름 */
tmplt_msg_data, /* 템플릿메시지 데이타 */
mobile_page_cn, /* 모바일 페이지 내용 */
regist_dt,
register
)
SELECT #{unitySndngDetailId}
, #{unitySndngMastrId}
, tetm.signgu_code
, tetm.ffnlg_code
, #{brthdy}
, #{vhcleNo}
, #{moblphonNo}
, #{nm}
, #{tmpltMsgData}
, #{mobilePageCn}
, now()
, 'batch'
FROM tb_ens_tmplat_manage tetm
WHERE sndng_ty_code = #{sndngTyCode}
AND tmplat_id = #{tmplatId}
</insert>
<update id="updatePniNtcnCntcData">
/** pni-mysql-mapper|updatePniNtcnCntcData-사전알림 연계데이타 연계결과 반영|julim */
UPDATE tb_pni_ntcn_cntc_data
SET process_at = #{processAt}
, trget_at = #{tgtYn}
, unity_sndng_detail_id = #{unitySndngDetailId}
, updt_dt = now()
, updusr = 'batch'
WHERE ntcn_cntc_data_id = #{ntcnCntcDataId}
</update>
</mapper>
Loading…
Cancel
Save