diff --git a/db/mens_traffic_oracle.sql b/db/mens_traffic_oracle.sql index f6d2525..b13a373 100644 --- a/db/mens_traffic_oracle.sql +++ b/db/mens_traffic_oracle.sql @@ -195,4 +195,7 @@ from tb_ens_rlaybsnm_manage; , mms_rdg_tmst = mms_rdg_tmst /* 열람 타임 스탬프 */ , updt_dt = sysdate , updusr = 'api_inbound' - WHERE unity_sndng_detail_id = '' + WHERE unity_sndng_detail_id = ''; + + +select * from tb_ens_rlaybsnm_manage; diff --git a/mens-api/src/main/java/kr/xit/biz/kt/mapper/IBizKtBcMapper.java b/mens-api/src/main/java/kr/xit/biz/kt/mapper/IBizKtBcMapper.java index c78645d..2af6dc3 100644 --- a/mens-api/src/main/java/kr/xit/biz/kt/mapper/IBizKtBcMapper.java +++ b/mens-api/src/main/java/kr/xit/biz/kt/mapper/IBizKtBcMapper.java @@ -22,7 +22,7 @@ import kr.xit.biz.ens.model.kt.KtMmsSendDTO.KtMsgRsltReqData; */ @Mapper public interface IBizKtBcMapper { - int updateRlaybsnmKtInfo(final CmmEnsRlaybsnmDTO dto); + void updateRlaybsnmKtBcInfo(final CmmEnsRlaybsnmDTO dto); int updateKtBcDtl(final KtMsgRsltReqData dto); - int saveKtCntcSndngResult(final KtMsgRsltReqData dto); + void saveKtBcCntcSndngResult(final KtMsgRsltReqData dto); } diff --git a/mens-api/src/main/java/kr/xit/biz/kt/service/BizKtBcService.java b/mens-api/src/main/java/kr/xit/biz/kt/service/BizKtBcService.java index 19a10d8..88e76d6 100644 --- a/mens-api/src/main/java/kr/xit/biz/kt/service/BizKtBcService.java +++ b/mens-api/src/main/java/kr/xit/biz/kt/service/BizKtBcService.java @@ -66,11 +66,11 @@ public class BizKtBcService extends AbstractService implements IBizKtBcService { if(StringUtils.isEmpty(resDTO.getAccessToken())){ throw BizRuntimeException.create("fail.api.kt.token.request"); } - mapper.updateRlaybsnmKtInfo( + mapper.updateRlaybsnmKtBcInfo( CmmEnsRlaybsnmDTO.builder() .signguCode(paramDTO.getSignguCode()) .ffnlgCode(paramDTO.getFfnlgCode()) - .profile(ApiConstants.PROFILE) + .profile(paramDTO.getProfile()) .ktAccessToken(resDTO.getAccessToken()) .ktTokenExpiresIn(resDTO.getExpiresIn()) .ktScope(resDTO.getScope()) @@ -122,7 +122,7 @@ public class BizKtBcService extends AbstractService implements IBizKtBcService { String.format("존재 하지 않는 발송 대상(src_key[%s], mms_sndg_rslt_sqno[%s]) 입니다", dto.getSrcKey(), dto.getMmsSndgRsltSqno()))); } - mapper.saveKtCntcSndngResult(dto); + mapper.saveKtBcCntcSndngResult(dto); } return KtCommonResponse.builder() diff --git a/mens-api/src/main/java/kr/xit/biz/kt/web/BizKtBcController.java b/mens-api/src/main/java/kr/xit/biz/kt/web/BizKtBcController.java index 7bb8e05..1ba19d2 100644 --- a/mens-api/src/main/java/kr/xit/biz/kt/web/BizKtBcController.java +++ b/mens-api/src/main/java/kr/xit/biz/kt/web/BizKtBcController.java @@ -32,7 +32,7 @@ import lombok.extern.slf4j.Slf4j; * * */ -@Tag(name = "BizKtMmsController", description = "KT MMS 업무처리 Controller") +@Tag(name = "BizKtBcController", description = "KT BC 업무처리 Controller") @RequiredArgsConstructor @RestController @RequestMapping(value = "/api/biz/kt/v1") diff --git a/mens-api/src/main/java/kr/xit/biz/ktgbs/mapper/IBizKtGbsMapper.java b/mens-api/src/main/java/kr/xit/biz/ktgbs/mapper/IBizKtGbsMapper.java index 0fd97c2..34392de 100644 --- a/mens-api/src/main/java/kr/xit/biz/ktgbs/mapper/IBizKtGbsMapper.java +++ b/mens-api/src/main/java/kr/xit/biz/ktgbs/mapper/IBizKtGbsMapper.java @@ -22,7 +22,7 @@ import kr.xit.biz.ens.model.ktgbs.KtGbsDTO; */ @Mapper public interface IBizKtGbsMapper { - int updateRlaybsnmKtInfo(final CmmEnsRlaybsnmDTO dto); + void updateRlaybsnmKtGbsInfo(final CmmEnsRlaybsnmDTO dto); int updateKtGbsDtl(final KtGbsDTO.MsgRsltReqsData dto); - int saveKtGbsCntcSndngResult(final KtGbsDTO.MsgRsltReqsData dto); + void saveKtGbsCntcSndngResult(final KtGbsDTO.MsgRsltReqsData dto); } diff --git a/mens-api/src/main/java/kr/xit/biz/ktgbs/service/BizKtGbsService.java b/mens-api/src/main/java/kr/xit/biz/ktgbs/service/BizKtGbsService.java index 5fec1a5..ef231d3 100644 --- a/mens-api/src/main/java/kr/xit/biz/ktgbs/service/BizKtGbsService.java +++ b/mens-api/src/main/java/kr/xit/biz/ktgbs/service/BizKtGbsService.java @@ -63,14 +63,13 @@ public class BizKtGbsService extends AbstractService implements IBizKtGbsService if(StringUtils.isEmpty(resDTO.getAccessToken())){ throw BizRuntimeException.create("fail.api.kt.token.request"); } - mapper.updateRlaybsnmKtInfo( + + mapper.updateRlaybsnmKtGbsInfo( CmmEnsRlaybsnmDTO.builder() .signguCode(paramDTO.getSignguCode()) .ffnlgCode(paramDTO.getFfnlgCode()) - .profile(ApiConstants.PROFILE) + .profile(paramDTO.getProfile()) .ktAccessToken(resDTO.getAccessToken()) - .ktTokenExpiresIn(resDTO.getExpiresIn()) - .ktScope(resDTO.getScope()) .build() ); cacheService.removeRlaybsnmInfoCache( diff --git a/mens-api/src/main/java/kr/xit/biz/ktgbs/web/BizKtGbsController.java b/mens-api/src/main/java/kr/xit/biz/ktgbs/web/BizKtGbsController.java index 9616b45..1d485cb 100644 --- a/mens-api/src/main/java/kr/xit/biz/ktgbs/web/BizKtGbsController.java +++ b/mens-api/src/main/java/kr/xit/biz/ktgbs/web/BizKtGbsController.java @@ -67,7 +67,7 @@ public class BizKtGbsController { value = PARAM2) }) }) - @Operation(deprecated = true, summary = "기관용 토큰 발급 요청", description = "기관용 토큰 발급 요청") + @Operation(deprecated = true, summary = "기관용 토큰 발급 요청-batch에서 호출", description = "기관용 토큰 발급 요청-batch에서 호출") @PostMapping(value = "/requestToken", produces = MediaType.APPLICATION_JSON_VALUE) public IApiResponse requestToken(@RequestBody final KtMnsRequest paramDTO) { return ApiResponseDTO.success(service.requestToken(paramDTO)); diff --git a/mens-api/src/main/resources/egovframework/mapper/biz/ens-kt-mysql-mapper.xml b/mens-api/src/main/resources/egovframework/mapper/biz/ens-kt-mysql-mapper.xml index 7d187e8..179f6eb 100644 --- a/mens-api/src/main/resources/egovframework/mapper/biz/ens-kt-mysql-mapper.xml +++ b/mens-api/src/main/resources/egovframework/mapper/biz/ens-kt-mysql-mapper.xml @@ -42,8 +42,8 @@ WHERE unity_sndng_detail_id = #{srcKey} - - /** ens-kt-mysql-mapper|saveCntcSndngResult-연계발송결과반영|julim */ + + /** ens-kt-mysql-mapper|saveKtBcCntcSndngResult-연계발송결과반영|julim */ SELECT tesn.signgu_code AS signguCode , tesn.ffnlg_code AS ffnlgCode diff --git a/mens-api/src/main/resources/egovframework/mapper/biz/ens-kt-oracle-mapper.xml b/mens-api/src/main/resources/egovframework/mapper/biz/ens-kt-oracle-mapper.xml index 96eb510..c7ecbf8 100644 --- a/mens-api/src/main/resources/egovframework/mapper/biz/ens-kt-oracle-mapper.xml +++ b/mens-api/src/main/resources/egovframework/mapper/biz/ens-kt-oracle-mapper.xml @@ -3,8 +3,8 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - - /** ens-kt-oracle-mapper|updateRlaybsnmKtInfo-kt token 정보 갱신|julim */ + + /** ens-kt-oracle-mapper|updateRlaybsnmKtBcInfo-kt BC token 정보 갱신|julim */ UPDATE tb_ens_rlaybsnm_manage SET kt_scope = #{ktScope}, @@ -25,6 +25,24 @@ AND ffnlg_code = #{ffnlgCode} + + /** ens-kt-oracle-mapper|updateRlaybsnmKtGbsInfo-kt GIBIS token 정보 갱신|julim */ + UPDATE tb_ens_rlaybsnm_manage + SET + + + kt_prod_access_token = #{ktAccessToken}, + + + kt_dev_access_token = #{ktAccessToken}, + + + updt_dt = sysdate, + updusr = 'api-biz' + WHERE signgu_code = #{signguCode} + AND ffnlg_code = #{ffnlgCode} + + /** ens-kt-oracle-mapper|updateKtGbsDtl-kt GIBIS 메세지 수신결과 상세 반영|julim */ UPDATE tb_ens_kt_gbs diff --git a/mens-batch/src/main/java/kr/xit/batch/ens/job/KtGbsAccessTokenUpdateJobConfig.java b/mens-batch/src/main/java/kr/xit/batch/ens/job/KtGbsAccessTokenUpdateJobConfig.java new file mode 100644 index 0000000..78b2455 --- /dev/null +++ b/mens-batch/src/main/java/kr/xit/batch/ens/job/KtGbsAccessTokenUpdateJobConfig.java @@ -0,0 +1,114 @@ +package kr.xit.batch.ens.job; + +import org.springframework.batch.core.Job; +import org.springframework.batch.core.Step; +import org.springframework.batch.core.configuration.annotation.JobBuilderFactory; +import org.springframework.batch.core.configuration.annotation.JobScope; +import org.springframework.batch.core.configuration.annotation.StepBuilderFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import kr.xit.batch.ens.task.KtGbsAccessTokenUpdateTasklet; +import kr.xit.biz.ens.service.IEnsBatchKtGbsAccessTokenUpdateService; +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; + +/** + *
+ * description :
+ *
+ * packageName : kr.xit.batch.ens.job
+ * fileName    : KtGbsAccessTokenUpdateJobConfig
+ * author      : seojh
+ * date        : 2024-08-29
+ * ======================================================================
+ * 변경일         변경자        변경 내용
+ * ----------------------------------------------------------------------
+ * 2024-08-29    julim       최초 생성
+ *
+ * 
+ */ +@Slf4j +@RequiredArgsConstructor +@Configuration +public class KtGbsAccessTokenUpdateJobConfig { + private static final String JOB_NAME = "ktGbsAccessTokenUpdateJob"; + + @SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection") + private final JobBuilderFactory jobBuilderFactory; + private final StepBuilderFactory stepBuilderFactory; + + private final IBatchCmmService lockService; + private final IEnsBatchKtGbsAccessTokenUpdateService service; + + @Bean(name = JOB_NAME) + public Job ktGbsAccessTokenUpdateJob() { + 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 KtGbsAccessTokenUpdateTasklet(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(); + } +} diff --git a/mens-batch/src/main/java/kr/xit/batch/ens/scheduler/KtGbsAccessTokenUpdateJobScheduler.java b/mens-batch/src/main/java/kr/xit/batch/ens/scheduler/KtGbsAccessTokenUpdateJobScheduler.java new file mode 100644 index 0000000..175b044 --- /dev/null +++ b/mens-batch/src/main/java/kr/xit/batch/ens/scheduler/KtGbsAccessTokenUpdateJobScheduler.java @@ -0,0 +1,74 @@ +package kr.xit.batch.ens.scheduler; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import org.springframework.batch.core.JobParameter; +import org.springframework.batch.core.JobParameters; +import org.springframework.batch.core.JobParametersInvalidException; +import org.springframework.batch.core.launch.JobLauncher; +import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException; +import org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import kr.xit.batch.ens.job.KtGbsAccessTokenUpdateJobConfig; +import kr.xit.biz.common.ApiConstants; +import kr.xit.biz.common.ApiConstants.SignguCode; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + *
+ * description :상태 close - send-ok
+ *              대상 : 연계 발송 마스터(tb_cntc_sndng_mastr)
+ *                ->  연계 발송 마스터(tb_cntc_sndng_mastr)
+ *                    통합 발송 마스터(tb_ens_unity_sndng_mastr)
+ *                    발송 마스터(tb_ens_sndng_mastr)
+ * packageName : kr.xit.batch.ens.scheduler
+ * fileName    : SndngCloseJobScheduler
+ * author      : seojh
+ * date        : 2023-06-14
+ * ======================================================================
+ * 변경일         변경자        변경 내용
+ * ----------------------------------------------------------------------
+ * 2023-06-14    seojh       최초 생성
+ *
+ * 
+ */ +@Slf4j +@RequiredArgsConstructor +@Component +public class KtGbsAccessTokenUpdateJobScheduler { + @SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection") + private final JobLauncher jobLauncher; + private final KtGbsAccessTokenUpdateJobConfig jobConfiguration; + @Value("${app.slack-webhook.enabled:false}") + private String isSlackEnabled; + + @Scheduled(cron = "${app.batch.cron.ens.kt-gibis-token}") + public void runJob() { + + Map confMap = new HashMap<>(); + confMap.put("startDate", new JobParameter(new Date())); + confMap.put("isSlackEnabled", new JobParameter(isSlackEnabled)); + + try { + for(SignguCode signguCode : SignguCode.values()) { + confMap.put("signguCode", new JobParameter(signguCode.getCode())); + confMap.put("ffnlgCode", new JobParameter(ApiConstants.FFNLN_CODE)); + JobParameters jobParameters = new JobParameters(confMap); + jobLauncher.run(jobConfiguration.ktGbsAccessTokenUpdateJob(), jobParameters); + } + + } catch (JobExecutionAlreadyRunningException | JobInstanceAlreadyCompleteException + | JobParametersInvalidException | org.springframework.batch.core.repository.JobRestartException e) { + + log.error(e.getMessage()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} diff --git a/mens-batch/src/main/java/kr/xit/batch/ens/task/KtGbsAccessTokenUpdateTasklet.java b/mens-batch/src/main/java/kr/xit/batch/ens/task/KtGbsAccessTokenUpdateTasklet.java new file mode 100644 index 0000000..8625ea6 --- /dev/null +++ b/mens-batch/src/main/java/kr/xit/batch/ens/task/KtGbsAccessTokenUpdateTasklet.java @@ -0,0 +1,71 @@ +package kr.xit.batch.ens.task; + +import java.util.UUID; + +import org.slf4j.MDC; +import org.springframework.batch.core.ExitStatus; +import org.springframework.batch.core.StepContribution; +import org.springframework.batch.core.configuration.annotation.JobScope; +import org.springframework.batch.core.scope.context.ChunkContext; +import org.springframework.batch.core.step.tasklet.Tasklet; +import org.springframework.batch.repeat.RepeatStatus; + +import kr.xit.batch.ens.task.cmm.TaskCmmUtils; +import kr.xit.biz.ens.model.kt.KtCommonDTO; +import kr.xit.biz.ens.service.IEnsBatchKtGbsAccessTokenUpdateService; +import kr.xit.core.exception.ErrorParse; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + *
+ * description :
+ *
+ * packageName : kr.xit.batch.ens.task
+ * fileName    : SndngCloseTasklet
+ * author      : seojh
+ * date        : 2023-06-14
+ * ======================================================================
+ * 변경일         변경자        변경 내용
+ * ----------------------------------------------------------------------
+ * 2023-06-14    seojh       최초 생성
+ *
+ * 
+ */ +@Slf4j +@RequiredArgsConstructor +public class KtGbsAccessTokenUpdateTasklet implements Tasklet { + private final IEnsBatchKtGbsAccessTokenUpdateService service; + + @Override + @JobScope + public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) { + final String isSlackEnabled = contribution.getStepExecution().getJobParameters().getString("isSlackEnabled"); + + try { + MDC.put("request_trace_batch_id", UUID.randomUUID().toString().replace("-", "")); + MDC.put("method", "POST"); + MDC.put("service_error_msg", ""); + + service.modifyAccessToken( + KtCommonDTO.KtMnsRequest.builder() + .signguCode(contribution.getStepExecution().getJobParameters().getString("signguCode")) + .ffnlgCode(contribution.getStepExecution().getJobParameters().getString("ffnlgCode")) + .build() + ); + }catch(Exception e){ + String errMsg = ErrorParse.extractError(e).getMessage(); + log.error("KtGbsAccessTokenUpdateTasklet 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; + } +} diff --git a/mens-batch/src/main/java/kr/xit/batch/ens/web/BatchJobWebController.java b/mens-batch/src/main/java/kr/xit/batch/ens/web/BatchJobWebController.java index 802ba40..d731d46 100644 --- a/mens-batch/src/main/java/kr/xit/batch/ens/web/BatchJobWebController.java +++ b/mens-batch/src/main/java/kr/xit/batch/ens/web/BatchJobWebController.java @@ -23,6 +23,7 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.ExampleObject; import io.swagger.v3.oas.annotations.tags.Tag; +import kr.xit.batch.ens.job.KtGbsAccessTokenUpdateJobConfig; import kr.xit.batch.ens.job.SndngAcceptJobConfig; import kr.xit.batch.ens.job.SndngCloseJobConfig; import kr.xit.batch.ens.job.SndngMakeJobConfig; @@ -67,6 +68,7 @@ public class BatchJobWebController { private final SndngSnedBulksJobConfig sendBulksJobConfig; private final SndngStatusBulksJobConfig statusJobConfig; private final SndngCloseJobConfig closeJobConfig; + private final KtGbsAccessTokenUpdateJobConfig tokenUpdateJobConfig; private static final String CAN_1 = """ { @@ -280,6 +282,43 @@ public class BatchJobWebController { return ApiResponseDTO.success(HttpStatus.OK); } + @io.swagger.v3.oas.annotations.parameters.RequestBody(required = true, content = { + @Content( + mediaType = "application/json", + examples = { + @ExampleObject( + name = "춘천", + value = CCN), + @ExampleObject( + name = "천안시 동남구청", + value = CAN_1), + @ExampleObject( + name = "천안시 서북구청", + value = CAN_2) + }) + }) + @Operation(summary = "ktGbsAccessTokenUpdate", description = "ktGbsAccessTokenUpdate") + @PostMapping(value = "/ktGbsAccessTokenUpdate", produces = MediaType.APPLICATION_JSON_VALUE) + public IApiResponse tokenUpdateJobConfig(@RequestBody final CmmEnsRequestDTO reqDTO) { + + try { + JobExecution jobExecution = jobLauncher.run( + tokenUpdateJobConfig.ktGbsAccessTokenUpdateJob(), + getJobParameters(reqDTO, "") + ); + + 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 confMap = new HashMap<>(); diff --git a/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchKtGbsAccessTokenUpdateService.java b/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchKtGbsAccessTokenUpdateService.java new file mode 100644 index 0000000..56777fc --- /dev/null +++ b/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchKtGbsAccessTokenUpdateService.java @@ -0,0 +1,56 @@ +package kr.xit.biz.ens.service; + +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; + +import kr.xit.biz.ens.cmm.CmmEnsBizUtils; +import kr.xit.biz.ens.model.kt.KtCommonDTO; +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; + +/** + *
+ * description : 모바일 전자고지 배치 서비스
+ *               - 배치에서 호출되는 클래스로 배치 로그등 Transaction 분리 필요
+ * packageName : kr.xit.biz.ens.service
+ * fileName    : EnsBatchKtGbsAccessTokenUpdateService
+ * author      : limju
+ * date        : 2024-08-29
+ * ======================================================================
+ * 변경일         변경자        변경 내용
+ * ----------------------------------------------------------------------
+ * 2024-08-29    limju       최초 생성
+ *
+ * 
+ */ +@Slf4j +@RequiredArgsConstructor +@Service +public class EnsBatchKtGbsAccessTokenUpdateService extends AbstractService implements IEnsBatchKtGbsAccessTokenUpdateService { + @Value("${app.contract.host}") + private String apiHost; + + @Value("${app.contract.kt.gibis.api.requestToken}") + private String requestToken; + + private final ApiWebClientUtil apiWebClient; + + @Override + @Transactional(propagation = Propagation.REQUIRES_NEW) + public void modifyAccessToken(final KtCommonDTO.KtMnsRequest dto) { + final String url = apiHost + requestToken; + + apiWebClient.exchange( + url, + HttpMethod.POST, + dto, + ApiResponseDTO.class, + CmmEnsBizUtils.getHeadeMap()); + } +} diff --git a/mens-batch/src/main/java/kr/xit/biz/ens/service/IEnsBatchKtGbsAccessTokenUpdateService.java b/mens-batch/src/main/java/kr/xit/biz/ens/service/IEnsBatchKtGbsAccessTokenUpdateService.java new file mode 100644 index 0000000..be1525f --- /dev/null +++ b/mens-batch/src/main/java/kr/xit/biz/ens/service/IEnsBatchKtGbsAccessTokenUpdateService.java @@ -0,0 +1,21 @@ +package kr.xit.biz.ens.service; + +import kr.xit.biz.ens.model.kt.KtCommonDTO; + +/** + *
+ * description : 
+ * packageName : kr.xit.biz.ens.service
+ * fileName    : IEnsBatchKtGbsAccessTokenUpdateService
+ * author      : limju
+ * date        : 2024 8월 29
+ * ======================================================================
+ * 변경일         변경자        변경 내용
+ * ----------------------------------------------------------------------
+ * 2024 8월 29   limju       최초 생성
+ *
+ * 
+ */ +public interface IEnsBatchKtGbsAccessTokenUpdateService { + void modifyAccessToken(final KtCommonDTO.KtMnsRequest dto); +}