fix: resolve Format specifier '%s' error in ToolScaffolder and generate SearchHr tool
This commit is contained in:
@@ -324,6 +324,7 @@ public class ToolScaffolder {
|
|||||||
createDate, author,
|
createDate, author,
|
||||||
routingType, group.toLowerCase(),
|
routingType, group.toLowerCase(),
|
||||||
baseName,
|
baseName,
|
||||||
|
baseName, baseName,
|
||||||
baseName, toolName, description, description + " 해줘.", interfaceId, register,
|
baseName, toolName, description, description + " 해줘.", interfaceId, register,
|
||||||
baseName,
|
baseName,
|
||||||
baseName,
|
baseName,
|
||||||
@@ -438,7 +439,7 @@ public class ToolScaffolder {
|
|||||||
BASE_PACKAGE, baseName,
|
BASE_PACKAGE, baseName,
|
||||||
BASE_PACKAGE, baseName,
|
BASE_PACKAGE, baseName,
|
||||||
BASE_PACKAGE, baseName, author, createDate, createDate, author,
|
BASE_PACKAGE, baseName, author, createDate, createDate, author,
|
||||||
baseName, baseName, baseName, baseName, baseName, baseName
|
baseName, baseName, baseName, baseName, baseName, baseName, baseName
|
||||||
);
|
);
|
||||||
Files.writeString(converterDir.resolve(baseName + "LegacyConverter.java"), converterContent);
|
Files.writeString(converterDir.resolve(baseName + "LegacyConverter.java"), converterContent);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package io.shinhanlife.dap.mcc.converter;
|
||||||
|
|
||||||
|
import io.shinhanlife.dap.mcc.dto.SearchHrReq;
|
||||||
|
import io.shinhanlife.dap.mcc.dto.SearchHrRes;
|
||||||
|
import io.shinhanlife.dap.mcc.legacy.SearchHrLegacyReq;
|
||||||
|
import io.shinhanlife.dap.mcc.legacy.SearchHrLegacyRes;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.Mapping;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package io.shinhanlife.dap.mcc.converter
|
||||||
|
* @className SearchHrLegacyConverter
|
||||||
|
* @description AX HUB 시스템 처리 클래스
|
||||||
|
* @author user
|
||||||
|
* @create 2026.07.22
|
||||||
|
* <pre>
|
||||||
|
* ---------- 개정이력 ----------
|
||||||
|
* 수정일 수정자 수정내용
|
||||||
|
* ---------- -------- ---------------------------
|
||||||
|
* 2026.07.22 user 최초생성
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
@Mapper(componentModel = "spring")
|
||||||
|
public interface SearchHrLegacyConverter {
|
||||||
|
|
||||||
|
@Mapping(source = "phoneNumber", target = "phone")
|
||||||
|
@Mapping(source = "message", target = "content")
|
||||||
|
SearchHrLegacyReq toLegacyReq(SearchHrReq req);
|
||||||
|
|
||||||
|
@Mapping(source = "phone", target = "phoneNumber")
|
||||||
|
@Mapping(source = "content", target = "message")
|
||||||
|
SearchHrReq toReq(SearchHrLegacyReq legacyReq);
|
||||||
|
|
||||||
|
// SearchHrRes toRes(SearchHrLegacyRes legacyRes);
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package io.shinhanlife.dap.mcc.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import io.shinhanlife.dap.mcc.annotation.McpParameter;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package io.shinhanlife.dap.mcc.dto
|
||||||
|
* @className SearchHrReq
|
||||||
|
* @description AX HUB 시스템 처리 클래스
|
||||||
|
* @author user
|
||||||
|
* @create 2026.07.22
|
||||||
|
* <pre>
|
||||||
|
* ---------- 개정이력 ----------
|
||||||
|
* 수정일 수정자 수정내용
|
||||||
|
* ---------- -------- ---------------------------
|
||||||
|
* 2026.07.22 user 최초생성
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
public class SearchHrReq {
|
||||||
|
@McpParameter(description = "수신자 전화번호", required = true)
|
||||||
|
private String phoneNumber;
|
||||||
|
|
||||||
|
@McpParameter(description = "전송할 메시지 내용", required = true)
|
||||||
|
private String message;
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package io.shinhanlife.dap.mcc.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package io.shinhanlife.dap.mcc.dto
|
||||||
|
* @className SearchHrRes
|
||||||
|
* @description AX HUB 시스템 처리 클래스
|
||||||
|
* @author user
|
||||||
|
* @create 2026.07.22
|
||||||
|
* <pre>
|
||||||
|
* ---------- 개정이력 ----------
|
||||||
|
* 수정일 수정자 수정내용
|
||||||
|
* ---------- -------- ---------------------------
|
||||||
|
* 2026.07.22 user 최초생성
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
public class SearchHrRes {
|
||||||
|
private String status;
|
||||||
|
private String message;
|
||||||
|
// TODO: Add response fields here
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package io.shinhanlife.dap.mcc.legacy;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package io.shinhanlife.dap.mcc.legacy
|
||||||
|
* @className SearchHrLegacyReq
|
||||||
|
* @description AX HUB 시스템 처리 클래스
|
||||||
|
* @author user
|
||||||
|
* @create 2026.07.22
|
||||||
|
* <pre>
|
||||||
|
* ---------- 개정이력 ----------
|
||||||
|
* 수정일 수정자 수정내용
|
||||||
|
* ---------- -------- ---------------------------
|
||||||
|
* 2026.07.22 user 최초생성
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SearchHrLegacyReq {
|
||||||
|
/**
|
||||||
|
* EAI 시스템이 요구하는 수신자 번호 파라미터명
|
||||||
|
*/
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EAI 시스템이 요구하는 메시지 내용 파라미터명
|
||||||
|
*/
|
||||||
|
private String content;
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package io.shinhanlife.dap.mcc.legacy;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package io.shinhanlife.dap.mcc.legacy
|
||||||
|
* @className SearchHrLegacyRes
|
||||||
|
* @description AX HUB 시스템 처리 클래스
|
||||||
|
* @author user
|
||||||
|
* @create 2026.07.22
|
||||||
|
* <pre>
|
||||||
|
* ---------- 개정이력 ----------
|
||||||
|
* 수정일 수정자 수정내용
|
||||||
|
* ---------- -------- ---------------------------
|
||||||
|
* 2026.07.22 user 최초생성
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SearchHrLegacyRes {
|
||||||
|
// TODO: Add legacy response fields here
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
package io.shinhanlife.dap.mcc.service;
|
||||||
|
|
||||||
|
import io.shinhanlife.dap.mcc.annotation.McpFunction;
|
||||||
|
import io.shinhanlife.dap.mcc.annotation.McpTool;
|
||||||
|
import io.shinhanlife.dap.mcc.dto.SearchHrReq;
|
||||||
|
import io.shinhanlife.dap.mcc.dto.SearchHrRes;
|
||||||
|
import io.shinhanlife.dap.common.integration.mci.component.AxhubMciComponent;
|
||||||
|
import io.shinhanlife.glow.communication.dto.Transfer;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
import io.shinhanlife.dap.mcc.converter.SearchHrLegacyConverter;
|
||||||
|
import io.shinhanlife.dap.mcc.legacy.SearchHrLegacyReq;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package io.shinhanlife.dap.mcc.service
|
||||||
|
* @className SearchHrService
|
||||||
|
* @description AX HUB 시스템 처리 클래스
|
||||||
|
* @author user
|
||||||
|
* @create 2026.07.22
|
||||||
|
* <pre>
|
||||||
|
* ---------- 개정이력 ----------
|
||||||
|
* 수정일 수정자 수정내용
|
||||||
|
* ---------- -------- ---------------------------
|
||||||
|
* 2026.07.22 user 최초생성
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@McpTool(
|
||||||
|
routingType = "MCI",
|
||||||
|
categoryKey = "hr"
|
||||||
|
)
|
||||||
|
public class SearchHrService {
|
||||||
|
|
||||||
|
private final AxhubMciComponent mci;
|
||||||
|
private final SearchHrLegacyConverter converter = Mappers.getMapper(SearchHrLegacyConverter.class);
|
||||||
|
|
||||||
|
@McpFunction(
|
||||||
|
displayName = "SearchHr 툴",
|
||||||
|
name = "searchHr",
|
||||||
|
description = "hr 조회",
|
||||||
|
prompt = "hr 조회 해줘.",
|
||||||
|
mappingId = "HR_001",
|
||||||
|
register = true,
|
||||||
|
requiresApproval = false,
|
||||||
|
openWorldHint = true
|
||||||
|
)
|
||||||
|
public Object execute(SearchHrReq req) {
|
||||||
|
log.info("[MCI Tool] {} 요청 수신.", "SearchHr");
|
||||||
|
try {
|
||||||
|
// MapStruct를 이용한 자동 매핑 (AI DTO -> MCI DTO)
|
||||||
|
SearchHrLegacyReq legacyReq = converter.toLegacyReq(req);
|
||||||
|
|
||||||
|
Transfer<Object> resTransfer = mci.callTo(
|
||||||
|
"HR_001",
|
||||||
|
null,
|
||||||
|
legacyReq,
|
||||||
|
Object.class
|
||||||
|
);
|
||||||
|
return resTransfer.getBody() != null ? resTransfer.getBody() : Map.of("status", "SUCCESS");
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("[MCI Tool] 연동 중 오류 발생: {}", e.getMessage(), e);
|
||||||
|
return Map.of("status", "ERROR", "message", e.getMessage() != null ? e.getMessage() : "Unknown error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user