소스 검색

修改下文件读取

luoguangyi 2 년 전
부모
커밋
d2c5cd51fb
2개의 변경된 파일12개의 추가작업 그리고 3개의 파일을 삭제
  1. 1 2
      pom.xml
  2. 11 1
      src/main/java/com/sagacloud/util/compute_engine/fjd/TableUtil.java

+ 1 - 2
pom.xml

@@ -156,9 +156,8 @@
                                     <includes>
                                         <include>*.properties</include>
                                         <include>*.yml</include>
-                                        <include>*.json</include>
                                         <include>*.conf</include>
-                                        <include>*.json</include>
+                                        <include>*.xml</include>
                                     </includes>
                                 </resource>
                             </resources>

+ 11 - 1
src/main/java/com/sagacloud/util/compute_engine/fjd/TableUtil.java

@@ -1,15 +1,20 @@
 package com.sagacloud.util.compute_engine.fjd;
 
 import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.io.resource.ResourceUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.JSONReader;
 import com.sagacloud.repository.HBaseSaveManagerRepository;
 import com.sagacloud.util.compute_engine.util.ConstantCE;
 import com.sagacloud.util.compute_engine.util.QueryUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.zillion.util.json.FastJsonReaderUtil;
+import org.zillion.util.json.FastJsonUtil;
 
 import java.io.File;
+import java.io.InputStreamReader;
+import java.io.Reader;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -208,7 +213,12 @@ public class TableUtil {
         if (table_name.startsWith("fjd_3")) {
             file_name = "fjd_2" + table_name.substring("fjd_2".length());
         }
-        JSONObject table_schema = FastJsonReaderUtil.Instance().ReadJSONObject(FileUtil.file("def_" + file_name + ".json"));
+        //JSONObject table_schema = FastJsonReaderUtil.Instance().ReadJSONObject(FileUtil.file("def_" + file_name + ".json"));
+        JSONReader json_reader = new JSONReader(ResourceUtil.getUtf8Reader("def_" + file_name + ".json"));
+        Object result = json_reader.readObject();
+        FastJsonUtil.Normalize(result);
+        JSONObject table_schema = (JSONObject)result;
+
         JSONArray Indexes = (JSONArray) table_schema.get("Indexes");
         table_schema.remove("Indexes");
         try {