배치 QSP에서 수동으로 실행시킬 때 리턴 타입 변경
This commit is contained in:
parent
e8967aa333
commit
72aeafd138
@ -1,9 +1,12 @@
|
|||||||
package com.interplug.qcast.batch;
|
package com.interplug.qcast.batch;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import lombok.RequiredArgsConstructor;
|
import org.springframework.batch.core.BatchStatus;
|
||||||
|
import org.springframework.batch.core.ExitStatus;
|
||||||
import org.springframework.batch.core.Job;
|
import org.springframework.batch.core.Job;
|
||||||
|
import org.springframework.batch.core.JobExecution;
|
||||||
import org.springframework.batch.core.JobParameters;
|
import org.springframework.batch.core.JobParameters;
|
||||||
import org.springframework.batch.core.JobParametersBuilder;
|
import org.springframework.batch.core.JobParametersBuilder;
|
||||||
import org.springframework.batch.core.JobParametersInvalidException;
|
import org.springframework.batch.core.JobParametersInvalidException;
|
||||||
@ -16,6 +19,7 @@ import org.springframework.scheduling.annotation.Scheduled;
|
|||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@ -38,26 +42,41 @@ public class JobLauncherController {
|
|||||||
* @throws JobRestartException
|
* @throws JobRestartException
|
||||||
*/
|
*/
|
||||||
@GetMapping("/batch/job/{jobName}") // Path Variable로 jobName을 받음
|
@GetMapping("/batch/job/{jobName}") // Path Variable로 jobName을 받음
|
||||||
public String launchJob(@PathVariable String jobName)
|
public Map<String, Object> launchJob(@PathVariable String jobName)
|
||||||
throws JobInstanceAlreadyCompleteException,
|
throws JobInstanceAlreadyCompleteException, JobExecutionAlreadyRunningException,
|
||||||
JobExecutionAlreadyRunningException,
|
JobParametersInvalidException, JobRestartException {
|
||||||
JobParametersInvalidException,
|
|
||||||
JobRestartException {
|
|
||||||
|
|
||||||
Job job = jobs.get(jobName);
|
Job job = jobs.get(jobName);
|
||||||
|
Map<String, Object> resultMap = new HashMap<String, Object>();
|
||||||
if (job == null) {
|
if (job == null) {
|
||||||
return "Job " + jobName + " not found";
|
// return "Job " + jobName + " not found";
|
||||||
|
resultMap.put("code", "FAILED");
|
||||||
|
resultMap.put("message", "Job" + jobName + " not found");
|
||||||
|
return resultMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
JobParameters jobParameters =
|
JobParameters jobParameters = new JobParametersBuilder().addString("jobName", jobName)
|
||||||
new JobParametersBuilder()
|
.addDate("time", new Date()).toJobParameters();
|
||||||
.addString("jobName", jobName)
|
|
||||||
.addDate("time", new Date())
|
|
||||||
.toJobParameters();
|
|
||||||
|
|
||||||
jobLauncher.run(job, jobParameters);
|
JobExecution jobExecution = jobLauncher.run(job, jobParameters);
|
||||||
|
|
||||||
return "Job " + jobName + " started";
|
|
||||||
|
|
||||||
|
BatchStatus status = jobExecution.getStatus();
|
||||||
|
ExitStatus exitStatus = jobExecution.getExitStatus();
|
||||||
|
|
||||||
|
if ("COMPLETED".equals(status.toString())) {
|
||||||
|
resultMap.put("code", status.toString());
|
||||||
|
resultMap.put("message", exitStatus.getExitDescription());
|
||||||
|
|
||||||
|
} else {
|
||||||
|
resultMap.put("code", status.toString());
|
||||||
|
resultMap.put("message", exitStatus.getExitDescription());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// return "Job " + jobName + " started";
|
||||||
|
return resultMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -71,11 +90,8 @@ public class JobLauncherController {
|
|||||||
*/
|
*/
|
||||||
// @Scheduled(cron = "*/5 * * * * *")
|
// @Scheduled(cron = "*/5 * * * * *")
|
||||||
@Scheduled(cron = "0 55 23 * * *")
|
@Scheduled(cron = "0 55 23 * * *")
|
||||||
public String storeAdditionalInfoJob()
|
public String storeAdditionalInfoJob() throws JobInstanceAlreadyCompleteException,
|
||||||
throws JobInstanceAlreadyCompleteException,
|
JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException {
|
||||||
JobExecutionAlreadyRunningException,
|
|
||||||
JobParametersInvalidException,
|
|
||||||
JobRestartException {
|
|
||||||
|
|
||||||
String jobName = "storeAdditionalJob";
|
String jobName = "storeAdditionalJob";
|
||||||
Job job = jobs.get(jobName);
|
Job job = jobs.get(jobName);
|
||||||
@ -101,11 +117,8 @@ public class JobLauncherController {
|
|||||||
* @throws JobRestartException
|
* @throws JobRestartException
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 30 02 * * *")
|
@Scheduled(cron = "0 30 02 * * *")
|
||||||
public String materialJob()
|
public String materialJob() throws JobInstanceAlreadyCompleteException,
|
||||||
throws JobInstanceAlreadyCompleteException,
|
JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException {
|
||||||
JobExecutionAlreadyRunningException,
|
|
||||||
JobParametersInvalidException,
|
|
||||||
JobRestartException {
|
|
||||||
|
|
||||||
String jobName = "materialJob";
|
String jobName = "materialJob";
|
||||||
Job job = jobs.get(jobName);
|
Job job = jobs.get(jobName);
|
||||||
@ -132,11 +145,8 @@ public class JobLauncherController {
|
|||||||
* @throws JobRestartException
|
* @throws JobRestartException
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 40 02 * * *")
|
@Scheduled(cron = "0 40 02 * * *")
|
||||||
public String bomJob()
|
public String bomJob() throws JobInstanceAlreadyCompleteException,
|
||||||
throws JobInstanceAlreadyCompleteException,
|
JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException {
|
||||||
JobExecutionAlreadyRunningException,
|
|
||||||
JobParametersInvalidException,
|
|
||||||
JobRestartException {
|
|
||||||
|
|
||||||
String jobName = "bomJob";
|
String jobName = "bomJob";
|
||||||
Job job = jobs.get(jobName);
|
Job job = jobs.get(jobName);
|
||||||
@ -164,11 +174,8 @@ public class JobLauncherController {
|
|||||||
* @throws JobRestartException
|
* @throws JobRestartException
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 40 03 * * *")
|
@Scheduled(cron = "0 40 03 * * *")
|
||||||
public String businessChargerJob()
|
public String businessChargerJob() throws JobInstanceAlreadyCompleteException,
|
||||||
throws JobInstanceAlreadyCompleteException,
|
JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException {
|
||||||
JobExecutionAlreadyRunningException,
|
|
||||||
JobParametersInvalidException,
|
|
||||||
JobRestartException {
|
|
||||||
|
|
||||||
String jobName = "businessChargerJob";
|
String jobName = "businessChargerJob";
|
||||||
Job job = jobs.get(jobName);
|
Job job = jobs.get(jobName);
|
||||||
@ -196,11 +203,8 @@ public class JobLauncherController {
|
|||||||
* @throws JobRestartException
|
* @throws JobRestartException
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 0 01 * * *")
|
@Scheduled(cron = "0 0 01 * * *")
|
||||||
public String adminUserJob()
|
public String adminUserJob() throws JobInstanceAlreadyCompleteException,
|
||||||
throws JobInstanceAlreadyCompleteException,
|
JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException {
|
||||||
JobExecutionAlreadyRunningException,
|
|
||||||
JobParametersInvalidException,
|
|
||||||
JobRestartException {
|
|
||||||
|
|
||||||
String jobName = "adminUserJob";
|
String jobName = "adminUserJob";
|
||||||
Job job = jobs.get(jobName);
|
Job job = jobs.get(jobName);
|
||||||
@ -228,11 +232,8 @@ public class JobLauncherController {
|
|||||||
* @throws JobRestartException
|
* @throws JobRestartException
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 0 0 * * *")
|
@Scheduled(cron = "0 0 0 * * *")
|
||||||
public String priceJob()
|
public String priceJob() throws JobInstanceAlreadyCompleteException,
|
||||||
throws JobInstanceAlreadyCompleteException,
|
JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException {
|
||||||
JobExecutionAlreadyRunningException,
|
|
||||||
JobParametersInvalidException,
|
|
||||||
JobRestartException {
|
|
||||||
|
|
||||||
String jobName = "priceJob";
|
String jobName = "priceJob";
|
||||||
Job job = jobs.get(jobName);
|
Job job = jobs.get(jobName);
|
||||||
@ -260,11 +261,8 @@ public class JobLauncherController {
|
|||||||
* @throws JobRestartException
|
* @throws JobRestartException
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 10 03 * * *")
|
@Scheduled(cron = "0 10 03 * * *")
|
||||||
public String commonCodeJob()
|
public String commonCodeJob() throws JobInstanceAlreadyCompleteException,
|
||||||
throws JobInstanceAlreadyCompleteException,
|
JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException {
|
||||||
JobExecutionAlreadyRunningException,
|
|
||||||
JobParametersInvalidException,
|
|
||||||
JobRestartException {
|
|
||||||
|
|
||||||
String jobName = "commonCodeJob";
|
String jobName = "commonCodeJob";
|
||||||
Job job = jobs.get(jobName);
|
Job job = jobs.get(jobName);
|
||||||
@ -291,11 +289,8 @@ public class JobLauncherController {
|
|||||||
* @throws JobRestartException
|
* @throws JobRestartException
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 30 23 * * *")
|
@Scheduled(cron = "0 30 23 * * *")
|
||||||
public String specialNoteDispItemAdditionalInfoJob()
|
public String specialNoteDispItemAdditionalInfoJob() throws JobInstanceAlreadyCompleteException,
|
||||||
throws JobInstanceAlreadyCompleteException,
|
JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException {
|
||||||
JobExecutionAlreadyRunningException,
|
|
||||||
JobParametersInvalidException,
|
|
||||||
JobRestartException {
|
|
||||||
String jobName = "specialNoteDispItemAdditionalJob";
|
String jobName = "specialNoteDispItemAdditionalJob";
|
||||||
Job job = jobs.get(jobName);
|
Job job = jobs.get(jobName);
|
||||||
if (job == null) {
|
if (job == null) {
|
||||||
@ -322,11 +317,8 @@ public class JobLauncherController {
|
|||||||
* @throws JobRestartException
|
* @throws JobRestartException
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "1 0 0 * * *")
|
@Scheduled(cron = "1 0 0 * * *")
|
||||||
public String planConfirmJob()
|
public String planConfirmJob() throws JobInstanceAlreadyCompleteException,
|
||||||
throws JobInstanceAlreadyCompleteException,
|
JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException {
|
||||||
JobExecutionAlreadyRunningException,
|
|
||||||
JobParametersInvalidException,
|
|
||||||
JobRestartException {
|
|
||||||
|
|
||||||
String jobName = "planConfirmJob";
|
String jobName = "planConfirmJob";
|
||||||
Job job = jobs.get(jobName);
|
Job job = jobs.get(jobName);
|
||||||
@ -354,11 +346,8 @@ public class JobLauncherController {
|
|||||||
* @throws JobRestartException
|
* @throws JobRestartException
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "1 20 0 * * *")
|
@Scheduled(cron = "1 20 0 * * *")
|
||||||
public String estimateSyncJob()
|
public String estimateSyncJob() throws JobInstanceAlreadyCompleteException,
|
||||||
throws JobInstanceAlreadyCompleteException,
|
JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException {
|
||||||
JobExecutionAlreadyRunningException,
|
|
||||||
JobParametersInvalidException,
|
|
||||||
JobRestartException {
|
|
||||||
|
|
||||||
String jobName = "estimateSyncJob";
|
String jobName = "estimateSyncJob";
|
||||||
Job job = jobs.get(jobName);
|
Job job = jobs.get(jobName);
|
||||||
|
|||||||
@ -71,16 +71,12 @@ public class CommCodeService {
|
|||||||
public void setHeaderCodeSyncSave(List<HeadCodeRequest> headCodeList) throws Exception {
|
public void setHeaderCodeSyncSave(List<HeadCodeRequest> headCodeList) throws Exception {
|
||||||
// 헤더코드 동기화
|
// 헤더코드 동기화
|
||||||
for (HeadCodeRequest headCodeReq : headCodeList) {
|
for (HeadCodeRequest headCodeReq : headCodeList) {
|
||||||
try {
|
|
||||||
if ("Y".equals(headCodeReq.getQcCommYn()) && "N".equals(headCodeReq.getDelYn())) {
|
if ("Y".equals(headCodeReq.getQcCommYn()) && "N".equals(headCodeReq.getDelYn())) {
|
||||||
headCodeReq.setDelFlg(0);
|
headCodeReq.setDelFlg(0);
|
||||||
} else {
|
} else {
|
||||||
headCodeReq.setDelFlg(1);
|
headCodeReq.setDelFlg(1);
|
||||||
}
|
}
|
||||||
commCodeMapper.setHeadCodeSyncSave(headCodeReq);
|
commCodeMapper.setHeadCodeSyncSave(headCodeReq);
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,16 +89,12 @@ public class CommCodeService {
|
|||||||
public void setCommonCodeSyncSave(List<DetailCodeRequest> detailCodeList) throws Exception {
|
public void setCommonCodeSyncSave(List<DetailCodeRequest> detailCodeList) throws Exception {
|
||||||
// 상세코드 동기화
|
// 상세코드 동기화
|
||||||
for (DetailCodeRequest detailCodeReq : detailCodeList) {
|
for (DetailCodeRequest detailCodeReq : detailCodeList) {
|
||||||
try {
|
|
||||||
if ("A".equals(detailCodeReq.getStatCd()) && "N".equals(detailCodeReq.getDelYn())) {
|
if ("A".equals(detailCodeReq.getStatCd()) && "N".equals(detailCodeReq.getDelYn())) {
|
||||||
detailCodeReq.setDelFlg(0);
|
detailCodeReq.setDelFlg(0);
|
||||||
} else {
|
} else {
|
||||||
detailCodeReq.setDelFlg(1);
|
detailCodeReq.setDelFlg(1);
|
||||||
}
|
}
|
||||||
commCodeMapper.setCommonCodeSyncSave(detailCodeReq);
|
commCodeMapper.setCommonCodeSyncSave(detailCodeReq);
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user