|
@@ -64,10 +64,30 @@ public class ToolUtil {
|
|
|
SETDLS2GeneralZone.put(objFrom, objTo);
|
|
|
}
|
|
|
|
|
|
- String[] ids = { "louti", "louti", "jingguan", "jingguan", "biaozhi", "biaozhi" };
|
|
|
- String[] levels = { "楼体照明", "楼体照明", "景观照明", "景观照明", "标识照明", "标识照明" };
|
|
|
- String[] types = { "A", "B", "A", "B", "A", "B" };
|
|
|
- JSONArray result = new JSONArray();
|
|
|
+ String[] ids_yejing = { "louti", "jingguan", "biaozhi" };
|
|
|
+ String[] levels_yejing = { "楼体照明", "景观照明", "标识照明" };
|
|
|
+ String[] types_yejing = { "A", "B", "C", "D" };
|
|
|
+ String[] ids_gonggong = { "tingche", "buxing", "yule", "qiongding" };
|
|
|
+ String[] levels_gonggong = { "停车场照明", "步行街照明", "娱乐楼", "穹顶灯" };
|
|
|
+ String[] types_gonggong = { "A", "B", "C", "D" };
|
|
|
+ String[] ids;
|
|
|
+ String[] levels;
|
|
|
+ String[] types;
|
|
|
+ if (is_public) {
|
|
|
+ ids = ids_gonggong;
|
|
|
+ levels = levels_gonggong;
|
|
|
+ types = types_gonggong;
|
|
|
+ } else {
|
|
|
+ ids = ids_yejing;
|
|
|
+ levels = levels_yejing;
|
|
|
+ types = types_yejing;
|
|
|
+ }
|
|
|
+
|
|
|
+ JSONArray level1Array = new JSONArray();
|
|
|
+ JSONArray level2Array = new JSONArray();
|
|
|
+ Map<String, Boolean> level1Map = new HashMap<String, Boolean>();
|
|
|
+ Map<String, Boolean> level2Map = new HashMap<String, Boolean>();
|
|
|
+ JSONArray huiluArray = new JSONArray();
|
|
|
for (String SELTCC : SELTCC2SELTCU.keySet()) {
|
|
|
if (!SELTCC2SELTCU.containsKey(SELTCC)) {
|
|
|
continue;
|
|
@@ -83,7 +103,9 @@ public class ToolUtil {
|
|
|
GeneralZone = SETDLS2GeneralZone.get(SETDLS);
|
|
|
}
|
|
|
|
|
|
- int index = BKDRHash.getHashCode(SELTCC) % levels.length;
|
|
|
+ int index = BKDRHash.getHashCode(SELTCC) % (levels.length * types.length);
|
|
|
+ int index_level = index / types.length;
|
|
|
+ int index_type = index % types.length;
|
|
|
JSONObject item = new JSONObject();
|
|
|
item.put("回路编号", SELTCC);
|
|
|
if (SELTCU != null && SELTCUMap.containsKey(SELTCU)) {
|
|
@@ -107,23 +129,64 @@ public class ToolUtil {
|
|
|
item.put("电井编号", null);
|
|
|
item.put("电井名称", null);
|
|
|
}
|
|
|
- item.put("编组类型", types[index]);
|
|
|
+ item.put("编组类型", types[index_type]);
|
|
|
if (is_public) {
|
|
|
String floor = SELTCC2floor.get(SELTCC);
|
|
|
if (floor != null) {
|
|
|
- item.put("楼层", floor);
|
|
|
- item.put("二级编组", ids[index] + "-" + floorMap.get(floor).get("localId") + "-" + types[index]);
|
|
|
- item.put("二级编组名称", levels[index] + "-" + floorMap.get(floor).get("localId") + "-" + types[index]);
|
|
|
- item.put("一级编组", ids[index]);
|
|
|
- item.put("一级编组名称", levels[index]);
|
|
|
- result.add(item);
|
|
|
+ String floorName=(String)floorMap.get(floor).get("localName");
|
|
|
+ String level1id = ids[index_level];
|
|
|
+ String level1name = levels[index_level];
|
|
|
+ String level2id = ids[index_level] + "-" + floorMap.get(floor).get("localId") + "-" + types[index_type];
|
|
|
+ String level2name = levels[index_level] + "-" + floorMap.get(floor).get("localId") + "-" + types[index_type];
|
|
|
+ item.put("楼层编号", floor);
|
|
|
+ item.put("楼层名称", floorName);
|
|
|
+ item.put("二级编组", level2id);
|
|
|
+ item.put("二级编组名称", level2name);
|
|
|
+ item.put("一级编组", level1id);
|
|
|
+ item.put("一级编组名称", level1name);
|
|
|
+ huiluArray.add(item);
|
|
|
+ if (!level1Map.containsKey(level1id)) {
|
|
|
+ level1Map.put(level1id, true);
|
|
|
+ JSONObject level1item = new JSONObject();
|
|
|
+ level1item.put("id", level1id);
|
|
|
+ level1item.put("name", level1name);
|
|
|
+ level1Array.add(level1item);
|
|
|
+ }
|
|
|
+ if (!level2Map.containsKey(level2id)) {
|
|
|
+ level2Map.put(level2id, true);
|
|
|
+ JSONObject level2item = new JSONObject();
|
|
|
+ level2item.put("id", level2id);
|
|
|
+ level2item.put("name", level2name);
|
|
|
+ level2item.put("一级编组", level1id);
|
|
|
+ level2item.put("楼层编号", floor);
|
|
|
+ level2Array.add(level2item);
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
- item.put("二级编组", ids[index] + "-" + types[index]);
|
|
|
- item.put("二级编组名称", levels[index] + "-" + types[index]);
|
|
|
- item.put("一级编组", ids[index]);
|
|
|
- item.put("一级编组名称", levels[index]);
|
|
|
- result.add(item);
|
|
|
+ String level1id = ids[index_level];
|
|
|
+ String level1name = levels[index_level];
|
|
|
+ String level2id = ids[index_level] + "-" + types[index_type];
|
|
|
+ String level2name = levels[index_level] + "-" + types[index_type];
|
|
|
+ item.put("二级编组", level2id);
|
|
|
+ item.put("二级编组名称", level2name);
|
|
|
+ item.put("一级编组", level1id);
|
|
|
+ item.put("一级编组名称", level1name);
|
|
|
+ huiluArray.add(item);
|
|
|
+ if (!level1Map.containsKey(level1id)) {
|
|
|
+ level1Map.put(level1id, true);
|
|
|
+ JSONObject level1item = new JSONObject();
|
|
|
+ level1item.put("id", level1id);
|
|
|
+ level1item.put("name", level1name);
|
|
|
+ level1Array.add(level1item);
|
|
|
+ }
|
|
|
+ if (!level2Map.containsKey(level2id)) {
|
|
|
+ level2Map.put(level2id, true);
|
|
|
+ JSONObject level2item = new JSONObject();
|
|
|
+ level2item.put("id", level2id);
|
|
|
+ level2item.put("name", level2name);
|
|
|
+ level2item.put("一级编组", level1id);
|
|
|
+ level2Array.add(level2item);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -132,6 +195,10 @@ public class ToolUtil {
|
|
|
// JSONArray peidianxiang = getArray_object("equipment", "SETDLS");
|
|
|
// JSONArray dianjing = getArray_object("space", "GeneralZone");
|
|
|
|
|
|
+ JSONObject result = new JSONObject();
|
|
|
+ result.put("回路", huiluArray);
|
|
|
+ result.put("一级编组", level1Array);
|
|
|
+ result.put("二级编组", level2Array);
|
|
|
return FastJsonUtil.toFormatString(result);
|
|
|
}
|
|
|
|