From 54ad7bfafa8c7bed0d76c3744f2e255c2e1b2880 Mon Sep 17 00:00:00 2001 From: "Jonguk. Lim" Date: Mon, 30 Sep 2024 10:16:32 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20NICE=20CI=20=EC=86=8C=EC=BC=93=20?= =?UTF-8?q?=ED=86=B5=EC=8B=A0=20=EC=B6=94=EA=B0=80=20=20=20=20=20=20=20-?= =?UTF-8?q?=20=EC=A0=84=EB=AC=B8=20=EC=9D=91=EB=8B=B5=20parsing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/support/NiceCiApiService.java | 53 +++++++++++-------- 1 file changed, 32 insertions(+), 21 deletions(-) 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 a6f70be..8fcf3de 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 @@ -89,40 +89,51 @@ public class NiceCiApiService { private String sendNiceCiSocket(final String binTxt) { String rtnMsg = ""; + // FIXME : test rtn message + final String niceCiRes = "0000002310NICEIF 021031896N503P000Z755400 000000010320240919 466241822620240919160011 1013민자도로 관리지원센터에서 김해찬님께 발송한 미납통행료 고지서가 도착했습니다.\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 0442113377 3 18912111020220김해찬 01084289916 0010108428991620240919160011 "; + try (Socket socket = new Socket(HOST, PORT); // 서버에 연결 BufferedWriter out = new BufferedWriter( - new OutputStreamWriter(socket.getOutputStream(), Charset.forName("EUC-KR")));){ + new OutputStreamWriter(socket.getOutputStream(), Charset.forName("EUC-KR"))); //new OutputStreamWriter(socket.getOutputStream())); - //BufferedReader in = new BufferedReader( - // new InputStreamReader(socket.getInputStream(), Charset.forName("EUC-KR")))) { - //InputStreamReader in = new InputStreamReader(socket.getInputStream(), Charset.forName("EUC-KR")){ + BufferedReader in = new BufferedReader( + new InputStreamReader(socket.getInputStream(), Charset.forName("EUC-KR")))) { try { - InputStreamReader in = new InputStreamReader(socket.getInputStream(), Charset.forName("EUC-KR")); socket.setSoTimeout(TIMEOUT); // 읽기 타임아웃 설정 out.write(binTxt); + // FIXME: 테스트 소켓서버 통신을 위해 임시로 추가 : 테스트 완료후 제거 out.write("\nEXIT"); - out.newLine(); - out.flush(); - - StringBuffer sb = new StringBuffer(); - //String message; - //while ((message = in.readLine()) != null) { - // sb.append(message); - //}; + // FIXME: 테스트 소켓서버 통신을 위해 임시로 추가 : 테스트 완료후 제거 - char[] chars = new char[4096]; - //in.read(chars); + out.flush(); - while((in.read(chars) != -1)) { - sb.append(new String(chars)); - } + //StringBuffer sb = new StringBuffer(); + //String rtnMsg = in.readLine(); - rtnMsg = sb.toString(); System.out.println("=============>>>서버 응답(EUC-KR로 읽어온 값)<<<===================================="); - System.out.println(rtnMsg); + System.out.println(niceCiRes); System.out.println("=============>>>서버 응답(EUC-KR로 읽어온 값)<<<===================================="); in.close(); } catch (Exception e) { @@ -136,6 +147,6 @@ public class NiceCiApiService { } catch (IOException e) { throw BizRuntimeException.create(e.getMessage()); } - return rtnMsg; + return niceCiRes; } }