|
@@ -15,12 +15,31 @@ public class ToolUtil {
|
|
JSONObject paramObject = JSON.parseObject(param);
|
|
JSONObject paramObject = JSON.parseObject(param);
|
|
String type = (String) paramObject.get("type");
|
|
String type = (String) paramObject.get("type");
|
|
if (type.equals("NightscapeLighting")) {
|
|
if (type.equals("NightscapeLighting")) {
|
|
- result = NightscapeLighting();
|
|
|
|
|
|
+ result = Lighting(false);
|
|
|
|
+ } else if (type.equals("PublicLighting")) {
|
|
|
|
+ result = Lighting(true);
|
|
}
|
|
}
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
- private static String NightscapeLighting() {
|
|
|
|
|
|
+ private static String Lighting(boolean is_public) {
|
|
|
|
+ Map<String, JSONObject> floorMap = new HashMap<String, JSONObject>();
|
|
|
|
+ JSONArray floorArray = getArray_object("floor", null);
|
|
|
|
+ for (int i = 0; i < floorArray.size(); i++) {
|
|
|
|
+ JSONObject item = (JSONObject) floorArray.get(i);
|
|
|
|
+ String id = (String) item.get("id");
|
|
|
|
+ floorMap.put(id, item);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ JSONArray louceng = getArray_relation("MechInArch", "Eq2Fl");
|
|
|
|
+ Map<String, String> SELTCC2floor = new HashMap<String, String>();
|
|
|
|
+ for (int i = 0; i < louceng.size(); i++) {
|
|
|
|
+ JSONObject item = (JSONObject) louceng.get(i);
|
|
|
|
+ String objFrom = item.getString("objFrom");
|
|
|
|
+ String objTo = item.getString("objTo");
|
|
|
|
+ SELTCC2floor.put(objFrom, objTo);
|
|
|
|
+ }
|
|
|
|
+
|
|
JSONArray kongzhi = getArray_relation("MechCtrl", "EqCtrl");
|
|
JSONArray kongzhi = getArray_relation("MechCtrl", "EqCtrl");
|
|
Map<String, String> SELTCC2SELTCU = new HashMap<String, String>();
|
|
Map<String, String> SELTCC2SELTCU = new HashMap<String, String>();
|
|
for (int i = 0; i < kongzhi.size(); i++) {
|
|
for (int i = 0; i < kongzhi.size(); i++) {
|
|
@@ -52,15 +71,20 @@ public class ToolUtil {
|
|
String[] types = { "A", "B", "A", "B" };
|
|
String[] types = { "A", "B", "A", "B" };
|
|
JSONArray result = new JSONArray();
|
|
JSONArray result = new JSONArray();
|
|
for (String SELTCC : SELTCC2SELTCU.keySet()) {
|
|
for (String SELTCC : SELTCC2SELTCU.keySet()) {
|
|
|
|
+ if (!SELTCC2SELTCU.containsKey(SELTCC)) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
String SELTCU = SELTCC2SELTCU.get(SELTCC);
|
|
String SELTCU = SELTCC2SELTCU.get(SELTCC);
|
|
- String SETDLS = null;
|
|
|
|
- if (SELTCU != null && SELTCU2SETDLS.containsKey(SELTCU)) {
|
|
|
|
- SETDLS = SELTCU2SETDLS.get(SELTCU);
|
|
|
|
|
|
+ if (!SELTCU2SETDLS.containsKey(SELTCU)) {
|
|
|
|
+ continue;
|
|
}
|
|
}
|
|
|
|
+ String SETDLS = SELTCU2SETDLS.get(SELTCU);
|
|
|
|
+
|
|
String GeneralZone = null;
|
|
String GeneralZone = null;
|
|
if (SETDLS != null && SETDLS2GeneralZone.containsKey(SETDLS)) {
|
|
if (SETDLS != null && SETDLS2GeneralZone.containsKey(SETDLS)) {
|
|
GeneralZone = SETDLS2GeneralZone.get(SETDLS);
|
|
GeneralZone = SETDLS2GeneralZone.get(SETDLS);
|
|
}
|
|
}
|
|
|
|
+
|
|
int index = BKDRHash.getHashCode(SELTCC) % levels.length;
|
|
int index = BKDRHash.getHashCode(SELTCC) % levels.length;
|
|
JSONObject item = new JSONObject();
|
|
JSONObject item = new JSONObject();
|
|
item.put("回路编号", SELTCC);
|
|
item.put("回路编号", SELTCC);
|
|
@@ -68,9 +92,19 @@ public class ToolUtil {
|
|
item.put("配电箱编号", SETDLS);
|
|
item.put("配电箱编号", SETDLS);
|
|
item.put("电井编号", GeneralZone);
|
|
item.put("电井编号", GeneralZone);
|
|
item.put("类型", types[index]);
|
|
item.put("类型", types[index]);
|
|
- item.put("二级编组", levels[index] + "-" + types[index]);
|
|
|
|
- item.put("一级编组", levels[index]);
|
|
|
|
- result.add(item);
|
|
|
|
|
|
+ if (is_public) {
|
|
|
|
+ String floor = SELTCC2floor.get(SELTCC);
|
|
|
|
+ if (floor != null) {
|
|
|
|
+ item.put("楼层", floor);
|
|
|
|
+ item.put("二级编组", levels[index] + "-" + floorMap.get(floor).get("localId") + "-" + types[index]);
|
|
|
|
+ item.put("一级编组", levels[index]);
|
|
|
|
+ result.add(item);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ item.put("二级编组", levels[index] + "-" + types[index]);
|
|
|
|
+ item.put("一级编组", levels[index]);
|
|
|
|
+ result.add(item);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
// JSONArray huilu = getArray_object("equipment", "SELTCC");
|
|
// JSONArray huilu = getArray_object("equipment", "SELTCC");
|