Compare commits
7 Commits
c0de1f4edb
...
0c89a09ccf
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c89a09ccf | ||
|
|
3ce9201cd5 | ||
|
|
be81c095c9 | ||
|
|
d4554ce34f | ||
|
|
b6d4ab1bec | ||
|
|
2c8497ebee | ||
|
|
8a93d5d6dc |
@@ -114,11 +114,13 @@ MSA 및 외부 시스템(MCI) 연동 환경의 안정성을 위해 완벽한 3-T
|
||||
새로운 도메인의 기능을 추가할 때 발생하는 반복적인 설정(보일러플레이트, 설정 파일 복사 등)을 1초 만에 자동화하기 위해 **DAP Developer Portal (Web UI)** 및 **CLI 스캐폴더 2종**을 제공합니다.
|
||||
|
||||
### 1. DAP Developer Portal (Web UI) - 가장 추천하는 방식!
|
||||
이제 더 이상 터미널에서 명령어를 칠 필요가 없습니다. Gateway 모듈에 내장된 웹 화면에서 빈칸만 채우면 코드가 마법처럼 찍혀 나옵니다.
|
||||
이제 더 이상 터미널에서 명령어를 칠 필요가 없습니다. Gateway 모듈에 내장된 웹 화면에서 빈칸만 채우면 신한라이프 패키지 개발 가이드에 맞춘 코드가 마법처럼 찍혀 나옵니다.
|
||||
|
||||
1. **접속 방법**: Gateway 서버 기동 후 브라우저에서 `http://localhost:8081/admin/scaffold.html` 접속
|
||||
2. **Pod (모듈) 생성 탭**: 모듈명(예: hr)과 포트만 입력하면 독립적인 Spring Boot 모듈이 디렉토리부터 빌드 스크립트까지 완벽히 생성됩니다.
|
||||
3. **Tool (기능) 생성 탭**: 생성된 모듈에 새로운 툴(서비스/DTO) 코드를 자동으로 주입합니다.
|
||||
3. **Tool (기능) 생성 탭**: 생성된 모듈에 새로운 툴 코드를 자동으로 주입합니다.
|
||||
- **MCI 연동 기반 툴 생성**: 4자리 시스템 코드(예: `nclg`)를 기반으로 알맞은 패키지에 `MciNclgClient`, `Converter`, `_I`, `_O` 파일이 정확하게 생성됩니다.
|
||||
- **완벽한 보일러플레이트 자동화**: `UseCaseImpl` 내부에 컴포넌트(`Client`, `Converter`)가 자동으로 의존성 주입되며, Java 15 Text Block을 활용해 들여쓰기(Indentation)까지 완벽히 정렬된 코드를 제공합니다.
|
||||
|
||||
### 2. CLI 스캐폴더 (기존 터미널 방식)
|
||||
웹 화면을 사용할 수 없는 환경이거나 터미널이 익숙한 경우, 아래 명령어를 통해 CLI 마법사를 사용할 수 있습니다.
|
||||
|
||||
@@ -63,8 +63,9 @@ public class ScaffoldingController {
|
||||
String date = req.get("date");
|
||||
if (date == null || date.trim().isEmpty()) date = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy.MM.dd"));
|
||||
boolean register = Boolean.parseBoolean(req.getOrDefault("register", "true"));
|
||||
String clientSystemCode = req.get("clientSystemCode");
|
||||
|
||||
return ToolScaffolder.scaffold(baseName, interfaceId, description, group, routingType, moduleName, author, date, register);
|
||||
return ToolScaffolder.scaffold(baseName, interfaceId, description, group, routingType, moduleName, author, date, register, clientSystemCode);
|
||||
} catch (Exception e) {
|
||||
return "오류 발생: " + e.getMessage();
|
||||
}
|
||||
|
||||
@@ -500,6 +500,14 @@
|
||||
<div class="input-hint">Controls dynamic routing exposure.</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Target System Code (MCI Only)</label>
|
||||
<input type="text" class="form-control" name="clientSystemCode" pattern="^[a-zA-Z]{4}$" maxlength="4" minlength="4" placeholder="e.g. cfpa" oninput="this.value = this.value.toLowerCase()">
|
||||
<div class="input-hint">Required for MCI Protocol (4 letters).</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-6">
|
||||
|
||||
@@ -68,7 +68,7 @@ public class ToolScaffolder {
|
||||
String createDate = getOrAsk(args, 7, scanner, "8. 작성일 (엔터 입력 시 '" + defaultDate + "'): ");
|
||||
if (createDate.trim().isEmpty()) createDate = defaultDate;
|
||||
|
||||
String result = scaffold(baseName, interfaceId, description, group, routingType, moduleName, author, createDate, true);
|
||||
String result = scaffold(baseName, interfaceId, description, group, routingType, moduleName, author, createDate, true, null);
|
||||
System.out.println(result);
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public class ToolScaffolder {
|
||||
return scanner.nextLine().trim();
|
||||
}
|
||||
|
||||
public static String scaffold(String baseName, String interfaceId, String description, String group, String routingType, String moduleName, String author, String createDate, boolean register) throws IOException {
|
||||
public static String scaffold(String baseName, String interfaceId, String description, String group, String routingType, String moduleName, String author, String createDate, boolean register, String clientSystemCode) throws IOException {
|
||||
baseName = toPascalCase(baseName);
|
||||
String envSourceDir = System.getenv("AXHUB_SOURCE_DIR");
|
||||
Path rootDir = envSourceDir != null ? Paths.get(envSourceDir) : Paths.get(".");
|
||||
@@ -95,6 +95,18 @@ public class ToolScaffolder {
|
||||
String bizPackage = BASE_PACKAGE + ".biz." + group.toLowerCase();
|
||||
boolean isMci = "MCI".equalsIgnoreCase(routingType);
|
||||
String mciGroupPath = "infra/itrf/mci/" + group.toLowerCase();
|
||||
String clientPkgSuffix = "";
|
||||
String clientPrefixCap = "";
|
||||
Path mciClientDir = null;
|
||||
|
||||
if (isMci && clientSystemCode != null && clientSystemCode.length() == 4) {
|
||||
String clientPrefix = clientSystemCode.toLowerCase();
|
||||
clientPkgSuffix = clientPrefix.substring(0, 3) + "." + clientPrefix.substring(3, 4);
|
||||
clientPrefixCap = toPascalCase(clientSystemCode);
|
||||
mciGroupPath = "infra/itrf/mci/" + clientPrefix.substring(0, 3) + "/" + clientPrefix.substring(3, 4);
|
||||
mciClientDir = rootDir.resolve(Paths.get(moduleName, BASE_PACKAGE_PATH, mciGroupPath));
|
||||
}
|
||||
|
||||
Path mciIoDir = rootDir.resolve(Paths.get(moduleName, BASE_PACKAGE_PATH, mciGroupPath, "io"));
|
||||
|
||||
Files.createDirectories(usecaseDir);
|
||||
@@ -102,6 +114,9 @@ public class ToolScaffolder {
|
||||
Files.createDirectories(dtoDir);
|
||||
if (isMci) {
|
||||
Files.createDirectories(mciIoDir);
|
||||
if (mciClientDir != null) {
|
||||
Files.createDirectories(mciClientDir);
|
||||
}
|
||||
} else {
|
||||
Files.createDirectories(legacyDtoDir);
|
||||
}
|
||||
@@ -226,8 +241,9 @@ public class ToolScaffolder {
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import java.util.Map;
|
||||
import %s.converter.%sLegacyConverter;
|
||||
import %s.infra.itrf.mci.%s.io.%s_I;
|
||||
import %s.converter.%sConverter;
|
||||
import %s.%s.io.%s_I;
|
||||
%s
|
||||
|
||||
/**
|
||||
* @package %s.usecase.impl
|
||||
@@ -248,8 +264,8 @@ public class ToolScaffolder {
|
||||
@RequiredArgsConstructor
|
||||
public class %sUseCaseImpl implements %sUseCase {
|
||||
|
||||
private final AxhubMciComponent mci;
|
||||
private final %sLegacyConverter converter;
|
||||
%s
|
||||
private final %sConverter converter;
|
||||
|
||||
@Override
|
||||
public Object execute(%sRequest req) {
|
||||
@@ -277,7 +293,8 @@ public class ToolScaffolder {
|
||||
bizPackage, baseName,
|
||||
bizPackage, baseName,
|
||||
bizPackage, baseName,
|
||||
BASE_PACKAGE, group.toLowerCase(), interfaceId,
|
||||
BASE_PACKAGE, mciGroupPath.replace("/", "."), interfaceId,
|
||||
(clientPrefixCap.isEmpty() ? "" : "import " + BASE_PACKAGE + "." + mciGroupPath.replace("/", ".") + ".Mci" + clientPrefixCap + "Client;\n"),
|
||||
bizPackage,
|
||||
baseName,
|
||||
author,
|
||||
@@ -285,6 +302,7 @@ public class ToolScaffolder {
|
||||
createDate, author,
|
||||
baseName,
|
||||
baseName,
|
||||
(clientPrefixCap.isEmpty() ? "private final AxhubMciComponent mci;" : "private final Mci" + clientPrefixCap + "Client mci;"),
|
||||
baseName,
|
||||
baseName,
|
||||
toolName,
|
||||
@@ -299,7 +317,7 @@ public class ToolScaffolder {
|
||||
import %s.dto.%sResponse;
|
||||
import %s.usecase.%sUseCase;
|
||||
import io.shinhanlife.dap.mcc.usecase.AbstractMcpToolUseCase;
|
||||
import %s.converter.%sLegacyConverter;
|
||||
import %s.converter.%sConverter;
|
||||
import org.springframework.stereotype.Service;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -323,7 +341,7 @@ public class ToolScaffolder {
|
||||
@RequiredArgsConstructor
|
||||
public class %sUseCaseImpl extends AbstractMcpToolUseCase implements %sUseCase {
|
||||
|
||||
private final %sLegacyConverter converter;
|
||||
private final %sConverter converter;
|
||||
|
||||
@Override
|
||||
public Object execute(%sRequest req) {
|
||||
@@ -353,12 +371,12 @@ public class ToolScaffolder {
|
||||
|
||||
if (isMci) {
|
||||
String mciReqContent = """
|
||||
package %s.infra.itrf.mci.%s.io;
|
||||
package %s.%s.io;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @package %s.infra.itrf.mci.%s.io
|
||||
* @package %s.%s.io
|
||||
* @className %s_I
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author %s
|
||||
@@ -383,16 +401,16 @@ public class ToolScaffolder {
|
||||
*/
|
||||
private String content;
|
||||
}
|
||||
""".formatted(BASE_PACKAGE, group.toLowerCase(), BASE_PACKAGE, group.toLowerCase(), interfaceId, author, createDate, createDate, author, interfaceId);
|
||||
""".formatted(BASE_PACKAGE, mciGroupPath.replace("/", "."), BASE_PACKAGE, mciGroupPath.replace("/", "."), interfaceId, author, createDate, createDate, author, interfaceId);
|
||||
Files.writeString(mciIoDir.resolve(interfaceId + "_I.java"), mciReqContent);
|
||||
|
||||
String mciResContent = """
|
||||
package %s.infra.itrf.mci.%s.io;
|
||||
package %s.%s.io;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @package %s.infra.itrf.mci.%s.io
|
||||
* @package %s.%s.io
|
||||
* @className %s_O
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author %s
|
||||
@@ -409,7 +427,7 @@ public class ToolScaffolder {
|
||||
public class %s_O {
|
||||
// TODO: Add response fields here
|
||||
}
|
||||
""".formatted(BASE_PACKAGE, group.toLowerCase(), BASE_PACKAGE, group.toLowerCase(), interfaceId, author, createDate, createDate, author, interfaceId);
|
||||
""".formatted(BASE_PACKAGE, mciGroupPath.replace("/", "."), BASE_PACKAGE, mciGroupPath.replace("/", "."), interfaceId, author, createDate, createDate, author, interfaceId);
|
||||
Files.writeString(mciIoDir.resolve(interfaceId + "_O.java"), mciResContent);
|
||||
|
||||
String converterContent = """
|
||||
@@ -417,15 +435,15 @@ public class ToolScaffolder {
|
||||
|
||||
import %s.dto.%sRequest;
|
||||
import %s.dto.%sResponse;
|
||||
import %s.infra.itrf.mci.%s.io.%s_I;
|
||||
import %s.infra.itrf.mci.%s.io.%s_O;
|
||||
import %s.%s.io.%s_I;
|
||||
import %s.%s.io.%s_O;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* @package %s.converter
|
||||
* @className %sLegacyConverter
|
||||
* @className %sConverter
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author %s
|
||||
* @create %s
|
||||
@@ -438,7 +456,7 @@ public class ToolScaffolder {
|
||||
* </pre>
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface %sLegacyConverter {
|
||||
public interface %sConverter {
|
||||
|
||||
@Mapping(source = "phoneNumber", target = "phone")
|
||||
@Mapping(source = "message", target = "content")
|
||||
@@ -454,14 +472,14 @@ public class ToolScaffolder {
|
||||
bizPackage,
|
||||
bizPackage, baseName,
|
||||
bizPackage, baseName,
|
||||
BASE_PACKAGE, group.toLowerCase(), interfaceId,
|
||||
BASE_PACKAGE, group.toLowerCase(), interfaceId,
|
||||
BASE_PACKAGE, mciGroupPath.replace("/", "."), interfaceId,
|
||||
BASE_PACKAGE, mciGroupPath.replace("/", "."), interfaceId,
|
||||
bizPackage, baseName, author, createDate, createDate, author,
|
||||
baseName, interfaceId, baseName,
|
||||
baseName, interfaceId,
|
||||
baseName, interfaceId
|
||||
);
|
||||
Files.writeString(converterDir.resolve(baseName + "LegacyConverter.java"), converterContent);
|
||||
Files.writeString(converterDir.resolve(baseName + "Converter.java"), converterContent);
|
||||
|
||||
log.append("\n=========================================\n");
|
||||
log.append(" Scaffolding Complete! (Routing: " + routingType + ")\n");
|
||||
@@ -472,7 +490,47 @@ public class ToolScaffolder {
|
||||
log.append("[Response DTO] ").append(dtoDir.resolve(baseName + "Response.java")).append("\n");
|
||||
log.append("[MCI Request IO] ").append(mciIoDir.resolve(interfaceId + "_I.java")).append("\n");
|
||||
log.append("[MCI Response IO] ").append(mciIoDir.resolve(interfaceId + "_O.java")).append("\n");
|
||||
log.append("[MCI Converter] ").append(converterDir.resolve(baseName + "LegacyConverter.java")).append("\n");
|
||||
log.append("[MCI Converter] ").append(converterDir.resolve(baseName + "Converter.java")).append("\n");
|
||||
|
||||
if (!clientPrefixCap.isEmpty()) {
|
||||
String mciClientContent = """
|
||||
package %s.%s;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import io.shinhanlife.dap.lib.integration.mci.component.AxhubMciComponent;
|
||||
import io.shinhanlife.glow.communication.dto.Transfer;
|
||||
|
||||
/**
|
||||
* @package %s.%s
|
||||
* @className Mci%sClient
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author %s
|
||||
* @create %s
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* %s %s 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class Mci%sClient {
|
||||
private final AxhubMciComponent mci;
|
||||
|
||||
public Transfer<Object> callTo(String interfaceId, String dummy, Object mciReq, Class<Object> resType) throws Exception {
|
||||
return mci.callTo(interfaceId, dummy, mciReq, resType);
|
||||
}
|
||||
}
|
||||
""".formatted(
|
||||
BASE_PACKAGE, mciGroupPath.replace("/", "."),
|
||||
BASE_PACKAGE, mciGroupPath.replace("/", "."), clientPrefixCap, author, createDate, createDate, author, clientPrefixCap
|
||||
);
|
||||
Files.writeString(mciClientDir.resolve("Mci" + clientPrefixCap + "Client.java"), mciClientContent);
|
||||
log.append("[MCI Client] ").append(mciClientDir.resolve("Mci" + clientPrefixCap + "Client.java")).append("\n");
|
||||
}
|
||||
|
||||
} else {
|
||||
String legacyReqContent = """
|
||||
@@ -548,7 +606,7 @@ public class ToolScaffolder {
|
||||
|
||||
/**
|
||||
* @package %s.converter
|
||||
* @className %sLegacyConverter
|
||||
* @className %sConverter
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author %s
|
||||
* @create %s
|
||||
@@ -561,7 +619,7 @@ public class ToolScaffolder {
|
||||
* </pre>
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface %sLegacyConverter {
|
||||
public interface %sConverter {
|
||||
|
||||
@Mapping(source = "phoneNumber", target = "phone")
|
||||
@Mapping(source = "message", target = "content")
|
||||
@@ -582,7 +640,7 @@ public class ToolScaffolder {
|
||||
bizPackage, baseName, author, createDate, createDate, author,
|
||||
baseName, baseName, baseName, baseName, baseName, baseName, baseName
|
||||
);
|
||||
Files.writeString(converterDir.resolve(baseName + "LegacyConverter.java"), converterContent);
|
||||
Files.writeString(converterDir.resolve(baseName + "Converter.java"), converterContent);
|
||||
|
||||
log.append("\n=========================================\n");
|
||||
log.append(" Scaffolding Complete! (Routing: " + routingType + ")\n");
|
||||
@@ -593,7 +651,7 @@ public class ToolScaffolder {
|
||||
log.append("[Response DTO] ").append(dtoDir.resolve(baseName + "Response.java")).append("\n");
|
||||
log.append("[Legacy Request DTO] ").append(legacyDtoDir.resolve(baseName + "LegacyRequest.java")).append("\n");
|
||||
log.append("[Legacy Response DTO] ").append(legacyDtoDir.resolve(baseName + "LegacyResponse.java")).append("\n");
|
||||
log.append("[Legacy Converter] ").append(converterDir.resolve(baseName + "LegacyConverter.java")).append("\n");
|
||||
log.append("[Legacy Converter] ").append(converterDir.resolve(baseName + "Converter.java")).append("\n");
|
||||
}
|
||||
log.append("\n Tip: ").append(interfaceId).append(" 목업 데이터를 mock-responses.json에 추가하세요.\n");
|
||||
|
||||
|
||||
@@ -5,6 +5,6 @@ import io.shinhanlife.dap.lib.annotation.McpFunction;
|
||||
import io.shinhanlife.dap.mcc.biz.oth.dto.*;
|
||||
|
||||
@McpTool(routingType = "MCI", categoryKey = "oth")
|
||||
public interface OnnbaMciToolUseCase {
|
||||
public interface Onnba3011UseCase {
|
||||
Object callOnnba3011(Onnba3011Request req);
|
||||
}
|
||||
@@ -3,7 +3,7 @@ package io.shinhanlife.dap.mcc.biz.oth.usecase.impl;
|
||||
import io.shinhanlife.dap.mcc.biz.oth.converter.Onnba3011Converter;
|
||||
import io.shinhanlife.dap.mcc.infra.itrf.mci.cfp.a.MciCfpaClient;
|
||||
import io.shinhanlife.dap.mcc.infra.itrf.mci.cfp.a.io.CLCNNB00001_I;
|
||||
import io.shinhanlife.dap.mcc.biz.oth.usecase.OnnbaMciToolUseCase;
|
||||
import io.shinhanlife.dap.mcc.biz.oth.usecase.Onnba3011UseCase;
|
||||
import io.shinhanlife.dap.mcc.biz.oth.dto.Onnba3011Request;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -26,14 +26,13 @@ import org.springframework.stereotype.Service;
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class OnnbaMciToolUseCaseImpl implements OnnbaMciToolUseCase {
|
||||
public class Onnba3011UseCaseImpl implements Onnba3011UseCase {
|
||||
|
||||
private static final String INTERFACE_CODE_3011 = "CLCNNB00001";
|
||||
|
||||
// 공통 MCI Client 주입
|
||||
private final MciCfpaClient mciCfpaClient;
|
||||
private final Onnba3011Converter onnba3011Converter;
|
||||
|
||||
/**
|
||||
* AI Agent가 호출하게 될 메서드입니다.
|
||||
* @McpFunction 어노테이션 하나로 AI 도구로 자동 노출 및 라우팅됩니다.
|
||||
@@ -24,13 +24,13 @@ import org.mockito.Mockito;
|
||||
* 2026.07.27 0986406 initial creation
|
||||
* </pre>
|
||||
*/
|
||||
class OnnbaMciToolUseCaseImplTest {
|
||||
class Onnba3011UseCaseImplTest {
|
||||
|
||||
@Test
|
||||
void convertsToolRequestBeforeCallingMciClient() throws Exception {
|
||||
MciCfpaClient mciCfpaClient = Mockito.mock(MciCfpaClient.class);
|
||||
Onnba3011Converter converter = Mockito.mock(Onnba3011Converter.class);
|
||||
OnnbaMciToolUseCaseImpl useCase = new OnnbaMciToolUseCaseImpl(mciCfpaClient, converter);
|
||||
Onnba3011UseCaseImpl useCase = new Onnba3011UseCaseImpl(mciCfpaClient, converter);
|
||||
Onnba3011Request request = new Onnba3011Request();
|
||||
CLCNNB00001_I mciRequest = new CLCNNB00001_I();
|
||||
|
||||
Reference in New Issue
Block a user