Merge branch 'jenkins_with_weblogic' of ssh://git@192.168.240.178:18081/eapim/eapim-admin.git into jenkins_with_weblogic

This commit is contained in:
daekuk1
2026-02-09 14:23:52 +09:00
8 changed files with 179 additions and 293 deletions
@@ -375,10 +375,20 @@
url:url, url:url,
data:postData, data:postData,
success:function(args){ success:function(args){
alert("<%=localeMessage.getString("common.saveMsg")%>");
if(isPop == "true"){ if(isPop == "true"){
alert("<%=localeMessage.getString("common.saveMsg")%> \n저장 후 변환정보 수정이 필수입니다. 변환정보를 확인하세요");
const origin = window.location.origin;
const layoutName = $("input[name='loutName']").val();
parent.postMessage({
action: 'LAYOUT_SAVED_OPEN_TRANSFORM',
layoutPartName: '${param.layoutPartName}'
}, origin);
window.close(); window.close();
} else { } else {
alert("<%=localeMessage.getString("common.saveMsg")%>");
goNav(returnUrl); goNav(returnUrl);
} }
}, },
@@ -1153,19 +1153,46 @@
addLayoutBtnEvent('outboundErrResponse', '아웃바운드 오류', 'TGTE'); addLayoutBtnEvent('outboundErrResponse', '아웃바운드 오류', 'TGTE');
window.addEventListener('message', function(e) { window.addEventListener('message', function(e) {
if (e.origin !== window.location.origin) return;
const popupMessage = e.data; const popupMessage = e.data;
if('DELETE' == popupMessage.cmd){ if (!popupMessage) return;
if('layout' == popupMessage.type){
$('#'+popupMessage.layoutPartName).val(''); if ('DELETE' == popupMessage.cmd) {
if ('layout' == popupMessage.type) {
$('#' + popupMessage.layoutPartName).val('');
} }
if('transform' == popupMessage.type){ if ('transform' == popupMessage.type) {
const partName = popupMessage.transformName.endsWith('REQ') ? '#requestTransform' : '#responseTransform'; const partName = popupMessage.transformName.endsWith('REQ') ? '#requestTransform' : '#responseTransform';
$(partName).val(''); $(partName).val('');
} }
transformSetStateChange(); transformSetStateChange();
return;
}
// 레이아웃 저장 후 변환 팝업 자동 실행 로직
if (popupMessage.action === 'LAYOUT_SAVED_OPEN_TRANSFORM') {
// 눈이 보이지않는 팝업창 popup창 닫기
if ($('.ui-dialog-content').length > 0) {
$('.ui-dialog-content').dialog('close');
}
const part = popupMessage.layoutPartName || "";
setTimeout(function() {
if (part.includes('Request')) {
modifyTransform('request');
} else if (part.includes('Response')) {
modifyTransform('response');
} else if (part.includes('ErrResponse')) {
modifyTransform('errResponse');
}
}, 300);
} }
}); });
// modifyLayout('inboundRequestLayout', '인바운드 요청', 'CBSS')
$('#requestTransformButton').on("click", function(event) { $('#requestTransformButton').on("click", function(event) {
modifyTransform('request'); modifyTransform('request');
}); });
@@ -1175,7 +1202,6 @@
$('#errResponseTransformButton').on("click", function(event) { $('#errResponseTransformButton').on("click", function(event) {
modifyTransform('errResponse'); modifyTransform('errResponse');
}); });
// modifyLayout('inboundRequestLayout', '인바운드 요청', 'CBSS')
// 함수 사용 예시에 인바운드 응답 처리 추가 // 함수 사용 예시에 인바운드 응답 처리 추가
$("#fromAdapter").change(function() { $("#fromAdapter").change(function() {
@@ -15,6 +15,14 @@
<jsp:include page="/jsp/common/include/css.jsp"/> <jsp:include page="/jsp/common/include/css.jsp"/>
<jsp:include page="/jsp/common/include/script.jsp"/> <jsp:include page="/jsp/common/include/script.jsp"/>
<style> <style>
#tab4 div {
display: block;
overflow-wrap: break-word;
word-break: break-all;
white-space: normal;
}
</style> </style>
<script language="javascript" > <script language="javascript" >
// var eaiBzwkDstcd = window.dialogArguments["eaiBzwkDstcd"]; // var eaiBzwkDstcd = window.dialogArguments["eaiBzwkDstcd"];
@@ -980,14 +988,14 @@ html,hbody {
<td style="width:30%;"><input type="text" name="msgDpstYMS" readonly="readonly"/> </td> <td style="width:30%;"><input type="text" name="msgDpstYMS" readonly="readonly"/> </td>
</tr> </tr>
<tr> <tr>
<th><%=localeMessage.getString("trackingDetail.eaiSvcName")%></th><td><input type="text" name="eaiSvcName" readonly="readonly" /> <th>API ID</th><td><input type="text" name="eaiSvcName" readonly="readonly" />
<%-- <img src="<c:url value="/images/bt/pop_detail.gif"/>" alt="" id="eaiSvcName" class="eaiSvcName_btn" /> --%> <%-- <img src="<c:url value="/images/bt/pop_detail.gif"/>" alt="" id="eaiSvcName" class="eaiSvcName_btn" /> --%>
<%-- <button type="button" class="cssbtn smallBtn2" id="eaiSvcName" style="vertical-align:middle; font-weight:bold;"><i class="material-icons">details</i><%= localeMessage.getString("button.detail") %></button>--%> <%-- <button type="button" class="cssbtn smallBtn2" id="eaiSvcName" style="vertical-align:middle; font-weight:bold;"><i class="material-icons">details</i><%= localeMessage.getString("button.detail") %></button>--%>
</td> </td>
<th><%=localeMessage.getString("trackingDetail.msgPrcssYMS")%></th><td><input type="text" name="msgPrcssYMS" readonly="readonly"/> </td> <th><%=localeMessage.getString("trackingDetail.msgPrcssYMS")%></th><td><input type="text" name="msgPrcssYMS" readonly="readonly"/> </td>
</tr> </tr>
<tr> <tr>
<th><%=localeMessage.getString("trackingDetail.eaiSvcDesc")%></th><td><input type="text" name="eaiSvcDesc" readonly="readonly"/> </td> <th>API 명</th><td><input type="text" name="eaiSvcDesc" readonly="readonly"/> </td>
<th>ORG GUID</th><td><input type="text" name="pguid" readonly="readonly"/> </td> <th>ORG GUID</th><td><input type="text" name="pguid" readonly="readonly"/> </td>
</tr> </tr>
<tr> <tr>
@@ -2,6 +2,9 @@ package com.eactive.eai.rms.data.entity.onl.apim.obp;
import com.eactive.apim.portal.obp.entity.ObpGwMetric; import com.eactive.apim.portal.obp.entity.ObpGwMetric;
import com.eactive.apim.portal.obp.repository.ObpGwMetricRepository; import com.eactive.apim.portal.obp.repository.ObpGwMetricRepository;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@@ -50,6 +53,24 @@ public class ObpGwMetricService {
return repository.findByTimesliceGreaterThanEqual(timeslice); return repository.findByTimesliceGreaterThanEqual(timeslice);
} }
/**
* 특정 시간대 이후의 GwMetric 데이터 조회 (row 수 제한)
*
* @param timeslice 조회 시작 시간대
* @param limit 최대 조회 건수 (0이면 무제한)
* @return 조회된 지표 목록 (timeslice ASC 정렬)
*/
public List<ObpGwMetric> findByTimesliceGreaterThanEqual(LocalDateTime timeslice, int limit) {
if (limit <= 0) {
// 무제한 조회 (기존 동작 유지)
return repository.findByTimesliceGreaterThanEqual(timeslice);
} else {
// 제한적 조회 (timeslice ASC 정렬 + limit)
Pageable pageable = PageRequest.of(0, limit, Sort.by(Sort.Order.asc("timeslice")));
return repository.findByTimesliceGreaterThanEqual(timeslice, pageable);
}
}
/** /**
* 엔티티 저장 (INSERT 또는 UPDATE) * 엔티티 저장 (INSERT 또는 UPDATE)
*/ */
@@ -1,131 +0,0 @@
package com.eactive.eai.rms.onl.apim.obp;
import com.eactive.apim.portal.obp.entity.ObpGwMetric;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
/**
* ObpGwMetric JSON 응답 DTO (after-timeslice 엔드포인트용)
*
* <p>예시 출력 형식에 맞춤:</p>
* <pre>
* {
* "apiId": "1ba56b82-a9c9-41e2-b3ab-ff9377667d56",
* "apiName": "[해외송금] 가상계좌 입금실패 정보조회",
* "apiRoutingUri": "/api/obs/remittance/remittancefail*",
* "httpMethod": "POST",
* "orgId": "ORG001",
* "partnerCode": "000008-01",
* "appId": "APP001",
* "appKey": "l7xx2fd7efc523794be5a1b126873a5de613",
* "requestUri": "-1",
* "timeslice": "2025-12-02T03:00:00.000+0000",
* "attemptedCount": 3,
* "completedCount": 3
* }
* </pre>
*/
@Data
public class ObpGwMetricAfterDTO {
private static final DateTimeFormatter ISO8601_MILLIS_FORMATTER =
DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'+0000'");
@SerializedName("apiId")
private String apiId;
@SerializedName("apiName")
private String apiName;
@SerializedName("apiRoutingUri")
private String apiRoutingUri;
@SerializedName("httpMethod")
private String httpMethod;
@SerializedName("orgId")
private String orgId;
@SerializedName("partnerCode")
private String partnerCode;
@SerializedName("appId")
private String appId;
@SerializedName("appKey")
private String appKey;
@SerializedName("requestUri")
private String requestUri;
@SerializedName("timeslice")
private String timeslice;
@SerializedName("attemptedCount")
private Long attemptedCount;
@SerializedName("completedCount")
private Long completedCount;
// AS-IS 호환을 위한 필드 (null 값으로 리턴)
@SerializedName("clusterHostname")
private String clusterHostname = null;
@SerializedName("apiDatabaseId")
private Integer apiDatabaseId = null;
@SerializedName("unauthorizedCount")
private Integer authorizedCount = null;
@SerializedName("backMinTime")
private Integer backMinTime = null;
@SerializedName("backMaxTime")
private Integer backMaxTime = null;
@SerializedName("backSumTime")
private Integer backSumTime = null;
@SerializedName("frontMinTime")
private Integer frontMinTime = null;
@SerializedName("frontMaxTime")
private Integer frontMaxTime = null;
@SerializedName("frontSumTime")
private Integer frontSumTime = null;
/**
* Entity → DTO 변환
*/
public static ObpGwMetricAfterDTO from(ObpGwMetric entity) {
ObpGwMetricAfterDTO dto = new ObpGwMetricAfterDTO();
dto.setApiId(entity.getApiId());
dto.setApiName(entity.getApiName());
dto.setApiRoutingUri(entity.getUri());
dto.setHttpMethod(entity.getMethod());
dto.setOrgId(entity.getOrgId());
dto.setPartnerCode(entity.getPartnerCode());
dto.setAppId(entity.getAppId());
dto.setAppKey(entity.getClientId());
dto.setRequestUri(entity.getRequestUri());
dto.setTimeslice(formatTimeslice(entity.getTimeslice()));
dto.setAttemptedCount(entity.getAttemptedCount());
dto.setCompletedCount(entity.getCompletedCount());
return dto;
}
/**
* timeslice를 ISO8601 형식 (밀리초 포함) + UTC 시간대로 변환
* 예: 2025-12-02T03:00:00.000+0000
*/
private static String formatTimeslice(LocalDateTime timeslice) {
if (timeslice == null) return null;
return timeslice.format(ISO8601_MILLIS_FORMATTER);
}
}
@@ -55,12 +55,12 @@ public class ObpGwMetricController extends BaseRestController {
produces = JSON_CONTENT_TYPE produces = JSON_CONTENT_TYPE
) )
@ResponseBody @ResponseBody
public String getGwMetricsAfterTimesliceV2( public String getGwMetricsAfterTimeslice(
@PathVariable("timeslice") String timeslice, @PathVariable("timeslice") String timeslice,
@PathVariable("providerCode") String providerCode, @PathVariable("providerCode") String providerCode,
@RequestParam(value = "pretty", required = false) Boolean pretty) { @RequestParam(value = "pretty", required = false) Boolean pretty) {
log.debug("GwMetric after-timeslice 조회 요청 (v2): timeslice={}, providerCode={}, pretty={}", log.debug("GwMetric after-timeslice 조회 요청: timeslice={}, providerCode={}, pretty={}",
timeslice, providerCode, pretty); timeslice, providerCode, pretty);
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
@@ -85,7 +85,7 @@ public class ObpGwMetricController extends BaseRestController {
DataSourceTypeManager.getDataSourceType(DataSourceTypeManager.MONITORING)); DataSourceTypeManager.getDataSourceType(DataSourceTypeManager.MONITORING));
// 5. 데이터 조회 // 5. 데이터 조회
List<ObpGwMetricAfterDTO> metrics = obpGwMetricManService.findByTimesliceAfter(timesliceHour); List<ObpGwMetricDTO> metrics = obpGwMetricManService.findByTimesliceAfter(timesliceHour);
// 6. JSON 변환 // 6. JSON 변환
String json = toJson(metrics, pretty); String json = toJson(metrics, pretty);
@@ -104,90 +104,4 @@ public class ObpGwMetricController extends BaseRestController {
throw new BizException("Failed to retrieve metrics: " + e.getMessage(), e); throw new BizException("Failed to retrieve metrics: " + e.getMessage(), e);
} }
} }
/**
* 특정 시간대의 GwMetric 데이터 조회
*
* @param datetime 조회 시간대 (형식: yyyy-MM-dd_HH:mm:ss)
* @param pretty true면 JSON 들여쓰기 적용
* @return JSON Array
*/
@RequestMapping(
value = "/kjb/gw-metrics/{datetime}.json",
produces = JSON_CONTENT_TYPE
)
@ResponseBody
public String getGwMetrics(
@PathVariable("datetime") String datetime,
@RequestParam(value = "pretty", required = false) Boolean pretty) {
log.debug("GwMetric 조회 요청: datetime={}, pretty={}", datetime, pretty);
long startTime = System.currentTimeMillis();
try {
// Path 파라미터 파싱
LocalDateTime targetTime = LocalDateTime.parse(datetime, PATH_FORMATTER);
LocalDateTime timeslice = targetTime.withMinute(0).withSecond(0).withNano(0);
// 조회
List<ObpGwMetricDTO> metrics = obpGwMetricManService.findByTimeslice(timeslice);
// JSON 변환 (GSON)
String json = toJson(metrics, pretty);
long elapsed = System.currentTimeMillis() - startTime;
log.info("GwMetric 조회 완료: datetime={}, count={}, size={}, elapsed={}ms",
datetime, metrics.size(), getFormattedJsonSize(json), elapsed);
return json;
} catch (Exception e) {
log.error("GwMetric 조회 실패: datetime={}", datetime, e);
throw e;
}
}
/**
* 특정 시간대 이후의 GwMetric 데이터 조회
*
* @param datetime 조회 시작 시간대 (형식: yyyy-MM-dd_HH:mm:ss)
* @param pretty true면 JSON 들여쓰기 적용
* @return JSON Array (해당 시간대 이후의 모든 지표)
* @deprecated Use {@link #getGwMetricsAfterTimesliceV2(String, String, Boolean)} instead.
* Migrate to /api/metrics/afterTimeslice/{timeslice}/{providerCode}
* Will be removed in next major version.
*/
@Deprecated
@RequestMapping(
value = "/kjb/gw-metrics/after-timeslice/{datetime}.json",
produces = JSON_CONTENT_TYPE
)
@ResponseBody
public String getGwMetricsAfterTimeslice(
@PathVariable("datetime") String datetime,
@RequestParam(value = "pretty", required = false) Boolean pretty) {
log.debug("GwMetric after-timeslice 조회 요청: datetime={}, pretty={}", datetime, pretty);
long startTime = System.currentTimeMillis();
try {
// Path 파라미터 파싱
LocalDateTime targetTime = LocalDateTime.parse(datetime, PATH_FORMATTER);
LocalDateTime timeslice = targetTime.withMinute(0).withSecond(0).withNano(0);
// 조회
List<ObpGwMetricAfterDTO> metrics = obpGwMetricManService.findByTimesliceAfter(timeslice);
// JSON 변환 (GSON)
String json = toJson(metrics, pretty);
long elapsed = System.currentTimeMillis() - startTime;
log.info("GwMetric after-timeslice 조회 완료: datetime={}, count={}, size={}, elapsed={}ms",
datetime, metrics.size(), getFormattedJsonSize(json), elapsed);
return json;
} catch (Exception e) {
log.error("GwMetric after-timeslice 조회 실패: datetime={}", datetime, e);
throw e;
}
}
} }
@@ -8,32 +8,61 @@ import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
/** /**
* ObpGwMetric JSON 응답 DTO * ObpGwMetric JSON 응답 DTO (after-timeslice 엔드포인트용)
* Entity 주석에 명시된 JSON Key 사용 *
* <p>예시 출력 형식에 맞춤:</p>
* <pre>
* {
* "apiId": "1ba56b82-a9c9-41e2-b3ab-ff9377667d56",
* "apiName": "[해외송금] 가상계좌 입금실패 정보조회",
* "apiRoutingUri": "/api/obs/remittance/remittancefail*",
* "httpMethod": "POST",
* "orgId": "ORG001",
* "partnerCode": "000008-01",
* "appId": "APP001",
* "appKey": "l7xx2fd7efc523794be5a1b126873a5de613",
* "requestUri": "-1",
* "timeslice": "2025-12-02T03:00:00.000+0000",
* "attemptedCount": 3,
* "completedCount": 3
* }
* </pre>
*/ */
@Data @Data
public class ObpGwMetricDTO { public class ObpGwMetricDTO {
private static final DateTimeFormatter ISO8601_FORMATTER = private static final DateTimeFormatter ISO8601_MILLIS_FORMATTER =
DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss'+0000'"); DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'+0900'");
@SerializedName("appKey") @SerializedName("apiId")
private String clientId; private String apiId;
@SerializedName("clusterHostname")
private String hostname;
@SerializedName("timeslice")
private String timeslice;
@SerializedName("apiName") @SerializedName("apiName")
private String apiName; private String apiName;
@SerializedName("apiRoutingUri") @SerializedName("apiRoutingUri")
private String uri; private String apiRoutingUri;
@SerializedName("httpMethod") @SerializedName("httpMethod")
private String method; private String httpMethod;
@SerializedName("orgId")
private String orgId;
@SerializedName("partnerCode")
private String partnerCode;
@SerializedName("appId")
private String appId;
@SerializedName("appKey")
private String appKey;
@SerializedName("requestUri")
private String requestUri;
@SerializedName("timeslice")
private String timeslice;
@SerializedName("attemptedCount") @SerializedName("attemptedCount")
private Long attemptedCount; private Long attemptedCount;
@@ -41,62 +70,68 @@ public class ObpGwMetricDTO {
@SerializedName("completedCount") @SerializedName("completedCount")
private Long completedCount; private Long completedCount;
// EAPIM ID
@SerializedName("apiIdByEapim")
private String apiId;
@SerializedName("appIdByEapim") // AS-IS 호환을 위한 필드 (null 값으로 리턴)
private String appId; @SerializedName("clusterHostname")
private String clusterHostname = null;
@SerializedName("orgIdByEapim") @SerializedName("apiDatabaseId")
private String orgId; private Integer apiDatabaseId = null;
// AS-IS 호환용 필드 @SerializedName("unauthorizedCount")
@SerializedName("appId") private Integer authorizedCount = null;
private String appIdByCaPortal;
@SerializedName("portalOrgId") @SerializedName("backMinTime")
private String orgIdByCaPortal; private Integer backMinTime = null;
@SerializedName("portalApiId") @SerializedName("backMaxTime")
private String apiIdByCaPortal; private Integer backMaxTime = null;
@SerializedName("partnerCode") @SerializedName("backSumTime")
private String partnerCode; private Integer backSumTime = null;
@SerializedName("frontMinTime")
private Integer frontMinTime = null;
@SerializedName("frontMaxTime")
private Integer frontMaxTime = null;
@SerializedName("frontSumTime")
private Integer frontSumTime = null;
@SerializedName("apiId")
private String apiIdByCa;
/** /**
* Entity → DTO 변환 * Entity → DTO 변환
*/ */
public static ObpGwMetricDTO from(ObpGwMetric entity) { public static ObpGwMetricDTO from(ObpGwMetric entity) {
ObpGwMetricDTO dto = new ObpGwMetricDTO(); ObpGwMetricDTO dto = new ObpGwMetricDTO();
dto.setClientId(entity.getClientId()); dto.setApiId(entity.getApiId());
dto.setHostname(entity.getHostname());
dto.setTimeslice(formatTimeslice(entity.getTimeslice()));
dto.setApiName(entity.getApiName()); dto.setApiName(entity.getApiName());
dto.setUri(entity.getUri()); dto.setApiRoutingUri(entity.getUri());
dto.setMethod(entity.getMethod()); dto.setHttpMethod(entity.getMethod());
dto.setOrgId(entity.getOrgId());
dto.setPartnerCode(entity.getPartnerCode());
dto.setAppId(entity.getAppId());
dto.setAppKey(entity.getClientId());
dto.setRequestUri(entity.getRequestUri());
dto.setTimeslice(formatTimeslice(entity.getTimeslice()));
dto.setAttemptedCount(entity.getAttemptedCount()); dto.setAttemptedCount(entity.getAttemptedCount());
dto.setCompletedCount(entity.getCompletedCount()); dto.setCompletedCount(entity.getCompletedCount());
dto.setApiId(entity.getApiId());
dto.setAppId(entity.getAppId());
dto.setOrgId(entity.getOrgId()); // 260224 - AS-IS 개발자포탈에서 쓰이던 ID 필드 값 삭제(OBP 디비 필드 형식과 맞지 않음)
dto.setAppIdByCaPortal(entity.getAppIdByCaPortal()); dto.setOrgId(null);
dto.setOrgIdByCaPortal(entity.getOrgIdByCaPortal()); dto.setAppId(null);
dto.setApiIdByCaPortal(entity.getApiIdByCaPortal());
dto.setPartnerCode(entity.getPartnerCode());
dto.setApiIdByCa(entity.getApiIdByCa());
return dto; return dto;
} }
/** /**
* timeslice를 ISO8601 형식 + UTC 시간대로 변환 * timeslice를 ISO8601 형식 (밀리초 포함) + UTC 시간대로 변환
* 예: 2025-12-02T01:00:00+0000 * 예: 2025-12-02T03:00:00.000+0000
*/ */
private static String formatTimeslice(LocalDateTime timeslice) { private static String formatTimeslice(LocalDateTime timeslice) {
if (timeslice == null) return null; if (timeslice == null) return null;
return timeslice.format(ISO8601_FORMATTER); return timeslice.format(ISO8601_MILLIS_FORMATTER);
} }
} }
@@ -10,6 +10,7 @@ import com.eactive.eai.rms.common.util.CommonUtil;
import com.eactive.eai.rms.data.entity.onl.apim.obp.ObpGwMetricJpaDAO; import com.eactive.eai.rms.data.entity.onl.apim.obp.ObpGwMetricJpaDAO;
import com.eactive.eai.rms.data.entity.onl.apim.obp.ObpGwMetricService; import com.eactive.eai.rms.data.entity.onl.apim.obp.ObpGwMetricService;
import com.eactive.eai.rms.data.entity.onl.apim.obp.ObpGwMetricVO; import com.eactive.eai.rms.data.entity.onl.apim.obp.ObpGwMetricVO;
import com.eactive.ext.kjb.common.KjbPropertyHolder;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.dao.DataIntegrityViolationException; import org.springframework.dao.DataIntegrityViolationException;
@@ -311,30 +312,32 @@ public class ObpGwMetricManService extends BaseService {
return entity; return entity;
} }
/**
* 특정 시간대의 GwMetric 데이터 조회 (REST API용)
*/
public List<ObpGwMetricDTO> findByTimeslice(LocalDateTime timeslice) {
DataSourceContextHolder.setDataSourceType(
DataSourceTypeManager.getDataSourceType(DataSourceTypeManager.MONITORING));
List<ObpGwMetric> entities = obpGwMetricService.findByTimeslice(timeslice);
return entities.stream()
.map(ObpGwMetricDTO::from)
.collect(Collectors.toList());
}
/** /**
* 특정 시간대 이후의 GwMetric 데이터 조회 (REST API용) * 특정 시간대 이후의 GwMetric 데이터 조회 (REST API용)
* after-timeslice 엔드포인트에서 사용 * after-timeslice 엔드포인트에서 사용
*
* <p>조회 범위 제한:</p>
* <ul>
* <li>pageSize 값을 KjbProperty.apiGwMetricPageSize에서 읽어옴 (기본값: 10000)</li>
* <li>0일 경우 무제한 조회</li>
* <li>정렬: timeslice ASC (오래된 데이터부터 반환)</li>
* </ul>
*/ */
public List<ObpGwMetricAfterDTO> findByTimesliceAfter(LocalDateTime timeslice) { public List<ObpGwMetricDTO> findByTimesliceAfter(LocalDateTime timeslice) {
DataSourceContextHolder.setDataSourceType( DataSourceContextHolder.setDataSourceType(
DataSourceTypeManager.getDataSourceType(DataSourceTypeManager.MONITORING)); DataSourceTypeManager.getDataSourceType(DataSourceTypeManager.MONITORING));
List<ObpGwMetric> entities = obpGwMetricService.findByTimesliceGreaterThanEqual(timeslice); // KjbProperty에서 pageSize 읽기
Integer pageSize = KjbPropertyHolder.get().getApiGwMetricPageSize();
if (pageSize == null) {
pageSize = 10000; // 기본값 (null 안전 처리)
}
// Service 호출 (limit 적용)
List<ObpGwMetric> entities = obpGwMetricService.findByTimesliceGreaterThanEqual(timeslice, pageSize);
return entities.stream() return entities.stream()
.map(ObpGwMetricAfterDTO::from) .map(ObpGwMetricDTO::from)
.collect(Collectors.toList()); .collect(Collectors.toList());
} }