From c00b6f545e7b8ac062ee5afc4bd848d0e62da1ab Mon Sep 17 00:00:00 2001 From: limju Date: Tue, 24 Oct 2023 18:33:47 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20KT=20=EC=82=AC=EC=A0=84/=EB=B3=B8=20?= =?UTF-8?q?=EB=AC=B8=EC=9E=90=20=EC=88=98=EC=8B=A0=20=EA=B2=B0=EA=B3=BC=20?= =?UTF-8?q?=EC=A0=84=EC=86=A1=20API=20=EB=B0=98=EC=98=81=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xit/biz/kt/service/BizKtMmsService.java | 8 +++--- .../java/kr/xit/ens/kt/cmm/CmmKtMmsUtils.java | 7 +++-- .../kr/xit/ens/kt/service/KtMmsService.java | 27 ++++++++++++++----- .../xit/biz/ens/service/EnsBatchService.java | 10 +++---- .../biz/batch/service/BatchCmmService.java | 4 +-- .../biz/batch/web/BatchCmmController.java | 1 - .../java/kr/xit/biz/common/ApiConstants.java | 10 +++++++ 7 files changed, 43 insertions(+), 24 deletions(-) diff --git a/mens-api/src/main/java/kr/xit/biz/kt/service/BizKtMmsService.java b/mens-api/src/main/java/kr/xit/biz/kt/service/BizKtMmsService.java index 6142a5e..00f170c 100644 --- a/mens-api/src/main/java/kr/xit/biz/kt/service/BizKtMmsService.java +++ b/mens-api/src/main/java/kr/xit/biz/kt/service/BizKtMmsService.java @@ -3,6 +3,7 @@ package kr.xit.biz.kt.service; import java.util.ArrayList; import java.util.List; import kr.xit.biz.cmm.service.ICmmEnsCacheService; +import kr.xit.biz.common.ApiConstants; import kr.xit.biz.common.ApiConstants.SignguCode; import kr.xit.biz.ens.model.cmm.CmmEnsRequestDTO; import kr.xit.biz.ens.model.cmm.CmmEnsRlaybsnmDTO; @@ -42,7 +43,6 @@ import org.springframework.stereotype.Service; @RequiredArgsConstructor @Service public class BizKtMmsService extends EgovAbstractServiceImpl implements IBizKtMmsService { - private static final String profile = System.getProperty("spring.profiles.active"); private static final int MAX_KT_SEND_CNT = 100; @Value("${contract.kt.api.dp-callback-url}") @@ -73,7 +73,7 @@ public class BizKtMmsService extends EgovAbstractServiceImpl implements IBizKtMm CmmEnsRlaybsnmDTO.builder() .signguCode(paramDTO.getSignguCode()) .ffnlgCode(paramDTO.getFfnlgCode()) - .profile(profile) + .profile(ApiConstants.PROFILE) .ktAccessToken(resDTO.getAccessToken()) .ktTokenExpiresIn(resDTO.getExpiresIn()) .ktScope(resDTO.getScope()) @@ -121,7 +121,7 @@ public class BizKtMmsService extends EgovAbstractServiceImpl implements IBizKtMm KtMainSendRequest.builder() .signguCode(reqDTO.getSignguCode()) .ffnlgCode(reqDTO.getFfnlgCode()) - .profile(profile) + .profile(ApiConstants.PROFILE) //.serviceCd("cache") //.serviceKey("cache") .msgCd("db") @@ -168,7 +168,7 @@ public class BizKtMmsService extends EgovAbstractServiceImpl implements IBizKtMm KtMsgRsltRequest.builder() .signguCode(reqDTO.getSignguCode()) .ffnlgCode(reqDTO.getFfnlgCode()) - .profile(profile) + .profile(ApiConstants.PROFILE) .reqs(reqs) .build() ); diff --git a/mens-api/src/main/java/kr/xit/ens/kt/cmm/CmmKtMmsUtils.java b/mens-api/src/main/java/kr/xit/ens/kt/cmm/CmmKtMmsUtils.java index 7b7a738..1879646 100644 --- a/mens-api/src/main/java/kr/xit/ens/kt/cmm/CmmKtMmsUtils.java +++ b/mens-api/src/main/java/kr/xit/ens/kt/cmm/CmmKtMmsUtils.java @@ -3,6 +3,7 @@ package kr.xit.ens.kt.cmm; import egovframework.com.cmm.EgovMessageSource; import java.util.Objects; import kr.xit.biz.cmm.service.ICmmEnsCacheService; +import kr.xit.biz.common.ApiConstants; import kr.xit.biz.ens.model.cmm.CmmEnsRequestDTO; import kr.xit.biz.ens.model.cmm.CmmEnsRlaybsnmDTO; import kr.xit.biz.ens.model.kt.KtCommonDTO.KtMnsRequest; @@ -37,8 +38,6 @@ public class CmmKtMmsUtils { private static final ICmmEnsCacheService cacheService = ApiSpringUtils.getCmmEnsCacheService(); private static final IKtMmsService ktMmsService = ApiSpringUtils.getKtMmsService(); - private static final String profile = System.getProperty("spring.profiles.active"); - /** * KT MMS 인증 정보 조회 * @return @@ -47,7 +46,7 @@ public class CmmKtMmsUtils { CmmEnsRequestDTO ensDTO = CmmEnsRequestDTO.builder() .signguCode(signguCode) .ffnlgCode(ffnlgCode) - .profile(profile) + .profile(ApiConstants.PROFILE) .build(); final CmmEnsRlaybsnmDTO dto = cacheService.getRlaybsnmInfoCache(ensDTO); @@ -63,7 +62,7 @@ public class CmmKtMmsUtils { KtMnsRequest.builder() .signguCode(signguCode) .ffnlgCode(ffnlgCode) - .profile(profile) + .profile(ApiConstants.PROFILE) .build() ); return cacheService.getRlaybsnmInfoCache(ensDTO); diff --git a/mens-api/src/main/java/kr/xit/ens/kt/service/KtMmsService.java b/mens-api/src/main/java/kr/xit/ens/kt/service/KtMmsService.java index 36bda51..3b0a1e3 100644 --- a/mens-api/src/main/java/kr/xit/ens/kt/service/KtMmsService.java +++ b/mens-api/src/main/java/kr/xit/ens/kt/service/KtMmsService.java @@ -2,6 +2,9 @@ package kr.xit.ens.kt.service; import java.util.HashMap; import java.util.Map; +import kr.xit.biz.common.ApiConstants; +import kr.xit.biz.common.ApiConstants.KtServiceCode; +import kr.xit.biz.common.ApiConstants.SignguCode; import kr.xit.biz.ens.model.cmm.CmmEnsRlaybsnmDTO; import kr.xit.biz.ens.model.kt.KtAcmdDTO.KtAcmdCerfRequest; import kr.xit.biz.ens.model.kt.KtAcmdDTO.KtAcmdCerfResponse; @@ -263,6 +266,14 @@ public class KtMmsService extends EgovAbstractServiceImpl implements IKtMmsServi @Override @TraceLogging public KtCommonResponse messageResult(final KtMsgRsltRequest reqDTO) { + switch(KtServiceCode.compare(reqDTO.getServiceCd())){ + case SISUL -> reqDTO.setSignguCode(SignguCode.TRAFFIC.getCode()); + case CHUMO -> reqDTO.setSignguCode(SignguCode.FUNERAL.getCode()); + } + reqDTO.setFfnlgCode(ApiConstants.FFNLN_CODE); + reqDTO.setProfile(ApiConstants.PROFILE); + + final CmmEnsRlaybsnmDTO ktMnsInfo = CmmKtMmsUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()); reqDTO.setServiceCd(ktMnsInfo.getKtServiceCode()); reqDTO.setSignguCode(null); @@ -270,13 +281,15 @@ public class KtMmsService extends EgovAbstractServiceImpl implements IKtMmsServi reqDTO.setProfile(null); CmmEnsUtils.validate(reqDTO); - return webClient.exchangeKt( - HOST + API_RESULT_MESSAGE, - HttpMethod.POST, - JsonUtils.toJson(reqDTO), - KtCommonResponse.class, - ktMnsInfo - ); + //TODO :: BIZ 처리 반영 할것 +// return webClient.exchangeKt( +// HOST + API_RESULT_MESSAGE, +// HttpMethod.POST, +// JsonUtils.toJson(reqDTO), +// KtCommonResponse.class, +// ktMnsInfo +// ); + return null; } //------------------------------------------------------------------------------ diff --git a/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchService.java b/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchService.java index 348b3fc..1b517a0 100644 --- a/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchService.java +++ b/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchService.java @@ -77,8 +77,6 @@ public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatc @Value("${contract.kt.api.bulkstatus}") private String apiKtBcBulkStatus; - private static final String profile = System.getProperty("spring.profiles.active"); - private final IEnsBatchRequireNewService requireNewService; private final ApiWebClientUtil apiWebClient; private final IEnsBatchMapper mapper; @@ -138,7 +136,7 @@ public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatc for (EnsDTO.SndngMssageParam dto : list) { dto.setSignguCode(reqDTO.getSignguCode()); dto.setFfnlgCode(reqDTO.getFfnlgCode()); - dto.setProfile(profile); + dto.setProfile(ApiConstants.PROFILE); final List mstIdList = new ArrayList<>(); String mstId = ""; if (!Objects.equals(mstId, dto.getUnitySndngMastrId())) { @@ -226,7 +224,7 @@ public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatc dto.setSignguCode(reqDTO.getSignguCode()); dto.setFfnlgCode(reqDTO.getFfnlgCode()); - dto.setProfile(profile); + dto.setProfile(ApiConstants.PROFILE); dto.setSndngProcessSttus(reqDTO.getSndngProcessSttus()); dto.setNewSndngProcessSttus(ApiConstants.SndngProcessStatus.MAKE_OK.getCode()); //FIXME: try1,try2,tr3이 있는 경우 try1 이전에 try2,3이 실행될 수 있는 경우??? @@ -242,7 +240,7 @@ public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatc dto.setSignguCode(reqDTO.getSignguCode()); dto.setFfnlgCode(reqDTO.getFfnlgCode()); - dto.setProfile(profile); + dto.setProfile(ApiConstants.PROFILE); //try2 발송 대상이 있는지 확인 final int sendCnt = mapper.selectSendOkTgts(dto); @@ -297,7 +295,7 @@ public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatc for (EnsDTO.SndngMssageParam tgtDTO : tgtList) { tgtDTO.setSignguCode(reqDTO.getSignguCode()); tgtDTO.setFfnlgCode(reqDTO.getFfnlgCode()); - tgtDTO.setProfile(profile); + tgtDTO.setProfile(ApiConstants.PROFILE); MDC.put(UNITY_SNDNG_MST_ID, tgtDTO.getUnitySndngMastrId()); MDC.put("sndngMastrId", tgtDTO.getSndngMastrId()); diff --git a/mens-batch/src/main/java/kr/xit/core/biz/batch/service/BatchCmmService.java b/mens-batch/src/main/java/kr/xit/core/biz/batch/service/BatchCmmService.java index 3b61431..ed3d95a 100644 --- a/mens-batch/src/main/java/kr/xit/core/biz/batch/service/BatchCmmService.java +++ b/mens-batch/src/main/java/kr/xit/core/biz/batch/service/BatchCmmService.java @@ -2,6 +2,7 @@ package kr.xit.core.biz.batch.service; import java.util.List; import java.util.Optional; +import kr.xit.biz.common.ApiConstants; import kr.xit.core.biz.batch.mapper.IBatchCmmMapper; import kr.xit.core.biz.batch.model.BatchCmmDTO.BatchCmmRequest; import kr.xit.core.biz.batch.model.BatchCmmDTO.BatchLock; @@ -28,7 +29,6 @@ import org.springframework.transaction.annotation.Transactional; */ @Service public class BatchCmmService extends EgovAbstractServiceImpl implements IBatchCmmService { - private static final String profile = System.getProperty("spring.profiles.active"); private final IBatchCmmMapper mapper; public BatchCmmService(IBatchCmmMapper mapper) { @@ -78,7 +78,7 @@ public class BatchCmmService extends EgovAbstractServiceImpl implements IBatchCm @Transactional(readOnly = true) public String execBatch(final BatchCmmRequest reqDTO){ BatchLock rtnDTO = mapper.selectBatchLock(reqDTO.getInstanceId()).orElseThrow(() -> BizRuntimeException.create("배치 인스턴스를 찾을 수 없습니다.")); - reqDTO.setProfile(profile); + reqDTO.setProfile(ApiConstants.PROFILE); String uri = rtnDTO.getInstanceUrl(); diff --git a/mens-batch/src/main/java/kr/xit/core/biz/batch/web/BatchCmmController.java b/mens-batch/src/main/java/kr/xit/core/biz/batch/web/BatchCmmController.java index 75a9054..26c62f2 100644 --- a/mens-batch/src/main/java/kr/xit/core/biz/batch/web/BatchCmmController.java +++ b/mens-batch/src/main/java/kr/xit/core/biz/batch/web/BatchCmmController.java @@ -35,7 +35,6 @@ import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/batch/cmm/v1") public class BatchCmmController { - private static final String profile = System.getProperty("spring.profiles.active"); private static final String PARAM1 = """ { "signguCode": "88328", diff --git a/mens-core/src/main/java/kr/xit/biz/common/ApiConstants.java b/mens-core/src/main/java/kr/xit/biz/common/ApiConstants.java index 0dee164..3476e66 100644 --- a/mens-core/src/main/java/kr/xit/biz/common/ApiConstants.java +++ b/mens-core/src/main/java/kr/xit/biz/common/ApiConstants.java @@ -21,6 +21,7 @@ import lombok.Getter; */ public class ApiConstants { + public static final String PROFILE = System.getProperty("spring.profiles.active"); public static final String FFNLN_CODE = "11"; /** @@ -199,4 +200,13 @@ public class ApiConstants { SYM_KEY, CI } + + public enum KtServiceCode { + SISUL, + CHUMO; + + public static KtServiceCode compare(final String en){ + return valueOf(en); + } + } }