Browse Source

拓扑图查询设备实例bug修复

linhuili 3 years ago
parent
commit
0b08744e42

+ 30 - 9
src/main/java/com/persagy/proxy/dictionary/controller/AdmLabslController.java

@@ -1,6 +1,7 @@
 package com.persagy.proxy.dictionary.controller;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.StrUtil;
 import com.persagy.proxy.adm.constant.AdmDictCategoryEnum;
 import com.persagy.proxy.adm.request.AdmDictQueryCriteria;
@@ -138,24 +139,44 @@ public class AdmLabslController {
         specialQueryFlag = handleRequestCriteria(filters, newFilters, specailFilters, specialQueryFlag);
         List<AdmEquipment> result = new ArrayList<>();
         List<AdmEquipment> specailContent = new ArrayList<>();
-        if(specialQueryFlag){
-            //查询未明确建筑,未明确楼层
-            AdmQueryCriteria specifal = new AdmQueryCriteria();
-            specifal = request;
-            specifal.setFilters(specailFilters.toString());
-            AdmResponse specailQueryResponse = iAdmEquipmentService.doQuery(context, request, AdmEquipment.class);
-            specailContent = (List<AdmEquipment>)specailQueryResponse.getContent();
-        }
+
+        AdmQueryCriteria specifal = new AdmQueryCriteria();
+        specifal = request;
+        specifal.setFilters(specailFilters.toString());
+
+        int totalCount = 0 ;
         request.setFilters(newFilters.toString());
         AdmResponse queryResponse = iAdmEquipmentService.doQuery(context, request, AdmEquipment.class);
         List<AdmEquipment> content = (List<AdmEquipment>)queryResponse.getContent();
+        if(queryResponse.getTotal() != null){
+            totalCount += queryResponse.getTotal().intValue();
+        }
+        if(specialQueryFlag){
+            //查询未明确建筑,未明确楼层
+            Long count = queryResponse.getCount();
+            Integer pageSize = request.getPageSize();
+            if(count < pageSize){
+                long specailPageSize = pageSize - count;
+                specifal.setPageSize((int) specailPageSize);
+                AdmResponse specailQueryResponse = iAdmEquipmentService.doQuery(context, specifal, AdmEquipment.class);
+                specailContent = (List<AdmEquipment>)specailQueryResponse.getContent();
+                if(specailQueryResponse.getTotal() != null){
+                    totalCount += specailQueryResponse.getTotal().intValue();
+                }
+            }
+        }
         if(CollUtil.isNotEmpty(content)){
             result.addAll(content);
         }
         if(CollUtil.isNotEmpty(specailContent)){
             result.addAll(specailContent);
         }
-        return AdmResponse.success(result);
+        AdmResponse response = AdmResponse.success(result);
+        response.setTotal(Long.valueOf(totalCount));
+        response.setCount(CollectionUtil.isEmpty(result) ? 0 : Long.valueOf(result.size()));
+        response.setPageNumber(request.getPageNumber());
+        response.setPageSize(request.getPageSize());
+        return response;
     }
 
     /**

+ 4 - 1
src/main/java/com/persagy/proxy/report/service/impl/AdmLabslServiceImpl.java

@@ -116,7 +116,7 @@ public class AdmLabslServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> im
         List<AdmBuilding> admBuildings = new ArrayList<>();
         //添加未明确建筑
         AdmBuilding admBuilding = new AdmBuilding();
-        admBuilding.setId("fisnull");
+        admBuilding.setId("bisnull");
         admBuilding.setName("未明确建筑");
         admBuilding.setLocalName("未明确建筑");
         admBuildings.add(admBuilding);
@@ -151,6 +151,9 @@ public class AdmLabslServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> im
             admBuildings.addAll(buildContent);
         }
         for (AdmBuilding building : admBuildings) {
+            if("未明确建筑".equals(building.getName())){
+                continue;
+            }
             List<AdmFloor> floorList = new ArrayList<>();
             floorList.add(admFloor);
             List<AdmFloor> floor = building.getFloor();