Merge branch 'main' of http://xit.xit-git.com:3000/xit-app/fims
commit
afd63db048
@ -0,0 +1,13 @@
|
|||||||
|
package cokr.xit.fims.crdn.parsing;
|
||||||
|
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import cokr.xit.foundation.data.DataObject;
|
||||||
|
|
||||||
|
public interface EquipmentEnterprise {
|
||||||
|
|
||||||
|
public List<DataObject> parsing(Stream<Path> fileList);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,79 @@
|
|||||||
|
package cokr.xit.fims.crdn.parsing;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import org.apache.commons.io.FilenameUtils;
|
||||||
|
|
||||||
|
import cokr.xit.foundation.data.DataObject;
|
||||||
|
|
||||||
|
public class Ino implements EquipmentEnterprise {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DataObject> parsing(Stream<Path> fileList) {
|
||||||
|
|
||||||
|
List<DataObject> dataObjectList = new ArrayList<>();
|
||||||
|
|
||||||
|
fileList.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);
|
||||||
|
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd / HH:mm:ss");
|
||||||
|
dataObject.put("TIMESTAMP", sdf.format(new Date(file.lastModified())));
|
||||||
|
dataObject.put("FILE_SIZE", file.length()+" byte");
|
||||||
|
|
||||||
|
String extension = FilenameUtils.getExtension(fileName);
|
||||||
|
dataObject.put("EXTENSION", extension);
|
||||||
|
|
||||||
|
String[] fileNameSplit = FilenameUtils.removeExtension(fileName).split(Matcher.quoteReplacement("_"));
|
||||||
|
|
||||||
|
dataObject.put("DEVICE_ID", fileNameSplit[0]);
|
||||||
|
dataObject.put("CRDN_YMD_TM", fileNameSplit[1]);
|
||||||
|
dataObject.put("VHRNO", fileNameSplit[2]);
|
||||||
|
dataObject.put("PHOTO_CNT", fileNameSplit[3]);
|
||||||
|
|
||||||
|
String photoSeq = fileNameSplit[4];
|
||||||
|
if(photoSeq.equals("1")) photoSeq = "입차사진";
|
||||||
|
else if(photoSeq.equals("2")) photoSeq = "주차사진";
|
||||||
|
else if(photoSeq.equals("3")) photoSeq = "위반사진";
|
||||||
|
else if(photoSeq.equals("4")) photoSeq = "출차사진";
|
||||||
|
|
||||||
|
dataObject.put("PHOTO_SEQ", photoSeq);
|
||||||
|
|
||||||
|
dataObject.put("LOCATION_X", fileNameSplit[5]);
|
||||||
|
dataObject.put("LOCATION_Y", fileNameSplit[6]);
|
||||||
|
|
||||||
|
String inputSe = fileNameSplit[7];
|
||||||
|
if(inputSe.equals("S")) inputSe = "정상등록자료";
|
||||||
|
else if(inputSe.equals("E")) inputSe = "삭제자료";
|
||||||
|
|
||||||
|
dataObject.put("INPUT_SE", inputSe);
|
||||||
|
dataObject.put("CRDN_PLC", fileNameSplit[8]);
|
||||||
|
dataObject.put("CRDN_ADDRESS", fileNameSplit[9]);
|
||||||
|
dataObject.put("CRDN_STDG_NM", fileNameSplit[10]);
|
||||||
|
|
||||||
|
if(fileNameSplit.length >= 12) {
|
||||||
|
String crdnCn = fileNameSplit[11];
|
||||||
|
if(crdnCn.equals("00")) crdnCn = "사용안함";
|
||||||
|
else if(crdnCn.equals("01")) crdnCn = "일반차량(전기차)";
|
||||||
|
else if(crdnCn.equals("02")) crdnCn = "장기주차(전기차)";
|
||||||
|
dataObject.put("CRDN_CN", crdnCn);
|
||||||
|
}
|
||||||
|
|
||||||
|
dataObjectList.add(dataObject);
|
||||||
|
});
|
||||||
|
|
||||||
|
return dataObjectList;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package cokr.xit.fims.crdn.parsing;
|
||||||
|
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import cokr.xit.foundation.data.DataObject;
|
||||||
|
|
||||||
|
public class Knl implements EquipmentEnterprise {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DataObject> parsing(Stream<Path> fileList) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue