|
@@ -328,9 +328,9 @@ public class PlatBuildingServiceImpl implements IPlatBuildingService {
|
|
|
List<Map<String, Object>> b = repeatElectricity(y);
|
|
|
List<Map<String, Object>> c = repeatElectricity(z);
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
- map.put("一号配电室", a);
|
|
|
- map.put("二号配电室", b);
|
|
|
- map.put("三号配电室", c);
|
|
|
+ map.put("first", a);
|
|
|
+ map.put("second", b);
|
|
|
+ map.put("third", c);
|
|
|
return map;
|
|
|
}
|
|
|
|
|
@@ -339,13 +339,28 @@ public class PlatBuildingServiceImpl implements IPlatBuildingService {
|
|
|
JSONArray x = JSONArray.parseArray(largeBuildingControl.getRoomLoadOne());
|
|
|
JSONArray y = JSONArray.parseArray(largeBuildingControl.getRoomLoadTwo());
|
|
|
JSONArray z = JSONArray.parseArray(largeBuildingControl.getRoomLoadThree());
|
|
|
- List<Map<String, Object>> a = repeatLoad(x);
|
|
|
- List<Map<String, Object>> b = repeatLoad(y);
|
|
|
- List<Map<String, Object>> c = repeatLoad(z);
|
|
|
+ List<Integer> a = new ArrayList<>();
|
|
|
+ List<Integer> b = new ArrayList<>();
|
|
|
+ List<Integer> c = new ArrayList<>();
|
|
|
+ for (Object it : x){
|
|
|
+ JSONObject jsonObject = (JSONObject) it;
|
|
|
+ Integer value = (Integer) jsonObject.values().iterator().next();
|
|
|
+ a.add(value);
|
|
|
+ }
|
|
|
+ for (Object it : y){
|
|
|
+ JSONObject jsonObject = (JSONObject) it;
|
|
|
+ Integer value = (Integer) jsonObject.values().iterator().next();
|
|
|
+ b.add(value);
|
|
|
+ }
|
|
|
+ for (Object it : z){
|
|
|
+ JSONObject jsonObject = (JSONObject) it;
|
|
|
+ Integer value = (Integer) jsonObject.values().iterator().next(); // 获取第一个值(每个 JSON 对象只有一个键值对)
|
|
|
+ c.add(value);
|
|
|
+ }
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
- map.put("一号配电室", a);
|
|
|
- map.put("二号配电室", b);
|
|
|
- map.put("三号配电室", c);
|
|
|
+ map.put("first", a);
|
|
|
+ map.put("second", b);
|
|
|
+ map.put("third", c);
|
|
|
return map;
|
|
|
}
|
|
|
|
|
@@ -353,14 +368,14 @@ public class PlatBuildingServiceImpl implements IPlatBuildingService {
|
|
|
LargeBuildingControl largeBuildingControl = platBuildingMapper.getWarnDevice();
|
|
|
JSONObject jsonObject = JSONObject.parseObject(largeBuildingControl.getWarnDevice());
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
- JSONObject water = jsonObject.getJSONObject("水浸");
|
|
|
- water.put("正常点位", largeBuildingControl.getWaterControlNormalNum() + largeBuildingControl.getWaterDeviceAirNum());
|
|
|
+ JSONObject water = jsonObject.getJSONObject("sj");
|
|
|
+ water.put("normal", largeBuildingControl.getWaterControlNormalNum() + largeBuildingControl.getWaterDeviceAirNum());
|
|
|
water.put("air", largeBuildingControl.getWaterDeviceAirNum());
|
|
|
water.put("control", largeBuildingControl.getWaterControlNormalNum() + largeBuildingControl.getWaterControlAbnormalNum());
|
|
|
- map.put("电表", repeatWarnDevice(jsonObject.getJSONObject("电表")));
|
|
|
- map.put("液位计", repeatWarnDevice(jsonObject.getJSONObject("液位计")));
|
|
|
- map.put("水浸", repeatWarnDevice(water));
|
|
|
- map.put("烟雾", repeatWarnDevice(jsonObject.getJSONObject("烟雾")));
|
|
|
+ map.put("db", repeatWarnDevice(jsonObject.getJSONObject("db")));
|
|
|
+ map.put("ywj", repeatWarnDevice(jsonObject.getJSONObject("ywj")));
|
|
|
+ map.put("sj", repeatWarnDevice(water));
|
|
|
+ map.put("yw", repeatWarnDevice(jsonObject.getJSONObject("yw")));
|
|
|
return map;
|
|
|
}
|
|
|
|
|
@@ -373,32 +388,18 @@ public class PlatBuildingServiceImpl implements IPlatBuildingService {
|
|
|
public Map<String, Object> getWarnState(){
|
|
|
LargeBuildingControl largeBuildingControl = platBuildingMapper.getWarnState();
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
- map.put("23F", largeBuildingControl.getWaterStateOne());
|
|
|
- map.put("-2F", largeBuildingControl.getWaterStateTwo());
|
|
|
+ map.put("23F", JSONObject.parseObject(largeBuildingControl.getWaterStateOne()));
|
|
|
+ map.put("-2F", JSONObject.parseObject(largeBuildingControl.getWaterStateTwo()));
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
|
|
|
private JSONObject repeatWarnDevice(JSONObject jsonObject){
|
|
|
- jsonObject.put("total", Long.valueOf(jsonObject.getString("正常点位")) + Long.valueOf(jsonObject.getString("异常点位")));
|
|
|
+ Long x = Long.parseLong(jsonObject.getString("zcdw")) + Long.parseLong(jsonObject.getString("ycdw"));
|
|
|
+ jsonObject.put("total", x);
|
|
|
return jsonObject;
|
|
|
}
|
|
|
|
|
|
- private List<Map<String, Object>> repeatLoad(JSONArray jsonArray){
|
|
|
- List<Map<String, Object>> list = new ArrayList<>();
|
|
|
- for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
- JSONObject item = jsonArray.getJSONObject(i);
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
- map.put("空载", item.getString("空载"));
|
|
|
- map.put("轻载", item.getString("轻载"));
|
|
|
- map.put("正常", item.getString("正常"));
|
|
|
- map.put("重载", item.getString("重载"));
|
|
|
- map.put("过载", item.getString("过载"));
|
|
|
- list.add(map);
|
|
|
- }
|
|
|
- return list;
|
|
|
- }
|
|
|
-
|
|
|
private List<Map<String, Object>> repeatElectricity(JSONArray jsonArray){
|
|
|
List<Map<String, Object>> list = new ArrayList<>();
|
|
|
for (int i = 0; i < jsonArray.size(); i++) {
|