견적서 관련 배치 개발 (Plan 확정, 견적서 QSP 동기화)
This commit is contained in:
parent
5a6cff2e8b
commit
11c9cbe49a
@ -2,6 +2,7 @@ package com.interplug.qcast.batch;
|
|||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.batch.core.Job;
|
import org.springframework.batch.core.Job;
|
||||||
import org.springframework.batch.core.JobParameters;
|
import org.springframework.batch.core.JobParameters;
|
||||||
import org.springframework.batch.core.JobParametersBuilder;
|
import org.springframework.batch.core.JobParametersBuilder;
|
||||||
@ -15,7 +16,6 @@ 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,16 +38,22 @@ 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) throws JobInstanceAlreadyCompleteException,
|
public String launchJob(@PathVariable String jobName)
|
||||||
JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException {
|
throws JobInstanceAlreadyCompleteException,
|
||||||
|
JobExecutionAlreadyRunningException,
|
||||||
|
JobParametersInvalidException,
|
||||||
|
JobRestartException {
|
||||||
|
|
||||||
Job job = jobs.get(jobName);
|
Job job = jobs.get(jobName);
|
||||||
if (job == null) {
|
if (job == null) {
|
||||||
return "Job " + jobName + " not found";
|
return "Job " + jobName + " not found";
|
||||||
}
|
}
|
||||||
|
|
||||||
JobParameters jobParameters = new JobParametersBuilder().addString("jobName", jobName)
|
JobParameters jobParameters =
|
||||||
.addDate("time", new Date()).toJobParameters();
|
new JobParametersBuilder()
|
||||||
|
.addString("jobName", jobName)
|
||||||
|
.addDate("time", new Date())
|
||||||
|
.toJobParameters();
|
||||||
|
|
||||||
jobLauncher.run(job, jobParameters);
|
jobLauncher.run(job, jobParameters);
|
||||||
|
|
||||||
@ -65,8 +71,11 @@ public class JobLauncherController {
|
|||||||
*/
|
*/
|
||||||
// @Scheduled(cron = "*/5 * * * * *")
|
// @Scheduled(cron = "*/5 * * * * *")
|
||||||
@Scheduled(cron = "0 55 23 * * *")
|
@Scheduled(cron = "0 55 23 * * *")
|
||||||
public String storeAdditionalInfoJob() throws JobInstanceAlreadyCompleteException,
|
public String storeAdditionalInfoJob()
|
||||||
JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException {
|
throws JobInstanceAlreadyCompleteException,
|
||||||
|
JobExecutionAlreadyRunningException,
|
||||||
|
JobParametersInvalidException,
|
||||||
|
JobRestartException {
|
||||||
|
|
||||||
String jobName = "storeAdditionalJob";
|
String jobName = "storeAdditionalJob";
|
||||||
Job job = jobs.get(jobName);
|
Job job = jobs.get(jobName);
|
||||||
@ -92,8 +101,11 @@ public class JobLauncherController {
|
|||||||
* @throws JobRestartException
|
* @throws JobRestartException
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 30 02 * * *")
|
@Scheduled(cron = "0 30 02 * * *")
|
||||||
public String materialJob() throws JobInstanceAlreadyCompleteException,
|
public String materialJob()
|
||||||
JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException {
|
throws JobInstanceAlreadyCompleteException,
|
||||||
|
JobExecutionAlreadyRunningException,
|
||||||
|
JobParametersInvalidException,
|
||||||
|
JobRestartException {
|
||||||
|
|
||||||
String jobName = "materialJob";
|
String jobName = "materialJob";
|
||||||
Job job = jobs.get(jobName);
|
Job job = jobs.get(jobName);
|
||||||
@ -120,8 +132,11 @@ public class JobLauncherController {
|
|||||||
* @throws JobRestartException
|
* @throws JobRestartException
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 40 02 * * *")
|
@Scheduled(cron = "0 40 02 * * *")
|
||||||
public String bomJob() throws JobInstanceAlreadyCompleteException,
|
public String bomJob()
|
||||||
JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException {
|
throws JobInstanceAlreadyCompleteException,
|
||||||
|
JobExecutionAlreadyRunningException,
|
||||||
|
JobParametersInvalidException,
|
||||||
|
JobRestartException {
|
||||||
|
|
||||||
String jobName = "bomJob";
|
String jobName = "bomJob";
|
||||||
Job job = jobs.get(jobName);
|
Job job = jobs.get(jobName);
|
||||||
@ -149,8 +164,11 @@ public class JobLauncherController {
|
|||||||
* @throws JobRestartException
|
* @throws JobRestartException
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 40 03 * * *")
|
@Scheduled(cron = "0 40 03 * * *")
|
||||||
public String businessChargerJob() throws JobInstanceAlreadyCompleteException,
|
public String businessChargerJob()
|
||||||
JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException {
|
throws JobInstanceAlreadyCompleteException,
|
||||||
|
JobExecutionAlreadyRunningException,
|
||||||
|
JobParametersInvalidException,
|
||||||
|
JobRestartException {
|
||||||
|
|
||||||
String jobName = "businessChargerJob";
|
String jobName = "businessChargerJob";
|
||||||
Job job = jobs.get(jobName);
|
Job job = jobs.get(jobName);
|
||||||
@ -178,8 +196,11 @@ public class JobLauncherController {
|
|||||||
* @throws JobRestartException
|
* @throws JobRestartException
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 0 01 * * *")
|
@Scheduled(cron = "0 0 01 * * *")
|
||||||
public String adminUserJob() throws JobInstanceAlreadyCompleteException,
|
public String adminUserJob()
|
||||||
JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException {
|
throws JobInstanceAlreadyCompleteException,
|
||||||
|
JobExecutionAlreadyRunningException,
|
||||||
|
JobParametersInvalidException,
|
||||||
|
JobRestartException {
|
||||||
|
|
||||||
String jobName = "adminUserJob";
|
String jobName = "adminUserJob";
|
||||||
Job job = jobs.get(jobName);
|
Job job = jobs.get(jobName);
|
||||||
@ -207,8 +228,11 @@ public class JobLauncherController {
|
|||||||
* @throws JobRestartException
|
* @throws JobRestartException
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 0 0 * * *")
|
@Scheduled(cron = "0 0 0 * * *")
|
||||||
public String priceJob() throws JobInstanceAlreadyCompleteException,
|
public String priceJob()
|
||||||
JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException {
|
throws JobInstanceAlreadyCompleteException,
|
||||||
|
JobExecutionAlreadyRunningException,
|
||||||
|
JobParametersInvalidException,
|
||||||
|
JobRestartException {
|
||||||
|
|
||||||
String jobName = "priceJob";
|
String jobName = "priceJob";
|
||||||
Job job = jobs.get(jobName);
|
Job job = jobs.get(jobName);
|
||||||
@ -236,8 +260,11 @@ public class JobLauncherController {
|
|||||||
* @throws JobRestartException
|
* @throws JobRestartException
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 10 03 * * *")
|
@Scheduled(cron = "0 10 03 * * *")
|
||||||
public String commonCodeJob() throws JobInstanceAlreadyCompleteException,
|
public String commonCodeJob()
|
||||||
JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException {
|
throws JobInstanceAlreadyCompleteException,
|
||||||
|
JobExecutionAlreadyRunningException,
|
||||||
|
JobParametersInvalidException,
|
||||||
|
JobRestartException {
|
||||||
|
|
||||||
String jobName = "commonCodeJob";
|
String jobName = "commonCodeJob";
|
||||||
Job job = jobs.get(jobName);
|
Job job = jobs.get(jobName);
|
||||||
@ -264,8 +291,11 @@ public class JobLauncherController {
|
|||||||
* @throws JobRestartException
|
* @throws JobRestartException
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 30 23 * * *")
|
@Scheduled(cron = "0 30 23 * * *")
|
||||||
public String specialNoteDispItemAdditionalInfoJob() throws JobInstanceAlreadyCompleteException,
|
public String specialNoteDispItemAdditionalInfoJob()
|
||||||
JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException {
|
throws JobInstanceAlreadyCompleteException,
|
||||||
|
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) {
|
||||||
@ -282,4 +312,67 @@ public class JobLauncherController {
|
|||||||
return "OK";
|
return "OK";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plan Confrim 동기화 배치
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @throws JobInstanceAlreadyCompleteException
|
||||||
|
* @throws JobExecutionAlreadyRunningException
|
||||||
|
* @throws JobParametersInvalidException
|
||||||
|
* @throws JobRestartException
|
||||||
|
*/
|
||||||
|
@Scheduled(cron = "1 0 0 * * *")
|
||||||
|
public String planConfirmJob()
|
||||||
|
throws JobInstanceAlreadyCompleteException,
|
||||||
|
JobExecutionAlreadyRunningException,
|
||||||
|
JobParametersInvalidException,
|
||||||
|
JobRestartException {
|
||||||
|
|
||||||
|
String jobName = "planConfirmJob";
|
||||||
|
Job job = jobs.get(jobName);
|
||||||
|
if (job == null) {
|
||||||
|
return "Job " + jobName + " not found";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("Y".equals(System.getProperty("spring.profiles.scheduler"))) {
|
||||||
|
JobParameters jobParameters =
|
||||||
|
new JobParametersBuilder().addDate("time", new Date()).toJobParameters();
|
||||||
|
|
||||||
|
jobLauncher.run(job, jobParameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 견적서 전송 동기화 배치
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @throws JobInstanceAlreadyCompleteException
|
||||||
|
* @throws JobExecutionAlreadyRunningException
|
||||||
|
* @throws JobParametersInvalidException
|
||||||
|
* @throws JobRestartException
|
||||||
|
*/
|
||||||
|
@Scheduled(cron = "1 20 0 * * *")
|
||||||
|
public String estimateSyncJob()
|
||||||
|
throws JobInstanceAlreadyCompleteException,
|
||||||
|
JobExecutionAlreadyRunningException,
|
||||||
|
JobParametersInvalidException,
|
||||||
|
JobRestartException {
|
||||||
|
|
||||||
|
String jobName = "estimateSyncJob";
|
||||||
|
Job job = jobs.get(jobName);
|
||||||
|
if (job == null) {
|
||||||
|
return "Job " + jobName + " not found";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("Y".equals(System.getProperty("spring.profiles.scheduler"))) {
|
||||||
|
JobParameters jobParameters =
|
||||||
|
new JobParametersBuilder().addDate("time", new Date()).toJobParameters();
|
||||||
|
|
||||||
|
jobLauncher.run(job, jobParameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,83 @@
|
|||||||
|
package com.interplug.qcast.batch.estimate;
|
||||||
|
|
||||||
|
import com.interplug.qcast.biz.estimate.EstimateService;
|
||||||
|
import com.interplug.qcast.biz.estimate.dto.EstimateSyncResponse;
|
||||||
|
import com.interplug.qcast.biz.estimate.dto.PlanSyncResponse;
|
||||||
|
import com.interplug.qcast.util.InterfaceQsp;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.batch.core.Job;
|
||||||
|
import org.springframework.batch.core.JobExecutionListener;
|
||||||
|
import org.springframework.batch.core.Step;
|
||||||
|
import org.springframework.batch.core.configuration.annotation.StepScope;
|
||||||
|
import org.springframework.batch.core.job.builder.JobBuilder;
|
||||||
|
import org.springframework.batch.core.repository.JobRepository;
|
||||||
|
import org.springframework.batch.core.step.builder.StepBuilder;
|
||||||
|
import org.springframework.batch.item.ItemProcessor;
|
||||||
|
import org.springframework.batch.item.ItemWriter;
|
||||||
|
import org.springframework.batch.item.support.ListItemReader;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.http.HttpMethod;
|
||||||
|
import org.springframework.transaction.PlatformTransactionManager;
|
||||||
|
|
||||||
|
/** Plan 확정 Item 마스터 동기화 배치 */
|
||||||
|
@Configuration
|
||||||
|
public class EstimateSyncConfiguration implements JobExecutionListener {
|
||||||
|
private final EstimateService estimateService;
|
||||||
|
|
||||||
|
private final InterfaceQsp interfaceQsp;
|
||||||
|
|
||||||
|
EstimateSyncResponse estimateSyncResponse;
|
||||||
|
|
||||||
|
@Value("${qsp.estimate-sync-batch-url}")
|
||||||
|
private String qspInterfaceUrl;
|
||||||
|
|
||||||
|
public EstimateSyncConfiguration(EstimateService estimateService, InterfaceQsp interfaceQsp) {
|
||||||
|
this.estimateService = estimateService;
|
||||||
|
this.interfaceQsp = interfaceQsp;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Job estimateSyncJob(JobRepository jobRepository, Step estimateSyncStep) {
|
||||||
|
return new JobBuilder("estimateSyncJob", jobRepository).start(estimateSyncStep).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Step estimateSyncStep(
|
||||||
|
JobRepository jobRepository, PlatformTransactionManager transactionManager) throws Exception {
|
||||||
|
return new StepBuilder("estimateSyncStep", jobRepository)
|
||||||
|
.<PlanSyncResponse, PlanSyncResponse>chunk(100, transactionManager)
|
||||||
|
.reader(estimateSyncReader())
|
||||||
|
.processor(estimateSyncProcessor())
|
||||||
|
.writer(estimateSyncWriter())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@StepScope
|
||||||
|
public ListItemReader<PlanSyncResponse> estimateSyncReader() throws Exception {
|
||||||
|
this.estimateSyncResponse =
|
||||||
|
interfaceQsp.callApiData(
|
||||||
|
HttpMethod.POST,
|
||||||
|
qspInterfaceUrl,
|
||||||
|
estimateService.selectEstimateSyncFailList(),
|
||||||
|
EstimateSyncResponse.class);
|
||||||
|
return (estimateSyncResponse != null)
|
||||||
|
? new ListItemReader<>(estimateSyncResponse.getSuccessList())
|
||||||
|
: new ListItemReader<>(Collections.emptyList());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public ItemProcessor<PlanSyncResponse, PlanSyncResponse> estimateSyncProcessor() {
|
||||||
|
return item -> item;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public ItemWriter<PlanSyncResponse> estimateSyncWriter() {
|
||||||
|
return items -> {
|
||||||
|
estimateService.setEstimateSyncSave((List<PlanSyncResponse>) items.getItems());
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,80 @@
|
|||||||
|
package com.interplug.qcast.batch.estimate;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.interplug.qcast.biz.estimate.EstimateService;
|
||||||
|
import com.interplug.qcast.biz.estimate.dto.PlanSyncResponse;
|
||||||
|
import com.interplug.qcast.util.InterfaceQsp;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.batch.core.Job;
|
||||||
|
import org.springframework.batch.core.JobExecutionListener;
|
||||||
|
import org.springframework.batch.core.Step;
|
||||||
|
import org.springframework.batch.core.configuration.annotation.StepScope;
|
||||||
|
import org.springframework.batch.core.job.builder.JobBuilder;
|
||||||
|
import org.springframework.batch.core.repository.JobRepository;
|
||||||
|
import org.springframework.batch.core.step.builder.StepBuilder;
|
||||||
|
import org.springframework.batch.item.ItemProcessor;
|
||||||
|
import org.springframework.batch.item.ItemWriter;
|
||||||
|
import org.springframework.batch.item.support.ListItemReader;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.http.HttpMethod;
|
||||||
|
import org.springframework.transaction.PlatformTransactionManager;
|
||||||
|
|
||||||
|
/** Plan 확정 Item 마스터 동기화 배치 */
|
||||||
|
@Configuration
|
||||||
|
public class PlanConfrimConfiguration implements JobExecutionListener {
|
||||||
|
private final EstimateService estimateService;
|
||||||
|
|
||||||
|
private final InterfaceQsp interfaceQsp;
|
||||||
|
|
||||||
|
List<PlanSyncResponse> planSyncList;
|
||||||
|
|
||||||
|
@Value("${qsp.estimate-plan-confirm-batch-url}")
|
||||||
|
private String qspInterfaceUrl;
|
||||||
|
|
||||||
|
public PlanConfrimConfiguration(EstimateService estimateService, InterfaceQsp interfaceQsp) {
|
||||||
|
this.estimateService = estimateService;
|
||||||
|
this.interfaceQsp = interfaceQsp;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Job planConfirmJob(JobRepository jobRepository, Step planConfirmStep) {
|
||||||
|
return new JobBuilder("planConfirmJob", jobRepository).start(planConfirmStep).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Step planConfirmStep(
|
||||||
|
JobRepository jobRepository, PlatformTransactionManager transactionManager) throws Exception {
|
||||||
|
return new StepBuilder("planConfirmStep", jobRepository)
|
||||||
|
.<PlanSyncResponse, PlanSyncResponse>chunk(100, transactionManager)
|
||||||
|
.reader(planConfirmReader())
|
||||||
|
.processor(planConfirmProcessor())
|
||||||
|
.writer(planConfirmWriter())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@StepScope
|
||||||
|
public ListItemReader<PlanSyncResponse> planConfirmReader() throws Exception {
|
||||||
|
this.planSyncList =
|
||||||
|
interfaceQsp.callApiData(
|
||||||
|
HttpMethod.GET, qspInterfaceUrl, null, new TypeReference<List<PlanSyncResponse>>() {});
|
||||||
|
return (planSyncList != null)
|
||||||
|
? new ListItemReader<>(planSyncList)
|
||||||
|
: new ListItemReader<>(Collections.emptyList());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public ItemProcessor<PlanSyncResponse, PlanSyncResponse> planConfirmProcessor() {
|
||||||
|
return item -> item;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public ItemWriter<PlanSyncResponse> planConfirmWriter() {
|
||||||
|
return items -> {
|
||||||
|
estimateService.setPlanConfirmSyncSave((List<PlanSyncResponse>) items.getItems());
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -15,6 +15,9 @@ public interface EstimateMapper {
|
|||||||
// 견적서 API 상세 확인
|
// 견적서 API 상세 확인
|
||||||
public EstimateSendResponse selectEstimateApiDetail(EstimateRequest estimateRequest);
|
public EstimateSendResponse selectEstimateApiDetail(EstimateRequest estimateRequest);
|
||||||
|
|
||||||
|
// 견적서 API 실패 목록 조회
|
||||||
|
public List<EstimateSendResponse> selectEstimateApiFailList();
|
||||||
|
|
||||||
// 견적서 아이템 목록 조회
|
// 견적서 아이템 목록 조회
|
||||||
public List<ItemResponse> selectEstimateItemList(EstimateRequest estimateRequest);
|
public List<ItemResponse> selectEstimateItemList(EstimateRequest estimateRequest);
|
||||||
|
|
||||||
@ -80,4 +83,7 @@ public interface EstimateMapper {
|
|||||||
|
|
||||||
// 견적서 복사
|
// 견적서 복사
|
||||||
public int insertEstimateCopy(EstimateCopyRequest estimateCopyRequest);
|
public int insertEstimateCopy(EstimateCopyRequest estimateCopyRequest);
|
||||||
|
|
||||||
|
// Plan 확정 동기화
|
||||||
|
public int updatePlanConfirmSync(PlanSyncResponse planSyncData);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -778,6 +778,7 @@ public class EstimateService {
|
|||||||
estimateRequest.setPlanNo(result.getPlanNo());
|
estimateRequest.setPlanNo(result.getPlanNo());
|
||||||
estimateRequest.setDocNo(result.getDocNo());
|
estimateRequest.setDocNo(result.getDocNo());
|
||||||
estimateRequest.setSyncFlg(result.getSyncFlg());
|
estimateRequest.setSyncFlg(result.getSyncFlg());
|
||||||
|
estimateRequest.setUserId(estimateCopyRequest.getUserId());
|
||||||
|
|
||||||
estimateMapper.updateEstimateApi(estimateRequest);
|
estimateMapper.updateEstimateApi(estimateRequest);
|
||||||
}
|
}
|
||||||
@ -1125,8 +1126,8 @@ public class EstimateService {
|
|||||||
estimateSendResponse.setSaveType("3");
|
estimateSendResponse.setSaveType("3");
|
||||||
estimateSendResponse.setSyncFlg("0");
|
estimateSendResponse.setSyncFlg("0");
|
||||||
estimateSendResponse.setConstructSpecification(
|
estimateSendResponse.setConstructSpecification(
|
||||||
!StringUtils.isEmpty(estimateRequest.getConstructSpecification())
|
!StringUtils.isEmpty(estimateSendResponse.getConstructSpecification())
|
||||||
? estimateRequest.getConstructSpecification().split("、")[0]
|
? estimateSendResponse.getConstructSpecification().split("、")[0]
|
||||||
: "");
|
: "");
|
||||||
estimateSendResponse.setDelFlg("1".equals(estimateSendResponse.getDelFlg()) ? "Y" : "N");
|
estimateSendResponse.setDelFlg("1".equals(estimateSendResponse.getDelFlg()) ? "Y" : "N");
|
||||||
|
|
||||||
@ -1152,7 +1153,7 @@ public class EstimateService {
|
|||||||
/* [1]. QSP API CALL -> Response */
|
/* [1]. QSP API CALL -> Response */
|
||||||
String strResponse =
|
String strResponse =
|
||||||
interfaceQsp.callApi(
|
interfaceQsp.callApi(
|
||||||
HttpMethod.POST, QSP_API_URL + "/api/master/qcastQuotationSave", estimateSendRequest);
|
HttpMethod.POST, QSP_API_URL + "/api/order/qcastQuotationSave", estimateSendRequest);
|
||||||
|
|
||||||
if (!"".equals(strResponse)) {
|
if (!"".equals(strResponse)) {
|
||||||
com.fasterxml.jackson.databind.ObjectMapper om =
|
com.fasterxml.jackson.databind.ObjectMapper om =
|
||||||
@ -1581,4 +1582,92 @@ public class EstimateService {
|
|||||||
}
|
}
|
||||||
return resultList;
|
return resultList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plan 확정 정보 동기화
|
||||||
|
*
|
||||||
|
* @param planSyncList Plan 목록
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public int setPlanConfirmSyncSave(List<PlanSyncResponse> planSyncList) throws Exception {
|
||||||
|
int cnt = 0;
|
||||||
|
for (PlanSyncResponse planSyncData : planSyncList) {
|
||||||
|
// Plan 확정 처리
|
||||||
|
cnt += estimateMapper.updatePlanConfirmSync(planSyncData);
|
||||||
|
}
|
||||||
|
return cnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* QSP Q.CAST 견적서 동기화 실패 목록
|
||||||
|
*
|
||||||
|
* @return EstimateSendRequest 견적서 실패 목록
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public EstimateSendRequest selectEstimateSyncFailList() throws Exception {
|
||||||
|
EstimateSendRequest estimateSendRequest = new EstimateSendRequest();
|
||||||
|
List<EstimateSendResponse> quoteList = new ArrayList<EstimateSendResponse>();
|
||||||
|
String docNo = "";
|
||||||
|
|
||||||
|
// 견적서 동기화 실패 목록 조회
|
||||||
|
List<EstimateSendResponse> estimateSendListResponse =
|
||||||
|
estimateMapper.selectEstimateApiFailList();
|
||||||
|
|
||||||
|
for (EstimateSendResponse estimateSendResponse : estimateSendListResponse) {
|
||||||
|
EstimateRequest estimateRequest = new EstimateRequest();
|
||||||
|
estimateRequest.setObjectNo(estimateSendResponse.getObjectNo());
|
||||||
|
estimateRequest.setPlanNo(estimateSendResponse.getPlanNo());
|
||||||
|
|
||||||
|
estimateSendResponse.setSaveType("3");
|
||||||
|
estimateSendResponse.setSyncFlg("0");
|
||||||
|
estimateSendResponse.setConstructSpecification(
|
||||||
|
!StringUtils.isEmpty(estimateSendResponse.getConstructSpecification())
|
||||||
|
? estimateSendResponse.getConstructSpecification().split("、")[0]
|
||||||
|
: "");
|
||||||
|
estimateSendResponse.setDelFlg("1".equals(estimateSendResponse.getDelFlg()) ? "Y" : "N");
|
||||||
|
|
||||||
|
// 아이템 목록 조회
|
||||||
|
estimateRequest.setSchBomNotExist("1");
|
||||||
|
List<ItemResponse> estimateItemList = estimateMapper.selectEstimateItemList(estimateRequest);
|
||||||
|
estimateSendResponse.setItemList(estimateItemList);
|
||||||
|
|
||||||
|
// 첨부파일 목록 조회
|
||||||
|
FileRequest fileDeleteReq = new FileRequest();
|
||||||
|
fileDeleteReq.setObjectNo(estimateRequest.getObjectNo());
|
||||||
|
fileDeleteReq.setPlanNo(estimateRequest.getPlanNo());
|
||||||
|
fileDeleteReq.setCategory("10");
|
||||||
|
|
||||||
|
List<FileResponse> fileList = fileMapper.selectFileList(fileDeleteReq);
|
||||||
|
estimateSendResponse.setFileList(fileList);
|
||||||
|
|
||||||
|
quoteList.add(estimateSendResponse);
|
||||||
|
estimateSendRequest.setQuoteList(quoteList);
|
||||||
|
}
|
||||||
|
|
||||||
|
return estimateSendRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 견적서 정보 QSP 동기화
|
||||||
|
*
|
||||||
|
* @param planSyncList Plan 목록
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public int setEstimateSyncSave(List<PlanSyncResponse> planSyncList) throws Exception {
|
||||||
|
int cnt = 0;
|
||||||
|
for (PlanSyncResponse planSyncData : planSyncList) {
|
||||||
|
EstimateRequest estimateRequest = new EstimateRequest();
|
||||||
|
estimateRequest.setObjectNo(planSyncData.getObjectNo());
|
||||||
|
estimateRequest.setPlanNo(planSyncData.getPlanNo());
|
||||||
|
estimateRequest.setDocNo(planSyncData.getDocNo());
|
||||||
|
estimateRequest.setSyncFlg(planSyncData.getSyncFlg());
|
||||||
|
estimateRequest.setUserId("system");
|
||||||
|
|
||||||
|
// 견적서 동기화 여부 처리
|
||||||
|
cnt += estimateMapper.updateEstimateApi(estimateRequest);
|
||||||
|
}
|
||||||
|
return cnt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,14 @@
|
|||||||
|
package com.interplug.qcast.biz.estimate.dto;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import java.util.List;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class EstimateSyncResponse {
|
||||||
|
@Schema(description = "실패목록")
|
||||||
|
private List<PlanSyncResponse> failList;
|
||||||
|
|
||||||
|
@Schema(description = "성공목록")
|
||||||
|
private List<PlanSyncResponse> successList;
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
package com.interplug.qcast.biz.estimate.dto;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class PlanSyncResponse {
|
||||||
|
@Schema(description = "물건번호")
|
||||||
|
private String objectNo;
|
||||||
|
|
||||||
|
@Schema(description = "플랜번호")
|
||||||
|
private String planNo;
|
||||||
|
|
||||||
|
@Schema(description = "견적서번호")
|
||||||
|
private String docNo;
|
||||||
|
|
||||||
|
@Schema(description = "동기화여부")
|
||||||
|
private String syncFlg;
|
||||||
|
|
||||||
|
@Schema(description = "메시지")
|
||||||
|
private String message;
|
||||||
|
}
|
||||||
@ -51,6 +51,8 @@ qsp:
|
|||||||
auto.login.aes256.key: _autoL!!
|
auto.login.aes256.key: _autoL!!
|
||||||
system-commonCode-batch-url: /api/system/commonCodeListData
|
system-commonCode-batch-url: /api/system/commonCodeListData
|
||||||
master-special-note-disp-item-batch-url: /api/master/quotationDispItemInfo
|
master-special-note-disp-item-batch-url: /api/master/quotationDispItemInfo
|
||||||
|
estimate-plan-confirm-batch-url: /api/order/planConfirmListData
|
||||||
|
estimate-sync-batch-url: /api/order/qcastQuotationSave
|
||||||
#File
|
#File
|
||||||
file:
|
file:
|
||||||
root.path: C:\\
|
root.path: C:\\
|
||||||
|
|||||||
@ -39,7 +39,7 @@ spring:
|
|||||||
|
|
||||||
#QSP
|
#QSP
|
||||||
qsp:
|
qsp:
|
||||||
url: http://1.248.227.176:8120
|
url: http://localhost:8120
|
||||||
master-store-batch-url: /api/master/storeAdditionalInfo
|
master-store-batch-url: /api/master/storeAdditionalInfo
|
||||||
master-material-batch-url: /api/master/materialList
|
master-material-batch-url: /api/master/materialList
|
||||||
master-bom-batch-url: /api/master/bomList
|
master-bom-batch-url: /api/master/bomList
|
||||||
@ -51,6 +51,8 @@ qsp:
|
|||||||
auto.login.aes256.key: _autoL!!
|
auto.login.aes256.key: _autoL!!
|
||||||
system-commonCode-batch-url: /api/system/commonCodeListData
|
system-commonCode-batch-url: /api/system/commonCodeListData
|
||||||
master-special-note-disp-item-batch-url: /api/master/quotationDispItemInfo
|
master-special-note-disp-item-batch-url: /api/master/quotationDispItemInfo
|
||||||
|
estimate-plan-confirm-batch-url: /api/order/planConfirmListData
|
||||||
|
estimate-sync-batch-url: /api/order/qcastQuotationSave
|
||||||
#File
|
#File
|
||||||
file:
|
file:
|
||||||
root.path: C:\\
|
root.path: C:\\
|
||||||
|
|||||||
@ -51,6 +51,8 @@ qsp:
|
|||||||
auto.login.aes256.key: _autoL!!
|
auto.login.aes256.key: _autoL!!
|
||||||
system-commonCode-batch-url: /api/system/commonCodeListData
|
system-commonCode-batch-url: /api/system/commonCodeListData
|
||||||
master-special-note-disp-item-batch-url: /api/master/quotationDispItemInfo
|
master-special-note-disp-item-batch-url: /api/master/quotationDispItemInfo
|
||||||
|
estimate-plan-confirm-batch-url: /api/order/planConfirmListData
|
||||||
|
estimate-sync-batch-url: /api/order/qcastQuotationSave
|
||||||
#File
|
#File
|
||||||
file:
|
file:
|
||||||
root.path: C:\\
|
root.path: C:\\
|
||||||
|
|||||||
@ -119,6 +119,49 @@
|
|||||||
ON T.CREATE_SALE_STORE_ID = SS2.SALE_STORE_ID
|
ON T.CREATE_SALE_STORE_ID = SS2.SALE_STORE_ID
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectEstimateApiFailList" resultType="com.interplug.qcast.biz.estimate.dto.EstimateSendResponse">
|
||||||
|
/* sqlid : com.interplug.qcast.biz.estimate.selectEstimateApiFailList */
|
||||||
|
SELECT
|
||||||
|
O.OBJECT_NO
|
||||||
|
, O.SALE_STORE_ID
|
||||||
|
, O.OBJECT_NAME
|
||||||
|
, O.OBJECT_NAME_OMIT
|
||||||
|
, O.RECEIVE_COMPANY_NAME
|
||||||
|
, O.RECEIVE_USER
|
||||||
|
, O.DELIVERY_ZIP_NO
|
||||||
|
, O.DELIVERY_TARGET
|
||||||
|
, O.DELIVERY_TEL
|
||||||
|
, O.DELIVERY_HOPE_DATE
|
||||||
|
, O.SPECIFICATION_CONFIRM_DATE
|
||||||
|
, O.PAYMENT_TERMS
|
||||||
|
, O.CAR_KIND_CD
|
||||||
|
, O.TRACK_KAIND AS TRACK_KIND
|
||||||
|
, O.TRACK_10T_DELIVERY
|
||||||
|
, O.TRACK_WEIGHT
|
||||||
|
, O.TRACK_TIME_SPECIFY
|
||||||
|
, O.TRACK_TIME
|
||||||
|
, O.FORKLIFT
|
||||||
|
, O.HOUSE_CLASS_CD
|
||||||
|
, O.BUSINESS_CHARGER_CD
|
||||||
|
, O.BUSINESS_GROUP_CD
|
||||||
|
, P.PLAN_NO
|
||||||
|
, P.CONSTRUCT_SPECIFICATION
|
||||||
|
, P.NORTH_ARRANGEMENT
|
||||||
|
, P.ESTIMATE_TYPE
|
||||||
|
, P.PKG_ASP
|
||||||
|
, P.DEL_FLG
|
||||||
|
, CONVERT(NVARCHAR(10), P.CREATE_DATETIME, 121) AS ESTIMATE_DETAIL_CREATE_DATE
|
||||||
|
, P.LAST_EDIT_DATETIME
|
||||||
|
, P.LAST_EDIT_USER
|
||||||
|
, (SELECT CODE FROM M_COMM_L WHERE HEAD_CD = '200800' AND CODE_NM = O.OBJECT_NAME_OMIT) AS OBJECT_NAME_OMIT_CD
|
||||||
|
FROM T_PLAN P WITH (NOLOCK)
|
||||||
|
INNER JOIN T_OBJECT O WITH (NOLOCK)
|
||||||
|
ON P.OBJECT_NO = O.OBJECT_NO
|
||||||
|
INNER JOIN M_SALES_STORE SS WITH(NOLOCK)
|
||||||
|
ON O.SALE_STORE_ID = SS.SALE_STORE_ID
|
||||||
|
WHERE P.SYNC_FLG = '0'
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="selectEstimateApiDetail" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest" resultType="com.interplug.qcast.biz.estimate.dto.EstimateSendResponse">
|
<select id="selectEstimateApiDetail" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest" resultType="com.interplug.qcast.biz.estimate.dto.EstimateSendResponse">
|
||||||
/* sqlid : com.interplug.qcast.biz.estimate.selectEstimateApiDetail */
|
/* sqlid : com.interplug.qcast.biz.estimate.selectEstimateApiDetail */
|
||||||
SELECT
|
SELECT
|
||||||
@ -563,6 +606,8 @@
|
|||||||
SET
|
SET
|
||||||
DOC_NO = #{docNo}
|
DOC_NO = #{docNo}
|
||||||
, SYNC_FLG = #{syncFlg}
|
, SYNC_FLG = #{syncFlg}
|
||||||
|
, LAST_EDIT_DATETIME = GETDATE()
|
||||||
|
, LAST_EDIT_USER = #{userId}
|
||||||
WHERE OBJECT_NO = #{objectNo}
|
WHERE OBJECT_NO = #{objectNo}
|
||||||
AND PLAN_NO = #{planNo}
|
AND PLAN_NO = #{planNo}
|
||||||
</update>
|
</update>
|
||||||
@ -900,4 +945,15 @@
|
|||||||
AND P.DEL_FLG = '0'
|
AND P.DEL_FLG = '0'
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
<update id="updatePlanConfirmSync" parameterType="com.interplug.qcast.biz.estimate.dto.PlanSyncResponse">
|
||||||
|
/* sqlid : com.interplug.qcast.biz.estimate.updatePlanConfirmSync */
|
||||||
|
UPDATE T_PLAN
|
||||||
|
SET
|
||||||
|
ORDER_FLG = '1'
|
||||||
|
, LAST_EDIT_DATETIME = GETDATE()
|
||||||
|
, LAST_EDIT_USER = 'system'
|
||||||
|
WHERE OBJECT_NO = #{objectNo}
|
||||||
|
AND PLAN_NO = #{planNo}
|
||||||
|
</update>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
x
Reference in New Issue
Block a user