|
@@ -1,11 +1,37 @@
|
|
|
package com.persagy.adm.server.algorithm.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
|
|
+import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
+import com.fasterxml.jackson.databind.node.ObjectNode;
|
|
|
+import com.persagy.adm.common.constant.GraphCodeEnum;
|
|
|
+import com.persagy.adm.common.constant.RelCodeEnum;
|
|
|
+import com.persagy.adm.server.algorithm.constant.AdmServerConstant;
|
|
|
+import com.persagy.adm.server.algorithm.dao.AdmModelFileMapper;
|
|
|
import com.persagy.adm.server.algorithm.domain.DeliverPlanVo;
|
|
|
+import com.persagy.adm.server.algorithm.entity.AdmModelFile;
|
|
|
import com.persagy.adm.server.algorithm.service.AdmModelService;
|
|
|
+import com.persagy.dmp.basic.model.QueryCriteria;
|
|
|
+import com.persagy.dmp.common.constant.CommonConstant;
|
|
|
+import com.persagy.dmp.common.context.AppContext;
|
|
|
+import com.persagy.dmp.common.exception.BusinessException;
|
|
|
+import com.persagy.dmp.common.helper.SpringHelper;
|
|
|
+import com.persagy.dmp.common.model.response.CommonResult;
|
|
|
+import com.persagy.dmp.digital.client.DigitalObjectFacade;
|
|
|
+import com.persagy.dmp.digital.entity.ObjectDigital;
|
|
|
+import com.persagy.dmp.digital.entity.ObjectRelation;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
/**
|
|
|
* 模型文件的逻辑处理类
|
|
|
* @author : lijie
|
|
@@ -15,15 +41,88 @@ import org.springframework.stereotype.Service;
|
|
|
@Slf4j
|
|
|
@RequiredArgsConstructor
|
|
|
public class AdmModelServiceImpl implements AdmModelService {
|
|
|
+
|
|
|
+ private final AdmModelFileMapper admModelFileMapper;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据建筑id查询建筑下的所有楼层
|
|
|
+ * @param buildingId : 建筑id
|
|
|
+ * @return : java.util.List<com.persagy.dmp.digital.entity.ObjectDigital>
|
|
|
+ * @author : lijie
|
|
|
+ * Update By 2022/1/19 10:04
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<ObjectDigital> queryFloorsByBuildingId(String buildingId) {
|
|
|
+ if (StrUtil.isBlank(buildingId)){
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
+ // 构建查询参数,valid为true,并且是该建筑下的.且按floorSequenceID正序排序
|
|
|
+ QueryCriteria queryCriteria = new QueryCriteria();
|
|
|
+ ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
|
|
|
+ ObjectNode objectNode = objectMapper.createObjectNode();
|
|
|
+ objectNode.put(ObjectDigital.PROP_VALID,Boolean.TRUE);
|
|
|
+ objectNode.putPOJO(ObjectRelation.RELATION_TO_HUM,createRelationQueryNode(objectMapper, GraphCodeEnum.ArchSubset.name(),
|
|
|
+ RelCodeEnum.Bd2Fl.name(),buildingId));
|
|
|
+ queryCriteria.setCriteria(objectNode);
|
|
|
+ queryCriteria.setOrders(CollUtil.newArrayList(OrderItem.asc(AdmServerConstant.FLOOR_SEQUENCE_ID)));
|
|
|
+ CommonResult<List<ObjectDigital>> commonResult = DigitalObjectFacade.queryObject(AppContext.getContext().getGroupCode(),
|
|
|
+ AppContext.getContext().getProjectId(), AppContext.getContext().getAppId(),
|
|
|
+ AppContext.getContext().getAccountId(), queryCriteria);
|
|
|
+ if (!CommonConstant.QUERY_SUCCESS.equals(commonResult.getResult())){
|
|
|
+ throw new BusinessException(commonResult.getResult(),commonResult.getMessage());
|
|
|
+ }
|
|
|
+ if (CollUtil.isEmpty(commonResult.getData())){
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
+ return commonResult.getData();
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 根据楼层id集合查询当前的模型文件信息
|
|
|
+ * @param floorIds : 楼层id集合
|
|
|
+ * @return : java.util.Map<java.lang.String,com.persagy.adm.server.algorithm.entity.AdmModelFile>
|
|
|
+ * @author : lijie
|
|
|
+ * Update By 2022/1/19 14:34
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Map<String, AdmModelFile> queryCurrentModelFileByFloorIds(List<String> floorIds) {
|
|
|
+ LambdaQueryWrapper<AdmModelFile> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.in(AdmModelFile::getFloorId,floorIds);
|
|
|
+ queryWrapper.eq(AdmModelFile::getValid,Boolean.TRUE);
|
|
|
+ queryWrapper.eq(AdmModelFile::getRemoved,Boolean.FALSE);
|
|
|
+ List<AdmModelFile> admModelFiles = admModelFileMapper.queryCurrentModelFileByFloorIds(queryWrapper);
|
|
|
+ if (CollUtil.isEmpty(admModelFiles)){
|
|
|
+ return CollUtil.newHashMap();
|
|
|
+ }
|
|
|
+ return admModelFiles.stream().collect(Collectors.toMap(AdmModelFile::getFloorId,admModelFile -> admModelFile,(k1,k2)->k1));
|
|
|
+ }
|
|
|
/**
|
|
|
- * 处理BOSS产生的交付计划
|
|
|
- * @param deliverPlanVo : 交付计划信息
|
|
|
+ * 新增模型文件
|
|
|
+ * @param modelFile : 模型文件信息
|
|
|
+ * return : void
|
|
|
* @author : lijie
|
|
|
- * Update By 2022/1/14 17:22
|
|
|
+ * Update By 2022/1/19 17:54
|
|
|
*/
|
|
|
@Override
|
|
|
- public void relayDeliverPlan(DeliverPlanVo deliverPlanVo) {
|
|
|
- // 1.根据商品code与项目任务模板的映射数据与规则生成项目任务数据
|
|
|
- // 2.调用dmp-rwd服务根据商品code生成交付范围
|
|
|
+ public void saveModelFile(AdmModelFile modelFile) {
|
|
|
+ admModelFileMapper.insertEntity(modelFile);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 创建关系查询对象
|
|
|
+ * @param objectMapper : objectMapper
|
|
|
+ * @param graphCode : 图类型编码
|
|
|
+ * @param relCode : 边类型编码
|
|
|
+ * @param buildingId : 建筑id
|
|
|
+ * @return : com.fasterxml.jackson.databind.node.ObjectNode
|
|
|
+ * @author : lijie
|
|
|
+ * Update By 2022/1/19 14:18
|
|
|
+ */
|
|
|
+ private ObjectNode createRelationQueryNode(ObjectMapper objectMapper, String graphCode, String relCode,
|
|
|
+ String buildingId) {
|
|
|
+ ObjectNode objectNode = objectMapper.createObjectNode();
|
|
|
+ objectNode.put(ObjectRelation.GRAPH_CODE_HUM,graphCode);
|
|
|
+ objectNode.put(ObjectRelation.REL_CODE_HUM,relCode);
|
|
|
+ objectNode.put(ObjectRelation.OBJ_FROM_HUM,buildingId);
|
|
|
+ return objectNode;
|
|
|
}
|
|
|
}
|