OBP GW 집계시 API URI 참조 테이블 변경
This commit is contained in:
@@ -61,26 +61,32 @@ public class ObpGwMetricDAO extends SqlMapClientTemplateDao {
|
||||
}
|
||||
|
||||
/**
|
||||
* URI 조회 (TSEAIHS04)
|
||||
* URI 조회 (HTTP_ADAPTER_EXTRA_LOG)
|
||||
* - GUID = TSEAILG1X.EAISVCSERNO와 매핑
|
||||
* - SERVICE_PROCESS_NUMBER = 100 (인바운드 요청)
|
||||
*
|
||||
* @param schemaId DB 스키마 ID
|
||||
* @param eaiSvcSernos EAI 서비스 일련번호 목록 (GUID)
|
||||
* @return eaiSvcSerno → URI 맵 (예: "POST /api/v1/transfer")
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Map<String, String> selectUris(String schemaId, Set<String> apiIds) {
|
||||
if (apiIds == null || apiIds.isEmpty()) {
|
||||
public Map<String, String> selectUris(String schemaId, Set<String> eaiSvcSernos) {
|
||||
if (eaiSvcSernos == null || eaiSvcSernos.isEmpty()) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("schemaId", schemaId);
|
||||
paramMap.put("apiIds", new ArrayList<>(apiIds)); // Set → List 변환 (iBATIS iterate 호환)
|
||||
paramMap.put("eaiSvcSernos", new ArrayList<>(eaiSvcSernos)); // Set → List 변환 (iBATIS iterate 호환)
|
||||
|
||||
List<Map<String, String>> resultList = this.template.queryForList("ObpGwMetric.selectUris", paramMap);
|
||||
|
||||
Map<String, String> result = new HashMap<>();
|
||||
for (Map<String, String> m : resultList) {
|
||||
String apiId = m.get("API_ID");
|
||||
String eaiSvcSerno = m.get("EAI_SVC_SERNO");
|
||||
String uri = m.get("URI");
|
||||
if (apiId != null && uri != null) {
|
||||
result.put(apiId, uri);
|
||||
if (eaiSvcSerno != null && uri != null) {
|
||||
result.put(eaiSvcSerno, uri);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -38,6 +38,9 @@ public class ObpGwMetricVO {
|
||||
/** 완료 횟수 (LOGPRCSSSERNO='400' AND 성공 조건 건수) */
|
||||
private Long completedCount;
|
||||
|
||||
/** EAI 서비스 일련번호 (URI 조회용 - HTTP_ADAPTER_EXTRA_LOG.GUID와 매핑) */
|
||||
private String eaiSvcSerno;
|
||||
|
||||
/**
|
||||
* timeslice 문자열을 LocalDateTime으로 변환
|
||||
*/
|
||||
|
||||
@@ -158,10 +158,16 @@ public class ObpGwMetricManService extends BaseService {
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
// URI 조회용 EAI 서비스 일련번호 (HTTP_ADAPTER_EXTRA_LOG.GUID와 매핑)
|
||||
Set<String> eaiSvcSernos = aggregatedList.stream()
|
||||
.map(ObpGwMetricVO::getEaiSvcSerno)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
Map<String, String> apiNameMap = obpGwMetricDAO.selectApiNames(apigwDataSourceType.getSchema(), apiIds);
|
||||
Map<String, String> uriMap = obpGwMetricDAO.selectUris(apigwDataSourceType.getSchema(), apiIds);
|
||||
log.info("[3단계] 부가정보 조회 완료: apiCount={}, elapsed={}ms",
|
||||
apiIds.size(), System.currentTimeMillis() - step3Start);
|
||||
Map<String, String> uriMap = obpGwMetricDAO.selectUris(apigwDataSourceType.getSchema(), eaiSvcSernos);
|
||||
log.info("[3단계] 부가정보 조회 완료: apiCount={}, eaiSvcSernoCount={}, elapsed={}ms",
|
||||
apiIds.size(), eaiSvcSernos.size(), System.currentTimeMillis() - step3Start);
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
// 4단계: 지표 DB로 전환 후 appId 조회 및 UPSERT
|
||||
@@ -196,7 +202,7 @@ public class ObpGwMetricManService extends BaseService {
|
||||
entity.setAttemptedCount(vo.getAttemptedCount());
|
||||
entity.setCompletedCount(vo.getCompletedCount());
|
||||
entity.setApiName(apiNameMap.get(vo.getApiId()));
|
||||
entity.setUri(uriMap.get(vo.getApiId()));
|
||||
entity.setUri(uriMap.get(vo.getEaiSvcSerno())); // eaiSvcSerno로 URI 조회
|
||||
entity.setAppId(appIdMap.get(vo.getOrgId()));
|
||||
entity.setUpdateCount(entity.getUpdateCount() + 1); // 보정 횟수 증가
|
||||
entity.setUpdatedAt(LocalDateTime.now());
|
||||
@@ -253,7 +259,7 @@ public class ObpGwMetricManService extends BaseService {
|
||||
entity.setAttemptedCount(vo.getAttemptedCount());
|
||||
entity.setCompletedCount(vo.getCompletedCount());
|
||||
entity.setApiName(apiNameMap.get(vo.getApiId()));
|
||||
entity.setUri(uriMap.get(vo.getApiId()));
|
||||
entity.setUri(uriMap.get(vo.getEaiSvcSerno())); // eaiSvcSerno로 URI 조회
|
||||
entity.setAppId(appIdMap.get(vo.getOrgId()));
|
||||
entity.setUpdateCount(0);
|
||||
entity.setCreatedAt(LocalDateTime.now());
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
<result property="timeslice" column="TIMESLICE"/>
|
||||
<result property="attemptedCount" column="ATTEMPTED_COUNT"/>
|
||||
<result property="completedCount" column="COMPLETED_COUNT"/>
|
||||
<result property="eaiSvcSerno" column="EAI_SVC_SERNO"/>
|
||||
</resultMap>
|
||||
|
||||
<!--
|
||||
@@ -42,7 +43,8 @@
|
||||
SUM(CASE WHEN LOGPRCSSSERNO = '100' THEN 1 ELSE 0 END) AS ATTEMPTED_COUNT,
|
||||
SUM(CASE WHEN LOGPRCSSSERNO = '400'
|
||||
AND (RSPNSERRCDNAME IS NULL OR RSPNSERRCDNAME LIKE 'ESB%')
|
||||
THEN 1 ELSE 0 END) AS COMPLETED_COUNT
|
||||
THEN 1 ELSE 0 END) AS COMPLETED_COUNT,
|
||||
MAX(EAISVCSERNO) AS EAI_SVC_SERNO
|
||||
FROM $schemaId$.$tableName$
|
||||
WHERE EAIBZWKDSTCD = #bzwkCode#
|
||||
AND MSGDPSTYMS BETWEEN #startTime# AND #endTime#
|
||||
@@ -63,15 +65,21 @@
|
||||
</iterate>
|
||||
</statement>
|
||||
|
||||
<!-- URI 조회 (TSEAIHS04) - APIFULLPATH 사용 -->
|
||||
<!--
|
||||
URI 조회 (HTTP_ADAPTER_EXTRA_LOG)
|
||||
- GUID = TSEAILG1X.EAISVCSERNO
|
||||
- SERVICE_PROCESS_NUMBER = 100 (인바운드 요청)
|
||||
- 결과: HTTP_METHOD + ' ' + URL (예: POST /mapi/kjbank/obp/kakaobank/v3/loan/query)
|
||||
-->
|
||||
<statement id="selectUris" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
|
||||
SELECT
|
||||
EAISVCNAME AS API_ID,
|
||||
APIFULLPATH AS URI
|
||||
FROM $schemaId$.TSEAIHS04
|
||||
WHERE EAISVCNAME IN
|
||||
<iterate property="apiIds" open="(" close=")" conjunction=",">
|
||||
#apiIds[]#
|
||||
GUID AS EAI_SVC_SERNO,
|
||||
HTTP_METHOD || ' ' || URL AS URI
|
||||
FROM $schemaId$.HTTP_ADAPTER_EXTRA_LOG
|
||||
WHERE SERVICE_PROCESS_NUMBER = 100
|
||||
AND GUID IN
|
||||
<iterate property="eaiSvcSernos" open="(" close=")" conjunction=",">
|
||||
#eaiSvcSernos[]#
|
||||
</iterate>
|
||||
</statement>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user