Merge branch 'jenkins_with_weblogic' into devs/sso
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;
|
||||
}
|
||||
}
|
||||
|
||||
+47
-21
@@ -8,12 +8,6 @@ import java.util.stream.Collectors;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.logger.EAILog;
|
||||
import com.eactive.eai.data.entity.onl.logger.EAILogId;
|
||||
import com.eactive.eai.data.entity.onl.logger.QEAILog;
|
||||
@@ -26,6 +20,12 @@ import com.querydsl.core.types.dsl.EntityPathBase;
|
||||
import com.querydsl.jpa.impl.JPAQuery;
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public class EAILogRepositoryImpl implements EAILogRepository {
|
||||
|
||||
@@ -43,26 +43,43 @@ public class EAILogRepositoryImpl implements EAILogRepository {
|
||||
EntityPathBase<?> entityPathBase = new EntityPathBase<>(clazz, qeaiLog.getMetadata().getName());
|
||||
|
||||
QEAIMessageEntity qeaiMessageEntity = QEAIMessageEntity.eAIMessageEntity;
|
||||
|
||||
// Count Query
|
||||
JPAQuery<?> countQuery = new JPAQueryFactory(em)
|
||||
.from(entityPathBase)
|
||||
.leftJoin(qeaiMessageEntity)
|
||||
.on(qeaiLog.eaisvcname.eq(qeaiMessageEntity.eaisvcname));
|
||||
|
||||
appendConditions(eaiLogSearch, qeaiLog, entityPathBase, qeaiMessageEntity, countQuery);
|
||||
|
||||
JPAQuery<?> query = new JPAQueryFactory(em).from(entityPathBase);
|
||||
appendConditions(eaiLogSearch, qeaiLog, entityPathBase, query);
|
||||
|
||||
long totalCount = query.select(qeaiLog.id.msgdpstyms.count()).fetchOne();
|
||||
long totalCount = countQuery.select(qeaiLog.id.msgdpstyms.count()).fetchOne();
|
||||
|
||||
if (totalCount == 0) {
|
||||
return new PageImpl<>(new ArrayList<>(), pageable, 0);
|
||||
}
|
||||
|
||||
// List Query 분리
|
||||
JPAQuery<?> listQuery = new JPAQueryFactory(em)
|
||||
.from(entityPathBase)
|
||||
.leftJoin(qeaiMessageEntity)
|
||||
.on(qeaiLog.eaisvcname.eq(qeaiMessageEntity.eaisvcname));
|
||||
|
||||
List<EAILogDto> list = query
|
||||
List<EAILogDto> list = listQuery
|
||||
// .select(Projections.constructor(EAILogDto.class, qeaiLog, qeaiMessageEntity.eaisvcdesc))
|
||||
.select(Projections.constructor(EAILogDto.class,
|
||||
qeaiLog.id, qeaiLog.trackasiskey1ctnt, qeaiLog.trackasiskey2ctnt, qeaiLog.keymgtmsgctnt,
|
||||
qeaiLog.eaisvcname, qeaiLog.extbizcd, qeaiLog.refkey, qeaiLog.clientname,
|
||||
qeaiLog.orgname, qeaiLog.msgprcssyms, qeaiLog.companycode, qeaiLog.eaierrctnt,
|
||||
qeaiLog.id,
|
||||
qeaiLog.trackasiskey1ctnt,
|
||||
qeaiLog.trackasiskey2ctnt,
|
||||
qeaiLog.keymgtmsgctnt,
|
||||
qeaiLog.eaisvcname,
|
||||
qeaiLog.extbizcd,
|
||||
qeaiLog.refkey,
|
||||
qeaiLog.clientname,
|
||||
qeaiLog.orgname,
|
||||
qeaiLog.msgprcssyms,
|
||||
qeaiLog.companycode,
|
||||
qeaiLog.eaierrctnt,
|
||||
qeaiMessageEntity.eaisvcdesc))
|
||||
.from(entityPathBase)
|
||||
.leftJoin(qeaiMessageEntity)
|
||||
.on(qeaiLog.eaisvcname.eq(qeaiMessageEntity.eaisvcname))
|
||||
.orderBy(qeaiLog.id.msgdpstyms.desc(), qeaiLog.id.eaisvcserno.asc(), qeaiLog.id.logprcssserno.asc())
|
||||
.limit(1000)
|
||||
.fetch();
|
||||
@@ -73,9 +90,15 @@ public class EAILogRepositoryImpl implements EAILogRepository {
|
||||
public Map<String, Long> countDetailedTransactions(Class<? extends EAILog> clazz, EAILogSearch eaiLogSearch) {
|
||||
QEAILog qeaiLog = QEAILog.eAILog;
|
||||
EntityPathBase<?> entityPathBase = new EntityPathBase<>(clazz, qeaiLog.getMetadata().getName());
|
||||
|
||||
QEAIMessageEntity qeaiMessageEntity = QEAIMessageEntity.eAIMessageEntity;
|
||||
|
||||
JPAQuery<?> query = new JPAQueryFactory(em).from(entityPathBase);
|
||||
appendConditions(eaiLogSearch, qeaiLog, entityPathBase, query);
|
||||
JPAQuery<?> query = new JPAQueryFactory(em)
|
||||
.from(entityPathBase)
|
||||
.leftJoin(qeaiMessageEntity)
|
||||
.on(qeaiLog.eaisvcname.eq(qeaiMessageEntity.eAIMessageEntity.eaisvcname));
|
||||
|
||||
appendConditions(eaiLogSearch, qeaiLog, entityPathBase, qeaiMessageEntity, query);
|
||||
|
||||
List<Tuple> results = query.select(
|
||||
qeaiLog.id.logprcssserno, // 로그 처리 상태
|
||||
@@ -91,8 +114,7 @@ public class EAILogRepositoryImpl implements EAILogRepository {
|
||||
return reult;
|
||||
}
|
||||
|
||||
private void appendConditions(EAILogSearch eaiLogSearch, QEAILog qeaiLog, EntityPathBase<?> entityPathBase, JPAQuery<?> query) {
|
||||
|
||||
private void appendConditions(EAILogSearch eaiLogSearch, QEAILog qeaiLog, EntityPathBase<?> entityPathBase, QEAIMessageEntity qeaiMessageEntity, JPAQuery<?> query) {
|
||||
if (StringUtils.equalsIgnoreCase(eaiLogSearch.getAuthChk(), "Y")) {
|
||||
QUserBusiness qUserBusiness = QUserBusiness.userBusiness;
|
||||
JPAQuery<String> subQuery = new JPAQueryFactory(em)
|
||||
@@ -127,6 +149,10 @@ public class EAILogRepositoryImpl implements EAILogRepository {
|
||||
if (StringUtils.isNotBlank(eaiLogSearch.getSearchEaiSvcName())) {
|
||||
query.where(qeaiLog.eaisvcname.containsIgnoreCase(eaiLogSearch.getSearchEaiSvcName()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(eaiLogSearch.getSearchEaiSvcDesc())) {
|
||||
query.where(qeaiMessageEntity.eaisvcdesc.containsIgnoreCase(eaiLogSearch.getSearchEaiSvcDesc()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(eaiLogSearch.getSearchKeyMgtMsgCtnt())) {
|
||||
query.where(qeaiLog.keymgtmsgctnt.contains(eaiLogSearch.getSearchKeyMgtMsgCtnt()));
|
||||
|
||||
@@ -15,6 +15,7 @@ public class EAILogSearch {
|
||||
private String searchEaiBzwkDstcd;
|
||||
private String searchEaiSvcSerno;
|
||||
private String searchEaiSvcName;
|
||||
private String searchEaiSvcDesc;
|
||||
private String searchKeyMgtMsgCtnt;
|
||||
private String searchTrackAsisKey1Ctnt;
|
||||
private String searchTrackAsisKey2Ctnt;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
package com.eactive.eai.rms.onl.manage.authoutbound;
|
||||
|
||||
import com.eactive.eai.agent.command.CommonCommand;
|
||||
import com.eactive.eai.rms.common.base.OnlBaseAnnotationController;
|
||||
import com.eactive.eai.rms.common.login.SessionManager;
|
||||
import com.eactive.eai.rms.common.vo.GridResponse;
|
||||
import com.eactive.eai.rms.onl.manage.comm.property.PropertyGroupUI;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Controller
|
||||
public class OutboundFixedCredentialController extends OnlBaseAnnotationController {
|
||||
enum CommandType { RELOAD, DELETE };
|
||||
|
||||
public static final Log logger = LogFactory.getLog(OutboundFixedCredentialController.class);
|
||||
|
||||
@Autowired
|
||||
OutboundOAuthCredentialManService service ;
|
||||
|
||||
@GetMapping(value = "/onl/admin/authoutbound/outboundFixedCredentialMan.view")
|
||||
public void view() {
|
||||
}
|
||||
|
||||
@GetMapping(value = "/onl/admin/authoutbound/outboundFixedCredentialMan.view", params = "cmd=DETAIL")
|
||||
public String viewDetail() {
|
||||
return "/onl/admin/authoutbound/outboundFixedCredentialManDetail";
|
||||
}
|
||||
|
||||
@PostMapping(value= "/onl/admin/authoutbound/outboundFixedCredentialMan.json", params = "cmd=LIST")
|
||||
public ResponseEntity<GridResponse<OutboundOAuthCredentialUI>>selectList(String searchAdapterGroupName, Pageable pageable) {
|
||||
Page<OutboundOAuthCredentialUI> page = service.selectList(pageable, searchAdapterGroupName);
|
||||
Page<OutboundOAuthCredentialUI> filteredPage =
|
||||
new PageImpl<>(
|
||||
page.filter(i -> "fixed_token".equals(i.getGrantType()))
|
||||
.stream()
|
||||
.collect(Collectors.toList()),
|
||||
pageable,
|
||||
page.getTotalElements() // 또는 filtered.size()
|
||||
);
|
||||
return ResponseEntity.ok(new GridResponse<>(filteredPage));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/onl/admin/authoutbound/outboundFixedCredentialMan.json", params = "cmd=DETAIL")
|
||||
public ResponseEntity<OutboundOAuthCredentialUI> selectDetail(String adapterGroupName) throws Exception {
|
||||
OutboundOAuthCredentialUI outboundOAuthCredentialUI = service.selectDetail(adapterGroupName);
|
||||
return ResponseEntity.ok(outboundOAuthCredentialUI);
|
||||
}
|
||||
|
||||
@PostMapping(value= "/onl/admin/authoutbound/outboundFixedCredentialMan.json",params = "cmd=LIST_DETAIL_COMBO")
|
||||
public ResponseEntity<Map<String, Object>> selectDetailCombo() throws Exception {
|
||||
Map<String, Object> map = service.selectDetailCombo();
|
||||
return ResponseEntity.ok(map);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/onl/admin/authoutbound/outboundFixedCredentialMan.json", params = "cmd=INSERT")
|
||||
public ResponseEntity<Void> insert(OutboundOAuthCredentialUI outboundOAuthCredentialUI) throws Exception {
|
||||
service.insert(outboundOAuthCredentialUI);
|
||||
commandOAuthInfo(CommandType.RELOAD, outboundOAuthCredentialUI.getAdapterGroupName());
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@PostMapping(value = "/onl/admin/authoutbound/outboundFixedCredentialMan.json", params = "cmd=UPDATE")
|
||||
public ResponseEntity<Void> update(OutboundOAuthCredentialUI outboundOAuthCredentialUI) throws Exception {
|
||||
service.update(outboundOAuthCredentialUI);
|
||||
commandOAuthInfo(CommandType.RELOAD, outboundOAuthCredentialUI.getAdapterGroupName());
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@PostMapping(value = "/onl/admin/authoutbound/outboundFixedCredentialMan.json", params = "cmd=DELETE")
|
||||
public ResponseEntity<Void> delete(String adapterGroupName) throws Exception {
|
||||
service.delete(adapterGroupName);
|
||||
commandOAuthInfo(CommandType.DELETE, adapterGroupName);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
private boolean commandOAuthInfo(CommandType commandType, String adapterGroupName) {
|
||||
String commandClass ;
|
||||
|
||||
if(CommandType.DELETE == commandType){
|
||||
commandClass = "com.eactive.eai.agent.authoutbound.RemoveOutboundOAuthCredentialCommand";
|
||||
}else{
|
||||
commandClass = "com.eactive.eai.agent.authoutbound.ReloadOutboundOAuthCredentialCommand";
|
||||
}
|
||||
logger.warn("Command:" + commandType + ", Target: " + adapterGroupName);
|
||||
CommonCommand command = new CommonCommand(commandClass, adapterGroupName);
|
||||
try {
|
||||
agentUtilService.broadcast(command);
|
||||
} catch (Exception e) {
|
||||
logger.warn("Command error", e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user