|
@@ -2,12 +2,10 @@ package com.project.zcustom.service.service.smart.impl;
|
|
|
|
|
|
import com.alibaba.fastjson2.JSONArray;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
-
|
|
|
import com.project.zcustom.controller.core.StringUtils;
|
|
|
import com.project.zcustom.domain.addional.LargeBuildingControl;
|
|
|
import com.project.zcustom.mapper.unit.PlatBuildingMapper;
|
|
|
import com.project.zcustom.service.service.smart.IPlatBuildingService;
|
|
|
-
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -15,10 +13,7 @@ import java.math.BigDecimal;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.time.temporal.TemporalAdjusters;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
@Service
|
|
|
public class PlatBuildingServiceImpl implements IPlatBuildingService {
|
|
@@ -32,7 +27,13 @@ public class PlatBuildingServiceImpl implements IPlatBuildingService {
|
|
|
|
|
|
String json = platBuildingMapper.getPowerAndWaterMonth();
|
|
|
if (StringUtils.isEmpty(json)){
|
|
|
- return resultList;
|
|
|
+ json = "[{\n" +
|
|
|
+ "\t\"key\": \"water\",\n" +
|
|
|
+ "\t\"value\": \"0\"\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"key\": \"power\",\n" +
|
|
|
+ "\t\"value\": \"0\"\n" +
|
|
|
+ "}]";
|
|
|
}
|
|
|
JSONArray dataArray = JSONArray.parseArray(json);
|
|
|
for (int i = 0; i < dataArray.size(); i++) {
|
|
@@ -41,7 +42,7 @@ public class PlatBuildingServiceImpl implements IPlatBuildingService {
|
|
|
String value = dataItem.getString("value");
|
|
|
Map<String, Object> data = new HashMap<>();
|
|
|
data.put("name", key);
|
|
|
- data.put("value", value);
|
|
|
+ data.put("value", new BigDecimal(value));
|
|
|
resultList.add(data);
|
|
|
}
|
|
|
return resultList;
|
|
@@ -52,7 +53,27 @@ public class PlatBuildingServiceImpl implements IPlatBuildingService {
|
|
|
|
|
|
String json = platBuildingMapper.getAirCondition();
|
|
|
if (StringUtils.isEmpty(json)){
|
|
|
- return resultList;
|
|
|
+ json = "[{\n" +
|
|
|
+ "\t\"name\": \"温度\",\n" +
|
|
|
+ "\t\"value\": \"0.00\",\n" +
|
|
|
+ "\t\"value1\": \"0.00\"\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"name\": \"湿度\",\n" +
|
|
|
+ "\t\"value\": \"0.00\",\n" +
|
|
|
+ "\t\"value1\": \"0.00\"\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"name\": \"二氧化碳\",\n" +
|
|
|
+ "\t\"value\": \"0.00\",\n" +
|
|
|
+ "\t\"value1\": \"0.00\"\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"name\": \"PM2.5\",\n" +
|
|
|
+ "\t\"value\": \"0.00\",\n" +
|
|
|
+ "\t\"value1\": \"0.00\"\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"name\": \"PM10\",\n" +
|
|
|
+ "\t\"value\": \"0.00\",\n" +
|
|
|
+ "\t\"value1\": \"0.00\"\n" +
|
|
|
+ "}]";
|
|
|
}
|
|
|
JSONArray dataArray = JSONArray.parseArray(json);
|
|
|
for (int i = 0; i < dataArray.size(); i++) {
|
|
@@ -74,7 +95,43 @@ public class PlatBuildingServiceImpl implements IPlatBuildingService {
|
|
|
|
|
|
String json = platBuildingMapper.getTarget();
|
|
|
if (StringUtils.isEmpty(json)){
|
|
|
- return resultList;
|
|
|
+ json = "[{\n" +
|
|
|
+ "\t\"guideValue\": 0.00,\n" +
|
|
|
+ "\t\"datumValue\": 0.00,\n" +
|
|
|
+ "\t\"tieValue\": 0.00,\n" +
|
|
|
+ "\t\"value\": \"0.00\",\n" +
|
|
|
+ "\t\"name\": \"单位建筑面积电耗(kW·h)\"\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"guideValue\": 0.00,\n" +
|
|
|
+ "\t\"datumValue\": 0.00,\n" +
|
|
|
+ "\t\"tieValue\": 0.00,\n" +
|
|
|
+ "\t\"value\": \"\",\n" +
|
|
|
+ "\t\"name\": \"单位建筑面积水耗(m³)\"\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"guideValue\": 0.00,\n" +
|
|
|
+ "\t\"datumValue\": 0.00,\n" +
|
|
|
+ "\t\"tieValue\": 0.00,\n" +
|
|
|
+ "\t\"value\": \"0.00\",\n" +
|
|
|
+ "\t\"name\": \"单位建筑面积综合能耗(kgce)\"\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"guideValue\": 0.00,\n" +
|
|
|
+ "\t\"datumValue\": 0.00,\n" +
|
|
|
+ "\t\"tieValue\": 0.00,\n" +
|
|
|
+ "\t\"value\": \"0.00\",\n" +
|
|
|
+ "\t\"name\": \"人均电耗(kW·h)\"\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"guideValue\": 0.00,\n" +
|
|
|
+ "\t\"datumValue\": 0.00,\n" +
|
|
|
+ "\t\"tieValue\": 0.00,\n" +
|
|
|
+ "\t\"value\": \"0.00\",\n" +
|
|
|
+ "\t\"name\": \"人均水耗(m³)\"\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"guideValue\": 0.00,\n" +
|
|
|
+ "\t\"datumValue\": 0.00,\n" +
|
|
|
+ "\t\"tieValue\": 0.00,\n" +
|
|
|
+ "\t\"value\": \"0.00\",\n" +
|
|
|
+ "\t\"name\": \"人均综合能耗(kgce)\"\n" +
|
|
|
+ "}]";
|
|
|
}
|
|
|
JSONArray dataArray = JSONArray.parseArray(json);
|
|
|
for (int i = 0; i < dataArray.size(); i++) {
|
|
@@ -126,7 +183,7 @@ public class PlatBuildingServiceImpl implements IPlatBuildingService {
|
|
|
String json = platBuildingMapper.greenElectricity();
|
|
|
if (StringUtils.isEmpty(json)){
|
|
|
data.put("publicEnergy", 0);
|
|
|
- data.put("grennEnergy", 0);
|
|
|
+ data.put("grennEnergy", 100);
|
|
|
return data;
|
|
|
}
|
|
|
JSONObject jsonObject = JSONObject.parseObject(json);
|
|
@@ -141,7 +198,7 @@ public class PlatBuildingServiceImpl implements IPlatBuildingService {
|
|
|
public List<Map<String, Object>> carbon(){
|
|
|
List<Map<String, Object>> resultList = new ArrayList<>();
|
|
|
String json = platBuildingMapper.carbon();
|
|
|
- if (json == null || json.isEmpty()) {
|
|
|
+ if ( StringUtils.isBlank(json)) {
|
|
|
return resultList;
|
|
|
}
|
|
|
JSONObject jsonObject = JSONObject.parseObject(json);
|
|
@@ -161,7 +218,7 @@ public class PlatBuildingServiceImpl implements IPlatBuildingService {
|
|
|
public Map<String, Object> energyYear(){
|
|
|
Map<String, Object> res = new HashMap<>();
|
|
|
String json = platBuildingMapper.energyYear();
|
|
|
- if (json == null || json.isEmpty()) {
|
|
|
+ if (StringUtils.isBlank(json)) {
|
|
|
return res;
|
|
|
}
|
|
|
JSONObject dataObject = JSONObject.parseObject(json);
|
|
@@ -187,7 +244,7 @@ public class PlatBuildingServiceImpl implements IPlatBuildingService {
|
|
|
public Map<String, Object> powerYear(){
|
|
|
Map<String, Object> res = new HashMap<>();
|
|
|
String json = platBuildingMapper.powerYear();
|
|
|
- if (json == null || json.isEmpty()) {
|
|
|
+ if (StringUtils.isBlank(json)) {
|
|
|
return res;
|
|
|
}
|
|
|
JSONObject dataObject = JSONObject.parseObject(json);
|
|
@@ -213,7 +270,7 @@ public class PlatBuildingServiceImpl implements IPlatBuildingService {
|
|
|
public Map<String, Object> waterYear(){
|
|
|
Map<String, Object> res = new HashMap<>();
|
|
|
String json = platBuildingMapper.waterYear();
|
|
|
- if (json == null || json.isEmpty()) {
|
|
|
+ if (StringUtils.isBlank(json)) {
|
|
|
return res;
|
|
|
}
|
|
|
JSONObject dataObject = JSONObject.parseObject(json);
|
|
@@ -284,7 +341,7 @@ public class PlatBuildingServiceImpl implements IPlatBuildingService {
|
|
|
public List<Map<String, Object>> patrolPoint(){
|
|
|
List<Map<String, Object>> resultList = new ArrayList<>();
|
|
|
String json = platBuildingMapper.patrolPoint();
|
|
|
- if (json == null || json.isEmpty()) {
|
|
|
+ if (StringUtils.isBlank(json)) {
|
|
|
return resultList;
|
|
|
}
|
|
|
JSONArray dataArray = JSONArray.parseArray(json);
|
|
@@ -312,10 +369,64 @@ public class PlatBuildingServiceImpl implements IPlatBuildingService {
|
|
|
}
|
|
|
|
|
|
public Map<String, Object> getThisWeekElectricity(){
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
LargeBuildingControl largeBuildingControl = platBuildingMapper.getThisWeekElectricity();
|
|
|
+ if (Objects.isNull(largeBuildingControl)) {
|
|
|
+ String total = "[{\n" +
|
|
|
+ "\t\"name\": \"光伏用电量\",\n" +
|
|
|
+ "\t\"num\": 0.0\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"name\": \"楼外设备用电量\",\n" +
|
|
|
+ "\t\"num\": 0.0\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"name\": \"充电桩用电量\",\n" +
|
|
|
+ "\t\"num\": 0.0\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"name\": \"地下室用电量\",\n" +
|
|
|
+ "\t\"num\": 0.0\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"name\": \"制冷机组用电量\",\n" +
|
|
|
+ "\t\"num\": 0.0\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"name\": \"消防用电量\",\n" +
|
|
|
+ "\t\"num\": 0.0\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"name\": \"电梯用电量\",\n" +
|
|
|
+ "\t\"num\": 0.0\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"name\": \"办公用电量\",\n" +
|
|
|
+ "\t\"num\": 0.0\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"name\": \"公共照明用电量\",\n" +
|
|
|
+ "\t\"num\": 0.0\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"name\": \"供热设备用电量\",\n" +
|
|
|
+ "\t\"num\": 0.0\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"name\": \"厨房用电量\",\n" +
|
|
|
+ "\t\"num\": 0.0\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"name\": \"机房总用电量\",\n" +
|
|
|
+ "\t\"num\": 0.0\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"name\": \"生活水泵用电量\",\n" +
|
|
|
+ "\t\"num\": 0.0\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"name\": \"冷源泵用电量\",\n" +
|
|
|
+ "\t\"num\": 0.0\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"name\": \"热源泵用电量\",\n" +
|
|
|
+ "\t\"num\": 0.0\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"name\": \"通信辅助设备用电量\",\n" +
|
|
|
+ "\t\"num\": 0.0\n" +
|
|
|
+ "}]";
|
|
|
+ map.put("total", JSONArray.parseArray(total));
|
|
|
+ map.put("room", "");
|
|
|
+ return map;
|
|
|
+ }
|
|
|
JSONArray weekElectricity = JSONArray.parseArray(largeBuildingControl.getWeekElectricity());
|
|
|
JSONArray roomElectricity = JSONArray.parseArray(largeBuildingControl.getRoomElectricity());
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
map.put("total", weekElectricity);
|
|
|
map.put("room", roomElectricity);
|
|
|
return map;
|
|
@@ -323,6 +434,9 @@ public class PlatBuildingServiceImpl implements IPlatBuildingService {
|
|
|
|
|
|
public JSONObject getControlElevator(){
|
|
|
String result = platBuildingMapper.getControlElevator();
|
|
|
+ if (StringUtils.isBlank(result)){
|
|
|
+ result = "{\"weekTotal\":0.00}";
|
|
|
+ }
|
|
|
return JSONObject.parseObject(result);
|
|
|
}
|
|
|
|
|
@@ -336,19 +450,84 @@ public class PlatBuildingServiceImpl implements IPlatBuildingService {
|
|
|
|
|
|
public List<Map<String, Object>> getTodayElectricity(){
|
|
|
String json = platBuildingMapper.getTodayElectricity();
|
|
|
+ if (StringUtils.isBlank(json)) {
|
|
|
+ json = "[{\n" +
|
|
|
+ "\t\"time\": \"00\",\n" +
|
|
|
+ "\t\"Kwh\": \"0.0\"\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"time\": \"01\",\n" +
|
|
|
+ "\t\"Kwh\": \"0.0\"\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"time\": \"02\",\n" +
|
|
|
+ "\t\"Kwh\": \"0.0\"\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"time\": \"03\",\n" +
|
|
|
+ "\t\"Kwh\": \"0.0\"\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"time\": \"04\",\n" +
|
|
|
+ "\t\"Kwh\": \"0.0\"\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"time\": \"05\",\n" +
|
|
|
+ "\t\"Kwh\": \"0.0\"\n" +
|
|
|
+ "}]";
|
|
|
+ }
|
|
|
JSONArray jsonArray = JSONArray.parseArray(json);
|
|
|
return repeatElectricity(jsonArray);
|
|
|
}
|
|
|
|
|
|
public Map<String, Object> getMonthElectricity(){
|
|
|
LargeBuildingControl largeBuildingControl = platBuildingMapper.getMonthElectricity();
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ if (Objects.isNull(largeBuildingControl)) {
|
|
|
+ largeBuildingControl = new LargeBuildingControl();
|
|
|
+ String one = "[{\n" +
|
|
|
+ "\t\"time\": \"2025-01\",\n" +
|
|
|
+ "\t\"Kwh\": \"0.0\"\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"time\": \"2025-02\",\n" +
|
|
|
+ "\t\"Kwh\": \"0.0\"\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"time\": \"2025-03\",\n" +
|
|
|
+ "\t\"Kwh\": \"0.0\"\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"time\": \"2025-04\",\n" +
|
|
|
+ "\t\"Kwh\": \"0.0\"\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"time\": \"2025-05\",\n" +
|
|
|
+ "\t\"Kwh\": \"0.0\"\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"time\": \"2025-06\",\n" +
|
|
|
+ "\t\"Kwh\": \"0.0\"\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"time\": \"2025-07\",\n" +
|
|
|
+ "\t\"Kwh\": \"0.0\"\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"time\": \"2025-08\",\n" +
|
|
|
+ "\t\"Kwh\": \"0.0\"\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"time\": \"2025-09\",\n" +
|
|
|
+ "\t\"Kwh\": \"0.0\"\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"time\": \"2025-10\",\n" +
|
|
|
+ "\t\"Kwh\": \"0.0\"\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"time\": \"2025-11\",\n" +
|
|
|
+ "\t\"Kwh\": \"0.0\"\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"time\": \"2025-12\",\n" +
|
|
|
+ "\t\"Kwh\": \"0.0\"\n" +
|
|
|
+ "}]";
|
|
|
+ largeBuildingControl.setMonthElectricityOne(one);
|
|
|
+ largeBuildingControl.setMonthElectricityTwo(one);
|
|
|
+ largeBuildingControl.setMonthElectricityThree(one);
|
|
|
+ }
|
|
|
JSONArray x = JSONArray.parseArray(largeBuildingControl.getMonthElectricityOne());
|
|
|
JSONArray y = JSONArray.parseArray(largeBuildingControl.getMonthElectricityTwo());
|
|
|
JSONArray z = JSONArray.parseArray(largeBuildingControl.getMonthElectricityThree());
|
|
|
List<Map<String, Object>> a = repeatElectricity(x);
|
|
|
List<Map<String, Object>> b = repeatElectricity(y);
|
|
|
List<Map<String, Object>> c = repeatElectricity(z);
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
+
|
|
|
map.put("first", a);
|
|
|
map.put("second", b);
|
|
|
map.put("third", c);
|
|
@@ -357,6 +536,24 @@ public class PlatBuildingServiceImpl implements IPlatBuildingService {
|
|
|
|
|
|
public Map<String, Object> getRoomLoad(){
|
|
|
LargeBuildingControl largeBuildingControl = platBuildingMapper.getRoomLoad();
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ if (Objects.isNull(largeBuildingControl)) {
|
|
|
+ largeBuildingControl = new LargeBuildingControl();
|
|
|
+ String json = "[{\n" +
|
|
|
+ "\t\"kz\": 0\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"qz\": 0\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"zc\": 0\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"zz\": 0\n" +
|
|
|
+ "}, {\n" +
|
|
|
+ "\t\"gz\": 0\n" +
|
|
|
+ "}]";
|
|
|
+ largeBuildingControl.setRoomLoadOne(json);
|
|
|
+ largeBuildingControl.setRoomLoadTwo(json);
|
|
|
+ largeBuildingControl.setRoomLoadThree(json);
|
|
|
+ }
|
|
|
JSONArray x = JSONArray.parseArray(largeBuildingControl.getRoomLoadOne());
|
|
|
JSONArray y = JSONArray.parseArray(largeBuildingControl.getRoomLoadTwo());
|
|
|
JSONArray z = JSONArray.parseArray(largeBuildingControl.getRoomLoadThree());
|
|
@@ -378,7 +575,6 @@ public class PlatBuildingServiceImpl implements IPlatBuildingService {
|
|
|
Integer value = (Integer) jsonObject.values().iterator().next(); // 获取第一个值(每个 JSON 对象只有一个键值对)
|
|
|
c.add(value);
|
|
|
}
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
map.put("first", a);
|
|
|
map.put("second", b);
|
|
|
map.put("third", c);
|
|
@@ -387,8 +583,34 @@ public class PlatBuildingServiceImpl implements IPlatBuildingService {
|
|
|
|
|
|
public Map<String, Object> getWarnDevice(){
|
|
|
LargeBuildingControl largeBuildingControl = platBuildingMapper.getWarnDevice();
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(largeBuildingControl.getWarnDevice());
|
|
|
+
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
+ if (Objects.isNull(largeBuildingControl)) {
|
|
|
+ String warnDevice = "{\n" +
|
|
|
+ "\t\"db\": {\n" +
|
|
|
+ "\t\t\"zcdw\": \"0\",\n" +
|
|
|
+ "\t\t\"ycdw\": \"0\"\n" +
|
|
|
+ "\t},\n" +
|
|
|
+ "\t\"ywj\": {\n" +
|
|
|
+ "\t\t\"zcdw\": \"0\",\n" +
|
|
|
+ "\t\t\"ycdw\": \"0\"\n" +
|
|
|
+ "\t},\n" +
|
|
|
+ "\t\"sj\": {\n" +
|
|
|
+ "\t\t\"zcdw\": \"0\",\n" +
|
|
|
+ "\t\t\"ycdw\": \"0\"\n" +
|
|
|
+ "\t},\n" +
|
|
|
+ "\t\"yw\": {\n" +
|
|
|
+ "\t\t\"zcdw\": \"0\",\n" +
|
|
|
+ "\t\t\"ycdw\": \"0\"\n" +
|
|
|
+ "\t}\n" +
|
|
|
+ "}";
|
|
|
+ largeBuildingControl = new LargeBuildingControl();
|
|
|
+ largeBuildingControl.setWarnDevice(warnDevice);
|
|
|
+ largeBuildingControl.setWaterControlAbnormalNum(0L);
|
|
|
+ largeBuildingControl.setWaterControlNormalNum(0L);
|
|
|
+ largeBuildingControl.setWaterDeviceAirNum(0L);
|
|
|
+ }
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(largeBuildingControl.getWarnDevice());
|
|
|
JSONObject water = jsonObject.getJSONObject("sj");
|
|
|
water.put("zcdw", largeBuildingControl.getWaterControlNormalNum() + largeBuildingControl.getWaterDeviceAirNum());
|
|
|
water.put("air", largeBuildingControl.getWaterDeviceAirNum());
|
|
@@ -402,6 +624,9 @@ public class PlatBuildingServiceImpl implements IPlatBuildingService {
|
|
|
|
|
|
public JSONArray getAbnormalPoint(String type){
|
|
|
LargeBuildingControl largeBuildingControl = platBuildingMapper.getAbnormalPoint();
|
|
|
+ if (Objects.isNull(largeBuildingControl)) {
|
|
|
+ return new JSONArray();
|
|
|
+ }
|
|
|
switch (type){
|
|
|
case "1":
|
|
|
return JSONArray.parseArray(largeBuildingControl.getAbnormalPointOne());
|
|
@@ -418,12 +643,20 @@ public class PlatBuildingServiceImpl implements IPlatBuildingService {
|
|
|
|
|
|
public JSONArray getWarnEvent(){
|
|
|
String json = platBuildingMapper.getWarnEvent();
|
|
|
+ if (StringUtils.isBlank(json)) {
|
|
|
+ json = "[{\"db\":\"0\",\"sj\":\"0\",\"yw\":\"0\",\"ywj\":\"0\",\"month\":\"1\"},{\"db\":\"0\",\"sj\":\"0\",\"yw\":\"0\",\"ywj\":\"0\",\"month\":\"2\"},{\"db\":\"0\",\"sj\":\"0\",\"yw\":\"0\",\"ywj\":\"0\",\"month\":\"3\"},{\"db\":\"0\",\"sj\":\"0\",\"yw\":\"0\",\"ywj\":\"0\",\"month\":\"4\"},{\"db\":\"0\",\"sj\":\"0\",\"yw\":\"0\",\"ywj\":\"0\",\"month\":\"5\"},{\"db\":\"0\",\"sj\":\"0\",\"yw\":\"0\",\"ywj\":\"0\",\"month\":\"6\"}]";
|
|
|
+ }
|
|
|
return JSONArray.parseArray(json);
|
|
|
}
|
|
|
|
|
|
public Map<String, Object> getWarnState(){
|
|
|
LargeBuildingControl largeBuildingControl = platBuildingMapper.getWarnState();
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
+ if (Objects.isNull(largeBuildingControl)) {
|
|
|
+ map.put("twentyThree", JSONObject.parseObject("{\"shsx\":[{\"dqsw\":\"0m\"},{\"zdsw\":\"0m\"},{\"zgsw\":\"00m\"}],\"xfsx\":[{\"dqsw\":\"0m\"},{\"zdsw\":\"0m\"},{\"zgsw\":\"0m\"}]}"));
|
|
|
+ map.put("minusTwo", JSONObject.parseObject("{\"gqsx\":[{\"dqsw\":\"0m\"},{\"zdsw\":\"0m\"},{\"zgsw\":\"0m\"}],\"dqsx\":[{\"dqsw\":\"0m\"},{\"zdsw\":\"0m\"},{\"zgsw\":\"0m\"}]}"));
|
|
|
+ return map;
|
|
|
+ }
|
|
|
map.put("twentyThree", JSONObject.parseObject(largeBuildingControl.getWaterStateOne()));
|
|
|
map.put("minusTwo", JSONObject.parseObject(largeBuildingControl.getWaterStateTwo()));
|
|
|
return map;
|
|
@@ -431,6 +664,9 @@ public class PlatBuildingServiceImpl implements IPlatBuildingService {
|
|
|
|
|
|
|
|
|
private JSONObject repeatWarnDevice(JSONObject jsonObject){
|
|
|
+ if (Objects.isNull(jsonObject)) {
|
|
|
+ return new JSONObject();
|
|
|
+ }
|
|
|
Long x = Long.parseLong(jsonObject.getString("zcdw")) + Long.parseLong(jsonObject.getString("ycdw"));
|
|
|
jsonObject.put("total", x);
|
|
|
return jsonObject;
|
|
@@ -448,11 +684,11 @@ public class PlatBuildingServiceImpl implements IPlatBuildingService {
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
- private String[] getLastSixMonths() {
|
|
|
+ private String[] getLastSixMonths() {
|
|
|
LocalDate currentDate = LocalDate.now();
|
|
|
// 自定义格式化模式,确保月份没有前导零并附加“月”字
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("M'月'");
|
|
|
- String[] monthsArray = new String[6];
|
|
|
+ String[] monthsArray = new String[6]; // 创建一个长度为6的数组存储月份信息
|
|
|
|
|
|
for (int i = 0; i < 6; i++) {
|
|
|
LocalDate firstDayOfMonth = currentDate.with(TemporalAdjusters.firstDayOfMonth());
|