|
@@ -631,73 +631,26 @@ public class ImportDataController extends BaseController {
|
|
|
}
|
|
|
|
|
|
Map<String, Double> map = null;
|
|
|
- Boolean isV2 = FileUtils.downLoadFromUrl("https://4dkk.4dage.com/data/data" + num + "/houst_floor.json?t=" + System.currentTimeMillis(),
|
|
|
+ boolean isV1 = FileUtils.downLoadFromUrl("https://4dkk.4dage.com/data/data" + num + "/floor.json?t=" + System.currentTimeMillis(),
|
|
|
"floor.json", basePath);
|
|
|
- ImportDataController.log.info("下载V2版本houst_floor-{},状态={}", num, isV2);
|
|
|
- if (!isV2) {
|
|
|
- boolean isV1 = FileUtils.downLoadFromUrl("https://4dkk.4dage.com/data/data" + num + "/floor.json?t=" + System.currentTimeMillis(),
|
|
|
- "floor.json", basePath);
|
|
|
- ImportDataController.log.info("下载V1版本floor-{},状态={}", num, isV1);
|
|
|
- }
|
|
|
+ ImportDataController.log.info("下载V1版本floor-{},状态={}", num, isV1);
|
|
|
ConvertCadKjl cad = new ConvertCadKjl();
|
|
|
String data = FileUtils.readFile(basePath + File.separator + "floor.json");
|
|
|
JSONObject inputJson = null;
|
|
|
JSONArray inputArray = null;
|
|
|
JSONArray resultArray = new JSONArray();
|
|
|
- if (isV2) {
|
|
|
- ReadFloorplan m_readFloorplan = new ReadFloorplan();
|
|
|
- JSONObject V2cad = m_readFloorplan.readFile(basePath + File.separator + "floor.json");
|
|
|
- JSONArray floors = V2cad.getJSONArray("floors");
|
|
|
- // resultJson.put("floors", V2data);交给下面的方法处理
|
|
|
- m_readFloorplan.analysisCadJsonObj(floors, resultJson);
|
|
|
-
|
|
|
- } else {
|
|
|
- if (StrUtil.isNotEmpty(data)) {
|
|
|
- inputJson = JSON.parseObject(data);
|
|
|
- if (inputJson.containsKey("floors")) {
|
|
|
- inputArray = inputJson.getJSONArray("floors");
|
|
|
- for (int i = 0, len = inputArray.size(); i < len; i++) {
|
|
|
- cad = new ConvertCadKjl();
|
|
|
- cad.init(inputArray.getJSONObject(i));
|
|
|
- cad.input = cad.preHandle(cad.input);
|
|
|
- JSONArray beams = cad.getBeams();
|
|
|
- JSONArray walls = ObjectUtil.isNotNull(cad.getWalls()) ? cad.getWalls() : new JSONArray();
|
|
|
- //判断是否需要重复出去墙
|
|
|
- AtomicBoolean removeAgain = new AtomicBoolean(false);
|
|
|
- walls = cad.removeRepeat(walls);
|
|
|
-
|
|
|
- JSONArray rooms = cad.getRooms();
|
|
|
- JSONArray flues = cad.getFlues();
|
|
|
- JSONArray holes = cad.getHoles();
|
|
|
-
|
|
|
- cad.output.put("holes", holes);
|
|
|
- cad.output.put("flues", flues);
|
|
|
- cad.output.put("beams", beams);
|
|
|
- cad.output.put("rooms", rooms);
|
|
|
- cad.output.put("walls", walls);
|
|
|
-
|
|
|
- map = ConvertCadKjl.getMaxOrMinValue(inputArray.getJSONObject(i));
|
|
|
-
|
|
|
- if (map != null) {
|
|
|
- JSONObject scene = new JSONObject();
|
|
|
- scene.put("bottom", map.get("translationAverage"));
|
|
|
- scene.put("top", map.get("puckAverage") == null ? null : map.get("puckAverage"));
|
|
|
- cad.output.put("scene", scene);
|
|
|
- }
|
|
|
-
|
|
|
- cad.output.put("version", floorPublishVer);
|
|
|
- resultArray.add(cad.output);
|
|
|
- }
|
|
|
- resultJson.put("floors", resultArray);
|
|
|
-
|
|
|
- } else {
|
|
|
- cad.init(inputJson);
|
|
|
+ if (StrUtil.isNotEmpty(data)) {
|
|
|
+ inputJson = JSON.parseObject(data);
|
|
|
+ if (inputJson.containsKey("floors")) {
|
|
|
+ inputArray = inputJson.getJSONArray("floors");
|
|
|
+ for (int i = 0, len = inputArray.size(); i < len; i++) {
|
|
|
+ cad = new ConvertCadKjl();
|
|
|
+ cad.init(inputArray.getJSONObject(i));
|
|
|
cad.input = cad.preHandle(cad.input);
|
|
|
JSONArray beams = cad.getBeams();
|
|
|
- JSONArray walls = cad.getWalls();
|
|
|
+ JSONArray walls = ObjectUtil.isNotNull(cad.getWalls()) ? cad.getWalls() : new JSONArray();
|
|
|
//判断是否需要重复出去墙
|
|
|
AtomicBoolean removeAgain = new AtomicBoolean(false);
|
|
|
- //去除重复的墙
|
|
|
walls = cad.removeRepeat(walls);
|
|
|
|
|
|
JSONArray rooms = cad.getRooms();
|
|
@@ -710,7 +663,7 @@ public class ImportDataController extends BaseController {
|
|
|
cad.output.put("rooms", rooms);
|
|
|
cad.output.put("walls", walls);
|
|
|
|
|
|
- map = ConvertCadKjl.getMaxOrMinValue(inputJson);
|
|
|
+ map = ConvertCadKjl.getMaxOrMinValue(inputArray.getJSONObject(i));
|
|
|
|
|
|
if (map != null) {
|
|
|
JSONObject scene = new JSONObject();
|
|
@@ -720,10 +673,43 @@ public class ImportDataController extends BaseController {
|
|
|
}
|
|
|
|
|
|
cad.output.put("version", floorPublishVer);
|
|
|
- resultJson = cad.output;
|
|
|
+ resultArray.add(cad.output);
|
|
|
}
|
|
|
+ resultJson.put("floors", resultArray);
|
|
|
+
|
|
|
+ } else {
|
|
|
cad.init(inputJson);
|
|
|
+ cad.input = cad.preHandle(cad.input);
|
|
|
+ JSONArray beams = cad.getBeams();
|
|
|
+ JSONArray walls = cad.getWalls();
|
|
|
+ //判断是否需要重复出去墙
|
|
|
+ AtomicBoolean removeAgain = new AtomicBoolean(false);
|
|
|
+ //去除重复的墙
|
|
|
+ walls = cad.removeRepeat(walls);
|
|
|
+
|
|
|
+ JSONArray rooms = cad.getRooms();
|
|
|
+ JSONArray flues = cad.getFlues();
|
|
|
+ JSONArray holes = cad.getHoles();
|
|
|
+
|
|
|
+ cad.output.put("holes", holes);
|
|
|
+ cad.output.put("flues", flues);
|
|
|
+ cad.output.put("beams", beams);
|
|
|
+ cad.output.put("rooms", rooms);
|
|
|
+ cad.output.put("walls", walls);
|
|
|
+
|
|
|
+ map = ConvertCadKjl.getMaxOrMinValue(inputJson);
|
|
|
+
|
|
|
+ if (map != null) {
|
|
|
+ JSONObject scene = new JSONObject();
|
|
|
+ scene.put("bottom", map.get("translationAverage"));
|
|
|
+ scene.put("top", map.get("puckAverage") == null ? null : map.get("puckAverage"));
|
|
|
+ cad.output.put("scene", scene);
|
|
|
+ }
|
|
|
+
|
|
|
+ cad.output.put("version", floorPublishVer);
|
|
|
+ resultJson = cad.output;
|
|
|
}
|
|
|
+ cad.init(inputJson);
|
|
|
}
|
|
|
|
|
|
|