diff --git a/src/main/java/cokr/xit/fims/crdn/parsing/AttachedTxtParser.java b/src/main/java/cokr/xit/fims/crdn/parsing/AttachedTxtParser.java
index 8f14f44f..e8a682b0 100644
--- a/src/main/java/cokr/xit/fims/crdn/parsing/AttachedTxtParser.java
+++ b/src/main/java/cokr/xit/fims/crdn/parsing/AttachedTxtParser.java
@@ -47,19 +47,9 @@ public class AttachedTxtParser extends LayoutParser{
this.refineValue(dataObject);
+ this.analyzeFileContent(dataObject, file);
-
- try {
-
- JSONParser jsonParser = new JSONParser(-1);
-
- JSONArray jsonArray = (JSONArray)jsonParser.parse(descriptor.getContentItems());
-
-
-
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
+ this.refineValue(dataObject);
if(!before.isEmpty()) {
boolean isChangeTempGroup = this.isChangeCrackdown(dataObject, before);
diff --git a/src/main/java/cokr/xit/fims/crdn/parsing/LayoutParser.java b/src/main/java/cokr/xit/fims/crdn/parsing/LayoutParser.java
index 48e39528..896941a0 100644
--- a/src/main/java/cokr/xit/fims/crdn/parsing/LayoutParser.java
+++ b/src/main/java/cokr/xit/fims/crdn/parsing/LayoutParser.java
@@ -111,6 +111,11 @@ abstract public class LayoutParser {
*/
public void refineValue(DataObject dataObject) {
+ //공백 제거
+ for(int i=0; i < allItem.length; i++) {
+ dataObject.put(allItem[i],dataObject.string(allItem[i]).trim());
+ }
+
//단속일시 설정
if(!dataObject.string("CRDN_TIMESTAMP").equals("")) {
dataObject.put("CRDN_YMD", dataObject.string("CRDN_TIMESTAMP").substring(0, 8));
@@ -125,6 +130,11 @@ abstract public class LayoutParser {
dataObject.put("CRDN_TIMESTAMP", dataObject.string("CRDN_YMD")+dataObject.string("CRDN_TM")+"000");
}
+ //숫자형 값에서 불필요한 0제거
+ String[] numberValues = {"PHOTO_CNT", "GPS_X", "GPS_Y", "MOSC_X", "MOSC_Y", "PLATE_WIDHT", "PLATE_HEIGHT"};
+ this.refineNumberValue(dataObject, numberValues);
+
+ //코드변환
CodeConverter codeConverter = new CodeConverter(allCode);
//위반내용
@@ -147,6 +157,35 @@ abstract public class LayoutParser {
codeConverter.fillIfEmpty(dataObject, "CRDN_CN", "CRDN_CN_CD", "CRDN_CN_NM");
}
+ /** dataObject 내에서 숫자형 데이터 항목을 정제한다.
+ * @param dataObject, items 숫자형 데이터 이름
+ * @return
+ */
+ public void refineNumberValue(DataObject dataObject, String[] items) {
+ for(int i=0;i
* @param dataObject
* @return
diff --git a/src/main/java/cokr/xit/fims/crdn/parsing/SingleFileParser.java b/src/main/java/cokr/xit/fims/crdn/parsing/SingleFileParser.java
index c8740bf4..fd67a958 100644
--- a/src/main/java/cokr/xit/fims/crdn/parsing/SingleFileParser.java
+++ b/src/main/java/cokr/xit/fims/crdn/parsing/SingleFileParser.java
@@ -39,9 +39,10 @@ public class SingleFileParser extends LayoutParser {
this.setFileDefaultInfo(dataObject, file);
-
this.analyzeFileContent(dataObject, file);
+ this.refineValue(dataObject);
+
dataObject.put("TEMP_GROUP_ID", tempGroupSeq);
tempGroupSeq++;
@@ -63,6 +64,7 @@ public class SingleFileParser extends LayoutParser {
JSONArray jsonArray = (JSONArray)jsonParser.parse(descriptor.getContentItems());
+ //텍스트 영역 파싱
BufferedReader textReader = new BufferedReader(new InputStreamReader(new FileInputStream(file), Charset.forName("EUC-KR")));
String textConent = CmmnUtil.substringByBytes(org.apache.commons.io.IOUtils.toString(textReader), 1, this.getSumByte(jsonArray));
@@ -88,7 +90,7 @@ public class SingleFileParser extends LayoutParser {
}
}
-
+ //이미지 영역 파싱
BufferedReader imageReader = new BufferedReader(new InputStreamReader(new FileInputStream(file), Charset.forName("ISO-8859-1")));
String imgContent = org.apache.commons.io.IOUtils.toString(imageReader).substring(this.getSumByte(jsonArray));