feat: Scaffolder 생성 시 MCI UseCaseImpl 템플릿을 실제 요청(image) 구조(BizException, resTransfer null 체크, IO DTO)와 완전히 일치하도록 수정
Some checks failed
Deploy to OCIWP / deploy (push) Failing after 25s
Some checks failed
Deploy to OCIWP / deploy (push) Failing after 25s
This commit is contained in:
@@ -868,11 +868,13 @@ public class ToolScaffolder {
|
|||||||
import %s.usecase.%sUseCase;
|
import %s.usecase.%sUseCase;
|
||||||
import io.shinhanlife.dat.lib.integration.mci.component.AxhubMciComponent;
|
import io.shinhanlife.dat.lib.integration.mci.component.AxhubMciComponent;
|
||||||
import io.shinhanlife.glow.communication.dto.Transfer;
|
import io.shinhanlife.glow.communication.dto.Transfer;
|
||||||
|
import io.shinhanlife.glow.BizException;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import %s.converter.%sConverter;
|
import %s.converter.%sConverter;
|
||||||
import %s.%s.io.%s_I;
|
import %s.%s.io.%s_I;
|
||||||
|
import %s.%s.io.%s_O;
|
||||||
%s
|
%s
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -903,19 +905,33 @@ public class ToolScaffolder {
|
|||||||
try {
|
try {
|
||||||
// MapStruct를 이용한 자동 매핑 (AI DTO -> MCI DTO)
|
// MapStruct를 이용한 자동 매핑 (AI DTO -> MCI DTO)
|
||||||
%s_I mciReq = converter.toLegacyRequest(req);
|
%s_I mciReq = converter.toLegacyRequest(req);
|
||||||
|
Transfer<%s_O> resTransfer = null;
|
||||||
|
|
||||||
Transfer<Object> resTransfer = mci.callTo(
|
if (mciReq != null) {
|
||||||
|
resTransfer = mci.callTo(
|
||||||
"%s",
|
"%s",
|
||||||
null,
|
null,
|
||||||
mciReq,
|
mciReq,
|
||||||
Object.class
|
%s_O.class
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
%sResponse response = new %sResponse();
|
%sResponse response = new %sResponse();
|
||||||
|
if (resTransfer != null && resTransfer.getBody() != null) {
|
||||||
|
response = converter.toResponse(resTransfer.getBody());
|
||||||
|
}
|
||||||
|
|
||||||
response.setResultCode("SUCCESS");
|
response.setResultCode("SUCCESS");
|
||||||
response.setResultMessage(resTransfer.getBody() != null
|
response.setResultMessage(resTransfer != null && resTransfer.getBody() != null
|
||||||
? "MCI call completed."
|
? "MCI call completed."
|
||||||
: "MCI call completed without a response body.");
|
: "MCI call completed without a response body.");
|
||||||
return response;
|
return response;
|
||||||
|
} catch (BizException e) {
|
||||||
|
log.error("[MCI Tool] 연동 중 오류 발생: {}", e.getMessage(), e);
|
||||||
|
%sResponse response = new %sResponse();
|
||||||
|
response.setResultCode("ERROR");
|
||||||
|
response.setResultMessage(e.getMessage() != null ? e.getMessage() : "Unknown error");
|
||||||
|
return response;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("[MCI Tool] 연동 중 오류 발생: {}", e.getMessage(), e);
|
log.error("[MCI Tool] 연동 중 오류 발생: {}", e.getMessage(), e);
|
||||||
%sResponse response = new %sResponse();
|
%sResponse response = new %sResponse();
|
||||||
@@ -932,6 +948,7 @@ public class ToolScaffolder {
|
|||||||
bizPackage, baseName,
|
bizPackage, baseName,
|
||||||
bizPackage, baseName,
|
bizPackage, baseName,
|
||||||
BASE_PACKAGE, mciGroupPath.replace("/", "."), ioPrefix,
|
BASE_PACKAGE, mciGroupPath.replace("/", "."), ioPrefix,
|
||||||
|
BASE_PACKAGE, mciGroupPath.replace("/", "."), ioPrefix,
|
||||||
(clientPrefixCap.isEmpty() ? "" : "import " + BASE_PACKAGE + "." + mciGroupPath.replace("/", ".") + ".Mci" + clientPrefixCap + "Client;\n"),
|
(clientPrefixCap.isEmpty() ? "" : "import " + BASE_PACKAGE + "." + mciGroupPath.replace("/", ".") + ".Mci" + clientPrefixCap + "Client;\n"),
|
||||||
bizPackage,
|
bizPackage,
|
||||||
baseName,
|
baseName,
|
||||||
@@ -946,20 +963,16 @@ public class ToolScaffolder {
|
|||||||
baseName,
|
baseName,
|
||||||
toolName,
|
toolName,
|
||||||
ioPrefix,
|
ioPrefix,
|
||||||
|
ioPrefix,
|
||||||
interfaceId,
|
interfaceId,
|
||||||
|
ioPrefix,
|
||||||
|
baseName,
|
||||||
|
baseName,
|
||||||
baseName,
|
baseName,
|
||||||
baseName,
|
baseName,
|
||||||
baseName,
|
baseName,
|
||||||
baseName
|
baseName
|
||||||
);
|
);
|
||||||
String mciIoPackage = BASE_PACKAGE + "." + mciGroupPath.replace("/", ".");
|
|
||||||
serviceImplContent = serviceImplContent
|
|
||||||
.replace("import " + mciIoPackage + ".io." + ioPrefix + "_I;",
|
|
||||||
"import " + mciIoPackage + ".io." + ioPrefix + "_I;\nimport " + mciIoPackage + ".io." + ioPrefix + "_O;")
|
|
||||||
.replace("Transfer<Object> resTransfer", "Transfer<" + ioPrefix + "_O> resTransfer")
|
|
||||||
.replace("Object.class", ioPrefix + "_O.class")
|
|
||||||
.replace("response.setResultCode(\"SUCCESS\");",
|
|
||||||
"if (resTransfer.getBody() != null) {\n response = converter.toResponse(resTransfer.getBody());\n }\n response.setResultCode(\"SUCCESS\");");
|
|
||||||
} else {
|
} else {
|
||||||
serviceImplContent = isHttp
|
serviceImplContent = isHttp
|
||||||
? httpUseCaseImplContent(bizPackage, baseName, httpGroupPath.replace("/", "."), httpApiClass, author, createDate)
|
? httpUseCaseImplContent(bizPackage, baseName, httpGroupPath.replace("/", "."), httpApiClass, author, createDate)
|
||||||
|
|||||||
Reference in New Issue
Block a user