fix: nice ci 전문 처리 fix

응답 반복부가 없을 경우에 대한 처리 추가
dev
Jonguk. Lim 4 weeks ago
parent 221c652786
commit a68c0c356c

@ -383,7 +383,7 @@ public class NiceCiApiSendDTO {
84, // 공란 84, // 공란
}; };
if (StringUtils.isNotBlank(tgtString) && NiceCiUtils.lengthKr(tgtString) >= 2310) { if (StringUtils.isNotBlank(tgtString) && NiceCiUtils.lengthKr(tgtString) >= 2210) {
Response response = new Response(); Response response = new Response();
int idx = 0; int idx = 0;
response.setTrnscId(StringUtils.left(tgtString, parseLength[idx])); response.setTrnscId(StringUtils.left(tgtString, parseLength[idx]));
@ -410,7 +410,7 @@ public class NiceCiApiSendDTO {
response.setIndvdlzRspnsBlnk(StringUtils.left(tgtString, parseLength[idx])); response.setIndvdlzRspnsBlnk(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(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; int repeat = NiceCiUtils.lengthKr(tgtString) / repeatLength;
String finalTgtString = tgtString; String finalTgtString = tgtString;
List<NiceCiApiResult> resResults = IntStream.range(0, repeat) List<NiceCiApiResult> resResults = IntStream.range(0, repeat)
@ -420,6 +420,10 @@ public class NiceCiApiSendDTO {
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
response.setNiceCiResults(resResults); response.setNiceCiResults(resResults);
}else{
if((NiceCiUtils.lengthKr(tgtString) != 0)){
throw new EnsException(EnsErrCd.INVALID_RESPONSE, "NICE CI 송신 응답 반복부 전문 오류:: length - " + NiceCiUtils.lengthKr(tgtString));
}
} }
return response; return response;
} }

@ -316,7 +316,7 @@ public class NiceCiApiStatusDTO {
// FIXME: 인코딩확인후 필요시 사용 // FIXME: 인코딩확인후 필요시 사용
//String tgtString = new String(tgtStr.getBytes(), StandardCharsets.UTF_8); //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(); Response nr = new Response();
int idx = 0; int idx = 0;
nr.setTrnscId(StringUtils.left(tgtString, parseLength[idx])); nr.setTrnscId(StringUtils.left(tgtString, parseLength[idx]));
@ -334,7 +334,7 @@ public class NiceCiApiStatusDTO {
nr.setRspnsCo(StringUtils.left(tgtString, parseLength[idx])); nr.setRspnsCo(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(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; int repeat = NiceCiUtils.lengthKr(tgtString) / repeatLength;
String finalTgtString = tgtString; String finalTgtString = tgtString;
List<NiceCiApiResult> resResults = IntStream.range(0, repeat) List<NiceCiApiResult> resResults = IntStream.range(0, repeat)
@ -344,6 +344,10 @@ public class NiceCiApiStatusDTO {
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
nr.setNiceCiResults(resResults); nr.setNiceCiResults(resResults);
}else{
if((NiceCiUtils.lengthKr(tgtString) != 0)){
throw new EnsException(EnsErrCd.INVALID_RESPONSE, "NICE CI 상태(이력) 조회 응답 반복부 전문 오류:: length - " + NiceCiUtils.lengthKr(tgtString));
}
} }
return nr; return nr;
} }

@ -244,9 +244,9 @@ public class NiceCiStatBulkService {
niceCiMapper.insertNiceSmsSndngInquireResponse(resDTO); niceCiMapper.insertNiceSmsSndngInquireResponse(resDTO);
// API response 반복부 저장 // API response 반복부 저장
List<NiceCiApiResult> results = resDTO.getNiceCiResults(); List<NiceCiApiResult> apiResults = resDTO.getNiceCiResults();
List<NiceCiDTO.SendResult> sendResults = new ArrayList<>(); List<NiceCiDTO.SendResult> sendResults = new ArrayList<>();
for (NiceCiApiResult result : results) { for (NiceCiApiResult result : apiResults) {
result.setNiceSmsSndngInqireId(niceSmsInqId); result.setNiceSmsSndngInqireId(niceSmsInqId);
try { try {
NiceCiDTO.SendResult sendResult = niceCiNewTransactionService.findDataIdFromSendResult(result) NiceCiDTO.SendResult sendResult = niceCiNewTransactionService.findDataIdFromSendResult(result)
@ -269,7 +269,7 @@ public class NiceCiStatBulkService {
} }
} }
} }
if(!results.isEmpty()) niceCiNewTransactionService.insertNiceSmsSndngInquireResponseRepeats(results); if(!apiResults.isEmpty()) niceCiNewTransactionService.insertNiceSmsSndngInquireResponseRepeats(apiResults);
if(!sendResults.isEmpty()) niceCiNewTransactionService.insertSendResults(sendResults); if(!sendResults.isEmpty()) niceCiNewTransactionService.insertSendResults(sendResults);
//---------------------------------------------------------- //----------------------------------------------------------
// API Call 후처리 END - response & 결과테이블 저장 // API Call 후처리 END - response & 결과테이블 저장

Loading…
Cancel
Save