Merge remote-tracking branch 'origin/jenkins_with_weblogic' of C:/eactive/workspaces/eapim-bundle/bundles/251111/eapim-admin_incremental_2025-08-01.bundle into jenkins_with_weblogic

This commit is contained in:
Rinjae
2025-11-11 09:58:43 +09:00
18 changed files with 291 additions and 223 deletions
@@ -37,11 +37,9 @@ public class CrossScriptingFilter implements Filter {
String uri = request.getRequestURL().toString();
String servletPath = request.getServletPath();
String baseUrl = uri.replace(servletPath, "");
boolean isValidUrl = returnUrl.startsWith(baseUrl);
// System.out.println("checkReturnUrl => "+ uri + " : "+ servletPath);
// System.out.println("checkReturnUrl => "+ baseUrl + " : "+ returnUrl);
// System.out.println("checkReturnUrl => "+ returnUrl + " : "+ isValidUrl);
return isValidUrl;
// 25.11.10 - weblogic https://host:443/ 문제 대응
baseUrl = baseUrl.replace(":443", "");
return returnUrl.startsWith(baseUrl);
}
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
@@ -52,7 +50,6 @@ public class CrossScriptingFilter implements Filter {
String returnUrl = (String)request.getParameter("returnUrl");
if(returnUrl != null) {
if(!checkReturnUrl(request, returnUrl)) {
System.out.println("CrossScriptingFilter] bad request. - " + returnUrl);
response.sendError(HttpServletResponse.SC_BAD_REQUEST, "bad request. - "+returnUrl);
return;
}
@@ -52,7 +52,7 @@ public class JobHistoryService extends AbstractEMSDataSerivce<JobHistory, String
String rctStatus = findRecentStatus(jobName, instanceName); // 최근 Data 조회
log.info("[DHJEONG]1_rctStatus-->{}, jobName-->{}, instanceName-->{}", rctStatus, jobName, instanceName);
// log.info("[DHJEONG]1_rctStatus-->{}, jobName-->{}, instanceName-->{}", rctStatus, jobName, instanceName);
if (!status.equals(rctStatus) || !"E".equals(jobInfo.getChkStatus())) {
// 'Y' 이면 무조건 등록, 'E' 이면 ==> Status 바뀌면 등록
@@ -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());
@@ -50,4 +50,5 @@ public class PortalUserUI {
@DateTimeFormat(pattern = "yyyyMMddHHmmss")
private LocalDateTime lastModifiedDate;
private String accountLockYn;
}
@@ -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;