|
|
@ -1,17 +1,20 @@
|
|
|
|
package cokr.xit.fims.crdn.parsing;
|
|
|
|
package cokr.xit.fims.crdn.parsing;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.ByteArrayInputStream;
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
|
import java.io.InputStream;
|
|
|
|
import java.nio.charset.Charset;
|
|
|
|
import java.nio.charset.Charset;
|
|
|
|
import java.nio.file.Files;
|
|
|
|
import java.nio.file.Files;
|
|
|
|
import java.nio.file.Path;
|
|
|
|
import java.nio.file.Path;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Base64;
|
|
|
|
import java.util.Base64;
|
|
|
|
|
|
|
|
import java.util.Base64.Decoder;
|
|
|
|
import java.util.Base64.Encoder;
|
|
|
|
import java.util.Base64.Encoder;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.stream.Stream;
|
|
|
|
import java.util.stream.Stream;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cokr.xit.base.file.FileInfo;
|
|
|
|
import cokr.xit.fims.cmmn.CmmnUtil;
|
|
|
|
import cokr.xit.fims.cmmn.CmmnUtil;
|
|
|
|
import cokr.xit.foundation.data.DataObject;
|
|
|
|
import cokr.xit.foundation.data.DataObject;
|
|
|
|
|
|
|
|
|
|
|
@ -44,11 +47,10 @@ public class HiteCom implements EquipmentEnterprise {
|
|
|
|
String fileCn = "";
|
|
|
|
String fileCn = "";
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
fileCn = new String(fileCn0.getBytes("ISO-8859-1"), "EUC-KR");
|
|
|
|
fileCn = new String(fileCn0.getBytes("ISO-8859-1"), "EUC-KR");
|
|
|
|
} catch (UnsupportedEncodingException e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("substring....");
|
|
|
|
|
|
|
|
dataObject.put("TEXT_SIZE", CmmnUtil.substringByBytes(fileCn, 0, 7));
|
|
|
|
dataObject.put("TEXT_SIZE", CmmnUtil.substringByBytes(fileCn, 0, 7));
|
|
|
|
dataObject.put("EQUIPMENT", CmmnUtil.substringByBytes(fileCn, 8, 12));
|
|
|
|
dataObject.put("EQUIPMENT", CmmnUtil.substringByBytes(fileCn, 8, 12));
|
|
|
|
dataObject.put("CAR_VELOCITY", CmmnUtil.substringByBytes(fileCn, 13, 15).replaceAll("^0+", "")); //차량속도
|
|
|
|
dataObject.put("CAR_VELOCITY", CmmnUtil.substringByBytes(fileCn, 13, 15).replaceAll("^0+", "")); //차량속도
|
|
|
@ -122,8 +124,8 @@ public class HiteCom implements EquipmentEnterprise {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
tempGroupSeq++;
|
|
|
|
|
|
|
|
dataObject.put("TEMP_GROUP_ID", tempGroupSeq);
|
|
|
|
dataObject.put("TEMP_GROUP_ID", tempGroupSeq);
|
|
|
|
|
|
|
|
tempGroupSeq++;
|
|
|
|
dataObject.put("ENT_TYPE", "hitecom");
|
|
|
|
dataObject.put("ENT_TYPE", "hitecom");
|
|
|
|
|
|
|
|
|
|
|
|
dataObjectList.add(dataObject);
|
|
|
|
dataObjectList.add(dataObject);
|
|
|
@ -137,4 +139,22 @@ public class HiteCom implements EquipmentEnterprise {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static FileInfo base64ToFileInfo(String fileName, String base64str, int sortOrder) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
Decoder decoder = Base64.getDecoder();
|
|
|
|
|
|
|
|
byte[] b64byte = decoder.decode(base64str.getBytes("ISO-8859-1"));
|
|
|
|
|
|
|
|
InputStream is = new ByteArrayInputStream(b64byte);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FileInfo fileInfo = new FileInfo();
|
|
|
|
|
|
|
|
fileInfo.setName(fileName+".jpg");
|
|
|
|
|
|
|
|
fileInfo.setInputStream(is);
|
|
|
|
|
|
|
|
fileInfo.setMimeType("image/jpeg");
|
|
|
|
|
|
|
|
fileInfo.setSize(is.available());
|
|
|
|
|
|
|
|
fileInfo.setSortOrder(sortOrder);
|
|
|
|
|
|
|
|
return fileInfo;
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|