AppRequest JPA Entity not found 에러 수정
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.apim.obp;
|
||||
|
||||
import com.eactive.apim.portal.apprequest.entity.AppRequest;
|
||||
import com.eactive.apim.portal.apprequest.entity.QAppRequest;
|
||||
import com.eactive.eai.data.entity.onl.message.EAIMessageEntity;
|
||||
import com.eactive.eai.data.entity.onl.message.QEAIMessageEntity;
|
||||
import com.eactive.eai.data.entity.onl.unifbwk.QUnifBwkTp;
|
||||
@@ -222,34 +220,4 @@ public class ObpGwMetricJpaDAO {
|
||||
|
||||
return new UriMethodResult(uriMap, methodMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* AppId 조회 (PTL_APP_REQUEST) - org_id로 조회
|
||||
*
|
||||
* @param orgIds 기관 ID 목록
|
||||
* @return 기관 ID → 앱 ID 맵
|
||||
*/
|
||||
public Map<String, String> selectAppIdsByOrgIds(Set<String> orgIds) {
|
||||
if (orgIds == null || orgIds.isEmpty()) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
QAppRequest appRequest = QAppRequest.appRequest;
|
||||
|
||||
List<Tuple> results = getQueryFactory()
|
||||
.select(appRequest.org.id, appRequest.id)
|
||||
.from(appRequest)
|
||||
.where(appRequest.org.id.in(orgIds))
|
||||
.fetch();
|
||||
|
||||
Map<String, String> result = new HashMap<>();
|
||||
for (Tuple tuple : results) {
|
||||
String orgId = tuple.get(appRequest.org.id);
|
||||
String appId = tuple.get(appRequest.id);
|
||||
if (orgId != null && appId != null) {
|
||||
result.put(orgId, appId);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.eactive.eai.rms.onl.apim.obp;
|
||||
|
||||
import com.eactive.apim.portal.apprequest.entity.AppRequest;
|
||||
import com.eactive.apim.portal.apprequest.repository.AppRequestRepository;
|
||||
import com.eactive.apim.portal.obp.entity.ObpGwMetric;
|
||||
import com.eactive.eai.rms.common.base.BaseService;
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceContextHolder;
|
||||
@@ -44,10 +46,14 @@ public class ObpGwMetricManService extends BaseService {
|
||||
|
||||
private final ObpGwMetricJpaDAO obpGwMetricJpaDAO;
|
||||
private final ObpGwMetricService obpGwMetricService;
|
||||
private final AppRequestRepository appRequestRepository;
|
||||
|
||||
public ObpGwMetricManService(ObpGwMetricJpaDAO obpGwMetricJpaDAO, ObpGwMetricService obpGwMetricService) {
|
||||
public ObpGwMetricManService(ObpGwMetricJpaDAO obpGwMetricJpaDAO,
|
||||
ObpGwMetricService obpGwMetricService,
|
||||
AppRequestRepository appRequestRepository) {
|
||||
this.obpGwMetricJpaDAO = obpGwMetricJpaDAO;
|
||||
this.obpGwMetricService = obpGwMetricService;
|
||||
this.appRequestRepository = appRequestRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -174,7 +180,8 @@ public class ObpGwMetricManService extends BaseService {
|
||||
.map(ObpGwMetricVO::getOrgId)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
Map<String, String> appIdMap = obpGwMetricJpaDAO.selectAppIdsByOrgIds(orgIds);
|
||||
// AppRequestRepository(@EMSDataSource)를 사용하여 MONITORING 스키마에서 조회
|
||||
Map<String, String> appIdMap = selectAppIdsByOrgIds(orgIds);
|
||||
|
||||
int insertCount = 0;
|
||||
int updateCount = 0;
|
||||
@@ -290,4 +297,30 @@ public class ObpGwMetricManService extends BaseService {
|
||||
.map(ObpGwMetricAfterDTO::from)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* org.id 목록으로 AppRequest를 조회하여 orgId -> appId 맵 반환
|
||||
*
|
||||
* <p>AppRequestRepository(@EMSDataSource)를 사용하여 MONITORING 스키마에서 조회</p>
|
||||
*
|
||||
* @param orgIds 기관 ID 목록
|
||||
* @return orgId -> appId 맵
|
||||
*/
|
||||
private Map<String, String> selectAppIdsByOrgIds(Set<String> orgIds) {
|
||||
if (orgIds == null || orgIds.isEmpty()) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
List<AppRequest> appRequests = appRequestRepository.findByOrg_IdIn(orgIds);
|
||||
|
||||
Map<String, String> result = new HashMap<>();
|
||||
for (AppRequest appRequest : appRequests) {
|
||||
String orgId = appRequest.getOrg() != null ? appRequest.getOrg().getId() : null;
|
||||
String appId = appRequest.getId();
|
||||
if (orgId != null && appId != null) {
|
||||
result.put(orgId, appId);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user