feat: NICE CI 전문 처리 반영

테스트를 위한 소켓 통신모듈 추가
dev
Jonguk. Lim 2 months ago
parent 4007291d3f
commit 3f0b367fd4

@ -520,6 +520,20 @@ public class DateUtil {
return LocalDateTime.parse(target); return LocalDateTime.parse(target);
} }
/**
* <pre>
* microsecond
* yyyyMMddHHmmssSSSSSSS
* <pre>
* @return String yyyyMMddHHmmssSSSSSSS
*/
public static String getNowTimeMicrosecond() {
ZonedDateTime now = ZonedDateTime.now(ZoneId.of("Asia/Seoul"));
// 6자리 나노초까지 포함된 포맷 지정
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSSSSSS");
return now.format(formatter);
}
/** /**
* <pre> * <pre>
* *
@ -590,5 +604,6 @@ public class DateUtil {
System.out.println(getAddDayT("2024-10-30T23:59:59", 1)); System.out.println(getAddDayT("2024-10-30T23:59:59", 1));
System.out.println(isAfterLocalDateTimeT("2024-10-30T23:59:59", "2024-10-30T23:59:58")); System.out.println(isAfterLocalDateTimeT("2024-10-30T23:59:59", "2024-10-30T23:59:58"));
System.out.println(isAfterLocalDateTimeT("2024-10-31T23:59:59", "2024-10-30T23:59:58")); System.out.println(isAfterLocalDateTimeT("2024-10-31T23:59:59", "2024-10-30T23:59:58"));
System.out.println(getNowTimeMicrosecond());
} }
} }

File diff suppressed because one or more lines are too long

@ -0,0 +1,65 @@
package cokr.xit.ens.modules.nice.model;
import java.io.*;
import java.net.*;
import java.nio.charset.*;
import org.apache.commons.lang.*;
public class Server {
public static void main(String[] args) {
try (ServerSocket serverSocket = new ServerSocket(12345)) { // 포트 12345에서 서버 소켓 열기
System.out.println("서버가 시작되었습니다.");
while (true) {
Socket clientSocket = serverSocket.accept(); // 클라이언트 연결 수락
new Thread(() -> handleClient(clientSocket)).start(); // 새로운 스레드에서 클라이언트 처리
}
} catch (IOException e) {
e.printStackTrace();
}
}
private static void handleClient(Socket clientSocket) {
final String res = "trCode " +
// NiceCommon
"NICEIF 020031895B503rsltorgId orgMngNo orgSndDt niceMngNo niceSndDt" +
" "+
// 개별응답부
"241~~~~~~~~~~~~~~~~~~~~~~~ 010 1 "+
// 응답반복부
"18401011449211name2 001 "+
"19412341234567이름2 1 ";
try (BufferedReader in = new BufferedReader(
new InputStreamReader(clientSocket.getInputStream(), Charset.forName("EUC-KR")));
BufferedWriter out = new BufferedWriter(
new OutputStreamWriter(clientSocket.getOutputStream(), Charset.forName("EUC-KR")))) {
// 클라이언트로부터 메시지 읽기
String message;
StringBuffer sb = new StringBuffer();
while((message = in.readLine()) != null && !(message.length() >= 10 && StringUtils.isEmpty(message.trim()))) { // 빈 줄이 들어올 때까지 읽기
sb.append(message);
};
System.out.println("=============>>>클라이언트로부터 받은 메시지<<<====================================");
System.out.println(sb.toString());
System.out.println("=============>>>클라이언트로부터 받은 메시지<<<====================================");
// 응답 메시지 작성 및 전송
out.write(res);
out.newLine();
out.flush();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
clientSocket.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}

@ -133,3 +133,12 @@ contract:
bulksend: /api/msg/send bulksend: /api/msg/send
bulksend-batch-unit: 100 bulksend-batch-unit: 100
read: /api/msg/read read: /api/msg/read
niceCi:
ip: 10.1.1.55
port: 10002
orgId: Z755400
# 개발
clientId: 0027370001
# 운영
#clientId: 0027370002

Loading…
Cancel
Save