From a68c0c356cc45e0c344dc7df6a9ec081f0aaeb31 Mon Sep 17 00:00:00 2001 From: "Jonguk. Lim" Date: Thu, 17 Oct 2024 14:29:46 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20nice=20ci=20=EC=A0=84=EB=AC=B8=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC=20fix=20=20=20=20=20=20=EC=9D=91=EB=8B=B5=20?= =?UTF-8?q?=EB=B0=98=EB=B3=B5=EB=B6=80=EA=B0=80=20=EC=97=86=EC=9D=84=20?= =?UTF-8?q?=EA=B2=BD=EC=9A=B0=EC=97=90=20=EB=8C=80=ED=95=9C=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cokr/xit/ens/modules/nice/model/NiceCiApiSendDTO.java | 8 ++++++-- .../xit/ens/modules/nice/model/NiceCiApiStatusDTO.java | 8 ++++++-- .../ens/modules/nice/service/NiceCiStatBulkService.java | 8 ++++---- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/main/java/cokr/xit/ens/modules/nice/model/NiceCiApiSendDTO.java b/src/main/java/cokr/xit/ens/modules/nice/model/NiceCiApiSendDTO.java index a8c4919..7c86962 100644 --- a/src/main/java/cokr/xit/ens/modules/nice/model/NiceCiApiSendDTO.java +++ b/src/main/java/cokr/xit/ens/modules/nice/model/NiceCiApiSendDTO.java @@ -383,7 +383,7 @@ public class NiceCiApiSendDTO { 84, // 공란 }; - if (StringUtils.isNotBlank(tgtString) && NiceCiUtils.lengthKr(tgtString) >= 2310) { + if (StringUtils.isNotBlank(tgtString) && NiceCiUtils.lengthKr(tgtString) >= 2210) { Response response = new Response(); int idx = 0; response.setTrnscId(StringUtils.left(tgtString, parseLength[idx])); @@ -410,7 +410,7 @@ public class NiceCiApiSendDTO { response.setIndvdlzRspnsBlnk(StringUtils.left(tgtString, parseLength[idx])); tgtString = tgtString.substring(parseLength[idx]); - if(NiceCiUtils.lengthKr(tgtString) % repeatLength == 0){ + if(NiceCiUtils.lengthKr(tgtString) > 0 && NiceCiUtils.lengthKr(tgtString) % repeatLength == 0){ int repeat = NiceCiUtils.lengthKr(tgtString) / repeatLength; String finalTgtString = tgtString; List resResults = IntStream.range(0, repeat) @@ -420,6 +420,10 @@ public class NiceCiApiSendDTO { }) .collect(Collectors.toList()); response.setNiceCiResults(resResults); + }else{ + if((NiceCiUtils.lengthKr(tgtString) != 0)){ + throw new EnsException(EnsErrCd.INVALID_RESPONSE, "NICE CI 송신 응답 반복부 전문 오류:: length - " + NiceCiUtils.lengthKr(tgtString)); + } } return response; } diff --git a/src/main/java/cokr/xit/ens/modules/nice/model/NiceCiApiStatusDTO.java b/src/main/java/cokr/xit/ens/modules/nice/model/NiceCiApiStatusDTO.java index 2187ab7..8ee8cde 100644 --- a/src/main/java/cokr/xit/ens/modules/nice/model/NiceCiApiStatusDTO.java +++ b/src/main/java/cokr/xit/ens/modules/nice/model/NiceCiApiStatusDTO.java @@ -316,7 +316,7 @@ public class NiceCiApiStatusDTO { // FIXME: 인코딩확인후 필요시 사용 //String tgtString = new String(tgtStr.getBytes(), StandardCharsets.UTF_8); - if (StringUtils.isNotBlank(tgtString) && NiceCiUtils.lengthKr(tgtString) >= 1290) { + if (StringUtils.isNotBlank(tgtString) && NiceCiUtils.lengthKr(tgtString) >= 140) { Response nr = new Response(); int idx = 0; nr.setTrnscId(StringUtils.left(tgtString, parseLength[idx])); @@ -334,7 +334,7 @@ public class NiceCiApiStatusDTO { nr.setRspnsCo(StringUtils.left(tgtString, parseLength[idx])); tgtString = tgtString.substring(parseLength[idx++]); - if(NiceCiUtils.lengthKr(tgtString) % repeatLength == 0){ + if(NiceCiUtils.lengthKr(tgtString) > 0 && NiceCiUtils.lengthKr(tgtString) % repeatLength == 0){ int repeat = NiceCiUtils.lengthKr(tgtString) / repeatLength; String finalTgtString = tgtString; List resResults = IntStream.range(0, repeat) @@ -344,6 +344,10 @@ public class NiceCiApiStatusDTO { }) .collect(Collectors.toList()); nr.setNiceCiResults(resResults); + }else{ + if((NiceCiUtils.lengthKr(tgtString) != 0)){ + throw new EnsException(EnsErrCd.INVALID_RESPONSE, "NICE CI 상태(이력) 조회 응답 반복부 전문 오류:: length - " + NiceCiUtils.lengthKr(tgtString)); + } } return nr; } diff --git a/src/main/java/cokr/xit/ens/modules/nice/service/NiceCiStatBulkService.java b/src/main/java/cokr/xit/ens/modules/nice/service/NiceCiStatBulkService.java index 58e2b9e..27b81b5 100644 --- a/src/main/java/cokr/xit/ens/modules/nice/service/NiceCiStatBulkService.java +++ b/src/main/java/cokr/xit/ens/modules/nice/service/NiceCiStatBulkService.java @@ -244,9 +244,9 @@ public class NiceCiStatBulkService { niceCiMapper.insertNiceSmsSndngInquireResponse(resDTO); // API response 반복부 저장 - List results = resDTO.getNiceCiResults(); + List apiResults = resDTO.getNiceCiResults(); List sendResults = new ArrayList<>(); - for (NiceCiApiResult result : results) { + for (NiceCiApiResult result : apiResults) { result.setNiceSmsSndngInqireId(niceSmsInqId); try { NiceCiDTO.SendResult sendResult = niceCiNewTransactionService.findDataIdFromSendResult(result) @@ -269,8 +269,8 @@ public class NiceCiStatBulkService { } } } - if(!results.isEmpty()) niceCiNewTransactionService.insertNiceSmsSndngInquireResponseRepeats(results); - if(!sendResults.isEmpty()) niceCiNewTransactionService.insertSendResults(sendResults); + if(!apiResults.isEmpty()) niceCiNewTransactionService.insertNiceSmsSndngInquireResponseRepeats(apiResults); + if(!sendResults.isEmpty()) niceCiNewTransactionService.insertSendResults(sendResults); //---------------------------------------------------------- // API Call 후처리 END - response & 결과테이블 저장 //----------------------------------------------------------