Ver código fonte

楼宇中控接口修改

zhanghao 3 meses atrás
pai
commit
f8bf0e9469

+ 12 - 5
project-zcustom/src/main/java/com/project/zcustom/controller/build/PlatBuildControlController.java

@@ -1,16 +1,11 @@
 package com.project.zcustom.controller.build;
 
 import com.project.common.core.domain.AjaxResult;
-import com.project.common.utils.poi.ExcelUtil;
-import com.project.zcustom.domain.addional.LargeCamera;
 import com.project.zcustom.service.smart.IPlatBuildingService;
 import lombok.RequiredArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
-import javax.servlet.http.HttpServletResponse;
-import java.util.List;
-
 @RestController
 @RequestMapping("/large/third")
 @RequiredArgsConstructor(onConstructor_ = @Autowired)
@@ -29,6 +24,12 @@ public class PlatBuildControlController {
         return AjaxResult.success("查询成功", platBuildingService.getThisWeekElectricity());
     }
 
+    /*专业所属电表明细*/
+    @GetMapping("/thisAmmeterDetail")
+    public AjaxResult getThisAmmeterDetail() {
+        return AjaxResult.success("查询成功", platBuildingService.getThisAmmeterDetail());
+    }
+
     /*楼宇今日总用电量*/
     @GetMapping("/todayElectricity")
     public AjaxResult getTodayElectricity() {
@@ -53,6 +54,12 @@ public class PlatBuildControlController {
         return AjaxResult.success("查询成功", platBuildingService.getWarnDevice());
     }
 
+    /*异常点位查看*/
+    @GetMapping("/abnormalPoint")
+    public AjaxResult getAbnormalPoint() {
+        return AjaxResult.success("查询成功", platBuildingService.getAbnormalPoint());
+    }
+
     /*告警事件的历史统计*/
     @GetMapping("/warnEvent")
     public AjaxResult getWarnEvent() {

+ 1 - 1
project-zcustom/src/main/java/com/project/zcustom/mapper/logistics/PlatLogisticsMapper.java

@@ -60,7 +60,7 @@ public interface PlatLogisticsMapper {
 
     public List<LargeLogistics> getSceneRateY();
 
-    public List<LargeLogistics> getOperation(String appOrg);
+    public LargeLogistics getOperation(String appOrg);
 
     public List<LargeLogistics> getInspectionSchemeNumX();
 

+ 1 - 1
project-zcustom/src/main/java/com/project/zcustom/service/logistics/ILargePlatAssetService.java

@@ -24,7 +24,7 @@ public interface ILargePlatAssetService {
 
     public Map<String, Object> getSceneRate(int flag);
 
-    public List<LargeLogistics> getOperation(String appOrg);
+    public LargeLogistics getOperation(String appOrg);
 
     public Map<String, Object> getInspectionSchemeNumX();
 

+ 38 - 4
project-zcustom/src/main/java/com/project/zcustom/service/logistics/impl/LargePlatAssetServiceImpl.java

@@ -121,19 +121,45 @@ public class LargePlatAssetServiceImpl implements ILargePlatAssetService {
 
     public LargeLogistics getNewAssetNum(String appOrg){
         LargeLogistics largeLogistics = platLogisticsMapper.getNewAssetNum(appOrg);
+        if (largeLogistics == null){
+            largeLogistics = new LargeLogistics();
+            largeLogistics.setNewBuildingAssetNum(0L);
+            largeLogistics.setNewServiceAssetNum(0L);
+            largeLogistics.setNewOfficeAssetNum(0L);
+        }
+        return largeLogistics;
     }
 
     public LargeLogistics getScrapAssetNum(String appOrg){
-        return platLogisticsMapper.getScrapAssetNum(appOrg);
+        LargeLogistics largeLogistics = platLogisticsMapper.getScrapAssetNum(appOrg);
+        if (largeLogistics == null){
+            largeLogistics = new LargeLogistics();
+            largeLogistics.setScrapBuildingAssetNum(0L);
+            largeLogistics.setScrapServiceAssetNum(0L);
+            largeLogistics.setScrapOfficeAssetNum(0L);
+        }
+        return largeLogistics;
     }
 
     public Map<String, Object> getCodedAndLabelRate(String appOrg){
         Map<String, Object> map = platLogisticsMapper.getCodedAndLabelRate(appOrg);
+        if (map == null) {
+            map = new HashMap<>();
+            map.put("labelRate", 0);
+            map.put("codedRate", 0);
+        }
         return map;
     }
 
     public LargeLogistics getMainlyRate(String appOrg){
-        return platLogisticsMapper.getMainlyRate(appOrg);
+        LargeLogistics largeLogistics =  platLogisticsMapper.getMainlyRate(appOrg);
+        if (largeLogistics == null) {
+            largeLogistics = new LargeLogistics();
+            largeLogistics.setBuildingAssetNum(0L);
+            largeLogistics.setServiceAssetNum(0L);
+            largeLogistics.setOfficeAssetNum(0L);
+        }
+        return largeLogistics;
     }
 
     public Map<String, Object> getSceneRate(int flag){
@@ -159,8 +185,16 @@ public class LargePlatAssetServiceImpl implements ILargePlatAssetService {
         return map;
     }
 
-    public List<LargeLogistics> getOperation(String appOrg){
-        return platLogisticsMapper.getOperation(appOrg);
+    public LargeLogistics getOperation(String appOrg){
+        LargeLogistics largeLogistics =  platLogisticsMapper.getOperation(appOrg);
+        if (largeLogistics == null){
+            largeLogistics = new LargeLogistics();
+            largeLogistics.setImportantDeviceTypeInspectionExecuteRate(new BigDecimal(0));
+            largeLogistics.setInspectionAnomalyRecordNum(0L);
+            largeLogistics.setRepairRecordNum(0L);
+            largeLogistics.setMaintenanceRecordNum(0L);
+        }
+        return largeLogistics;
     }
 
     public Map<String, Object> getInspectionSchemeNumX(){

+ 7 - 0
project-zcustom/src/main/java/com/project/zcustom/service/smart/IPlatBuildingService.java

@@ -1,5 +1,8 @@
 package com.project.zcustom.service.smart;
 
+import com.alibaba.fastjson2.JSONArray;
+import com.alibaba.fastjson2.JSONObject;
+
 import java.util.List;
 import java.util.Map;
 
@@ -32,6 +35,8 @@ public interface IPlatBuildingService{
 
     Map<String, Object> getThisWeekElectricity();
 
+    JSONArray getThisAmmeterDetail();
+
     List<Map<String, Object>> getTodayElectricity();
 
     Map<String, Object> getMonthElectricity();
@@ -40,6 +45,8 @@ public interface IPlatBuildingService{
 
     Map<String, Object> getWarnDevice();
 
+    JSONArray getAbnormalPoint();
+
     Map<String, Object> getWarnEvent();
 
     Map<String, Object> getWarnState();

+ 57 - 11
project-zcustom/src/main/java/com/project/zcustom/service/smart/impl/PlatBuildingServiceImpl.java

@@ -294,14 +294,8 @@ 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<>();
         map.put("total", weekElectricity);
@@ -309,6 +303,42 @@ public class PlatBuildingServiceImpl implements IPlatBuildingService {
         return map;
     }
 
+    public JSONArray getThisAmmeterDetail(){
+        String str = "[\n" +
+                "        {\n" +
+                "            \"number\": \"1# 1-3\",\n" +
+                "            \"EqName\": \"设备名称\",\n" +
+                "            \"type\": \"设备所属类别\",\n" +
+                "            \"Kwh\": \"56.2\",\n" +
+                "        },\n" +
+                "        {\n" +
+                "            \"number\": \"1# 1-3\",\n" +
+                "            \"EqName\": \"设备名称\",\n" +
+                "            \"type\": \"设备所属类别\",\n" +
+                "            \"Kwh\": \"56.2\",\n" +
+                "        },\n" +
+                "        {\n" +
+                "            \"number\": \"1# 1-3\",\n" +
+                "            \"EqName\": \"设备名称\",\n" +
+                "            \"type\": \"设备所属类别\",\n" +
+                "            \"Kwh\": \"56.2\",\n" +
+                "        },\n" +
+                "        {\n" +
+                "            \"number\": \"1# 1-3\",\n" +
+                "            \"EqName\": \"设备名称\",\n" +
+                "            \"type\": \"设备所属类别\",\n" +
+                "            \"Kwh\": \"56.2\",\n" +
+                "        },\n" +
+                "        {\n" +
+                "            \"number\": \"1# 1-3\",\n" +
+                "            \"EqName\": \"设备名称\",\n" +
+                "            \"type\": \"设备所属类别\",\n" +
+                "            \"Kwh\": \"56.2\",\n" +
+                "        },\n" +
+                "    ]";
+        return JSONArray.parseArray(str);
+    }
+
     public List<Map<String, Object>> getTodayElectricity(){
         String json = platBuildingMapper.getTodayElectricity();
         JSONArray jsonArray = JSONArray.parseArray(json);
@@ -375,10 +405,29 @@ public class PlatBuildingServiceImpl implements IPlatBuildingService {
         return map;
     }
 
+    public JSONArray getAbnormalPoint(){
+        String str = "[\n" +
+                "        {\n" +
+                "            \"alertTime\": \"2025-01-01 15:12:11\",\n" +
+                "            \"alertName\": \"液位过低\",\n" +
+                "            \"alertValue\": \"1.11m\",\n" +
+                "            \"alertEquipment\": \"液位计编号(如电表的话:为1# 1-5等)\",\n" +
+                "            \"alertPosition\": \"B2层2号配电室\"\n" +
+                "        },\n" +
+                "        {\n" +
+                "            \"alertTime\": \"2025-01-01 15:12:11\",\n" +
+                "            \"alertName\": \"设备离线\",\n" +
+                "            \"alertValue\": \"0.00m\",\n" +
+                "            \"alertEquipment\": \"液位计编号(如电表的话:为1# 1-5等)\",\n" +
+                "            \"alertPosition\": \"B2层2号配电室\"\n" +
+                "        }\n" +
+                "    ]";
+        return JSONArray.parseArray(str);
+    }
+
     public Map<String, Object> getWarnEvent(){
         String json = platBuildingMapper.getWarnEvent();
-        JSONObject jsonObject = JSONObject.parseObject(json);
-        return jsonObject;
+        return JSONObject.parseObject(json);
     }
 
     public Map<String, Object> getWarnState(){
@@ -391,11 +440,8 @@ 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;
     }