Merge branch 'jenkins_with_weblogic' into devs/app_approval

# Conflicts:
#	CLAUDE.md
#	settings.gradle
#	src/main/java/com/eactive/eai/rms/onl/apim/approval/PortalApprovalManService.java
#	src/main/java/com/eactive/eai/rms/onl/apim/approval/app/PortalAppApprovalListener.java
#	src/main/java/com/eactive/eai/rms/onl/apim/approval/user/PortalUserApprovalListener.java
This commit is contained in:
Rinjae
2025-11-17 11:38:30 +09:00
119 changed files with 6107 additions and 3560 deletions
@@ -143,13 +143,15 @@ public class PortalApprovalManService extends BaseService {
AppRequest appRequest = optRequest.get();
appApprovalUI.setRequestType(appRequest.getType());
if (StringUtils.isNotEmpty(appRequest.getApiGroupList())) {
String[] apiGroupList = appRequest.getApiGroupList().split(",");
for (String apiGroupId : apiGroupList) {
apiGroupService.findByIdWithApiList(apiGroupId).ifPresent(apiGroup ->
appApprovalUI.getApiServices().add(apiGroupUIMapper.toVo(apiGroup))
);
}
if (appRequest.getApiGroupList() == null || appRequest.getApiGroupList().isEmpty()) {
appRequest.setApiGroupList("");
}
String[] apiGroupList = appRequest.getApiGroupList().split(",");
for (String apiGroupId : apiGroupList) {
apiGroupService.findByIdWithApiList(apiGroupId).ifPresent(apiGroup ->
appApprovalUI.getApiServices().add(apiGroupUIMapper.toVo(apiGroup))
);
}
List<String> currentGroupNameList = new ArrayList<>();
@@ -71,31 +71,50 @@ public class PortalAppApprovalListener implements ApprovalListener {
private final ClientManService clientManService;
private final MessageSendService messageSendService;
@Override
public void execute(Approval approval, Map<String, Object> option1) throws ApprovalDeployException {
Optional<AppRequest> optRequest = appRequestRepository.findAppRequestByApproval(approval);
AppRequest appRequest = optRequest.orElseGet(null);
if (appRequest != null) {
AppRequestType type = appRequest.getType();
CredentialUI credentialUI = null;
// Portal DB에 credential 저장 (트랜잭션 커밋 보장)
CredentialUI credentialUI = saveCredential(appRequest, type);
if (appRequest.getType().equals(AppRequestType.NEW)) {
credentialUI = createAndSaveCredentialUI(optRequest.get());
} else if (appRequest.getType().equals(AppRequestType.MODIFY)) {
credentialUI = modifyClientUI(optRequest.get());
} else if (appRequest.getType().equals(AppRequestType.DELETE)) {
credentialManService.delete(optRequest.get().getClientId());
credentialUI = new CredentialUI();
credentialUI.setClientid(optRequest.get().getClientId());
}
// 위 메서드가 반환되면 트랜잭션이 커밋되어 Portal DB에 영구 저장됨
// 이제 APIGW 동기화 및 GW 리로드 수행
syncTargetServer(type, credentialUI);
sendApprovalResult(appRequest);
}
}
/**
* Portal DB에 credential 정보를 저장하고 트랜잭션을 커밋합니다.
* GW 동기화 이전에 Portal DB의 변경사항이 확정되어야 하므로 별도 트랜잭션으로 분리합니다.
*
* @param appRequest 앱 등록/수정/삭제 요청 정보
* @param type 요청 타입 (NEW/MODIFY/DELETE)
* @return 저장된 credential 정보
*/
@Transactional
public CredentialUI saveCredential(AppRequest appRequest, AppRequestType type) {
CredentialUI credentialUI = null;
if (type.equals(AppRequestType.NEW)) {
credentialUI = createAndSaveCredentialUI(appRequest);
} else if (type.equals(AppRequestType.MODIFY)) {
credentialUI = modifyClientUI(appRequest);
} else if (type.equals(AppRequestType.DELETE)) {
credentialManService.delete(appRequest.getClientId());
credentialUI = new CredentialUI();
credentialUI.setClientid(appRequest.getClientId());
}
return credentialUI;
}
private void sendApprovalResult(AppRequest appRequest) {
MessageRecipient recipient = new MessageRecipient();
recipient.setPhone(appRequest.getApproval().getRequester().getMobileNumber());
@@ -118,15 +137,10 @@ public class PortalAppApprovalListener implements ApprovalListener {
clientManService.delete(credentialUI.getClientid());
}
//TODO: commit 처리
CommonCommand.builder()
.name(CommonCommand.RELOAD_CLIENT_COMMAND)
.args(credentialUI.getClientid())
.build().broadcast(agentUtilService);
}
private CredentialUI modifyClientUI(AppRequest appRequest) {
@@ -88,7 +88,7 @@ public class PortalUserApprovalListener implements ApprovalListener {
portalOrg.setOrgStatus(OrgStatus.ACTIVE);
portalOrgService.save(portalOrg);
syncStaging(portalOrgUIMapper.toVo(portalOrg));
// syncStaging(portalOrgUIMapper.toVo(portalOrg));
sendApprovalResult(portalUser);
}
@@ -97,42 +97,50 @@ public class PortalUserApprovalListener implements ApprovalListener {
recipient.setPhone(portalUser.getMobileNumber());
recipient.setUserId(portalUser.getEmailAddr());
Map<String, String> params = new HashMap<>();
messageSendService.sendMessage(MessageCode.USER_REGISTRATION_APPROVED, recipient, params);
// messageSendService.sendMessage(MessageCode.USER_REGISTRATION_APPROVED, recipient, params);
messageSendService.sendMessage(MessageCode.MANAGER_WITH_ORG_REGISTER_APPROVED, recipient, params);
}
/**
* @deprecated 광주은행에서는 사용하지 않음. (개발/운영 완전 분리)
* @param portalOrgUI
* @throws ApprovalDeployException
*/
private void syncStaging(PortalOrgUI portalOrgUI) throws ApprovalDeployException {
// 프록시를 통한 스테이징 서버 호출 추가
Map<String, String> properties = portalPropertyService.getPortalPropertiesAsMap(PORTAL_PROPERTY_GROUP);
String apiKey = properties.get("apiKey");
String proxyUrl = properties.get("portal.url");
String timeout = properties.getOrDefault("deploy.proxy_timeout", "10000");
String proxyEndpoint = proxyUrl + "/_onl/apim/portalorg/portalOrgMan.json";
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.set("X-API-KEY", apiKey);
headers.set("target_host", "stg");
headers.set("action", "insert");
portalOrgUI.setCompRegFile(null);
HttpEntity<PortalOrgUI> request = new HttpEntity<>(portalOrgUI, headers);
try {
ResponseEntity<String> response = createRestTemplateWithTimeout(Integer.parseInt(timeout)).exchange(
proxyEndpoint,
HttpMethod.POST,
request,
String.class
);
if (!response.getStatusCode().is2xxSuccessful()) {
logger.error("Failed to sync with staging server. Status: {}, Body: {}", response.getStatusCode(), response.getBody());
throw new ApprovalDeployException("기관 정보 배포에 실패 했습니다.");
}
} catch (Exception e) {
logger.error("Failed to sync with staging server. {}", e.getMessage());
throw new ApprovalDeployException("기관 정보 배포에 실패 했습니다.");
}
throw new RuntimeException("Unable use this method(syncStaging())");
// // 프록시를 통한 스테이징 서버 호출 추가
// Map<String, String> properties = portalPropertyService.getPortalPropertiesAsMap(PORTAL_PROPERTY_GROUP);
// String apiKey = properties.get("apiKey");
// String proxyUrl = properties.get("portal.url");
// String timeout = properties.getOrDefault("deploy.proxy_timeout", "10000");
// String proxyEndpoint = proxyUrl + "/_onl/apim/portalorg/portalOrgMan.json";
//
// HttpHeaders headers = new HttpHeaders();
// headers.setContentType(MediaType.APPLICATION_JSON);
// headers.set("X-API-KEY", apiKey);
// headers.set("target_host", "stg");
// headers.set("action", "insert");
//
// portalOrgUI.setCompRegFile(null);
// HttpEntity<PortalOrgUI> request = new HttpEntity<>(portalOrgUI, headers);
//
// try {
// ResponseEntity<String> response = createRestTemplateWithTimeout(Integer.parseInt(timeout)).exchange(
// proxyEndpoint,
// HttpMethod.POST,
// request,
// String.class
// );
//
// if (!response.getStatusCode().is2xxSuccessful()) {
// logger.error("Failed to sync with staging server. Status: {}, Body: {}", response.getStatusCode(), response.getBody());
// throw new ApprovalDeployException("기관 정보 배포에 실패 했습니다.");
// }
// } catch (Exception e) {
// logger.error("Failed to sync with staging server. {}", e.getMessage());
// throw new ApprovalDeployException("기관 정보 배포에 실패 했습니다.");
// }
}
@Override
@@ -5,9 +5,11 @@ import com.eactive.apim.portal.file.entity.FileInfo;
import com.eactive.apim.portal.file.service.FileService;
import com.eactive.apim.portal.file.service.FileTypeContext;
import com.eactive.apim.portal.portalNotice.entity.PortalNotice;
import com.eactive.eai.common.util.ContainerUtil;
import com.eactive.eai.rms.common.base.BaseService;
import com.eactive.eai.rms.data.entity.onl.apim.portalnotice.PortalNoticeService;
import com.eactive.eai.rms.data.entity.onl.apim.portalnotice.PortalNoticeUISearch;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -18,19 +20,28 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Optional;
@Service
@Transactional(transactionManager = "transactionManagerForEMS")
@Slf4j
public class PortalNoticeManService extends BaseService {
private final PortalNoticeService portalNoticeService;
private final PortalNoticeUIMapper portalNoticeUIMapper;
private final FileService fileService;
private final FileService fileService;
private String decodeString(String value) {
// return new String(value.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8);
if (ContainerUtil.get() == ContainerUtil.TOMCAT) {
try {
return new String(value.getBytes("euc-kr"), StandardCharsets.UTF_8);
} catch (UnsupportedEncodingException e) {
log.warn("Failed euc-kr to UTF-8", e);
return value;
}
}
return new String(value.getBytes(Charset.defaultCharset()), StandardCharsets.UTF_8);
}
@@ -102,7 +113,7 @@ public class PortalNoticeManService extends BaseService {
if (file != null && !file.isEmpty()) { // 새로운 파일이 업로드된 경우에만 처리
String decodedFileName = decodeString(portalNoticeUI.getFileName());
FileTypeContext.setFileType("notice");
FileInfo fileInfo = fileService.createOrUpdateSingleFile(portalNotice.getFileId(), file, decodedFileName);
FileInfo fileInfo = fileService.createOrUpdateSingleFile(portalNotice.getFileId(), file, decodedFileName, true);
if (fileInfo != null) {
portalNotice.setFileId(fileInfo.getFileId());
@@ -56,15 +56,6 @@ public class PortalOrgManController extends BaseAnnotationController {
return ResponseEntity.ok(result);
}
@PostMapping(value = "/onl/apim/portalorg/portalOrgMan.json", params = "cmd=UNMASK")
public ResponseEntity<Map<String, Object>> selectDetailUnmask(String id, String reason) {
if (StringUtils.isBlank(reason)) {
throw new BizException("마스킹 해제 사유를 입력해 주세요.");
}
Map<String, Object> result = portalOrgManService.selectDetailWithUsersUnmask(id);
return ResponseEntity.ok(result);
}
@PostMapping(value = "/onl/apim/portalorg/portalOrgMan.json", params = "cmd=LIST_INIT_COMBO")
public ResponseEntity<Map<String, Object>> initCombo() {
List<ComboVo> approvalStatusList = comboService.getMonitoringCodeSortedBySeq("APPROVE_STATUS_CODE"); // 승인상태코드
@@ -172,25 +172,9 @@ public class PortalOrgManService extends BaseService {
private PortalUserCorpManagerUI convertCorporateManagerToUIWithMaskOption(PortalUser corporateManager, boolean isMasked) {
PortalUserCorpManagerUI ui = portalUserCorpManagerUIMapper.toVo(corporateManager);
if (ui != null && isMasked) {
if (StringUtils.isNotBlank(ui.getUserName())) {
ui.setUserName(MaskingUtils.maskName(ui.getUserName()));
}
if (StringUtils.isNotBlank(ui.getEmailAddr())) {
ui.setEmailAddr(MaskingUtils.maskEmailId(ui.getEmailAddr()));
}
if (StringUtils.isNotBlank(ui.getMobileNumber())) {
ui.setMobileNumber(MaskingUtils.maskPhoneNumber(ui.getMobileNumber()));
}
}
return ui;
}
public Map<String, Object> selectDetailWithUsersUnmask(String id) {
return getDetailWithUsers(id, false);
}
private void setFileInfo(PortalOrg portalOrg, PortalOrgUI ui) {
Optional.ofNullable(portalOrg.getCompRegFile())
.filter(StringUtils::isNotBlank)
@@ -41,9 +41,11 @@ public class PortalUserManService extends BaseService {
private final PortalOrgService portalOrgService;
private final FileService fileService;
private final PortalOrgManService portalOrgManService;
private final PasswordEncoder passwordEncoder;
// private final PasswordEncoder passwordEncoder;
private final PasswordEncoder kjbSafedbPasswordEncoder;
private final PortalUserTermsService portalUserTermsService;
public Page<PortalUserUI> selectList(Pageable pageable, PortalUserUISearch portalUserUISearch) {
Page<PortalUser> portalUser = portalUserService.findAll(pageable, portalUserUISearch);
return portalUser.map(entity -> {
@@ -122,7 +124,7 @@ public class PortalUserManService extends BaseService {
}
PortalUser portalUser = portalUserUIMapper.toEntity(portalUserUI);
portalUser.setPasswordHash(passwordEncoder.encode("!" + portalUserUI.getLoginId()));
portalUser.setPasswordHash(kjbSafedbPasswordEncoder.encode("!" + portalUserUI.getLoginId()));
portalUser.setLoginFailureCount(0);
portalUser.setAccountLockYn("N");
portalUser.setEmailAddr(portalUserUI.getLoginId());
@@ -50,4 +50,5 @@ public class PortalUserUI {
@DateTimeFormat(pattern = "yyyyMMddHHmmss")
private LocalDateTime lastModifiedDate;
private String accountLockYn;
}
@@ -1,6 +1,5 @@
package com.eactive.eai.rms.onl.apim.template;
import com.eactive.apim.portal.template.entity.MessageCode;
import com.eactive.apim.portal.template.entity.MessageTemplate;
import com.eactive.eai.rms.common.base.BaseService;
import com.eactive.eai.rms.data.entity.onl.apim.template.MessageTemplateSearch;
@@ -2,11 +2,16 @@ package com.eactive.eai.rms.onl.common.service;
import com.eactive.eai.rms.onl.common.service.ums.UmsDispatchService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Arrays;
import java.util.Set;
import java.util.stream.Collectors;
/**
* Admin Job Configuration
* ----------------------
@@ -17,17 +22,37 @@ import org.springframework.beans.factory.annotation.Autowired;
// Cron Expression: */5 * * * * ?
@Slf4j
public class UmsDispatchJob implements Job {
private final UmsDispatchService umsDispatchService;
@Autowired
public UmsDispatchJob(UmsDispatchService umsDispatchService) {
this.umsDispatchService = umsDispatchService;
}
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
log.info("Starting Message Dispatch Job...");
// inst.Name 이 지정된 경우 해당 인스턴스에서만 동작
String jobInstName = context.getJobDetail().getJobDataMap().getString("execute.instances");
if (StringUtils.isNotEmpty(jobInstName)) {
log.debug("Job 실행 인스턴스 명이 지정되어 있음 - {}", jobInstName);
jobInstName = jobInstName.toLowerCase();
Set<String> propInstances = Arrays.stream(jobInstName.split(",")).map(String::trim).collect(Collectors.toSet());
String instanceName = System.getProperty("inst.Name");
if (StringUtils.isNotEmpty(instanceName)) {
log.debug("현재 인스턴스 명 : {}", instanceName);
instanceName = instanceName.trim().toLowerCase();
if (!propInstances.contains(instanceName)) {
log.debug("Job 인스턴스명과 현재 인스턴스명이 다름. 종료 처리");
return;
}
}
}
try {
umsDispatchService.processMessages();
} catch (Exception e) {
@@ -1,8 +1,12 @@
package com.eactive.eai.rms.onl.common.service.ums;
import com.eactive.apim.portal.template.entity.MessageRequest;
import edu.emory.mathcs.backport.java.util.Collections;
import com.eactive.apim.portal.template.repository.MessageRequestRepository;
import com.eactive.eai.rms.data.entity.man.monitoringProperty.service.MonitoringPropertyService;
import com.eactive.ext.kjb.common.KjbProperty;
import com.eactive.ext.kjb.ums.KjbEmailSendModule;
import com.eactive.ext.kjb.ums.KjbUmsService;
import com.eactive.ext.kjb.util.KjbPropertyInjector;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
@@ -15,15 +19,17 @@ import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.*;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
@Slf4j
@Service
@Transactional(transactionManager = "transactionManagerForEMS")
public class UmsDispatchService {
public static final String PROP_GORUP_ID = "Monitoring";
private final ThreadPoolExecutor executorService;
private final TransactionTemplate transactionTemplate;
@@ -36,15 +42,25 @@ public class UmsDispatchService {
@PersistenceContext(unitName = "entityManagerFactoryForEMS")
private EntityManager entityManager;
@Autowired
private UmsSender umsSender;
private final MessageRequestRepository messageRequestRepository;
private final KjbUmsService kjbUmsService;
private final KjbEmailSendModule kjbEmailSendModule;
private final KjbPropertyInjector kjbPropertyInjector;
@Autowired
private StandardMessageFactory messageFactory;
@Autowired
public UmsDispatchService(
@Qualifier("transactionManagerForEMS") PlatformTransactionManager transactionManager) {
@Qualifier("transactionManagerForEMS") PlatformTransactionManager transactionManager,
MonitoringPropertyService monitoringPropertyService,
MessageRequestRepository messageRequestRepository
) {
this.kjbPropertyInjector = new KjbPropertyInjector(monitoringPropertyService, PROP_GORUP_ID);
this.messageRequestRepository = messageRequestRepository;
// this.kjbEmailService = kjbEmailService;
// this.kjbSafedbWrapper = kjbSafedbWrapper;
// this.monitoringPropertyService = monitoringPropertyService;
this.executorService = new ThreadPoolExecutor(
CORE_POOL_SIZE,
MAX_POOL_SIZE,
@@ -56,6 +72,20 @@ public class UmsDispatchService {
this.transactionTemplate = new TransactionTemplate(transactionManager);
log.debug("UmsDispatchService initialized with thread pool - core: {}, max: {}, queue: {}",
CORE_POOL_SIZE, MAX_POOL_SIZE, QUEUE_CAPACITY);
KjbProperty prop = new KjbProperty();
// prop.setEaiBatchUrl(monitoringPropertyService.getPrpty2ValById(PROP_GORUP_ID, "kjb.ums.eai_batch.url"));
// prop.setUmsEaiBatchSendDir(monitoringPropertyService.getPrpty2ValById(PROP_GORUP_ID, "kjb.ums.eai_batch.send_dir"));
// prop.setUmsEaiBatchBackupDir(monitoringPropertyService.getPrpty2ValById(PROP_GORUP_ID, "kjb.ums.eai_batch.backup_dir"));
// prop.setUmsEaiBatchInterfaceId(monitoringPropertyService.getPrpty2ValById(PROP_GORUP_ID, "kjb.ums.eai_batch.interface_id"));
// prop.setUmsHostUrl(monitoringPropertyService.getPrpty2ValById(PROP_GORUP_ID, "kjb.ums.host_url"));
// prop.setUmsApiKey(monitoringPropertyService.getPrpty2ValById(PROP_GORUP_ID, "kjb.ums.api_key"));
prop = kjbPropertyInjector.inject(prop);
this.kjbUmsService = new KjbUmsService(prop);
this.kjbEmailSendModule = KjbEmailSendModule.getInstance(prop, messageRequestRepository);
}
@SuppressWarnings("unchecked")
@@ -98,6 +128,9 @@ public class UmsDispatchService {
}
} else {
log.info("No pending messages found");
// 발송 메세지가 없을 때 파일 삭제 처리 진행
}
}
@@ -110,7 +143,17 @@ public class UmsDispatchService {
try {
transactionTemplate.execute(status -> {
try {
processMessage(message);
// 광주은행에서는 사용하지 않는 메소드
// processMessage(message);
if (KjbUmsService.isAllowChannel(message)) {
kjbUmsService.send(message);
}
if (KjbEmailSendModule.isAllowChannel(message)) {
kjbEmailSendModule.sendEmail(message);
}
return null;
} catch (Exception e) {
log.error("Failed to process message: {} - Error: {}",
@@ -127,21 +170,27 @@ public class UmsDispatchService {
});
}
public void processMessage(MessageRequest message) throws IOException {
try {
String standardMessage = messageFactory.createMessage(message);
log.debug("Processing message ID: {} - Type: {}", message.getId(), message.getMessageType());
umsSender.sendMessage(standardMessage);
updateMessageStatus(message, "SENT");
log.debug("Successfully processed and sent message ID: {}", message.getId());
} catch (Exception e) {
log.error("Message processing failed for ID: {} - Error: {}",
message.getId(), e.getMessage(), e);
updateMessageStatus(message, "FAILED");
throw e;
}
}
/**
* kbank 방식으로 광주은행에서는 사용하지 않음
* @param message
* @throws IOException
*/
// @Deprecated
// public void processMessage(MessageRequest message) throws IOException {
// try {
// String standardMessage = messageFactory.createMessage(message);
// log.debug("Processing message ID: {} - Type: {}", message.getId(), message.getMessageType());
//
// umsSender.sendMessage(standardMessage);
// updateMessageStatus(message, "SENT");
// log.debug("Successfully processed and sent message ID: {}", message.getId());
// } catch (Exception e) {
// log.error("Message processing failed for ID: {} - Error: {}",
// message.getId(), e.getMessage(), e);
// updateMessageStatus(message, "FAILED");
// throw e;
// }
// }
public void updateMessageStatus(MessageRequest message, String status) {
message.setRequestStatus(status);
@@ -16,8 +16,12 @@ import org.springframework.stereotype.Component;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
/**
* 25.11.05 - 광주은행 미사용 클래스
*/
@Slf4j
@Component
@Deprecated
public class UmsSender {
private final MonitoringPropertyService monitoringPropertyService;
@@ -268,7 +268,7 @@ public class ApiInterfaceController extends OnlBaseAnnotationController {
.body(exportData.getExportFileContent());
}
@PostMapping(value = "/onl/transaction/apim/apiInterfaceMan.json", params = "cmd=INSERT_CLONE")
@PostMapping(value = "/onl/transaction/apim/apiInterfaceMan.json", params = "cmd=CLONE")
public ResponseEntity<?> cloneApiInterface(String orgApiInterfaceId, String newBizCode, String newApiInterfaceId, String newInboundHttpMethod, String newInboundRestPath) throws BizException {
try {
ApiInterfaceUI orgApiInterfaceUI = service.selectDetail(orgApiInterfaceId);
@@ -216,6 +216,20 @@ public class ApiInterfaceService extends OnlBaseService {
apiInterfaceUI.setInboundResponseStandardMessageItems(convertMapToStdMessageItems(restOption.getStandardCommonFields()));
}
}
if("syncAsync".equals(apiInterfaceUI.getSyncAsyncType()) && serviceMessageEntityList != null && serviceMessageEntityList.size() > 1){
ServiceMessageEntity extraServiceMessageEntity = serviceMessageEntityList.get(1);
apiInterfaceUI.setToResponseAdapter(extraServiceMessageEntity.getPsvsysadptrbzwkgroupname());
String restOptionStr = extraServiceMessageEntity.getRestoption();
if(StringUtils.isNotBlank(restOptionStr)) {
ObjectMapper mapper = new ObjectMapper();
RestOption restOption = mapper.readValue(restOptionStr, RestOption.class);
apiInterfaceUI.setOutboundResponseHttpMethod(restOption.getMethod());
apiInterfaceUI.setOutboundResponseRestPath(restOption.getExtraPath());
}
}
apiInterfaceUI.setTransformYn(transformYn);
apiInterfaceUI.setErrTransformYn(errTransformYn); // 추가
@@ -430,8 +444,8 @@ public class ApiInterfaceService extends OnlBaseService {
public void setServiceMessageRoutingInfo(ApiInterfaceUI vo, EAIMessageEntity eaiMessageEntity, List<ServiceMessageEntity> serviceMessageEntityList) throws Exception {
// 기본 요청 ServiceMessageEntity 설정
ServiceMessageEntity requestEntity = serviceMessageEntityList.get(0);
if ("async".equals(vo.getSyncAsyncType())) {
if ("async".equals(vo.getSyncAsyncType()) || "syncAsync".equals(vo.getSyncAsyncType())) {
requestEntity.setPsvintfacdsticname("ASYN");
}
@@ -462,6 +476,32 @@ public class ApiInterfaceService extends OnlBaseService {
setRouteInfo(vo, vo.getInboundResponseHttpMethod(), vo.getInboundResponseRestPath(), vo.getFromResponseAdapter(), responseEntity, vo.getInboundResponseStandardMessageItems());
}
// syncAsync 타입인 경우 응답용 ServiceMessageEntity 추가 처리
if ("syncAsync".equals(vo.getSyncAsyncType())) {
ServiceMessageEntity responseEntity;
// ServiceMessageEntity가 없으면 새로 생성
if (serviceMessageEntityList.size() < 2) {
responseEntity = new ServiceMessageEntity();
responseEntity.setId(new ServiceMessageEntityId(vo.getEaiSvcName(), 2));
responseEntity.setEaimessage(eaiMessageEntity);
serviceMessageEntityList.add(responseEntity);
} else {
responseEntity = serviceMessageEntityList.get(1);
}
// ServiceMessageEntity 설정
responseEntity.setPsvsysadptrbzwkgroupname(vo.getToResponseAdapter());
responseEntity.setPsvintfacdsticname("ASYN");
// REST 정보 설정
AdapterGroupUI responseAdapter = adapterService.selectDetail(vo.getToResponseAdapter());
String responseRoutName = getOutboundProcessorName(responseAdapter);
responseEntity.setOutbndroutname(responseRoutName);
setRouteInfo(vo, vo.getOutboundResponseHttpMethod(), vo.getOutboundResponseRestPath(), vo.getToResponseAdapter(), responseEntity, vo.getStandardMessageItems());
}
}
public static List<StdMessageItemUI> convertMapToStdMessageItems(Map<String, String> standardCommonFields) {
@@ -669,6 +709,8 @@ public class ApiInterfaceService extends OnlBaseService {
sheet.setColumnWidth(ci++, 200 * 30);
sheet.setColumnWidth(ci++, 300 * 30);
sheet.setColumnWidth(ci++, 200 * 30);
sheet.setColumnWidth(ci++, 200 * 30);
sheet.setColumnWidth(ci++, 300 * 30);
sheet.setColumnWidth(ci, 300 * 30);
int rowNum = 0;
@@ -690,6 +732,8 @@ public class ApiInterfaceService extends OnlBaseService {
createCell(row, cellIndex++, textStyle, apiInterfaceUI.getEaiSvcDesc());
createCell(row, cellIndex++, headerStyle, "변환여부(Y/N)");
createCell(row, cellIndex++, textStyle, apiInterfaceUI.getTransformYn());
createCell(row, cellIndex++, headerStyle, "Sync/Async 타입");
createCell(row, cellIndex++, textStyle, apiInterfaceUI.getSyncAsyncType());
rowNum = addTitle(sheet, ++rowNum, titleStyle, "어댑터 설정");
row = sheet.createRow(rowNum++);
@@ -698,8 +742,23 @@ public class ApiInterfaceService extends OnlBaseService {
createCell(row, cellIndex++, headerStyle, "인바운드 어댑터");
createCell(row, cellIndex++, textStyle, apiInterfaceUI.getFromAdapter());
createCell(row, cellIndex++, headerStyle, "아웃바운드 어댑터");
createCell(row, cellIndex, textStyle, apiInterfaceUI.getToAdapter());
createCell(row, cellIndex++, textStyle, apiInterfaceUI.getToAdapter());
//SYNC TYPE 에 따라 추가정보 생성
String syncAsyncType = apiInterfaceUI.getSyncAsyncType();
if (syncAsyncType.equals("asyncSync") || syncAsyncType.equals("syncAsync")) {
if (apiInterfaceUI.getSyncAsyncType().equals("asyncSync")) {
createCell(row, cellIndex++, headerStyle, "INBOUND (ASYNC) 응답 어댑터");
createCell(row, cellIndex, textStyle, apiInterfaceUI.getFromResponseAdapter());
} else {
createCell(row, cellIndex++, headerStyle, "OUTBOUND (ASYNC) 응답 어댑터");
createCell(row, cellIndex, textStyle, apiInterfaceUI.getToResponseAdapter());
}
}
rowNum = addTitle(sheet, ++rowNum, titleStyle, "REST 설정");
row = sheet.createRow(rowNum++);
row.setHeightInPoints(height); // 행 높이를 20 포인트로 설정
@@ -707,14 +766,30 @@ public class ApiInterfaceService extends OnlBaseService {
createCell(row, cellIndex++, headerStyle, "수신 메소드");
createCell(row, cellIndex++, textStyle, apiInterfaceUI.getInboundHttpMethod());
createCell(row, cellIndex++, headerStyle, "수신 PATH(URL)");
createCell(row, cellIndex, textStyle, apiInterfaceUI.getInboundRestPath());
createCell(row, cellIndex++, textStyle, apiInterfaceUI.getInboundRestPath());
if(apiInterfaceUI.getSyncAsyncType().equals("asyncSync")) {
createCell(row, cellIndex++, headerStyle, "응답 송신 메소드");
createCell(row, cellIndex++, textStyle, apiInterfaceUI.getInboundResponseHttpMethod());
createCell(row, cellIndex++, headerStyle, "응답 송신 REST PATH(URL)");
createCell(row, cellIndex, textStyle, apiInterfaceUI.getInboundResponseRestPath());
}
row = sheet.createRow(rowNum++);
row.setHeightInPoints(height); // 행 높이를 20 포인트로 설정
cellIndex = 0; // 초기 셀 인덱스
createCell(row, cellIndex++, headerStyle, "송신 메소드");
createCell(row, cellIndex++, textStyle, apiInterfaceUI.getOutboundHttpMethod());
createCell(row, cellIndex++, headerStyle, "송신 PATH(URL)");
createCell(row, cellIndex, textStyle, apiInterfaceUI.getOutboundRestPath());
createCell(row, cellIndex++, textStyle, apiInterfaceUI.getOutboundRestPath());
if(apiInterfaceUI.getSyncAsyncType().equals("syncAsync")) {
createCell(row, cellIndex++, headerStyle, "응답 수신 메소드");
createCell(row, cellIndex++, textStyle, apiInterfaceUI.getOutboundResponseHttpMethod());
createCell(row, cellIndex++, headerStyle, "송신 REST PATH(URL)");
createCell(row, cellIndex, textStyle, apiInterfaceUI.getOutboundResponseRestPath());
}
if ("Y".equals(apiInterfaceUI.getTransformYn())) {
rowNum = addTitle(sheet, ++rowNum, titleStyle, "변환 설정");
@@ -768,9 +843,27 @@ public class ApiInterfaceService extends OnlBaseService {
String interfaceDesc = PoiUtils.getCellValue(sheet, 2, 1);
String transformYn = PoiUtils.getCellValue(sheet, 2, 3);
String syncAsyncType = PoiUtils.getCellValue(sheet, 2, 5);
String inboundAdapterGroupName = PoiUtils.getCellValue(sheet, 5, 1);
String outboundAdapterGroupName = PoiUtils.getCellValue(sheet, 5, 3);
String inboundResponseHttpMethod = "";
String inboundResponseRestPath = "";
String fromResponseAdapter = "";
String outboundResponseHttpMethod = "";
String outboundResponseRestPath = "";
String toResponseAdapter = "";
if (syncAsyncType.equals("asyncSync")) {
inboundResponseHttpMethod = PoiUtils.getCellValue(sheet, 8, 5);
inboundResponseRestPath = PoiUtils.getCellValue(sheet, 8, 7);
fromResponseAdapter = PoiUtils.getCellValue(sheet, 5, 5);
} else if (syncAsyncType.equals("syncAsync")) {
outboundResponseHttpMethod = PoiUtils.getCellValue(sheet, 9, 5);
outboundResponseRestPath = PoiUtils.getCellValue(sheet, 9, 7);
toResponseAdapter = PoiUtils.getCellValue(sheet, 5, 5);
}
String inboundHttpMethod = PoiUtils.getCellValue(sheet, 8, 1);
String inboundRestPath = PoiUtils.getCellValue(sheet, 8, 3);
@@ -784,6 +877,7 @@ public class ApiInterfaceService extends OnlBaseService {
apiInterfaceUI.setEaiSvcName(elinkServiceId);
apiInterfaceUI.setEaiSvcDesc(interfaceDesc);
apiInterfaceUI.setTransformYn(transformYn);
apiInterfaceUI.setSyncAsyncType(syncAsyncType);
apiInterfaceUI.setFromAdapter(inboundAdapterGroupName);
apiInterfaceUI.setToAdapter(outboundAdapterGroupName);
@@ -792,6 +886,14 @@ public class ApiInterfaceService extends OnlBaseService {
apiInterfaceUI.setInboundRestPath(inboundRestPath);
apiInterfaceUI.setOutboundHttpMethod(outboundHttpMethod);
apiInterfaceUI.setOutboundRestPath(outboundRestPath);
apiInterfaceUI.setInboundResponseHttpMethod(inboundResponseHttpMethod);
apiInterfaceUI.setInboundResponseRestPath(inboundResponseRestPath);
apiInterfaceUI.setFromResponseAdapter(fromResponseAdapter);
apiInterfaceUI.setOutboundResponseHttpMethod(outboundResponseHttpMethod);
apiInterfaceUI.setOutboundResponseRestPath(outboundResponseRestPath);
apiInterfaceUI.setToResponseAdapter(toResponseAdapter);
apiInterfaceUI.setIsHeaderRouting(false);
@@ -110,6 +110,10 @@ public interface ApiInterfaceUIMapper {
syncAsyncType = "asyncSync";
}
vo.setSyncAsyncType(syncAsyncType);
// 가상응답 여부
String simYn = "T".equals(eaiMessageEntity.getTrantype()) ? "Y" : "N";
vo.setSimYn(simYn);
vo.setToAdapter(requestEntity.getPsvsysadptrbzwkgroupname());
vo.setToutVal(requestEntity.getToutval());
@@ -186,6 +190,11 @@ public interface ApiInterfaceUIMapper {
if(vo == null || vo.getSyncAsyncType() == null){
return;
}
// 가상응답 여부
String tranType = "Y".equals(vo.getSimYn()) ? "T" : "R";
entity.setTrantype(tranType);
switch(vo.getSyncAsyncType()){
case "async":
case "asyncSync":
@@ -193,4 +202,4 @@ public interface ApiInterfaceUIMapper {
break;
}
}
}
}
@@ -54,6 +54,11 @@ public class ApiInterfaceUI {
private String inboundResponseHttpMethod;
private String inboundResponseRestPath;
private String fromResponseAdapter;
//SYNC-ASYNC 용
private String outboundResponseHttpMethod;
private String outboundResponseRestPath;
private String toResponseAdapter;
private String inboundErrResponseLayout;
private String errResponseTransform;