refactor: apply Legacy naming convention to Sms and Sample converters and DTOs

This commit is contained in:
jade
2026-07-13 17:45:25 +09:00
parent c8fef29fcd
commit d24c95a2df
5 changed files with 16 additions and 16 deletions

View File

@@ -1,16 +1,16 @@
package io.shinhanlife.axhub.biz.mcp.sample.converter; package io.shinhanlife.axhub.biz.mcp.sample.converter;
import io.shinhanlife.axhub.biz.mcp.sample.dto.SampleAiReqDto; import io.shinhanlife.axhub.biz.mcp.sample.dto.SampleAiReqDto;
import io.shinhanlife.axhub.biz.mcp.sample.dto.SampleMciReqDto; import io.shinhanlife.axhub.biz.mcp.sample.dto.SampleLegacyReqDto;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.Mapping; import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
@Mapper(componentModel = "spring") @Mapper(componentModel = "spring")
public interface SampleMciConverter { public interface SampleLegacyConverter {
// 테스트 환경 등에서 Spring Bean 주입 없이 직접 접근하기 위한 INSTANCE 제공 (IDE 에러 방지용) // 테스트 환경 등에서 Spring Bean 주입 없이 직접 접근하기 위한 INSTANCE 제공 (IDE 에러 방지용)
SampleMciConverter INSTANCE = Mappers.getMapper(SampleMciConverter.class); SampleLegacyConverter INSTANCE = Mappers.getMapper(SampleLegacyConverter.class);
/** /**
* AI Agent의 DTO를 MCI 통신용 DTO로 변환합니다. * AI Agent의 DTO를 MCI 통신용 DTO로 변환합니다.
@@ -19,5 +19,5 @@ public interface SampleMciConverter {
@Mapping(source = "userId", target = "customerId") @Mapping(source = "userId", target = "customerId")
@Mapping(source = "actionType", target = "interfaceId") @Mapping(source = "actionType", target = "interfaceId")
@Mapping(source = "extraInfo", target = "requestDetails") @Mapping(source = "extraInfo", target = "requestDetails")
SampleMciReqDto toMciReq(SampleAiReqDto aiReq); SampleLegacyReqDto toLegacyReq(SampleAiReqDto aiReq);
} }

View File

@@ -26,7 +26,7 @@ import lombok.ToString;
@ToString @ToString
@NoArgsConstructor(access = AccessLevel.PROTECTED) @NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor @AllArgsConstructor
public class SampleMciReqDto { public class SampleLegacyReqDto {
/** /**
* MCI 인터페이스 ID (: MCI0001) * MCI 인터페이스 ID (: MCI0001)

View File

@@ -1,17 +1,17 @@
package io.shinhanlife.axhub.biz.mcp.sample.converter; package io.shinhanlife.axhub.biz.mcp.sample.converter;
import io.shinhanlife.axhub.biz.mcp.sample.dto.SampleAiReqDto; import io.shinhanlife.axhub.biz.mcp.sample.dto.SampleAiReqDto;
import io.shinhanlife.axhub.biz.mcp.sample.dto.SampleMciReqDto; import io.shinhanlife.axhub.biz.mcp.sample.dto.SampleLegacyReqDto;
import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
public class SampleMciConverterTest { public class SampleLegacyConverterTest {
// MapStruct가 자동 생성한 구현체를 가져와서 테스트합니다. (IDE 에러 방지를 위해 INSTANCE 참조) // MapStruct가 자동 생성한 구현체를 가져와서 테스트합니다. (IDE 에러 방지를 위해 INSTANCE 참조)
private final SampleMciConverter sampleMciConverter = SampleMciConverter.INSTANCE; private final SampleLegacyConverter sampleLegacyConverter = SampleLegacyConverter.INSTANCE;
@Test @Test
@DisplayName("AI 파라미터 DTO가 MCI DTO로 정확히 매핑되는지 테스트") @DisplayName("AI 파라미터 DTO가 MCI DTO로 정확히 매핑되는지 테스트")
@@ -24,12 +24,12 @@ public class SampleMciConverterTest {
.build(); .build();
// when: MapStruct 자동 생성 매퍼를 통해 1줄로 변환 // when: MapStruct 자동 생성 매퍼를 통해 1줄로 변환
SampleMciReqDto mciDto = sampleMciConverter.toMciReq(aiDto); SampleLegacyReqDto mciDto = sampleLegacyConverter.toLegacyReq(aiDto);
// then: 콘솔에 결과 출력 검증 // then: 콘솔에 결과 출력 검증
System.out.println("====== MapStruct 변환 테스트 결과 ======"); System.out.println("====== MapStruct 변환 테스트 결과 ======");
System.out.println(" [변환 전] AI DTO : " + aiDto); System.out.println(" [변환 전] AI DTO : " + aiDto);
System.out.println(" [변환 후] MCI DTO: " + mciDto); System.out.println(" [변환 후] Legacy DTO: " + mciDto);
System.out.println("==============================================="); System.out.println("===============================================");
assertNotNull(mciDto, "변환된 객체는 null이 아니어야 합니다."); assertNotNull(mciDto, "변환된 객체는 null이 아니어야 합니다.");

View File

@@ -7,11 +7,11 @@ import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
@Mapper(componentModel = "spring") @Mapper(componentModel = "spring")
public interface SmsMciConverter { public interface SmsLegacyConverter {
SmsMciConverter INSTANCE = Mappers.getMapper(SmsMciConverter.class); SmsLegacyConverter INSTANCE = Mappers.getMapper(SmsLegacyConverter.class);
@Mapping(source = "phoneNumber", target = "phone") @Mapping(source = "phoneNumber", target = "phone")
@Mapping(source = "message", target = "content") @Mapping(source = "message", target = "content")
SmsLegacyReqDto toMciReq(SmsSendReq req); SmsLegacyReqDto toLegacyReq(SmsSendReq req);
} }

View File

@@ -4,7 +4,7 @@ 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.annotation.McpTool;
import io.shinhanlife.axhub.biz.mcp.tool.dto.SmsSendReq; import io.shinhanlife.axhub.biz.mcp.tool.dto.SmsSendReq;
import io.shinhanlife.axhub.biz.mcp.tool.service.AbstractMcpToolService; import io.shinhanlife.axhub.biz.mcp.tool.service.AbstractMcpToolService;
import io.shinhanlife.axhub.biz.mcp.tool.sms.converter.SmsMciConverter; import io.shinhanlife.axhub.biz.mcp.tool.sms.converter.SmsLegacyConverter;
import io.shinhanlife.axhub.biz.mcp.tool.sms.dto.SmsLegacyReqDto; import io.shinhanlife.axhub.biz.mcp.tool.sms.dto.SmsLegacyReqDto;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@@ -33,10 +33,10 @@ public class SmsToolService extends AbstractMcpToolService {
log.info("[SMS] SMS 발송 요청 수신. 수신자: {}", req.getPhoneNumber()); log.info("[SMS] SMS 발송 요청 수신. 수신자: {}", req.getPhoneNumber());
// MapStruct를 이용한 자동 매핑 (AI DTO -> MCI DTO) // MapStruct를 이용한 자동 매핑 (AI DTO -> MCI DTO)
SmsLegacyReqDto mciReq = SmsMciConverter.INSTANCE.toMciReq(req); SmsLegacyReqDto legacyReq = SmsLegacyConverter.INSTANCE.toLegacyReq(req);
// 레거시 시스템 연동 (EAI) - DTO 객체를 그대로 넘김 // 레거시 시스템 연동 (EAI) - DTO 객체를 그대로 넘김
Map<String, Object> result = executeLegacy("EAI", "SMS_SEND_001", mciReq); Map<String, Object> result = executeLegacy("EAI", "SMS_SEND_001", legacyReq);
// 결과 가공 // 결과 가공
if ("SUCCESS".equals(result.get("status"))) { if ("SUCCESS".equals(result.get("status"))) {