Merge branch 'jenkins_with_weblogic' of ssh://192.168.240.178:18081/eapim/eapim-admin into jenkins_with_weblogic
This commit is contained in:
+6
-5
@@ -41,12 +41,13 @@ public class MonitoringPropertyService
|
||||
id.setPrptyName(prptyName);
|
||||
|
||||
Optional<MonitoringProperty> property = repository.findById(id);
|
||||
if (property.isPresent() && !property.get().getPrpty2Val().isEmpty()) {
|
||||
return property.get().getPrpty2Val();
|
||||
} else {
|
||||
return defaultValue;
|
||||
if (property.isPresent()) {
|
||||
String value = property.get().getPrpty2Val();
|
||||
if (value != null && !value.isEmpty()) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public Iterable<MonitoringProperty> findAllByIdPrptyName(String prptyName) {
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.apim.obp;
|
||||
|
||||
import com.eactive.eai.rms.common.base.SqlMapClientTemplateDao;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* ObpGwMetric DAO - iBATIS를 사용한 로그 테이블 집계
|
||||
*/
|
||||
@Repository
|
||||
public class ObpGwMetricDAO extends SqlMapClientTemplateDao {
|
||||
|
||||
/**
|
||||
* EAIBZWKDSTCD 코드 목록 조회
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<String> selectAllBzwkCodes(String schemaId) {
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("schemaId", schemaId);
|
||||
return this.template.queryForList("ObpGwMetric.selectAllBzwkCodes", paramMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* EAIBZWKDSTCD별 시간대 로그 집계
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<ObpGwMetricVO> selectHourlyMetricsByBzwkCode(HashMap<String, Object> paramMap) {
|
||||
return this.template.queryForList("ObpGwMetric.selectHourlyMetricsByBzwkCode", paramMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* API 이름 조회 (TSEAIHE01)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Map<String, String> selectApiNames(String schemaId, Set<String> apiIds) {
|
||||
if (apiIds == null || apiIds.isEmpty()) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("schemaId", schemaId);
|
||||
paramMap.put("apiIds", new ArrayList<>(apiIds)); // Set → List 변환 (iBATIS iterate 호환)
|
||||
|
||||
List<Map<String, String>> resultList = this.template.queryForList("ObpGwMetric.selectApiNames", paramMap);
|
||||
|
||||
Map<String, String> result = new HashMap<>();
|
||||
for (Map<String, String> m : resultList) {
|
||||
String apiId = m.get("API_ID");
|
||||
String apiName = m.get("API_NAME");
|
||||
if (apiId != null && apiName != null) {
|
||||
result.put(apiId, apiName);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* URI 조회 (TSEAIHS04)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Map<String, String> selectUris(String schemaId, Set<String> apiIds) {
|
||||
if (apiIds == null || apiIds.isEmpty()) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("schemaId", schemaId);
|
||||
paramMap.put("apiIds", new ArrayList<>(apiIds)); // 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 uri = m.get("URI");
|
||||
if (apiId != null && uri != null) {
|
||||
result.put(apiId, uri);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* AppId 조회 (ptl_app_request) - org_id로 조회
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Map<String, String> selectAppIdsByOrgIds(Set<String> orgIds) {
|
||||
if (orgIds == null || orgIds.isEmpty()) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("orgIds", new ArrayList<>(orgIds)); // Set → List 변환 (iBATIS iterate 호환)
|
||||
|
||||
List<Map<String, String>> resultList = this.template.queryForList("ObpGwMetric.selectAppIdsByOrgIds", paramMap);
|
||||
|
||||
Map<String, String> result = new HashMap<>();
|
||||
for (Map<String, String> m : resultList) {
|
||||
String orgId = m.get("ORG_ID");
|
||||
String appId = m.get("APP_ID");
|
||||
if (orgId != null && appId != null) {
|
||||
result.put(orgId, appId);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.apim.obp;
|
||||
|
||||
import com.eactive.apim.portal.obp.entity.ObpGwMetric;
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
import com.eactive.eai.rms.data.EMSDataSource;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* ObpGwMetric Repository (eapim-admin 위치)
|
||||
* API Gateway 시간별 거래량 지표 조회/저장을 위한 Spring Data JPA Repository
|
||||
*/
|
||||
@EMSDataSource
|
||||
public interface ObpGwMetricRepository extends BaseRepository<ObpGwMetric, String> {
|
||||
|
||||
/**
|
||||
* UPSERT 판단을 위한 기존 데이터 조회
|
||||
* 동일한 timeslice + apiId + clientId + hostname + orgId 조합이 존재하는지 확인
|
||||
*/
|
||||
Optional<ObpGwMetric> findByTimesliceAndApiIdAndClientIdAndHostnameAndOrgId(
|
||||
LocalDateTime timeslice,
|
||||
String apiId,
|
||||
String clientId,
|
||||
String hostname,
|
||||
String orgId
|
||||
);
|
||||
|
||||
/**
|
||||
* 특정 시간대의 모든 GwMetric 데이터 조회
|
||||
*/
|
||||
List<ObpGwMetric> findByTimeslice(LocalDateTime timeslice);
|
||||
|
||||
/**
|
||||
* 특정 시간 범위의 GwMetric 데이터 조회
|
||||
*/
|
||||
List<ObpGwMetric> findByTimesliceBetween(LocalDateTime startTime, LocalDateTime endTime);
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.apim.obp;
|
||||
|
||||
import com.eactive.apim.portal.obp.entity.ObpGwMetric;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* ObpGwMetric Service - 엔티티 CRUD 서비스
|
||||
*/
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
public class ObpGwMetricService {
|
||||
|
||||
private final ObpGwMetricRepository repository;
|
||||
|
||||
public ObpGwMetricService(ObpGwMetricRepository repository) {
|
||||
this.repository = repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* UPSERT 판단을 위한 기존 데이터 조회
|
||||
*/
|
||||
public Optional<ObpGwMetric> findByUniqueKey(LocalDateTime timeslice, String apiId, String clientId, String hostname, String orgId) {
|
||||
return repository.findByTimesliceAndApiIdAndClientIdAndHostnameAndOrgId(
|
||||
timeslice, apiId, clientId, hostname, orgId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 특정 시간대의 모든 GwMetric 데이터 조회
|
||||
*/
|
||||
public List<ObpGwMetric> findByTimeslice(LocalDateTime timeslice) {
|
||||
return repository.findByTimeslice(timeslice);
|
||||
}
|
||||
|
||||
/**
|
||||
* 특정 시간 범위의 GwMetric 데이터 조회
|
||||
*/
|
||||
public List<ObpGwMetric> findByTimesliceBetween(LocalDateTime startTime, LocalDateTime endTime) {
|
||||
return repository.findByTimesliceBetween(startTime, endTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 엔티티 저장 (INSERT 또는 UPDATE)
|
||||
*/
|
||||
public ObpGwMetric save(ObpGwMetric entity) {
|
||||
return repository.save(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 엔티티 목록 저장
|
||||
*/
|
||||
public List<ObpGwMetric> saveAll(List<ObpGwMetric> entities) {
|
||||
return repository.saveAll(entities);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.apim.obp;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
/**
|
||||
* ObpGwMetric VO - 로그 집계 결과 매핑용
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ObpGwMetricVO {
|
||||
|
||||
private static final DateTimeFormatter TIMESLICE_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMddHH0000000");
|
||||
|
||||
/** API ID (EAISVCNAME) */
|
||||
private String apiId;
|
||||
|
||||
/** 클라이언트 ID (CLIENTID) */
|
||||
private String clientId;
|
||||
|
||||
/** 호스트 이름 (EAISEVRINSTNCNAME) */
|
||||
private String hostname;
|
||||
|
||||
/** 기관 ID (ORGID) */
|
||||
private String orgId;
|
||||
|
||||
/** 타임슬라이스 문자열 (yyyyMMddHH0000000) */
|
||||
private String timeslice;
|
||||
|
||||
/** 시도 횟수 (LOGPRCSSSERNO='100' 건수) */
|
||||
private Long attemptedCount;
|
||||
|
||||
/** 완료 횟수 (LOGPRCSSSERNO='400' AND 성공 조건 건수) */
|
||||
private Long completedCount;
|
||||
|
||||
/**
|
||||
* timeslice 문자열을 LocalDateTime으로 변환
|
||||
*/
|
||||
public LocalDateTime getTimesliceAsLocalDateTime() {
|
||||
if (timeslice == null || timeslice.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
// "yyyyMMddHH0000000" 형식에서 앞 10자리(yyyyMMddHH)만 사용
|
||||
String dateTimeStr = timeslice.substring(0, 10) + "0000";
|
||||
return LocalDateTime.parse(dateTimeStr, DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 집계 키 생성 (apiId + clientId + hostname + orgId)
|
||||
*/
|
||||
public String getAggregationKey() {
|
||||
return String.join("|",
|
||||
nullSafe(apiId),
|
||||
nullSafe(clientId),
|
||||
nullSafe(hostname),
|
||||
nullSafe(orgId)
|
||||
);
|
||||
}
|
||||
|
||||
private String nullSafe(String value) {
|
||||
return value != null ? value : "";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user