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);