From 55cac28529a121e03db78a705b3bc93b54699923 Mon Sep 17 00:00:00 2001 From: "Jonguk. Lim" Date: Thu, 10 Oct 2024 15:29:47 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20Exception=20=EB=A9=94=EC=84=B8=EC=A7=80?= =?UTF-8?q?=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/nice/model/TestSocketClient.java | 81 ------------------- .../nice/service/NiceCiAcceptService.java | 3 +- .../nice/service/NiceCiSendBulkService.java | 2 +- .../nice/service/NiceCiStatBulkService.java | 6 +- .../service/support/NiceCiApiService.java | 4 +- 5 files changed, 8 insertions(+), 88 deletions(-) delete mode 100644 src/main/java/cokr/xit/ens/modules/nice/model/TestSocketClient.java diff --git a/src/main/java/cokr/xit/ens/modules/nice/model/TestSocketClient.java b/src/main/java/cokr/xit/ens/modules/nice/model/TestSocketClient.java deleted file mode 100644 index 38c9bba..0000000 --- a/src/main/java/cokr/xit/ens/modules/nice/model/TestSocketClient.java +++ /dev/null @@ -1,81 +0,0 @@ -package cokr.xit.ens.modules.nice.model; - -import java.io.*; -import java.net.*; -import java.nio.charset.*; - -public class TestSocketClient { - public static void main(String[] args) { - - final String msg = "0000006438NICEIF 020031895B503 Z755400 000000010320240919 4 誘쇱����濡� 愿�由ъ����쇳�곗���� 源��댁갔��猿� 諛��≫�� 誘몃�⑺�듯��猷� 怨�吏���媛� ��李⑺���듬����.\n" - + "\n" - + "誘쇱����濡� 誘몃�⑺�듯��猷� 怨�吏���\n" - + "\n" - + "�� 李⑤��踰��� : 19��0914\n" - + "�� 誘몃�⑸��� �몄�� : ����-臾몄��\n" - + "�� 誘몃�⑸��� 湲곌� : 2021�� 04�� 12��~2023�� 08�� 30��\n" - + "�� �⑸�湲��� : 819,500��(42嫄�)\n" - + "�� �⑸�湲고�� : 2024��10��01��\n" - + "�� �⑸�諛⑸� : \n" - + "�� ���⑥�� (�⑸���湲�) �대┃\n" - + "�� 媛���怨�醫� �⑸�\n" - + "-(媛���怨�醫�) : �������� 792000-36-986609\n" - + "援�誘쇱���� 731190-72-253083\n" - + "�곕━���� 283752-73-918780\n" - + "�������� 562146-27-470101\n" - + "\n" - + "�� ��由쇳�� ���� �� 醫��닿�吏����� 諛��〓��吏� ���듬����.\n" - + "\n" - + "臾몄��泥� : 044-211-3377 31 1 WL " - + "\n "; - - final String msg2 = "0000006150NICEIF 020031895B503 Z755400 000000010320240919 4 민자도로 관리지원센터에서 김해찬님께 발송한 미납통행료 고지서가 도착했습니다.\n" - + "\n" - + "민자도로 미납통행료 고지서\n" - + "\n" - + "□ 차량번호 : 19너0914\n" - + "□ 미납발생 노선 : 서울-문산\n" - + "□ 미납발생 기간 : 2021년 04월 12일~2023년 08월 30일\n" - + "□ 납부금액 : 819,500원(42건)\n" - + "□ 납부기한 : 2024년10월01일\n" - + "□ 납부방법 : \n" - + "① 하단의 (납부하기) 클릭\n" - + "② 가상계좌 납부\n" - + "-(가상계좌) : 농협은행 792000-36-986609\n" - + "국민은행 731190-72-253083\n" - + "우리은행 283752-73-918780\n" - + "신한은행 562146-27-470101\n" - + "\n" - + "※ 알림톡 수신 시 종이고지서는 발송되지 않습니다.\n" - + "\n" - + "문의처 : 044-211-3377"; - //+ "\nEXIT"; - - try (Socket socket = new Socket("127.0.0.1", 10002); // 서버에 연결 - BufferedWriter out = new BufferedWriter( - new OutputStreamWriter(socket.getOutputStream(), Charset.forName("EUC-KR"))); - //new OutputStreamWriter(socket.getOutputStream())); - BufferedReader in = new BufferedReader( - new InputStreamReader(socket.getInputStream(), Charset.forName("EUC-KR")))) { - - socket.setSoTimeout(2000); - - out.write(msg2); - out.write("\nEXIT"); - out.newLine(); - out.flush(); - - // 서버로부터 응답 받기 (EUC-KR -> UTF-8 변환) - String rtnMsg; - //String responseUTF8 = new String(response.getBytes(Charset.forName("EUC-KR")), StandardCharsets.UTF_8); - //String responseUTF8 = new String(response.getBytes()); - - rtnMsg = in.readLine(); - System.out.println("=============>>>서버 응답 (EUC-KR로 읽어온 값)<<<===================================="); - System.out.println(rtnMsg); - System.out.println("=============>>>서버 응답 (EUC-KR로 읽어온 값)<<<===================================="); - } catch (IOException e) { - e.printStackTrace(); - } - } -} 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 700ee53..b7fea2b 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 @@ -2,6 +2,7 @@ package cokr.xit.ens.modules.nice.service; import java.util.*; +import org.apache.commons.lang3.*; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.*; import org.springframework.stereotype.*; @@ -185,7 +186,7 @@ public class NiceCiAcceptService { } catch (Exception e){ xit.setPrcsCd(IupPrcsCd.TGRF.getCode()); - xit.setErrMsg(e.getMessage()); + xit.setErrMsg(ObjectUtils.isNotEmpty(e.getCause())? e.getCause().getMessage() : e.getMessage()); niceCiMapper.updatePrcsCdAndErrorOfInputXit(xit); } } diff --git a/src/main/java/cokr/xit/ens/modules/nice/service/NiceCiSendBulkService.java b/src/main/java/cokr/xit/ens/modules/nice/service/NiceCiSendBulkService.java index 2b39626..a90372a 100644 --- a/src/main/java/cokr/xit/ens/modules/nice/service/NiceCiSendBulkService.java +++ b/src/main/java/cokr/xit/ens/modules/nice/service/NiceCiSendBulkService.java @@ -167,7 +167,7 @@ public class NiceCiSendBulkService { } catch (Exception e){ xit.setPrcsCd(IupPrcsCd.FAIL.getCode()); - xit.setErrMsg(e.getMessage()); + xit.setErrMsg(ObjectUtils.isNotEmpty(e.getCause())? e.getCause().getMessage() : e.getMessage()); niceCiMapper.updatePrcsCdAndErrorOfInputXit(xit); } } 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 2078b9d..6c59581 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 @@ -109,10 +109,10 @@ public class NiceCiStatBulkService { .build(); } catch (Exception e) { - log.error("NICE CI Status 조회 ERROR::{}", e.getMessage()); + log.error("NICE CI Status 조회 ERROR::{}", ObjectUtils.isNotEmpty(e.getCause())? e.getCause().getMessage() : e.getMessage()); return EnsResponseVO.errBuilder() .errCode(EnsErrCd.ERR999) - .errMsg(e.getMessage()) + .errMsg(ObjectUtils.isNotEmpty(e.getCause())? e.getCause().getMessage() : e.getMessage()) .build(); } return EnsResponseVO.okBuilder() @@ -259,7 +259,7 @@ public class NiceCiStatBulkService { EnsException ens = (EnsException)e; log.error("NICE CI Status 조회 ERROR::{}[{}]", ens.getMessage(), ens.getErrCd()); } else { - log.error("NICE CI Status 조회 ERROR::{}", e.getMessage()); + log.error("NICE CI Status 조회 ERROR::{}", ObjectUtils.isNotEmpty(e.getCause())? e.getCause().getMessage() : e.getMessage()); } } } diff --git a/src/main/java/cokr/xit/ens/modules/nice/service/support/NiceCiApiService.java b/src/main/java/cokr/xit/ens/modules/nice/service/support/NiceCiApiService.java index 23516af..a1066d9 100644 --- a/src/main/java/cokr/xit/ens/modules/nice/service/support/NiceCiApiService.java +++ b/src/main/java/cokr/xit/ens/modules/nice/service/support/NiceCiApiService.java @@ -162,8 +162,8 @@ public class NiceCiApiService { throw new EnsException(EnsErrCd.API_COMM_ERROR, "NICE CI Socket 서버 응답 시간 초과"); } catch (IOException e) { - log.error("NICE CI Socket 서버 응답 시간 초과: " + e.getMessage()); - throw new EnsException(EnsErrCd.API_COMM_ERROR, e.getMessage()); + log.error("NICE CI Socket 서버 ERROR :: {}", ObjectUtils.isNotEmpty(e.getCause())? e.getCause().getMessage() : e.getMessage()); + throw new EnsException(EnsErrCd.API_COMM_ERROR, ObjectUtils.isNotEmpty(e.getCause())? e.getCause().getMessage() : e.getMessage()); } return rtnMsg; }