Browse Source

Merge branch 'develop' of http://39.106.8.246:3003/BDTP/adm-middleware.git into develop

zhangqiankun 3 years ago
parent
commit
d26771d8e7

+ 5 - 4
src/main/java/com/persagy/proxy/adm/model/AdmPoint.java

@@ -1,6 +1,7 @@
 package com.persagy.proxy.adm.model;
 
 import com.alibaba.fastjson.annotation.JSONField;
+import com.persagy.proxy.relation.model.BaseEntity;
 import lombok.Data;
 
 /**
@@ -9,17 +10,17 @@ import lombok.Data;
  * @date 2021/8/17
  */
 @Data
-public class AdmPoint {
+public class AdmPoint extends BaseEntity {
 
     /** 坐标x */
     @JSONField(name = "X")
-    private Double x;
+    private Double X;
 
     /** 坐标y */
     @JSONField(name = "Y")
-    private Double y;
+    private Double Y;
 
     /** 坐标z */
     @JSONField(name = "Z")
-    private Double z;
+    private Double Z;
 }

+ 4 - 6
src/main/java/com/persagy/proxy/adm/request/AdmDCSQueryRequest.java

@@ -1,13 +1,11 @@
 package com.persagy.proxy.adm.request;
 
-import java.util.Set;
-
 import com.fasterxml.jackson.annotation.JsonAlias;
-import com.persagy.proxy.adm.request.AdmQueryCriteria;
-
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import java.util.Set;
+
 /**
  * 业务空间查询请求体
  * @author lvxy
@@ -17,11 +15,11 @@ import lombok.EqualsAndHashCode;
 @EqualsAndHashCode(callSuper=true)
 public class AdmDCSQueryRequest extends AdmQueryCriteria {
     /** 楼层id */
-    
+    @JsonAlias(value = {"FloorId", "floorId"})
     private String floorId;
 
     /** 建筑id */
-   
+    @JsonAlias(value = {"BuildingId", "buildingId"})
     private String buildingId;
 
     /** 空间类型 */

+ 9 - 1
src/main/java/com/persagy/proxy/adm/utils/AdmEntityTransferUtil.java

@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.dmp.basic.utils.JsonNodeUtils;
+import com.persagy.dmp.common.utils.JsonHelper;
 
 import java.io.IOException;
 import java.util.Iterator;
@@ -58,7 +59,7 @@ public class AdmEntityTransferUtil {
      * @return
      */
     public static <T> List<T> toAdmMultiEntity(List array, List<String> projection, Class<T> clazz) {
-        ArrayNode dataNode = JsonNodeUtils.toArrayNode(array, null, null);
+        ArrayNode dataNode = JsonNodeUtils.toArrayNode(array, "infos", null);
         return toAdmMultiEntity(dataNode, projection, clazz);
     }
     
@@ -134,6 +135,13 @@ public class AdmEntityTransferUtil {
         copyProperty(node, "creationTime", "createTime");
         copyProperty(node, "modifiedTime", "lastUpdate");
         copyProperty(node, "objType", "objectType");
+        // outline特殊处理
+        JsonNode outLine = node.get("outline");
+        if(outLine != null && outLine.isTextual()) {
+            node.remove("outline");
+            ArrayNode arrayNode = JsonHelper.toSingleEntityQuietly(outLine.textValue(), ArrayNode.class);
+            node.set("outline", arrayNode);
+        }
         removeProperty(node, projection);
     }
 

+ 3 - 3
src/main/java/com/persagy/proxy/adm/utils/AdmQueryCriteriaHelper.java

@@ -206,15 +206,15 @@ public class AdmQueryCriteriaHelper {
      * @param express
      */
     private static void convertExpress(String name, ObjectNode criteria, String express) {
-        String cond = StrUtil.isBlank(StrUtil.getContainsStr(express, COND_STR)) ?
-                StrUtil.getContainsStr(express, COND_STR_TRIM) : StrUtil.getContainsStr(express, COND_STR);
+        String cond = StrUtil.isBlank(StrUtil.getContainsStrIgnoreCase(express, COND_STR)) ?
+                StrUtil.getContainsStrIgnoreCase(express, COND_STR_TRIM) : StrUtil.getContainsStrIgnoreCase(express, COND_STR);
         if(StrUtil.isBlank(cond)) {
             return;
         }
         int condIndex = StrUtil.indexOfIgnoreCase(express, cond, 0);
         String condLeft = StrUtil.subPre(express, condIndex).trim();
         String condRight = StrUtil.subSuf(express, condIndex+cond.length()).trim();
-        addCondition(name, criteria, condLeft, cond.trim(), condRight);
+        addCondition(name, criteria, condLeft, cond.trim().toLowerCase(), condRight);
     }
 
     /**

+ 22 - 23
src/main/java/com/persagy/proxy/object/controller/AdmSpaceController.java

@@ -1,41 +1,34 @@
 package com.persagy.proxy.object.controller;
 
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.ws.rs.QueryParam;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.fasterxml.jackson.databind.node.JsonNodeFactory;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.dmp.basic.model.QueryCriteria;
 import com.persagy.dmp.basic.utils.JsonNodeUtils;
 import com.persagy.proxy.adm.handler.SpaceRelationInfoHandler;
+import com.persagy.proxy.adm.request.*;
+import com.persagy.proxy.adm.service.IAdmRelationService;
+import com.persagy.proxy.adm.utils.AdmContextUtil;
+import com.persagy.proxy.adm.utils.ObjectNameUtil;
+import com.persagy.proxy.common.entity.RelationDTO;
 import com.persagy.proxy.object.model.AdmBuilding;
-import com.persagy.proxy.adm.request.AdmDCSQueryRequest;
 import com.persagy.proxy.object.model.AdmFloor;
 import com.persagy.proxy.object.model.AdmSpace;
-import com.persagy.proxy.adm.request.AdmUpDataFloorAndBuildingRequests;
-import com.persagy.proxy.adm.request.AdmCreateRequest;
-import com.persagy.proxy.adm.request.AdmQueryCriteria;
-import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.object.service.IAdmBuildingService;
 import com.persagy.proxy.object.service.IAdmFloorService;
-import com.persagy.proxy.adm.service.IAdmRelationService;
 import com.persagy.proxy.object.service.IAdmSpaceService;
-import com.persagy.proxy.adm.utils.AdmContextUtil;
-import com.persagy.proxy.adm.utils.ObjectNameUtil;
-import com.persagy.proxy.common.entity.RelationDTO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.util.StrUtil;
-import cn.hutool.json.JSONUtil;
+import javax.ws.rs.QueryParam;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * Adm 空间 API
@@ -312,6 +305,12 @@ public class AdmSpaceController {
         if(StrUtil.isNotEmpty(request.getZoneType())){
             objectNode.put("zoneType", request.getZoneType());
         }
+        if(StrUtil.isNotEmpty(request.getFloorId())){
+            objectNode.put("floorId", request.getFloorId());
+        }
+        if(StrUtil.isNotEmpty(request.getBuildingId())){
+            objectNode.put("buildingId", request.getBuildingId());
+        }
         return objectNode;
     }
 

+ 1 - 1
src/main/java/com/persagy/proxy/object/model/AdmComponent.java

@@ -87,7 +87,7 @@ public class AdmComponent extends AdmBaseEntity<AdmComponent> {
         /** 二维码图片 */
         private String qrcodePic;
         /** 对象类型 */
-        private String objectType;
+        private String objectType = OBJ_TYPE;
 
         /** 部件分类 */
         private Map<String, String> equipCategory;

+ 2 - 1
src/main/java/com/persagy/proxy/object/model/AdmISpace.java

@@ -5,6 +5,7 @@ import lombok.Data;
 
 import java.util.ArrayList;
 import java.util.Date;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -73,7 +74,7 @@ public class AdmISpace {
     private String objectType = OBJ_TYPE;
 
     /** 轮廓线 */
-    private ArrayList<ArrayList<AdmPoint>> outline;
+    private List<List<AdmPoint>> outline;
 
     /** 对象类型code */
     private String classCode;

+ 10 - 1
src/main/java/com/persagy/proxy/object/service/impl/AdmShaftServiceImpl.java

@@ -6,10 +6,12 @@ import com.persagy.proxy.object.model.AdmEquipment;
 import com.persagy.proxy.object.model.AdmShaft;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.object.model.AdmSystem;
 import com.persagy.proxy.object.service.IAdmEquipmentService;
 import com.persagy.proxy.object.service.IAdmShaftService;
 import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.object.service.IAdmSystemService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -25,20 +27,27 @@ import java.util.List;
 public class AdmShaftServiceImpl extends AbstractAdmBaseServiceImpl<AdmShaft> implements IAdmShaftService {
     @Autowired
     private IAdmEquipmentService equipmentService;
+    @Autowired
+    private IAdmSystemService systemService;
 
     @Override
     public void ensureSpecialValues(InstanceUrlParam context, List<AdmShaft> vos) {
         if(CollUtil.isEmpty(vos)) {
             return;
         }
-        //收集设备对象
+        //收集设备对象、系统对象
         List<AdmEquipment> equipmentList = new ArrayList<>();
+        List<AdmSystem> systemList = new ArrayList<>();
         vos.stream().forEach(admShaft -> {
             if(CollUtil.isNotEmpty(admShaft.getEquipmentList())){
                 equipmentList.addAll(admShaft.getEquipmentList());
             }
+            if(CollUtil.isNotEmpty(admShaft.getSystemList())){
+                systemList.addAll(admShaft.getSystemList());
+            }
         });
         equipmentService.ensureSpecialValues(AdmContextUtil.toDmpContext(), equipmentList);
+        systemService.ensureSpecialValues(AdmContextUtil.toDmpContext(), systemList);
     }
     @Override
     public AdmResponse doQuery(InstanceUrlParam context, AdmQueryCriteria request, Class<AdmShaft> clazz) {

+ 12 - 5
src/main/java/com/persagy/proxy/object/service/impl/AdmSystemServiceImpl.java

@@ -1,17 +1,18 @@
 package com.persagy.proxy.object.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
+import com.persagy.proxy.adm.request.AdmQueryCriteria;
+import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.impl.AbstractAdmBaseServiceImpl;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
 import com.persagy.proxy.dictionary.model.AdmDict;
-import com.persagy.proxy.object.model.AdmEquipment;
 import com.persagy.proxy.dictionary.model.AdmObjectType;
-import com.persagy.proxy.object.model.AdmSystem;
-import com.persagy.proxy.adm.request.AdmQueryCriteria;
-import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.dictionary.service.IAdmDictService;
+import com.persagy.proxy.object.model.AdmEquipment;
+import com.persagy.proxy.object.model.AdmSystem;
+import com.persagy.proxy.object.model.AdmSystemCategory;
 import com.persagy.proxy.object.service.IAdmEquipmentService;
 import com.persagy.proxy.object.service.IAdmSystemService;
-import com.persagy.proxy.common.entity.InstanceUrlParam;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -54,10 +55,16 @@ public class AdmSystemServiceImpl extends AbstractAdmBaseServiceImpl<AdmSystem>
         }
         // 转换为编码名称Map
         Map<String, String> codeNameMap = CollUtil.fieldValueAsMap(dicList, "code", "name");
+        Map<String, AdmObjectType> codeNameMaps = CollUtil.fieldValueMap(dicList, "code");
         // 给系统赋值 - 同时收集设备对象,扩展设备对象赋值
         List<AdmEquipment> equipmentList = new ArrayList<>();
         for(AdmSystem vo:vos) {
             vo.setCategoryName(codeNameMap.get(vo.getClassCode()));
+            AdmSystemCategory admSystemCategory = new AdmSystemCategory();
+            admSystemCategory.setCategoryName(codeNameMaps.get(vo.getClassCode()).getName());
+            admSystemCategory.setCode(codeNameMaps.get(vo.getClassCode()).getCode());
+            admSystemCategory.setProjectI(codeNameMaps.get(vo.getClassCode()).getProjectId());
+            vo.setCategoryNames(admSystemCategory);
             // 收集设备对象
             if(CollUtil.isEmpty(vo.getEquipmentList())) {
                 continue;

+ 2 - 2
src/main/java/com/persagy/proxy/relation/controller/RelationShInBdController.java

@@ -45,8 +45,8 @@ public class RelationShInBdController {
             return AdmResponse.failure("必填项:shaftId(竖井id)、BuildingIdList(建筑id列表)");
         }
         List<RelationDTO> voList = new ArrayList<>();
-        String graphCode = AdmRelationTypeEnum.BD2SH_ARCHFORARCH.getGraphCode();
-        String relCode = AdmRelationTypeEnum.BD2SH_ARCHFORARCH.getRelCode();
+        String graphCode = AdmRelationTypeEnum.BD2SH_ARCHSUBSET.getGraphCode();
+        String relCode = AdmRelationTypeEnum.BD2SH_ARCHSUBSET.getRelCode();
         // 组装关系
         for (String buildingId : buildingIdList) {
             RelationDTO relation = RelationDTO.builder().graphCode(graphCode).relCode(relCode)