diff --git a/axhub-common/src/main/java/io/shinhanlife/glow/util/GlowTrgmParser.java b/axhub-common/src/main/java/io/shinhanlife/glow/util/GlowTrgmParser.java new file mode 100644 index 0000000..247b4b1 --- /dev/null +++ b/axhub-common/src/main/java/io/shinhanlife/glow/util/GlowTrgmParser.java @@ -0,0 +1,92 @@ +package io.shinhanlife.glow.util; + +import io.shinhanlife.glow.GlowTrgmField; +import lombok.extern.slf4j.Slf4j; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; + +/** + * @package io.shinhanlife.glow.util + * @className GlowTrgmParser + * @description AX HUB 시스템 처리 클래스 + * @author 김형식 + * @create 2026.09.01 + *
+ * ---------- 개정이력 ---------- + * 수정일 수정자 수정내용 + * ---------- -------- --------------------------- + * 2026.09.01 김형식 최초생성 + * + *+ */ +@Slf4j +public class GlowTrgmParser { + + /** + * 고정 길이 문자열 전문을 @GlowTrgmField 어노테이션 정보에 따라 DTO 객체로 파싱합니다. + * @param trgmString 원본 전문 문자열 + * @param clazz 매핑할 DTO 클래스 + * @return 파싱된 DTO 인스턴스 + */ + public static
+ * ---------- 개정이력 ---------- + * 수정일 수정자 수정내용 + * ---------- -------- --------------------------- + * 2026.09.01 김형식 최초생성 + * + *+ */ +@Slf4j +@Service("mciStringEimsSender") +public class MciStringEimsSender implements EimsSender { + + private final RestClient restClient; + private final String mciUrl; + + public MciStringEimsSender(@Value("${eims.mci.url}") String mciUrl) { + this.mciUrl = mciUrl; + this.restClient = RestClient.create(); + } + + @Override + public String send(String interfaceId, String payload) throws Exception { + StopWatch stopWatch = new StopWatch(); stopWatch.start(); + + try { + log.info("🌐 [ESB 어댑터(String)] 전송 준비 완료 - RestClient 호출 시작 (Interface: {})", interfaceId); + + String response = restClient.post() + .uri(mciUrl) + .contentType(MediaType.TEXT_PLAIN) + .body(payload != null ? payload : "") + .retrieve() + .body(String.class); + + log.info("🌐 [ESB 어댑터(String)] 응답 수신 완료: {}", response); + return response != null ? response : ""; + + } finally { + stopWatch.stop(); + log.info("📊 [SLA 모니터링 - MCI(String)] 소요시간: {} ms", stopWatch.getTotalTimeMillis()); + } + } +} diff --git a/axhub-tool-other/src/main/java/io/shinhanlife/axhub/biz/mcp/tool/dto/SampleStringReq.java b/axhub-tool-other/src/main/java/io/shinhanlife/axhub/biz/mcp/tool/dto/SampleStringReq.java new file mode 100644 index 0000000..49d49cf --- /dev/null +++ b/axhub-tool-other/src/main/java/io/shinhanlife/axhub/biz/mcp/tool/dto/SampleStringReq.java @@ -0,0 +1,24 @@ +package io.shinhanlife.axhub.biz.mcp.tool.dto; + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +/** + * @package io.shinhanlife.axhub.biz.mcp.tool.dto + * @className SampleStringReq + * @description AX HUB 시스템 처리 클래스 + * @author 김형식 + * @create 2026.09.01 + *
+ * ---------- 개정이력 ---------- + * 수정일 수정자 수정내용 + * ---------- -------- --------------------------- + * 2026.09.01 김형식 최초생성 + * + *+ */ +@Data +@JsonInclude(JsonInclude.Include.NON_NULL) +public class SampleStringReq { + private String query; +} diff --git a/axhub-tool-other/src/main/java/io/shinhanlife/axhub/biz/mcp/tool/dto/SampleStringRes.java b/axhub-tool-other/src/main/java/io/shinhanlife/axhub/biz/mcp/tool/dto/SampleStringRes.java new file mode 100644 index 0000000..0656cf1 --- /dev/null +++ b/axhub-tool-other/src/main/java/io/shinhanlife/axhub/biz/mcp/tool/dto/SampleStringRes.java @@ -0,0 +1,35 @@ +package io.shinhanlife.axhub.biz.mcp.tool.dto; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.shinhanlife.glow.GlowTrgmField; +import lombok.Data; + +/** + * @package io.shinhanlife.axhub.biz.mcp.tool.dto + * @className SampleStringRes + * @description AX HUB 시스템 처리 클래스 + * @author 김형식 + * @create 2026.09.01 + *
+ * ---------- 개정이력 ---------- + * 수정일 수정자 수정내용 + * ---------- -------- --------------------------- + * 2026.09.01 김형식 최초생성 + * + *+ */ +@Data +@JsonInclude(JsonInclude.Include.NON_NULL) +public class SampleStringRes { + @GlowTrgmField(order = 1, length = 10, description = "이름") + private String name; + + @GlowTrgmField(order = 2, length = 3, description = "나이") + private int age; + + @GlowTrgmField(order = 3, length = 8, description = "가입일자(YYYYMMDD)") + private String joinDate; + + @GlowTrgmField(order = 4, length = 2, description = "상태코드") + private String statusCode; +} diff --git a/axhub-tool-other/src/main/java/io/shinhanlife/axhub/biz/mcp/tool/service/SampleStringToolService.java b/axhub-tool-other/src/main/java/io/shinhanlife/axhub/biz/mcp/tool/service/SampleStringToolService.java new file mode 100644 index 0000000..26c42d9 --- /dev/null +++ b/axhub-tool-other/src/main/java/io/shinhanlife/axhub/biz/mcp/tool/service/SampleStringToolService.java @@ -0,0 +1,50 @@ +package io.shinhanlife.axhub.biz.mcp.tool.service; + +import io.shinhanlife.axhub.biz.mcp.tool.annotation.McpFunction; +import io.shinhanlife.axhub.biz.mcp.tool.annotation.McpTool; +import io.shinhanlife.axhub.biz.mcp.tool.dto.SampleStringReq; +import io.shinhanlife.axhub.biz.mcp.tool.dto.SampleStringRes; +import io.shinhanlife.glow.util.GlowTrgmParser; +import org.springframework.stereotype.Service; + +/** + * @package io.shinhanlife.axhub.biz.mcp.tool.service + * @className SampleStringToolService + * @description AX HUB 시스템 처리 클래스 + * @author 김형식 + * @create 2026.09.01 + *
+ * ---------- 개정이력 ---------- + * 수정일 수정자 수정내용 + * ---------- -------- --------------------------- + * 2026.09.01 김형식 최초생성 + * + *+ */ +@Service +@McpTool( + routingType = "MCI_STRING", + group = "COMMON" +) +public class SampleStringToolService extends AbstractMcpToolService { + + @McpFunction( + name = "get_sample_string", + description = "MCI String 버전과 GlowTrgmField 파싱을 테스트하는 샘플 툴입니다.", + prompt = "MCI 전문(String) 연계 및 고정 길이 파싱 테스트 해줘.", + mappingId = "TRGM_001" + ) + public Object execute(SampleStringReq req) { + // 1. EIMS(Legacy)를 통해 원본 고정 길이 문자열을 받아옵니다. + java.util.Map