diff --git a/WebContent/META-INF/context.xml b/WebContent/META-INF/context.xml deleted file mode 100644 index abcab3e..0000000 --- a/WebContent/META-INF/context.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/WebContent/WEB-INF/properties/env.P.properties b/WebContent/WEB-INF/properties/env.P.properties index 6ef25bb..2a732cc 100644 --- a/WebContent/WEB-INF/properties/env.P.properties +++ b/WebContent/WEB-INF/properties/env.P.properties @@ -14,5 +14,5 @@ eai.tableowner=EMSADM # P/T/D/S eai.systemmode=P eai.drmode=N -# black / blue / green / orange / yellow -theme.color=blue \ No newline at end of file +# black / blue / green / orange / yellow +theme.color=blue diff --git a/WebContent/WEB-INF/web.xml b/WebContent/WEB-INF/web.xml index aad14c7..f108b9c 100644 --- a/WebContent/WEB-INF/web.xml +++ b/WebContent/WEB-INF/web.xml @@ -51,6 +51,11 @@ encodingFilter *.file + + + encodingFilter + *.json + - - springapp diff --git a/WebContent/addon/request-header.jsp b/WebContent/addon/request-header.jsp index 28b0be1..7c0113e 100644 --- a/WebContent/addon/request-header.jsp +++ b/WebContent/addon/request-header.jsp @@ -6,5 +6,4 @@ while (names.hasMoreElements()) { out.println(name + ": " + request.getHeader(name)); } %> - request.getScheme(): <%=request.getScheme()%> \ No newline at end of file diff --git a/WebContent/jsp/onl/apim/portaluser/portalUserMan.jsp b/WebContent/jsp/onl/apim/portaluser/portalUserMan.jsp index 017c49f..35cadcc 100644 --- a/WebContent/jsp/onl/apim/portaluser/portalUserMan.jsp +++ b/WebContent/jsp/onl/apim/portaluser/portalUserMan.jsp @@ -92,7 +92,8 @@ '<%= localeMessage.getString("portalUser.roleName") %>', '<%= localeMessage.getString("portalUser.userStatus") %>', '<%= localeMessage.getString("portalUser.createOn") %>', - '<%= localeMessage.getString("portalUser.approvalStatus") %>' + '<%= localeMessage.getString("portalUser.approvalStatus") %>', + '<%= localeMessage.getString("portalUser.accountLockYn") %>' ], colModel: [ {name: 'rowNum', align: 'center', width: '30', sortable: false}, @@ -104,7 +105,8 @@ {name: 'roleCodeDescription', align: 'center', width: "80"}, {name: 'userStatusDescription', align: 'center', width: "50"}, {name: 'createdDate', align: 'center', width: "100", formatter: timeStampFormat}, - {name: 'approvalStatusDescription', align: 'center', width: "50"} + {name: 'approvalStatusDescription', align: 'center', width: "50"}, + {name: 'accountLockYn', align: 'center', width: "50"} ], jsonReader: { repeatitems: false diff --git a/WebContent/jsp/onl/apim/portaluser/portalUserManDetail.jsp b/WebContent/jsp/onl/apim/portaluser/portalUserManDetail.jsp index b970798..533c8a7 100644 --- a/WebContent/jsp/onl/apim/portaluser/portalUserManDetail.jsp +++ b/WebContent/jsp/onl/apim/portaluser/portalUserManDetail.jsp @@ -184,6 +184,9 @@ } else { $('#orgInfoSection').hide(); } + + $("select[name=accountLockYn]").val(data.accountLockYn); + // 25.09.23 - 마스킹 해제 상태를 기본으로 적용 / Rinjae updateButtonStates($("#userStatus").val(), true); @@ -633,6 +636,19 @@ + + <%= getRequiredLabel(localeMessage.getString("portalUser.accountLockYn")) %> + +
+ +
+ + + + diff --git a/kjb-docs/Property 설정.md b/kjb-docs/Property 설정.md new file mode 100644 index 0000000..9356d8c --- /dev/null +++ b/kjb-docs/Property 설정.md @@ -0,0 +1,75 @@ +# 광주은행용 Property 설정 +## 참고 Class +- com.eactive.ext.kjb.common.KjbProperty + +## Monitoring +### UMS 관련 (kjb.ums) +- 실제 광주은행 내에서는 UMS 는 SMS/LMS/알림톡 등 만 담당. +- 이메일 발송은 별도 시스템이 있음 (JSON 형식의 파일로 EAI 배치 이용 연계) + +- kjb.eai_batch.url + - 개발 : http://172.31.32.111:10230/BATAppWeb/EaiBatCall + - 검증 : http://172.31.33.111:10430/BATAppWeb/EaiBatCall + - 운영 : http://172.21.1.40:10860/BATAppWeb/EaiBatCall +- kjb.ums.host_url + - 개발 : http://172.31.35.144:9021 + - 운영 : +- kjb.ums.api_key + - 개발 API KEY(192.168.240.176) : `7cca6d58-e4f7-474d-9edd-525806bc99ff` + - 운영 API KEY(192.168.132.77 / 192.168.132.78 / 192.168.157.77 ) : `6a40a69f-5614-485b-8d0f-6fb2e2e51bfe` +- kjb.ums.eai_batch.send_dir : /Data/eapim/portal/sendmail/snd +- kjb.ums.eai_batch.backup_dir : /Data/eapim/portal/sendmail/bak + + +## 개발 Property + +| Key | 이름 | Value | 분류 | | +| ------------------------------------ | ------------------------ | ----------------------------------------------- | --- | --- | +| kjb.eai_batch.url | EAI 배치 호출 주소 | http://172.31.32.111:10230/BATAppWeb/EaiBatCall | 이메일 | | +| kjb.ums.eai_batch.connection_timeout | EAI 배치 커넥션 타임아웃(seconds) | 5 | 이메일 | | +| kjb.ums.eai_batch.response_timeout | EAI 배치 응답 타임아웃(seconds) | 10 | 이메일 | | +| kjb.ums.eai_batch.send_dir | EAI 배치 발송용 디렉토리 | /Data/eapim/portal/sendmail/snd | 이메일 | | +| kjb.ums.eai_batch.backup_dir | EAI 배치 발송 이후 백업 디렉토리 | /Data/eapim/portal/sendmail/bak | 이메일 | | +| kjb.ums.eai_batch.interface_id | 고객이메일발송용 EAI 배치 인터페이스 | UAGFF00001UIE | 알림톡 | | +| kjb.ums.host_url | UMS 호출 주소 | http://172.31.35.144:9021 | 알림톡 | | +| kjb.ums.api_key | UMS API Key | 7cca6d58-e4f7-474d-9edd-525806bc99ff | 알림톡 | | +| kjb.ums.connection_timeout | UMS 커넥션 타임아웃(seconds) | 5 | 알림톡 | | +| kjb.ums.response_timeout | UMS 응답 타임아웃(seconds) | 10 | 알림톡 | | +| | | | | | + +```sql +-- 개발 서버용 +insert into EMSADM.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.eai_batch.url', 'http://172.31.32.111:10230/BATAppWeb/EaiBatCall'); +insert into EMSADM.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.eai.batch.connection_timeout', '5'); +insert into EMSADM.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.eai.batch.response_timeout', '5'); +insert into EMSADM.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.eai.batch.timeout', '10'); +insert into EMSADM.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.eai.batch.charset', 'euc-kr'); +insert into EMSADM.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.eai_batch.send_dir', '/Data/eapim/portal/sendmail/snd'); +insert into EMSADM.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.eai_batch.backup_dir', '/Data/eapim/portal/sendmail/bak'); +insert into EMSADM.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.eai_batch.error_dir', '/Data/eapim/portal/sendmail/bak'); +insert into EMSADM.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.eai_batch.retention_date', '60'); +insert into EMSADM.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.eai_batch.interface_id', 'UAGFF00001UIE'); +insert into EMSADM.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.host_url', 'http://172.31.35.144:9021'); +insert into EMSADM.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.api_key', '7cca6d58-e4f7-474d-9edd-525806bc99ff'); +insert into EMSADM.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.connection_timeout', '5'); +insert into EMSADM.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.response_timeout', '5'); +insert into EMSADM.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.timeout', '10'); + + +-- autogen template +insert into EMSADM.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.eai.batch.url', ''); +insert into EMSADM.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.eai.batch.connection_timeout', '5'); +insert into EMSADM.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.eai.batch.response_timeout', '5'); +insert into EMSADM.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.eai.batch.timeout', '10'); +insert into EMSADM.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.eai.batch.charset', 'euc-kr'); +insert into EMSADM.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.eai_batch.send_dir', ''); +insert into EMSADM.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.eai_batch.backup_dir', ''); +insert into EMSADM.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.eai_batch.error_dir', ''); +insert into EMSADM.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.eai_batch.interface_id', ''); +insert into EMSADM.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.eai_batch.retention_date', '60'); +insert into EMSADM.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.host', ''); +insert into EMSADM.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.api_key', ''); +insert into EMSADM.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.connection_timeout', '5'); +insert into EMSADM.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.response_timeout', '5'); +insert into EMSADM.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', 'kjb.ums.timeout', '10'); +``` \ No newline at end of file diff --git a/src/main/java/com/eactive/eai/rms/common/filter/CrossScriptingFilter.java b/src/main/java/com/eactive/eai/rms/common/filter/CrossScriptingFilter.java index f7426c7..c01f2cb 100644 --- a/src/main/java/com/eactive/eai/rms/common/filter/CrossScriptingFilter.java +++ b/src/main/java/com/eactive/eai/rms/common/filter/CrossScriptingFilter.java @@ -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; } diff --git a/src/main/java/com/eactive/eai/rms/data/entity/man/scheduler/JobHistoryService.java b/src/main/java/com/eactive/eai/rms/data/entity/man/scheduler/JobHistoryService.java index 6021ccc..25f2265 100644 --- a/src/main/java/com/eactive/eai/rms/data/entity/man/scheduler/JobHistoryService.java +++ b/src/main/java/com/eactive/eai/rms/data/entity/man/scheduler/JobHistoryService.java @@ -52,7 +52,7 @@ public class JobHistoryService extends AbstractEMSDataSerivce{}, 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 바뀌면 등록 diff --git a/src/main/java/com/eactive/eai/rms/onl/apim/portalnotice/PortalNoticeManService.java b/src/main/java/com/eactive/eai/rms/onl/apim/portalnotice/PortalNoticeManService.java index 9e125a3..64ffe55 100644 --- a/src/main/java/com/eactive/eai/rms/onl/apim/portalnotice/PortalNoticeManService.java +++ b/src/main/java/com/eactive/eai/rms/onl/apim/portalnotice/PortalNoticeManService.java @@ -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()); diff --git a/src/main/java/com/eactive/eai/rms/onl/apim/portaluser/PortalUserUI.java b/src/main/java/com/eactive/eai/rms/onl/apim/portaluser/PortalUserUI.java index 475ecda..16094a5 100644 --- a/src/main/java/com/eactive/eai/rms/onl/apim/portaluser/PortalUserUI.java +++ b/src/main/java/com/eactive/eai/rms/onl/apim/portaluser/PortalUserUI.java @@ -50,4 +50,5 @@ public class PortalUserUI { @DateTimeFormat(pattern = "yyyyMMddHHmmss") private LocalDateTime lastModifiedDate; + private String accountLockYn; } diff --git a/src/main/java/com/eactive/eai/rms/onl/common/service/UmsDispatchJob.java b/src/main/java/com/eactive/eai/rms/onl/common/service/UmsDispatchJob.java index 9b2c31c..993e165 100644 --- a/src/main/java/com/eactive/eai/rms/onl/common/service/UmsDispatchJob.java +++ b/src/main/java/com/eactive/eai/rms/onl/common/service/UmsDispatchJob.java @@ -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 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) { diff --git a/src/main/java/com/eactive/eai/rms/onl/common/service/ums/UmsDispatchService.java b/src/main/java/com/eactive/eai/rms/onl/common/service/ums/UmsDispatchService.java index ad361f8..549ce34 100644 --- a/src/main/java/com/eactive/eai/rms/onl/common/service/ums/UmsDispatchService.java +++ b/src/main/java/com/eactive/eai/rms/onl/common/service/ums/UmsDispatchService.java @@ -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); diff --git a/src/main/java/com/eactive/eai/rms/onl/common/service/ums/UmsSender.java b/src/main/java/com/eactive/eai/rms/onl/common/service/ums/UmsSender.java index cd2ff04..4a95ca1 100644 --- a/src/main/java/com/eactive/eai/rms/onl/common/service/ums/UmsSender.java +++ b/src/main/java/com/eactive/eai/rms/onl/common/service/ums/UmsSender.java @@ -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; diff --git a/src/main/java/com/eactive/ext/kjb/ums/KjbUmsService.java b/src/main/java/com/eactive/ext/kjb/ums/KjbUmsService.java deleted file mode 100644 index 08c3ccd..0000000 --- a/src/main/java/com/eactive/ext/kjb/ums/KjbUmsService.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.eactive.ext.kjb.ums; - -import com.eactive.apim.portal.template.entity.MessageRequest; -import com.eactive.eai.rms.common.base.BaseService; -import com.eactive.eai.rms.data.entity.man.monitoringProperty.service.MonitoringPropertyService; -import com.eactive.ext.kjb.common.KjbProperty; -import com.eactive.ext.kjb.safedb.KjbSafedbWrapper; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonObject; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.io.UnsupportedEncodingException; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Arrays; - -@Service -@Transactional(transactionManager = "transactionManagerForEMS") -@Slf4j -public class KjbUmsService extends BaseService { - public static final String PROP_GORUP_ID = "Monitoring"; - public static final String PROP_EAI_BATCH_URL = "kjb.ums.eai_batch.url"; - public static final String PROP_EAI_BATCH_SEND_DIR = "kjb.ums.eai_batch.send_dir"; - - - private final KjbSafedbWrapper kjbSafedbWrapper; - - private final KjbProperty prop; - - - @Autowired - public KjbUmsService(KjbSafedbWrapper kjbSafedbWrapper, - MonitoringPropertyService monitoringPropertyService) { - this.kjbSafedbWrapper = kjbSafedbWrapper; - - KjbProperty prop = new KjbProperty(); - prop.setEaiBatchUrl(monitoringPropertyService.getPropertyValue(PROP_GORUP_ID, PROP_EAI_BATCH_URL, "")); - prop.setEaiBatchSendDir(monitoringPropertyService.getPropertyValue(PROP_GORUP_ID, PROP_EAI_BATCH_SEND_DIR, "/Data/files/send")); - - this.prop = prop; - } - - public KjbUmsService(KjbSafedbWrapper kjbSafedbWrapper, - KjbProperty property) { - this.kjbSafedbWrapper = kjbSafedbWrapper; - this.prop = property; - - init(); - } - - - private void init() { - if (prop.getEaiBatchUrl().isEmpty()) { - log.warn("{} 가 설정되지 않음. 실제 EAI 배치 연동 없이 동작함", PROP_EAI_BATCH_URL); - } - - log.info("EAI Batch URL: {}", prop.getEaiBatchUrl()); - log.info("EAI Batch Send Dir: {}", prop.getEaiBatchSendDir()); - - - // 디렉토리 검사(쓰기 권한 포함) - Path sendDirPath = Paths.get(prop.getEaiBatchSendDir()); - if (!sendDirPath.toFile().exists()) { - // 생성 시도 - boolean created = sendDirPath.toFile().mkdirs(); - if (!created) { - log.error("EAI_BATCH_SEND_DIR 디렉토리를 생성할 수 없음: {}", prop.getEaiBatchSendDir()); - throw new IllegalStateException("EAI_BATCH_SEND_DIR 디렉토리를 생성할 수 없음: " + prop.getEaiBatchSendDir()); - } - } - - if (!sendDirPath.toFile().isDirectory()) { - log.error("EAI_BATCH_SEND_DIR 가 디렉토리가 아님: {}", prop.getEaiBatchSendDir()); - throw new IllegalStateException("EAI_BATCH_SEND_DIR 가 디렉토리가 아님: " + prop.getEaiBatchSendDir()); - } - - if (!sendDirPath.toFile().canWrite()) { - log.error("EAI_BATCH_SEND_DIR 에 쓰기 권한이 없음: {}", prop.getEaiBatchSendDir()); - throw new IllegalStateException("EAI_BATCH_SEND_DIR 에 쓰기 권한이 없음: " + prop.getEaiBatchSendDir()); - } - } - - - public void sendEmail(MessageRequest messageRequest) { - log.debug("sendEmail() called - EAI_BATCH_URL: {}, EAI_BATCH_SEND_DIR: {}", prop.getEaiBatchUrl(), prop.getEaiBatchSendDir()); - log.debug("MessageRequest ID: {}, Email: {}", messageRequest.getId(), messageRequest.getEmail()); - - - if (StringUtils.isEmpty(messageRequest.getId())) { - log.warn("MessageRequest ID is empty"); - throw new IllegalArgumentException("MessageRequest ID is required"); - } - - if (StringUtils.isEmpty(messageRequest.getEmail())) { - log.warn("MessageRequest Email is empty for ID: {}", messageRequest.getId()); - throw new IllegalArgumentException("MessageRequest Email is required for ID: " + messageRequest.getId()); - } - - - String filename = "EMAIL_" + messageRequest.getId() + ".json"; - - JsonObject jsonObject = new JsonObject(); - jsonObject.addProperty("EMAIL", kjbSafedbWrapper.encryptNotRnnoString(messageRequest.getEmail())); - - - Gson gson = new GsonBuilder().setPrettyPrinting().create(); - String jsonString = gson.toJson(jsonObject); - byte[] jsonBytes = null; - - try { - jsonBytes = jsonString.getBytes("euc-kr"); - } catch (UnsupportedEncodingException e) { - throw new RuntimeException(e); - - } - - log.debug("Generated JSON({} bytes): {}", jsonBytes.length, jsonString); - log.debug("euc-kr first 10 bytes: {}...", Arrays.toString(Arrays.copyOfRange(jsonBytes, 0, 10))); - } -} diff --git a/src/main/java/com/eactive/ext/kjb/util/KjbPropertyInjector.java b/src/main/java/com/eactive/ext/kjb/util/KjbPropertyInjector.java new file mode 100644 index 0000000..8b4ac6c --- /dev/null +++ b/src/main/java/com/eactive/ext/kjb/util/KjbPropertyInjector.java @@ -0,0 +1,62 @@ +package com.eactive.ext.kjb.util; + +import com.eactive.eai.rms.data.entity.man.monitoringProperty.service.MonitoringPropertyService; +import com.eactive.ext.kjb.common.KjbProperty; +import com.eactive.ext.kjb.common.KjbPropertyValue; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Field; + +@Slf4j +public class KjbPropertyInjector { + private final MonitoringPropertyService monitoringPropertyService; + private final String groupId; + + + public KjbPropertyInjector(MonitoringPropertyService monitoringPropertyService, String groupId) { + this.monitoringPropertyService = monitoringPropertyService; + this.groupId = groupId; + } + + public T inject(T property) { + Class clazz = property.getClass(); + + for (Field field : clazz.getDeclaredFields()) { + KjbPropertyValue anno = field.getAnnotation(KjbPropertyValue.class); + + if (anno != null) { + String key = anno.key(); + String rawValue = monitoringPropertyService.getPropertyValue(groupId, key, anno.defaultValue()); + Object convertedValue = convertValue(field.getType(), rawValue); + + field.setAccessible(true); + try { + field.set(property, convertedValue); + } catch (IllegalAccessException e) { + log.error("Failed to inject property: {} - {}", field.getName(), key, e); + throw new RuntimeException(e); + } + } + } + + return property; + } + + + private static Object convertValue(Class type, String rawValue) { + if (rawValue == null) return null; + if (StringUtils.isEmpty(rawValue)) return ""; + + if (type == String.class) return rawValue; + if (type == Integer.class || type == int.class) return Integer.valueOf(rawValue); + if (type == Long.class || type == long.class) return Long.valueOf(rawValue); + if (type == Double.class || type == double.class) return Double.valueOf(rawValue); + if (type == Boolean.class || type == boolean.class) return Boolean.valueOf(rawValue); + if (type == Float.class || type == float.class) return Float.valueOf(rawValue); + if (type == Short.class || type == short.class) return Short.valueOf(rawValue); + if (type == Byte.class || type == byte.class) return Byte.valueOf(rawValue); + + return rawValue; + } +} diff --git a/src/main/resources/logback-dev.xml b/src/main/resources/logback-dev.xml index 5f92950..406f9bc 100644 --- a/src/main/resources/logback-dev.xml +++ b/src/main/resources/logback-dev.xml @@ -25,7 +25,7 @@ 10 - utf-8 + utf-8 ${LOG_PATTERN} diff --git a/src/main/resources/message/LocaleMessage_ko.properties b/src/main/resources/message/LocaleMessage_ko.properties index 61a0e22..15179a2 100644 --- a/src/main/resources/message/LocaleMessage_ko.properties +++ b/src/main/resources/message/LocaleMessage_ko.properties @@ -2728,6 +2728,7 @@ portalUser.mobile = \uD734\uB300\uD3F0\uBC88\uD638 portalUser.roleName = \uAD8C\uD55C portalUser.emailAddr =\uC774\uBA54\uC77C \uC544\uC774\uB514 portalUser.approvalStatus =\uC2B9\uC778\uC0C1\uD0DC +portalUser.accountLockYn =\uCC28\uB2E8\uC5EC\uBD80 portalUserDetail.title =\uAC00\uC785\uC790\uC815\uBCF4 portalOrgDetail.title=\uBC95\uC778 \uC815\uBCF4