FileEventListener 수정사항 반영

This commit is contained in:
dogyeom
2025-11-20 17:10:51 +09:00
parent c97965f5d9
commit beb36e6367
@@ -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);