From beb36e636715ffa1b49ee2f48bb0b1c68e3033e1 Mon Sep 17 00:00:00 2001 From: dogyeom Date: Thu, 20 Nov 2025 17:10:51 +0900 Subject: [PATCH] =?UTF-8?q?FileEventListener=20=EC=88=98=EC=A0=95=EC=82=AC?= =?UTF-8?q?=ED=95=AD=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../eai/inbound/FileEventListener.java | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/com/eactive/eai/inbound/FileEventListener.java b/src/com/eactive/eai/inbound/FileEventListener.java index 330c229..cc2ee93 100644 --- a/src/com/eactive/eai/inbound/FileEventListener.java +++ b/src/com/eactive/eai/inbound/FileEventListener.java @@ -51,6 +51,11 @@ public class FileEventListener extends Process{ catchException(e); } } + public String[] extractLastTwo(String dirPath) {// 20251120 + String[] parts = dirPath.split("/"); + int len = parts.length; + return new String[] { parts[len - 2], parts[len - 1] }; + } private void getFileEventInfo() throws Exception { // 수신한 파일 정보 @@ -58,8 +63,12 @@ public class FileEventListener extends Process{ logger.info("[Send File Event] ▶▶▶▶▶▶▶▶▶▶ Local 송신 FILE EVENT 발생 !! ◀◀◀◀◀◀◀◀◀◀"); logger.info("[Send File Event] ※ Event 디렉토리 : [" + dirPath +"]"); logger.info("[Send File Event] ※ Event 파일명 : [" + fileName +"]"); +// logger.info("[Send File Event] ========================================================================="); + if(dirPath.length() >= BatchDirUtil.getResponseRootDir().length()+11) {// 20251120 + fileName = extractLastTwo(dirPath)[0]+"_"+extractLastTwo(dirPath)[1]+"_"+fileName; + } + logger.info("[Send File Event] ※ Event 수정 파일명 : [" + fileName +"]"); logger.info("[Send File Event] ========================================================================="); - //업무구분코드 String processCode = fileName.substring(0, 5); String institutionCode = fileName.substring(6, 10); @@ -144,7 +153,14 @@ public class FileEventListener extends Process{ private void callFileMover() throws Exception { - String renamedFileName = fileName.substring(11) + "_" + CalendarUtil.getCurrentTimeNoDash(); + String renamedFileName = fileName; + if(dirPath.length() >= BatchDirUtil.getResponseRootDir().length()+11 && fileName.length() > 11) {// 20251120 + fileName = fileName.substring(11); + renamedFileName = fileName + "_" + CalendarUtil.getCurrentTimeNoDash(); + }else { + renamedFileName = fileName.substring(11) + "_" + CalendarUtil.getCurrentTimeNoDash(); + } + File realFile = new File(this.dirPath +"/"+ fileName); File archFile = new File(this.targetDir +"/"+ renamedFileName);