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 & 결과테이블 저장 //----------------------------------------------------------