feat: Add AxhubEaiComponent and MCI/EAI mock frameworks
Some checks failed
Deploy to OCIWP / deploy (push) Failing after 3m26s
Some checks failed
Deploy to OCIWP / deploy (push) Failing after 3m26s
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
package io.shinhanlife.dap.common.integration.eai.component;
|
||||
|
||||
import io.shinhanlife.dap.dapmt.config.GlowCommunicationProperties;
|
||||
import io.shinhanlife.glow.communication.dto.CommonHeader;
|
||||
import io.shinhanlife.glow.communication.dto.Transfer;
|
||||
import io.shinhanlife.glow.communication.module.eai.component.GlowEaiComponent;
|
||||
import io.shinhanlife.glow.communication.util.CommonHeaderFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 신한라이프 내부 Glow 표준 EAI 컴포넌트 어댑터 (AXHUB)
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class AxhubEaiComponent {
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private final GlowEaiComponent eai;
|
||||
private final GlowCommunicationProperties communicationProperties;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <O> Transfer<O> syncEai(Transfer<Object> request) {
|
||||
// LOG 저장 (AXHUB 방식 로깅)
|
||||
CommonHeader reqHeader = (CommonHeader) request.getHeader();
|
||||
log.info("[AxhubEaiComponent] {} EAI 호출시작 (수신서비스: {})", reqHeader.getItrfId(), reqHeader.getRcvSvcId());
|
||||
|
||||
Transfer<O> response = (Transfer<O>) eai.sync(request);
|
||||
|
||||
log.info("[AxhubEaiComponent] {} EAI 호출종료 (수신서비스: {})", reqHeader.getItrfId(), reqHeader.getRcvSvcId());
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* EAI 호출
|
||||
*/
|
||||
public <O, I> Transfer<O> call(String itrfId, String rcvSvcId, I inputDto) throws Exception {
|
||||
CommonHeader header = CommonHeaderFactory.createRequestHeader(itrfId, rcvSvcId);
|
||||
|
||||
Transfer<Object> request = Transfer.builder()
|
||||
.header(header)
|
||||
.body(inputDto)
|
||||
.build();
|
||||
|
||||
return syncEai(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* EAI 호출 (응답 타입 명시)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <O, I> Transfer<O> call(String itrfId, String rcvSvcId, I inputDto, Class<O> resBodyClass) throws Exception {
|
||||
CommonHeader header = CommonHeaderFactory.createRequestHeader(itrfId, rcvSvcId);
|
||||
|
||||
Transfer<Object> request = Transfer.builder()
|
||||
.header(header)
|
||||
.body(inputDto)
|
||||
.resBodyClass((Class<Object>) (Class<?>) resBodyClass)
|
||||
.build();
|
||||
|
||||
return syncEai(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* EAI 호출 (rcvSvcId 없는 경우)
|
||||
*/
|
||||
public <O, I> Transfer<O> call(String itrfId, I inputDTO, Class<O> resBodyClass) throws Exception {
|
||||
String className = inputDTO.getClass().getSimpleName();
|
||||
String rcvSvcId = className.replace("_I", "");
|
||||
return call(itrfId, rcvSvcId, inputDTO, resBodyClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* EAI 호출 (Res body class와 rcvSvcId 없는 경우)
|
||||
*/
|
||||
public <O, I> Transfer<O> call(String itrfId, I inputDTO) throws Exception {
|
||||
String className = inputDTO.getClass().getSimpleName();
|
||||
String rcvSvcId = className.replace("_I", "");
|
||||
return call(itrfId, rcvSvcId, inputDTO);
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,22 @@
|
||||
package io.shinhanlife.dap.common.integration.mci.component;
|
||||
|
||||
import io.shinhanlife.dap.common.session.dto.SessionDto;
|
||||
import io.shinhanlife.dap.common.util.SessionUtil;
|
||||
import io.shinhanlife.dap.dapmt.config.GlowCommunicationProperties;
|
||||
import io.shinhanlife.glow.communication.dto.CommonHeader;
|
||||
import io.shinhanlife.glow.communication.dto.HeaderDefaults;
|
||||
import io.shinhanlife.glow.communication.dto.Transfer;
|
||||
import io.shinhanlife.glow.communication.module.mci.component.GlowMciComponent;
|
||||
import io.shinhanlife.glow.communication.util.CommonHeaderFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 신한라이프 내부 Glow 표준 컴포넌트 어댑터
|
||||
* 신한라이프 내부 Glow 표준 컴포넌트 어댑터 (AXHUB)
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@@ -16,14 +25,93 @@ public class AxhubMciComponent {
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private final GlowMciComponent mci;
|
||||
private final GlowCommunicationProperties communicationProperties;
|
||||
|
||||
/** 전문생성채널유형코드 : 1 (채널계) */
|
||||
private final static String TGRM_CREA_CHNN_TYPE_CD_1 = "1";
|
||||
private static final String SUCO_UNBL_CODE = "NNB00147"; // 청약불가
|
||||
|
||||
/**
|
||||
* 전문 Common Header 생성
|
||||
* @param itrfName 인터페이스Id
|
||||
* @param rcvSvcId 수신서비스Id
|
||||
* @return Map<HeaderDefaults, String>
|
||||
*/
|
||||
private Map<HeaderDefaults, String> createCommonHeaderMap(String itrfName, String rcvSvcId) {
|
||||
SessionDto sessionDto = SessionUtil.getSession();
|
||||
Map<HeaderDefaults, String> commonHeaderMap = new HashMap<>();
|
||||
|
||||
commonHeaderMap.put(HeaderDefaults.ITRF_ID, itrfName);
|
||||
commonHeaderMap.put(HeaderDefaults.RCV_SVC_ID, rcvSvcId);
|
||||
|
||||
if (sessionDto != null) {
|
||||
commonHeaderMap.put(HeaderDefaults.STR_YMD, sessionDto.getStrYmd());
|
||||
commonHeaderMap.put(HeaderDefaults.ACNT_OGNZ_NO, sessionDto.getBrafNo());
|
||||
commonHeaderMap.put(HeaderDefaults.PSMR_ASRT_CD, sessionDto.getPsmrAsrtCd());
|
||||
commonHeaderMap.put(HeaderDefaults.SBSN_RULP_ASRT_CD, sessionDto.getSbsnRulpAsrtCd());
|
||||
commonHeaderMap.put(HeaderDefaults.BSDU_CD, sessionDto.getBsduCd());
|
||||
commonHeaderMap.put(HeaderDefaults.BSQU_CD, sessionDto.getBsquCd());
|
||||
commonHeaderMap.put(HeaderDefaults.OGNZ_ASRT_CD, sessionDto.getOgnzAsrtCd());
|
||||
commonHeaderMap.put(HeaderDefaults.OGNZ_LEVE_CD, sessionDto.getOgnzLeveCd());
|
||||
commonHeaderMap.put(HeaderDefaults.SCRN_ID, sessionDto.getPrgrId());
|
||||
}
|
||||
|
||||
commonHeaderMap.put(HeaderDefaults.INDV_CTIN_ROLE_CD, io.shinhanlife.dap.common.integration.mci.enums.IndvCtinRoleTyp.CD_Z99.getCode());
|
||||
commonHeaderMap.put(HeaderDefaults.TGRM_CREA_CHNN_TYPE_CD, TGRM_CREA_CHNN_TYPE_CD_1);
|
||||
|
||||
if (communicationProperties != null && communicationProperties.getCommon() != null) {
|
||||
commonHeaderMap.put(HeaderDefaults.ENVR_TYPE_CD, communicationProperties.getCommon().getEnvType());
|
||||
}
|
||||
|
||||
return commonHeaderMap;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <O, I> Transfer<O> callTo(String itrfName, String rcvSvcId, I inputDto, Class<O> resBodyClass) {
|
||||
log.info("[AxhubMciComponent] MCI 호출 준비 - 인터페이스: {}, 수신서비스: {}", itrfName, rcvSvcId);
|
||||
private <O> Transfer<O> syncMci(Transfer<Object> request) {
|
||||
// LOG 저장 (AXHUB 방식 로깅)
|
||||
CommonHeader reqHeader = (CommonHeader) request.getHeader();
|
||||
log.info("[AxhubMciComponent] {} MCI 호출시작 (수신서비스: {})", reqHeader.getItrfId(), reqHeader.getRcvSvcId());
|
||||
Transfer<O> response = (Transfer<O>) mci.sync(request);
|
||||
log.info("[AxhubMciComponent] {} MCI 호출종료 (수신서비스: {})", reqHeader.getItrfId(), reqHeader.getRcvSvcId());
|
||||
|
||||
// Header 세팅 로직 생략 (Mock)
|
||||
if (response != null && response.getHeader() != null) {
|
||||
CommonHeader resHeader = (CommonHeader) response.getHeader();
|
||||
String tgrmDalRsltCd = resHeader.getTgrmDalRsltCd();
|
||||
// TODO 추가 메시지 처리 및 오류 코드 제어 로직
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
public <O, I> Transfer<O> callTo(String itrfName, String rcvSvcId, I inputDto) throws Exception {
|
||||
Map<HeaderDefaults, String> commonHeaderMap = createCommonHeaderMap(itrfName, rcvSvcId);
|
||||
CommonHeader header = CommonHeaderFactory.createRequestHeader(commonHeaderMap);
|
||||
|
||||
Transfer<Object> request = Transfer.builder()
|
||||
.header(header)
|
||||
.body(inputDto)
|
||||
.build();
|
||||
|
||||
return syncMci(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 대내 mci 호출
|
||||
* @param itrfName 인터페이스Id
|
||||
* @param rcvSvcId 수신서비스Id
|
||||
* @param inputDto inputDto
|
||||
* @param resBodyClass resBodyClass
|
||||
* @return Transfer
|
||||
* @param <O> resBodyClass 제너릭
|
||||
* @param <I> inputDto 제너릭
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <O, I> Transfer<O> callTo(String itrfName, String rcvSvcId, I inputDto, Class<O> resBodyClass) throws Exception {
|
||||
Map<HeaderDefaults, String> commonHeaderMap = createCommonHeaderMap(itrfName, rcvSvcId);
|
||||
CommonHeader header = CommonHeaderFactory.createRequestHeader(commonHeaderMap);
|
||||
|
||||
Transfer<Object> request = Transfer.builder()
|
||||
.header(header)
|
||||
.body(inputDto)
|
||||
.resBodyClass((Class<Object>) (Class<?>) resBodyClass)
|
||||
.build();
|
||||
@@ -31,9 +119,34 @@ public class AxhubMciComponent {
|
||||
return syncMci(request);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <O> Transfer<O> syncMci(Transfer<Object> request) {
|
||||
log.info("[AxhubMciComponent] GlowMciComponent.sync() 호출");
|
||||
return (Transfer<O>) mci.sync(request);
|
||||
/**
|
||||
* 대내 mci 호출 (rcvSvcId 없는 경우)
|
||||
* @param itrfName 인터페이스Id
|
||||
* @param inputDTO 수신서비스Id (클래스명 대체)
|
||||
* @param resBodyClass resBodyClass
|
||||
* @return Transfer
|
||||
* @param <O> resBodyClass 제너릭
|
||||
* @param <I> inputDto 제너릭
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
public <O, I> Transfer<O> callTo(String itrfName, I inputDTO, Class<O> resBodyClass) throws Exception {
|
||||
String className = inputDTO.getClass().getSimpleName();
|
||||
String rcvSvcId = className.replace("_I", "");
|
||||
return callTo(itrfName, rcvSvcId, inputDTO, resBodyClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* 대내 mci 호출 (Res body class와 rcvSvcId 없는 경우)
|
||||
* @param itrfName 인터페이스Id
|
||||
* @param inputDTO 수신서비스Id (클래스명 대체)
|
||||
* @return Transfer
|
||||
* @param <O> resBodyClass 제너릭
|
||||
* @param <I> inputDto 제너릭
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
public <O, I> Transfer<O> callTo(String itrfName, I inputDTO) throws Exception {
|
||||
String className = inputDTO.getClass().getSimpleName();
|
||||
String rcvSvcId = className.replace("_I", "");
|
||||
return callTo(itrfName, rcvSvcId, inputDTO);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package io.shinhanlife.dap.common.integration.mci.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Getter
|
||||
@RequiredArgsConstructor
|
||||
public enum IndvCtinRoleTyp {
|
||||
CD_Z99("Z99");
|
||||
|
||||
private final String code;
|
||||
}
|
||||
@@ -59,6 +59,17 @@ public class SessionDto {
|
||||
private List<String> tgtrPrafNoList;
|
||||
private List<String> tgtrOgnzNoList;
|
||||
|
||||
// 추가된 LICO 연동 공통 헤더 필수 필드들
|
||||
private String strYmd;
|
||||
private String brafNo;
|
||||
private String psmrAsrtCd;
|
||||
private String sbsnRulpAsrtCd;
|
||||
private String bsduCd;
|
||||
private String bsquCd;
|
||||
private String ognzAsrtCd;
|
||||
private String ognzLeveCd;
|
||||
private String prgrId;
|
||||
|
||||
|
||||
// 유틸성
|
||||
private String loginDtm; // 로그인일시
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package io.shinhanlife.glow.communication.dto;
|
||||
import lombok.Data;
|
||||
@Data
|
||||
public class CommonHeader {
|
||||
private String itrfId;
|
||||
private String rcvSvcId;
|
||||
private String tgrmDalRsltCd;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package io.shinhanlife.glow.communication.dto;
|
||||
|
||||
public enum HeaderDefaults {
|
||||
ITRF_ID, RCV_SVC_ID, STR_YMD, ACNT_OGNZ_NO, PSMR_ASRT_CD, SBSN_RULP_ASRT_CD, BSDU_CD, BSQU_CD,
|
||||
INDV_CTIN_ROLE_CD, SCRN_ID, OGNZ_ASRT_CD, OGNZ_LEVE_CD, TGRM_CREA_CHNN_TYPE_CD, ENVR_TYPE_CD
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package io.shinhanlife.glow.communication.exception;
|
||||
|
||||
public class ItrfException extends Exception {
|
||||
public ItrfException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
public ItrfException(String msgCd, String msgPrnAttrCd, String msgCt, String anxMsgCt) {
|
||||
super(msgCd + ": " + msgCt);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package io.shinhanlife.glow.communication.module.eai.component;
|
||||
|
||||
import io.shinhanlife.glow.communication.dto.Transfer;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* TODO: 실제 Glow Framework 의존성(JAR)이 추가되면 이 Mock 클래스를 삭제하세요.
|
||||
*/
|
||||
@Component
|
||||
public class GlowEaiComponent<I, O> {
|
||||
public Transfer<O> sync(Transfer<I> request) {
|
||||
// Mock 구현
|
||||
Transfer<O> response = new Transfer<>();
|
||||
response.setHeader(request.getHeader());
|
||||
response.setResBodyClass((Class<O>) request.getResBodyClass());
|
||||
return response;
|
||||
}
|
||||
|
||||
public <S, R> Transfer<R> call(Transfer<S> request, Class<R> resBody) {
|
||||
Transfer<R> response = new Transfer<>();
|
||||
response.setHeader(request.getHeader());
|
||||
response.setResBodyClass(resBody);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package io.shinhanlife.glow.communication.util;
|
||||
import io.shinhanlife.glow.communication.dto.CommonHeader;
|
||||
import io.shinhanlife.glow.communication.dto.HeaderDefaults;
|
||||
import java.util.Map;
|
||||
public class CommonHeaderFactory {
|
||||
public static CommonHeader createRequestHeader(Map<HeaderDefaults, String> commonHeaderMap) {
|
||||
CommonHeader header = new CommonHeader();
|
||||
header.setItrfId(commonHeaderMap.get(HeaderDefaults.ITRF_ID));
|
||||
header.setRcvSvcId(commonHeaderMap.get(HeaderDefaults.RCV_SVC_ID));
|
||||
return header;
|
||||
}
|
||||
public static CommonHeader createRequestHeader(String itrfId, String rcvSvcId) {
|
||||
CommonHeader header = new CommonHeader();
|
||||
header.setItrfId(itrfId);
|
||||
header.setRcvSvcId(rcvSvcId);
|
||||
return header;
|
||||
}
|
||||
}
|
||||
43
dap-tool-payment/src/main/resources/static/index.html
Normal file
43
dap-tool-payment/src/main/resources/static/index.html
Normal file
@@ -0,0 +1,43 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ko">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Payment Tool</title>
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
font-family: 'Inter', 'Apple SD Gothic Neo', sans-serif;
|
||||
background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
|
||||
color: #fff;
|
||||
}
|
||||
.container {
|
||||
text-align: center;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
padding: 3rem;
|
||||
border-radius: 15px;
|
||||
backdrop-filter: blur(10px);
|
||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
|
||||
}
|
||||
h1 {
|
||||
font-size: 2.5rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
p {
|
||||
font-size: 1.2rem;
|
||||
opacity: 0.9;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>💳 Payment Tool</h1>
|
||||
<p>Axhub Payment Module is successfully running!</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user