Compare commits
29 Commits
1ac84f2f92
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 4bf7f661e3 | |||
| 124df00f51 | |||
| e4de8ebc8b | |||
| 52e8c3be39 | |||
| 136626e7c4 | |||
| 0848cd3469 | |||
| 0b6f273132 | |||
| 266644798f | |||
| 2e8b45c69e | |||
| ea3d23424c | |||
| 2a9dfaa093 | |||
| 3b74f9ce38 | |||
| 145ad37499 | |||
| a235b0656c | |||
| da397b21b0 | |||
| e084436c90 | |||
| 15652e158d | |||
| 8e4c2efe88 | |||
| cad51df3cb | |||
| d19a9eb593 | |||
| a05870fd1b | |||
| 47259da0f6 | |||
| 0bdcc440b7 | |||
| 778197c1dd | |||
| 91631ea750 | |||
| a1d7f8f10e | |||
| 1ba140ddea | |||
| 7117420f38 | |||
| 536151a737 |
@@ -1,7 +1,7 @@
|
|||||||
UserManController_사용자관리_APIGW_INSERT,UPDATE,DELETE
|
UserManController_사용자관리_APIGW_INSERT,UPDATE,DELETE
|
||||||
AdapterController_어댑터관리_APIGW_INSERT,UPDATE,DELETE
|
AdapterController_어댑터관리_APIGW_INSERT,UPDATE,DELETE
|
||||||
ApiInterfaceController_API관리_APIGW_INSERT,UPDATE,DELETE,CLONE
|
ApiInterfaceController_API관리_APIGW_INSERT,UPDATE,DELETE,CLONE
|
||||||
ClientController_Client (키정보)관리_APIGW_INSERT,UPDATE,DELETE
|
ClientController_Client (키정보)관리_APIGW_INSERT,UPDATE,DELETE,SYNC_PORTAL
|
||||||
RoleController_Role (역할)관리_APIGW_INSERT,UPDATE,DELETE
|
RoleController_Role (역할)관리_APIGW_INSERT,UPDATE,DELETE
|
||||||
MenuController_Menu관리_APIGW_INSERT,UPDATE,DELETE
|
MenuController_Menu관리_APIGW_INSERT,UPDATE,DELETE
|
||||||
PortalApprovalLineManController_승인라인관리_APIGW_INSERT,UPDATE,DELETE
|
PortalApprovalLineManController_승인라인관리_APIGW_INSERT,UPDATE,DELETE
|
||||||
|
|||||||
@@ -110,7 +110,7 @@
|
|||||||
</mvc:interceptor>
|
</mvc:interceptor>
|
||||||
<mvc:interceptor>
|
<mvc:interceptor>
|
||||||
<mvc:mapping path="/_onl/**"/>
|
<mvc:mapping path="/_onl/**"/>
|
||||||
<bean class="com.eactive.eai.rms.common.interceptor.ApiKeyInterceptor" />
|
<bean class="com.eactive.eai.rms.common.interceptor.InternalApiTokenInterceptor" />
|
||||||
</mvc:interceptor>
|
</mvc:interceptor>
|
||||||
<!-- BaseRestController 엔드포인트 IP 화이트리스트 인증 -->
|
<!-- BaseRestController 엔드포인트 IP 화이트리스트 인증 -->
|
||||||
<mvc:interceptor>
|
<mvc:interceptor>
|
||||||
|
|||||||
@@ -29,6 +29,14 @@
|
|||||||
// (enricher 는 oauth·api_key 를 모두 apiKey-in-header 로 모델링하므로 scheme.type 만으로 구분 불가)
|
// (enricher 는 oauth·api_key 를 모두 apiKey-in-header 로 모델링하므로 scheme.type 만으로 구분 불가)
|
||||||
var djbAuthType = '';
|
var djbAuthType = '';
|
||||||
|
|
||||||
|
// 마지막 저장(또는 최초 로드) 시점의 state.data 스냅샷 — 닫기 전 미저장 변경 여부 판별용.
|
||||||
|
var savedSnapshot = null;
|
||||||
|
function isDirty() { return savedSnapshot !== null && JSON.stringify(state.data) !== savedSnapshot; }
|
||||||
|
function closeEditor() {
|
||||||
|
if (isDirty() && !window.confirm('저장하지 않은 변경사항이 있습니다. 저장하지 않고 닫으시겠습니까?')) return;
|
||||||
|
window.close();
|
||||||
|
}
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
// 2. 유틸
|
// 2. 유틸
|
||||||
// ============================================================
|
// ============================================================
|
||||||
@@ -1703,7 +1711,7 @@
|
|||||||
|
|
||||||
var bSave = $('#btn-save'); if (bSave) bSave.addEventListener('click', () => saveSpec(false));
|
var bSave = $('#btn-save'); if (bSave) bSave.addEventListener('click', () => saveSpec(false));
|
||||||
var bRegen = $('#btn-regen'); if (bRegen) bRegen.addEventListener('click', regenerate);
|
var bRegen = $('#btn-regen'); if (bRegen) bRegen.addEventListener('click', regenerate);
|
||||||
var bClose = $('#btn-close'); if (bClose) bClose.addEventListener('click', () => window.close());
|
var bClose = $('#btn-close'); if (bClose) bClose.addEventListener('click', closeEditor);
|
||||||
|
|
||||||
// Cmd/Ctrl + S → 저장 (브라우저 기본 저장 대화상자 차단)
|
// Cmd/Ctrl + S → 저장 (브라우저 기본 저장 대화상자 차단)
|
||||||
document.addEventListener('keydown', function (e) {
|
document.addEventListener('keydown', function (e) {
|
||||||
@@ -2066,6 +2074,7 @@
|
|||||||
.then(function (res) {
|
.then(function (res) {
|
||||||
if (res && res.status === 'success') {
|
if (res && res.status === 'success') {
|
||||||
toast(temp ? '임시저장되었습니다' : '저장되었습니다');
|
toast(temp ? '임시저장되었습니다' : '저장되었습니다');
|
||||||
|
savedSnapshot = JSON.stringify(state.data); // 저장 성공 시점을 새 저장 기준선으로 갱신
|
||||||
var badge = $('#hdr-source'); if (badge) { badge.textContent = '저장본'; badge.className = 'ml-1 px-2 py-0.5 text-[11px] rounded-full bg-emerald-50 text-emerald-700 border border-emerald-200'; badge.classList.remove('hidden'); }
|
var badge = $('#hdr-source'); if (badge) { badge.textContent = '저장본'; badge.className = 'ml-1 px-2 py-0.5 text-[11px] rounded-full bg-emerald-50 text-emerald-700 border border-emerald-200'; badge.classList.remove('hidden'); }
|
||||||
} else toast('저장 실패: ' + (res && res.errorMsg || ''), 'error');
|
} else toast('저장 실패: ' + (res && res.errorMsg || ''), 'error');
|
||||||
})
|
})
|
||||||
@@ -2102,6 +2111,7 @@
|
|||||||
// ============================================================
|
// ============================================================
|
||||||
function init() {
|
function init() {
|
||||||
loadInitialData().then(function () {
|
loadInitialData().then(function () {
|
||||||
|
savedSnapshot = JSON.stringify(state.data); // 초기 로드(자동생성 포함) 완료 시점을 저장 기준선으로 설정
|
||||||
renderStepper();
|
renderStepper();
|
||||||
renderForm();
|
renderForm();
|
||||||
bindGlobalEvents();
|
bindGlobalEvents();
|
||||||
|
|||||||
@@ -7,6 +7,19 @@
|
|||||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||||
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
|
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
|
||||||
<%@ include file="/jsp/common/include/localemessage.jsp" %>
|
<%@ include file="/jsp/common/include/localemessage.jsp" %>
|
||||||
|
<%
|
||||||
|
// 비밀번호 규칙 안내문구용 모니터링 프로퍼티 조회
|
||||||
|
com.eactive.eai.rms.common.context.MonitoringContext monitoringContext =
|
||||||
|
(com.eactive.eai.rms.common.context.MonitoringContext) WebApplicationContextUtils
|
||||||
|
.getRequiredWebApplicationContext(pageContext.getServletContext())
|
||||||
|
.getBean("monitoringContext");
|
||||||
|
int pwdLengthCheck = monitoringContext.getIntProperty(
|
||||||
|
com.eactive.eai.rms.common.context.MonitoringContext.RMS_PASSWORD_LENGTH_CHECK, 7);
|
||||||
|
int pwdCombiCheck = monitoringContext.getIntProperty(
|
||||||
|
com.eactive.eai.rms.common.context.MonitoringContext.RMS_PASSWORD_COMBI_CHECK, 2);
|
||||||
|
int pwdRepeatCheck = monitoringContext.getIntProperty(
|
||||||
|
com.eactive.eai.rms.common.context.MonitoringContext.RMS_PASSWORD_REPEAT_CHECK, 3);
|
||||||
|
%>
|
||||||
<c:set var="themeColor" value="<%=System.getProperty(\"theme.color\")%>" scope="session" />
|
<c:set var="themeColor" value="<%=System.getProperty(\"theme.color\")%>" scope="session" />
|
||||||
|
|
||||||
<%
|
<%
|
||||||
@@ -92,6 +105,7 @@
|
|||||||
data: $('#loginForm').serialize(),
|
data: $('#loginForm').serialize(),
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
|
console.log('res', response)
|
||||||
if (response.changePassword) {
|
if (response.changePassword) {
|
||||||
showChangeInitPassword(response);
|
showChangeInitPassword(response);
|
||||||
}
|
}
|
||||||
@@ -103,8 +117,14 @@
|
|||||||
// 직접 로그인 성공
|
// 직접 로그인 성공
|
||||||
window.location.href = response.redirectUrl;
|
window.location.href = response.redirectUrl;
|
||||||
} else {
|
} else {
|
||||||
// 로그인 실패
|
if (response.errorMessage == 'NO_PHONE_NUMBER') {
|
||||||
alert('로그인에 실패했습니다');
|
alert("휴대폰번호가 등록되어 있지 않아 로그인할 수 없습니다. 관리자에게 문의하세요")
|
||||||
|
} else if (response.errorMessage == 'FAIL_SEND_AUTH') {
|
||||||
|
alert("인증번호 발송에 실패했습니다. 잠시 후 다시 시도해주세요.")
|
||||||
|
} else {
|
||||||
|
// 로그인 실패
|
||||||
|
alert('로그인에 실패했습니다');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
@@ -481,8 +501,8 @@
|
|||||||
<input type="password" name="confirmPassword" class="form-control rounded-left" placeholder="<%= localeMessage.getString("login.placeholderConfirmationPassword") %>" autocomplete="off" required>
|
<input type="password" name="confirmPassword" class="form-control rounded-left" placeholder="<%= localeMessage.getString("login.placeholderConfirmationPassword") %>" autocomplete="off" required>
|
||||||
</div>
|
</div>
|
||||||
<span style="font-size:0.8em; color:red">
|
<span style="font-size:0.8em; color:red">
|
||||||
※ 7글자 이상 & 영문/숫자/특수문자 2종류 이상<br/>
|
※ <%= pwdLengthCheck %>글자 이상 & 영문/숫자/특수문자 <%= pwdCombiCheck %>종류 이상<br/>
|
||||||
※ 연속된 숫자/문자(예: 123, abc, qwer), 동일 문자 3자 이상 반복 사용 불가
|
※ 연속된 숫자/문자(예: 123, abc, qwer) 사용 불가<%= pwdRepeatCheck >= 2 ? ", 동일 문자 " + pwdRepeatCheck + "자 이상 반복 불가" : "" %>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
|
|||||||
@@ -179,8 +179,8 @@
|
|||||||
autowidth: true,
|
autowidth: true,
|
||||||
viewrecords : true,
|
viewrecords : true,
|
||||||
gridview : true,
|
gridview : true,
|
||||||
ondblClickRow : function(rowId) {
|
ondblClickRow : function(rowId) {
|
||||||
console.log("rowId", rowId);
|
/* console.log("rowId", rowId);
|
||||||
var rowData = $(this)
|
var rowData = $(this)
|
||||||
.getRowData(rowId);
|
.getRowData(rowId);
|
||||||
var key = rowData['EaiSevrInstncName'];
|
var key = rowData['EaiSevrInstncName'];
|
||||||
@@ -193,7 +193,7 @@
|
|||||||
url2 += "&searchAdptrBzwkGroupName="
|
url2 += "&searchAdptrBzwkGroupName="
|
||||||
+ key2;
|
+ key2;
|
||||||
url2 += '&menuId='+'${param.menuId}';
|
url2 += '&menuId='+'${param.menuId}';
|
||||||
goNav(url2);
|
goNav(url2); */
|
||||||
},
|
},
|
||||||
loadComplete : function(d) {
|
loadComplete : function(d) {
|
||||||
$("button[name*=img]").unbind("click");
|
$("button[name*=img]").unbind("click");
|
||||||
|
|||||||
@@ -308,7 +308,8 @@
|
|||||||
dataType: "json",
|
dataType: "json",
|
||||||
data: {
|
data: {
|
||||||
cmd: 'SYNC_PORTAL',
|
cmd: 'SYNC_PORTAL',
|
||||||
clientId: clientId
|
clientId: clientId,
|
||||||
|
serviceType: 'APIGW'
|
||||||
},
|
},
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
showSyncResultModal(response);
|
showSyncResultModal(response);
|
||||||
@@ -453,8 +454,8 @@
|
|||||||
</div><!-- end content_top -->
|
</div><!-- end content_top -->
|
||||||
<div class="content_middle">
|
<div class="content_middle">
|
||||||
<div class="search_wrap">
|
<div class="search_wrap">
|
||||||
<!-- <button type="button" class="cssbtn" id="btn_sync_portal" level="W" status="DETAIL"><i class="material-icons">sync</i> 개발자포탈 정보 반영
|
<button type="button" class="cssbtn" id="btn_sync_portal" level="W" status="DETAIL"><i class="material-icons">sync</i> 개발자포탈 정보 반영
|
||||||
</button> -->
|
</button>
|
||||||
<button type="button" class="cssbtn" id="btn_delete" level="W" status="DETAIL"><i class="material-icons">delete</i> <%= localeMessage.getString("button.delete") %>
|
<button type="button" class="cssbtn" id="btn_delete" level="W" status="DETAIL"><i class="material-icons">delete</i> <%= localeMessage.getString("button.delete") %>
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="cssbtn" id="btn_modify" level="W" status="DETAIL,NEW"><i
|
<button type="button" class="cssbtn" id="btn_modify" level="W" status="DETAIL,NEW"><i
|
||||||
@@ -741,7 +742,7 @@ function showSyncResultModal(response) {
|
|||||||
if (response.success) {
|
if (response.success) {
|
||||||
statusClass = "status-success";
|
statusClass = "status-success";
|
||||||
var createdCount = response.createdApiSpecCount || 0;
|
var createdCount = response.createdApiSpecCount || 0;
|
||||||
var createdMsg = createdCount > 0 ? "<br/><span style='color:#007bff;'>* " + createdCount + "개의 API Spec이 자동 생성되었습니다.</span>" : "";
|
var createdMsg = createdCount > 0 ? "<br/><span style='color:#007bff;'>* " + createdCount + "개의 API Spec을 비공개(N)로 자동 생성했습니다. API Spec 관리에서 확인 후 공개하세요.</span>" : "";
|
||||||
|
|
||||||
if (response.action === 'INSERTED') {
|
if (response.action === 'INSERTED') {
|
||||||
statusMsg = "<strong>반영 완료</strong> - 포탈에 새로운 인증정보가 생성되었습니다." + createdMsg;
|
statusMsg = "<strong>반영 완료</strong> - 포탈에 새로운 인증정보가 생성되었습니다." + createdMsg;
|
||||||
@@ -771,6 +772,7 @@ function showSyncResultModal(response) {
|
|||||||
var syncedApis = response.syncedApis || [];
|
var syncedApis = response.syncedApis || [];
|
||||||
var invalidApis = response.invalidApis || [];
|
var invalidApis = response.invalidApis || [];
|
||||||
var createdApiSpecs = response.createdApiSpecs || [];
|
var createdApiSpecs = response.createdApiSpecs || [];
|
||||||
|
var specGenFailed = response.specGenFailed || [];
|
||||||
|
|
||||||
$targetCount.text(targetApis.length);
|
$targetCount.text(targetApis.length);
|
||||||
|
|
||||||
@@ -784,8 +786,11 @@ function showSyncResultModal(response) {
|
|||||||
if (invalidApis.includes(apiId)) {
|
if (invalidApis.includes(apiId)) {
|
||||||
status = "미존재 (APIGW에 없음)";
|
status = "미존재 (APIGW에 없음)";
|
||||||
statusClass = "api-invalid";
|
statusClass = "api-invalid";
|
||||||
|
} else if (specGenFailed.includes(apiId)) {
|
||||||
|
status = "반영됨 (Spec 자동생성 실패·빈 항목)";
|
||||||
|
statusClass = "api-created";
|
||||||
} else if (createdApiSpecs.includes(apiId)) {
|
} else if (createdApiSpecs.includes(apiId)) {
|
||||||
status = "반영됨 (Spec 신규생성)";
|
status = "반영됨 (Spec 자동생성·비공개)";
|
||||||
statusClass = "api-created";
|
statusClass = "api-created";
|
||||||
} else if (syncedApis.includes(apiId)) {
|
} else if (syncedApis.includes(apiId)) {
|
||||||
status = "반영됨";
|
status = "반영됨";
|
||||||
|
|||||||
@@ -97,7 +97,7 @@
|
|||||||
<div class="search_wrap">
|
<div class="search_wrap">
|
||||||
<button type="button" class="cssbtn" id="btn_previous" level="R" status="DETAIL,NEW"><i class="material-icons">arrow_back</i> <%= localeMessage.getString("button.previous") %></button>
|
<button type="button" class="cssbtn" id="btn_previous" level="R" status="DETAIL,NEW"><i class="material-icons">arrow_back</i> <%= localeMessage.getString("button.previous") %></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="title" id="title">전문레이아웃 연동 이력 상세</div>
|
<div class="title" id="title">연동 배포 이력 상세</div>
|
||||||
<table class="table_row" cellspacing="0">
|
<table class="table_row" cellspacing="0">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col style="width:12%"/><col style="width:38%"/>
|
<col style="width:12%"/><col style="width:38%"/>
|
||||||
|
|||||||
@@ -47,6 +47,8 @@
|
|||||||
$('#sentDate').text(data.sentDateFull || '');
|
$('#sentDate').text(data.sentDateFull || '');
|
||||||
// 서버에서 마스킹+escape 된 안전 HTML
|
// 서버에서 마스킹+escape 된 안전 HTML
|
||||||
$('#messageHtml').html(data.messageHtml || '');
|
$('#messageHtml').html(data.messageHtml || '');
|
||||||
|
// 응답내용(RESPONSE_DATA) — 원문이므로 text 로만 출력
|
||||||
|
$('#responseData').text(data.responseData || '');
|
||||||
|
|
||||||
// PENDING 건만 '실패 처리' 노출 (권한 제어는 buttonControl 이 담당)
|
// PENDING 건만 '실패 처리' 노출 (권한 제어는 buttonControl 이 담당)
|
||||||
if (data.requestStatus !== 'PENDING') {
|
if (data.requestStatus !== 'PENDING') {
|
||||||
@@ -142,6 +144,10 @@
|
|||||||
<th>메세지 내용</th>
|
<th>메세지 내용</th>
|
||||||
<td colspan="3"><div id="messageHtml" class="msg-detail"></div></td>
|
<td colspan="3"><div id="messageHtml" class="msg-detail"></div></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>응답내용</th>
|
||||||
|
<td colspan="3"><div id="responseData" class="msg-detail"></div></td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -530,6 +530,10 @@
|
|||||||
if (confirm("<%= localeMessage.getString("common.checkSave")%>") != true) return;
|
if (confirm("<%= localeMessage.getString("common.checkSave")%>") != true) return;
|
||||||
|
|
||||||
var formData = new FormData($("#ajaxForm")[0]);
|
var formData = new FormData($("#ajaxForm")[0]);
|
||||||
|
// Summernote 그림 다이얼로그의 내부 파일 input(name="files")이 #ajaxForm 안에 있어
|
||||||
|
// 선택한 이미지가 지워지지 않고 남아 있으면 여기서 함께 딸려 온다.
|
||||||
|
// 본 화면은 첨부파일 기능을 쓰지 않으므로 항상 제거한다.
|
||||||
|
formData.delete("files");
|
||||||
formData.set("useYn", $("#useYn").is(":checked") ? "Y" : "N");
|
formData.set("useYn", $("#useYn").is(":checked") ? "Y" : "N");
|
||||||
formData.set("fixYn", $("#fixYn").is(":checked") ? "Y" : "N");
|
formData.set("fixYn", $("#fixYn").is(":checked") ? "Y" : "N");
|
||||||
formData.set("noticeDetail", $('#contents').summernote('code'));
|
formData.set("noticeDetail", $('#contents').summernote('code'));
|
||||||
|
|||||||
@@ -70,6 +70,7 @@
|
|||||||
|
|
||||||
// 총건수 도넛 차트
|
// 총건수 도넛 차트
|
||||||
var totalDonutOption = {
|
var totalDonutOption = {
|
||||||
|
color: ['#5470C6', '#FAC858', '#EE6666'],
|
||||||
title: {
|
title: {
|
||||||
text: '총 건수 분포',
|
text: '총 건수 분포',
|
||||||
left: 'center',
|
left: 'center',
|
||||||
@@ -111,7 +112,7 @@
|
|||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
data: [
|
data: [
|
||||||
{ value: 0, name: '성공', itemStyle: { color: '#91CC75' } },
|
{ value: 0, name: '성공', itemStyle: { color: '#5470C6' } },
|
||||||
{ value: 0, name: 'Timeout', itemStyle: { color: '#FAC858' } },
|
{ value: 0, name: 'Timeout', itemStyle: { color: '#FAC858' } },
|
||||||
{ value: 0, name: '시스템오류', itemStyle: { color: '#EE6666' } }
|
{ value: 0, name: '시스템오류', itemStyle: { color: '#EE6666' } }
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -52,6 +52,8 @@
|
|||||||
var url = '<c:url value="/onl/kjb/statistics/apiStatsHourMan.json"/>';
|
var url = '<c:url value="/onl/kjb/statistics/apiStatsHourMan.json"/>';
|
||||||
var url_view = '<c:url value="/onl/kjb/statistics/apiStatsHourMan.view"/>';
|
var url_view = '<c:url value="/onl/kjb/statistics/apiStatsHourMan.view"/>';
|
||||||
var url_minute_view = '<c:url value="/onl/kjb/statistics/apiStatsMinuteMan.view"/>';
|
var url_minute_view = '<c:url value="/onl/kjb/statistics/apiStatsMinuteMan.view"/>';
|
||||||
|
var url_left_menu = '<c:url value="/leftMenu.do"/>';
|
||||||
|
var DASHBOARD_MENU_ID = '0305001'; // apiStatsMinuteMan(대시보드) 메뉴 ID
|
||||||
|
|
||||||
var totalDonutChart, callChart;
|
var totalDonutChart, callChart;
|
||||||
|
|
||||||
@@ -71,6 +73,7 @@
|
|||||||
|
|
||||||
// 총건수 도넛 차트
|
// 총건수 도넛 차트
|
||||||
var totalDonutOption = {
|
var totalDonutOption = {
|
||||||
|
color: ['#5470C6', '#FAC858', '#EE6666'],
|
||||||
title: {
|
title: {
|
||||||
text: '총 건수 분포',
|
text: '총 건수 분포',
|
||||||
left: 'center',
|
left: 'center',
|
||||||
@@ -112,7 +115,7 @@
|
|||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
data: [
|
data: [
|
||||||
{ value: 0, name: '성공', itemStyle: { color: '#91CC75' } },
|
{ value: 0, name: '성공', itemStyle: { color: '#5470C6' } },
|
||||||
{ value: 0, name: 'Timeout', itemStyle: { color: '#FAC858' } },
|
{ value: 0, name: 'Timeout', itemStyle: { color: '#FAC858' } },
|
||||||
{ value: 0, name: '시스템오류', itemStyle: { color: '#EE6666' } }
|
{ value: 0, name: '시스템오류', itemStyle: { color: '#EE6666' } }
|
||||||
]
|
]
|
||||||
@@ -161,23 +164,20 @@
|
|||||||
var hour = parseInt(statTime.substring(8, 10));
|
var hour = parseInt(statTime.substring(8, 10));
|
||||||
|
|
||||||
var startDate = year + '-' + month + '-' + day;
|
var startDate = year + '-' + month + '-' + day;
|
||||||
var startTime = (hour < 10 ? '0' + hour : hour) + ':00';
|
var hourStr = (hour < 10 ? '0' + hour : hour);
|
||||||
|
var startTime = hourStr + ':00';
|
||||||
// 1시간 후 계산 (23시인 경우 다음날 00시로 자동 계산)
|
// 해당 시간대 끝(정시~59분)으로 이동 (예: 10:00~10:59)
|
||||||
var d = new Date(parseInt(year), parseInt(month) - 1, parseInt(day), hour, 0, 0);
|
var endTime = hourStr + ':59';
|
||||||
d.setHours(d.getHours() + 1);
|
|
||||||
|
|
||||||
var endDate = d.getFullYear() + '-' +
|
|
||||||
(d.getMonth() + 1 < 10 ? '0' : '') + (d.getMonth() + 1) + '-' +
|
|
||||||
(d.getDate() < 10 ? '0' : '') + d.getDate();
|
|
||||||
var endTime = (d.getHours() < 10 ? '0' : '') + d.getHours() + ':00';
|
|
||||||
|
|
||||||
var params = '?searchStartDate=' + startDate + '&searchStartTime=' + startTime
|
var params = '?searchStartDate=' + startDate + '&searchStartTime=' + startTime
|
||||||
+ '&searchEndDate=' + endDate + '&searchEndTime=' + endTime;
|
+ '&searchEndDate=' + startDate + '&searchEndTime=' + endTime;
|
||||||
params += '&menuId='+'${param.menuId}';
|
params += '&menuId='+DASHBOARD_MENU_ID;
|
||||||
params += '&cmd='+'LIST';
|
params += '&cmd='+'LIST';
|
||||||
params += '&serviceType='+'APIGW';
|
params += '&serviceType='+'APIGW';
|
||||||
|
|
||||||
|
// 왼쪽 메뉴도 대시보드(분단위 통계) 메뉴로 전환
|
||||||
|
parent.leftFrame.location.href = url_left_menu + '?menuId=' + DASHBOARD_MENU_ID
|
||||||
|
+ '&serviceType=' + sessionStorage["serviceType"];
|
||||||
location.href = url_minute_view + params;
|
location.href = url_minute_view + params;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,6 +63,9 @@
|
|||||||
|
|
||||||
// 총건수 도넛 차트
|
// 총건수 도넛 차트
|
||||||
var totalDonutOption = {
|
var totalDonutOption = {
|
||||||
|
// updateCharts()에서 series[].data를 itemStyle 없이 재설정하면 조각별 itemStyle.color가
|
||||||
|
// 병합 과정에서 유실되므로, 옵션 레벨 color 팔레트(성공/Timeout/시스템오류 순)로 색을 고정한다.
|
||||||
|
color: ['#5470C6', '#FAC858', '#EE6666'],
|
||||||
title: {
|
title: {
|
||||||
text: '총 건수 분포',
|
text: '총 건수 분포',
|
||||||
left: 'center',
|
left: 'center',
|
||||||
@@ -104,7 +107,7 @@
|
|||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
data: [
|
data: [
|
||||||
{ value: 0, name: '성공', itemStyle: { color: '#91CC75' } },
|
{ value: 0, name: '성공', itemStyle: { color: '#5470C6' } },
|
||||||
{ value: 0, name: 'Timeout', itemStyle: { color: '#FAC858' } },
|
{ value: 0, name: 'Timeout', itemStyle: { color: '#FAC858' } },
|
||||||
{ value: 0, name: '시스템오류', itemStyle: { color: '#EE6666' } }
|
{ value: 0, name: '시스템오류', itemStyle: { color: '#EE6666' } }
|
||||||
]
|
]
|
||||||
@@ -259,14 +262,14 @@
|
|||||||
var diffMinutes = (end - start) / (1000 * 60);
|
var diffMinutes = (end - start) / (1000 * 60);
|
||||||
|
|
||||||
if (diffMinutes > 60) {
|
if (diffMinutes > 60) {
|
||||||
// 1시간 초과 시 시작 + 1시간으로 조정
|
// 1시간 초과 시 시작시각 기준 1시간치(정시~59분)로 조정
|
||||||
endDateTime = updateEndTime(new Date(start.getTime() + 60 * 60 * 1000));
|
endDateTime = updateEndTime(new Date(start.getTime() + 59 * 60 * 1000));
|
||||||
} else {
|
} else {
|
||||||
endDateTime = formatDateTime(end);
|
endDateTime = formatDateTime(end);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 종료시간 미입력 시 시작 + 1시간으로 설정
|
// 종료시간 미입력 시 시작시각 기준 1시간치(정시~59분)로 설정
|
||||||
endDateTime = updateEndTime(new Date(start.getTime() + 60 * 60 * 1000));
|
endDateTime = updateEndTime(new Date(start.getTime() + 59 * 60 * 1000));
|
||||||
}
|
}
|
||||||
|
|
||||||
return { start: startDateTime, end: endDateTime };
|
return { start: startDateTime, end: endDateTime };
|
||||||
@@ -322,8 +325,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 조회기간을 정시 단위 1시간 구간으로 이동 (direction: -1 이전, 1 이후)
|
// 조회기간을 정시 단위 1시간 구간으로 이동 (direction: -1 이전, 1 이후)
|
||||||
// ex) 시작 08:35, 이전 클릭 -> 08:00~09:00, 다시 -> 07:00~08:00
|
// ex) 시작 08:35, 이전 클릭 -> 08:00~08:59, 다시 -> 07:00~07:59
|
||||||
// ex) 시작 08:35, 이후 클릭 -> 09:00~10:00, 다시 -> 10:00~11:00
|
// ex) 시작 08:35, 이후 클릭 -> 09:00~09:59, 다시 -> 10:00~10:59
|
||||||
function shiftTimeRange(direction) {
|
function shiftTimeRange(direction) {
|
||||||
var startDate = $("input[name=searchStartDate]").val().replace(/-/g, "");
|
var startDate = $("input[name=searchStartDate]").val().replace(/-/g, "");
|
||||||
var startTime = $("input[name=searchStartTime]").val().replace(/:/g, "");
|
var startTime = $("input[name=searchStartTime]").val().replace(/:/g, "");
|
||||||
@@ -347,7 +350,8 @@
|
|||||||
start.setHours(start.getHours() + 1);
|
start.setHours(start.getHours() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
var end = new Date(start.getTime() + 60 * 60 * 1000);
|
// 종료시각은 같은 시간대의 59분으로 설정 (예: 10:00~10:59)
|
||||||
|
var end = new Date(start.getTime() + 59 * 60 * 1000);
|
||||||
|
|
||||||
function pad(n) { return String(n).padStart(2, '0'); }
|
function pad(n) { return String(n).padStart(2, '0'); }
|
||||||
|
|
||||||
@@ -577,9 +581,9 @@
|
|||||||
|
|
||||||
$("input[name=searchStartDate]").datepicker();
|
$("input[name=searchStartDate]").datepicker();
|
||||||
|
|
||||||
// 기본값 설정 (현재 시간(분) 기준 1시간 전 ~ 현재 시간(분))
|
// 기본값 설정 (현재 시간(분) 기준 59분 전 ~ 현재 시간(분))
|
||||||
var now = new Date();
|
var now = new Date();
|
||||||
var oneHourAgo = new Date(now.getTime() - 60 * 60 * 1000);
|
var oneHourAgo = new Date(now.getTime() - 59 * 60 * 1000);
|
||||||
|
|
||||||
function formatDate(d) {
|
function formatDate(d) {
|
||||||
return d.getFullYear() + '-' +
|
return d.getFullYear() + '-' +
|
||||||
|
|||||||
@@ -58,6 +58,7 @@
|
|||||||
|
|
||||||
// 총건수 도넛 차트
|
// 총건수 도넛 차트
|
||||||
var totalDonutOption = {
|
var totalDonutOption = {
|
||||||
|
color: ['#5470C6', '#FAC858', '#EE6666'],
|
||||||
title: {
|
title: {
|
||||||
text: '총 건수 분포',
|
text: '총 건수 분포',
|
||||||
left: 'center',
|
left: 'center',
|
||||||
@@ -99,7 +100,7 @@
|
|||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
data: [
|
data: [
|
||||||
{ value: 0, name: '성공', itemStyle: { color: '#91CC75' } },
|
{ value: 0, name: '성공', itemStyle: { color: '#5470C6' } },
|
||||||
{ value: 0, name: 'Timeout', itemStyle: { color: '#FAC858' } },
|
{ value: 0, name: 'Timeout', itemStyle: { color: '#FAC858' } },
|
||||||
{ value: 0, name: '시스템오류', itemStyle: { color: '#EE6666' } }
|
{ value: 0, name: '시스템오류', itemStyle: { color: '#EE6666' } }
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -58,6 +58,7 @@
|
|||||||
|
|
||||||
// 총건수 도넛 차트
|
// 총건수 도넛 차트
|
||||||
var totalDonutOption = {
|
var totalDonutOption = {
|
||||||
|
color: ['#5470C6', '#FAC858', '#EE6666'],
|
||||||
title: {
|
title: {
|
||||||
text: '총 건수 분포',
|
text: '총 건수 분포',
|
||||||
left: 'center',
|
left: 'center',
|
||||||
@@ -99,7 +100,7 @@
|
|||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
data: [
|
data: [
|
||||||
{ value: 0, name: '성공', itemStyle: { color: '#91CC75' } },
|
{ value: 0, name: '성공', itemStyle: { color: '#5470C6' } },
|
||||||
{ value: 0, name: 'Timeout', itemStyle: { color: '#FAC858' } },
|
{ value: 0, name: 'Timeout', itemStyle: { color: '#FAC858' } },
|
||||||
{ value: 0, name: '시스템오류', itemStyle: { color: '#EE6666' } }
|
{ value: 0, name: '시스템오류', itemStyle: { color: '#EE6666' } }
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -38,6 +38,13 @@
|
|||||||
success: function (json) {
|
success: function (json) {
|
||||||
new makeOptions("BIZCODE", "BIZNAME").setObj($("select[name=searchEaiBzwkDstcd]")).setNoValueInclude(true).setNoValue("", "전체").setData(json.bizList).setFormat(codeName3OptionFormat).rendering();
|
new makeOptions("BIZCODE", "BIZNAME").setObj($("select[name=searchEaiBzwkDstcd]")).setNoValueInclude(true).setNoValue("", "전체").setData(json.bizList).setFormat(codeName3OptionFormat).rendering();
|
||||||
|
|
||||||
|
var apiGroupSelect = $('select[name=searchApiGroupId]').empty();
|
||||||
|
apiGroupSelect.append($('<option>').val('').text('전체'));
|
||||||
|
apiGroupSelect.append($('<option>').val('UNREGISTERED').text('미등록'));
|
||||||
|
(json.apiGroupList || []).forEach(function (group) {
|
||||||
|
apiGroupSelect.append($('<option>').val(group.id).text(group.groupName));
|
||||||
|
});
|
||||||
|
|
||||||
setSearchable(selectName); // 콤보에 searchable 설정
|
setSearchable(selectName); // 콤보에 searchable 설정
|
||||||
putSelectFromParam();
|
putSelectFromParam();
|
||||||
|
|
||||||
@@ -86,6 +93,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function specStatusFormatter(cellvalue, options, rowObject) {
|
||||||
|
switch (cellvalue) {
|
||||||
|
case 'PUBLISHED':
|
||||||
|
var groupNames = rowObject.publishedGroupNames || [];
|
||||||
|
var tooltip = groupNames.length ? groupNames.join('\n') : '게시된 그룹 없음';
|
||||||
|
return $('<span>').text('게시(' + groupNames.length + ')').attr('title', tooltip).css('cursor', 'help').prop('outerHTML');
|
||||||
|
case 'REGISTERED': return '등록';
|
||||||
|
default: return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function list() {
|
function list() {
|
||||||
detail()
|
detail()
|
||||||
var gridPostData = getSearchForJqgrid("cmd", "LIST"); //jqgrid에서는 object 로
|
var gridPostData = getSearchForJqgrid("cmd", "LIST"); //jqgrid에서는 object 로
|
||||||
@@ -101,6 +119,7 @@
|
|||||||
'요청',
|
'요청',
|
||||||
'응답',
|
'응답',
|
||||||
'상태',
|
'상태',
|
||||||
|
'스펙 상태',
|
||||||
'작성자',
|
'작성자',
|
||||||
'가상응답여부',
|
'가상응답여부',
|
||||||
'변경일시(*)',
|
'변경일시(*)',
|
||||||
@@ -113,6 +132,7 @@
|
|||||||
{name: 'fromAdapter', align: 'center', width: '30', formatter: adapterNameShortFormatter, sortable: false},
|
{name: 'fromAdapter', align: 'center', width: '30', formatter: adapterNameShortFormatter, sortable: false},
|
||||||
{name: 'toAdapter', align: 'center', width: '30', formatter: adapterNameShortFormatter, sortable: false},
|
{name: 'toAdapter', align: 'center', width: '30', formatter: adapterNameShortFormatter, sortable: false},
|
||||||
{name: 'statusCode', align: 'center', width: '30', formatter: apiStatusFormatter, sortable: false},
|
{name: 'statusCode', align: 'center', width: '30', formatter: apiStatusFormatter, sortable: false},
|
||||||
|
{name: 'specStatus', align: 'center', width: '40', formatter: specStatusFormatter, sortable: false, title: false},
|
||||||
{name: 'author', align: 'center', width: '40', sortable: false},
|
{name: 'author', align: 'center', width: '40', sortable: false},
|
||||||
{name : 'simYn', align : 'center' , width:'40', hidden: true },
|
{name : 'simYn', align : 'center' , width:'40', hidden: true },
|
||||||
{name : 'lastModifiedDate', align : 'center' , width:'60', sortable: true},
|
{name : 'lastModifiedDate', align : 'center' , width:'60', sortable: true},
|
||||||
@@ -421,6 +441,14 @@
|
|||||||
<td>
|
<td>
|
||||||
<select name="searchEaiBzwkDstcd" value="${param.searchEaiBzwkDstcd}"></select>
|
<select name="searchEaiBzwkDstcd" value="${param.searchEaiBzwkDstcd}"></select>
|
||||||
</td>
|
</td>
|
||||||
|
<th style="width:180px;">당타발 구분</th>
|
||||||
|
<td>
|
||||||
|
<select name="searchInOutType" style="width: 100%">
|
||||||
|
<option value="">전체</option>
|
||||||
|
<option value="1">당발</option>
|
||||||
|
<option value="2">타발</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
<th style="width:180px;">상태</th>
|
<th style="width:180px;">상태</th>
|
||||||
<td>
|
<td>
|
||||||
<select name="searchStatusCode" style="width: 100%">
|
<select name="searchStatusCode" style="width: 100%">
|
||||||
@@ -431,6 +459,24 @@
|
|||||||
<option value="C">점검</option>
|
<option value="C">점검</option>
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th style="width:180px;">API 스펙 상태</th>
|
||||||
|
<td>
|
||||||
|
<select name="searchSpecStatus" style="width: 100%">
|
||||||
|
<option value="">전체</option>
|
||||||
|
<option value="UNREGISTERED">미등록</option>
|
||||||
|
<option value="REGISTERED">등록</option>
|
||||||
|
<option value="PUBLISHED">게시</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
<th style="width:180px;">API 그룹</th>
|
||||||
|
<td>
|
||||||
|
<select name="searchApiGroupId" style="width: 100%">
|
||||||
|
<option value="">전체</option>
|
||||||
|
<option value="UNREGISTERED">미등록</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
<th></th><td></td>
|
<th></th><td></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -467,4 +513,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+13
-3
@@ -113,9 +113,9 @@ dependencies {
|
|||||||
// https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api
|
// https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api
|
||||||
compileOnly group: 'javax.servlet', name: 'javax.servlet-api', version: '4.0.1'
|
compileOnly group: 'javax.servlet', name: 'javax.servlet-api', version: '4.0.1'
|
||||||
|
|
||||||
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.13.1'
|
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.13.2.2'
|
||||||
//implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-xml', version: '2.13.1'
|
//implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-xml', version: '2.13.1'
|
||||||
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.1'
|
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.2'
|
||||||
|
|
||||||
// apistatus-draft.yml (자동 탐지 초안 양식) 로딩용.
|
// apistatus-draft.yml (자동 탐지 초안 양식) 로딩용.
|
||||||
// admin 은 Spring Boot 가 아니라 yml 자동 바인딩이 없어 직접 파싱한다.
|
// admin 은 Spring Boot 가 아니라 yml 자동 바인딩이 없어 직접 파싱한다.
|
||||||
@@ -140,13 +140,18 @@ dependencies {
|
|||||||
|
|
||||||
implementation "org.apache.ibatis:ibatis-sqlmap:2.3.4.726"
|
implementation "org.apache.ibatis:ibatis-sqlmap:2.3.4.726"
|
||||||
implementation "org.jdom:jdom:1.1"
|
implementation "org.jdom:jdom:1.1"
|
||||||
implementation "com.google.code.gson:gson:2.3.1"
|
implementation "com.google.code.gson:gson:2.8.9"
|
||||||
implementation "javax.annotation:javax.annotation-api:1.2"
|
implementation "javax.annotation:javax.annotation-api:1.2"
|
||||||
implementation "net.sf.json-lib:json-lib-ext-spring:1.0.2"
|
implementation "net.sf.json-lib:json-lib-ext-spring:1.0.2"
|
||||||
implementation "taglibs:standard:1.1.2"
|
implementation "taglibs:standard:1.1.2"
|
||||||
implementation "javax.servlet:jstl:1.1.2"
|
implementation "javax.servlet:jstl:1.1.2"
|
||||||
implementation group: 'com.jcraft', name: 'jsch', version: '0.1.51'
|
implementation group: 'com.jcraft', name: 'jsch', version: '0.1.51'
|
||||||
|
|
||||||
|
// springapp-servlet.xml 의 CommonsMultipartResolver 가 사용.
|
||||||
|
// 기존엔 elink-online-common(api 'commons-fileupload:1.5')에서 전이적으로 받아왔으나,
|
||||||
|
// eapim-online 쪽에서 해당 의존성을 제거할 예정이라 직접 선언으로 전환.
|
||||||
|
implementation "commons-fileupload:commons-fileupload:1.6.0"
|
||||||
|
|
||||||
implementation "org.quartz-scheduler:quartz:${quartzVersion}"
|
implementation "org.quartz-scheduler:quartz:${quartzVersion}"
|
||||||
|
|
||||||
// https://mvnrepository.com/artifact/org.apache.poi/poi
|
// https://mvnrepository.com/artifact/org.apache.poi/poi
|
||||||
@@ -234,6 +239,11 @@ configurations.all {
|
|||||||
// 일부 transitive 가 끌어오는 xml-apis:1.0.b2 (2002, DOM L2) 는 이 클래스를 포함하지 않아
|
// 일부 transitive 가 끌어오는 xml-apis:1.0.b2 (2002, DOM L2) 는 이 클래스를 포함하지 않아
|
||||||
// xercesImpl 가 NoClassDefFoundError 를 일으킴 → 1.4.01 로 강제 통일.
|
// xercesImpl 가 NoClassDefFoundError 를 일으킴 → 1.4.01 로 강제 통일.
|
||||||
force 'xml-apis:xml-apis:1.4.01'
|
force 'xml-apis:xml-apis:1.4.01'
|
||||||
|
|
||||||
|
// logback 1.2.10 은 SLF4J 1.7 바인딩(StaticLoggerBinder)만 제공한다.
|
||||||
|
// transitive (Java-WebSocket:1.5.7 등) 가 slf4j-api 2.x 를 끌어올리면
|
||||||
|
// SLF4J 가 provider 를 못 찾아 NOP 로거로 폴백 → 콘솔/파일 로그가 전부 사라진다.
|
||||||
|
force 'org.slf4j:slf4j-api:1.7.36'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
POST http://localhost:7090/monitoring/_onl/admin/authserver/clientMan.json?serviceType=APIGW
|
POST http://localhost:7090/monitoring/_onl/admin/authserver/clientMan.json?serviceType=APIGW
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
User-Agent: insomnia/10.1.1
|
User-Agent: insomnia/10.1.1
|
||||||
X-API-KEY: EAPIM_KEY
|
X-Internal-Token: {{internalApiToken}}
|
||||||
action: insert
|
action: insert
|
||||||
target_host: stg
|
target_host: stg
|
||||||
|
|
||||||
@@ -118,4 +118,4 @@ target_host: stg
|
|||||||
"errTransformYn": "N"
|
"errTransformYn": "N"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,470 +1,368 @@
|
|||||||
# EAPIM Admin
|
# eapim-admin
|
||||||
|
|
||||||
광주은행 엔터프라이즈 API 관리 시스템 - 관리 콘솔
|
제주은행(DJB) eLink EMS 관리 콘솔
|
||||||
|
|
||||||
## 프로젝트 개요
|
## 개요
|
||||||
|
|
||||||
**EAPIM Admin**은 광주은행의 eLink EMS (eLink Management System) 관리 콘솔로, API 게이트웨이 구성, 모니터링, 통계, 트랜잭션 로그 조회 기능을 제공하는 웹 기반 플랫폼입니다.
|
**eapim-admin** 은 eLink EMS(eLink Management System)의 웹 기반 관리 콘솔입니다.
|
||||||
|
API 게이트웨이 구성, 실시간 모니터링/대시보드, 통계, 트랜잭션 로그 조회, 인터페이스·레이아웃·어댑터·라우팅 관리 기능을 제공합니다.
|
||||||
|
|
||||||
|
eLink EMS 는 세 가지 애플리케이션으로 구성됩니다.
|
||||||
|
|
||||||
|
| 애플리케이션 | 설명 |
|
||||||
|
|---|---|
|
||||||
|
| **eapim-admin** | 관리 콘솔 (이 저장소) |
|
||||||
|
| eapim-online | 실시간 트랜잭션 처리 API 게이트웨이 |
|
||||||
|
| eapim-portal | API 소비자용 개발자 포털 (Spring Boot) |
|
||||||
|
|
||||||
|
> 패키지·클래스에 남아 있는 `kjb` / `KJB` 명칭은 초기 광주은행 커스터마이징에서 유래한 것으로,
|
||||||
|
> 현재 배포 대상은 제주은행(DJB)입니다. 제주은행 전용 코드는 `com.eactive.eai.rms.ext.djb` 하위에 있습니다.
|
||||||
|
|
||||||
## 기술 스택
|
## 기술 스택
|
||||||
|
|
||||||
- Spring Framework 5.3.27
|
| 구분 | 버전 / 내용 |
|
||||||
- Java 17
|
|---|---|
|
||||||
- Gradle 8.7
|
| Java | **8** (Gradle toolchain 으로 강제, `JavaLanguageVersion.of(8)`) |
|
||||||
- Oracle 19c
|
| 빌드 | Gradle **8.7** (wrapper), `war` 패키징 |
|
||||||
- Spring Data JPA 2.5.2
|
| Spring Framework | 5.3.27 (MVC / ORM / JDBC) |
|
||||||
- Hibernate 5.4.33/5.6.15
|
| Spring Data JPA | 2.5.2 |
|
||||||
- QueryDSL 5.0.0
|
| Hibernate | 5.6.15.Final |
|
||||||
- iBATIS 2.3.4 (레거시 SQL 매핑)
|
| QueryDSL | 5.0.0 (빌드 시 Q-class 생성) |
|
||||||
- Quartz 2.2.1
|
| iBATIS | 2.3.4 (레거시 SQL 매핑) |
|
||||||
- Logback 1.2.10
|
| Quartz | 2.2.1 (스케줄링) |
|
||||||
|
| 로깅 | SLF4J + Logback 1.2.10 (모든 `log4j` 의존성 제외) |
|
||||||
|
| 기타 | Apache POI 3.17(Excel), Jackson 2.13.1, AWS SDK 2.x(S3), EhCache, Lombok, MapStruct |
|
||||||
|
|
||||||
## 초기 세팅 가이드
|
애플리케이션 프레임워크는 Spring Boot 가 아닌 전통적 Spring 5.3 WAR 이며 Tomcat / WebLogic 등에 배포됩니다.
|
||||||
|
(Spring Boot 는 테스트 유틸리티 `spring-boot-starter-test:2.6.15` 에만 사용)
|
||||||
|
|
||||||
### 사전 요구사항
|
## 사전 요구사항
|
||||||
|
|
||||||
- JDK 17 이상
|
- **JDK 8** - `.envrc`(direnv) 또는 셸 rc 에서 `JAVA_HOME` 을 JDK 8 위치로 export. Gradle 8 toolchain auto-detect 가 `JAVA_HOME` 도 후보로 인식합니다. `gradle.properties` 에 JDK 경로를 넣지 않습니다.
|
||||||
- Gradle 8.7
|
|
||||||
- Git
|
- Git
|
||||||
- Oracle 19c (또는 개발 환경에 따라 접근 가능한 DB)
|
- Oracle 접근 (개발/테스트 환경에 따라). 테스트는 H2 인메모리 DB 사용.
|
||||||
|
- **형제 디렉토리 체크아웃 필요** - 멀티 모듈 프로젝트로 아래 저장소가 같은 부모 디렉토리에 있어야 합니다.
|
||||||
|
```
|
||||||
|
<workspace>/
|
||||||
|
├── eapim-admin/ # 이 저장소
|
||||||
|
├── eapim-online/ # elink-online-* 모듈
|
||||||
|
└── elink-portal-common/ # 포털 공통 JPA 엔티티
|
||||||
|
```
|
||||||
|
|
||||||
### 환경별 설정 파일
|
## 멀티 모듈 구조
|
||||||
프로젝트 클론 후 필요한 환경 설정을 수정하세요:
|
|
||||||
|
|
||||||
- `WebContent/WEB-INF/properties/env.D.properties` - 개발 환경
|
`settings.gradle` 에서 형제 디렉토리의 소스 프로젝트를 참조합니다.
|
||||||
- `WebContent/WEB-INF/properties/env.T.properties` - 테스트/스테이징 환경
|
|
||||||
- `WebContent/WEB-INF/properties/env.P.properties` - 운영 환경
|
|
||||||
|
|
||||||
|
| 모듈 | 위치 | 설명 |
|
||||||
|
|---|---|---|
|
||||||
|
| elink-online-core | `../eapim-online/elink-online-core` | 핵심 인터페이스 / 도메인 모델 |
|
||||||
|
| elink-online-core-jpa | `../eapim-online/elink-online-core-jpa` | JPA 엔티티 / 리포지토리 |
|
||||||
|
| elink-online-transformer | `../eapim-online/elink-online-transformer` | 메시지 변환 로직 |
|
||||||
|
| elink-online-common | `../eapim-online/elink-online-common` | 공통 유틸리티 |
|
||||||
|
| elink-online-emsclient | `../eapim-online/elink-online-emsclient` | EMS 통신 클라이언트 |
|
||||||
|
| elink-portal-common | `../elink-portal-common` | 포털 공통 컴포넌트 (JPA 엔티티) |
|
||||||
|
|
||||||
### 주의사항
|
> `kjb-safedb`, `eapim-admin-djb` 는 `settings.gradle` 에 주석 처리되어 있으며,
|
||||||
- **SafeDB**: 암호화 기능이 필요한 경우 `-Dkjb_safedb.mode=fake` 설정 (개발 환경) 또는 실제 SafeDB 라이브러리 설치
|
> 필요 시 주석을 해제하고 해당 디렉토리를 체크아웃합니다.
|
||||||
- **멀티 모듈 구조**: eapim-online의 여러 모듈들을 참조하므로 반드시 eapim-online도 클론해야 합니다
|
|
||||||
|
|
||||||
|
|
||||||
## 빌드 및 실행
|
## 빌드 및 실행
|
||||||
|
|
||||||
### Gradle 명령어
|
|
||||||
|
|
||||||
프로젝트 루트의 Gradle wrapper(`./gradlew`) 를 사용합니다.
|
프로젝트 루트의 Gradle wrapper(`./gradlew`) 를 사용합니다.
|
||||||
|
|
||||||
### 빌드 및 실행 명령어
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 표준 빌드
|
# 표준 빌드
|
||||||
./gradlew build
|
./gradlew build
|
||||||
|
|
||||||
# Weblogic 배포용 빌드 (테스트 제외)
|
|
||||||
./gradlew build -x test -Pprofile=weblogic
|
|
||||||
|
|
||||||
# WAR 파일 빌드[ems_stdout.log](../../logs/emsSvr-RinjaeMA/ems_stdout.log)
|
|
||||||
./gradlew war
|
|
||||||
|
|
||||||
# 클린 빌드
|
# 클린 빌드
|
||||||
./gradlew clean build
|
./gradlew clean build
|
||||||
|
|
||||||
# 테스트 실행
|
# WAR 빌드 (build/libs/eapim-admin.war)
|
||||||
./gradlew test
|
./gradlew war
|
||||||
|
|
||||||
# 패키징 없이 클래스만 컴파일
|
# WebLogic 배포용 빌드 (테스트 제외, weblogic-web.xml 사용)
|
||||||
|
./gradlew build -x test -Pprofile=weblogic
|
||||||
|
|
||||||
|
# 패키징 없이 컴파일만
|
||||||
./gradlew classes
|
./gradlew classes
|
||||||
|
|
||||||
# QueryDSL Q-classes 및 기타 애노테이션 생성
|
# QueryDSL Q-class 등 생성 코드만 생성
|
||||||
./gradlew compileJava
|
./gradlew compileJava
|
||||||
|
|
||||||
# 의존성 트리 보기
|
# 전체 테스트
|
||||||
./gradlew dependencies
|
./gradlew test
|
||||||
|
|
||||||
# 사용 가능한 모든 태스크 목록
|
# 특정 테스트
|
||||||
|
./gradlew test --tests "com.eactive.eai.rms.*"
|
||||||
|
|
||||||
|
# 의존성 트리 / 태스크 목록
|
||||||
|
./gradlew dependencies
|
||||||
./gradlew tasks --all
|
./gradlew tasks --all
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- WAR 파일명: `eapim-admin.war`, 컨텍스트 경로: `/monitoring`
|
||||||
|
- 프로필: `-Pprofile=weblogic` 지정 시 `web.xml` 대신 `weblogic-web.xml` 사용 (DefaultServlet 문제 회피)
|
||||||
|
|
||||||
|
## 로컬 개발 빠른 시작
|
||||||
|
|
||||||
|
1. **생성 코드 생성** - 최초 1회 및 pull 이후
|
||||||
|
```bash
|
||||||
|
./gradlew compileJava # Q-class IDE 오류 시: ./gradlew clean compileJava
|
||||||
|
```
|
||||||
|
2. **빌드/테스트**
|
||||||
|
```bash
|
||||||
|
./gradlew build
|
||||||
|
```
|
||||||
|
3. **IDE 열기** - 아래 "IDE 설정" 참조
|
||||||
|
4. **WAS(Tomcat 등) 실행 구성** 에 `eapim-admin` 배포 + 아래 VM 옵션 추가 후 기동
|
||||||
|
|
||||||
|
### 로컬 Tomcat VM 옵션 예시
|
||||||
|
|
||||||
|
전체 목록과 설명은 `CLAUDE.md` 의 "필수 환경 변수 (Tomcat)" 를 참조하세요.
|
||||||
|
|
||||||
|
```
|
||||||
|
-Deai.datasource.type=DEV
|
||||||
|
-Dinst.Name=emsSvr11
|
||||||
|
-Deai.tableowner=EMSADM
|
||||||
|
-Deai.systemmode=D
|
||||||
|
-Dfile.encoding=utf-8
|
||||||
|
-Dlogin.mode=db
|
||||||
|
-DLOGBACK_LOG_LEVEL=DEBUG
|
||||||
|
-Ddamo-manager.enabled=true
|
||||||
|
-Dlogging.log-path=/logs/prod/eapim/emsSvr11
|
||||||
|
-Dlogback.configurationFile=classpath:logback-dev.xml
|
||||||
|
-Dhibernate.dialect=org.hibernate.dialect.Oracle12cDialect
|
||||||
|
```
|
||||||
|
|
||||||
|
- `inst.Name` 은 클러스터 내에서 인스턴스마다 고유해야 합니다.
|
||||||
|
- `eai.tableowner` 는 Oracle 스키마 소유자.
|
||||||
|
|
||||||
## 프로젝트 구조
|
## 프로젝트 구조
|
||||||
|
|
||||||
### 전체 프로젝트 구조
|
|
||||||
```
|
|
||||||
kjb-eapim/
|
|
||||||
├── eapim-admin/ # Admin 관리 콘솔 (현재 프로젝트)
|
|
||||||
├── eapim-online/ # Online 게이트웨이 코어 모듈
|
|
||||||
│ ├── elink-online-core/
|
|
||||||
│ ├── elink-online-core-jpa/
|
|
||||||
│ ├── elink-online-transformer/
|
|
||||||
│ ├── elink-online-common/
|
|
||||||
│ ├── elink-online-emsclient/
|
|
||||||
│ └── elink-online-adapter/
|
|
||||||
├── elink-portal-common/ # 포털 공통 컴포넌트 (JPA 엔티티)
|
|
||||||
├── kjb-safedb/ # SafeDB 암호화 라이브러리
|
|
||||||
└── eapim-portal/ # Portal 개발자 포털 (선택사항)
|
|
||||||
```
|
|
||||||
|
|
||||||
### eapim-admin 내부 구조
|
|
||||||
```
|
```
|
||||||
src/main/java/com/eactive/eai/
|
src/main/java/com/eactive/eai/
|
||||||
├── agent/command - 커맨드 패턴 구현
|
├── agent/command - 커맨드 패턴 구현
|
||||||
├── common/ - 공통 유틸리티, iBatis, JSON 직렬화
|
├── common - 공통 유틸리티, iBatis, JSON 직렬화
|
||||||
├── custom/ - 고객사별 커스터마이제이션
|
├── custom - 고객사별 커스터마이제이션
|
||||||
├── rms/ - 메인 애플리케이션 코드
|
├── rms - 메인 애플리케이션 코드
|
||||||
│ ├── bap/ - 배치 처리 (BAP)
|
│ ├── bap - 배치 처리(BAP): adaptor / manage / tansaction
|
||||||
│ ├── bat/ - 추가 배치 기능
|
│ ├── bat - 추가 배치 기능
|
||||||
│ ├── common/ - RMS 공통 (필터, 시작, 서비스)
|
│ ├── common - RMS 공통 (필터, 시작, 서비스)
|
||||||
│ ├── data/ - 데이터 엔티티, 리포지토리
|
│ ├── data - 데이터 엔티티, 리포지토리
|
||||||
│ ├── env/ - 환경 설정
|
│ ├── env - 환경 설정
|
||||||
│ ├── kakao/ - 카카오 연동
|
│ ├── kakao - 카카오 연동
|
||||||
│ ├── onl/ - 온라인 트랜잭션 관리
|
│ ├── onl - 온라인 트랜잭션 관리 (apim / manage / transaction)
|
||||||
│ └── service/ - 비즈니스 서비스
|
│ ├── service - 비즈니스 서비스
|
||||||
└── ext.kjb/ - 광주은행(KJB) 확장
|
│ └── ext
|
||||||
```
|
│ ├── djb - 제주은행(DJB) 확장 (webhook, UMS 연동, 통계 등)
|
||||||
|
│ └── kjb - 광주은행(KJB) 유래 확장
|
||||||
|
└── (com.eactive.ext.kjb) - 통계 화면 등 일부 확장 코드
|
||||||
|
|
||||||
### 웹 리소스 구조
|
|
||||||
```
|
|
||||||
WebContent/
|
WebContent/
|
||||||
├── WEB-INF/
|
├── WEB-INF/
|
||||||
│ ├── applicationContext.xml - Root Spring 설정
|
│ ├── applicationContext.xml - Root Spring 설정
|
||||||
│ ├── springapp-servlet.xml - Servlet Spring 설정
|
│ ├── springapp-servlet.xml - Servlet Spring 설정
|
||||||
│ ├── web.xml - Tomcat용 배포 디스크립터
|
│ ├── web.xml / weblogic-web.xml
|
||||||
│ ├── weblogic-web.xml - WebLogic용 배포 디스크립터
|
│ └── properties/ - env.D / env.T / env.P / env.L .properties
|
||||||
│ └── properties/ - 환경별 프로퍼티
|
├── jsp/ - 화면
|
||||||
│ ├── env.D.properties - 개발
|
└── guide/ - 사용자 가이드(docsify)
|
||||||
│ ├── env.T.properties - 테스트
|
|
||||||
│ └── env.P.properties - 운영
|
|
||||||
└── guide/ - 사용자 가이드
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## 주요 기능
|
## 데이터 액세스 (하이브리드 ORM)
|
||||||
|
|
||||||
다음과 같은 관리 기능을 수행하며, 모든 관리 대상은 실시간으로 DB, 메모리에 있는 정보가 수정, 반영됩니다.
|
JPA 와 iBATIS 를 함께 사용합니다.
|
||||||
|
|
||||||
| 기능 | 설명 |
|
- **신규 기능**: JPA + Spring Data 리포지토리 (`com.eactive.eai.rms.data.entity`, `elink-portal-common`)
|
||||||
| -------------------- | ------------------------------------------------------------ |
|
- **레거시**: iBATIS SQL 매퍼 `src/main/resources/com/eactive/eai/**/*.xml` (Spring XML 설정, 점진적 마이그레이션 대상)
|
||||||
| 사용자 관리 | 사용자 및 권한을 관리하는 기능 |
|
- 벤더별 매핑: Oracle `*-oracle.xml`, MariaDB `*-mariadb.xml`, PostgreSQL `*-postgresql.xml`
|
||||||
| 로그 조회 | 거래 수행 내역을 조회 하는 기능(온라인/배치/일괄) |
|
|
||||||
| 통계 조회 | 거래 통계 조회 기능 |
|
|
||||||
| 대시보드 조회 | 거래 내역 및 장애상황을 모니터링 할 수 있는 대시보드 조회 기능 |
|
|
||||||
| 인터페이스 관리 | 인터페이스 등록/관리 기능 |
|
|
||||||
| 레이아웃 관리 | 레이아웃 등록/관리 기능 |
|
|
||||||
| 변환 관리 | 변환 등록/관리 기능 |
|
|
||||||
| 어댑터 관리 | 통신 어댑터 등록/관리 기능 |
|
|
||||||
| 라우팅룰 관리 | 라우팅 룰 등록/관리 기능 |
|
|
||||||
| 배치 어댑터 관리 | 배치 어댑터 등록/관리 기능 |
|
|
||||||
| 배치 인터페이스 관리 | 배치 인터페이스 등록/관리 기능 |
|
|
||||||
| 일괄 관리 | 일괄 등록/관리 기능 |
|
|
||||||
|
|
||||||
## 외부 모듈
|
### Multi-tenancy (런타임 스키마 전환)
|
||||||
|
|
||||||
이 프로젝트는 다음 모듈에 의존합니다 (settings.gradle 참조):
|
Hibernate Multi-tenancy 로 요청 시점에 스키마를 전환합니다.
|
||||||
|
`DataSourceContextHolder`(ThreadLocal) → `TenantIdentifierResolver` → `ConfigurableMultiTenantConnectionProvider.setSchema()`.
|
||||||
| 이름 | 버전 | 설명 |
|
요청 파라미터 `serviceType`(예: `APIGW`) 를 `DataSourceTypeInterceptor` 가 읽어 자동 설정하거나, 컨트롤러에서 명시 설정합니다.
|
||||||
| ------------------------ | ------------ | ---------------------------------------------- |
|
자세한 내용은 `CLAUDE.md` 의 "Multi-tenancy" 절 참조.
|
||||||
| elink-online-core | 4.5-SNAPSHOT | 코어 모듈로 인터페이스 클래스 정의 |
|
|
||||||
| elink-online-core-jpa | 4.5-SNAPSHOT | JPA 엔티티 및 리포지토리 |
|
|
||||||
| elink-online-transformer | 4.5-SNAPSHOT | 변환 모듈로 메시지 및 변환 관련 클래스 정의 |
|
|
||||||
| elink-online-adapter | 4.5-SNAPSHOT | 어댑터 모듈로 통신에 필요한 어댑터 클래스 정의 |
|
|
||||||
| elink-online-common | 4.5-SNAPSHOT | 나머지 공통 프로그램이 정의되어있다 |
|
|
||||||
| elink-online-emsclient | 4.5-SNAPSHOT | ems와 통신하기 위한 모듈 |
|
|
||||||
| elink-portal-common | - | 포털 공통 컴포넌트 (JPA 엔티티) |
|
|
||||||
| kjb-safedb | - | 커스텀 암호화 라이브러리 |
|
|
||||||
| eapim-admin-kjb | - | KJB 은행 특화 커스터마이제이션 |
|
|
||||||
|
|
||||||
## 하이브리드 ORM 방식
|
|
||||||
|
|
||||||
이 애플리케이션은 **JPA와 iBATIS 모두를 사용**합니다:
|
|
||||||
- **JPA/Hibernate**: `elink-portal-common`을 통한 현대적인 데이터 액세스 (Spring Data repositories)
|
|
||||||
- **iBATIS**: 기존 코드를 위한 레거시 SQL 매핑 (점진적으로 마이그레이션 예정)
|
|
||||||
|
|
||||||
데이터 액세스 작업 시:
|
|
||||||
- 새로운 기능은 JPA와 Spring Data repositories를 사용해야 합니다
|
|
||||||
- 레거시 iBATIS 매퍼는 `src/main/resources/com/eactive/eai/**/*.xml`에 있으며 Spring XML을 통해 설정됩니다
|
|
||||||
|
|
||||||
## 코드 생성
|
## 코드 생성
|
||||||
|
|
||||||
빌드 프로세스에서 생성되는 것들:
|
빌드 시 생성됩니다.
|
||||||
- **QueryDSL Q-classes**: 타입 안전 쿼리 클래스
|
|
||||||
- **Lombok**: 애노테이션 프로세싱을 통한 Getters/setters/builders
|
|
||||||
- **MapStruct**: DTO와 엔티티 간의 객체 매퍼
|
|
||||||
|
|
||||||
### 이중 Q-Class 생성 (Gradle + Eclipse)
|
|
||||||
|
|
||||||
이 프로젝트는 **Gradle과 Eclipse 애노테이션 프로세서 모두를 사용**하므로, Q-classes가 **두 위치에 생성**됩니다:
|
|
||||||
|
|
||||||
1. **`build/generated/java/`** - `gradle compileJava` 또는 `gradle build` 실행 시 Gradle이 생성
|
|
||||||
2. **`WebContent/generated/`** - Eclipse IDE에서 빌드 시 Eclipse APT가 생성
|
|
||||||
|
|
||||||
**이는 예상된 동작이며 의도적입니다.** 두 디렉토리 모두 `.gitignore`에 포함되어 있으며 커밋해서는 안 됩니다.
|
|
||||||
|
|
||||||
## AI 코딩 어시스턴트 지침 파일
|
|
||||||
|
|
||||||
이 프로젝트는 여러 AI 코딩 어시스턴트를 지원합니다. 각 도구는 다음 파일을 참조합니다:
|
|
||||||
|
|
||||||
### 지침 파일 위치
|
|
||||||
|
|
||||||
| AI 도구 | 지침 파일 경로 | 용도 |
|
|
||||||
|---------|---------------|------|
|
|
||||||
| **Claude Code** | `CLAUDE.md` | 마스터 지침 파일 (한글) |
|
|
||||||
| **GitHub Copilot** | `.github/copilot-instructions.md` | Copilot용 지침 |
|
|
||||||
| **Cursor** | `.cursorrules` | Cursor용 간결한 규칙 |
|
|
||||||
|
|
||||||
### 지침 파일 관리 방법
|
|
||||||
|
|
||||||
1. **마스터 파일**: `CLAUDE.md`
|
|
||||||
- 가장 상세한 프로젝트 지침을 포함
|
|
||||||
- 한글로 작성되어 한국 개발팀이 이해하기 쉬움
|
|
||||||
- 수정 시 이 파일을 먼저 업데이트
|
|
||||||
|
|
||||||
2. **동기화**:
|
|
||||||
```bash
|
|
||||||
# CLAUDE.md 수정 후 다른 파일들 동기화
|
|
||||||
cp CLAUDE.md .github/copilot-instructions.md
|
|
||||||
# .cursorrules는 간결한 버전이므로 필요시 수동 업데이트
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **새로운 AI 도구 지원 추가**:
|
|
||||||
- Windsurf: `.windsurfrules` 파일 생성
|
|
||||||
- 기타 도구: 해당 도구의 규칙 파일명 확인 후 생성
|
|
||||||
|
|
||||||
|
- **QueryDSL Q-class** - `build/generated/java/` 에 생성, `.gitignore` 대상 (커밋 금지)
|
||||||
|
- **Lombok** - getter/setter/builder 등
|
||||||
|
- **MapStruct** - DTO ↔ 엔티티 매퍼
|
||||||
|
|
||||||
|
pull 이후 또는 Q-class IDE 오류 시 `./gradlew compileJava` (또는 `clean compileJava`) 로 재생성합니다.
|
||||||
|
|
||||||
## 환경 설정
|
## 환경 설정
|
||||||
|
|
||||||
### 시스템 모드
|
### 시스템 모드
|
||||||
|
|
||||||
- **D (DEV)**: 개발 환경
|
`-Deai.systemmode` 로 지정하며 해당 프로퍼티 파일을 로드합니다.
|
||||||
- **T (TEST)**: 테스트/스테이징 환경
|
|
||||||
- **P (PROD)**: 운영 환경
|
|
||||||
|
|
||||||
시스템 모드는 `-Deai.systemmode` JVM 옵션으로 설정하며, 해당 환경의 프로퍼티 파일(`env.D.properties` 등)을 로드합니다.
|
| 값 | 환경 | 파일 |
|
||||||
|
|---|---|---|
|
||||||
|
| D | 개발 | `env.D.properties` |
|
||||||
|
| T | 테스트 / 스테이징 | `env.T.properties` |
|
||||||
|
| P | 운영 | `env.P.properties` |
|
||||||
|
| L | 로컬 | `env.L.properties` |
|
||||||
|
|
||||||
### TOMCAT 기동 옵션 참조
|
### 데이터베이스
|
||||||
|
|
||||||
#### 은행 개발 서버용
|
- **Oracle**: 운영 주 DB (`hibernate.dialect=org.hibernate.dialect.Oracle12cDialect`)
|
||||||
```
|
- **MariaDB / PostgreSQL**: 벤더별 SQL 매핑으로 지원 (JDBC 의존성은 필요 시 활성화)
|
||||||
-Deai.datasource.type=DEV
|
- **H2**: 테스트용 인메모리 DB (`src/test/resources`)
|
||||||
-Dinst.Name=emsSvr11
|
- 연결 타입은 `-Deai.datasource.type`(DEV/STG/PROD) 로 선택
|
||||||
-Deai.tableowner=EMSAPP
|
|
||||||
-Deai.systemmode=D
|
|
||||||
-Dfile.encoding=utf-8
|
|
||||||
-DLOGBACK_LOG_LEVEL=info
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 로컬 개발용
|
### DB 암호화
|
||||||
```
|
|
||||||
-Deai.datasource.type=DEV
|
`damo-manager.jar` 모듈은 환경에 따라 다른 암호화로직을 제공한다.
|
||||||
-Dinst.Name=emsSvr99
|
|
||||||
-Deai.tableowner=EMSAPP
|
| 환경 | 설명 |
|
||||||
-Deai.systemmode=D
|
|---|---|
|
||||||
-Dfile.encoding=utf-8
|
| 운영 | 실제 D'amo 네이티브 라이브러리 |
|
||||||
-Dlogin.mode=db
|
| 개발 | SHA-256 |
|
||||||
-DLOGBACK_LOG_LEVEL=DEBUG
|
|
||||||
-Dlogback.configurationFile=classpath:logback-dev.xml
|
로컬 개발 시 `-Ddamo-manager.enabled=false`
|
||||||
-Dhibernate.dialect=org.hibernate.dialect.Oracle12cDialect
|
|
||||||
-Dkjb_safedb.mode=fake
|
## DJB (제주은행) 전용 설정
|
||||||
|
|
||||||
|
DJB 전용 프로퍼티는 DB 테이블 `TSEAIRM24` 에 그룹명 `'Monitoring'` 과
|
||||||
|
DB 테이블 `PTL_PROPERTY` 에 그룹명 `'Portal'` 로 저장된다.
|
||||||
|
|
||||||
|
> Monitoring 프라퍼티 (환경정보 > EMS관리 > 모니터링 프라퍼티)
|
||||||
|
|
||||||
|
**계정관리**
|
||||||
|
- `djb.sms_auth.enabled` - 로그인시 2-factor 인증 적용여부
|
||||||
|
- `djb.sms_auth.fixed_value` - sms_auth.mode=fixed일 경우 고정인증값
|
||||||
|
- `djb.sms_auth.mode` - 2-factor 인증 모드 (real:실제, fixed:고정값-개발환경에서 사용)
|
||||||
|
- `rms.DUAL_LOGIN_ENABLED` - 중복 로그인 허용 여부
|
||||||
|
- `rms.auto.logout.timeout` - 자동 로그아웃 시간(분)
|
||||||
|
- `rms.password.combi.check` - 비밀번호 영문/숫자/특수문자 조합 종류수
|
||||||
|
- `rms.password.fail.count` - 비밀번호 실패 허용 횟수(이 값 이상 실패시 계정 잠김)
|
||||||
|
- `rms.password.history.count` - 이전 비밀번호 변경 불가 횟수
|
||||||
|
- `rms.password.init.subfix` - 관리자가 비밀번호 초기화시 추가 문자 ex) 행번@!
|
||||||
|
- `rms.password.length.check` - 비밀번호 최소 자리수
|
||||||
|
- `rms.password.repeat.check` - 비밀번호 동일문자,연속문자 반복 불가 횟수
|
||||||
|
- `rms.password.sms_auth.enabled` - 비밀번호 변경시 2-factor 인증 여부
|
||||||
|
|
||||||
|
**인터페이스 배포**
|
||||||
|
- `iomap.download.path` - 인터페이스.json 파일 다운로드 서버 경로
|
||||||
|
- `iomap.upload.path` - 인터페이스.json 파일 업로드 서버 경로
|
||||||
|
|
||||||
|
**UMS(공통) 연동**
|
||||||
|
- `djb.ums.was_ip_address` - 관리자포탈 WAS IP 주소 (UMS 연동시 필요)
|
||||||
|
- `djb.ums.was_mac_address` - 관리자포탈 WAS MAC 주소 (UMS 연동 시 필요)
|
||||||
|
|
||||||
|
**UMS(이메일) 연동**
|
||||||
|
- `djb.ums.email.url` - 이메일 API 엔드포인트 (EAI)
|
||||||
|
- `djb.ums.email.cstno` - 고객번호
|
||||||
|
- `djb.ums.email.ums_evnt_id` - UMS이벤트 ID
|
||||||
|
|
||||||
|
**UMS(사내메신저) 연동**
|
||||||
|
- `djb.ums.messenger.url` - 사내메신저 API 앤드포인트 (FEP)
|
||||||
|
- `djb.ums.messenger.client_id` - 사내메신저 클라이언트 아이디
|
||||||
|
- `djb.ums.messenger.client_secret` - 사내메신저 클라이언트 시크릿
|
||||||
|
- `djb.ums.messenger.api-monitor.enabled` - API 상태변화시 직원에게 사내메신저 발송 여부
|
||||||
|
|
||||||
|
**UMS(SMS) 연동**
|
||||||
|
- `djb.ums.sms.url` - SMS API 엔드포인트 (EAI)
|
||||||
|
- `djb.ums.sms.almtk_snd_prtl_key.intra` - 카톡 알림톡 채널 ID (제주은행 임직원)
|
||||||
|
- `djb.ums.sms.almtk_snd_prtl_key.public` - 카톡 알림톡 채널 ID (제주은행)
|
||||||
|
|
||||||
|
**Webhook 발송**
|
||||||
|
- `rms.webhook.enabled` - 웹훅 발송 여부
|
||||||
|
- `rms.webhook.retry_count` - 웹훅 재발송 횟수
|
||||||
|
- `rms.webhook.retry_time` - 웹훅 재발송 시간간격
|
||||||
|
- `rms.webhook.reverse_proxy.url` - 리버스 프록시 경로
|
||||||
|
|
||||||
|
|
||||||
-Dlogback.configurationFile="C:\eactive\workspaces\kjb-eapim\eapim-admin\src\main\resources\logback-rinjae.xml"
|
> Portal 프라퍼티 (파트너포탈 > 포탈관리 > Property관리)
|
||||||
```
|
|
||||||
|
|
||||||
### 데이터베이스 지원
|
**UMS 연동**
|
||||||
|
- `djb.ums.email.if_id` - 이메일 연동 인터페이스 ID
|
||||||
|
- `djb.ums.email.tx_id` - 이메일 거래 ID
|
||||||
|
- `djb.ums.messenger.if_id` - 사내메신저 인터페이스 ID
|
||||||
|
- `djb.ums.messenger.tx_id` - 사내메신저 거래 ID
|
||||||
|
- `djb.ums.sms.if_id` - SMS 인터페이스 ID
|
||||||
|
- `djb.ums.sms.tx_id` - SMS 거래 ID
|
||||||
|
|
||||||
- **Oracle**: 운영 데이터베이스 (주)
|
|
||||||
- **PostgreSQL/MariaDB**: 대체 운영 DB
|
|
||||||
- **H2**: 테스트용 인메모리 데이터베이스
|
|
||||||
|
|
||||||
데이터베이스 벤더는 프로퍼티 파일의 `db.vendor`와 `hibernate.dialect`를 통해 설정됩니다.
|
## 스케쥴러
|
||||||
|
|
||||||
### SafeDB 암호화 라이브러리
|
**API 상태 모니터링**
|
||||||
|
- `ApiStatusMonitorJob11, ApiStatusMonitorJob21` - API 상태 변화를 모니터링한다. API 상태 변화 발생시 직원에게 메신저 및 제휴사에게 웹훅을 발송한다.
|
||||||
|
- 실행간격(1분)이 짧아서 CLUSTERED는 적용을 못하고, 서버수만큼 등록하여 번갈아 가면서 실행하도록 설정
|
||||||
|
- `api.status.error.range_minute` - API 장애 판단을 위한 로그 구간(분)
|
||||||
|
- `api.status.error.rate` - API 장애판단을 위한 오류율 (ex : 10분동안 90% 이상 오류 발생시 장애로 판단)
|
||||||
|
- `api.status.delay.range_minute` - API 지연 상태 판단을 위한 로그 구간(분)
|
||||||
|
- `api.status.delay.avg_resp_time` - API 지연 상태 판단을 위한 평균 응답속도 (ex: 10분동안 평균 응답속도가 10초이상이면 지연으로 판단)
|
||||||
|
|
||||||
`kjb-safedb` 모듈은 세 가지 동작 모드를 제공합니다:
|
**유량제어토큰실패감시**
|
||||||
- **REAL**: 실제 SafeDB 네이티브 라이브러리 사용
|
- `InflowTokenMonitorJob` - 유량제어 토큰 획득 실패(TSEAIFR11) 발생시 직원에게 메신저를 발송한다
|
||||||
- **FAKE**: SHA-256/AES-256을 사용하는 개발 모드 (SafeDB 설치 불필요)
|
- `api.inflow.fail.range_minute` - 최근 몇분동안 감시하는지 설정
|
||||||
- **NONE**: 암호화 우회 (테스트 전용)
|
|
||||||
|
|
||||||
개발 시 SafeDB가 로컬에 설치되지 않은 경우 `-Dkjb_safedb.mode=fake`를 설정합니다.
|
**API 통계**
|
||||||
|
- `ApiStatsHourlyAggregationJob` - 당일 API 로그 정보를 시간별로 집계 (TSEAILG00 > API_STATS_HOUR)
|
||||||
|
- `APISTATSDAILYJOB` - API 사용통계 일집계 (API_STATS_HOUR > API_STATS_DAY)
|
||||||
|
- `APISTATSMONTHLYJOB` - API 사용통계 월집계 (API_STATS_DAY > API_STATS_MONTH)
|
||||||
|
- `APISTATSYEARLYJOB` - API 사용통계 년집계 (API_STATS_MONTH > API_STATS_YEAR)
|
||||||
|
|
||||||
|
**UMS발송**
|
||||||
|
- `UMSDISPATCHJOB11, UMSDISPATCHJOB21` - UMS를 발송한다.
|
||||||
|
- 실행간격(5초)이 짧아서 CLUSTERED는 적용을 못하고, 서버수만큼 등록하여 번갈아 가면서 실행하도록 설정
|
||||||
|
|
||||||
|
**게시글종료**
|
||||||
|
- `PortalInquiryClosingJob` - 답변완료 이후 일정기간 댓글이 없는 경우 게시글을 종료한다
|
||||||
|
- `inquiry.comment.closing_day` - 게시글 종료 대기일수
|
||||||
|
|
||||||
|
**메모리초기화**
|
||||||
|
- `MEMORYTRINIT` - 관리자포탈 서버 메모리 초기화(G/W에서 받은 거래현황)
|
||||||
|
|
||||||
|
**토큰발급이력삭제**
|
||||||
|
- `TOKENISSUANCELOGCLEANUPJOB` - 7일이 지난 토큰 발급내역을 삭제한다
|
||||||
|
|
||||||
## 배포
|
## 배포
|
||||||
|
|
||||||
### 지원 서버
|
| 대상 | 비고 |
|
||||||
- **Tomcat** (기본, 개발)
|
|---|---|
|
||||||
- **WebLogic 14.1.2** (운영, `-Pprofile=weblogic` 필요)
|
| Tomcat | 기본, 개발 |
|
||||||
- **JEUS** (지원)
|
| WebLogic 14.1.2 | 운영, `-Pprofile=weblogic` 필요 |
|
||||||
- **JBoss/WildFly** (descriptors와 함께 지원)
|
| JEUS | 지원 |
|
||||||
|
| JBoss / WildFly | descriptor 포함 지원 |
|
||||||
|
|
||||||
### WebLogic 전용 빌드
|
- 모든 관리 변경사항은 DB 와 메모리에 즉시 반영됩니다.
|
||||||
|
- 인코딩은 UTF-8. `CharacterEncodingFilter` 가 `*.excel` 을 제외한 모든 요청에 적용.
|
||||||
WebLogic용 빌드 시, DefaultServlet 문제를 해결하기 위해 `web.xml`을 `weblogic-web.xml`로 교체하는 `weblogic` 프로필을 사용합니다:
|
- XSS 보호: `com.eactive.eai.rms.common.filter.CrossScriptingFilter` 전역 적용.
|
||||||
|
|
||||||
```bash
|
|
||||||
gradle build -x test -Pprofile=weblogic
|
|
||||||
```
|
|
||||||
|
|
||||||
### WAR 배포
|
|
||||||
|
|
||||||
WAR 파일은 context path `/monitoring`으로 `eapim-admin.war`로 빌드됩니다.
|
|
||||||
|
|
||||||
## IDE 설정
|
## IDE 설정
|
||||||
|
|
||||||
### Eclipse
|
`build.gradle` 은 `eclipse` / `eclipse-wtp` / `idea` 플러그인을 모두 포함합니다.
|
||||||
|
IntelliJ 전용 변형은 `build.gradle.intellij` 로 별도 관리합니다 (필요 시 `build.gradle` 로 교체).
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
gradle eclipse
|
# Eclipse
|
||||||
|
./gradlew eclipse # .project / .classpath, WTP(context path: /monitoring), APT 설정 생성
|
||||||
|
|
||||||
|
# IntelliJ IDEA
|
||||||
|
./gradlew idea # 또는 IDE 에서 "Import Gradle Project"
|
||||||
```
|
```
|
||||||
|
|
||||||
다음을 생성합니다:
|
|
||||||
- `.project` 및 `.classpath` 파일
|
|
||||||
- Eclipse WTP 설정 (context path: `/monitoring`)
|
|
||||||
- UTF-8 인코딩 설정
|
|
||||||
- QueryDSL/Lombok을 위한 애노테이션 프로세서 설정
|
|
||||||
|
|
||||||
### IntelliJ IDEA
|
|
||||||
|
|
||||||
```bash
|
|
||||||
gradle idea
|
|
||||||
```
|
|
||||||
|
|
||||||
또는 IntelliJ에서 직접 "Import Gradle Project"를 사용합니다.
|
|
||||||
|
|
||||||
## KJB (광주은행) 전용 설정
|
|
||||||
|
|
||||||
### 프로퍼티 관리
|
|
||||||
KJB 전용 프로퍼티는 데이터베이스 테이블 `TSEAIRM24`에 그룹명 `'Monitoring'`으로 저장됩니다.
|
|
||||||
|
|
||||||
|
|
||||||
### 주요 프로퍼티 설정
|
|
||||||
|
|
||||||
**이메일 알림 (EAI Batch를 통해)**
|
|
||||||
- `kjb.eai_batch.url` - 이메일 발송을 위한 EAI 배치 서버 URL
|
|
||||||
- 개발: http://172.31.32.111:10230/BATAppWeb/EaiBatCall
|
|
||||||
- QA: http://172.31.33.111:10430/BATAppWeb/EaiBatCall
|
|
||||||
- 운영: http://172.21.1.40:10860/BATAppWeb/EaiBatCall
|
|
||||||
- 입력하지 않을 경우 EAI 배치 호출을 하지 않고 내부적으로 통신하지 않으며 warning 로그만 남김
|
|
||||||
- `kjb.ums.eai_batch.send_dir` - 이메일 파일 발송 디렉토리 (기본값: `/Data/eapim/portal/sendmail/snd`)
|
|
||||||
- `kjb.ums.eai_batch.backup_dir` - 이메일 백업 디렉토리 (기본값: `/Data/eapim/portal/sendmail/bak`)
|
|
||||||
- `kjb.ums.eai_batch.interface_id` - 고객 이메일용 인터페이스 ID (예: `UAGFF00001UIE`)
|
|
||||||
|
|
||||||
**UMS (SMS/LMS/카카오톡) 연동**
|
|
||||||
- `kjb.ums.host_url` - UMS API 엔드포인트
|
|
||||||
- `kjb.ums.api_key` - UMS API 인증 키
|
|
||||||
- `kjb.ums.connection_timeout` - 연결 타임아웃 (초 단위)
|
|
||||||
- `kjb.ums.response_timeout` - 응답 타임아웃 (초 단위)
|
|
||||||
|
|
||||||
### 보안
|
|
||||||
- 커스텀 패스워드 인코더: SafeDB 연동을 위한 `KjbSafedbPasswordEncoder`
|
|
||||||
|
|
||||||
## 테스트
|
## 테스트
|
||||||
|
|
||||||
테스트에 사용되는 것들:
|
- **JUnit 5 (Jupiter)** - 테스트 프레임워크
|
||||||
- **JUnit 5 (Jupiter)**: 테스트 프레임워크
|
- **Spring Boot Test 2.6.15** - 통합 테스트 유틸리티
|
||||||
- **Spring Boot Test 2.6.15**: 통합 테스트 유틸리티
|
- **H2** - 인메모리 DB (`src/test/resources`)
|
||||||
- **H2 Database**: 테스트용 인메모리 데이터베이스
|
- **Mockito** - 모킹 (Spring Boot Test 경유)
|
||||||
- **Mockito**: 모킹 프레임워크 (Spring Boot Test를 통해)
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 모든 테스트 실행
|
./gradlew test
|
||||||
gradle test
|
./gradlew test --tests "com.eactive.eai.rms.*"
|
||||||
|
|
||||||
# 특정 테스트 클래스 실행
|
|
||||||
gradle test --tests "com.example.ClassName"
|
|
||||||
|
|
||||||
# 특정 테스트 패키지 실행 (JUnit 플랫폼 사용)
|
|
||||||
gradle test --tests "com.eactive.eai.rms.*"
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## 관련 프로젝트
|
|
||||||
|
|
||||||
프로젝트 구조 (kjb-eapim 디렉토리 기준):
|
|
||||||
- `eapim-admin/` - Admin 관리 콘솔 (현재 프로젝트)
|
|
||||||
- `eapim-online/` - Online 게이트웨이 (코어 모듈 포함)
|
|
||||||
- `eapim-portal/` - Portal 개발자 포털
|
|
||||||
- `elink-portal-common/` - 공통 유틸리티 라이브러리
|
|
||||||
- `kjb-safedb/` - SafeDB 암호화 라이브러리
|
|
||||||
- `kjb-eapim-sql/` - SQL 스크립트 (선택사항)
|
|
||||||
|
|
||||||
## 문서
|
## 문서
|
||||||
|
|
||||||
- **프로젝트 상세 지침**: `CLAUDE.md` (한글)
|
- **프로젝트 상세 지침**: `CLAUDE.md` (AI 어시스턴트 및 개발자용 마스터 문서, 한글)
|
||||||
- **사용자 가이드**: `WebContent/guide/` (한글)
|
- **사용자 가이드**: `WebContent/guide/` (docsify)
|
||||||
|
|
||||||
## 참고: KJB 데이터베이스 파라미터 설정
|
|
||||||
|
|
||||||
### 추가 파라미터 SQL
|
|
||||||
```sql
|
|
||||||
-- 로컬 개발용 (외부)
|
|
||||||
-- EAI, UMS 주소 미기입시 내부적으론 호출 시도 하지 않고 warning 로그만 남기며 정상 처리
|
|
||||||
--insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.eai_batch.url', '');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.eai.batch.connection_timeout', '5');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.eai.batch.response_timeout', '5');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.eai.batch.timeout', '10');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.eai.batch.charset', 'euc-kr');
|
|
||||||
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.eai_batch.send_dir', '/Data/eapim/portal/sendmail/snd');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.eai_batch.backup_dir', '/Data/eapim/portal/sendmail/bak');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.eai_batch.error_dir', '/Data/eapim/portal/sendmail/bak');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.eai_batch.retention_date', '60');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.eai_batch.interface_id', 'UIEFF00001UAG');
|
|
||||||
|
|
||||||
-- insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.host_url', '');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.api_key', '7cca6d58-e4f7-474d-9edd-525806bc99ff');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.connection_timeout', '5');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.response_timeout', '5');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.timeout', '10');
|
|
||||||
|
|
||||||
--insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.obp.host_url', '');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.obp.trust_system', 'APIMPT-0002-QVBJTVBULTAwMDI=');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.obp.commission_uri', '/api/billing/findBillingForCondition');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.obp.commission_print_uri', '/api/billing/billing/findBillingForCondition/print');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.obp.query_partnercode_uri', '/api/customer/findCustomerByBusinessManRegistrationNo/%s');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.obp.create_partnercode_uri', '/not-yet-implement/%s');
|
|
||||||
commit;
|
|
||||||
|
|
||||||
|
|
||||||
-- 은행 개발 서버용
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.eai_batch.url', 'http://172.31.32.111:10230/BATAppWeb/EaiBatCall');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.eai.batch.connection_timeout', '5');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.eai.batch.response_timeout', '5');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.eai.batch.timeout', '10');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.eai.batch.charset', 'euc-kr');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.eai_batch.send_dir', '/Data/eapim/portal/sendmail/snd');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.eai_batch.backup_dir', '/Data/eapim/portal/sendmail/bak');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.eai_batch.error_dir', '/Data/eapim/portal/sendmail/bak');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.eai_batch.retention_date', '60');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.eai_batch.interface_id', 'UIEFF00001UAG');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.host_url', 'http://172.31.35.144:9021');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.api_key', '7cca6d58-e4f7-474d-9edd-525806bc99ff');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.connection_timeout', '5');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.response_timeout', '5');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.timeout', '10');
|
|
||||||
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.obp.host_url', 'http://192.168.246.15:8181');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.obp.trust_system', 'APIMPT-0002-QVBJTVBULTAwMDI=');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.obp.commission_uri', '/api/billing/findBillingForCondition');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.obp.commission_print_uri', '/api/billing/billing/findBillingForCondition/print');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.obp.query_partnercode_uri', '/api/customer/findCustomerByBusinessManRegistrationNo/%s');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.obp.create_partnercode_uri', '/not-yet-implement/%s');
|
|
||||||
commit;
|
|
||||||
|
|
||||||
|
|
||||||
-- 은행 운영 서버용
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.eai_batch.url', 'http://172.21.1.40:10860/BATAppWeb/EaiBatCall');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.eai.batch.connection_timeout', '5');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.eai.batch.response_timeout', '5');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.eai.batch.timeout', '10');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.eai.batch.charset', 'euc-kr');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.eai_batch.send_dir', '/Data/eapim/portal/sendmail/snd');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.eai_batch.backup_dir', '/Data/eapim/portal/sendmail/bak');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.eai_batch.error_dir', '/Data/eapim/portal/sendmail/bak');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.eai_batch.retention_date', '60');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.eai_batch.interface_id', 'UIEFF00001UAG');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.host_url', 'http://172.24.128.66:9021');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.api_key', '7cca6d58-e4f7-474d-9edd-525806bc99ff');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.connection_timeout', '5');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.response_timeout', '5');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.timeout', '10');
|
|
||||||
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.obp.host_url', 'http://192.168.246.15:8181');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.obp.trust_system', 'APIMPT-0002-QVBJTVBULTAwMDI=');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.obp.commission_uri', '/api/billing/findBillingForCondition');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.obp.commission_print_uri', '/api/billing/billing/findBillingForCondition/print');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.obp.query_partnercode_uri', '/api/customer/findCustomerByBusinessManRegistrationNo/%s');
|
|
||||||
insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.obp.create_partnercode_uri', '/not-yet-implement/%s');
|
|
||||||
commit;
|
|
||||||
```
|
|
||||||
## 라이선스
|
## 라이선스
|
||||||
|
|
||||||
© 광주은행 (Kwangju Bank)
|
사내 전용(proprietary). 제주은행 eLink EMS.
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ import com.eactive.eai.rms.common.util.CommonConstants;
|
|||||||
import com.eactive.eai.rms.data.entity.onl.bzwkdstcd.UserBusiness;
|
import com.eactive.eai.rms.data.entity.onl.bzwkdstcd.UserBusiness;
|
||||||
import com.eactive.eai.rms.data.entity.onl.bzwkdstcd.UserBusinessId;
|
import com.eactive.eai.rms.data.entity.onl.bzwkdstcd.UserBusinessId;
|
||||||
import com.eactive.eai.rms.data.entity.onl.bzwkdstcd.UserBusinessService;
|
import com.eactive.eai.rms.data.entity.onl.bzwkdstcd.UserBusinessService;
|
||||||
|
import com.eactive.eai.rms.data.entity.onl.transaction.TransactionTrackingFilter;
|
||||||
|
import com.eactive.eai.rms.data.entity.onl.transaction.TransactionTrackingFilterId;
|
||||||
|
import com.eactive.eai.rms.data.entity.onl.transaction.TransactionTrackingFilterService;
|
||||||
import com.eactive.eai.rms.data.entity.onl.unifbwk.UnifBwkTpService;
|
import com.eactive.eai.rms.data.entity.onl.unifbwk.UnifBwkTpService;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@@ -40,6 +43,9 @@ public class BizManService extends BaseService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private UserBusinessService userBusinessService;
|
private UserBusinessService userBusinessService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TransactionTrackingFilterService transactionTrackingFilterService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserBizUIMapper userBizUIMapper;
|
private UserBizUIMapper userBizUIMapper;
|
||||||
|
|
||||||
@@ -101,7 +107,14 @@ public class BizManService extends BaseService {
|
|||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
userBusinessService.deleteOrSave(userId, userBusinesses);
|
userBusinessService.deleteOrSave(userId, userBusinesses);
|
||||||
|
|
||||||
|
transactionTrackingFilterService.deleteAllByUserId(userId);
|
||||||
|
List<TransactionTrackingFilter> filters = userBusinesses.stream()
|
||||||
|
.map(ub -> new TransactionTrackingFilter(
|
||||||
|
new TransactionTrackingFilterId(userId, ub.getId().getEaiBzwkDstcd())))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
transactionTrackingFilterService.saveAll(filters);
|
||||||
|
|
||||||
String userBusinessServiceLists = userBusinesses.stream()
|
String userBusinessServiceLists = userBusinesses.stream()
|
||||||
.map(e -> e.getId().getEaiBzwkDstcd())
|
.map(e -> e.getId().getEaiBzwkDstcd())
|
||||||
.collect(Collectors.joining(","));
|
.collect(Collectors.joining(","));
|
||||||
|
|||||||
@@ -276,6 +276,15 @@ public interface MonitoringContext {
|
|||||||
// 비밀번호 변경 시 SMS 2차 인증 사용 여부 (djb.sms_auth.enabled 와 함께 true 여야 동작)
|
// 비밀번호 변경 시 SMS 2차 인증 사용 여부 (djb.sms_auth.enabled 와 함께 true 여야 동작)
|
||||||
public static final String RMS_PASSWORD_SMS_AUTH_ENABLED = "rms.password.sms_auth.enabled";
|
public static final String RMS_PASSWORD_SMS_AUTH_ENABLED = "rms.password.sms_auth.enabled";
|
||||||
|
|
||||||
|
// 비밀번호 최소 길이 (기본 7)
|
||||||
|
public static final String RMS_PASSWORD_LENGTH_CHECK = "rms.password.length.check";
|
||||||
|
|
||||||
|
// 비밀번호 문자 조합 종류 수 (영문/숫자/특수문자 중 N종류 이상, 기본 2)
|
||||||
|
public static final String RMS_PASSWORD_COMBI_CHECK = "rms.password.combi.check";
|
||||||
|
|
||||||
|
// 동일 문자 연속 반복 제한 개수 (기본 3, 2 미만이면 미검사)
|
||||||
|
public static final String RMS_PASSWORD_REPEAT_CHECK = "rms.password.repeat.check";
|
||||||
|
|
||||||
// API 상태변화 스윙챗 발송여부
|
// API 상태변화 스윙챗 발송여부
|
||||||
public static final String DJB_UMS_MESSENGER_APIMONITOR_ENABLED = "djb.ums.messenger.api-monitor.enabled";
|
public static final String DJB_UMS_MESSENGER_APIMONITOR_ENABLED = "djb.ums.messenger.api-monitor.enabled";
|
||||||
|
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ class RequestWrapper extends HttpServletRequestWrapper {
|
|||||||
// src 속성 화이트리스트 필터링 - 허용된 프로토콜만 통과
|
// src 속성 화이트리스트 필터링 - 허용된 프로토콜만 통과
|
||||||
value = filterSrcAttribute(value);
|
value = filterSrcAttribute(value);
|
||||||
|
|
||||||
// 리치 텍스트 파라미터는 문자 변환을 건너뛰고 XSS 패턴 필터링만 적용
|
// 리치 텍스트 파라미터와 메시지 템플릿 저장 요청은 문자 변환 없이 XSS 패턴 필터링만 적용
|
||||||
if (!shouldSkipCharConvert()) {
|
if (!shouldSkipCharConvert()) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
value = convertChars(value, sb);
|
value = convertChars(value, sb);
|
||||||
@@ -179,6 +179,15 @@ class RequestWrapper extends HttpServletRequestWrapper {
|
|||||||
if (param == null) {
|
if (param == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// 상세 화면은 .view로 열리지만 등록/수정 데이터는 .json으로 POST됨.
|
||||||
|
// 문자 발송에 사용되는 입력값이 HTML 엔티티로 저장되지 않도록 함.
|
||||||
|
if ("POST".equalsIgnoreCase(getMethod())
|
||||||
|
&& "/onl/apim/template/messageTemplateMan.json".equals(getServletPath())) {
|
||||||
|
String cmd = super.getParameter("cmd");
|
||||||
|
if ("INSERT".equals(cmd) || "UPDATE".equals(cmd)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
for (String skipParam : SKIP_CHAR_CONVERT_PARAMS) {
|
for (String skipParam : SKIP_CHAR_CONVERT_PARAMS) {
|
||||||
if (StringUtils.equalsIgnoreCase(param, skipParam)) {
|
if (StringUtils.equalsIgnoreCase(param, skipParam)) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1,64 +0,0 @@
|
|||||||
package com.eactive.eai.rms.common.interceptor;
|
|
||||||
|
|
||||||
import com.eactive.apim.portal.portalproperty.service.PortalPropertyService;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Map;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
import org.springframework.web.servlet.HandlerInterceptor;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
@Slf4j
|
|
||||||
public class ApiKeyInterceptor implements HandlerInterceptor {
|
|
||||||
|
|
||||||
private static final String API_KEY_HEADER = "X-API-KEY";
|
|
||||||
private static final String PORTAL_PROPERTY_GROUP = "Portal";
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private PortalPropertyService portalPropertyService;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
|
||||||
try {
|
|
||||||
String requestApiKey = request.getHeader(API_KEY_HEADER);
|
|
||||||
|
|
||||||
if (StringUtils.isEmpty(requestApiKey)) {
|
|
||||||
log.warn("Request received without API key. URI: {}", request.getRequestURI());
|
|
||||||
sendErrorResponse(response, HttpServletResponse.SC_UNAUTHORIZED, "API key is missing");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, String> properties = portalPropertyService.getPortalPropertiesAsMap(PORTAL_PROPERTY_GROUP);
|
|
||||||
String validApiKey = properties.get("apiKey");
|
|
||||||
|
|
||||||
if (StringUtils.isEmpty(validApiKey)) {
|
|
||||||
log.error("API key not configured in properties");
|
|
||||||
sendErrorResponse(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "API key is not configured");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!validApiKey.equals(requestApiKey)) {
|
|
||||||
log.warn("Invalid API key received. URI: {}", request.getRequestURI());
|
|
||||||
sendErrorResponse(response, HttpServletResponse.SC_FORBIDDEN, "Invalid API key");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("Error processing API key validation", e);
|
|
||||||
sendErrorResponse(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Error processing request");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void sendErrorResponse(HttpServletResponse response, int status, String message) throws IOException {
|
|
||||||
response.setStatus(status);
|
|
||||||
response.setContentType("application/json");
|
|
||||||
response.getWriter().write(String.format("{\"error\": \"%s\"}", message));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.eactive.eai.rms.common.interceptor;
|
||||||
|
|
||||||
|
import com.eactive.apim.portal.common.internal.InternalApiTokenService;
|
||||||
|
import java.io.IOException;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code /_onl/**} 내부 연동 요청을 공유 내부 토큰으로 검증한다.
|
||||||
|
*
|
||||||
|
* <p>토큰과 헤더명은 PTL_PROPERTY {@code Portal / internal.api.header-name},
|
||||||
|
* {@code Portal / internal.api.token}을 사용한다. admin은 토큰을 생성하지 않고 읽기 전용으로
|
||||||
|
* 검증하므로, portal이 먼저 기동되어 토큰을 생성해야 한다.</p>
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class InternalApiTokenInterceptor implements HandlerInterceptor {
|
||||||
|
|
||||||
|
private final InternalApiTokenService internalApiTokenService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws IOException {
|
||||||
|
String headerName = internalApiTokenService.findHeaderName();
|
||||||
|
String presentedToken = request.getHeader(headerName);
|
||||||
|
|
||||||
|
if (!internalApiTokenService.matchesReadOnly(presentedToken)) {
|
||||||
|
log.warn("Invalid internal API token. URI: {}, header: {}", request.getRequestURI(), headerName);
|
||||||
|
sendErrorResponse(response, HttpServletResponse.SC_UNAUTHORIZED, "Internal API token is invalid");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendErrorResponse(HttpServletResponse response, int status, String message) throws IOException {
|
||||||
|
response.setStatus(status);
|
||||||
|
response.setContentType("application/json;charset=UTF-8");
|
||||||
|
response.getWriter().write(String.format("{\"error\": \"%s\"}", message));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -67,6 +67,9 @@ public class MainController implements InterceptorSkipController {
|
|||||||
private static final String USER_STATUS_LOCKED = "2";
|
private static final String USER_STATUS_LOCKED = "2";
|
||||||
private static final int DEFAULT_MAX_LOGIN_FAIL_COUNT = 5;
|
private static final int DEFAULT_MAX_LOGIN_FAIL_COUNT = 5;
|
||||||
private static final int DEFAULT_PASSWORD_HISTORY_COUNT = 5;
|
private static final int DEFAULT_PASSWORD_HISTORY_COUNT = 5;
|
||||||
|
private static final int DEFAULT_PASSWORD_LENGTH_CHECK = 7;
|
||||||
|
private static final int DEFAULT_PASSWORD_COMBI_CHECK = 2;
|
||||||
|
private static final int DEFAULT_PASSWORD_REPEAT_CHECK = 3;
|
||||||
|
|
||||||
private final LocaleMessage localeMessage;
|
private final LocaleMessage localeMessage;
|
||||||
private final MonitoringContext monitoringContext;
|
private final MonitoringContext monitoringContext;
|
||||||
@@ -220,7 +223,7 @@ public class MainController implements InterceptorSkipController {
|
|||||||
// 휴대폰번호 없는 사용자
|
// 휴대폰번호 없는 사용자
|
||||||
return LoginResponseDto.builder()
|
return LoginResponseDto.builder()
|
||||||
.success(false)
|
.success(false)
|
||||||
.errorMessage("휴대폰번호가 등록되어 있지 않아 로그인할 수 없습니다. 관리자에게 문의하세요.")
|
.errorMessage("NO_PHONE_NUMBER")
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,7 +234,7 @@ public class MainController implements InterceptorSkipController {
|
|||||||
if (!sent) {
|
if (!sent) {
|
||||||
return LoginResponseDto.builder()
|
return LoginResponseDto.builder()
|
||||||
.success(false)
|
.success(false)
|
||||||
.errorMessage("인증번호 발송에 실패했습니다. 잠시 후 다시 시도해주세요.")
|
.errorMessage("FAIL_SEND_AUTH")
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -469,6 +472,24 @@ public class MainController implements InterceptorSkipController {
|
|||||||
return monitoringContext.getBooleanProperty(MonitoringContext.RMS_PASSWORD_SMS_AUTH_ENABLED, false);
|
return monitoringContext.getBooleanProperty(MonitoringContext.RMS_PASSWORD_SMS_AUTH_ENABLED, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 비밀번호 최소 길이 조회 (rms.password.length.check)
|
||||||
|
private int getPasswordLengthCheck() {
|
||||||
|
return monitoringContext.getIntProperty(
|
||||||
|
MonitoringContext.RMS_PASSWORD_LENGTH_CHECK, DEFAULT_PASSWORD_LENGTH_CHECK);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 비밀번호 문자 조합 종류 수 조회 (rms.password.combi.check, 영문/숫자/특수문자 중 N종류 이상)
|
||||||
|
private int getPasswordCombiCheck() {
|
||||||
|
return monitoringContext.getIntProperty(
|
||||||
|
MonitoringContext.RMS_PASSWORD_COMBI_CHECK, DEFAULT_PASSWORD_COMBI_CHECK);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 동일 문자 연속 반복 제한 개수 조회 (rms.password.repeat.check, 2 미만이면 미검사)
|
||||||
|
private int getPasswordRepeatCheck() {
|
||||||
|
return monitoringContext.getIntProperty(
|
||||||
|
MonitoringContext.RMS_PASSWORD_REPEAT_CHECK, DEFAULT_PASSWORD_REPEAT_CHECK);
|
||||||
|
}
|
||||||
|
|
||||||
// 로그인 실패 횟수 증가, 임계치 도달 시 계정 잠금
|
// 로그인 실패 횟수 증가, 임계치 도달 시 계정 잠금
|
||||||
private int increaseLoginFailCount(UserInfo userInfo) {
|
private int increaseLoginFailCount(UserInfo userInfo) {
|
||||||
int failCount = (userInfo.getLoginfailcount() == null ? 0 : userInfo.getLoginfailcount()) + 1;
|
int failCount = (userInfo.getLoginfailcount() == null ? 0 : userInfo.getLoginfailcount()) + 1;
|
||||||
@@ -1018,10 +1039,17 @@ public class MainController implements InterceptorSkipController {
|
|||||||
|
|
||||||
private boolean isPasswordValid(String password) {
|
private boolean isPasswordValid(String password) {
|
||||||
|
|
||||||
return password != null && password.getBytes().length == password
|
if (password == null || password.getBytes().length != password.length()) {
|
||||||
.length() && password.getBytes().length >= 7
|
return false;
|
||||||
&& isCombination(password)
|
}
|
||||||
&& !isRepeatPassword(password, PASSWORD_PATTERN_CHECK_LENGTH)
|
|
||||||
|
int lengthCheck = getPasswordLengthCheck();
|
||||||
|
int combiCheck = getPasswordCombiCheck();
|
||||||
|
int repeatCheck = getPasswordRepeatCheck();
|
||||||
|
|
||||||
|
return password.getBytes().length >= lengthCheck
|
||||||
|
&& isCombination(password, combiCheck)
|
||||||
|
&& (repeatCheck < 2 || !isRepeatPassword(password, repeatCheck))
|
||||||
&& !isSerialPassword(password, PASSWORD_PATTERN_CHECK_LENGTH)
|
&& !isSerialPassword(password, PASSWORD_PATTERN_CHECK_LENGTH)
|
||||||
&& !isKeyboardSequentialPassword(password, PASSWORD_PATTERN_CHECK_LENGTH);
|
&& !isKeyboardSequentialPassword(password, PASSWORD_PATTERN_CHECK_LENGTH);
|
||||||
}
|
}
|
||||||
@@ -1088,7 +1116,7 @@ public class MainController implements InterceptorSkipController {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isCombination(String password) {
|
private boolean isCombination(String password, int minTypes) {
|
||||||
int combicount = 0;
|
int combicount = 0;
|
||||||
// 숫자포함여부
|
// 숫자포함여부
|
||||||
String pattern = "[0-9]+";
|
String pattern = "[0-9]+";
|
||||||
@@ -1117,8 +1145,8 @@ public class MainController implements InterceptorSkipController {
|
|||||||
combicount++;
|
combicount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// combicount가 2 이상이면 true, 그렇지 않으면 false 반환
|
// combicount가 minTypes 이상이면 true, 그렇지 않으면 false 반환
|
||||||
return combicount >= 2;
|
return combicount >= minTypes;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,9 +8,12 @@ import com.eactive.eai.data.entity.onl.apim.apigroup.QApiGroupApi;
|
|||||||
import com.eactive.eai.data.jpa.AbstractDataService;
|
import com.eactive.eai.data.jpa.AbstractDataService;
|
||||||
import com.eactive.eai.rms.onl.apim.apigroup.ui.ApiGroupUISearch;
|
import com.eactive.eai.rms.onl.apim.apigroup.ui.ApiGroupUISearch;
|
||||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||||
|
import com.querydsl.core.Tuple;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -47,6 +50,24 @@ public class ApiGroupService extends AbstractDataService<ApiGroup, String, ApiGr
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 검색 콤보용 그룹 ID/명칭. 게시 여부와 관계없이 모든 그룹을 제공한다. */
|
||||||
|
public List<Map<String, String>> findGroupOptions() {
|
||||||
|
QApiGroup group = QApiGroup.apiGroup;
|
||||||
|
List<Tuple> rows = getJPAQueryFactory()
|
||||||
|
.select(group.id, group.groupName)
|
||||||
|
.from(group)
|
||||||
|
.orderBy(group.displayOrder.asc().nullsLast(), group.groupName.asc(), group.id.asc())
|
||||||
|
.fetch();
|
||||||
|
List<Map<String, String>> options = new ArrayList<>();
|
||||||
|
for (Tuple row : rows) {
|
||||||
|
Map<String, String> option = new HashMap<>();
|
||||||
|
option.put("id", row.get(group.id));
|
||||||
|
option.put("groupName", StringUtils.defaultIfBlank(row.get(group.groupName), "그룹명 없음"));
|
||||||
|
options.add(option);
|
||||||
|
}
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
public void deleteApiGroupApiByApiId(String apiId) {
|
public void deleteApiGroupApiByApiId(String apiId) {
|
||||||
List<ApiGroup> apiGroups = repository.findAll();
|
List<ApiGroup> apiGroups = repository.findAll();
|
||||||
for (ApiGroup apiGroup : apiGroups) {
|
for (ApiGroup apiGroup : apiGroups) {
|
||||||
@@ -77,6 +98,28 @@ public class ApiGroupService extends AbstractDataService<ApiGroup, String, ApiGr
|
|||||||
.fetch();
|
.fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 목록 툴팁용 게시 그룹명. Oracle IN 절 제한에 맞춰 페이지의 API들을 일괄 조회한다. */
|
||||||
|
public Map<String, List<String>> findPublishedGroupNamesByApiIds(List<String> apiIds) {
|
||||||
|
Map<String, List<String>> groupNames = new HashMap<>();
|
||||||
|
QApiGroup group = QApiGroup.apiGroup;
|
||||||
|
QApiGroupApi membership = QApiGroupApi.apiGroupApi;
|
||||||
|
for (int from = 0; from < apiIds.size(); from += 1000) {
|
||||||
|
List<String> chunk = apiIds.subList(from, Math.min(from + 1000, apiIds.size()));
|
||||||
|
List<Tuple> rows = getJPAQueryFactory()
|
||||||
|
.select(membership.id.apiId, group.groupName)
|
||||||
|
.from(membership)
|
||||||
|
.join(membership.apiGroup, group)
|
||||||
|
.where(membership.id.apiId.in(chunk), group.displayYn.eq("1"))
|
||||||
|
.orderBy(group.displayOrder.asc().nullsLast(), group.groupName.asc(), group.id.asc())
|
||||||
|
.fetch();
|
||||||
|
for (Tuple row : rows) {
|
||||||
|
groupNames.computeIfAbsent(row.get(membership.id.apiId), key -> new ArrayList<>())
|
||||||
|
.add(StringUtils.defaultIfBlank(row.get(group.groupName), "그룹명 없음"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return groupNames;
|
||||||
|
}
|
||||||
|
|
||||||
/** API 를 지정한 그룹 목록에만 소속시킨다(기존 소속 제거 후 재설정). */
|
/** API 를 지정한 그룹 목록에만 소속시킨다(기존 소속 제거 후 재설정). */
|
||||||
public void setApiGroupsForApi(String apiId, List<String> groupIds) {
|
public void setApiGroupsForApi(String apiId, List<String> groupIds) {
|
||||||
deleteApiGroupApiByApiId(apiId);
|
deleteApiGroupApiByApiId(apiId);
|
||||||
|
|||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
package com.eactive.eai.rms.data.entity.onl.apim.apispec;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.eactive.apim.portal.apispec.entity.ApiSpecInfo;
|
||||||
|
import com.eactive.eai.rms.data.EMSDataSource;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.data.repository.Repository;
|
||||||
|
import org.springframework.data.repository.query.Param;
|
||||||
|
|
||||||
|
/** EAI 목록과 스키마가 다른 EMS 스펙의 ID/게시 여부만 조회한다. */
|
||||||
|
@EMSDataSource
|
||||||
|
public interface ApiSpecStatusRepository extends Repository<ApiSpecInfo, String> {
|
||||||
|
|
||||||
|
@Query("SELECT a.apiId FROM ApiSpecInfo a WHERE "
|
||||||
|
+ "(:status = 'PUBLISHED' AND a.displayYn = 'Y') OR "
|
||||||
|
+ "(:status = 'REGISTERED' AND (a.displayYn IS NULL OR a.displayYn <> 'Y'))")
|
||||||
|
List<String> findApiIdsByStatus(@Param("status") String status);
|
||||||
|
|
||||||
|
@Query("SELECT a.apiId AS apiId, a.displayYn AS displayYn FROM ApiSpecInfo a WHERE a.apiId IN :apiIds")
|
||||||
|
List<SpecStatus> findStatusesByApiIds(@Param("apiIds") Collection<String> apiIds);
|
||||||
|
|
||||||
|
interface SpecStatus {
|
||||||
|
String getApiId();
|
||||||
|
String getDisplayYn();
|
||||||
|
}
|
||||||
|
}
|
||||||
-7
@@ -1,7 +0,0 @@
|
|||||||
package com.eactive.eai.rms.data.entity.onl.djb.inflow;
|
|
||||||
|
|
||||||
public interface InflowTokenInsufficient {
|
|
||||||
String getEaisvcname();
|
|
||||||
String getEaisvcdesc();
|
|
||||||
Long getCnt();
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.eactive.eai.rms.data.entity.onl.eaimsg;
|
package com.eactive.eai.rms.data.entity.onl.eaimsg;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -14,6 +15,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import com.eactive.apim.portal.apispec.repository.ApiSpecInfoRepository;
|
import com.eactive.apim.portal.apispec.repository.ApiSpecInfoRepository;
|
||||||
|
import com.eactive.eai.rms.data.entity.onl.apim.apispec.ApiSpecStatusRepository;
|
||||||
import com.eactive.eai.data.entity.onl.adapter.QAdapter;
|
import com.eactive.eai.data.entity.onl.adapter.QAdapter;
|
||||||
import com.eactive.eai.data.entity.onl.apim.apigroup.QApiGroup;
|
import com.eactive.eai.data.entity.onl.apim.apigroup.QApiGroup;
|
||||||
import com.eactive.eai.data.entity.onl.apim.apigroup.QApiGroupApi;
|
import com.eactive.eai.data.entity.onl.apim.apigroup.QApiGroupApi;
|
||||||
@@ -51,6 +53,7 @@ public class EAIMessageService extends AbstractDataService<EAIMessageEntity, Str
|
|||||||
|
|
||||||
/** EMSAPP(PTL_API_SPEC_INFO) 조회용. 다른 스키마라 EAI 메시지 쿼리에 조인할 수 없다 */
|
/** EMSAPP(PTL_API_SPEC_INFO) 조회용. 다른 스키마라 EAI 메시지 쿼리에 조인할 수 없다 */
|
||||||
private final ApiSpecInfoRepository apiSpecInfoRepository;
|
private final ApiSpecInfoRepository apiSpecInfoRepository;
|
||||||
|
private final ApiSpecStatusRepository apiSpecStatusRepository;
|
||||||
|
|
||||||
public Page<Tuple> selectList(EAIMessageUISearch eaiMessageUISearch, Pageable pageable, String sortname, String sortorder) {
|
public Page<Tuple> selectList(EAIMessageUISearch eaiMessageUISearch, Pageable pageable, String sortname, String sortorder) {
|
||||||
|
|
||||||
@@ -201,6 +204,32 @@ public class EAIMessageService extends AbstractDataService<EAIMessageEntity, Str
|
|||||||
predicate
|
predicate
|
||||||
.and(qStdInfo.apifullpath.contains(eaiMessageUISearch.getSearchApiFullPath()));
|
.and(qStdInfo.apifullpath.contains(eaiMessageUISearch.getSearchApiFullPath()));
|
||||||
}
|
}
|
||||||
|
if (StringUtils.isNotBlank(eaiMessageUISearch.getSearchInOutType())) {
|
||||||
|
predicate.and(qeaiMessageEntity.eaisvcname.endsWith(eaiMessageUISearch.getSearchInOutType()));
|
||||||
|
}
|
||||||
|
|
||||||
|
String specStatus = eaiMessageUISearch.getSearchSpecStatus();
|
||||||
|
if ("UNREGISTERED".equals(specStatus)) {
|
||||||
|
predicate.and(apiSpecRegisteredExpression(qeaiMessageEntity.eaisvcname).not());
|
||||||
|
} else if ("REGISTERED".equals(specStatus) || "PUBLISHED".equals(specStatus)) {
|
||||||
|
predicate.and(apiIdInExpression(qeaiMessageEntity.eaisvcname,
|
||||||
|
apiSpecStatusRepository.findApiIdsByStatus(specStatus)));
|
||||||
|
}
|
||||||
|
|
||||||
|
String apiGroupId = eaiMessageUISearch.getSearchApiGroupId();
|
||||||
|
if (StringUtils.isNotBlank(apiGroupId)) {
|
||||||
|
QApiGroupApi membership = QApiGroupApi.apiGroupApi;
|
||||||
|
QApiGroup group = QApiGroup.apiGroup;
|
||||||
|
JPQLQuery<Integer> groupQuery = JPAExpressions.selectOne()
|
||||||
|
.from(membership)
|
||||||
|
.join(membership.apiGroup, group)
|
||||||
|
.where(membership.id.apiId.eq(qeaiMessageEntity.eaisvcname));
|
||||||
|
if ("UNREGISTERED".equals(apiGroupId)) {
|
||||||
|
predicate.and(groupQuery.notExists());
|
||||||
|
} else {
|
||||||
|
predicate.and(groupQuery.where(group.id.eq(apiGroupId)).exists());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(eaiMessageUISearch.getSearchStatusCode())) {
|
if (StringUtils.isNotBlank(eaiMessageUISearch.getSearchStatusCode())) {
|
||||||
String statusCode = eaiMessageUISearch.getSearchStatusCode();
|
String statusCode = eaiMessageUISearch.getSearchStatusCode();
|
||||||
@@ -230,7 +259,10 @@ public class EAIMessageService extends AbstractDataService<EAIMessageEntity, Str
|
|||||||
* API ID 를 EMS 커넥션에서 따로 읽어 IN 절로 넘긴다.</p>
|
* API ID 를 EMS 커넥션에서 따로 읽어 IN 절로 넘긴다.</p>
|
||||||
*/
|
*/
|
||||||
private BooleanExpression apiSpecRegisteredExpression(StringPath eaiSvcNamePath) {
|
private BooleanExpression apiSpecRegisteredExpression(StringPath eaiSvcNamePath) {
|
||||||
List<String> specApiIds = apiSpecInfoRepository.findAllApiIds();
|
return apiIdInExpression(eaiSvcNamePath, apiSpecInfoRepository.findAllApiIds());
|
||||||
|
}
|
||||||
|
|
||||||
|
private BooleanExpression apiIdInExpression(StringPath eaiSvcNamePath, List<String> specApiIds) {
|
||||||
if (specApiIds.isEmpty()) {
|
if (specApiIds.isEmpty()) {
|
||||||
// in(빈 리스트) 는 JPQL 이 깨지므로 항상 거짓인 조건으로 대체한다
|
// in(빈 리스트) 는 JPQL 이 깨지므로 항상 거짓인 조건으로 대체한다
|
||||||
return Expressions.ONE.eq(Expressions.TWO);
|
return Expressions.ONE.eq(Expressions.TWO);
|
||||||
@@ -245,6 +277,18 @@ public class EAIMessageService extends AbstractDataService<EAIMessageEntity, Str
|
|||||||
return expression;
|
return expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 현재 페이지의 스펙 상태를 일괄 조회한다. Oracle IN 절은 1,000개씩 나눈다. */
|
||||||
|
public Map<String, String> findApiSpecStatuses(List<String> apiIds) {
|
||||||
|
Map<String, String> statuses = new HashMap<>();
|
||||||
|
for (int from = 0; from < apiIds.size(); from += ORACLE_IN_LIMIT) {
|
||||||
|
int to = Math.min(from + ORACLE_IN_LIMIT, apiIds.size());
|
||||||
|
for (ApiSpecStatusRepository.SpecStatus spec : apiSpecStatusRepository.findStatusesByApiIds(apiIds.subList(from, to))) {
|
||||||
|
statuses.put(spec.getApiId(), "Y".equals(spec.getDisplayYn()) ? "PUBLISHED" : "REGISTERED");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return statuses;
|
||||||
|
}
|
||||||
|
|
||||||
/** 노출 중인(display_yn='1') API 그룹에 편성된 API ID. API_GROUP 은 EAI 메시지와 같은 스키마다 */
|
/** 노출 중인(display_yn='1') API 그룹에 편성된 API ID. API_GROUP 은 EAI 메시지와 같은 스키마다 */
|
||||||
private JPQLQuery<String> displayedGroupApiIdSubQuery() {
|
private JPQLQuery<String> displayedGroupApiIdSubQuery() {
|
||||||
QApiGroupApi qApiGroupApi = QApiGroupApi.apiGroupApi;
|
QApiGroupApi qApiGroupApi = QApiGroupApi.apiGroupApi;
|
||||||
|
|||||||
@@ -19,6 +19,12 @@ public class EAIMessageUISearch {
|
|||||||
private String searchRefKey;
|
private String searchRefKey;
|
||||||
|
|
||||||
private String searchApiFullPath;
|
private String searchApiFullPath;
|
||||||
|
/** API ID 마지막 자리 (1: 당발, 2: 타발) */
|
||||||
|
private String searchInOutType;
|
||||||
|
/** UNREGISTERED: 미등록, REGISTERED: 등록(비게시), PUBLISHED: 게시 */
|
||||||
|
private String searchSpecStatus;
|
||||||
|
/** 그룹 ID. UNREGISTERED이면 소속 그룹이 없는 API */
|
||||||
|
private String searchApiGroupId;
|
||||||
|
|
||||||
/** API_STATUS.STATUS_CODE (E:장애, D:지연, C:점검). "N" 이면 정상(코드 없음)만 조회 */
|
/** API_STATUS.STATUS_CODE (E:장애, D:지연, C:점검). "N" 이면 정상(코드 없음)만 조회 */
|
||||||
private String searchStatusCode;
|
private String searchStatusCode;
|
||||||
|
|||||||
+2
@@ -62,6 +62,8 @@ public class InboundErrorInfoService extends AbstractDataService<InboundErrorInf
|
|||||||
List<InboundErrorInfo> list = query
|
List<InboundErrorInfo> list = query
|
||||||
.select(qInboundErrorInfo)
|
.select(qInboundErrorInfo)
|
||||||
.orderBy(qInboundErrorInfo.erroccurhms.desc())
|
.orderBy(qInboundErrorInfo.erroccurhms.desc())
|
||||||
|
.offset(pageable.getOffset())
|
||||||
|
.limit(pageable.getPageSize())
|
||||||
.fetch();
|
.fetch();
|
||||||
|
|
||||||
return new PageImpl<>(list, pageable, totalCount);
|
return new PageImpl<>(list, pageable, totalCount);
|
||||||
|
|||||||
+3
-3
@@ -336,12 +336,12 @@ public class ApiStatsMinuteService
|
|||||||
|
|
||||||
if (StringUtils.isNotBlank(search.getSearchEndDateTime())) {
|
if (StringUtils.isNotBlank(search.getSearchEndDateTime())) {
|
||||||
endDateTime = LocalDateTime.parse(search.getSearchEndDateTime(), DATE_TIME_FORMATTER);
|
endDateTime = LocalDateTime.parse(search.getSearchEndDateTime(), DATE_TIME_FORMATTER);
|
||||||
// 1시간(60분) 초과 시 시작시간 기준 1시간 후로 강제 설정
|
// 1시간(60분) 초과 시 시작시간 기준 1시간치(정시~59분, statTime 조건이 양끝 포함이므로 -1분)로 강제 설정
|
||||||
if (java.time.Duration.between(startDateTime, endDateTime).toMinutes() > MAX_MINUTES) {
|
if (java.time.Duration.between(startDateTime, endDateTime).toMinutes() > MAX_MINUTES) {
|
||||||
endDateTime = startDateTime.plusMinutes(MAX_MINUTES);
|
endDateTime = startDateTime.plusMinutes(MAX_MINUTES - 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
endDateTime = startDateTime.plusMinutes(MAX_MINUTES);
|
endDateTime = startDateTime.plusMinutes(MAX_MINUTES - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
search.setParsedStartDateTime(startDateTime);
|
search.setParsedStartDateTime(startDateTime);
|
||||||
|
|||||||
+8
@@ -20,4 +20,12 @@ public class TransactionTrackingFilterService extends
|
|||||||
.fetch();
|
.fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void deleteAllByUserId(String userId) {
|
||||||
|
repository.deleteAll(findAllByUserId(userId));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void saveAll(List<TransactionTrackingFilter> filters) {
|
||||||
|
repository.saveAll(filters);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,16 @@
|
|||||||
package com.eactive.eai.rms.ext.djb.inflow;
|
package com.eactive.eai.rms.ext.djb.inflow;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
import com.eactive.eai.data.jpa.BaseRepository;
|
import com.eactive.eai.data.jpa.BaseRepository;
|
||||||
import com.eactive.eai.rms.data.entity.onl.djb.inflow.InflowTokenInsufficient;
|
|
||||||
import com.eactive.eai.rms.data.entity.onl.djb.inflow.InflowTokenInsufficientLog;
|
import com.eactive.eai.rms.data.entity.onl.djb.inflow.InflowTokenInsufficientLog;
|
||||||
import com.eactive.eai.rms.data.entity.onl.djb.inflow.InflowTokenInsufficientLogId;
|
import com.eactive.eai.rms.data.entity.onl.djb.inflow.InflowTokenInsufficientLogId;
|
||||||
|
|
||||||
public interface InflowTokenRepository extends BaseRepository<InflowTokenInsufficientLog, InflowTokenInsufficientLogId> {
|
public interface InflowTokenRepository extends BaseRepository<InflowTokenInsufficientLog, InflowTokenInsufficientLogId> {
|
||||||
|
|
||||||
@Query(nativeQuery = true, value =
|
@Query(nativeQuery = true, value =
|
||||||
" SELECT EAISVCNAME" +
|
" SELECT COUNT(*)" +
|
||||||
" , (SELECT EAISVCDESC FROM TSEAIHE01 WHERE A.EAISVCNAME = EAISVCNAME) AS EAISVCDESC" +
|
" FROM TSEAIFR11" +
|
||||||
" , COUNT(*) AS CNT" +
|
" WHERE MSGDPSTYMS >= TO_CHAR(SYSTIMESTAMP - NUMTODSINTERVAL(:rangeMinute, 'MINUTE'), 'YYYYMMDDHH24MISSFF3')")
|
||||||
" FROM TSEAIFR11 A" +
|
long countTokenInsufficient(@Param("rangeMinute") long rangeMinute);
|
||||||
" WHERE MSGDPSTYMS >= TO_CHAR(SYSTIMESTAMP - NUMTODSINTERVAL(:rangeMinute, 'MINUTE'), 'YYYYMMDDHH24MISSFF3')" +
|
}
|
||||||
" GROUP BY EAISVCNAME")
|
|
||||||
List<InflowTokenInsufficient> countTokenInsufficient(@Param("rangeMinute") long rangeMinute);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.eactive.eai.rms.ext.djb.inflow;
|
package com.eactive.eai.rms.ext.djb.inflow;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -11,7 +10,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import com.eactive.apim.portal.template.entity.MessageCode;
|
import com.eactive.apim.portal.template.entity.MessageCode;
|
||||||
import com.eactive.eai.rms.common.context.MonitoringContext;
|
import com.eactive.eai.rms.common.context.MonitoringContext;
|
||||||
import com.eactive.eai.rms.data.entity.onl.djb.inflow.InflowTokenInsufficient;
|
|
||||||
import com.eactive.eai.rms.ext.djb.ums.UmsManager;
|
import com.eactive.eai.rms.ext.djb.ums.UmsManager;
|
||||||
|
|
||||||
|
|
||||||
@@ -23,25 +21,29 @@ public class InflowTokenService {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private InflowTokenRepository inflowTokenRepository;
|
private InflowTokenRepository inflowTokenRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MonitoringContext monitoringContext;
|
private MonitoringContext monitoringContext;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UmsManager ums;
|
private UmsManager ums;
|
||||||
|
|
||||||
public void checkRecentFails(long rangeMinute) {
|
public void checkRecentFails(long rangeMinute) {
|
||||||
if (monitoringContext.getBooleanProperty(MonitoringContext.DJB_UMS_MESSENGER_APIMONITOR_ENABLED, true)) {
|
if (!monitoringContext.getBooleanProperty(MonitoringContext.DJB_UMS_MESSENGER_APIMONITOR_ENABLED, true)) {
|
||||||
List<InflowTokenInsufficient> rows = inflowTokenRepository.countTokenInsufficient(rangeMinute);
|
return;
|
||||||
|
|
||||||
for (InflowTokenInsufficient info : rows) {
|
|
||||||
log.debug("유량제어 토큰 획득 실패: {}-{} 최근 {}분 동안 {}건", info.getEaisvcname(), info.getEaisvcdesc(), rangeMinute, info.getCnt());
|
|
||||||
String message = "유량제어 토큰 획득 실패가 발생하였습니다 \n" + info.getEaisvcname();
|
|
||||||
|
|
||||||
HashMap<String,Object> params = new HashMap<String,Object>();
|
|
||||||
params.put("message", message);
|
|
||||||
ums.sendMessenger("api-monitor", MessageCode.INFLOW_TOKEN_FAILED, params);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long failCount = inflowTokenRepository.countTokenInsufficient(rangeMinute);
|
||||||
|
if (failCount <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
log.debug("유량제어 토큰 획득 실패: 최근 {}분 동안 {}건", rangeMinute, failCount);
|
||||||
|
|
||||||
|
String message = "유량제어 토큰 획득 실패가 발생하였습니다\n최근 " + rangeMinute + "분 동안 " + failCount + "건";
|
||||||
|
|
||||||
|
HashMap<String, Object> params = new HashMap<String, Object>();
|
||||||
|
params.put("message", message);
|
||||||
|
ums.sendMessenger("api-monitor", MessageCode.INFLOW_TOKEN_FAILED, params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,18 @@
|
|||||||
package com.eactive.eai.rms.ext.djb.ums.service;
|
package com.eactive.eai.rms.ext.djb.ums.service;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.InetAddress;
|
||||||
|
import java.net.NetworkInterface;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -40,13 +44,11 @@ public class UmsService {
|
|||||||
private static final Gson gson = new Gson();
|
private static final Gson gson = new Gson();
|
||||||
|
|
||||||
private static final String SYS_DVCD = "API"; //시스템코드
|
private static final String SYS_DVCD = "API"; //시스템코드
|
||||||
private static final String BZWK_DVCD = "99"; //업무구분코드
|
|
||||||
private static final String BZWK_CD = "999"; //업무코드
|
|
||||||
private static final String BZWK_DCLS_DVCD = "9019"; //세부구분코드
|
private static final String BZWK_DCLS_DVCD = "9019"; //세부구분코드
|
||||||
private static final String SUB_BZWK_CD = "999"; //서브업무코드 TODO: 변경할것
|
private static final String BZWK_CD = "EBK"; //업무코드
|
||||||
private static final String TEAM_DVCD = "99"; //팀구분코드 TODO: 변경해야함
|
private static final String SUB_BZWK_CD = "EBG"; //서브업무코드
|
||||||
|
|
||||||
|
|
||||||
private final MonitoringPropertyService propertyService;
|
private final MonitoringPropertyService propertyService;
|
||||||
private final MessageRequestService messageRequestService;
|
private final MessageRequestService messageRequestService;
|
||||||
|
|
||||||
@@ -60,27 +62,35 @@ public class UmsService {
|
|||||||
throw new IllegalArgumentException("messageRequest is null");
|
throw new IllegalArgumentException("messageRequest is null");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.httpConnection(messageRequest);
|
UmsResponse response = this.httpConnection(messageRequest);
|
||||||
|
|
||||||
return true;
|
// HTTP 응답코드가 2xx 일 때만 SENT, 나머지는 FAILED
|
||||||
|
boolean success = response.getHttpStatus() >= 200 && response.getHttpStatus() < 300;
|
||||||
|
|
||||||
|
messageRequest.setRequestStatus(success ? "SENT" : "FAILED");
|
||||||
|
messageRequest.setSentDate(LocalDateTime.now());
|
||||||
|
messageRequest.setResponseData(response.getResponseData());
|
||||||
|
messageRequestService.save(messageRequest);
|
||||||
|
|
||||||
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void httpConnection(MessageRequest messageRequest) throws Exception {
|
private UmsResponse httpConnection(MessageRequest messageRequest) throws Exception {
|
||||||
HttpURLConnection conn = null;
|
HttpURLConnection conn = null;
|
||||||
BufferedReader br = null;
|
BufferedReader br = null;
|
||||||
log.debug("<<<HTTP Connection>>>:" + messageRequest.toString());
|
log.debug("<<<HTTP Connection>>>:" + messageRequest.toString());
|
||||||
try {
|
try {
|
||||||
String host = propertyService.getPropertyValue("Monitoring", "djb.ums."+messageRequest.getMessageType().toLowerCase()+".url", "");
|
String host = propertyService.getPropertyValue("Monitoring", "djb.ums."+messageRequest.getMessageType().toLowerCase()+".url", "");
|
||||||
|
|
||||||
URL url = new URL(host);
|
URL url = new URL(host);
|
||||||
int timeoutValue = 5 * 1000; // 타임아웃 설정을 위한 값 (단위: ms)
|
int timeoutValue = 5 * 1000; // 타임아웃 설정을 위한 값 (단위: ms)
|
||||||
// Charset charset = Charset.forName("UTF-8");
|
// Charset charset = Charset.forName("UTF-8");
|
||||||
Charset charset = Charset.forName("MS949");
|
Charset charset = Charset.forName("MS949");
|
||||||
|
|
||||||
StringBuffer sb = null;
|
StringBuffer sb = null;
|
||||||
String bodyData = this.makeBodyData(messageRequest);
|
String bodyData = this.makeBodyData(messageRequest);
|
||||||
|
|
||||||
String responseData = "";
|
String responseData = "";
|
||||||
String method = bodyData.isEmpty() ? "GET" : "POST";
|
String method = bodyData.isEmpty() ? "GET" : "POST";
|
||||||
conn = (HttpURLConnection) url.openConnection();
|
conn = (HttpURLConnection) url.openConnection();
|
||||||
@@ -90,7 +100,7 @@ public class UmsService {
|
|||||||
conn.setConnectTimeout(timeoutValue); // 연결 타임아웃 설정(5초)
|
conn.setConnectTimeout(timeoutValue); // 연결 타임아웃 설정(5초)
|
||||||
conn.setReadTimeout(timeoutValue); // 읽기 타임아웃 설정(5초)
|
conn.setReadTimeout(timeoutValue); // 읽기 타임아웃 설정(5초)
|
||||||
conn.setDoOutput(true);
|
conn.setDoOutput(true);
|
||||||
|
|
||||||
// POst 방식인 경우에만
|
// POst 방식인 경우에만
|
||||||
if (method.equals("POST")) {
|
if (method.equals("POST")) {
|
||||||
OutputStream os = conn.getOutputStream();
|
OutputStream os = conn.getOutputStream();
|
||||||
@@ -98,27 +108,32 @@ public class UmsService {
|
|||||||
os.write(requestData);
|
os.write(requestData);
|
||||||
os.close();
|
os.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int responseCode = conn.getResponseCode();
|
||||||
|
|
||||||
if (log.isDebugEnabled()) {
|
if (log.isDebugEnabled()) {
|
||||||
log.debug("getContentType();" + conn.getContentType()); // 응답 콘텐츠 유형 구하기
|
log.debug("getContentType();" + conn.getContentType()); // 응답 콘텐츠 유형 구하기
|
||||||
log.debug("getResponsecode();" + conn.getResponseCode()); // 응답 코드 구하기
|
log.debug("getResponsecode();" + responseCode); // 응답 코드 구하기
|
||||||
log.debug("getResponseMessage():" + conn.getResponseMessage()); // 응답 메세지 구하기
|
log.debug("getResponseMessage():" + conn.getResponseMessage()); // 응답 메세지 구하기
|
||||||
}
|
}
|
||||||
|
|
||||||
// http 요청 후 응답 받은 데이타를 버퍼에 쌓는다
|
// http 요청 후 응답 받은 데이타를 버퍼에 쌓는다
|
||||||
if (conn.getResponseCode() >= 200 && conn.getResponseCode() <= 300) {
|
InputStream is = (responseCode >= 200 && responseCode < 300) ? conn.getInputStream() : conn.getErrorStream();
|
||||||
br = new BufferedReader(new InputStreamReader(conn.getInputStream(), charset));
|
if (is != null) {
|
||||||
} else {
|
br = new BufferedReader(new InputStreamReader(is, charset));
|
||||||
br = new BufferedReader(new InputStreamReader(conn.getErrorStream(), charset));
|
|
||||||
|
String inputLine;
|
||||||
|
sb = new StringBuffer();
|
||||||
|
while ((inputLine = br.readLine()) != null) {
|
||||||
|
sb.append(inputLine);
|
||||||
|
}
|
||||||
|
|
||||||
|
responseData = sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
String inputLine;
|
|
||||||
sb = new StringBuffer();
|
return new UmsResponse(responseCode, responseData);
|
||||||
while ((inputLine = br.readLine()) != null) {
|
|
||||||
sb.append(inputLine);
|
|
||||||
}
|
|
||||||
|
|
||||||
responseData = sb.toString();
|
|
||||||
} finally {
|
} finally {
|
||||||
// http 요청 및 응답 완료 후 BufferedReader를 닫는다
|
// http 요청 및 응답 완료 후 BufferedReader를 닫는다
|
||||||
if (br != null) {
|
if (br != null) {
|
||||||
@@ -129,9 +144,66 @@ public class UmsService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** UMS HTTP 호출 결과(응답코드 + 응답본문) 보관용. */
|
||||||
|
private static class UmsResponse {
|
||||||
|
private final int httpStatus;
|
||||||
|
private final String responseData;
|
||||||
|
|
||||||
|
UmsResponse(int httpStatus, String responseData) {
|
||||||
|
this.httpStatus = httpStatus;
|
||||||
|
this.responseData = responseData;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getHttpStatus() {
|
||||||
|
return httpStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getResponseData() {
|
||||||
|
return responseData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 표준 헤더의 최초전문송신IP(frst_trnm_ipad)용 - 프로퍼티 설정값 대신 현재 서버(WAS)의 실제 IP를 조회한다.
|
||||||
|
* 조회 실패 시에는 기존처럼 djb.ums.was_ip_address 프로퍼티 값으로 대체한다.
|
||||||
|
*/
|
||||||
|
private String getCurrentServerIp() {
|
||||||
|
try {
|
||||||
|
return InetAddress.getLocalHost().getHostAddress();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("getCurrentServerIp error", e);
|
||||||
|
return propertyService.getPropertyValue("Monitoring", "djb.ums.was_ip_address", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 표준 헤더의 최초전문송신MAC(frst_trnm_mac)용 - 프로퍼티 설정값 대신 현재 서버(WAS)의 실제 MAC 주소를 조회한다.
|
||||||
|
* 조회 실패(네트워크 인터페이스를 찾지 못하는 경우 포함) 시에는 기존처럼 djb.ums.was_mac_address 프로퍼티 값으로 대체한다.
|
||||||
|
*/
|
||||||
|
private String getCurrentServerMac() {
|
||||||
|
try {
|
||||||
|
NetworkInterface ni = NetworkInterface.getByInetAddress(InetAddress.getLocalHost());
|
||||||
|
byte[] mac = (ni != null) ? ni.getHardwareAddress() : null;
|
||||||
|
if (mac == null) {
|
||||||
|
return propertyService.getPropertyValue("Monitoring", "djb.ums.was_mac_address", "");
|
||||||
|
}
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (int i = 0; i < mac.length; i++) {
|
||||||
|
if (i > 0) {
|
||||||
|
sb.append(":");
|
||||||
|
}
|
||||||
|
sb.append(String.format("%02X", mac[i]));
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("getCurrentServerMac error", e);
|
||||||
|
return propertyService.getPropertyValue("Monitoring", "djb.ums.was_mac_address", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private String makeBodyData(MessageRequest messageRequest) {
|
private String makeBodyData(MessageRequest messageRequest) {
|
||||||
// 리턴값
|
// 리턴값
|
||||||
String rtnVal = "";
|
String rtnVal = "";
|
||||||
@@ -147,9 +219,9 @@ public class UmsService {
|
|||||||
stdHeadVO.setStnd_mesg_ver("R10");
|
stdHeadVO.setStnd_mesg_ver("R10");
|
||||||
stdHeadVO.setOrtr_guid(jsonData[2]);
|
stdHeadVO.setOrtr_guid(jsonData[2]);
|
||||||
stdHeadVO.setSect_ecrpt_yn("N");
|
stdHeadVO.setSect_ecrpt_yn("N");
|
||||||
stdHeadVO.setFrst_trnm_ipad(propertyService.getPropertyValue("Monitoring", "djb.ums.was_ip_address", ""));
|
stdHeadVO.setFrst_trnm_ipad(getCurrentServerIp());
|
||||||
stdHeadVO.setFrst_trnm_ipv4_addr(propertyService.getPropertyValue("Monitoring", "djb.ums.was_ip_address", ""));
|
stdHeadVO.setFrst_trnm_ipv4_addr(getCurrentServerIp());
|
||||||
stdHeadVO.setFrst_trnm_mac(propertyService.getPropertyValue("Monitoring", "djb.ums.was_mac_address", ""));
|
stdHeadVO.setFrst_trnm_mac(getCurrentServerMac());
|
||||||
stdHeadVO.setFrst_mesg_dman_dt(jsonData[0]);
|
stdHeadVO.setFrst_mesg_dman_dt(jsonData[0]);
|
||||||
stdHeadVO.setFrst_mesg_dman_time(jsonData[1]);
|
stdHeadVO.setFrst_mesg_dman_time(jsonData[1]);
|
||||||
stdHeadVO.setFrst_trnm_sys_dvcd(SYS_DVCD);
|
stdHeadVO.setFrst_trnm_sys_dvcd(SYS_DVCD);
|
||||||
@@ -161,7 +233,7 @@ public class UmsService {
|
|||||||
stdHeadVO.setChnl_tycd("EAI"); // 채널유형코드
|
stdHeadVO.setChnl_tycd("EAI"); // 채널유형코드
|
||||||
stdHeadVO.setHmab_dvcd("1"); // 내외구분코드 1:내부 2:외부(타발)
|
stdHeadVO.setHmab_dvcd("1"); // 내외구분코드 1:내부 2:외부(타발)
|
||||||
stdHeadVO.setIf_id(messageRequest.getEaiInterfaceId()); // 인터페이스ID
|
stdHeadVO.setIf_id(messageRequest.getEaiInterfaceId()); // 인터페이스ID
|
||||||
stdHeadVO.setTx_id(messageRequest.getServiceId()); // 거래ID
|
stdHeadVO.setTx_id(messageRequest.getEaiTxId()); // 거래ID
|
||||||
|
|
||||||
if ("MESSENGER".equals(messageRequest.getMessageType()) ) {
|
if ("MESSENGER".equals(messageRequest.getMessageType()) ) {
|
||||||
|
|
||||||
@@ -205,7 +277,7 @@ public class UmsService {
|
|||||||
// Sms 데이터
|
// Sms 데이터
|
||||||
SmsDataVO dataVO = new SmsDataVO();
|
SmsDataVO dataVO = new SmsDataVO();
|
||||||
dataVO.setSnd_dman_dt(jsonData[0]);
|
dataVO.setSnd_dman_dt(jsonData[0]);
|
||||||
dataVO.setSnd_dman_id(this.getSndDmanId(messageRequest.getMessageType()));
|
dataVO.setSnd_dman_id(this.getSndDmanId(messageRequest));
|
||||||
dataVO.setSnd_dvcd("EAI");
|
dataVO.setSnd_dvcd("EAI");
|
||||||
dataVO.setSms_msg_titl(StringUtil.chunkString(messageRequest.getSubject(), 40, false)); // MS949 40byte 초과시 절단
|
dataVO.setSms_msg_titl(StringUtil.chunkString(messageRequest.getSubject(), 40, false)); // MS949 40byte 초과시 절단
|
||||||
dataVO.setSms_msg_ctnt(messageRequest.getMessage());
|
dataVO.setSms_msg_ctnt(messageRequest.getMessage());
|
||||||
@@ -215,19 +287,21 @@ public class UmsService {
|
|||||||
dataVO.setSnd_emp_dprm_cd("132"); //요청부서코드
|
dataVO.setSnd_emp_dprm_cd("132"); //요청부서코드
|
||||||
dataVO.setLtrs_snd_tycd("2"); // 1:SMS 2:LMS/MMS
|
dataVO.setLtrs_snd_tycd("2"); // 1:SMS 2:LMS/MMS
|
||||||
dataVO.setMsg_snd_tycd("1008"); // 알림톡 메세지 종류 0000:SMS, 1000:LMS, 1008:알림톡, ....
|
dataVO.setMsg_snd_tycd("1008"); // 알림톡 메세지 종류 0000:SMS, 1000:LMS, 1008:알림톡, ....
|
||||||
//ADMIN으로 시작하면 제주은행 임직원, 나머지는 제주은행 고객용
|
//ADMIN으로 시작하면 제주은행 내부용, 나머지는 제주은행 고객용
|
||||||
if (messageRequest.getMessageCode().name().startsWith("ADMIN")) {
|
if (messageRequest.getMessageCode().name().startsWith("ADMIN")) {
|
||||||
|
dataVO.setSms_trnm_bzwk_dvcd("99"); //업무구분코드
|
||||||
|
dataVO.setSms_bzwk_dcls_dvcd(BZWK_DCLS_DVCD); //업무세분코드
|
||||||
dataVO.setAlmtk_snd_prfl_key(propertyService.getPropertyValue("Monitoring", "djb.ums.sms.almtk_snd_prtl_key.intra", "")); // 제주은행 임직원 플러스친구아이디
|
dataVO.setAlmtk_snd_prfl_key(propertyService.getPropertyValue("Monitoring", "djb.ums.sms.almtk_snd_prtl_key.intra", "")); // 제주은행 임직원 플러스친구아이디
|
||||||
} else {
|
} else {
|
||||||
|
dataVO.setSms_trnm_bzwk_dvcd("95"); //업무구분코드
|
||||||
|
dataVO.setSms_bzwk_dcls_dvcd(BZWK_DCLS_DVCD); //업무세분코드
|
||||||
dataVO.setAlmtk_snd_prfl_key(propertyService.getPropertyValue("Monitoring", "djb.ums.sms.almtk_snd_prtl_key.public", "")); // 제주은행 플러스친구아이디
|
dataVO.setAlmtk_snd_prfl_key(propertyService.getPropertyValue("Monitoring", "djb.ums.sms.almtk_snd_prtl_key.public", "")); // 제주은행 플러스친구아이디
|
||||||
}
|
}
|
||||||
dataVO.setAlmtk_tmplt_cd(BZWK_DVCD + TEAM_DVCD + BZWK_DCLS_DVCD + "001"); // 템플릿코드
|
dataVO.setAlmtk_tmplt_cd(messageRequest.getServiceId()); // 템플릿코드
|
||||||
dataVO.setAlmtk_err_ltrs_snd_yn("Y"); // 오류자문자발송여부
|
dataVO.setAlmtk_err_ltrs_snd_yn("Y"); // 오류자문자발송여부
|
||||||
dataVO.setAlmtk_btn_trnm_tycd("2"); // 카카오버튼전송방식 1-format string 2-JSON 3-XML
|
dataVO.setAlmtk_btn_trnm_tycd("2"); // 카카오버튼전송방식 1-format string 2-JSON 3-XML
|
||||||
|
|
||||||
dataVO.setSms_trnm_bzwk_dvcd(BZWK_DVCD); //업무구분코드
|
dataVO.setSms_sys_dvcd("85"); //시스템코드
|
||||||
dataVO.setSms_bzwk_dcls_dvcd(BZWK_DCLS_DVCD); //업무세분코드
|
|
||||||
dataVO.setSms_sys_dvcd("83"); //시스템코드
|
|
||||||
dataVO.setTx_dt(jsonData[0]); //거래일자
|
dataVO.setTx_dt(jsonData[0]); //거래일자
|
||||||
dataVO.setTx_tktm(jsonData[1].substring(0,6)); //거래시간
|
dataVO.setTx_tktm(jsonData[1].substring(0,6)); //거래시간
|
||||||
|
|
||||||
@@ -251,7 +325,7 @@ public class UmsService {
|
|||||||
EmailDataVO dataVO = new EmailDataVO();
|
EmailDataVO dataVO = new EmailDataVO();
|
||||||
dataVO.setUms_evnt_id(propertyService.getPropertyValue("Monitoring", "djb.ums.email.ums_evnt_id", "")); // UMS이벤트ID(필수)
|
dataVO.setUms_evnt_id(propertyService.getPropertyValue("Monitoring", "djb.ums.email.ums_evnt_id", "")); // UMS이벤트ID(필수)
|
||||||
dataVO.setSnd_dman_dt(jsonData[0]);
|
dataVO.setSnd_dman_dt(jsonData[0]);
|
||||||
dataVO.setSnd_dman_id(this.getSndDmanId(messageRequest.getMessageType()));
|
dataVO.setSnd_dman_id(this.getSndDmanId(messageRequest));
|
||||||
dataVO.setDman_seqno(1); // 발송요청순번
|
dataVO.setDman_seqno(1); // 발송요청순번
|
||||||
dataVO.setEmail_titl(messageRequest.getSubject()); // 메일제목
|
dataVO.setEmail_titl(messageRequest.getSubject()); // 메일제목
|
||||||
dataVO.setCstno(propertyService.getPropertyValue("Monitoring", "djb.ums.email.cstno", "")); // 고객번호(필수)
|
dataVO.setCstno(propertyService.getPropertyValue("Monitoring", "djb.ums.email.cstno", "")); // 고객번호(필수)
|
||||||
@@ -263,7 +337,7 @@ public class UmsService {
|
|||||||
dataVO.setSnd_emp_dprm_cd("132"); // 발신자부서코드(필수)
|
dataVO.setSnd_emp_dprm_cd("132"); // 발신자부서코드(필수)
|
||||||
dataVO.setBzwk_cd(BZWK_CD); // 업무코드
|
dataVO.setBzwk_cd(BZWK_CD); // 업무코드
|
||||||
dataVO.setSub_bzwk_cd(SUB_BZWK_CD); // 서브업무코드
|
dataVO.setSub_bzwk_cd(SUB_BZWK_CD); // 서브업무코드
|
||||||
dataVO.setSys_dvcd(SYS_DVCD); // 시스템구분코드
|
dataVO.setSys_dvcd("85"); // 시스템구분코드
|
||||||
dataVO.setTx_dt(jsonData[0]); // 거래일자
|
dataVO.setTx_dt(jsonData[0]); // 거래일자
|
||||||
dataVO.setTx_tktm(jsonData[1].substring(0,6)); // 거래시간
|
dataVO.setTx_tktm(jsonData[1].substring(0,6)); // 거래시간
|
||||||
|
|
||||||
@@ -357,20 +431,24 @@ public class UmsService {
|
|||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getSndDmanId(String messageType) {
|
private String getSndDmanId(MessageRequest messageRequest) {
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
||||||
String yyyymmdd = sdf.format(new Date());
|
String yyyymmdd = sdf.format(new Date());
|
||||||
|
|
||||||
String uuid = "";
|
String uuid = "";
|
||||||
|
|
||||||
if ("EMAIL".equals(messageType)) {
|
if ("EMAIL".equals(messageRequest.getMessageType())) {
|
||||||
uuid = SYS_DVCD + BZWK_CD + SUB_BZWK_CD + yyyymmdd + "O" + "E" ;
|
uuid = SYS_DVCD + BZWK_CD + SUB_BZWK_CD + yyyymmdd + "O" + "E" ;
|
||||||
|
|
||||||
long seq = messageRequestService.countEmailRequestsOnDate(LocalDate.now()) + 1;
|
long seq = messageRequestService.countEmailRequestsOnDate(LocalDate.now()) + 1;
|
||||||
uuid += String.format("%013d", seq);
|
uuid += String.format("%013d", seq);
|
||||||
|
|
||||||
} else if ("SMS".equals(messageType)) { //kakao 알림톡
|
} else if ("SMS".equals(messageRequest.getMessageType())) { //kakao 알림톡
|
||||||
uuid = SYS_DVCD + BZWK_DVCD + BZWK_DCLS_DVCD + yyyymmdd + "O" + "K";
|
if (messageRequest.getMessageCode().name().startsWith("ADMIN")) {
|
||||||
|
uuid = SYS_DVCD + "99" + BZWK_DCLS_DVCD + yyyymmdd + "O" + "K"; //내부용
|
||||||
|
} else {
|
||||||
|
uuid = SYS_DVCD + "95" + BZWK_DCLS_DVCD + yyyymmdd + "O" + "K"; //대고객
|
||||||
|
}
|
||||||
|
|
||||||
long seq = messageRequestService.countSmsKakaoRequestsOnDate(LocalDate.now()) + 1;
|
long seq = messageRequestService.countSmsKakaoRequestsOnDate(LocalDate.now()) + 1;
|
||||||
uuid += String.format("%013d", seq);
|
uuid += String.format("%013d", seq);
|
||||||
|
|||||||
+143
@@ -0,0 +1,143 @@
|
|||||||
|
package com.eactive.eai.rms.onl.apim.approval.credential;
|
||||||
|
|
||||||
|
import com.eactive.apim.portal.apispec.entity.ApiSpecInfo;
|
||||||
|
import com.eactive.apim.portal.apispec.service.ApiSpecInfoService;
|
||||||
|
import com.eactive.apim.portal.app.entity.Credential;
|
||||||
|
import com.eactive.eai.data.entity.onl.authserver.ClientEntity;
|
||||||
|
import com.eactive.eai.data.entity.onl.message.EAIMessageEntity;
|
||||||
|
import com.eactive.eai.rms.onl.transaction.apim.ApiSpecManService;
|
||||||
|
import com.eactive.eai.rms.onl.transaction.apim.DjbApiSpecAutoGenService;
|
||||||
|
import com.eactive.eai.rms.onl.transaction.apim.ui.ApiSpecInfoUI;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APIGW 인증 클라이언트(TSEAIAU01) → 개발자포탈(ptl_credential) 반영, 포털 쪽 쓰기 전담.
|
||||||
|
*
|
||||||
|
* {@link com.eactive.eai.rms.onl.apim.approval.app.GwClientSyncService}(포털→GW 방향)의 반대 방향 대응물.
|
||||||
|
* 트랜잭션 매니저를 EMS(MONITORING 스키마 고정)로 명시해, 호출부(APIGW 트랜잭션)의
|
||||||
|
* {@code DataSourceContextHolder} 를 건드리지 않는다.
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class PortalCredentialSyncService {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(PortalCredentialSyncService.class);
|
||||||
|
|
||||||
|
private static final String DEFAULT_APP_DESCRIPTION = "APIGW에서 반영된 인증정보";
|
||||||
|
|
||||||
|
private final CredentialService credentialService;
|
||||||
|
private final ApiSpecInfoService apiSpecInfoService;
|
||||||
|
private final ApiSpecManService apiSpecManService;
|
||||||
|
private final DjbApiSpecAutoGenService autoGenService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GW 클라이언트 정보를 포털 Credential 로 반영한다(없으면 신규, 있으면 갱신).
|
||||||
|
*
|
||||||
|
* @param gwClient APIGW 스키마에서 조회한 클라이언트(orgid 는 공백이 아니어야 한다 - 호출부 사전 검증)
|
||||||
|
* @return 반영 결과
|
||||||
|
*/
|
||||||
|
public Outcome apply(ClientEntity gwClient) {
|
||||||
|
String clientId = gwClient.getClientid();
|
||||||
|
String orgId = gwClient.getOrgid();
|
||||||
|
|
||||||
|
Credential existing = credentialService.findByClientidAndOrgid(clientId, orgId);
|
||||||
|
boolean isNew = existing == null;
|
||||||
|
Credential credential = isNew ? new Credential() : existing;
|
||||||
|
if (isNew) {
|
||||||
|
credential.setClientid(clientId);
|
||||||
|
}
|
||||||
|
|
||||||
|
copyGwFields(gwClient, credential);
|
||||||
|
|
||||||
|
if (isNew && StringUtils.isBlank(credential.getAppDescription())) {
|
||||||
|
credential.setAppDescription(DEFAULT_APP_DESCRIPTION);
|
||||||
|
}
|
||||||
|
// appIconFileId / server 는 포털 고유 필드라 GW 에 대응값이 없다 - 기존 값 그대로 유지(신규면 null)
|
||||||
|
|
||||||
|
Outcome outcome = new Outcome(isNew);
|
||||||
|
credential.setApiList(resolveApiList(gwClient.getApiList(), outcome));
|
||||||
|
|
||||||
|
credentialService.save(credential);
|
||||||
|
return outcome;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void copyGwFields(ClientEntity gwClient, Credential credential) {
|
||||||
|
credential.setClientname(gwClient.getClientname());
|
||||||
|
credential.setClientsecret(gwClient.getClientsecret());
|
||||||
|
credential.setScope(gwClient.getScope());
|
||||||
|
credential.setGranttypes(gwClient.getGranttypes());
|
||||||
|
credential.setAccesstokenvalidityseconds(gwClient.getAccesstokenvalidityseconds());
|
||||||
|
credential.setRefreshtokenvalidityseconds(gwClient.getRefreshtokenvalidityseconds());
|
||||||
|
credential.setAllowedips(gwClient.getAllowedips());
|
||||||
|
credential.setAuthorities(gwClient.getAuthorities());
|
||||||
|
credential.setRedirecturi(gwClient.getRedirecturi());
|
||||||
|
credential.setSecuritykey(gwClient.getSecuritykey());
|
||||||
|
credential.setAutoapprove(gwClient.getAutoapprove());
|
||||||
|
credential.setResourceids(gwClient.getResourceids());
|
||||||
|
credential.setOrgid(gwClient.getOrgid());
|
||||||
|
credential.setOrgname(gwClient.getOrgname());
|
||||||
|
credential.setDailytokenlimit(gwClient.getDailytokenlimit());
|
||||||
|
credential.setModifiedby(gwClient.getModifiedby());
|
||||||
|
credential.setModifiedon(gwClient.getModifiedon());
|
||||||
|
// appstatus 는 GW 값 그대로 복사(차단 상태도 포털에 반영). 공백/null 이면 정상(1)으로 간주.
|
||||||
|
credential.setAppstatus(StringUtils.isNotBlank(gwClient.getAppstatus()) ? gwClient.getAppstatus() : "1");
|
||||||
|
}
|
||||||
|
|
||||||
|
/** GW apiList 의 각 eaisvcname 을 포털 ApiSpecInfo(영속) 로 매핑, 미등록이면 자동생성 후 저장한다. */
|
||||||
|
private List<ApiSpecInfo> resolveApiList(List<EAIMessageEntity> gwApiList, Outcome outcome) {
|
||||||
|
List<ApiSpecInfo> result = new ArrayList<>();
|
||||||
|
if (gwApiList == null) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
for (EAIMessageEntity gwApi : gwApiList) {
|
||||||
|
String apiId = gwApi.getEaisvcname();
|
||||||
|
ApiSpecInfo spec = apiSpecInfoService.findById(apiId).orElse(null);
|
||||||
|
if (spec == null) {
|
||||||
|
spec = createApiSpec(apiId, gwApi, outcome);
|
||||||
|
}
|
||||||
|
result.add(spec);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ApiSpecInfo createApiSpec(String apiId, EAIMessageEntity gwApi, Outcome outcome) {
|
||||||
|
ApiSpecInfoUI ui;
|
||||||
|
try {
|
||||||
|
ui = autoGenService.generateApiSpecInfo(apiId);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.warn("API Spec 자동생성 실패, 최소 정보로 대체 생성 - apiId: {}", apiId, e);
|
||||||
|
ui = new ApiSpecInfoUI();
|
||||||
|
ui.setApiId(apiId);
|
||||||
|
ui.setApiName(StringUtils.isNotBlank(gwApi.getEaisvcdesc()) ? gwApi.getEaisvcdesc() : apiId);
|
||||||
|
ui.setApiSimpleDescription(gwApi.getEaisvcdesc());
|
||||||
|
outcome.specGenFailed.add(apiId);
|
||||||
|
}
|
||||||
|
ui.setDisplayYn("N"); // 비공개로 자동 생성 - 관리자가 API Spec 관리에서 확인 후 공개
|
||||||
|
apiSpecManService.save(ui);
|
||||||
|
outcome.createdApiSpecs.add(apiId);
|
||||||
|
|
||||||
|
return apiSpecInfoService.findById(apiId)
|
||||||
|
.orElseThrow(() -> new IllegalStateException("API Spec 저장 직후 조회 실패: " + apiId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public static class Outcome {
|
||||||
|
private final boolean inserted;
|
||||||
|
private final List<String> createdApiSpecs = new ArrayList<>();
|
||||||
|
private final List<String> specGenFailed = new ArrayList<>();
|
||||||
|
|
||||||
|
Outcome(boolean inserted) {
|
||||||
|
this.inserted = inserted;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
-83
@@ -6,7 +6,6 @@ import com.eactive.apim.portal.approval.statemachine.listener.ApprovalListener;
|
|||||||
import com.eactive.apim.portal.portalorg.entity.PortalOrg;
|
import com.eactive.apim.portal.portalorg.entity.PortalOrg;
|
||||||
import com.eactive.apim.portal.portalorg.entity.PortalOrgEnums.ApprovalStatus;
|
import com.eactive.apim.portal.portalorg.entity.PortalOrgEnums.ApprovalStatus;
|
||||||
import com.eactive.apim.portal.portalorg.entity.PortalOrgEnums.OrgStatus;
|
import com.eactive.apim.portal.portalorg.entity.PortalOrgEnums.OrgStatus;
|
||||||
import com.eactive.apim.portal.portalproperty.service.PortalPropertyService;
|
|
||||||
import com.eactive.apim.portal.portaluser.entity.PortalUser;
|
import com.eactive.apim.portal.portaluser.entity.PortalUser;
|
||||||
import com.eactive.apim.portal.portaluser.entity.PortalUserEnums;
|
import com.eactive.apim.portal.portaluser.entity.PortalUserEnums;
|
||||||
import com.eactive.apim.portal.template.entity.MessageCode;
|
import com.eactive.apim.portal.template.entity.MessageCode;
|
||||||
@@ -14,27 +13,15 @@ import com.eactive.apim.portal.template.service.MessageRecipient;
|
|||||||
import com.eactive.apim.portal.template.service.MessageSendService;
|
import com.eactive.apim.portal.template.service.MessageSendService;
|
||||||
import com.eactive.eai.rms.data.entity.onl.apim.portalorg.PortalOrgService;
|
import com.eactive.eai.rms.data.entity.onl.apim.portalorg.PortalOrgService;
|
||||||
import com.eactive.eai.rms.data.entity.onl.apim.portaluser.PortalUserService;
|
import com.eactive.eai.rms.data.entity.onl.apim.portaluser.PortalUserService;
|
||||||
import com.eactive.eai.rms.onl.apim.portalorg.PortalOrgUI;
|
|
||||||
import com.eactive.eai.rms.onl.apim.portalorg.PortalOrgUIMapper;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.http.client.HttpClient;
|
|
||||||
import org.apache.http.client.config.RequestConfig;
|
|
||||||
import org.apache.http.impl.client.HttpClientBuilder;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.http.HttpEntity;
|
|
||||||
import org.springframework.http.HttpHeaders;
|
|
||||||
import org.springframework.http.HttpMethod;
|
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.client.RestTemplate;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Transactional
|
@Transactional
|
||||||
@@ -42,36 +29,9 @@ import org.springframework.web.client.RestTemplate;
|
|||||||
public class PortalUserApprovalListener implements ApprovalListener {
|
public class PortalUserApprovalListener implements ApprovalListener {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(PortalUserApprovalListener.class);
|
private static final Logger logger = LoggerFactory.getLogger(PortalUserApprovalListener.class);
|
||||||
private static final String PORTAL_PROPERTY_GROUP = "Portal";
|
|
||||||
private final PortalPropertyService portalPropertyService;
|
|
||||||
private final PortalOrgService portalOrgService;
|
private final PortalOrgService portalOrgService;
|
||||||
private final PortalUserService portalUserService;
|
private final PortalUserService portalUserService;
|
||||||
private final MessageSendService messageSendService;
|
private final MessageSendService messageSendService;
|
||||||
private final PortalOrgUIMapper portalOrgUIMapper;
|
|
||||||
|
|
||||||
public static RestTemplate createRestTemplateWithTimeout(int connectTimeout) {
|
|
||||||
|
|
||||||
RequestConfig requestConfig = RequestConfig.custom()
|
|
||||||
.setConnectionRequestTimeout(connectTimeout)
|
|
||||||
.setConnectTimeout(connectTimeout)
|
|
||||||
.setSocketTimeout(connectTimeout)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
HttpClient httpClient =
|
|
||||||
HttpClientBuilder.create()
|
|
||||||
.setMaxConnTotal(50)
|
|
||||||
.setMaxConnPerRoute(20)
|
|
||||||
.setDefaultRequestConfig(requestConfig)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory();
|
|
||||||
factory.setHttpClient(httpClient);
|
|
||||||
|
|
||||||
RestTemplate restTemplate = new RestTemplate();
|
|
||||||
restTemplate.setRequestFactory(factory);
|
|
||||||
|
|
||||||
return restTemplate;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Approval approval, Map<String, Object> options) throws ApprovalDeployException {
|
public void execute(Approval approval, Map<String, Object> options) throws ApprovalDeployException {
|
||||||
@@ -88,7 +48,6 @@ public class PortalUserApprovalListener implements ApprovalListener {
|
|||||||
portalOrg.setOrgStatus(OrgStatus.ACTIVE);
|
portalOrg.setOrgStatus(OrgStatus.ACTIVE);
|
||||||
portalOrgService.save(portalOrg);
|
portalOrgService.save(portalOrg);
|
||||||
|
|
||||||
// syncStaging(portalOrgUIMapper.toVo(portalOrg));
|
|
||||||
sendApprovalResult(portalUser);
|
sendApprovalResult(portalUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,48 +65,6 @@ public class PortalUserApprovalListener implements ApprovalListener {
|
|||||||
messageSendService.sendMessage(MessageCode.MANAGER_WITH_ORG_REGISTER_APPROVED, recipient, params);
|
messageSendService.sendMessage(MessageCode.MANAGER_WITH_ORG_REGISTER_APPROVED, recipient, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated 광주은행에서는 사용하지 않음. (개발/운영 완전 분리)
|
|
||||||
* @param portalOrgUI
|
|
||||||
* @throws ApprovalDeployException
|
|
||||||
*/
|
|
||||||
private void syncStaging(PortalOrgUI portalOrgUI) throws ApprovalDeployException {
|
|
||||||
throw new RuntimeException("Unable use this method(syncStaging())");
|
|
||||||
|
|
||||||
// // 프록시를 통한 스테이징 서버 호출 추가
|
|
||||||
// Map<String, String> properties = portalPropertyService.getPortalPropertiesAsMap(PORTAL_PROPERTY_GROUP);
|
|
||||||
// String apiKey = properties.get("apiKey");
|
|
||||||
// String proxyUrl = properties.get("portal.url");
|
|
||||||
// String timeout = properties.getOrDefault("deploy.proxy_timeout", "10000");
|
|
||||||
// String proxyEndpoint = proxyUrl + "/_onl/apim/portalorg/portalOrgMan.json";
|
|
||||||
//
|
|
||||||
// HttpHeaders headers = new HttpHeaders();
|
|
||||||
// headers.setContentType(MediaType.APPLICATION_JSON);
|
|
||||||
// headers.set("X-API-KEY", apiKey);
|
|
||||||
// headers.set("target_host", "stg");
|
|
||||||
// headers.set("action", "insert");
|
|
||||||
//
|
|
||||||
// portalOrgUI.setCompRegFile(null);
|
|
||||||
// HttpEntity<PortalOrgUI> request = new HttpEntity<>(portalOrgUI, headers);
|
|
||||||
//
|
|
||||||
// try {
|
|
||||||
// ResponseEntity<String> response = createRestTemplateWithTimeout(Integer.parseInt(timeout)).exchange(
|
|
||||||
// proxyEndpoint,
|
|
||||||
// HttpMethod.POST,
|
|
||||||
// request,
|
|
||||||
// String.class
|
|
||||||
// );
|
|
||||||
//
|
|
||||||
// if (!response.getStatusCode().is2xxSuccessful()) {
|
|
||||||
// logger.error("Failed to sync with staging server. Status: {}, Body: {}", response.getStatusCode(), response.getBody());
|
|
||||||
// throw new ApprovalDeployException("기관 정보 배포에 실패 했습니다.");
|
|
||||||
// }
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// logger.error("Failed to sync with staging server. {}", e.getMessage());
|
|
||||||
// throw new ApprovalDeployException("기관 정보 배포에 실패 했습니다.");
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void rollback(Approval approval) {
|
public void rollback(Approval approval) {
|
||||||
logger.debug("Rollback started for approval ID: {}, type: {}, status: {}",
|
logger.debug("Rollback started for approval ID: {}, type: {}, status: {}",
|
||||||
|
|||||||
+1
@@ -72,6 +72,7 @@ public class MessageRequestManService extends BaseService {
|
|||||||
|
|
||||||
ui.setUmsUid(e.getUmsUid());
|
ui.setUmsUid(e.getUmsUid());
|
||||||
ui.setRequestStatus(e.getRequestStatus());
|
ui.setRequestStatus(e.getRequestStatus());
|
||||||
|
ui.setResponseData(e.getResponseData());
|
||||||
ui.setEaiInterfaceId(e.getEaiInterfaceId());
|
ui.setEaiInterfaceId(e.getEaiInterfaceId());
|
||||||
ui.setServiceId(e.getServiceId());
|
ui.setServiceId(e.getServiceId());
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ public class MessageRequestUI {
|
|||||||
/* 본문 — 패턴 마스킹 + span 색상강조된 안전 HTML */
|
/* 본문 — 패턴 마스킹 + span 색상강조된 안전 HTML */
|
||||||
private String messageHtml;
|
private String messageHtml;
|
||||||
|
|
||||||
|
/* UMS 응답 내용 (RESPONSE_DATA) — 원문 그대로, 화면에서는 text 로만 출력 */
|
||||||
|
private String responseData;
|
||||||
|
|
||||||
/* 수신자 (마스킹) */
|
/* 수신자 (마스킹) */
|
||||||
private String username;
|
private String username;
|
||||||
private String email;
|
private String email;
|
||||||
|
|||||||
@@ -60,6 +60,9 @@ public class PortalNoticeManService extends BaseService {
|
|||||||
private static final String MANUAL_TITLE_KEYWORD = "장애";
|
private static final String MANUAL_TITLE_KEYWORD = "장애";
|
||||||
|
|
||||||
private String decodeString(String value) {
|
private String decodeString(String value) {
|
||||||
|
if (value == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
if (ContainerUtil.get() == ContainerUtil.TOMCAT) {
|
if (ContainerUtil.get() == ContainerUtil.TOMCAT) {
|
||||||
try {
|
try {
|
||||||
return new String(value.getBytes("euc-kr"), StandardCharsets.UTF_8);
|
return new String(value.getBytes("euc-kr"), StandardCharsets.UTF_8);
|
||||||
@@ -433,7 +436,8 @@ public class PortalNoticeManService extends BaseService {
|
|||||||
MultipartFile file = portalNoticeUI.getFiles();
|
MultipartFile file = portalNoticeUI.getFiles();
|
||||||
|
|
||||||
if (file != null && !file.isEmpty()) { // 새로운 파일이 업로드된 경우에만 처리
|
if (file != null && !file.isEmpty()) { // 새로운 파일이 업로드된 경우에만 처리
|
||||||
String decodedFileName = decodeString(portalNoticeUI.getFileName());
|
String fileName = StringUtils.defaultIfBlank(portalNoticeUI.getFileName(), file.getOriginalFilename());
|
||||||
|
String decodedFileName = decodeString(fileName);
|
||||||
FileTypeContext.setFileType("notice");
|
FileTypeContext.setFileType("notice");
|
||||||
FileInfo fileInfo = fileService.createOrUpdateSingleFile(portalNotice.getFileId(), file, decodedFileName, true);
|
FileInfo fileInfo = fileService.createOrUpdateSingleFile(portalNotice.getFileId(), file, decodedFileName, true);
|
||||||
|
|
||||||
|
|||||||
@@ -147,8 +147,8 @@ public class UmsDispatchService {
|
|||||||
try {
|
try {
|
||||||
transactionTemplate.execute(status -> {
|
transactionTemplate.execute(status -> {
|
||||||
try {
|
try {
|
||||||
|
// 상태(SENT/FAILED) 및 RESPONSE_DATA 저장은 umsService.send() 내부에서 처리한다.
|
||||||
umsService.send(message);
|
umsService.send(message);
|
||||||
updateMessageStatus(message, "SENT");
|
|
||||||
return null;
|
return null;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// checked exception을 RuntimeException으로 감싸 전파 → TransactionTemplate이 rollback 후 re-throw
|
// checked exception을 RuntimeException으로 감싸 전파 → TransactionTemplate이 rollback 후 re-throw
|
||||||
@@ -159,7 +159,8 @@ public class UmsDispatchService {
|
|||||||
log.error("Failed to process message: {} - Error: {}", message.getId(), e.getMessage(), e);
|
log.error("Failed to process message: {} - Error: {}", message.getId(), e.getMessage(), e);
|
||||||
try {
|
try {
|
||||||
transactionTemplate.execute(s -> {
|
transactionTemplate.execute(s -> {
|
||||||
updateMessageStatus(message, "FAILED");
|
// 응답 자체를 받지 못한 경우(네트워크/타임아웃 등) 예외 메시지를 RESPONSE_DATA 에 남긴다.
|
||||||
|
updateMessageStatus(message, "FAILED", toResponseData(e));
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
@@ -171,10 +172,19 @@ public class UmsDispatchService {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void updateMessageStatus(MessageRequest message, String status) {
|
public void updateMessageStatus(MessageRequest message, String status, String responseData) {
|
||||||
message.setRequestStatus(status);
|
message.setRequestStatus(status);
|
||||||
message.setSentDate(LocalDateTime.now());
|
message.setSentDate(LocalDateTime.now());
|
||||||
|
if (responseData != null) {
|
||||||
|
message.setResponseData(responseData);
|
||||||
|
}
|
||||||
entityManager.merge(message);
|
entityManager.merge(message);
|
||||||
entityManager.flush();
|
entityManager.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 예외를 RESPONSE_DATA 컬럼에 저장할 문자열로 변환한다. (RuntimeException 래퍼는 원인 예외로 풀어서 사용) */
|
||||||
|
private static String toResponseData(Throwable t) {
|
||||||
|
Throwable root = (t instanceof RuntimeException && t.getCause() != null) ? t.getCause() : t;
|
||||||
|
return String.valueOf(root);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -162,6 +162,11 @@ public class ClientController extends OnlBaseAnnotationController {
|
|||||||
response.put("createdApiSpecCount", result.getCreatedApiSpecCount());
|
response.put("createdApiSpecCount", result.getCreatedApiSpecCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Spec 자동생성 실패(레이아웃/어댑터 미설정 등)로 최소 정보만 생성된 API 목록
|
||||||
|
if (result.getSpecGenFailed() != null && !result.getSpecGenFailed().isEmpty()) {
|
||||||
|
response.put("specGenFailed", result.getSpecGenFailed());
|
||||||
|
}
|
||||||
|
|
||||||
return ResponseEntity.ok(response);
|
return ResponseEntity.ok(response);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// 에러 처리
|
// 에러 처리
|
||||||
|
|||||||
+14
-135
@@ -1,21 +1,12 @@
|
|||||||
package com.eactive.eai.rms.onl.manage.authserver.client;
|
package com.eactive.eai.rms.onl.manage.authserver.client;
|
||||||
|
|
||||||
import com.eactive.apim.portal.apispec.entity.ApiSpecInfo;
|
|
||||||
import com.eactive.apim.portal.apispec.service.ApiSpecInfoService;
|
|
||||||
import com.eactive.apim.portal.app.entity.Credential;
|
|
||||||
import com.eactive.apim.portal.portalorg.entity.PortalOrg;
|
import com.eactive.apim.portal.portalorg.entity.PortalOrg;
|
||||||
import com.eactive.eai.data.entity.onl.message.EAIMessageEntity;
|
import com.eactive.eai.data.entity.onl.message.EAIMessageEntity;
|
||||||
import com.eactive.eai.rms.common.datasource.DataSourceContextHolder;
|
|
||||||
import com.eactive.eai.rms.common.datasource.DataSourceType;
|
|
||||||
import com.eactive.eai.rms.common.datasource.DataSourceTypeManager;
|
|
||||||
import com.eactive.eai.rms.data.entity.onl.apim.portalorg.PortalOrgService;
|
import com.eactive.eai.rms.data.entity.onl.apim.portalorg.PortalOrgService;
|
||||||
import com.eactive.eai.rms.data.entity.onl.eaimsg.EAIMessageService;
|
import com.eactive.eai.rms.data.entity.onl.eaimsg.EAIMessageService;
|
||||||
import com.eactive.eai.rms.onl.apim.approval.credential.CredentialManService;
|
import com.eactive.eai.rms.onl.apim.approval.credential.PortalCredentialSyncService;
|
||||||
import com.eactive.eai.rms.onl.apim.approval.credential.CredentialService;
|
|
||||||
import com.eactive.eai.rms.onl.apim.approval.credential.CredentialUI;
|
|
||||||
import com.eactive.eai.rms.onl.apim.portalorg.PortalOrgUI;
|
import com.eactive.eai.rms.onl.apim.portalorg.PortalOrgUI;
|
||||||
import com.eactive.eai.rms.onl.apim.portalorg.PortalOrgUIMapper;
|
import com.eactive.eai.rms.onl.apim.portalorg.PortalOrgUIMapper;
|
||||||
import com.eactive.eai.rms.onl.transaction.apim.ui.ApiSpecInfoUI;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
@@ -28,7 +19,6 @@ import com.eactive.eai.rms.common.base.OnlBaseService;
|
|||||||
import com.eactive.eai.rms.data.entity.onl.authserver.ClientEntityService;
|
import com.eactive.eai.rms.data.entity.onl.authserver.ClientEntityService;
|
||||||
import com.eactive.eai.rms.data.entity.onl.authserver.ClientSearch;
|
import com.eactive.eai.rms.data.entity.onl.authserver.ClientSearch;
|
||||||
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -42,28 +32,22 @@ public class ClientManService extends OnlBaseService {
|
|||||||
private ClientUIMapper clientUIMapper;
|
private ClientUIMapper clientUIMapper;
|
||||||
private PortalOrgService portalOrgService;
|
private PortalOrgService portalOrgService;
|
||||||
private PortalOrgUIMapper portalOrgUIMapper;
|
private PortalOrgUIMapper portalOrgUIMapper;
|
||||||
private CredentialManService credentialManService;
|
|
||||||
private CredentialService credentialService;
|
|
||||||
private EAIMessageService eaiMessageService;
|
private EAIMessageService eaiMessageService;
|
||||||
private ApiSpecInfoService apiSpecInfoService;
|
private PortalCredentialSyncService portalCredentialSyncService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public ClientManService(ClientEntityService clientEntityService,
|
public ClientManService(ClientEntityService clientEntityService,
|
||||||
ClientUIMapper clientUIMapper,
|
ClientUIMapper clientUIMapper,
|
||||||
PortalOrgService portalOrgService,
|
PortalOrgService portalOrgService,
|
||||||
PortalOrgUIMapper portalOrgUIMapper,
|
PortalOrgUIMapper portalOrgUIMapper,
|
||||||
CredentialManService credentialManService,
|
|
||||||
CredentialService credentialService,
|
|
||||||
EAIMessageService eaiMessageService,
|
EAIMessageService eaiMessageService,
|
||||||
ApiSpecInfoService apiSpecInfoService) {
|
PortalCredentialSyncService portalCredentialSyncService) {
|
||||||
this.clientEntityService = clientEntityService;
|
this.clientEntityService = clientEntityService;
|
||||||
this.clientUIMapper = clientUIMapper;
|
this.clientUIMapper = clientUIMapper;
|
||||||
this.portalOrgService = portalOrgService;
|
this.portalOrgService = portalOrgService;
|
||||||
this.portalOrgUIMapper = portalOrgUIMapper;
|
this.portalOrgUIMapper = portalOrgUIMapper;
|
||||||
this.credentialManService = credentialManService;
|
|
||||||
this.credentialService = credentialService;
|
|
||||||
this.eaiMessageService = eaiMessageService;
|
this.eaiMessageService = eaiMessageService;
|
||||||
this.apiSpecInfoService = apiSpecInfoService;
|
this.portalCredentialSyncService = portalCredentialSyncService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -127,6 +111,10 @@ public class ClientManService extends OnlBaseService {
|
|||||||
* AGW 인증관리(ClientEntity)의 정보를 개발자포탈(Credential)에 반영합니다.
|
* AGW 인증관리(ClientEntity)의 정보를 개발자포탈(Credential)에 반영합니다.
|
||||||
* 포탈에 없으면 신규 생성(INSERT), 있으면 업데이트(UPDATE)합니다.
|
* 포탈에 없으면 신규 생성(INSERT), 있으면 업데이트(UPDATE)합니다.
|
||||||
*
|
*
|
||||||
|
* 검증(2,3단계)은 APIGW 스키마에서 이 메서드의 트랜잭션 안에서 수행하고, 실패 시 포탈은 전혀 건드리지
|
||||||
|
* 않는다. 실제 포탈 쓰기(Credential/ApiSpecInfo)는 {@link PortalCredentialSyncService}
|
||||||
|
* (별도 EMS 트랜잭션)에 위임한다.
|
||||||
|
*
|
||||||
* @param clientId 클라이언트 ID
|
* @param clientId 클라이언트 ID
|
||||||
* @return 반영 결과 (INSERTED, UPDATED, SKIPPED_NO_ORG, SKIPPED_INVALID_API, ERROR)
|
* @return 반영 결과 (INSERTED, UPDATED, SKIPPED_NO_ORG, SKIPPED_INVALID_API, ERROR)
|
||||||
*/
|
*/
|
||||||
@@ -181,73 +169,20 @@ public class ClientManService extends OnlBaseService {
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. MONITORING 스키마로 전환
|
// 4. 포탈 스키마에 반영 (별도 EMS 트랜잭션)
|
||||||
DataSourceType monitoringType = DataSourceTypeManager.getDataSourceType("MONITORING");
|
PortalCredentialSyncService.Outcome outcome = portalCredentialSyncService.apply(clientEntity);
|
||||||
DataSourceContextHolder.setDataSourceType(monitoringType);
|
|
||||||
|
|
||||||
// 5. PTL_API_SPEC_INFO에 없는 API 자동 생성
|
|
||||||
List<String> createdApiSpecs = new ArrayList<>();
|
|
||||||
if (clientEntity.getApiList() != null && !clientEntity.getApiList().isEmpty()) {
|
|
||||||
for (EAIMessageEntity apiEntity : clientEntity.getApiList()) {
|
|
||||||
String apiId = apiEntity.getEaisvcname();
|
|
||||||
if (!apiSpecInfoService.findById(apiId).isPresent()) {
|
|
||||||
// PTL_API_SPEC_INFO에 없으면 자동 생성
|
|
||||||
ApiSpecInfo newApiSpec = new ApiSpecInfo();
|
|
||||||
newApiSpec.setApiId(apiId);
|
|
||||||
newApiSpec.setApiName(StringUtils.isNotBlank(apiEntity.getEaisvcdesc())
|
|
||||||
? apiEntity.getEaisvcdesc() : apiId);
|
|
||||||
newApiSpec.setApiSimpleDescription(apiEntity.getEaisvcdesc());
|
|
||||||
newApiSpec.setDisplayYn("Y"); // 기본값: 공개
|
|
||||||
apiSpecInfoService.create(newApiSpec);
|
|
||||||
createdApiSpecs.add(apiId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 6. 기존 Credential 확인
|
|
||||||
Credential existingCredential = credentialService.findByClientidAndOrgid(clientId, orgId);
|
|
||||||
|
|
||||||
// 7. 데이터 변환 (ClientEntity → CredentialUI)
|
|
||||||
CredentialUI credentialUI = convertToCredentialUI(clientEntity);
|
|
||||||
|
|
||||||
SyncResult.SyncAction action;
|
|
||||||
if (existingCredential != null) {
|
|
||||||
// 업데이트: 기존 값 유지해야 할 필드 처리
|
|
||||||
Credential existing = existingCredential;
|
|
||||||
if (StringUtils.isNotBlank(existing.getAppDescription())) {
|
|
||||||
credentialUI.setAppDescription(existing.getAppDescription());
|
|
||||||
}
|
|
||||||
if (StringUtils.isNotBlank(existing.getAppIconFileId())) {
|
|
||||||
credentialUI.setAppIconFileId(existing.getAppIconFileId());
|
|
||||||
}
|
|
||||||
if (StringUtils.isNotBlank(existing.getServer())) {
|
|
||||||
credentialUI.setServer(existing.getServer());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 8. 포탈 스키마에 업데이트
|
|
||||||
credentialManService.update(credentialUI);
|
|
||||||
action = SyncResult.SyncAction.UPDATED;
|
|
||||||
} else {
|
|
||||||
// 신규 생성: 기본값 설정
|
|
||||||
if (StringUtils.isBlank(credentialUI.getAppDescription())) {
|
|
||||||
credentialUI.setAppDescription("APIGW에서 반영된 인증정보");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 8. 포탈 스키마에 신규 생성
|
|
||||||
credentialManService.insert(credentialUI);
|
|
||||||
action = SyncResult.SyncAction.INSERTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
return SyncResult.builder()
|
return SyncResult.builder()
|
||||||
.success(true)
|
.success(true)
|
||||||
.action(action)
|
.action(outcome.isInserted() ? SyncResult.SyncAction.INSERTED : SyncResult.SyncAction.UPDATED)
|
||||||
.message("포탈 정보 반영 완료")
|
.message("포탈 정보 반영 완료")
|
||||||
.targetApis(requestedApiIds)
|
.targetApis(requestedApiIds)
|
||||||
.targetApiCount(requestedApiIds.size())
|
.targetApiCount(requestedApiIds.size())
|
||||||
.syncedApis(requestedApiIds)
|
.syncedApis(requestedApiIds)
|
||||||
.syncedApiCount(requestedApiIds.size())
|
.syncedApiCount(requestedApiIds.size())
|
||||||
.createdApiSpecs(createdApiSpecs)
|
.createdApiSpecs(outcome.getCreatedApiSpecs())
|
||||||
.createdApiSpecCount(createdApiSpecs.size())
|
.createdApiSpecCount(outcome.getCreatedApiSpecs().size())
|
||||||
|
.specGenFailed(outcome.getSpecGenFailed())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -259,60 +194,4 @@ public class ClientManService extends OnlBaseService {
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* ClientEntity를 CredentialUI로 변환합니다.
|
|
||||||
*
|
|
||||||
* @param clientEntity APIGW 클라이언트 엔티티
|
|
||||||
* @return CredentialUI 포탈 인증정보 UI 객체
|
|
||||||
*/
|
|
||||||
private CredentialUI convertToCredentialUI(ClientEntity clientEntity) {
|
|
||||||
CredentialUI credentialUI = new CredentialUI();
|
|
||||||
|
|
||||||
// 기본 인증정보
|
|
||||||
credentialUI.setClientid(clientEntity.getClientid());
|
|
||||||
credentialUI.setClientname(clientEntity.getClientname());
|
|
||||||
credentialUI.setClientsecret(clientEntity.getClientsecret());
|
|
||||||
|
|
||||||
// OAuth 설정
|
|
||||||
credentialUI.setScope(clientEntity.getScope());
|
|
||||||
credentialUI.setGranttypes(clientEntity.getGranttypes());
|
|
||||||
credentialUI.setAccesstokenvalidityseconds(clientEntity.getAccesstokenvalidityseconds());
|
|
||||||
credentialUI.setRefreshtokenvalidityseconds(clientEntity.getRefreshtokenvalidityseconds());
|
|
||||||
|
|
||||||
// 보안 설정
|
|
||||||
credentialUI.setAllowedips(clientEntity.getAllowedips());
|
|
||||||
credentialUI.setAuthorities(clientEntity.getAuthorities());
|
|
||||||
credentialUI.setRedirecturi(clientEntity.getRedirecturi());
|
|
||||||
credentialUI.setSecuritykey(clientEntity.getSecuritykey());
|
|
||||||
credentialUI.setAutoapprove(clientEntity.getAutoapprove());
|
|
||||||
credentialUI.setResourceids(clientEntity.getResourceids());
|
|
||||||
|
|
||||||
// 조직 정보
|
|
||||||
credentialUI.setOrgid(clientEntity.getOrgid());
|
|
||||||
credentialUI.setOrgname(clientEntity.getOrgname());
|
|
||||||
|
|
||||||
// 앱 상태
|
|
||||||
credentialUI.setAppstatus(clientEntity.getAppstatus());
|
|
||||||
credentialUI.setDailytokenlimit(clientEntity.getDailytokenlimit());
|
|
||||||
|
|
||||||
// 수정 정보
|
|
||||||
credentialUI.setModifiedby(clientEntity.getModifiedby());
|
|
||||||
if (clientEntity.getModifiedon() != null) {
|
|
||||||
credentialUI.setModifiedon(clientEntity.getModifiedon().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME));
|
|
||||||
}
|
|
||||||
|
|
||||||
// API 목록 변환
|
|
||||||
List<ApiSpecInfoUI> apiList = new ArrayList<>();
|
|
||||||
if (clientEntity.getApiList() != null) {
|
|
||||||
for (EAIMessageEntity apiEntity : clientEntity.getApiList()) {
|
|
||||||
ApiSpecInfoUI apiUI = new ApiSpecInfoUI();
|
|
||||||
apiUI.setApiId(apiEntity.getEaisvcname());
|
|
||||||
apiList.add(apiUI);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
credentialUI.setApiList(apiList);
|
|
||||||
|
|
||||||
return credentialUI;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,6 +66,12 @@ public class SyncResult {
|
|||||||
*/
|
*/
|
||||||
private int createdApiSpecCount;
|
private int createdApiSpecCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Spec 자동생성에 실패해 최소 정보(apiId만)로 대체 생성된 API 목록
|
||||||
|
* (레이아웃/어댑터 정보 부재 등. PTL_API_SPEC_INFO 행 자체는 생성됨 - displayYn='N')
|
||||||
|
*/
|
||||||
|
private List<String> specGenFailed;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 반영 액션 타입
|
* 반영 액션 타입
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -135,6 +135,15 @@ public class ApiInterfaceService extends OnlBaseService {
|
|||||||
public Page<ApiInterfaceUI> selectList(EAIMessageUISearch eaiMessageUISearch, Pageable pageable,String sortname, String sortorder) {
|
public Page<ApiInterfaceUI> selectList(EAIMessageUISearch eaiMessageUISearch, Pageable pageable,String sortname, String sortorder) {
|
||||||
|
|
||||||
Page<Tuple> tuples = eaiMessageQueryService.selectList(eaiMessageUISearch, pageable, sortname, sortorder );
|
Page<Tuple> tuples = eaiMessageQueryService.selectList(eaiMessageUISearch, pageable, sortname, sortorder );
|
||||||
|
List<String> apiIds = tuples.getContent().stream()
|
||||||
|
.map(tuple -> tuple.get(QEAIMessageEntity.eAIMessageEntity).getEaisvcname())
|
||||||
|
.distinct()
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
Map<String, String> specStatuses = eaiMessageQueryService.findApiSpecStatuses(apiIds);
|
||||||
|
List<String> publishedApiIds = apiIds.stream()
|
||||||
|
.filter(apiId -> "PUBLISHED".equals(specStatuses.get(apiId)))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
Map<String, List<String>> publishedGroupNames = apiGroupService.findPublishedGroupNamesByApiIds(publishedApiIds);
|
||||||
|
|
||||||
return tuples.map(tuple -> {
|
return tuples.map(tuple -> {
|
||||||
EAIMessageEntity eaiMessageEntity = tuple.get(QEAIMessageEntity.eAIMessageEntity);
|
EAIMessageEntity eaiMessageEntity = tuple.get(QEAIMessageEntity.eAIMessageEntity);
|
||||||
@@ -153,6 +162,8 @@ public class ApiInterfaceService extends OnlBaseService {
|
|||||||
apiInterfaceUI.setApiFullPath(apiFullPath);
|
apiInterfaceUI.setApiFullPath(apiFullPath);
|
||||||
apiInterfaceUI.setBzwksvckeyname(bzwksvckeyname);
|
apiInterfaceUI.setBzwksvckeyname(bzwksvckeyname);
|
||||||
apiInterfaceUI.setStatusCode(statusCode);
|
apiInterfaceUI.setStatusCode(statusCode);
|
||||||
|
apiInterfaceUI.setSpecStatus(specStatuses.getOrDefault(eaiMessageEntity.getEaisvcname(), "UNREGISTERED"));
|
||||||
|
apiInterfaceUI.setPublishedGroupNames(publishedGroupNames.getOrDefault(eaiMessageEntity.getEaisvcname(), Collections.emptyList()));
|
||||||
|
|
||||||
return apiInterfaceUI;
|
return apiInterfaceUI;
|
||||||
});
|
});
|
||||||
@@ -164,6 +175,7 @@ public class ApiInterfaceService extends OnlBaseService {
|
|||||||
// 전체 목록수 얻기
|
// 전체 목록수 얻기
|
||||||
HashMap map = new HashMap();
|
HashMap map = new HashMap();
|
||||||
map.put("bizList", voList);
|
map.put("bizList", voList);
|
||||||
|
map.put("apiGroupList", apiGroupService.findGroupOptions());
|
||||||
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,323 @@
|
|||||||
|
package com.eactive.eai.rms.onl.transaction.apim;
|
||||||
|
|
||||||
|
import com.eactive.eai.rms.onl.manage.rule.layout.ui.LayoutUI;
|
||||||
|
import com.eactive.eai.rms.onl.transaction.apim.ui.ApiInterfaceUI;
|
||||||
|
import com.eactive.eai.rms.onl.transaction.apim.ui.ApiSpecInfoUI;
|
||||||
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||||
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 레이아웃+어댑터 기반 API Spec(OpenAPI 3.1) 자동생성 규칙(백엔드 단일 소스).
|
||||||
|
*
|
||||||
|
* {@link DjbApiSpecController}(6단계 편집 마법사)와 인증관리 "개발자포탈 정보 반영"
|
||||||
|
* (ClientManService.syncPortalData → PortalCredentialSyncService) 양쪽이 이 서비스를 공유한다.
|
||||||
|
* 규칙 자체는 원래 DjbApiSpecController 의 private 메서드였던 것을 그대로 옮긴 것으로, 동작 변경은 없다.
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class DjbApiSpecAutoGenService {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(DjbApiSpecAutoGenService.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApiInterfaceService apiInterfaceService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApiSpecManService apiSpecManService;
|
||||||
|
|
||||||
|
private final ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 레이아웃/어댑터 정보를 조합해 OpenAPI 3.1 스펙 JSON 을 생성한다.
|
||||||
|
* 규칙: title/tag/summary = API명(eaiSvcDesc), operationId = 인터페이스ID,
|
||||||
|
* servers[0].url 을 path 앞에 붙이고 servers 제거(서버 선택 제거),
|
||||||
|
* 요청/200 응답 예제를 레이아웃 샘플로 임베드.
|
||||||
|
*/
|
||||||
|
public String generateSpecJson(String eaiSvcName) throws Exception {
|
||||||
|
ApiInterfaceUI apiInterfaceUI = apiInterfaceService.selectDetail(eaiSvcName);
|
||||||
|
if (apiInterfaceUI == null) {
|
||||||
|
throw new IllegalStateException("API 인터페이스 정보를 찾을 수 없습니다: " + eaiSvcName);
|
||||||
|
}
|
||||||
|
LayoutUI requestLayoutUI = resolveLayout(apiInterfaceUI, true);
|
||||||
|
LayoutUI responseLayoutUI = resolveLayout(apiInterfaceUI, false);
|
||||||
|
return generateSpecJson(eaiSvcName, apiInterfaceUI, requestLayoutUI, responseLayoutUI);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String generateSpecJson(String eaiSvcName, ApiInterfaceUI apiInterfaceUI,
|
||||||
|
LayoutUI requestLayoutUI, LayoutUI responseLayoutUI) throws Exception {
|
||||||
|
Map<String, String> inboundAdapterSpec = apiInterfaceService.getHttpAdapterInfo(apiInterfaceUI.getFromAdapter());
|
||||||
|
if (inboundAdapterSpec == null) {
|
||||||
|
inboundAdapterSpec = new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
String baseSpec = apiSpecManService.generateSwaggerSpec(requestLayoutUI, responseLayoutUI, inboundAdapterSpec, apiInterfaceUI);
|
||||||
|
|
||||||
|
String apiName = StringUtils.isNotBlank(apiInterfaceUI.getEaiSvcDesc()) ? apiInterfaceUI.getEaiSvcDesc() : eaiSvcName;
|
||||||
|
String contentType = StringUtils.isNotBlank(apiInterfaceUI.getRestContentType()) ? apiInterfaceUI.getRestContentType() : "application/json";
|
||||||
|
return applyAutoRules(baseSpec, apiName, eaiSvcName, contentType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 자동생성 결과를 저장 가능한 {@link ApiSpecInfoUI} 로 조립한다.
|
||||||
|
* displayYn 은 호출자가 정한다(비공개로 자동 생성하려면 호출 후 "N" 을 세팅).
|
||||||
|
*/
|
||||||
|
public ApiSpecInfoUI generateApiSpecInfo(String eaiSvcName) throws Exception {
|
||||||
|
ApiInterfaceUI apiInterfaceUI = apiInterfaceService.selectDetail(eaiSvcName);
|
||||||
|
if (apiInterfaceUI == null) {
|
||||||
|
throw new IllegalStateException("API 인터페이스 정보를 찾을 수 없습니다: " + eaiSvcName);
|
||||||
|
}
|
||||||
|
|
||||||
|
String apiName = StringUtils.isNotBlank(apiInterfaceUI.getEaiSvcDesc()) ? apiInterfaceUI.getEaiSvcDesc() : eaiSvcName;
|
||||||
|
LayoutUI requestLayoutUI = resolveLayout(apiInterfaceUI, true);
|
||||||
|
LayoutUI responseLayoutUI = resolveLayout(apiInterfaceUI, false);
|
||||||
|
String specJson = generateSpecJson(eaiSvcName, apiInterfaceUI, requestLayoutUI, responseLayoutUI);
|
||||||
|
|
||||||
|
ApiSpecInfoUI ui = new ApiSpecInfoUI();
|
||||||
|
ui.setApiId(eaiSvcName);
|
||||||
|
ui.setApiName(apiName);
|
||||||
|
ui.setApiSimpleDescription(apiInterfaceUI.getEaiSvcDesc());
|
||||||
|
ui.setTestbedSpec(specJson);
|
||||||
|
ui.setApiRequestSpec(apiSpecManService.generateSpecTableFromLayout(requestLayoutUI));
|
||||||
|
ui.setApiResponseSpec(apiSpecManService.generateSpecTableFromLayout(responseLayoutUI));
|
||||||
|
ui.setSampleRequest(apiSpecManService.generateSampleDataFromLayout(requestLayoutUI));
|
||||||
|
ui.setSampleResponse(apiSpecManService.generateSampleDataFromLayout(responseLayoutUI));
|
||||||
|
|
||||||
|
extractFirstOperation(specJson, ui);
|
||||||
|
return ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 생성된 spec 의 첫 path/method/requestBody mediaType 을 추출한다(마법사 프론트와 동일 규칙, app.js 의 _defScalar 대응). */
|
||||||
|
private void extractFirstOperation(String specJson, ApiSpecInfoUI ui) {
|
||||||
|
try {
|
||||||
|
JsonNode root = objectMapper.readTree(specJson);
|
||||||
|
JsonNode pathsNode = root.get("paths");
|
||||||
|
if (pathsNode == null || !pathsNode.isObject() || pathsNode.size() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Iterator<Map.Entry<String, JsonNode>> pathIt = pathsNode.fields();
|
||||||
|
if (!pathIt.hasNext()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Map.Entry<String, JsonNode> pathEntry = pathIt.next();
|
||||||
|
ui.setApiUrl(pathEntry.getKey());
|
||||||
|
|
||||||
|
JsonNode pathItem = pathEntry.getValue();
|
||||||
|
if (pathItem != null && pathItem.isObject() && pathItem.fields().hasNext()) {
|
||||||
|
Map.Entry<String, JsonNode> methodEntry = pathItem.fields().next();
|
||||||
|
ui.setApiMethod(methodEntry.getKey().toUpperCase());
|
||||||
|
|
||||||
|
JsonNode op = methodEntry.getValue();
|
||||||
|
if (op != null && op.isObject()) {
|
||||||
|
JsonNode content = op.path("requestBody").path("content");
|
||||||
|
if (content.isObject() && content.fields().hasNext()) {
|
||||||
|
ui.setApiContentType(content.fields().next().getKey());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.warn("자동생성 spec 에서 apiUrl/apiMethod 추출 실패: " + ui.getApiId(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private LayoutUI resolveLayout(ApiInterfaceUI apiInterfaceUI, boolean request) throws Exception {
|
||||||
|
String layoutName = request ? apiInterfaceUI.getInboundRequestLayout() : apiInterfaceUI.getInboundResponseLayout();
|
||||||
|
return StringUtils.isNotEmpty(layoutName) ? apiSpecManService.selectLayoutUI(layoutName) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 자동생성 규칙 후처리(Jackson 트리 조작). 실패 시 원본 유지. */
|
||||||
|
private String applyAutoRules(String specJson, String apiName, String eaiSvcName, String contentType) {
|
||||||
|
try {
|
||||||
|
JsonNode parsed = objectMapper.readTree(specJson);
|
||||||
|
if (!parsed.isObject()) {
|
||||||
|
return specJson;
|
||||||
|
}
|
||||||
|
ObjectNode root = (ObjectNode) parsed;
|
||||||
|
|
||||||
|
root.put("openapi", "3.1.0"); // OpenAPI 3.1 방출(Swagger UI 5.x oas31 렌더 지원)
|
||||||
|
getOrCreateObject(root, "info").put("title", apiName);
|
||||||
|
|
||||||
|
String tagName = "DJBank"; // 자동생성 태그명 고정
|
||||||
|
ArrayNode tags = objectMapper.createArrayNode();
|
||||||
|
ObjectNode tag = objectMapper.createObjectNode();
|
||||||
|
tag.put("name", tagName);
|
||||||
|
tag.put("description", apiName); // 태그 설명 = 간단설명(API명)
|
||||||
|
tags.add(tag);
|
||||||
|
root.set("tags", tags);
|
||||||
|
|
||||||
|
// 어댑터경로(servers[0].url = getHttpAdapterInfo urlPath)를 path 앞에 baking 하고 servers 제거.
|
||||||
|
// 호스트(gw=djb.gateway.base-url / mock=Mock URL / sample=없음)는 프론트가 응답유형에 따라 서버로 붙인다.
|
||||||
|
String adapterPath = "";
|
||||||
|
JsonNode serversNode = root.get("servers");
|
||||||
|
if (serversNode != null && serversNode.isArray() && serversNode.size() > 0 && serversNode.get(0).get("url") != null) {
|
||||||
|
adapterPath = serversNode.get(0).get("url").asText("");
|
||||||
|
}
|
||||||
|
root.remove("servers");
|
||||||
|
|
||||||
|
JsonNode pathsNode = root.get("paths");
|
||||||
|
if (pathsNode != null && pathsNode.isObject()) {
|
||||||
|
ObjectNode paths = (ObjectNode) pathsNode;
|
||||||
|
List<String> pathKeys = new ArrayList<>();
|
||||||
|
Iterator<String> pit = paths.fieldNames();
|
||||||
|
while (pit.hasNext()) {
|
||||||
|
pathKeys.add(pit.next());
|
||||||
|
}
|
||||||
|
for (String pk : pathKeys) {
|
||||||
|
JsonNode pathItem = paths.get(pk);
|
||||||
|
if (pathItem != null && pathItem.isObject()) {
|
||||||
|
List<String> methods = new ArrayList<>();
|
||||||
|
Iterator<String> mit = pathItem.fieldNames();
|
||||||
|
while (mit.hasNext()) {
|
||||||
|
methods.add(mit.next());
|
||||||
|
}
|
||||||
|
for (String mk : methods) {
|
||||||
|
JsonNode opNode = pathItem.get(mk);
|
||||||
|
if (opNode != null && opNode.isObject()) {
|
||||||
|
ObjectNode op = (ObjectNode) opNode;
|
||||||
|
op.put("operationId", eaiSvcName);
|
||||||
|
op.put("summary", apiName);
|
||||||
|
ArrayNode opTags = objectMapper.createArrayNode();
|
||||||
|
opTags.add(tagName);
|
||||||
|
op.set("tags", opTags);
|
||||||
|
// 예제(요청/응답 본문)는 프론트에서 스키마 기준으로 생성 → 자동생성/재생성 결과 일치. 여기선 임베드하지 않음.
|
||||||
|
markGwOnOperation(op);
|
||||||
|
addResponseHeader(op, "200", "Content-Type", contentType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String newKey = adapterPath.isEmpty() ? pk
|
||||||
|
: (adapterPath.replaceAll("/+$", "") + (pk.startsWith("/") ? "" : "/") + pk);
|
||||||
|
if (!newKey.equals(pk)) {
|
||||||
|
paths.set(newKey, pathItem);
|
||||||
|
paths.remove(pk);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return objectMapper.writeValueAsString(root);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("applyAutoRules 실패, 원본 spec 유지", e);
|
||||||
|
return specJson;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** GW 유래 스키마 필드에 x-djb-gw 마커 부여(프론트에서 잠금 표시). */
|
||||||
|
private void markGwOnOperation(ObjectNode op) {
|
||||||
|
JsonNode body = op.get("requestBody");
|
||||||
|
if (body != null && body.isObject()) {
|
||||||
|
markGwInContent(body.get("content"));
|
||||||
|
}
|
||||||
|
JsonNode resps = op.get("responses");
|
||||||
|
if (resps != null && resps.isObject()) {
|
||||||
|
List<String> codes = new ArrayList<>();
|
||||||
|
Iterator<String> it = resps.fieldNames();
|
||||||
|
while (it.hasNext()) {
|
||||||
|
codes.add(it.next());
|
||||||
|
}
|
||||||
|
for (String c : codes) {
|
||||||
|
JsonNode r = resps.get(c);
|
||||||
|
if (r != null && r.isObject()) {
|
||||||
|
markGwInContent(r.get("content"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void markGwInContent(JsonNode content) {
|
||||||
|
if (content == null || !content.isObject()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<String> mts = new ArrayList<>();
|
||||||
|
Iterator<String> it = content.fieldNames();
|
||||||
|
while (it.hasNext()) {
|
||||||
|
mts.add(it.next());
|
||||||
|
}
|
||||||
|
for (String mt : mts) {
|
||||||
|
JsonNode m = content.get(mt);
|
||||||
|
if (m != null && m.isObject()) {
|
||||||
|
markGwSchema(m.get("schema"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void markGwSchema(JsonNode schema) {
|
||||||
|
if (schema == null || !schema.isObject()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ObjectNode s = (ObjectNode) schema;
|
||||||
|
JsonNode props = s.get("properties");
|
||||||
|
if (props != null && props.isObject()) {
|
||||||
|
ArrayNode required = (s.get("required") != null && s.get("required").isArray())
|
||||||
|
? (ArrayNode) s.get("required") : objectMapper.createArrayNode();
|
||||||
|
java.util.Set<String> existing = new java.util.HashSet<>();
|
||||||
|
required.forEach(n -> existing.add(n.asText()));
|
||||||
|
List<String> keys = new ArrayList<>();
|
||||||
|
Iterator<String> it = props.fieldNames();
|
||||||
|
while (it.hasNext()) {
|
||||||
|
keys.add(it.next());
|
||||||
|
}
|
||||||
|
for (String k : keys) {
|
||||||
|
JsonNode p = props.get(k);
|
||||||
|
if (p != null && p.isObject()) {
|
||||||
|
((ObjectNode) p).put("x-djb-gw", true);
|
||||||
|
if (!existing.contains(k)) { // GW 필드는 기본 '필수'
|
||||||
|
required.add(k);
|
||||||
|
existing.add(k);
|
||||||
|
}
|
||||||
|
markGwSchema(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (required.size() > 0) {
|
||||||
|
s.set("required", required);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
JsonNode items = s.get("items");
|
||||||
|
if (items != null && items.isObject()) {
|
||||||
|
markGwSchema(items);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 응답 헤더 미리 등록(중복 시 스킵). */
|
||||||
|
private void addResponseHeader(ObjectNode op, String code, String headerName, String example) {
|
||||||
|
JsonNode resps = op.get("responses");
|
||||||
|
if (resps == null || !resps.isObject()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
JsonNode r = resps.get(code);
|
||||||
|
if (r == null || !r.isObject()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ObjectNode headers = getOrCreateObject((ObjectNode) r, "headers");
|
||||||
|
if (headers.has(headerName)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ObjectNode h = objectMapper.createObjectNode();
|
||||||
|
h.put("description", headerName);
|
||||||
|
ObjectNode sc = objectMapper.createObjectNode();
|
||||||
|
sc.put("type", "string");
|
||||||
|
h.set("schema", sc);
|
||||||
|
h.put("example", example);
|
||||||
|
headers.set(headerName, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ObjectNode getOrCreateObject(ObjectNode parent, String field) {
|
||||||
|
JsonNode node = parent.get(field);
|
||||||
|
if (node != null && node.isObject()) {
|
||||||
|
return (ObjectNode) node;
|
||||||
|
}
|
||||||
|
ObjectNode created = objectMapper.createObjectNode();
|
||||||
|
parent.set(field, created);
|
||||||
|
return created;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,16 +2,13 @@ package com.eactive.eai.rms.onl.transaction.apim;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import com.fasterxml.jackson.databind.node.TextNode;
|
|
||||||
|
|
||||||
import org.apache.commons.lang.StringEscapeUtils;
|
import org.apache.commons.lang.StringEscapeUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -60,6 +57,9 @@ public class DjbApiSpecController extends OnlBaseAnnotationController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private DjbApiSpecLayoutMergeService layoutMergeService;
|
private DjbApiSpecLayoutMergeService layoutMergeService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DjbApiSpecAutoGenService autoGenService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private PortalPropertyService portalPropertyService;
|
private PortalPropertyService portalPropertyService;
|
||||||
|
|
||||||
@@ -146,7 +146,7 @@ public class DjbApiSpecController extends OnlBaseAnnotationController {
|
|||||||
spec = saved.getTestbedSpec();
|
spec = saved.getTestbedSpec();
|
||||||
source = "saved";
|
source = "saved";
|
||||||
} else {
|
} else {
|
||||||
spec = generateSpec(eaiSvcName);
|
spec = autoGenService.generateSpecJson(eaiSvcName);
|
||||||
source = force ? "regenerated" : "generated";
|
source = force ? "regenerated" : "generated";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,268 +324,6 @@ public class DjbApiSpecController extends OnlBaseAnnotationController {
|
|||||||
return StringUtils.isNotEmpty(layoutName) ? apiSpecManService.selectLayoutUI(layoutName) : null;
|
return StringUtils.isNotEmpty(layoutName) ? apiSpecManService.selectLayoutUI(layoutName) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 레이아웃 기반 자동 생성 + 자동생성 규칙(백엔드 단일 소스).
|
|
||||||
* 규칙: title/tag/summary = API명(eaiSvcDesc), operationId = 인터페이스ID,
|
|
||||||
* servers[0].url 을 path 앞에 붙이고 servers 제거(서버 선택 제거),
|
|
||||||
* 요청/200 응답 예제를 레이아웃 샘플로 임베드.
|
|
||||||
*/
|
|
||||||
private String generateSpec(String eaiSvcName) throws Exception {
|
|
||||||
ApiInterfaceUI apiInterfaceUI = apiInterfaceService.selectDetail(eaiSvcName);
|
|
||||||
if (apiInterfaceUI == null) {
|
|
||||||
throw new IllegalStateException("API 인터페이스 정보를 찾을 수 없습니다: " + eaiSvcName);
|
|
||||||
}
|
|
||||||
Map<String, String> inboundAdapterSpec = apiInterfaceService.getHttpAdapterInfo(apiInterfaceUI.getFromAdapter());
|
|
||||||
if (inboundAdapterSpec == null) {
|
|
||||||
inboundAdapterSpec = new HashMap<>();
|
|
||||||
}
|
|
||||||
String requestLayoutName = apiInterfaceUI.getInboundRequestLayout();
|
|
||||||
String responseLayoutName = apiInterfaceUI.getInboundResponseLayout();
|
|
||||||
LayoutUI requestLayoutUI = StringUtils.isNotEmpty(requestLayoutName)
|
|
||||||
? apiSpecManService.selectLayoutUI(requestLayoutName) : null;
|
|
||||||
LayoutUI responseLayoutUI = StringUtils.isNotEmpty(responseLayoutName)
|
|
||||||
? apiSpecManService.selectLayoutUI(responseLayoutName) : null;
|
|
||||||
|
|
||||||
String baseSpec = apiSpecManService.generateSwaggerSpec(requestLayoutUI, responseLayoutUI, inboundAdapterSpec, apiInterfaceUI);
|
|
||||||
|
|
||||||
String apiName = StringUtils.isNotBlank(apiInterfaceUI.getEaiSvcDesc()) ? apiInterfaceUI.getEaiSvcDesc() : eaiSvcName;
|
|
||||||
String reqSample = apiSpecManService.generateSampleDataFromLayout(requestLayoutUI);
|
|
||||||
String resSample = apiSpecManService.generateSampleDataFromLayout(responseLayoutUI);
|
|
||||||
String contentType = StringUtils.isNotBlank(apiInterfaceUI.getRestContentType()) ? apiInterfaceUI.getRestContentType() : "application/json";
|
|
||||||
return applyAutoRules(baseSpec, apiName, eaiSvcName, reqSample, resSample, contentType);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 자동생성 규칙 후처리(Jackson 트리 조작). 실패 시 원본 유지. */
|
|
||||||
private String applyAutoRules(String specJson, String apiName, String eaiSvcName, String reqSample, String resSample, String contentType) {
|
|
||||||
try {
|
|
||||||
JsonNode parsed = objectMapper.readTree(specJson);
|
|
||||||
if (!parsed.isObject()) {
|
|
||||||
return specJson;
|
|
||||||
}
|
|
||||||
ObjectNode root = (ObjectNode) parsed;
|
|
||||||
|
|
||||||
root.put("openapi", "3.1.0"); // OpenAPI 3.1 방출(Swagger UI 5.x oas31 렌더 지원)
|
|
||||||
getOrCreateObject(root, "info").put("title", apiName);
|
|
||||||
|
|
||||||
String tagName = "DJBank"; // 자동생성 태그명 고정
|
|
||||||
ArrayNode tags = objectMapper.createArrayNode();
|
|
||||||
ObjectNode tag = objectMapper.createObjectNode();
|
|
||||||
tag.put("name", tagName);
|
|
||||||
tag.put("description", apiName); // 태그 설명 = 간단설명(API명)
|
|
||||||
tags.add(tag);
|
|
||||||
root.set("tags", tags);
|
|
||||||
|
|
||||||
// 어댑터경로(servers[0].url = getHttpAdapterInfo urlPath)를 path 앞에 baking 하고 servers 제거.
|
|
||||||
// 호스트(gw=djb.gateway.base-url / mock=Mock URL / sample=없음)는 프론트가 응답유형에 따라 서버로 붙인다.
|
|
||||||
String adapterPath = "";
|
|
||||||
JsonNode serversNode = root.get("servers");
|
|
||||||
if (serversNode != null && serversNode.isArray() && serversNode.size() > 0 && serversNode.get(0).get("url") != null) {
|
|
||||||
adapterPath = serversNode.get(0).get("url").asText("");
|
|
||||||
}
|
|
||||||
root.remove("servers");
|
|
||||||
|
|
||||||
JsonNode pathsNode = root.get("paths");
|
|
||||||
if (pathsNode != null && pathsNode.isObject()) {
|
|
||||||
ObjectNode paths = (ObjectNode) pathsNode;
|
|
||||||
List<String> pathKeys = new ArrayList<>();
|
|
||||||
Iterator<String> pit = paths.fieldNames();
|
|
||||||
while (pit.hasNext()) {
|
|
||||||
pathKeys.add(pit.next());
|
|
||||||
}
|
|
||||||
for (String pk : pathKeys) {
|
|
||||||
JsonNode pathItem = paths.get(pk);
|
|
||||||
if (pathItem != null && pathItem.isObject()) {
|
|
||||||
List<String> methods = new ArrayList<>();
|
|
||||||
Iterator<String> mit = pathItem.fieldNames();
|
|
||||||
while (mit.hasNext()) {
|
|
||||||
methods.add(mit.next());
|
|
||||||
}
|
|
||||||
for (String mk : methods) {
|
|
||||||
JsonNode opNode = pathItem.get(mk);
|
|
||||||
if (opNode != null && opNode.isObject()) {
|
|
||||||
ObjectNode op = (ObjectNode) opNode;
|
|
||||||
op.put("operationId", eaiSvcName);
|
|
||||||
op.put("summary", apiName);
|
|
||||||
ArrayNode opTags = objectMapper.createArrayNode();
|
|
||||||
opTags.add(tagName);
|
|
||||||
op.set("tags", opTags);
|
|
||||||
// 예제(요청/응답 본문)는 프론트에서 스키마 기준으로 생성 → 자동생성/재생성 결과 일치. 여기선 임베드하지 않음.
|
|
||||||
markGwOnOperation(op);
|
|
||||||
addResponseHeader(op, "200", "Content-Type", contentType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
String newKey = adapterPath.isEmpty() ? pk
|
|
||||||
: (adapterPath.replaceAll("/+$", "") + (pk.startsWith("/") ? "" : "/") + pk);
|
|
||||||
if (!newKey.equals(pk)) {
|
|
||||||
paths.set(newKey, pathItem);
|
|
||||||
paths.remove(pk);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return objectMapper.writeValueAsString(root);
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("applyAutoRules 실패, 원본 spec 유지", e);
|
|
||||||
return specJson;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setContentExample(ObjectNode op, String sampleJson) {
|
|
||||||
if (StringUtils.isBlank(sampleJson)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
JsonNode body = op.get("requestBody");
|
|
||||||
if (body == null || !body.isObject()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
JsonNode content = body.get("content");
|
|
||||||
if (content == null || !content.isObject()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Iterator<String> mts = content.fieldNames();
|
|
||||||
if (!mts.hasNext()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
JsonNode mtNode = content.get(mts.next());
|
|
||||||
if (mtNode != null && mtNode.isObject()) {
|
|
||||||
((ObjectNode) mtNode).set("example", parseJsonOrText(sampleJson));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setResponseExample(ObjectNode op, String code, String sampleJson) {
|
|
||||||
if (StringUtils.isBlank(sampleJson)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
JsonNode resps = op.get("responses");
|
|
||||||
if (resps == null || !resps.isObject()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
JsonNode r = resps.get(code);
|
|
||||||
if (r == null || !r.isObject()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ObjectNode content = getOrCreateObject((ObjectNode) r, "content");
|
|
||||||
ObjectNode appjson = getOrCreateObject(content, "application/json");
|
|
||||||
appjson.set("example", parseJsonOrText(sampleJson));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** GW 유래 스키마 필드에 x-djb-gw 마커 부여(프론트에서 잠금 표시). */
|
|
||||||
private void markGwOnOperation(ObjectNode op) {
|
|
||||||
JsonNode body = op.get("requestBody");
|
|
||||||
if (body != null && body.isObject()) {
|
|
||||||
markGwInContent(body.get("content"));
|
|
||||||
}
|
|
||||||
JsonNode resps = op.get("responses");
|
|
||||||
if (resps != null && resps.isObject()) {
|
|
||||||
List<String> codes = new ArrayList<>();
|
|
||||||
Iterator<String> it = resps.fieldNames();
|
|
||||||
while (it.hasNext()) {
|
|
||||||
codes.add(it.next());
|
|
||||||
}
|
|
||||||
for (String c : codes) {
|
|
||||||
JsonNode r = resps.get(c);
|
|
||||||
if (r != null && r.isObject()) {
|
|
||||||
markGwInContent(r.get("content"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void markGwInContent(JsonNode content) {
|
|
||||||
if (content == null || !content.isObject()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
List<String> mts = new ArrayList<>();
|
|
||||||
Iterator<String> it = content.fieldNames();
|
|
||||||
while (it.hasNext()) {
|
|
||||||
mts.add(it.next());
|
|
||||||
}
|
|
||||||
for (String mt : mts) {
|
|
||||||
JsonNode m = content.get(mt);
|
|
||||||
if (m != null && m.isObject()) {
|
|
||||||
markGwSchema(m.get("schema"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void markGwSchema(JsonNode schema) {
|
|
||||||
if (schema == null || !schema.isObject()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ObjectNode s = (ObjectNode) schema;
|
|
||||||
JsonNode props = s.get("properties");
|
|
||||||
if (props != null && props.isObject()) {
|
|
||||||
ArrayNode required = (s.get("required") != null && s.get("required").isArray())
|
|
||||||
? (ArrayNode) s.get("required") : objectMapper.createArrayNode();
|
|
||||||
java.util.Set<String> existing = new java.util.HashSet<>();
|
|
||||||
required.forEach(n -> existing.add(n.asText()));
|
|
||||||
List<String> keys = new ArrayList<>();
|
|
||||||
Iterator<String> it = props.fieldNames();
|
|
||||||
while (it.hasNext()) {
|
|
||||||
keys.add(it.next());
|
|
||||||
}
|
|
||||||
for (String k : keys) {
|
|
||||||
JsonNode p = props.get(k);
|
|
||||||
if (p != null && p.isObject()) {
|
|
||||||
((ObjectNode) p).put("x-djb-gw", true);
|
|
||||||
if (!existing.contains(k)) { // GW 필드는 기본 '필수'
|
|
||||||
required.add(k);
|
|
||||||
existing.add(k);
|
|
||||||
}
|
|
||||||
markGwSchema(p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (required.size() > 0) {
|
|
||||||
s.set("required", required);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
JsonNode items = s.get("items");
|
|
||||||
if (items != null && items.isObject()) {
|
|
||||||
markGwSchema(items);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 응답 헤더 미리 등록(중복 시 스킵). */
|
|
||||||
private void addResponseHeader(ObjectNode op, String code, String headerName, String example) {
|
|
||||||
JsonNode resps = op.get("responses");
|
|
||||||
if (resps == null || !resps.isObject()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
JsonNode r = resps.get(code);
|
|
||||||
if (r == null || !r.isObject()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ObjectNode headers = getOrCreateObject((ObjectNode) r, "headers");
|
|
||||||
if (headers.has(headerName)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ObjectNode h = objectMapper.createObjectNode();
|
|
||||||
h.put("description", headerName);
|
|
||||||
ObjectNode sc = objectMapper.createObjectNode();
|
|
||||||
sc.put("type", "string");
|
|
||||||
h.set("schema", sc);
|
|
||||||
h.put("example", example);
|
|
||||||
headers.set(headerName, h);
|
|
||||||
}
|
|
||||||
|
|
||||||
private JsonNode parseJsonOrText(String s) {
|
|
||||||
try {
|
|
||||||
return objectMapper.readTree(s);
|
|
||||||
} catch (Exception e) {
|
|
||||||
return TextNode.valueOf(s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private ObjectNode getOrCreateObject(ObjectNode parent, String field) {
|
|
||||||
JsonNode node = parent.get(field);
|
|
||||||
if (node != null && node.isObject()) {
|
|
||||||
return (ObjectNode) node;
|
|
||||||
}
|
|
||||||
ObjectNode created = objectMapper.createObjectNode();
|
|
||||||
parent.set(field, created);
|
|
||||||
return created;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void putIfNotNull(Map<String, String> map, String key, String value) {
|
private void putIfNotNull(Map<String, String> map, String key, String value) {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
map.put(key, value);
|
map.put(key, value);
|
||||||
|
|||||||
@@ -54,6 +54,8 @@ public class ApiInterfaceUI {
|
|||||||
private String apiFullPath;
|
private String apiFullPath;
|
||||||
private String bzwksvckeyname;
|
private String bzwksvckeyname;
|
||||||
private String statusCode;
|
private String statusCode;
|
||||||
|
private String specStatus;
|
||||||
|
private List<String> publishedGroupNames;
|
||||||
|
|
||||||
//ASYNC-SYNC 용
|
//ASYNC-SYNC 용
|
||||||
private String inboundResponseHttpMethod;
|
private String inboundResponseHttpMethod;
|
||||||
|
|||||||
@@ -0,0 +1,184 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<configuration scan="true" scanPeriod="10 seconds">
|
||||||
|
<statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" />
|
||||||
|
|
||||||
|
<property name="LOG_PATTERN" value="[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] \\(%F:%L\\) %-20M -%msg%n" />
|
||||||
|
<property name="PREFIX" value="${inst.Type:-ems}" />
|
||||||
|
<property name="LOG_HOME" value="/work/eactive/djb-eapim/workspace/eapim-admin/logs" />
|
||||||
|
<property name="BACKUP_HOME" value="${LOG_HOME}/backup/" />
|
||||||
|
<property name="LOG_LEVEL" value="${LOGBACK_LOG_LEVEL:-DEBUG}" />
|
||||||
|
|
||||||
|
|
||||||
|
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<charset>utf-8</charset>
|
||||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss} %-5level [%thread] %logger{36} - %msg%n</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="STDOUT"
|
||||||
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_HOME}/${PREFIX}_stdout.log</file>
|
||||||
|
<rollingPolicy
|
||||||
|
class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>
|
||||||
|
${LOG_HOME}/${PREFIX}_stdout.log-%d{yyyy-MM-dd}.%i
|
||||||
|
</fileNamePattern>
|
||||||
|
<maxFileSize>500MB</maxFileSize>
|
||||||
|
<maxHistory>10</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<charset>utf-8</charset>
|
||||||
|
<pattern>${LOG_PATTERN}</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="ACCESS_APPENDER"
|
||||||
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_HOME}/${PREFIX}_access.log</file>
|
||||||
|
<rollingPolicy
|
||||||
|
class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>
|
||||||
|
${LOG_HOME}/${PREFIX}_access.log-%d{yyyy-MM-dd}.%i
|
||||||
|
</fileNamePattern>
|
||||||
|
<maxFileSize>500MB</maxFileSize>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<charset>utf-8</charset>
|
||||||
|
<pattern>${LOG_PATTERN}</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
<appender name="SMS_APPENDER"
|
||||||
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_HOME}/sms.log</file>
|
||||||
|
<rollingPolicy
|
||||||
|
class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>
|
||||||
|
${LOG_HOME}/sms.log-%d{yyyy-MM-dd}.%i
|
||||||
|
</fileNamePattern>
|
||||||
|
<maxFileSize>500MB</maxFileSize>
|
||||||
|
<maxHistory>10</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<charset>utf-8</charset>
|
||||||
|
<pattern>${LOG_PATTERN}</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
<appender name="QUERY_APPENDER"
|
||||||
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_HOME}/${PREFIX}_query.log</file>
|
||||||
|
<rollingPolicy
|
||||||
|
class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>
|
||||||
|
${LOG_HOME}/${PREFIX}_query.log-%d{yyyy-MM-dd}.%i
|
||||||
|
</fileNamePattern>
|
||||||
|
<maxFileSize>500MB</maxFileSize>
|
||||||
|
<maxHistory>10</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<charset>utf-8</charset>
|
||||||
|
<pattern>${LOG_PATTERN}</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
<appender name="DYNAMIC_APPENDER"
|
||||||
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_HOME}/${PREFIX}_dynamic.log</file>
|
||||||
|
<rollingPolicy
|
||||||
|
class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>
|
||||||
|
${LOG_HOME}/${PREFIX}_dynamic.log-%d{yyyy-MM-dd}.%i
|
||||||
|
</fileNamePattern>
|
||||||
|
<maxFileSize>500MB</maxFileSize>
|
||||||
|
<maxHistory>10</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<charset>utf-8</charset>
|
||||||
|
<pattern>${LOG_PATTERN}</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
<appender name="HIBERNATE_APPENDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_HOME}/${PREFIX}_hibernate.log</file>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_HOME}/${PREFIX}_hibernate.log-%d{yyyy-MM-dd}.%i</fileNamePattern>
|
||||||
|
<maxFileSize>500MB</maxFileSize>
|
||||||
|
<maxHistory>10</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<charset>utf-8</charset>
|
||||||
|
<pattern>${LOG_PATTERN}</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
<appender name="HOTSWAP_APPENDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_HOME}/${PREFIX}_hotswap.log</file>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_HOME}/${PREFIX}_hotswap.log-%d{yyyy-MM-dd}.%i</fileNamePattern>
|
||||||
|
<maxFileSize>500MB</maxFileSize>
|
||||||
|
<maxHistory>10</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<charset>utf-8</charset>
|
||||||
|
<pattern>${LOG_PATTERN}</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<logger name="com.eactive.eai.rms.onl.server" level="ERROR" />
|
||||||
|
<logger name="com.eactive.eai.rms.onl.dashboard" level="ERROR" />
|
||||||
|
<logger name="com.eactive.eai.rms.common.acl.user.BizDao" level="ERROR" />
|
||||||
|
<logger name="com.eactive.eai.rms.common.acl.user.BizDao" level="ERROR" />
|
||||||
|
<logger name="com.eactive.eai.rms.ext.djb.job" level="DEBUG" />
|
||||||
|
<logger name="com.eactive.eai.rms.ext.djb.apistatus" level="DEBUG" />
|
||||||
|
|
||||||
|
<logger name="org.springframework.orm.jpa.JpaTransactionManager" level="ERROR" additivity="false" />
|
||||||
|
|
||||||
|
<logger name="org.springframework" level="INFO" />
|
||||||
|
<logger name="net.sf.ehcache" level="INFO" />
|
||||||
|
|
||||||
|
|
||||||
|
<logger name="ACCESS_LOGGER" level="DEBUG" >
|
||||||
|
<appender-ref ref="ACCESS_APPENDER" />
|
||||||
|
</logger>
|
||||||
|
<logger name="SMS_LOGGER" level="DEBUG" >
|
||||||
|
<appender-ref ref="SMS_APPENDER" />
|
||||||
|
</logger>
|
||||||
|
<logger name="DYNAMIC_LOGGER" level="DEBUG" >
|
||||||
|
<appender-ref ref="DYNAMIC_APPENDER" />
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- QUERY_APPENDER start -->
|
||||||
|
<!-- Hibernate SQL & 파라미터 바인딩 -->
|
||||||
|
<logger name="org.hibernate.SQL" level="DEBUG" additivity="false">
|
||||||
|
<appender-ref ref="QUERY_APPENDER" />
|
||||||
|
<appender-ref ref="HIBERNATE_APPENDER" />
|
||||||
|
</logger>
|
||||||
|
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE" additivity="false">
|
||||||
|
<appender-ref ref="QUERY_APPENDER" />
|
||||||
|
<appender-ref ref="HIBERNATE_APPENDER" />
|
||||||
|
</logger>
|
||||||
|
<logger name="org.hibernate.type.descriptor.sql.BasicExtractor" level="TRACE" additivity="false">
|
||||||
|
<appender-ref ref="QUERY_APPENDER" />
|
||||||
|
<appender-ref ref="HIBERNATE_APPENDER" />
|
||||||
|
</logger>
|
||||||
|
<!-- Hibernate 일반 로그 (DDL/init/connection 등) -->
|
||||||
|
<logger name="org.hibernate" level="INFO" additivity="false">
|
||||||
|
<appender-ref ref="HIBERNATE_APPENDER" />
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<!-- iBATIS 2.3.4 (commons-logging 또는 log4j-over-slf4j 통해 SLF4J 도달) -->
|
||||||
|
<logger name="com.ibatis" level="DEBUG" additivity="false">
|
||||||
|
<appender-ref ref="QUERY_APPENDER" />
|
||||||
|
</logger>
|
||||||
|
<logger name="com.eactive.eai.rms.common.base.SchemaIdConfiguredSqlMapTemplate" level="DEBUG" additivity="false">
|
||||||
|
<appender-ref ref="QUERY_APPENDER" />
|
||||||
|
</logger>
|
||||||
|
<!-- QUERY_APPENDER end -->
|
||||||
|
|
||||||
|
<!-- HotswapAgent는 자체 logger를 사용하므로 logback에 안 잡힘. hotswap-agent.properties의 LOGFILE로 직접 파일 출력 -->
|
||||||
|
|
||||||
|
<root>
|
||||||
|
<level value="INFO" />
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
|
<appender-ref ref="CONSOLE" />
|
||||||
|
</root>
|
||||||
|
</configuration>
|
||||||
+84
@@ -0,0 +1,84 @@
|
|||||||
|
package com.eactive.eai.rms.data.entity.onl.apim.apispec;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import javax.persistence.EntityManager;
|
||||||
|
|
||||||
|
import com.eactive.apim.portal.apispec.entity.ApiSpecInfo;
|
||||||
|
import org.hibernate.SessionFactory;
|
||||||
|
import org.hibernate.cfg.Configuration;
|
||||||
|
import org.junit.jupiter.api.AfterAll;
|
||||||
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.data.jpa.repository.support.JpaRepositoryFactory;
|
||||||
|
|
||||||
|
class ApiSpecStatusRepositoryTest {
|
||||||
|
private static SessionFactory sessionFactory;
|
||||||
|
private static EntityManager entityManager;
|
||||||
|
private static ApiSpecStatusRepository repository;
|
||||||
|
|
||||||
|
@BeforeAll
|
||||||
|
static void setUp() {
|
||||||
|
sessionFactory = new Configuration()
|
||||||
|
.addAnnotatedClass(ApiSpecInfo.class)
|
||||||
|
.setProperty("hibernate.dialect", "org.hibernate.dialect.H2Dialect")
|
||||||
|
.setProperty("hibernate.connection.driver_class", "org.h2.Driver")
|
||||||
|
.setProperty("hibernate.connection.url", "jdbc:h2:mem:apiSpecStatus;DB_CLOSE_DELAY=-1")
|
||||||
|
.setProperty("hibernate.hbm2ddl.auto", "create-drop")
|
||||||
|
.buildSessionFactory();
|
||||||
|
entityManager = sessionFactory.createEntityManager();
|
||||||
|
repository = new JpaRepositoryFactory(entityManager).getRepository(ApiSpecStatusRepository.class);
|
||||||
|
entityManager.getTransaction().begin();
|
||||||
|
save("PUBLISHED1", "Y");
|
||||||
|
save("REGISTERED1", "N");
|
||||||
|
save("LEGACY2", null);
|
||||||
|
entityManager.getTransaction().commit();
|
||||||
|
entityManager.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void save(String apiId, String displayYn) {
|
||||||
|
ApiSpecInfo spec = new ApiSpecInfo();
|
||||||
|
spec.setApiId(apiId);
|
||||||
|
spec.setDisplayYn(displayYn);
|
||||||
|
entityManager.persist(spec);
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterAll
|
||||||
|
static void tearDown() {
|
||||||
|
if (entityManager != null) entityManager.close();
|
||||||
|
if (sessionFactory != null) sessionFactory.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void publishedIncludesOnlyDisplayedSpecs() {
|
||||||
|
assertEquals(Arrays.asList("PUBLISHED1"), repository.findApiIdsByStatus("PUBLISHED"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void registeredIncludesNonDisplayedAndLegacyNullSpecs() {
|
||||||
|
assertEquals(new HashSet<>(Arrays.asList("REGISTERED1", "LEGACY2")),
|
||||||
|
new HashSet<>(repository.findApiIdsByStatus("REGISTERED")));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void statusProjectionIncludesOnlyRequestedExistingSpecs() {
|
||||||
|
Map<String, String> statuses = repository.findStatusesByApiIds(
|
||||||
|
Arrays.asList("PUBLISHED1", "LEGACY2", "MISSING2")).stream()
|
||||||
|
.collect(Collectors.toMap(ApiSpecStatusRepository.SpecStatus::getApiId,
|
||||||
|
spec -> "Y".equals(spec.getDisplayYn()) ? "PUBLISHED" : "REGISTERED"));
|
||||||
|
assertEquals(2, statuses.size());
|
||||||
|
assertEquals("PUBLISHED", statuses.get("PUBLISHED1"));
|
||||||
|
assertEquals("REGISTERED", statuses.get("LEGACY2"));
|
||||||
|
assertEquals("UNREGISTERED", statuses.getOrDefault("MISSING2", "UNREGISTERED"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void missingApiHasNoSpecStatus() {
|
||||||
|
assertTrue(repository.findStatusesByApiIds(Arrays.asList("MISSING2")).isEmpty());
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user