From abaeb3bbc35d17b06dc543c95273a7c757588bf8 Mon Sep 17 00:00:00 2001 From: "Jonguk. Lim" Date: Fri, 4 Oct 2024 15:03:28 +0900 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20NICE=20CI=20accept=20=EC=A7=84?= =?UTF-8?q?=ED=96=89=20=20=20=20=20=20=20NICE=20CI=20API=20=ED=98=B8?= =?UTF-8?q?=EC=B6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xit/ens/modules/nice/service/NiceCiAcceptService.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/cokr/xit/ens/modules/nice/service/NiceCiAcceptService.java b/src/main/java/cokr/xit/ens/modules/nice/service/NiceCiAcceptService.java index 486facd..9a9d97b 100644 --- a/src/main/java/cokr/xit/ens/modules/nice/service/NiceCiAcceptService.java +++ b/src/main/java/cokr/xit/ens/modules/nice/service/NiceCiAcceptService.java @@ -15,6 +15,7 @@ import cokr.xit.ens.core.exception.*; import cokr.xit.ens.core.exception.code.*; import cokr.xit.ens.core.utils.*; import cokr.xit.ens.modules.common.code.*; +import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.api.*; import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.model.*; import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.service.process.model.*; import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.api.*; @@ -59,6 +60,7 @@ public class NiceCiAcceptService { private final INiceCiMapper niceCiMapper; private final PayUseSysApi payUseSysApi; + private final BillKkoPayApiSpec billKkoPayApi; private Gson gson = new GsonBuilder().disableHtmlEscaping().create(); @@ -207,8 +209,8 @@ public class NiceCiAcceptService { .build(); billHistoryService.insertBillHistory(billHistDTO); - ResponseEntity resEntity = payUseSysApi.payUrl(orgMng.getKkoBpUrlApi(), param, - null); + ResponseEntity resEntity = billKkoPayApi.url(orgMng.getKkoBpBillerCode(), orgMng.getKkoBpAuthorization(), + gson.toJson(param)); // 마스터 상태 실패처리 if(resEntity.getStatusCode() != HttpStatus.OK){ From 613ad05383045ea2c6588559457ec94d0774d9f9 Mon Sep 17 00:00:00 2001 From: "Jonguk. Lim" Date: Fri, 4 Oct 2024 15:04:22 +0900 Subject: [PATCH 2/4] =?UTF-8?q?feat:=20NICE=20CI=20accept=20=EC=A7=84?= =?UTF-8?q?=ED=96=89=20=20=20=20=20=20=20NICE=20CI=20API=20=ED=98=B8?= =?UTF-8?q?=EC=B6=9C=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xit/ens/modules/nice/service/NiceCiAcceptService.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/java/cokr/xit/ens/modules/nice/service/NiceCiAcceptService.java b/src/main/java/cokr/xit/ens/modules/nice/service/NiceCiAcceptService.java index 9a9d97b..e04c973 100644 --- a/src/main/java/cokr/xit/ens/modules/nice/service/NiceCiAcceptService.java +++ b/src/main/java/cokr/xit/ens/modules/nice/service/NiceCiAcceptService.java @@ -18,7 +18,6 @@ import cokr.xit.ens.modules.common.code.*; import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.api.*; import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.model.*; import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.service.process.model.*; -import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.api.*; import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.code.*; import cokr.xit.ens.modules.common.ctgy.sys.mng.domain.*; import cokr.xit.ens.modules.common.ctgy.sys.mng.service.*; @@ -56,12 +55,9 @@ public class NiceCiAcceptService { private final KeySequenceService keySequenceService; private final NiceCiBillHistoryService billHistoryService; - - private final INiceCiMapper niceCiMapper; - private final PayUseSysApi payUseSysApi; - private final BillKkoPayApiSpec billKkoPayApi; + private final BillKkoPayApiSpec billKkoPayApi; private Gson gson = new GsonBuilder().disableHtmlEscaping().create(); From 6bd34dc6ba2fc3c3c30ee9898c4ccc2fed679c31 Mon Sep 17 00:00:00 2001 From: "Jonguk. Lim" Date: Fri, 4 Oct 2024 15:24:00 +0900 Subject: [PATCH 3/4] =?UTF-8?q?feat:=20NICE=20CI=20=EC=9D=B8=EC=A6=9D?= =?UTF-8?q?=ED=86=A1=20=EC=A7=84=ED=96=89=20=20=20=20=20=20=20cron=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cron/cron.txt | 6 ++++++ .../modules/nice/presentation/NiceCiController.java | 11 +++++------ .../ens/modules/nice/service/NiceCiAcceptService.java | 8 +++++--- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/cron/cron.txt b/cron/cron.txt index 12674ff..30a124f 100644 --- a/cron/cron.txt +++ b/cron/cron.txt @@ -5,6 +5,9 @@ ## 업무 테이블 자료 접수 */2 * * * * curl -X POST https://phts-manager.koti.re.kr/iup/signtalk/accept/all +## FIXME: 업무 테이블 자료 접수 - NICE CI 추가 +*/2 * * * * curl -X POST https://phts-manager.koti.re.kr/nice/talk/accept/all + ## 업무 테이블 전송 결과 반영 7 7-23 * * * curl -X POST https://phts-manager.koti.re.kr/iup/signtalk/fetch/all @@ -26,6 +29,9 @@ */1 9-18 * * * curl -X POST https://phts-manager.koti.re.kr/nv/signtalk/send/bulk/all */30 9-21 * * * curl -X POST https://phts-manager.koti.re.kr/nv/signtalk/stat/bulk/all +# FIXME: NICE CI 인증톡 추가 +*/1 9-18 * * * curl -X POST https://phts-manager.koti.re.kr/nice/talk/send/bulk/all +*/30 9-21 * * * curl -X POST https://phts-manager.koti.re.kr/nice/talk/stat/bulk/all #---------------------------------------------# # [ENS] 로그 데이터 삭제 스케줄러 diff --git a/src/main/java/cokr/xit/ens/modules/nice/presentation/NiceCiController.java b/src/main/java/cokr/xit/ens/modules/nice/presentation/NiceCiController.java index dbbbc9b..5555914 100644 --- a/src/main/java/cokr/xit/ens/modules/nice/presentation/NiceCiController.java +++ b/src/main/java/cokr/xit/ens/modules/nice/presentation/NiceCiController.java @@ -3,7 +3,6 @@ package cokr.xit.ens.modules.nice.presentation; import org.springframework.http.*; import org.springframework.web.bind.annotation.*; -import cokr.xit.ens.modules.nice.model.*; import cokr.xit.ens.modules.nice.service.*; import io.swagger.v3.oas.annotations.*; import io.swagger.v3.oas.annotations.tags.*; @@ -32,19 +31,19 @@ public class NiceCiController { private final NiceCiAcceptService niceCiAcceptService; @Operation(summary = "접수") - @PostMapping(value = "/accept", produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity accept(final NiceCiDTO.NiceCiParam niceCiParam) { - return new ResponseEntity<>(niceCiAcceptService.accept(niceCiParam), HttpStatus.OK); + @PostMapping(value = "/accept/all", produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity accept() { + return new ResponseEntity<>(niceCiAcceptService.accept(), HttpStatus.OK); } @Operation(summary = "(대량)전송요청") - @PostMapping(value = "/send/bulk", produces = MediaType.APPLICATION_JSON_VALUE) + @PostMapping(value = "/send/bulk/all", produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity sendBulk() { return new ResponseEntity<>(niceCiService.requestSendBulk(), HttpStatus.OK); } @Operation(summary = "(대량)상태조회") - @PostMapping(value = "/status/bulk", produces = MediaType.APPLICATION_JSON_VALUE) + @PostMapping(value = "/stat/bulk/all", produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity findBulkStatus() { return new ResponseEntity<>(niceCiService.findBulkStatus(), HttpStatus.OK); } diff --git a/src/main/java/cokr/xit/ens/modules/nice/service/NiceCiAcceptService.java b/src/main/java/cokr/xit/ens/modules/nice/service/NiceCiAcceptService.java index e04c973..1f67a9b 100644 --- a/src/main/java/cokr/xit/ens/modules/nice/service/NiceCiAcceptService.java +++ b/src/main/java/cokr/xit/ens/modules/nice/service/NiceCiAcceptService.java @@ -81,9 +81,11 @@ public class NiceCiAcceptService { * */ @Transactional(propagation = Propagation.REQUIRES_NEW) - public EnsResponseVO accept(final NiceCiDTO.NiceCiParam niceCiParam){ - niceCiParam.setSendType(IupSendTypeCd.NI.getCode()); - niceCiParam.setPrcsCd(IupPrcsCd.TGRG.getCode()); + public EnsResponseVO accept(){ + final NiceCiDTO.NiceCiParam niceCiParam = NiceCiDTO.NiceCiParam.builder() + .sendType(IupSendTypeCd.NI.getCode()) + .prcsCd(IupPrcsCd.TGRG.getCode()) + .build(); final List list = niceCiMapper.selectNiceCiAcceptTgts(niceCiParam); if(list.isEmpty()){ From baf910a44926ccd650b64c6f50b14a28777cb51c Mon Sep 17 00:00:00 2001 From: "Jonguk. Lim" Date: Fri, 4 Oct 2024 16:07:21 +0900 Subject: [PATCH 4/4] =?UTF-8?q?feat:=20NICE=20CI=20=EC=9D=B8=EC=A6=9D?= =?UTF-8?q?=ED=86=A1=20=EC=A7=84=ED=96=89=20-=20NICE=20CI=20API=20?= =?UTF-8?q?=ED=98=B8=EC=B6=9C=20=EA=B2=B0=EA=B3=BC=20=EB=B0=98=EC=98=81=20?= =?UTF-8?q?fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nice/service/NiceCiAcceptService.java | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/main/java/cokr/xit/ens/modules/nice/service/NiceCiAcceptService.java b/src/main/java/cokr/xit/ens/modules/nice/service/NiceCiAcceptService.java index 1f67a9b..14af269 100644 --- a/src/main/java/cokr/xit/ens/modules/nice/service/NiceCiAcceptService.java +++ b/src/main/java/cokr/xit/ens/modules/nice/service/NiceCiAcceptService.java @@ -8,6 +8,7 @@ import org.springframework.stereotype.*; import org.springframework.transaction.annotation.*; import com.google.gson.*; +import com.google.gson.reflect.*; import cokr.xit.ens.biz.iup.code.*; import cokr.xit.ens.core.aop.*; @@ -16,9 +17,9 @@ import cokr.xit.ens.core.exception.code.*; import cokr.xit.ens.core.utils.*; import cokr.xit.ens.modules.common.code.*; import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.api.*; -import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.model.*; import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.service.process.model.*; import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.code.*; +import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.model.*; import cokr.xit.ens.modules.common.ctgy.sys.mng.domain.*; import cokr.xit.ens.modules.common.ctgy.sys.mng.service.*; import cokr.xit.ens.modules.nice.mapper.*; @@ -119,8 +120,9 @@ public class NiceCiAcceptService { try { List inputDataXits = xit.getInputDataXits(); for (NiceCiDTO.InputDataXit data : inputDataXits) { - BillKkoApiRespDTO respDTO = getPayUrl(data, billHistDTO, orgMng, kkoPayUrlRespData); + PayApiRespDTO> respDTO = getPayUrl(data, billHistDTO, orgMng, kkoPayUrlRespData); + // FIXME: API 호출 결과 SET - 연계 설정후 확인 필요 data.setPayUrl(String.valueOf(respDTO.getData())); niceCiMapper.updatePayUrlOfDataInput(data); @@ -190,7 +192,7 @@ public class NiceCiAcceptService { * @param kkoPayUrlRespData KkoPayUrlRespData * @return KkoPayUrlRespData */ - private BillKkoApiRespDTO getPayUrl(final NiceCiDTO.InputDataXit dataXit, NiceCiDTO.BillHistDTO billHistDTO, final OrgMng orgMng, final KkoPayUrlRespData kkoPayUrlRespData){ + private PayApiRespDTO> getPayUrl(final NiceCiDTO.InputDataXit dataXit, NiceCiDTO.BillHistDTO billHistDTO, final OrgMng orgMng, final KkoPayUrlRespData kkoPayUrlRespData){ // FIXME: 파라메터 확인 필요 Map map = new HashMap<>(); map.put("biller_user_key", dataXit.getDataId()); @@ -211,18 +213,21 @@ public class NiceCiAcceptService { gson.toJson(param)); // 마스터 상태 실패처리 + String rsltStr = resEntity.getBody(); if(resEntity.getStatusCode() != HttpStatus.OK){ - billHistDTO.setErrorCode(resEntity.getStatusCode().toString()); - //billHistDTO.setErrorCode(EnsErrCd.API_COMM_ERROR.getCode()); - billHistDTO.setErrorMessage(resEntity.getBody()); + billHistDTO.setErrorCode(EnsErrCd.API_COMM_ERROR.getCode()); + billHistDTO.setErrorMessage("["+ BillLogSeCd.VD +"] " + EnsErrCd.API_COMM_ERROR.getCodeNm() + " " + resEntity.getStatusCode().toString()); billHistoryService.updateBillHistory(billHistDTO); - throw new EnsException(EnsErrCd.API_COMM_ERROR, EnsErrCd.API_COMM_ERROR.getCodeNm()); + throw new EnsException(EnsErrCd.API_COMM_ERROR, "["+ BillLogSeCd.VD +"] " + EnsErrCd.API_COMM_ERROR.getCodeNm() + " " + resEntity.getStatusCode().toString(), rsltStr); } - String rsltStr = resEntity.getBody(); - return BillKkoApiRespDTO.okBuilder() - .data(resEntity.getBody()) - .build(); - } - + try { + return gson.fromJson(rsltStr, new TypeToken>>() {}.getType()); + } catch (Exception ex) { + billHistDTO.setErrorCode(EnsErrCd.INVALID_RESPONSE.getCode()); + billHistDTO.setErrorMessage("["+ BillLogSeCd.VD +"] " + EnsErrCd.INVALID_RESPONSE.getCodeNm()); + billHistoryService.updateBillHistory(billHistDTO); + throw new EnsException(EnsErrCd.INVALID_RESPONSE, "["+ BillLogSeCd.VD +"] " + EnsErrCd.INVALID_RESPONSE.getCodeNm(), ex); + } + } }