Merge remote-tracking branch 'origin/master'
This commit is contained in:
+43
-80
@@ -1,9 +1,6 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.inflow;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
@@ -18,6 +15,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import com.eactive.apim.portal.app.entity.QCredential;
|
||||
import com.eactive.eai.data.entity.onl.adapter.QAdapterGroup;
|
||||
import com.eactive.eai.data.entity.onl.authserver.QClientEntity;
|
||||
import com.eactive.eai.data.entity.onl.inflow.InflowControl;
|
||||
import com.eactive.eai.data.entity.onl.inflow.InflowControlId;
|
||||
import com.eactive.eai.data.entity.onl.inflow.QInflowControl;
|
||||
@@ -29,7 +27,6 @@ import com.eactive.eai.rms.onl.manage.inflow.history.InflowControlHistoryManUISe
|
||||
import com.eactive.eai.rms.onl.manage.inflow.inflow.InflowControlManMapper;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
import com.querydsl.core.Tuple;
|
||||
import com.querydsl.core.types.OrderSpecifier;
|
||||
import com.querydsl.jpa.impl.JPAQuery;
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
|
||||
@@ -186,101 +183,67 @@ public class InflowControlService extends AbstractDataService<InflowControl, Inf
|
||||
}
|
||||
|
||||
public InflowControlServiceDto findByIdForClient(String clientId) {
|
||||
QCredential qCredential = QCredential.credential;
|
||||
JPAQueryFactory jpaQueryFactory = new JPAQueryFactory(entityManager);
|
||||
QInflowControl qInflowControl = QInflowControl.inflowControl;
|
||||
QClientEntity qClientEntity = QClientEntity.clientEntity;
|
||||
|
||||
// EMSADM: Credential 조회
|
||||
Tuple credTuple = new JPAQueryFactory(entityManagerForEMS)
|
||||
.select(qCredential.clientid, qCredential.clientname)
|
||||
.from(qCredential)
|
||||
.where(qCredential.clientid.eq(clientId))
|
||||
Tuple tuple = jpaQueryFactory
|
||||
.select(qInflowControl, qClientEntity.clientid, qClientEntity.clientname)
|
||||
.from(qClientEntity)
|
||||
.leftJoin(qInflowControl)
|
||||
.on(qInflowControl.id.type.eq(CLIENT_TYPE_INFLOW)
|
||||
.and(qInflowControl.id.name.eq(qClientEntity.clientid)))
|
||||
.where(qClientEntity.clientid.eq(clientId))
|
||||
.fetchOne();
|
||||
|
||||
// AGWADM: InflowControl 조회
|
||||
InflowControl inflowControl = new JPAQueryFactory(entityManager)
|
||||
.selectFrom(qInflowControl)
|
||||
.where(qInflowControl.id.type.eq(CLIENT_TYPE_INFLOW)
|
||||
.and(qInflowControl.id.name.eq(clientId)))
|
||||
.fetchOne();
|
||||
|
||||
InflowControlServiceDto dto;
|
||||
if (inflowControl != null) {
|
||||
dto = mapper.toDto(inflowControl);
|
||||
} else {
|
||||
dto = new InflowControlServiceDto();
|
||||
dto.setName(clientId);
|
||||
dto.setType(CLIENT_TYPE_INFLOW);
|
||||
}
|
||||
if (credTuple != null) {
|
||||
dto.setDesc(credTuple.get(qCredential.clientname));
|
||||
}
|
||||
return dto;
|
||||
return toDto(qClientEntity, qInflowControl, tuple);
|
||||
}
|
||||
|
||||
public Page<InflowControlServiceDto> findAllForClient(Pageable pageable, String searchName) {
|
||||
QCredential qCredential = QCredential.credential;
|
||||
|
||||
JPAQueryFactory jpaQueryFactory = new JPAQueryFactory(entityManager);
|
||||
QInflowControl qInflowControl = QInflowControl.inflowControl;
|
||||
QClientEntity qClientEntity = QClientEntity.clientEntity;
|
||||
|
||||
// EMSADM: Credential 목록 및 건수 조회
|
||||
JPAQueryFactory emsFactory = new JPAQueryFactory(entityManagerForEMS);
|
||||
BooleanBuilder credPredicate = new BooleanBuilder();
|
||||
if (!StringUtils.isEmpty(searchName)) {
|
||||
credPredicate.and(qCredential.clientname.contains(searchName));
|
||||
}
|
||||
|
||||
long totalCount = emsFactory
|
||||
.select(qCredential.clientid.count())
|
||||
.from(qCredential)
|
||||
.where(credPredicate)
|
||||
.fetchOne();
|
||||
|
||||
List<Tuple> credList = emsFactory
|
||||
.select(qCredential.clientid, qCredential.clientname)
|
||||
.from(qCredential)
|
||||
.where(credPredicate)
|
||||
.orderBy(qCredential.clientname.asc())
|
||||
List<Tuple> tupleList = jpaQueryFactory
|
||||
.select(qInflowControl, qClientEntity.clientid, qClientEntity.clientname)
|
||||
.from(qClientEntity)
|
||||
.leftJoin(qInflowControl)
|
||||
.on(qInflowControl.id.type.eq(CLIENT_TYPE_INFLOW)
|
||||
.and(qInflowControl.id.name.eq(qClientEntity.clientid)))
|
||||
.where(qClientEntity.clientname.contains(searchName))
|
||||
.orderBy(qClientEntity.clientname.asc())
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.fetch();
|
||||
|
||||
if (credList.isEmpty()) {
|
||||
return new PageImpl<>(Collections.emptyList(), pageable, totalCount);
|
||||
}
|
||||
|
||||
// AGWADM: 해당 clientId의 InflowControl 일괄 조회
|
||||
List<String> clientIds = credList.stream()
|
||||
.map(t -> t.get(qCredential.clientid))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
Map<String, InflowControl> inflowMap = new JPAQueryFactory(entityManager)
|
||||
.selectFrom(qInflowControl)
|
||||
.where(qInflowControl.id.type.eq(CLIENT_TYPE_INFLOW)
|
||||
.and(qInflowControl.id.name.in(clientIds)))
|
||||
.fetch()
|
||||
List<InflowControlServiceDto> dtoList = tupleList
|
||||
.stream()
|
||||
.collect(Collectors.toMap(ic -> ic.getId().getName(), ic -> ic));
|
||||
|
||||
// Java에서 병합
|
||||
List<InflowControlServiceDto> dtoList = credList.stream()
|
||||
.map(tuple -> {
|
||||
String clientId = tuple.get(qCredential.clientid);
|
||||
InflowControl inflowControl = inflowMap.get(clientId);
|
||||
InflowControlServiceDto dto;
|
||||
if (inflowControl != null) {
|
||||
dto = mapper.toDto(inflowControl);
|
||||
} else {
|
||||
dto = new InflowControlServiceDto();
|
||||
dto.setName(clientId);
|
||||
dto.setType(CLIENT_TYPE_INFLOW);
|
||||
}
|
||||
dto.setDesc(tuple.get(qCredential.clientname));
|
||||
return dto;
|
||||
})
|
||||
.map(tuple -> toDto(qClientEntity, qInflowControl, tuple))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
long totalCount = jpaQueryFactory
|
||||
.select(qClientEntity.clientname.count())
|
||||
.from(qClientEntity)
|
||||
.where(qClientEntity.clientname.contains(searchName))
|
||||
.fetchOne();
|
||||
return new PageImpl<>(dtoList, pageable, totalCount);
|
||||
}
|
||||
|
||||
private InflowControlServiceDto toDto(QClientEntity qClientEntity, QInflowControl qInflowControl,
|
||||
Tuple tuple) {
|
||||
InflowControlServiceDto dto = null;
|
||||
if (tuple.get(qInflowControl) != null)
|
||||
dto = mapper.toDto(tuple.get(qInflowControl));
|
||||
else {
|
||||
dto = new InflowControlServiceDto();
|
||||
dto.setName(tuple.get(qClientEntity.clientid));
|
||||
dto.setType(CLIENT_TYPE_INFLOW);
|
||||
}
|
||||
dto.setDesc(tuple.get(qClientEntity.clientname));
|
||||
return dto;
|
||||
}
|
||||
|
||||
public Page<Tuple> selectLogList(Pageable pageable, InflowControlHistoryManUISearch uiSearch) {
|
||||
QInflowControlLog qlog = QInflowControlLog.inflowControlLog;
|
||||
QInflowControlGroup qgroup = QInflowControlGroup.inflowControlGroup;
|
||||
|
||||
@@ -80,7 +80,6 @@ public class ApiStatsHourlyAggregationJob implements Job {
|
||||
log.info("=== 시간별 통계 집계 작업 시작 === 대상: {}", targetDate);
|
||||
|
||||
String searchDate = targetDate.format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
||||
String schemaEMS = System.getProperty("eai.tableowner", "EMSADM").toUpperCase();
|
||||
String logTableName = CommonUtil.getLogTable(searchDate, true);
|
||||
|
||||
// 1. 기존 데이터 삭제
|
||||
@@ -129,7 +128,7 @@ public class ApiStatsHourlyAggregationJob implements Job {
|
||||
" FROM " + logTableName +
|
||||
" WHERE MSGDPSTYMS LIKE :searchDate || '%'" +
|
||||
" GROUP BY EAISVCSERNO" +
|
||||
" ) A LEFT OUTER JOIN " + schemaEMS + ".TSEAIRM28 B ON A.ERROR_CODE = B.CODE AND B.CODEGROUP = 'ERRCODE_TIMEOUT'" +
|
||||
" ) A LEFT OUTER JOIN TSEAICM20 B ON A.ERROR_CODE = B.CODE AND B.CODEGROUP = 'ERRCODE_TIMEOUT' AND B.USEYN = 'Y' " +
|
||||
" GROUP BY SUBSTR(DT,1,10), API_NAME, GW_INSTANCE_ID, BIZ_DIV_CODE, NVL(A.CLIENT_ID, 'NONE')" +
|
||||
" , INBOUND_ADAPTER, OUTBOUND_ADAPTER";
|
||||
|
||||
|
||||
@@ -15,8 +15,6 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
import com.eactive.eai.rms.common.vo.GridResponse;
|
||||
import com.eactive.eai.rms.data.ext.djb.statistics.ApiUseStatsExcelExportService;
|
||||
import com.eactive.eai.rms.data.ext.djb.statistics.ApiUseStatsService;
|
||||
import com.eactive.ext.kjb.statistics.ui.ApiStatsSearch;
|
||||
import com.eactive.ext.kjb.statistics.ui.ApiStatsUI;
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.eactive.eai.rms.data.ext.djb.statistics;
|
||||
package com.eactive.eai.rms.ext.djb.statistics;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.eactive.eai.rms.data.ext.djb.statistics;
|
||||
package com.eactive.eai.rms.ext.djb.statistics;
|
||||
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
import com.eactive.eai.rms.data.entity.onl.kjb.statistics.ApiStatsDay;
|
||||
+4
-6
@@ -1,4 +1,4 @@
|
||||
package com.eactive.eai.rms.data.ext.djb.statistics;
|
||||
package com.eactive.eai.rms.ext.djb.statistics;
|
||||
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
@@ -62,8 +62,6 @@ public class ApiUseStatsService
|
||||
|
||||
private Query getDataQuery(ApiStatsSearch search) {
|
||||
|
||||
String schemaEms = System.getProperty("eai.tableowner", "EMSADM").toUpperCase();
|
||||
|
||||
StringBuilder where = buildNativeWhere(search);
|
||||
|
||||
String dataSql = "";
|
||||
@@ -80,7 +78,7 @@ public class ApiUseStatsService
|
||||
+ ", MIN(A.MIN_RESP_TIME)"
|
||||
+ ", MAX(A.MAX_RESP_TIME)"
|
||||
+ " FROM API_STATS_DAY A"
|
||||
+ " LEFT OUTER JOIN " + schemaEms + ".PTL_CREDENTIAL B ON A.CLIENT_ID = B.CLIENTID"
|
||||
+ " LEFT OUTER JOIN TSEAIAU01 B ON A.CLIENT_ID = B.CLIENTID"
|
||||
+ " LEFT OUTER JOIN TSEAIHE01 C ON A.API_NAME = C.EAISVCNAME "
|
||||
+ where
|
||||
+ " GROUP BY B.ORGNAME"
|
||||
@@ -98,7 +96,7 @@ public class ApiUseStatsService
|
||||
+ ", MIN(A.MIN_RESP_TIME)"
|
||||
+ ", MAX(A.MAX_RESP_TIME)"
|
||||
+ " FROM API_STATS_DAY A "
|
||||
+ " LEFT OUTER JOIN " + schemaEms + ".PTL_CREDENTIAL B ON A.CLIENT_ID = B.CLIENTID"
|
||||
+ " LEFT OUTER JOIN TSEAIAU01 B ON A.CLIENT_ID = B.CLIENTID"
|
||||
+ " LEFT OUTER JOIN TSEAIHE01 C ON A.API_NAME = C.EAISVCNAME "
|
||||
+ where
|
||||
+ " GROUP BY C.EAISVCDESC"
|
||||
@@ -116,7 +114,7 @@ public class ApiUseStatsService
|
||||
+ ", MIN(A.MIN_RESP_TIME)"
|
||||
+ ", MAX(A.MAX_RESP_TIME)"
|
||||
+ " FROM API_STATS_DAY A "
|
||||
+ " LEFT OUTER JOIN " + schemaEms + ".PTL_CREDENTIAL B ON A.CLIENT_ID = B.CLIENTID"
|
||||
+ " LEFT OUTER JOIN TSEAIAU01 B ON A.CLIENT_ID = B.CLIENTID"
|
||||
+ " LEFT OUTER JOIN TSEAIHE01 C ON A.API_NAME = C.EAISVCNAME "
|
||||
+ where
|
||||
+ " GROUP BY TO_CHAR(STAT_TIME,'YYYY-MM-DD')"
|
||||
Reference in New Issue
Block a user