자동 생성된 API Spec 목록 및 개수 추가
This commit is contained in:
@@ -713,6 +713,10 @@
|
||||
color: #dc3545;
|
||||
font-weight: bold;
|
||||
}
|
||||
.api-created {
|
||||
color: #007bff;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
@@ -732,12 +736,15 @@ function showSyncResultModal(response) {
|
||||
|
||||
if (response.success) {
|
||||
statusClass = "status-success";
|
||||
var createdCount = response.createdApiSpecCount || 0;
|
||||
var createdMsg = createdCount > 0 ? "<br/><span style='color:#007bff;'>* " + createdCount + "개의 API Spec이 자동 생성되었습니다.</span>" : "";
|
||||
|
||||
if (response.action === 'INSERTED') {
|
||||
statusMsg = "<strong>반영 완료</strong> - 포탈에 새로운 인증정보가 생성되었습니다.";
|
||||
statusMsg = "<strong>반영 완료</strong> - 포탈에 새로운 인증정보가 생성되었습니다." + createdMsg;
|
||||
} else if (response.action === 'UPDATED') {
|
||||
statusMsg = "<strong>반영 완료</strong> - 기존 포탈 인증정보가 업데이트되었습니다.";
|
||||
statusMsg = "<strong>반영 완료</strong> - 기존 포탈 인증정보가 업데이트되었습니다." + createdMsg;
|
||||
} else {
|
||||
statusMsg = "<strong>반영 완료</strong> - " + response.message;
|
||||
statusMsg = "<strong>반영 완료</strong> - " + response.message + createdMsg;
|
||||
}
|
||||
} else {
|
||||
if (response.action === 'SKIPPED_NO_ORG') {
|
||||
@@ -759,6 +766,7 @@ function showSyncResultModal(response) {
|
||||
var targetApis = response.targetApis || [];
|
||||
var syncedApis = response.syncedApis || [];
|
||||
var invalidApis = response.invalidApis || [];
|
||||
var createdApiSpecs = response.createdApiSpecs || [];
|
||||
|
||||
$targetCount.text(targetApis.length);
|
||||
|
||||
@@ -772,6 +780,9 @@ function showSyncResultModal(response) {
|
||||
if (invalidApis.includes(apiId)) {
|
||||
status = "미존재 (APIGW에 없음)";
|
||||
statusClass = "api-invalid";
|
||||
} else if (createdApiSpecs.includes(apiId)) {
|
||||
status = "반영됨 (Spec 신규생성)";
|
||||
statusClass = "api-created";
|
||||
} else if (syncedApis.includes(apiId)) {
|
||||
status = "반영됨";
|
||||
statusClass = "api-synced";
|
||||
|
||||
@@ -156,6 +156,12 @@ public class ClientController extends OnlBaseAnnotationController {
|
||||
response.put("invalidApis", result.getInvalidApis());
|
||||
}
|
||||
|
||||
// 자동 생성된 API Spec 목록 포함
|
||||
if (result.getCreatedApiSpecs() != null && !result.getCreatedApiSpecs().isEmpty()) {
|
||||
response.put("createdApiSpecs", result.getCreatedApiSpecs());
|
||||
response.put("createdApiSpecCount", result.getCreatedApiSpecCount());
|
||||
}
|
||||
|
||||
return ResponseEntity.ok(response);
|
||||
} catch (Exception e) {
|
||||
// 에러 처리
|
||||
|
||||
+31
-5
@@ -1,5 +1,7 @@
|
||||
package com.eactive.eai.rms.onl.manage.authserver.client;
|
||||
|
||||
import com.eactive.apim.portal.apispec.entity.ApiSpecInfo;
|
||||
import com.eactive.apim.portal.apispec.service.ApiSpecInfoService;
|
||||
import com.eactive.apim.portal.app.entity.Credential;
|
||||
import com.eactive.apim.portal.portalorg.entity.PortalOrg;
|
||||
import com.eactive.eai.data.entity.onl.message.EAIMessageEntity;
|
||||
@@ -43,6 +45,7 @@ public class ClientManService extends OnlBaseService {
|
||||
private CredentialManService credentialManService;
|
||||
private CredentialService credentialService;
|
||||
private EAIMessageService eaiMessageService;
|
||||
private ApiSpecInfoService apiSpecInfoService;
|
||||
|
||||
@Autowired
|
||||
public ClientManService(ClientEntityService clientEntityService,
|
||||
@@ -51,7 +54,8 @@ public class ClientManService extends OnlBaseService {
|
||||
PortalOrgUIMapper portalOrgUIMapper,
|
||||
CredentialManService credentialManService,
|
||||
CredentialService credentialService,
|
||||
EAIMessageService eaiMessageService) {
|
||||
EAIMessageService eaiMessageService,
|
||||
ApiSpecInfoService apiSpecInfoService) {
|
||||
this.clientEntityService = clientEntityService;
|
||||
this.clientUIMapper = clientUIMapper;
|
||||
this.portalOrgService = portalOrgService;
|
||||
@@ -59,6 +63,7 @@ public class ClientManService extends OnlBaseService {
|
||||
this.credentialManService = credentialManService;
|
||||
this.credentialService = credentialService;
|
||||
this.eaiMessageService = eaiMessageService;
|
||||
this.apiSpecInfoService = apiSpecInfoService;
|
||||
}
|
||||
|
||||
|
||||
@@ -168,10 +173,29 @@ public class ClientManService extends OnlBaseService {
|
||||
DataSourceType monitoringType = DataSourceTypeManager.getDataSourceType("MONITORING");
|
||||
DataSourceContextHolder.setDataSourceType(monitoringType);
|
||||
|
||||
// 5. 기존 Credential 확인
|
||||
// 5. PTL_API_SPEC_INFO에 없는 API 자동 생성
|
||||
List<String> createdApiSpecs = new ArrayList<>();
|
||||
if (clientEntity.getApiList() != null && !clientEntity.getApiList().isEmpty()) {
|
||||
for (EAIMessageEntity apiEntity : clientEntity.getApiList()) {
|
||||
String apiId = apiEntity.getEaisvcname();
|
||||
if (!apiSpecInfoService.findById(apiId).isPresent()) {
|
||||
// PTL_API_SPEC_INFO에 없으면 자동 생성
|
||||
ApiSpecInfo newApiSpec = new ApiSpecInfo();
|
||||
newApiSpec.setApiId(apiId);
|
||||
newApiSpec.setApiName(StringUtils.isNotBlank(apiEntity.getEaisvcdesc())
|
||||
? apiEntity.getEaisvcdesc() : apiId);
|
||||
newApiSpec.setApiSimpleDescription(apiEntity.getEaisvcdesc());
|
||||
newApiSpec.setDisplayYn("Y"); // 기본값: 공개
|
||||
apiSpecInfoService.create(newApiSpec);
|
||||
createdApiSpecs.add(apiId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 6. 기존 Credential 확인
|
||||
Credential existingCredential = credentialService.findByClientidAndOrgid(clientId, orgId);
|
||||
|
||||
// 6. 데이터 변환 (ClientEntity → CredentialUI)
|
||||
// 7. 데이터 변환 (ClientEntity → CredentialUI)
|
||||
CredentialUI credentialUI = convertToCredentialUI(clientEntity);
|
||||
|
||||
SyncResult.SyncAction action;
|
||||
@@ -188,7 +212,7 @@ public class ClientManService extends OnlBaseService {
|
||||
credentialUI.setServer(existing.getServer());
|
||||
}
|
||||
|
||||
// 7. 포탈 스키마에 업데이트
|
||||
// 8. 포탈 스키마에 업데이트
|
||||
credentialManService.update(credentialUI);
|
||||
action = SyncResult.SyncAction.UPDATED;
|
||||
} else {
|
||||
@@ -197,7 +221,7 @@ public class ClientManService extends OnlBaseService {
|
||||
credentialUI.setAppDescription("APIGW에서 반영된 인증정보");
|
||||
}
|
||||
|
||||
// 7. 포탈 스키마에 신규 생성
|
||||
// 8. 포탈 스키마에 신규 생성
|
||||
credentialManService.insert(credentialUI);
|
||||
action = SyncResult.SyncAction.INSERTED;
|
||||
}
|
||||
@@ -210,6 +234,8 @@ public class ClientManService extends OnlBaseService {
|
||||
.targetApiCount(requestedApiIds.size())
|
||||
.syncedApis(requestedApiIds)
|
||||
.syncedApiCount(requestedApiIds.size())
|
||||
.createdApiSpecs(createdApiSpecs)
|
||||
.createdApiSpecCount(createdApiSpecs.size())
|
||||
.build();
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -56,6 +56,16 @@ public class SyncResult {
|
||||
*/
|
||||
private List<String> invalidApis;
|
||||
|
||||
/**
|
||||
* 자동 생성된 API Spec 목록 (PTL_API_SPEC_INFO에 없어서 새로 생성된 API)
|
||||
*/
|
||||
private List<String> createdApiSpecs;
|
||||
|
||||
/**
|
||||
* 자동 생성된 API Spec 개수
|
||||
*/
|
||||
private int createdApiSpecCount;
|
||||
|
||||
/**
|
||||
* 반영 액션 타입
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user