|
@@ -1,6 +1,7 @@
|
|
|
package com.persagy.proxy.adm.service.impl;
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fasterxml.jackson.databind.node.ArrayNode;
|
|
|
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
|
|
@@ -13,6 +14,7 @@ import com.persagy.proxy.adm.request.AdmResponse;
|
|
|
import com.persagy.proxy.adm.service.*;
|
|
|
import com.persagy.proxy.common.entity.InstanceUrlParam;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
import org.springframework.context.annotation.Primary;
|
|
@@ -87,14 +89,15 @@ public class AdmLabslServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> im
|
|
|
ObjectNode node = JsonNodeFactory.instance.objectNode();
|
|
|
|
|
|
//查询所有的空间类型
|
|
|
- List<String> objTypes = new ArrayList<>();
|
|
|
- objTypes.add(AdmDictCategoryEnum.SPACE.getValue());
|
|
|
- node.put("objType",objTypes.toString());
|
|
|
+ //List<String> objTypes = new ArrayList<>();
|
|
|
+ //objTypes.add(AdmDictCategoryEnum.SPACE.getValue());
|
|
|
+ node.put("objType",AdmDictCategoryEnum.SPACE.getValue());
|
|
|
criteria.setCriteria(node);
|
|
|
AdmResponse response = doQueryObjectType(context, criteria, clazz);
|
|
|
|
|
|
List<AdmObjectInfo> content = (List<AdmObjectInfo>) response.getContent();
|
|
|
- return AdmResponse.success(content);
|
|
|
+ response.setContent(content);
|
|
|
+ return response;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -112,6 +115,7 @@ public class AdmLabslServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> im
|
|
|
admBuilding.setId("fisnull");
|
|
|
admBuilding.setName("未明确建筑");
|
|
|
admBuilding.setLocalName("未明确建筑");
|
|
|
+ admBuildings.add(admBuilding);
|
|
|
|
|
|
//添加未明确楼层
|
|
|
ArrayList<AdmFloor> admFloors = new ArrayList<>();
|
|
@@ -134,18 +138,21 @@ public class AdmLabslServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> im
|
|
|
|
|
|
AdmResponse buildResponse = buildingService.doQuery(context, request, AdmBuilding.class);
|
|
|
if(CollUtil.isEmpty(buildResponse.getContent())){
|
|
|
- admBuildings.add(admBuilding);
|
|
|
- return AdmResponse.success((List<JSONObject>)admBuilding);
|
|
|
+ return AdmResponse.success(admBuildings);
|
|
|
}
|
|
|
|
|
|
//建筑下的楼层添加默认"未明确楼层"
|
|
|
List<AdmBuilding> buildContent = (List<AdmBuilding>)buildResponse.getContent();
|
|
|
- buildContent.add(admBuilding);
|
|
|
- for (AdmBuilding building : buildContent) {
|
|
|
+ if(CollUtil.isNotEmpty(buildContent)){
|
|
|
+ admBuildings.addAll(buildContent);
|
|
|
+ }
|
|
|
+ for (AdmBuilding building : admBuildings) {
|
|
|
List<AdmFloor> floor = building.getFloor();
|
|
|
- floor.add(admFloor);
|
|
|
+ if(CollUtil.isNotEmpty(floor)){
|
|
|
+ floor.add(admFloor);
|
|
|
+ }
|
|
|
}
|
|
|
- return AdmResponse.success(buildContent);
|
|
|
+ return AdmResponse.success(admBuildings);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -162,7 +169,13 @@ public class AdmLabslServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> im
|
|
|
//根据id查询对应的设备类型
|
|
|
AdmQueryCriteria request = new AdmQueryCriteria();
|
|
|
request.setName(AdmEquipment.OBJ_TYPE);
|
|
|
- request.setFilters("id in " + ids);
|
|
|
+
|
|
|
+ StringBuilder stringBuilder = new StringBuilder();
|
|
|
+ ids.stream().forEach(item -> {
|
|
|
+ stringBuilder.append("'").append(item).append("'").append(",");
|
|
|
+ });
|
|
|
+ String filters = StrUtil.sub(stringBuilder.toString(),0, -1);
|
|
|
+ request.setFilters("id in ["+filters+"]");
|
|
|
AdmResponse equipResponse = equipmentService.doQuery(context, request, AdmEquipment.class);
|
|
|
if(CollUtil.isEmpty(equipResponse.getContent())){
|
|
|
throw new Exception("设备不存在");
|
|
@@ -173,7 +186,9 @@ public class AdmLabslServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> im
|
|
|
//根据设备类型查询设备所属专业
|
|
|
QueryCriteria dictCriteria = new QueryCriteria();
|
|
|
ObjectNode node = JsonNodeFactory.instance.objectNode();
|
|
|
- node.put("code",classCodes.toString());
|
|
|
+ ArrayNode array = node.putObject("code").putArray("$in");
|
|
|
+ classCodes.forEach(code -> array.add(code));
|
|
|
+
|
|
|
dictCriteria.setCriteria(node);
|
|
|
AdmResponse dictResponse = doQueryObjectType(context, dictCriteria, clazz);
|
|
|
if(CollUtil.isEmpty(dictResponse.getContent())){
|