|
@@ -1,5 +1,7 @@
|
|
|
package com.fdkankan.common.util;
|
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
import java.io.IOException;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -17,7 +19,11 @@ public class CreateHouseJsonUtil {
|
|
|
public static JSONObject createHouseTypeJsonByUser(String filePath) {
|
|
|
JSONObject house = init();
|
|
|
JSONArray floors = house.getJSONArray("floors");
|
|
|
-
|
|
|
+
|
|
|
+ String type = readType(filePath);
|
|
|
+ if(StrUtil.isEmpty(type) && !"cad".equals(type)){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
JSONArray floorJson = readFloorJson(filePath);
|
|
|
for(int i=0;i<floorJson.size();++i) {
|
|
|
JSONObject floor = floorJson.getJSONObject(i);
|
|
@@ -49,6 +55,16 @@ public class CreateHouseJsonUtil {
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private static String readType(String filePath) {
|
|
|
+ try {
|
|
|
+ JSONObject floorplanUser = FileUtil.readJson(filePath);
|
|
|
+ String type = floorplanUser.getString("type");
|
|
|
+ return type;
|
|
|
+ } catch (IOException e) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
private static JSONObject convert(JSONObject floorJson,int floor) {
|
|
|
JSONArray rooms = floorJson.getJSONArray("rooms");
|