fix: nice ci 전문 처리 fix

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

@ -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<NiceCiApiResult> 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;
}

@ -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<NiceCiApiResult> 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;
}

@ -244,9 +244,9 @@ public class NiceCiStatBulkService {
niceCiMapper.insertNiceSmsSndngInquireResponse(resDTO);
// API response 반복부 저장
List<NiceCiApiResult> results = resDTO.getNiceCiResults();
List<NiceCiApiResult> apiResults = resDTO.getNiceCiResults();
List<NiceCiDTO.SendResult> 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 & 결과테이블 저장
//----------------------------------------------------------

Loading…
Cancel
Save