Merge branch 'jenkins_with_weblogic' into features/ui-improvements
This commit is contained in:
@@ -6,10 +6,10 @@
|
||||
|
||||
<context-root>monitoring</context-root>
|
||||
<session-descriptor>
|
||||
<timeout-secs>3600</timeout-secs>
|
||||
<timeout-secs>1800</timeout-secs>
|
||||
<cookie-name>JSESSIONID_EMS</cookie-name>
|
||||
<persistent-store-type>memory</persistent-store-type>
|
||||
<persistent-store-type>replicated_if_clustered</persistent-store-type>
|
||||
<!-- <persistent-store-type>memory</persistent-store-type>-->
|
||||
<persistent-store-type>replicated_if_clustered</persistent-store-type>
|
||||
</session-descriptor>
|
||||
|
||||
<container-descriptor>
|
||||
|
||||
@@ -211,6 +211,22 @@
|
||||
layoutInfo = json.standardHeader;
|
||||
bzwkdatatntInfo = json.BZWKDATACTNT;
|
||||
|
||||
// bzwkdatatntInfoLength 파싱 및 패딩 처리
|
||||
let bzwkdatatntInfoLength = 0;
|
||||
try {
|
||||
bzwkdatatntInfoLength = parseInt(layoutInfo[layoutInfo.length - 2].value, 10);
|
||||
if (isNaN(bzwkdatatntInfoLength)) {
|
||||
bzwkdatatntInfoLength = 0;
|
||||
}
|
||||
} catch (e) {
|
||||
bzwkdatatntInfoLength = 0;
|
||||
}
|
||||
|
||||
// bzwkdatatntInfo 패딩 적용
|
||||
if (bzwkdatatntInfoLength > 0 && bzwkdatatntInfo) {
|
||||
bzwkdatatntInfo = padByteString(bzwkdatatntInfo, bzwkdatatntInfoLength);
|
||||
}
|
||||
|
||||
if((isInboundPart && isInboundWithoutNet) || (isOutboundPart && isOutboundWithoutNet)){
|
||||
selectHttpLog(url, prcsDate, json.EAISVCSERNO.trim(), logPrcssSerno);
|
||||
}else{
|
||||
@@ -897,9 +913,42 @@ $(document).ready(function() {
|
||||
|
||||
// console.log("변환 완료:", parsedList);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* 문자열의 바이트 수 계산 (한글 2바이트, 영문/숫자 1바이트)
|
||||
*/
|
||||
function getByteLength(str) {
|
||||
let byteCount = 0;
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
const charCode = str.charCodeAt(i);
|
||||
byteCount += (charCode >= 0xAC00 && charCode <= 0xD7A3) ? 2 : 1;
|
||||
}
|
||||
return byteCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 문자열을 주어진 바이트 수만큼 패딩
|
||||
* @param {string} str - 원본 문자열
|
||||
* @param {number} targetBytes - 목표 바이트 수
|
||||
* @param {string} position - 'left' 또는 'right' (기본: 'right')
|
||||
* @param {string} padChar - 패딩 문자 (기본: 공백)
|
||||
* @returns {string} - 패딩된 문자열
|
||||
*/
|
||||
function padByteString(str, targetBytes, position = 'right', padChar = ' ') {
|
||||
const currentBytes = getByteLength(str);
|
||||
|
||||
if (currentBytes >= targetBytes) {
|
||||
return str; // 이미 목표 바이트 이상이면 그대로 반환
|
||||
}
|
||||
|
||||
const paddingBytes = targetBytes - currentBytes;
|
||||
const padding = padChar.repeat(paddingBytes);
|
||||
|
||||
return position === 'left' ? padding + str : str + padding;
|
||||
}
|
||||
|
||||
</script>
|
||||
<style>
|
||||
.dialog_confirm{
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
org.gradle.jvmargs=-Xmx2g
|
||||
org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError
|
||||
org.gradle.parallel=true
|
||||
org.gradle.caching=true
|
||||
org.gradle.configureondemand=true
|
||||
@@ -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.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.transaction.annotation.Transactional;
|
||||
|
||||
@@ -50,6 +53,24 @@ public class ObpGwMetricService {
|
||||
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)
|
||||
*/
|
||||
|
||||
@@ -7,8 +7,9 @@ import com.eactive.ext.kjb.common.KjbPropertyHolder;
|
||||
import com.eactive.ext.kjb.common.KjbUmsException;
|
||||
import com.eactive.ext.kjb.ums.KjbUmsService;
|
||||
import com.eactive.ext.kjb.ums.UmsBizWorkCode;
|
||||
import com.eactive.ext.kjb.ums.gson.IUmsGsonObject;
|
||||
import com.eactive.ext.kjb.ums.gson.GsonUtil;
|
||||
import com.eactive.ext.kjb.ums.gson.VerifyPhoneUmsTemplate;
|
||||
import com.google.gson.JsonObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@@ -121,8 +122,7 @@ public class SmsAuthService {
|
||||
String guid = String.format("EAPIM_EMS-%s",
|
||||
DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS").format(LocalDateTime.now()));
|
||||
|
||||
IUmsGsonObject content = null;
|
||||
content = VerifyPhoneUmsTemplate.builder().authNumber(authCode).build();
|
||||
JsonObject content = GsonUtil.toJsonObject(VerifyPhoneUmsTemplate.builder().authNumber(authCode).build());
|
||||
|
||||
getUmsService().sendKakaoAlimTalk(guid, UmsBizWorkCode.VERIFY_PHONE, cleanedPhone, content);
|
||||
log.info("SMS 인증번호 발송 완료 - guid: {}, phone: {}****{}",
|
||||
|
||||
@@ -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
|
||||
)
|
||||
@ResponseBody
|
||||
public String getGwMetricsAfterTimesliceV2(
|
||||
public String getGwMetricsAfterTimeslice(
|
||||
@PathVariable("timeslice") String timeslice,
|
||||
@PathVariable("providerCode") String providerCode,
|
||||
@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);
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
@@ -85,7 +85,7 @@ public class ObpGwMetricController extends BaseRestController {
|
||||
DataSourceTypeManager.getDataSourceType(DataSourceTypeManager.MONITORING));
|
||||
|
||||
// 5. 데이터 조회
|
||||
List<ObpGwMetricAfterDTO> metrics = obpGwMetricManService.findByTimesliceAfter(timesliceHour);
|
||||
List<ObpGwMetricDTO> metrics = obpGwMetricManService.findByTimesliceAfter(timesliceHour);
|
||||
|
||||
// 6. JSON 변환
|
||||
String json = toJson(metrics, pretty);
|
||||
@@ -104,90 +104,4 @@ public class ObpGwMetricController extends BaseRestController {
|
||||
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;
|
||||
|
||||
/**
|
||||
* ObpGwMetric JSON 응답 DTO
|
||||
* Entity 주석에 명시된 JSON Key 사용
|
||||
* 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 ObpGwMetricDTO {
|
||||
|
||||
private static final DateTimeFormatter ISO8601_FORMATTER =
|
||||
DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss'+0000'");
|
||||
private static final DateTimeFormatter ISO8601_MILLIS_FORMATTER =
|
||||
DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'+0900'");
|
||||
|
||||
@SerializedName("appKey")
|
||||
private String clientId;
|
||||
|
||||
@SerializedName("clusterHostname")
|
||||
private String hostname;
|
||||
|
||||
@SerializedName("timeslice")
|
||||
private String timeslice;
|
||||
@SerializedName("apiId")
|
||||
private String apiId;
|
||||
|
||||
@SerializedName("apiName")
|
||||
private String apiName;
|
||||
|
||||
@SerializedName("apiRoutingUri")
|
||||
private String uri;
|
||||
private String apiRoutingUri;
|
||||
|
||||
@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")
|
||||
private Long attemptedCount;
|
||||
@@ -41,62 +70,68 @@ public class ObpGwMetricDTO {
|
||||
@SerializedName("completedCount")
|
||||
private Long completedCount;
|
||||
|
||||
// EAPIM ID
|
||||
@SerializedName("apiIdByEapim")
|
||||
private String apiId;
|
||||
|
||||
@SerializedName("appIdByEapim")
|
||||
private String appId;
|
||||
// AS-IS 호환을 위한 필드 (null 값으로 리턴)
|
||||
@SerializedName("clusterHostname")
|
||||
private String clusterHostname = null;
|
||||
|
||||
@SerializedName("orgIdByEapim")
|
||||
private String orgId;
|
||||
@SerializedName("apiDatabaseId")
|
||||
private Integer apiDatabaseId = null;
|
||||
|
||||
// AS-IS 호환용 필드
|
||||
@SerializedName("appId")
|
||||
private String appIdByCaPortal;
|
||||
@SerializedName("unauthorizedCount")
|
||||
private Integer authorizedCount = null;
|
||||
|
||||
@SerializedName("portalOrgId")
|
||||
private String orgIdByCaPortal;
|
||||
@SerializedName("backMinTime")
|
||||
private Integer backMinTime = null;
|
||||
|
||||
@SerializedName("portalApiId")
|
||||
private String apiIdByCaPortal;
|
||||
@SerializedName("backMaxTime")
|
||||
private Integer backMaxTime = null;
|
||||
|
||||
@SerializedName("partnerCode")
|
||||
private String partnerCode;
|
||||
@SerializedName("backSumTime")
|
||||
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 변환
|
||||
*/
|
||||
public static ObpGwMetricDTO from(ObpGwMetric entity) {
|
||||
ObpGwMetricDTO dto = new ObpGwMetricDTO();
|
||||
dto.setClientId(entity.getClientId());
|
||||
dto.setHostname(entity.getHostname());
|
||||
dto.setTimeslice(formatTimeslice(entity.getTimeslice()));
|
||||
dto.setApiId(entity.getApiId());
|
||||
dto.setApiName(entity.getApiName());
|
||||
dto.setUri(entity.getUri());
|
||||
dto.setMethod(entity.getMethod());
|
||||
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());
|
||||
dto.setApiId(entity.getApiId());
|
||||
dto.setAppId(entity.getAppId());
|
||||
dto.setOrgId(entity.getOrgId());
|
||||
dto.setAppIdByCaPortal(entity.getAppIdByCaPortal());
|
||||
dto.setOrgIdByCaPortal(entity.getOrgIdByCaPortal());
|
||||
dto.setApiIdByCaPortal(entity.getApiIdByCaPortal());
|
||||
dto.setPartnerCode(entity.getPartnerCode());
|
||||
dto.setApiIdByCa(entity.getApiIdByCa());
|
||||
|
||||
|
||||
// 260224 - AS-IS 개발자포탈에서 쓰이던 ID 필드 값 삭제(OBP 디비 필드 형식과 맞지 않음)
|
||||
dto.setOrgId(null);
|
||||
dto.setAppId(null);
|
||||
|
||||
return dto;
|
||||
}
|
||||
|
||||
/**
|
||||
* timeslice를 ISO8601 형식 + UTC 시간대로 변환
|
||||
* 예: 2025-12-02T01:00:00+0000
|
||||
* 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_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.ObpGwMetricService;
|
||||
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.LoggerFactory;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
@@ -311,30 +312,32 @@ public class ObpGwMetricManService extends BaseService {
|
||||
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용)
|
||||
* 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(
|
||||
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()
|
||||
.map(ObpGwMetricAfterDTO::from)
|
||||
.map(ObpGwMetricDTO::from)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
+52
-38
@@ -404,7 +404,7 @@ public class LayoutSyncController extends OnlBaseAnnotationController implements
|
||||
String resultS = null;
|
||||
ServletInputStream sis = null;
|
||||
|
||||
HashMap<String, String> param = new HashMap<String, String>();
|
||||
HashMap<String, String> param = new HashMap<>();
|
||||
String recvTime = DateUtil.getDateTime("yyyyMMddHHmmssSS").substring(0, 16);
|
||||
|
||||
// 초기화
|
||||
@@ -431,26 +431,33 @@ public class LayoutSyncController extends OnlBaseAnnotationController implements
|
||||
byte[] arg = new byte[request.getContentLength()];
|
||||
int resultSet = 0;
|
||||
int total = 0;
|
||||
try {
|
||||
resultSet = sis.readLine(arg, 0, arg.length);
|
||||
while(resultSet != -1) {
|
||||
total += resultSet;
|
||||
resultSet = sis.readLine(arg, total, 1024);
|
||||
}
|
||||
|
||||
String xmlContent = null;
|
||||
try {
|
||||
resultSet = sis.readLine(arg, 0, arg.length);
|
||||
while (resultSet != -1) {
|
||||
total += resultSet;
|
||||
resultSet = sis.readLine(arg, total, 1024);
|
||||
}
|
||||
|
||||
param.put("recvData", new String(arg, "UTF-8"));
|
||||
} catch(Exception e) {
|
||||
logger.error("MessageSync.err - don't read the XML File - " + new String(arg), e);
|
||||
param.put("recvData", "");
|
||||
}
|
||||
xmlContent = new String(arg, "EUC-KR");
|
||||
// ===== 인코딩 확인 로그 시작 =====
|
||||
logger.info("========== 인코딩 디버깅 정보 ==========");
|
||||
// 다양한 인코딩으로 읽어보기
|
||||
logger.info("request.getCharacterEncoding(): {}", request.getCharacterEncoding());
|
||||
logger.info("request.getContentType(): {}", request.getContentType());
|
||||
logger.info("Content Length: {} bytes", arg.length);
|
||||
logger.info("EUC-KR 전체 내용:\n{}", xmlContent);
|
||||
logger.info("========================================");
|
||||
// ===== 인코딩 확인 로그 끝 =====
|
||||
param.put("recvData", xmlContent);
|
||||
} catch (Exception e) {
|
||||
logger.error("MessageSync.err - don't read the XML File", e);
|
||||
param.put("recvData", "");
|
||||
}
|
||||
|
||||
// byte[]로부터 XML 파싱 (BOM 제거)
|
||||
String xmlContent = new String(arg, "UTF-8").trim();
|
||||
// BOM 제거 (UTF-8 BOM: EF BB BF)
|
||||
if (xmlContent.startsWith("\uFEFF")) {
|
||||
xmlContent = xmlContent.substring(1);
|
||||
}
|
||||
Document doc = builder.build(new ByteArrayInputStream(xmlContent.getBytes("UTF-8")));
|
||||
// byte[]로부터 XML 파싱 - EUC-KR로 읽기
|
||||
Document doc = builder.build(new StringReader(xmlContent));
|
||||
|
||||
param.put("logPrcssSeqno", UUIDGenerator.getUUID());
|
||||
// xml 1.1
|
||||
@@ -468,9 +475,9 @@ public class LayoutSyncController extends OnlBaseAnnotationController implements
|
||||
param.put("recvAmndHMS", recvTime);
|
||||
|
||||
logger.info(layoutName + " command - [" + command +"]");
|
||||
HashMap<String, Object> returnMap = new HashMap<String,Object>();
|
||||
HashMap<String, Object> returnMap = new HashMap<>();
|
||||
if( command.equals("delete") ) {
|
||||
HashMap<String,Object> vo = new HashMap<String,Object>();
|
||||
HashMap<String,Object> vo = new HashMap<>();
|
||||
vo.put("loutName",layoutName);
|
||||
|
||||
service.deleteLayout(vo);
|
||||
@@ -496,10 +503,10 @@ public class LayoutSyncController extends OnlBaseAnnotationController implements
|
||||
// }
|
||||
|
||||
String layout = body.getChild("data").getText();
|
||||
logger.info(layoutName + " recv Data - [" + layout + "]");
|
||||
logger.info("{} recv Data - [{}]]", layoutName, layout);
|
||||
param.put("recvData", layout);
|
||||
|
||||
Document doc2 = builder.build(new ByteArrayInputStream(layout.getBytes()));
|
||||
Document doc2 = builder.build(new StringReader(layout));
|
||||
|
||||
HashMap<String,Object> vo = new HashMap<String,Object>();
|
||||
|
||||
@@ -512,7 +519,7 @@ public class LayoutSyncController extends OnlBaseAnnotationController implements
|
||||
if (!"EAI".equalsIgnoreCase(useSystem) && !"FEP".equalsIgnoreCase(useSystem)) {
|
||||
String errorMessage = "사용 시스템(" + useSystem + ")인 전문레이아웃은 EAI, FEP로 배포 안됨.";
|
||||
logger.error(errorMessage);
|
||||
throw new Exception(errorMessage);
|
||||
throw new UseSystemException(errorMessage);
|
||||
}
|
||||
|
||||
if( "ASCII".equals(format.getAttributeValue("msgType")) ) {
|
||||
@@ -584,12 +591,17 @@ public class LayoutSyncController extends OnlBaseAnnotationController implements
|
||||
|
||||
} catch( Exception e ) {
|
||||
logger.error("",e);
|
||||
logger.error("",e.getStackTrace()[0]);
|
||||
try {
|
||||
if( results != null ) {
|
||||
results.getChild("Result").setText("False");
|
||||
if (e instanceof UseSystemException) {
|
||||
results.getChild("Result").setText("True");
|
||||
} else {
|
||||
results.getChild("Result").setText("False");
|
||||
}
|
||||
results.getChild("ResultMessage").setText( e.getMessage() );
|
||||
|
||||
|
||||
|
||||
resultS = StringUtils.toXMLString(rDoc, true);
|
||||
}
|
||||
if( param.get("logPrcssSeqno") == null ) {
|
||||
@@ -607,10 +619,11 @@ public class LayoutSyncController extends OnlBaseAnnotationController implements
|
||||
|
||||
ServletOutputStream sos = null;
|
||||
try {
|
||||
response.setContentType("application/xml; charset=EUC-KR");
|
||||
sos = response.getOutputStream();
|
||||
sos.write(resultS.getBytes());
|
||||
sos.write(resultS.getBytes("EUC-KR"));
|
||||
} catch( Exception e ) {
|
||||
e.printStackTrace();
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if( sis != null ) sis.close();
|
||||
if( sos != null ) sos.close();
|
||||
@@ -644,16 +657,16 @@ public class LayoutSyncController extends OnlBaseAnnotationController implements
|
||||
|
||||
// 초기화
|
||||
DataSourceContextHolder.setDataSourceType(DataSourceTypeManager.getDataSourceType(schema));
|
||||
try {
|
||||
try {
|
||||
// // 요청 전문
|
||||
sis = request.getInputStream();
|
||||
|
||||
JSONObject json = (JSONObject) JSONValue.parse(new InputStreamReader(sis));
|
||||
sis = request.getInputStream();
|
||||
|
||||
JSONObject json = (JSONObject) JSONValue.parse(new InputStreamReader(sis, "EUC-KR"));
|
||||
|
||||
// JJB 향후제거 shkim 2020-05-13 연계 테스트 체크
|
||||
logger.error("\n\n MMI SYNC Request : " + json.toString());
|
||||
|
||||
// log 기록
|
||||
// log 기록
|
||||
byte[] arg = new byte[request.getContentLength()];
|
||||
int resultSet =0;
|
||||
int total = 0;
|
||||
@@ -663,10 +676,10 @@ public class LayoutSyncController extends OnlBaseAnnotationController implements
|
||||
total += resultSet;
|
||||
resultSet = sis.readLine(arg, total, 1024);
|
||||
}
|
||||
|
||||
param.put("recvData", new String(arg));
|
||||
|
||||
param.put("recvData", new String(arg, "EUC-KR"));
|
||||
} catch(Exception e) {
|
||||
logger.error("MessageSync.err - don't read the JSON File - " + new String(arg), e);
|
||||
logger.error("MessageSync.err - don't read the JSON File - " + new String(arg, "EUC-KR"), e);
|
||||
param.put("recvData", "");
|
||||
}
|
||||
|
||||
@@ -707,10 +720,11 @@ public class LayoutSyncController extends OnlBaseAnnotationController implements
|
||||
|
||||
ServletOutputStream sos = null;
|
||||
try {
|
||||
response.setContentType("application/json; charset=EUC-KR");
|
||||
sos = response.getOutputStream();
|
||||
sos.write(resultS.toString().getBytes());
|
||||
sos.write(resultS.toString().getBytes("EUC-KR"));
|
||||
} catch( Exception e ) {
|
||||
e.printStackTrace();
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if( sis != null ) sis.close();
|
||||
if( sos != null ) sos.close();
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.eactive.eai.rms.onl.manage.rule.layoutsync;
|
||||
|
||||
import com.eactive.eai.rms.onl.common.exception.EMSRuntimeException;
|
||||
|
||||
public class UseSystemException extends EMSRuntimeException {
|
||||
|
||||
public UseSystemException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,9 +10,11 @@ import java.util.List;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.quartz.SchedulerException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -39,7 +41,6 @@ public class DailyToMonthlyAggregationJob implements Job {
|
||||
|
||||
private ApiStatsDayService apiStatsDayService;
|
||||
private ApiStatsMonthService apiStatsMonthService;
|
||||
private DailyToMonthlyAggregationJob self;
|
||||
|
||||
@Autowired
|
||||
public void setApiStatsDayService(ApiStatsDayService apiStatsDayService) {
|
||||
@@ -51,18 +52,24 @@ public class DailyToMonthlyAggregationJob implements Job {
|
||||
this.apiStatsMonthService = apiStatsMonthService;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setSelf(DailyToMonthlyAggregationJob self) {
|
||||
this.self = self;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
|
||||
ApplicationContext appContext = null;
|
||||
final DailyToMonthlyAggregationJob selfJob;
|
||||
try {
|
||||
appContext = (ApplicationContext) context.getScheduler().getContext().get("applicationContext");
|
||||
selfJob = appContext.getBean(DailyToMonthlyAggregationJob.class);
|
||||
} catch (SchedulerException e) {
|
||||
log.error("applicationContext get module error",e);
|
||||
return ;
|
||||
}
|
||||
|
||||
DataSourceType dataType = DataSourceTypeManager.getDataSourceType(DataSourceTypeManager.APIGW);
|
||||
DataSourceContextHolder.setDataSourceType(dataType);
|
||||
try {
|
||||
YearMonth targetMonth = YearMonth.now().minusMonths(1);
|
||||
self.executeManual(targetMonth);
|
||||
selfJob.executeManual(targetMonth);
|
||||
} catch (Exception e) {
|
||||
throw new JobExecutionException(e);
|
||||
} finally {
|
||||
|
||||
@@ -9,9 +9,11 @@ import java.util.List;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.quartz.SchedulerException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -38,7 +40,6 @@ public class HourlyToDailyAggregationJob implements Job {
|
||||
|
||||
private ApiStatsHourService apiStatsHourService;
|
||||
private ApiStatsDayService apiStatsDayService;
|
||||
private HourlyToDailyAggregationJob self;
|
||||
|
||||
@Autowired
|
||||
public void setApiStatsHourService(ApiStatsHourService apiStatsHourService) {
|
||||
@@ -50,18 +51,23 @@ public class HourlyToDailyAggregationJob implements Job {
|
||||
this.apiStatsDayService = apiStatsDayService;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setSelf(HourlyToDailyAggregationJob self) {
|
||||
this.self = self;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
ApplicationContext appContext = null;
|
||||
final HourlyToDailyAggregationJob selfJob;
|
||||
try {
|
||||
appContext = (ApplicationContext) context.getScheduler().getContext().get("applicationContext");
|
||||
selfJob = appContext.getBean(HourlyToDailyAggregationJob.class);
|
||||
} catch (SchedulerException e) {
|
||||
log.error("applicationContext get module error",e);
|
||||
return ;
|
||||
}
|
||||
|
||||
DataSourceType dataType = DataSourceTypeManager.getDataSourceType(DataSourceTypeManager.APIGW);
|
||||
DataSourceContextHolder.setDataSourceType(dataType);
|
||||
try {
|
||||
LocalDate targetDate = LocalDate.now().minusDays(1);
|
||||
self.executeManual(targetDate);
|
||||
selfJob.executeManual(targetDate);
|
||||
} catch (Exception e) {
|
||||
throw new JobExecutionException(e);
|
||||
} finally {
|
||||
|
||||
+14
-7
@@ -8,9 +8,11 @@ import java.util.List;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.quartz.SchedulerException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -37,7 +39,6 @@ public class MonthlyToYearlyAggregationJob implements Job {
|
||||
|
||||
private ApiStatsMonthService apiStatsMonthService;
|
||||
private ApiStatsYearService apiStatsYearService;
|
||||
private MonthlyToYearlyAggregationJob self;
|
||||
|
||||
@Autowired
|
||||
public void setApiStatsMonthService(ApiStatsMonthService apiStatsMonthService) {
|
||||
@@ -49,18 +50,24 @@ public class MonthlyToYearlyAggregationJob implements Job {
|
||||
this.apiStatsYearService = apiStatsYearService;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setSelf(MonthlyToYearlyAggregationJob self) {
|
||||
this.self = self;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
|
||||
ApplicationContext appContext = null;
|
||||
final MonthlyToYearlyAggregationJob selfJob;
|
||||
try {
|
||||
appContext = (ApplicationContext) context.getScheduler().getContext().get("applicationContext");
|
||||
selfJob = appContext.getBean(MonthlyToYearlyAggregationJob.class);
|
||||
} catch (SchedulerException e) {
|
||||
log.error("applicationContext get module error",e);
|
||||
return ;
|
||||
}
|
||||
|
||||
DataSourceType dataType = DataSourceTypeManager.getDataSourceType(DataSourceTypeManager.APIGW);
|
||||
DataSourceContextHolder.setDataSourceType(dataType);
|
||||
try {
|
||||
Year targetYear = Year.now().minusYears(1);
|
||||
self.executeManual(targetYear);
|
||||
selfJob.executeManual(targetYear);
|
||||
} catch (Exception e) {
|
||||
throw new JobExecutionException(e);
|
||||
} finally {
|
||||
|
||||
+4
-2
@@ -9,6 +9,8 @@ import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
/**
|
||||
@@ -37,9 +39,9 @@ class LayoutSyncControllerTest {
|
||||
|
||||
String url = BASE_URL + "?cmd=Message&schema=APIGW";
|
||||
|
||||
// HTTP 헤더 설정
|
||||
// HTTP 헤더 설정 (EUC-KR)
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_XML);
|
||||
headers.setContentType(new MediaType("application", "xml", Charset.forName("EUC-KR")));
|
||||
|
||||
// 요청 생성
|
||||
HttpEntity<String> request = new HttpEntity<>(requestXml, headers);
|
||||
|
||||
Reference in New Issue
Block a user