|
@@ -10,12 +10,19 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.fasterxml.jackson.databind.node.ArrayNode;
|
|
|
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
|
|
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
|
|
+import com.google.common.collect.Sets;
|
|
|
import com.persagy.dmp.basic.model.QueryCriteria;
|
|
|
import com.persagy.dmp.common.context.AppContext;
|
|
|
+import com.persagy.dmp.common.helper.SpringHelper;
|
|
|
+import com.persagy.dmp.common.model.response.CommonResult;
|
|
|
import com.persagy.dmp.define.entity.ObjectTypeDefine;
|
|
|
import com.persagy.dmp.digital.client.DigitalObjectFacade;
|
|
|
+import com.persagy.dmp.digital.entity.ObjectDigital;
|
|
|
import com.persagy.dmp.digital.entity.ObjectRelation;
|
|
|
+import com.persagy.dmp.simple.client.DigitalObjectSimpleFacade;
|
|
|
import com.persagy.proxy.adm.constant.AdmCommonConstant;
|
|
|
+import com.persagy.proxy.adm.constant.GraphCodeEnum;
|
|
|
+import com.persagy.proxy.adm.constant.RelCodeEnum;
|
|
|
import com.persagy.proxy.adm.request.AdmDCSQueryRequest;
|
|
|
import com.persagy.proxy.adm.request.AdmQueryCriteria;
|
|
|
import com.persagy.proxy.adm.request.AdmResponse;
|
|
@@ -36,6 +43,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -268,6 +276,78 @@ public class AdmSpaceServiceImpl extends AbstractAdmBaseServiceImpl<AdmSpace> im
|
|
|
loadTrafficSpace(context, spaceIds, spaceType, false, result);
|
|
|
return result;
|
|
|
}
|
|
|
+ /***
|
|
|
+ * Description: 查询多建筑楼层下的空间id
|
|
|
+ * @param request : 请求参数
|
|
|
+ * @return : java.util.Set<java.lang.String>
|
|
|
+ * @author : lijie
|
|
|
+ * @date :2021/10/28 17:56
|
|
|
+ * Update By lijie 2021/10/28 17:56
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Set<String> queryMultiBuildingOrFloorSpaceIds(HttpServletRequest request) {
|
|
|
+ String groupCode = AppContext.getContext().getGroupCode();
|
|
|
+ String projectId = AppContext.getContext().getProjectId();
|
|
|
+ // 1.查询楼层下的空间的关系统计数据
|
|
|
+ CommonResult<List<ObjectRelation>> floorCountByObjIds = DigitalObjectSimpleFacade
|
|
|
+ .queryRelationCountByObjIds(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID,
|
|
|
+ getMultiBuildingOrFloorQueryWrapper(request,RelCodeEnum.Fl2Sp.name()));
|
|
|
+ List<ObjectRelation> floorSpaceData = floorCountByObjIds.getData();
|
|
|
+ // 2.查询建筑下的空间的关系统计数据
|
|
|
+ CommonResult<List<ObjectRelation>> buildingCountByObjIds = DigitalObjectSimpleFacade
|
|
|
+ .queryRelationCountByObjIds(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID,
|
|
|
+ getMultiBuildingOrFloorQueryWrapper(request, RelCodeEnum.Bd2Sp.name()));
|
|
|
+ List<ObjectRelation> buildingSpaceData = buildingCountByObjIds.getData();
|
|
|
+ Set<String> spaceIds = CollUtil.newHashSet(CollUtil.isNotEmpty(floorSpaceData), floorSpaceData
|
|
|
+ .stream().map(ObjectRelation::getObjTo).collect(Collectors.toSet()));
|
|
|
+ spaceIds.addAll(CollUtil.newHashSet(CollUtil.isNotEmpty(buildingSpaceData),
|
|
|
+ buildingSpaceData.stream().map(ObjectRelation::getObjTo).collect(Collectors.toSet())));
|
|
|
+ return spaceIds;
|
|
|
+ }
|
|
|
+ /***
|
|
|
+ * Description: 查询多建筑楼层下的空间列表
|
|
|
+ * @param request : 请求参数
|
|
|
+ * @return : java.util.Set<java.lang.String>
|
|
|
+ * @author : lijie
|
|
|
+ * @date :2021/10/28 17:56
|
|
|
+ * Update By lijie 2021/10/28 17:56
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public AdmResponse queryMultiBuildingOrFloorSpaces(HttpServletRequest request) {
|
|
|
+ // 1.查询多建筑楼层下的空间id列表
|
|
|
+ Set<String> spaceIds = queryMultiBuildingOrFloorSpaceIds(request);
|
|
|
+ AdmQueryCriteria spaceCriteria = new AdmQueryCriteria();
|
|
|
+ String filters = " id in ['"+ String.join("', '", spaceIds) +"'] ";
|
|
|
+ spaceCriteria.setFilters(filters);
|
|
|
+ AdmQueryCriteria floorCriteria = new AdmQueryCriteria();
|
|
|
+ floorCriteria.setName("floorList");
|
|
|
+ AdmQueryCriteria buildingCriteria = new AdmQueryCriteria();
|
|
|
+ buildingCriteria.setName("building");
|
|
|
+ floorCriteria.setCascade(CollUtil.newArrayList(buildingCriteria));
|
|
|
+ spaceCriteria.setCascade(CollUtil.newArrayList(floorCriteria));
|
|
|
+ return super.doQuery(AdmContextUtil.toDmpContext(), spaceCriteria, AdmSpace.class);
|
|
|
+ }
|
|
|
+
|
|
|
+ /***
|
|
|
+ * Description: 获得多建筑楼层下的空间的查询条件
|
|
|
+ * @param request : 请求参数
|
|
|
+ * @param relCode : 边类型
|
|
|
+ * @return : com.fasterxml.jackson.databind.node.ObjectNode
|
|
|
+ * @author : lijie
|
|
|
+ * @date :2021/10/28 17:55
|
|
|
+ * Update By lijie 2021/10/28 17:55
|
|
|
+ */
|
|
|
+ private ObjectNode getMultiBuildingOrFloorQueryWrapper(HttpServletRequest request,String relCode) {
|
|
|
+ ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
|
|
|
+ ObjectNode objectNode = objectMapper.createObjectNode();
|
|
|
+ if (StrUtil.isNotBlank(AppContext.getContext().getProjectId())){
|
|
|
+ objectNode.putPOJO("projectIds", Sets.newHashSet(AppContext.getContext().getProjectId()));
|
|
|
+ }
|
|
|
+ objectNode.putPOJO("graphCodes", Sets.newHashSet(GraphCodeEnum.ArchSubset.name()));
|
|
|
+ objectNode.putPOJO("relCodes", Sets.newHashSet(relCode));
|
|
|
+ objectNode.putPOJO("groups", Sets.newHashSet("objTo"));
|
|
|
+ return objectNode;
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 装载交通关系
|