OpenAPI Spec·포탈 노출 필터 추가 - EAIMessage 검색 조건 추가 - API Group 팝업 검색 개선 - JSP 체크박스 연동 처리
eapim-admin CI / build (push) Has been cancelled
eapim-admin CI / build (push) Has been cancelled
This commit is contained in:
@@ -13,7 +13,10 @@ import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.apim.portal.apispec.repository.ApiSpecInfoRepository;
|
||||
import com.eactive.eai.data.entity.onl.adapter.QAdapter;
|
||||
import com.eactive.eai.data.entity.onl.apim.apigroup.QApiGroup;
|
||||
import com.eactive.eai.data.entity.onl.apim.apigroup.QApiGroupApi;
|
||||
import com.eactive.eai.data.entity.onl.authserver.QScopeEntity;
|
||||
import com.eactive.eai.data.entity.onl.logger.QStatLog;
|
||||
import com.eactive.eai.data.entity.onl.message.EAIMessageEntity;
|
||||
@@ -31,6 +34,9 @@ import com.querydsl.core.types.OrderSpecifier;
|
||||
import com.querydsl.core.types.Projections;
|
||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
import com.querydsl.core.types.dsl.Expressions;
|
||||
import com.querydsl.core.types.dsl.StringPath;
|
||||
import com.querydsl.jpa.JPAExpressions;
|
||||
import com.querydsl.jpa.JPQLQuery;
|
||||
import com.querydsl.jpa.impl.JPAQuery;
|
||||
|
||||
@Service
|
||||
@@ -38,8 +44,14 @@ import com.querydsl.jpa.impl.JPAQuery;
|
||||
@RequiredArgsConstructor
|
||||
public class EAIMessageService extends AbstractDataService<EAIMessageEntity, String, EAIMessageRepository> {
|
||||
|
||||
/** Oracle IN 절 표현식 개수 상한. 넘기면 ORA-01795 라 나눠 OR 로 잇는다 */
|
||||
private static final int ORACLE_IN_LIMIT = 1000;
|
||||
|
||||
private final UserBusinessService userBusinessService;
|
||||
|
||||
/** EMSAPP(PTL_API_SPEC_INFO) 조회용. 다른 스키마라 EAI 메시지 쿼리에 조인할 수 없다 */
|
||||
private final ApiSpecInfoRepository apiSpecInfoRepository;
|
||||
|
||||
public Page<Tuple> selectList(EAIMessageUISearch eaiMessageUISearch, Pageable pageable, String sortname, String sortorder) {
|
||||
|
||||
QEAIMessageEntity qeaiMessageEntity = QEAIMessageEntity.eAIMessageEntity;
|
||||
@@ -196,10 +208,52 @@ public class EAIMessageService extends AbstractDataService<EAIMessageEntity, Str
|
||||
predicate
|
||||
.and(qStdInfo.apifullpath.contains(eaiMessageUISearch.getSearchApiFullPath()));
|
||||
}
|
||||
|
||||
|
||||
if ("Y".equals(eaiMessageUISearch.getSearchApiSpecYn())) {
|
||||
predicate.and(apiSpecRegisteredExpression(qeaiMessageEntity.eaisvcname));
|
||||
}
|
||||
|
||||
if ("Y".equals(eaiMessageUISearch.getSearchPortalDisplayYn())) {
|
||||
predicate.and(qeaiMessageEntity.eaisvcname.in(displayedGroupApiIdSubQuery()));
|
||||
}
|
||||
|
||||
return predicate;
|
||||
}
|
||||
|
||||
/**
|
||||
* OpenAPI Spec 등록 여부 조건.
|
||||
*
|
||||
* <p>PTL_API_SPEC_INFO 는 EMSAPP 스키마라 TSEAIHE01 쿼리에 조인하면 ORA-00942 다. 스펙이 있는
|
||||
* API ID 를 EMS 커넥션에서 따로 읽어 IN 절로 넘긴다.</p>
|
||||
*/
|
||||
private BooleanExpression apiSpecRegisteredExpression(StringPath eaiSvcNamePath) {
|
||||
List<String> specApiIds = apiSpecInfoRepository.findAllApiIds();
|
||||
if (specApiIds.isEmpty()) {
|
||||
// in(빈 리스트) 는 JPQL 이 깨지므로 항상 거짓인 조건으로 대체한다
|
||||
return Expressions.ONE.eq(Expressions.TWO);
|
||||
}
|
||||
|
||||
BooleanExpression expression = null;
|
||||
for (int from = 0; from < specApiIds.size(); from += ORACLE_IN_LIMIT) {
|
||||
int to = Math.min(from + ORACLE_IN_LIMIT, specApiIds.size());
|
||||
BooleanExpression chunk = eaiSvcNamePath.in(specApiIds.subList(from, to));
|
||||
expression = (expression == null) ? chunk : expression.or(chunk);
|
||||
}
|
||||
return expression;
|
||||
}
|
||||
|
||||
/** 노출 중인(display_yn='1') API 그룹에 편성된 API ID. API_GROUP 은 EAI 메시지와 같은 스키마다 */
|
||||
private JPQLQuery<String> displayedGroupApiIdSubQuery() {
|
||||
QApiGroupApi qApiGroupApi = QApiGroupApi.apiGroupApi;
|
||||
QApiGroup qApiGroup = QApiGroup.apiGroup;
|
||||
|
||||
return JPAExpressions
|
||||
.select(qApiGroupApi.id.apiId)
|
||||
.from(qApiGroupApi)
|
||||
.join(qApiGroupApi.apiGroup, qApiGroup)
|
||||
.where(qApiGroup.displayYn.eq("1"));
|
||||
}
|
||||
|
||||
public Page<RoutingEaiMsgDto> findAll(Pageable pageable, RoutingEaiMsgSearch routingEaiMsgSearch) {
|
||||
|
||||
List<RoutingEaiMsgDto> result = routingEaiMsgDtoList(pageable, routingEaiMsgSearch);
|
||||
|
||||
@@ -22,4 +22,10 @@ public class EAIMessageUISearch {
|
||||
|
||||
private String searchApiFullPath;
|
||||
|
||||
/** "Y" 면 PTL_API_SPEC_INFO 에 OpenAPI Spec 이 등록된 API 만 조회 */
|
||||
private String searchApiSpecYn;
|
||||
|
||||
/** "Y" 면 노출 중인(display_yn='1') API 그룹에 편성된 API 만 조회 */
|
||||
private String searchPortalDisplayYn;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user