|
@@ -294,22 +294,18 @@ public class PlatBuildingServiceImpl implements IPlatBuildingService {
|
|
|
}
|
|
|
|
|
|
public Map<String, Object> getThisWeekElectricity(){
|
|
|
+ String str = "[{\"number\":\"1# 1-3\",\"EqName\":\"设备名称\",\"type\":\"设备所属类别\",\"Kwh\":\"56.2\"},{\"number\":\"1# 1-3\",\"EqName\":\"设备名称\",\"type\":\"设备所属类别\",\"Kwh\":\"56.2\"},{\"number\":\"1# 1-3\",\"EqName\":\"设备名称\",\"type\":\"设备所属类别\",\"Kwh\":\"56.2\"},{\"number\":\"1# 1-3\",\"EqName\":\"设备名称\",\"type\":\"设备所属类别\",\"Kwh\":\"56.2\"},{\"number\":\"1# 1-3\",\"EqName\":\"设备名称\",\"type\":\"设备所属类别\",\"Kwh\":\"56.2\"}]";
|
|
|
+ JSONArray jsonArray = new JSONArray(str);
|
|
|
LargeBuildingControl largeBuildingControl = platBuildingMapper.getThisWeekElectricity();
|
|
|
JSONArray weekElectricity = JSONArray.parseArray(largeBuildingControl.getWeekElectricity());
|
|
|
+ for (Object obj : weekElectricity){
|
|
|
+ JSONObject jsonObject = (JSONObject) obj;
|
|
|
+ jsonObject.put("detail", jsonArray);
|
|
|
+ }
|
|
|
JSONArray roomElectricity = JSONArray.parseArray(largeBuildingControl.getRoomElectricity());
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
- List<String> weeklist = new ArrayList<>();
|
|
|
- List<String> roomlist = new ArrayList<>();
|
|
|
- for (int i = 0; i < weekElectricity.size(); i++) {
|
|
|
- JSONObject item = weekElectricity.getJSONObject(i);
|
|
|
- weeklist.add(item.getString("num"));
|
|
|
- }
|
|
|
- for (int i = 0; i < roomElectricity.size(); i++) {
|
|
|
- JSONObject item = roomElectricity.getJSONObject(i);
|
|
|
- roomlist.add(item.getString("num"));
|
|
|
- }
|
|
|
- map.put("total", weeklist);
|
|
|
- map.put("room", roomlist);
|
|
|
+ map.put("total", weekElectricity);
|
|
|
+ map.put("room", roomElectricity);
|
|
|
return map;
|
|
|
}
|
|
|
|
|
@@ -395,8 +391,11 @@ public class PlatBuildingServiceImpl implements IPlatBuildingService {
|
|
|
|
|
|
|
|
|
private JSONObject repeatWarnDevice(JSONObject jsonObject){
|
|
|
+ String str = "[{\"alertTime\":\"2025-01-01 15:12:11\",\"alertName\":\"液位过低\",\"alertValue\":\"1.11m\",\"alertEquipment\":\"液位计编号如电表的话为1# 1-5等\",\"alertPosition\":\"B2层2号配电室\"},{\"alertTime\":\"2025-01-01 15:12:11\",\"alertName\":\"设备离线\",\"alertValue\":\"0.00m\",\"alertEquipment\":\"液位计编号如电表的话为1# 1-5等\",\"alertPosition\":\"B2层2号配电室\"}]";
|
|
|
+ JSONArray jsonArray = new JSONArray(str);
|
|
|
Long x = Long.parseLong(jsonObject.getString("zcdw")) + Long.parseLong(jsonObject.getString("ycdw"));
|
|
|
jsonObject.put("total", x);
|
|
|
+ jsonObject.put("abnormal", jsonArray);
|
|
|
return jsonObject;
|
|
|
}
|
|
|
|