From 32c458439d6ad5c899781adabc677b9bfc59fa92 Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Wed, 20 Sep 2023 18:10:00 +0900 Subject: [PATCH] =?UTF-8?q?=EC=86=8C=EC=8A=A4=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cokr/xit/fims/crdn/parsing/Ino.java | 8 +++++- .../xit/fims/crdn/parsing/XitRecommend.java | 25 +++++++++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/main/java/cokr/xit/fims/crdn/parsing/Ino.java b/src/main/java/cokr/xit/fims/crdn/parsing/Ino.java index da408447..eda8a90c 100644 --- a/src/main/java/cokr/xit/fims/crdn/parsing/Ino.java +++ b/src/main/java/cokr/xit/fims/crdn/parsing/Ino.java @@ -7,6 +7,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.regex.Matcher; +import java.util.stream.Collectors; import java.util.stream.Stream; import org.apache.commons.io.FilenameUtils; @@ -20,7 +21,12 @@ public class Ino implements EquipmentEnterprise { List dataObjectList = new ArrayList<>(); - fileList.forEach(item -> { + //파일명으로 정렬(파싱 전) + List sortedFileList = fileList + .sorted((item1, item2) -> item1.toFile().getName().compareTo(item2.toFile().getName())) + .collect(Collectors.toList()); + + sortedFileList.forEach(item -> { DataObject dataObject = new DataObject(); File file = item.toFile(); String filePath = file.getPath(); diff --git a/src/main/java/cokr/xit/fims/crdn/parsing/XitRecommend.java b/src/main/java/cokr/xit/fims/crdn/parsing/XitRecommend.java index ce78f326..e555b50b 100644 --- a/src/main/java/cokr/xit/fims/crdn/parsing/XitRecommend.java +++ b/src/main/java/cokr/xit/fims/crdn/parsing/XitRecommend.java @@ -1,7 +1,10 @@ package cokr.xit.fims.crdn.parsing; +import java.io.File; import java.nio.file.Path; +import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; import java.util.stream.Stream; import cokr.xit.foundation.data.DataObject; @@ -11,9 +14,28 @@ public class XitRecommend implements EquipmentEnterprise{ @Override public List parsing(Stream fileList) { + //파일명으로 정렬(파싱 전) + List sortedFileList = fileList + .sorted((item1, item2) -> item1.toFile().getName().compareTo(item2.toFile().getName())) + .collect(Collectors.toList()); - //TODO: + List dataObjectList = new ArrayList<>(); + sortedFileList.forEach(item -> { + DataObject dataObject = new DataObject(); + File file = item.toFile(); + String filePath = file.getPath(); + dataObject.put("FILE_PATH", filePath); + String fileName = file.getName(); + dataObject.put("FILE_NAME", fileName); + + //TODO: + + + dataObjectList.add(dataObject); + }); + + return dataObjectList; /* 1. 연계형식: 파일 연계 @@ -56,7 +78,6 @@ public class XitRecommend implements EquipmentEnterprise{ 127.482432 37.362931 */ - return null; } }