Browse Source

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

zhangqiankun 3 years ago
parent
commit
59b63526ce
22 changed files with 500 additions and 174 deletions
  1. 8 0
      src/main/java/com/persagy/proxy/adm/controller/AdmModelRelController.java
  2. 29 20
      src/main/java/com/persagy/proxy/adm/controller/AdmRelCalController.java
  3. 19 8
      src/main/java/com/persagy/proxy/adm/controller/AdmReportEquipController.java
  4. 8 28
      src/main/java/com/persagy/proxy/adm/controller/AdmSystemController.java
  5. 2 0
      src/main/java/com/persagy/proxy/adm/model/AdmDict.java
  6. 6 3
      src/main/java/com/persagy/proxy/adm/model/AdmEquipment.java
  7. 5 2
      src/main/java/com/persagy/proxy/adm/model/AdmObjectInfo.java
  8. 1 1
      src/main/java/com/persagy/proxy/adm/model/AdmShaft.java
  9. 5 0
      src/main/java/com/persagy/proxy/adm/model/AdmSystem.java
  10. 18 0
      src/main/java/com/persagy/proxy/adm/service/IAdmBaseService.java
  11. 4 3
      src/main/java/com/persagy/proxy/adm/service/IAdmDictService.java
  12. 7 0
      src/main/java/com/persagy/proxy/adm/service/IAdmEquipmentService.java
  13. 30 0
      src/main/java/com/persagy/proxy/adm/service/IAdmObjectRelationCalService.java
  14. 10 0
      src/main/java/com/persagy/proxy/adm/service/IAdmSystemService.java
  15. 50 0
      src/main/java/com/persagy/proxy/adm/service/impl/AbstractAdmBaseServiceImpl.java
  16. 2 51
      src/main/java/com/persagy/proxy/adm/service/impl/AbstractAdmDictBaseServiceImpl.java
  17. 95 16
      src/main/java/com/persagy/proxy/adm/service/impl/AdmDictServiceImpl.java
  18. 43 6
      src/main/java/com/persagy/proxy/adm/service/impl/AdmEquipmentServiceImpl.java
  19. 47 35
      src/main/java/com/persagy/proxy/adm/service/impl/AdmModelRelServiceImpl.java
  20. 55 0
      src/main/java/com/persagy/proxy/adm/service/impl/AdmObjectRelationCalServiceImpl.java
  21. 55 0
      src/main/java/com/persagy/proxy/adm/service/impl/AdmSystemServiceImpl.java
  22. 1 1
      src/main/java/com/persagy/proxy/common/client/DmpRwdClient.java

+ 8 - 0
src/main/java/com/persagy/proxy/adm/controller/AdmModelRelController.java

@@ -1,10 +1,12 @@
 package com.persagy.proxy.adm.controller;
 
+import com.persagy.dmp.common.exception.BusinessException;
 import com.persagy.proxy.adm.model.AdmModelRel;
 import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.IAdmModelRelService;
 import com.persagy.proxy.adm.utils.AdmContextUtil;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -41,6 +43,12 @@ public class AdmModelRelController {
      */
     @PostMapping("/equip-ispace")
     public AdmResponse update(@RequestBody AdmModelRel admModelRel) throws Exception {
+        if(StringUtils.isEmpty(admModelRel.getModelId())){
+            throw new BusinessException("模型ID不能为空");
+        }
+        if(StringUtils.isEmpty(admModelRel.getFloorId())){
+            throw new BusinessException("楼层ID不能为空");
+        }
         List<AdmModelRel> vos = service.doUpdateModelInfo(AdmContextUtil.toDmpContext(), AdmModelRel.class,admModelRel);
         return AdmResponse.success(vos);
     }

+ 29 - 20
src/main/java/com/persagy/proxy/adm/controller/AdmRelCalController.java

@@ -46,8 +46,9 @@ public class AdmRelCalController {
      * Update By lijie 2021/8/31 12:10
      */
     @PostMapping(value = {"bd2sp","fl2sp","sh2bd"})
-    public AdmResponse archSubsetCalcRelation(@RequestParam("objectTypes") String objectTypeStr,
-                                              @RequestParam("relationType") String relationTypeStr, HttpServletRequest request) {
+    public AdmResponse archSubsetCalcRelation(@RequestParam(value = "objectTypes",required = false) String objectTypeStr,
+                                              @RequestParam(value = "relationType",required = false) String relationTypeStr,
+                                              HttpServletRequest request) {
         admRelCalService.calcRelation(AdmContextUtil.toDmpContext(),CollUtil.newArrayList(getAdmRelationTypeEnum(request)),null);
         return AdmResponse.success(new ArrayList<>());
     }
@@ -71,8 +72,9 @@ public class AdmRelCalController {
      * Update By lijie 2021/8/31 12:10
      */
     @PostMapping(value = {"eq2bd","eq2fl","eq2sh","eq2sp_in","sy2bd","sy2fl","sy2sh","sy2sp"})
-    public AdmResponse mechInArchCalcRelation(@RequestParam("objectTypes") String objectTypeStr,
-                                              @RequestParam("relationType") String relationTypeStr, HttpServletRequest request) {
+    public AdmResponse mechInArchCalcRelation(@RequestParam(value = "objectTypes",required = false) String objectTypeStr,
+                                              @RequestParam(value = "relationType",required = false) String relationTypeStr,
+                                              HttpServletRequest request) {
         admRelCalService.calcRelation(AdmContextUtil.toDmpContext(), CollUtil.newArrayList(getAdmRelationTypeEnum(request)),null);
         return AdmResponse.success(new ArrayList<>());
     }
@@ -92,8 +94,8 @@ public class AdmRelCalController {
      * Update By lijie 2021/8/31 12:10
      */
     @PostMapping(value = {"pe2bd","pe2fl","pe2sh","pe2sp"})
-    public AdmResponse propertyInArchCalcRelation(@RequestParam("objectTypes") String objectTypeStr,
-                                                  @RequestParam("relationType") String relationTypeStr) {
+    public AdmResponse propertyInArchCalcRelation(@RequestParam(value = "objectTypes",required = false) String objectTypeStr,
+                                                  @RequestParam(value = "relationType",required = false) String relationTypeStr) {
         // 资产暂时未引入,直接返回成功
         // 组装上下文条件
         InstanceUrlParam context = AdmContextUtil.toDmpContext();
@@ -112,8 +114,8 @@ public class AdmRelCalController {
      * Update By lijie 2021/8/31 12:10
      */
     @PostMapping(value = {"eq2sp_for"})
-    public AdmResponse mechForArchCalcRelation(@RequestParam("objectTypes") String objectTypeStr,
-                                               @RequestParam("relationType") String relationTypeStr) {
+    public AdmResponse mechForArchCalcRelation(@RequestParam(value = "objectTypes",required = false) String objectTypeStr,
+                                               @RequestParam(value = "relationType",required = false) String relationTypeStr) {
         // 资产暂时未引入,直接返回成功
         // 组装上下文条件
         InstanceUrlParam context = AdmContextUtil.toDmpContext();
@@ -132,10 +134,11 @@ public class AdmRelCalController {
      * Update By lijie 2021/8/31 12:10
      */
     @PostMapping(value = {"sp2sp"})
-    public AdmResponse archForArchCalcRelation( @RequestParam("buildingId") String buildingId,
-                                                @RequestParam("objectType") String objectType,
-                                                @RequestParam("type") String type) {
-        admRelCalService.calcRelationForArchForArchSpToSp(AdmContextUtil.toDmpContext(),buildingId,objectType,type,AdmRelationTypeEnum.SP2SP_ARCHFORARCH);
+    public AdmResponse archForArchCalcRelation( @RequestParam(value = "buildingId",required = false) String buildingId,
+                                                @RequestParam(value = "objectType",required = false) String objectType,
+                                                @RequestParam(value = "type",required = false) String type) {
+        admRelCalService.calcRelationForArchForArchSpToSp(AdmContextUtil.toDmpContext(),buildingId,objectType,type,
+                AdmRelationTypeEnum.SP2SP_ARCHFORARCH);
         return AdmResponse.success(new ArrayList<>());
     }
     /***
@@ -148,7 +151,8 @@ public class AdmRelCalController {
      */
     @PostMapping(value = {"eq2sp_SensorRelationship_ss2sp"})
     public AdmResponse sensorRelationshipCalcRelation() {
-        admRelCalService.calcRelation(AdmContextUtil.toDmpContext(),CollUtil.newArrayList(AdmRelationTypeEnum.EQ2SP_SENSORRELATIONSHIP_SS2SP),"AirConditioningZone");
+        admRelCalService.calcRelation(AdmContextUtil.toDmpContext(),
+                CollUtil.newArrayList(AdmRelationTypeEnum.EQ2SP_SENSORRELATIONSHIP_SS2SP),"AirConditioningZone");
         return AdmResponse.success(new ArrayList<>());
     }
     /***
@@ -161,7 +165,8 @@ public class AdmRelCalController {
      */
     @PostMapping(value = {"sp2sp_ConvectionNetwork_1"})
     public AdmResponse convectionNetworkCalcRelation() {
-        admRelCalService.calcRelation(AdmContextUtil.toDmpContext(),CollUtil.newArrayList(AdmRelationTypeEnum.SP2SP_CONVECTIONNETWORK_1),null);
+        admRelCalService.calcRelation(AdmContextUtil.toDmpContext(),
+                CollUtil.newArrayList(AdmRelationTypeEnum.SP2SP_CONVECTIONNETWORK_1),null);
         return AdmResponse.success(new ArrayList<>());
     }
     /***
@@ -174,7 +179,8 @@ public class AdmRelCalController {
      */
     @PostMapping(value = {"sp2sp_RadiationNetwork_1"})
     public AdmResponse radiationNetworkCalcRelation() {
-        admRelCalService.calcRelation(AdmContextUtil.toDmpContext(),CollUtil.newArrayList(AdmRelationTypeEnum.SP2SP_RADIATIONNETWORK_1),null);
+        admRelCalService.calcRelation(AdmContextUtil.toDmpContext(),
+                CollUtil.newArrayList(AdmRelationTypeEnum.SP2SP_RADIATIONNETWORK_1),null);
         return AdmResponse.success(new ArrayList<>());
     }
     /***
@@ -187,7 +193,8 @@ public class AdmRelCalController {
      */
     @PostMapping(value = {"sp2sp_SpaceNeighborhood_5"})
     public AdmResponse spaceNeighborhoodCalcRelation() {
-        admRelCalService.calcRelation(AdmContextUtil.toDmpContext(),CollUtil.newArrayList(AdmRelationTypeEnum.SP2SP_SPACENEIGHBORHOOD_5),null);
+        admRelCalService.calcRelation(AdmContextUtil.toDmpContext(),
+                CollUtil.newArrayList(AdmRelationTypeEnum.SP2SP_SPACENEIGHBORHOOD_5),null);
         return AdmResponse.success(new ArrayList<>());
     }
     /***
@@ -219,7 +226,8 @@ public class AdmRelCalController {
      */
     @PostMapping(value = {"sp2sp_TrafficNetwork_1"})
     public AdmResponse trafficNetworkCalcRelation() {
-        admRelCalService.calcRelation(AdmContextUtil.toDmpContext(),CollUtil.newArrayList(AdmRelationTypeEnum.SP2SP_TRAFFICNETWORK_1),null);
+        admRelCalService.calcRelation(AdmContextUtil.toDmpContext(),
+                CollUtil.newArrayList(AdmRelationTypeEnum.SP2SP_TRAFFICNETWORK_1),null);
         return AdmResponse.success(new ArrayList<>());
     }
     /***
@@ -233,7 +241,8 @@ public class AdmRelCalController {
      */
     @PostMapping(value = {"fl2fl","sh2sh"})
     public AdmResponse throughRelationshipCalcRelation(HttpServletRequest request) {
-        admRelCalService.calcRelation(AdmContextUtil.toDmpContext(),CollUtil.newArrayList(getAdmRelationTypeEnum(request)),null);
+        admRelCalService.calcRelation(AdmContextUtil.toDmpContext(),
+                CollUtil.newArrayList(getAdmRelationTypeEnum(request)),null);
         return AdmResponse.success(new ArrayList<>());
     }
 
@@ -251,8 +260,8 @@ public class AdmRelCalController {
      */
     @PostMapping(value = {"sign"})
     public AdmResponse changeSign( @PathVariable("relType") String relType,
-                                     @QueryParam("objectTypes") String objectTypeStr,
-                                     @QueryParam("relationType") String relationTypeStr) {
+                                   @RequestParam(value = "objectTypes",required = false) String objectTypeStr,
+                                   @RequestParam(value = "relationType",required = false) String relationTypeStr) {
         // 资产暂时未引入,直接返回成功
         // 组装上下文条件
         InstanceUrlParam context = AdmContextUtil.toDmpContext();

+ 19 - 8
src/main/java/com/persagy/proxy/adm/controller/AdmReportEquipController.java

@@ -20,6 +20,7 @@ import com.persagy.dmp.digital.client.DigitalRelationFacade;
 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.enums.AdmDictCategoryEnum;
 import com.persagy.proxy.adm.model.*;
 import com.persagy.proxy.adm.model.equip.EquipUpDateEnclosure;
 import com.persagy.proxy.adm.request.AdmCreateRequest;
@@ -305,10 +306,7 @@ public class AdmReportEquipController {
         criteriaEquip.putPOJO("relationTo",relationTo);
         queryCriteria.setCriteria(criteriaEquip);
         List<ObjectNode> equips = DigitalObjectFacade.query(groupCode,AdmContextUtil.toDmpContext().getProjectId(),AdmCommonConstant.APP_ID,null,queryCriteria);
-        if (CollUtil.isEmpty(equips))
-            return AdmResponse.success();
-        else
-            return AdmResponse.success(equips);
+        return AdmResponse.success(equips);
     }
 
     /**
@@ -321,7 +319,7 @@ public class AdmReportEquipController {
         //return SysEquipService.pageQuery(request, arrayListOf(SFilter.eq("projectId", SPageAdmContextUtil.toDmpContext().getHeader("projectId").toString())))
         request.setName(AdmSystem.OBJ_TYPE);
         QueryCriteria queryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(request);
-        queryCriteria.setSize(500l);
+        queryCriteria.setSize(500L);
         List<ObjectNode> objectNodeList = DigitalObjectFacade.query(groupCode,AdmContextUtil.toDmpContext().getProjectId(),AdmCommonConstant.APP_ID,null,queryCriteria);
         if(CollUtil.isEmpty(objectNodeList)){
             return AdmResponse.success();
@@ -329,8 +327,8 @@ public class AdmReportEquipController {
         List<AdmSystem> admSystemList = JSONUtil.toList(objectNodeList.toString(), AdmSystem.class);
         Map<String, AdmSystem> admSystemMap = CollUtil.fieldValueMap(admSystemList, BaseEntity.PROP_ID);
         QueryCriteria queryCriteriaRelation = new QueryCriteria();
-        queryCriteriaRelation.setPage(request.getPageNumber() == null ? 0 : request.getPageNumber()*1l);
-        queryCriteriaRelation.setSize(request.getPageSize() == null ? 0 : request.getPageSize()*1l);
+        queryCriteriaRelation.setPage(request.getPageNumber() == null ? 0 : request.getPageNumber()*1L);
+        queryCriteriaRelation.setSize(request.getPageSize() == null ? 0 : request.getPageSize()*1L);
 
         ObjectNode criteria = JsonNodeFactory.instance.objectNode();
         criteria.put("relCode", "Sy2Eq");
@@ -814,6 +812,17 @@ public class AdmReportEquipController {
         }
     }
 
+    /**
+     * 查询系统-设备类树
+     * @return
+     * @throws Exception
+     */
+    @GetMapping("/type/tree")
+    public AdmResponse querySystemEquipCategory() throws Exception {
+        // 组装上下文条件
+        AdmDict request = AdmDict.builder().type(AdmDictCategoryEnum.SYSTEM_EQUIP.getValue()).build();
+        return dictService.queryCategory(AdmContextUtil.toDmpContext(),request,AdmObjectType.class);
+    }
 
     /**
      * 计算动态、静态信息点
@@ -960,7 +969,7 @@ public class AdmReportEquipController {
         } else {
             // 2.2 根据定义获取信息点
             //查询当前实例所有信息点总数
-            long controlInfoCounts = 0l;
+            long controlInfoCounts = 0L;
             QueryCriteria queryCriteria = new QueryCriteria();
             ObjectNode criteria = JsonNodeFactory.instance.objectNode();
             criteria = JsonNodeFactory.instance.objectNode();
@@ -1024,4 +1033,6 @@ public class AdmReportEquipController {
             infos.put(attribute, upTarget);
         }
     }
+
+
 }

+ 8 - 28
src/main/java/com/persagy/proxy/adm/controller/AdmSystemController.java

@@ -177,8 +177,7 @@ public class AdmSystemController {
      * @throws Exception
      */
     @GetMapping("/export")
-    public AdmResponse exportInfos(
-                             @RequestBody AdmQueryCriteria request) throws Exception {
+    public AdmResponse exportInfos(@RequestBody AdmQueryCriteria request) {
         request.setName(AdmSystem.OBJ_TYPE);
         return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmSystem.class);
     }
@@ -207,33 +206,14 @@ public class AdmSystemController {
 
     /**
      * 查询
-
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/query")
-    public AdmResponse query(@RequestBody AdmQueryCriteria request) throws Exception {
+    public AdmResponse query(@RequestBody AdmQueryCriteria request) {
         request.setName(AdmSystem.OBJ_TYPE);
-        AdmResponse admResponse = service.doQuery(AdmContextUtil.toDmpContext(), request, AdmSystem.class);
-        List<AdmSystem> systemList = (List<AdmSystem>) admResponse.getContent();
-        if(CollUtil.isNotEmpty(systemList)){
-            AdmDict admDict = new AdmDict();
-            admDict.setType(AdmSystem.OBJ_TYPE);
-            AdmResponse admResponseDic = dictService.queryCategory(AdmContextUtil.toDmpContext(), admDict, AdmObjectType.class);
-            if(CollUtil.isNotEmpty(admResponseDic.getContent())){
-                List<AdmObjectType> admDictList = (List<AdmObjectType>) admResponseDic.getContent();
-                Map<String, AdmObjectType> admDictMap = CollUtil.fieldValueMap(admDictList, "code");
-                systemList.stream().forEach(admSystem -> {
-                    if(admDictMap.keySet().contains(admSystem.getClassCode())){
-                        AdmObjectType admDictTemp = admDictMap.get(admSystem.getClassCode());
-                        admSystem.setCategoryName(admDictTemp.getName());
-                    }
-                });
-                admResponse.setContent(systemList);
-            }
-        }
-        return admResponse;
+        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmSystem.class);
     }
 
 
@@ -381,8 +361,8 @@ public class AdmSystemController {
         requestData.setSize(rwdQueryCriteria.getSize());
         List result = DigitalObjectSimpleFacade.queryNotSureSystem(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmContextUtil.toDmpContext().getAppId(),null, requestData);
         if(CollUtil.isNotEmpty(result)){
-           List<AdmSystem> admSystemList = JSONUtil.toList(result.toString(), AdmSystem.class);
-           return admSystemList;
+            List<AdmSystem> admSystemList = JSONUtil.toList(result.toString(), AdmSystem.class);
+            return admSystemList;
         }else{
             return null;
         }
@@ -464,7 +444,7 @@ public class AdmSystemController {
      */
     @PostMapping("/un-sys-equip")
     public AdmResponse queryUnEquip( @NotNull @QueryParam("sysId") String sysId,
-                             @RequestBody AdmQueryCriteria request) throws Exception {
+                                     @RequestBody AdmQueryCriteria request) throws Exception {
         AdmResponse admResponse = queryObjectByType(sysId,request,"Sy2Eq","MechSubset", AdmEquipment.OBJ_TYPE);
         return admResponse;
     }
@@ -480,7 +460,7 @@ public class AdmSystemController {
      */
     @PostMapping("/un-sys-shaft")
     public AdmResponse queryUnSh( @NotNull @QueryParam("sysId") String sysId,
-                             @RequestBody AdmQueryCriteria request) throws Exception {
+                                  @RequestBody AdmQueryCriteria request) throws Exception {
         AdmResponse admResponse = queryObjectByType(sysId,request,"Sy2Sh",null, AdmShaft.OBJ_TYPE);
         return admResponse;
     }
@@ -495,7 +475,7 @@ public class AdmSystemController {
      */
     @PostMapping("/un-sys-zoneSpaceBaseTable")
     public AdmResponse queryUnZoneSp(@NotNull @QueryParam("sysId") String sysId,
-                             @RequestBody AdmQueryCriteria request) throws Exception {
+                                     @RequestBody AdmQueryCriteria request) throws Exception {
         AdmResponse admResponse = queryObjectByType(sysId,request,"Sy2Sp",null, AdmSpace.OBJ_TYPE);
         return admResponse;
     }

+ 2 - 0
src/main/java/com/persagy/proxy/adm/model/AdmDict.java

@@ -1,5 +1,6 @@
 package com.persagy.proxy.adm.model;
 
+import lombok.Builder;
 import lombok.Data;
 
 /**
@@ -10,6 +11,7 @@ import lombok.Data;
  * @Version V1.0
  **/
 @Data
+@Builder
 public class AdmDict {
 
   private String type;

+ 6 - 3
src/main/java/com/persagy/proxy/adm/model/AdmEquipment.java

@@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode;
 
 import javax.persistence.Column;
 import java.util.List;
+import java.util.Map;
 
 /**
  * ADM 设备 实体
@@ -71,8 +72,8 @@ public class AdmEquipment extends AdmSBaseEntity<AdmEquipment>{
 
     /** 品牌id */
     private String dpBrandId;
-    
-    
+
+
 
     /** Revit族 */
     private String bimFamilyName;
@@ -109,7 +110,9 @@ public class AdmEquipment extends AdmSBaseEntity<AdmEquipment>{
     private String qrcodePic;
 
     /** 对象类型 */
-    private String objectType;
+    private String objectType = OBJ_TYPE;
+    /** 设备分类 */
+    private Map<String, String> equipCategory;
 
     /** 资产信息实体类   资产对应设备设施关系 资产→设备设施*/
     @CascadeColumn(graphCode = "Property2Mech", relCode = "Pe2Eq", selectToObj = false)

+ 5 - 2
src/main/java/com/persagy/proxy/adm/model/AdmObjectInfo.java

@@ -101,12 +101,12 @@ public class AdmObjectInfo {
 
     /** 是否只读, 如果是则不允许对该信息点做变更 */
     private Boolean readonly;
-
     /** 排序 */
     private Integer sort;
 
     /** 是否显示 */
-   private Boolean visible;
+    private Boolean visible;
+
 
     /** 是否编辑 */
     private Boolean editable;
@@ -123,4 +123,7 @@ public class AdmObjectInfo {
 
     /** 字典内容 */
    private List<AdmObjectInfo> content;
+
+   /** 展示顺序 */
+   private Integer showOrder;
 }

+ 1 - 1
src/main/java/com/persagy/proxy/adm/model/AdmShaft.java

@@ -44,7 +44,7 @@ public class AdmShaft extends AdmSBaseEntity<AdmShaft>{
     /** BIM模型中轮廓坐标 */
     private List<AdmPointPosition> outline;
     /** 对象类型 */
-    private String objectType;
+    private String objectType = OBJ_TYPE;
     /** 级联-竖井内的设备 */
     @CascadeColumn(graphCode = "MechInArch", relCode = "Eq2Sh", selectToObj = false)
     private List<AdmEquipment> equipmentList;

+ 5 - 0
src/main/java/com/persagy/proxy/adm/model/AdmSystem.java

@@ -49,6 +49,11 @@ public class AdmSystem extends AdmSBaseEntity<AdmSystem> {
     /** 级联-设备 */
     @CascadeColumn(graphCode = "MechSubset", relCode = "Sy2Eq")
     private List<AdmEquipment> equipmentList;
+
+    /** 级联-竖井*/
+    @CascadeColumn(graphCode = "MechInArch", relCode = "Sy2Sh")
+    private List<AdmShaft> shaftList;
+
     /** 级联-空间 */
     @CascadeColumn(graphCode = "MechInArch", relCode = "Sy2Sp")
     private List<AdmSpace> zoneSpaceBaseTableList;

+ 18 - 0
src/main/java/com/persagy/proxy/adm/service/IAdmBaseService.java

@@ -55,4 +55,22 @@ public interface IAdmBaseService<T> {
      * @return
      */
     AdmResponse doQuery(InstanceUrlParam context, QueryCriteria request, Class<T> clazz);
+
+    /**
+     * 条件查询标记计算关系
+     * @param context
+     * @param dmpRequest
+     * @param clazz
+     * @return
+     */
+    AdmResponse doQueryRelationProjectCal(InstanceUrlParam context, QueryCriteria dmpRequest, Class<T> clazz);
+
+    /**
+     * 修改标记计算关系
+     * @param context
+     * @param clazz
+     * @param voList
+     * @return
+     */
+    List<T> doUpdateRelationProjectCal(InstanceUrlParam context, Class<T> clazz, List<T> voList);
 }

+ 4 - 3
src/main/java/com/persagy/proxy/adm/service/IAdmDictService.java

@@ -1,8 +1,9 @@
 package com.persagy.proxy.adm.service;
 
-import com.persagy.proxy.adm.model.*;
+import com.persagy.proxy.adm.model.AdmDefFuncIdGather;
+import com.persagy.proxy.adm.model.AdmDict;
+import com.persagy.proxy.adm.model.AdmDictQueryCriteria;
 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.common.entity.InstanceUrlParam;
 
@@ -25,7 +26,7 @@ public interface IAdmDictService<T> extends IAdmDictBaseService<T>{
      * @return
      * @throws Exception
      */
-    AdmResponse queryCategory(InstanceUrlParam context , AdmDict request, Class<T> clazz) throws Exception;
+    AdmResponse queryCategory(InstanceUrlParam context , AdmDict request, Class<T> clazz);
 
 
     /**

+ 7 - 0
src/main/java/com/persagy/proxy/adm/service/IAdmEquipmentService.java

@@ -41,4 +41,11 @@ public interface IAdmEquipmentService extends IAdmBaseService<AdmEquipment>{
     void doDeleteEuip(InstanceUrlParam context, List<AdmEquipment> voList);
     @Deprecated
     public List<AdmEquipment> doInsertExt(InstanceUrlParam context, Class<AdmEquipment> clazz, List<AdmEquipment> voList);
+
+    /**
+     * 补充设备类型属性
+     * @param context
+     * @param vos
+     */
+    void ensureSpecialValues(InstanceUrlParam context, List<AdmEquipment> vos);
 }

+ 30 - 0
src/main/java/com/persagy/proxy/adm/service/IAdmObjectRelationCalService.java

@@ -0,0 +1,30 @@
+package com.persagy.proxy.adm.service;
+
+import com.persagy.dmp.digital.entity.ObjectRelationProjectCal;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * 标记关系计算
+ * @author:linhuili
+ * @date:2021/10/15
+ */
+public interface IAdmObjectRelationCalService extends IAdmBaseService<ObjectRelationProjectCal> {
+
+    /**
+     *  根据关系类型查询标记计算关系
+     * @param context
+     * @param relationType
+     * @return
+     */
+    List<ObjectRelationProjectCal> queryCalRelByRelationType(InstanceUrlParam context, Set<String> relationType);
+
+    /**
+     * 更新标记计算关系
+     * @param context
+     * @param objectRelationProjectCals
+     */
+    void updateObjectCalRel(InstanceUrlParam context, List<ObjectRelationProjectCal> objectRelationProjectCals);
+}

+ 10 - 0
src/main/java/com/persagy/proxy/adm/service/IAdmSystemService.java

@@ -1,6 +1,9 @@
 package com.persagy.proxy.adm.service;
 
 import com.persagy.proxy.adm.model.AdmSystem;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+
+import java.util.List;
 
 /**
  * ADM 系统 接口
@@ -8,4 +11,11 @@ import com.persagy.proxy.adm.model.AdmSystem;
  * @date 2021/8/18
  */
 public interface IAdmSystemService extends IAdmBaseService<AdmSystem>{
+
+    /**
+     * 补充系统分类名称属性
+     * @param context
+     * @param vos
+     */
+    void ensureSpecialValues(InstanceUrlParam context, List<AdmSystem> vos);
 }

+ 50 - 0
src/main/java/com/persagy/proxy/adm/service/impl/AbstractAdmBaseServiceImpl.java

@@ -415,4 +415,54 @@ public class AbstractAdmBaseServiceImpl<T> implements IAdmBaseService<T> {
         return response;
     }
 
+    /**
+     * 查询标记计算关系
+     * @param context
+     * @param dmpRequest
+     * @param clazz
+     * @return
+     */
+    @Override
+    public AdmResponse doQueryRelationProjectCal(InstanceUrlParam context, QueryCriteria dmpRequest, Class<T> clazz) {
+        // 转换参数
+        JSONObject para = null;
+        try {
+            para = JsonHelper.toJsonObject(dmpRequest);
+        } catch (IOException e) {
+            log.error(e.getMessage(), e);
+            return null;
+        }
+        // 调用中台查询
+        DmpResult<JSONArray> dmpResult = rwdClient.queryRelationProjectCal(context, para);
+        List<T> admVOs = AdmEntityTransferUtil.toAdmMultiEntity(dmpResult.getData(), null, clazz);
+        // 设置返回值
+        AdmResponse response = AdmResponse.success(admVOs);
+        Long total = dmpResult.getCount() == null ? null : dmpResult.getCount().longValue();
+        response.setTotal(total);
+        return response;
+    }
+
+
+    /**
+     * 修改
+     * @param context
+     * @param clazz
+     * @param voList
+     * @return
+     */
+    @Override
+    public List<T> doUpdateRelationProjectCal(InstanceUrlParam context, Class<T> clazz, List<T> voList) {
+        if(CollUtil.isEmpty(voList)) {
+            return null;
+        }
+        ArrayNode vos = AdmEntityTransferUtil.toDmpMultiEntity(voList);
+        // 调用中台修改
+        DmpResult<JSONArray> response = rwdClient.updateRelationProjectCal(context, JSONArray.parseArray(vos.toString()));
+        if(!DmpResult.SUCCESS.equals(response.getResult())) {
+            throw new RuntimeException("调用中台查询接口出错:" + response.getMessage());
+        }
+        // 转换为结果
+        return AdmEntityTransferUtil.toAdmMultiEntity(response.getData(), null, clazz);
+    }
+
 }

+ 2 - 51
src/main/java/com/persagy/proxy/adm/service/impl/AbstractAdmDictBaseServiceImpl.java

@@ -199,6 +199,7 @@ public class AbstractAdmDictBaseServiceImpl<T> implements IAdmDictBaseService<T>
             admVO.setMultiple(admVO.getIsMultiple());
             admVO.setRegion(admVO.getIsRegion());
             admVO.setGroupCode(groupCode);
+            admVO.setSort(admVO.getShowOrder());
 
             //path路径处理
             if(StringUtils.isEmpty(admVO.getFirstName()) || AdmDictConstant.FIRST_BASE_TAG.equals(admVO.getFirstName())
@@ -212,60 +213,10 @@ public class AbstractAdmDictBaseServiceImpl<T> implements IAdmDictBaseService<T>
             if(admVO.getVisible() == null){
                 admVO.setVisible(false);
             }
-            //信息点是否可编辑设置默认值
-            if(admVO.getEditable() == null){
-                List<String> unEditableList = checkoutDefInfoUnEditable();
-                if(unEditableList.contains(admVO.getCode())){
-                    admVO.setEditable(false);
-                }else {
-                    admVO.setEditable(true);
-                }
-            }
-            //是否禁止操作设置默认值
-            if(admVO.getUnDisabled() == null){
-                List<String> unDisableList = checkoutDefInfoUnDisable();
-                if(unDisableList.contains(admVO.getCode())){
-                    admVO.setUnDisabled(false);
-                }else {
-                    admVO.setUnDisabled(true);
-                }
-            }
         }
     }
 
-    /**
-     * 校验信息点是否可编辑
-     * @return
-     */
-    public List<String> checkoutDefInfoUnEditable(){
-        List<String> list = new ArrayList<>();
-        list.add("id");
-        list.add("name");
-        list.add("qRCodePic");
-        list.add("defaultQRCode");
-        list.add("bimId");
-        list.add("bimFamilyName");
-        list.add("bimFamilySymbol");
-        return list;
-    }
-    
-    /**
-     * 校验信息点是否禁止使用
-     * @return
-     */
-    public List<String> checkoutDefInfoUnDisable(){
-        List<String> list = new ArrayList<>();
-        list.add("id");
-        list.add("name");
-        list.add("localId");
-        list.add("localName");
-        list.add("qRCodePic");
-        list.add("defaultQRCode");
-        list.add("bimId");
-        list.add("bimFamilyName");
-        list.add("bimFamilySymbol");
-        return list;
-    }
+
 
     /**
      * 字典数据格式与ADM兼容

+ 95 - 16
src/main/java/com/persagy/proxy/adm/service/impl/AdmDictServiceImpl.java

@@ -1,16 +1,12 @@
 package com.persagy.proxy.adm.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
-
 import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.node.ArrayNode;
 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.define.entity.ObjectInfoCollect;
-import com.persagy.dmp.define.entity.ObjectInfoDefine;
 import com.persagy.proxy.adm.constant.AdmDictConstant;
 import com.persagy.proxy.adm.constant.enums.AdmDictCategoryEnum;
 import com.persagy.proxy.adm.model.*;
@@ -21,10 +17,12 @@ import com.persagy.proxy.adm.service.IAdmDictService;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
-import org.springframework.context.annotation.Primary;
 import org.springframework.stereotype.Service;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 /**
@@ -48,7 +46,7 @@ public class AdmDictServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> imp
      * @throws Exception
      */
     @Override
-    public AdmResponse queryCategory(InstanceUrlParam context , AdmDict request, Class<T> clazz) throws Exception {
+    public AdmResponse queryCategory(InstanceUrlParam context , AdmDict request, Class<T> clazz) {
         String type = request.getType();
         QueryCriteria criteria = new QueryCriteria();
         ObjectNode node = JsonNodeFactory.instance.objectNode();
@@ -99,11 +97,11 @@ public class AdmDictServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> imp
         AdmResponse admResponse = doQueryObjectType(context, new QueryCriteria(), clazz);
         List<AdmObjectType> objectTypes = (List<AdmObjectType>) admResponse.getContent();
         Map<String, List<AdmObjectType>> objectTypeMap = objectTypes.stream().filter(k-> StringUtils.isNotEmpty(k.getObjType()))
-                                                         .collect(Collectors.groupingBy(AdmObjectType::getObjType));
+                .collect(Collectors.groupingBy(AdmObjectType::getObjType));
         //获取专业-设备类关系
         List<AdmObjectType> equipments = objectTypeMap.get(AdmDictCategoryEnum.EQUIPMENT.getValue());
         Map<String,List<AdmObjectType>> majorEquipMap = equipments.stream().filter(k->StringUtils.isNotEmpty(k.getMajorCode()))
-                                                         .collect(Collectors.groupingBy(item -> item.getMajorCode()));
+                .collect(Collectors.groupingBy(item -> item.getMajorCode()));
 
         //获取专业-系统类关系
         List<AdmObjectType> systems = objectTypeMap.get(AdmDictCategoryEnum.SYSTEM.getValue());
@@ -157,7 +155,7 @@ public class AdmDictServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> imp
         }
         //构建专业-系统-设备类树形结构
         for (AdmObjectType major : allMajor) {
-             //设置专业
+            //设置专业
             if(CollUtil.isNotEmpty(majorSystemMap)){
                 //专业下的系统
                 List<AdmObjectType> systemCodes = majorSystemMap.get(major.getCode());
@@ -302,8 +300,8 @@ public class AdmDictServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> imp
             String name = null;
             //项目
             if(AdmDictCategoryEnum.PROJECT.getValue().equals(type)){
-               name = AdmDictCategoryEnum.PROJECT.getDesc();
-               classCodes.add(AdmDictCategoryEnum.PROJECT.getValue());
+                name = AdmDictCategoryEnum.PROJECT.getDesc();
+                classCodes.add(AdmDictCategoryEnum.PROJECT.getValue());
             }
             //建筑
             if(AdmDictCategoryEnum.BUILDING.getValue().equals(type)){
@@ -354,9 +352,12 @@ public class AdmDictServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> imp
      */
     @Override
     public AdmResponse query(InstanceUrlParam context, AdmDictQueryCriteria request, String fieldName, Class<T> clazz) {
+        //转换排序字段
+        revertSortField(request);
         //查询类型下的所有信息点信息
         AdmResponse admResponse = doQueryObjectInfo(context, request, AdmDictConstant.CLASS_CODE, clazz);
         List<AdmObjectInfo> admObjectInfos = (List<AdmObjectInfo>) admResponse.getContent();
+        admObjectInfos = sortFuncidForEdit(admObjectInfos);
         //查询平台级信息点采集信息
         List<ObjectInfoCollect> commonObjectInfoCollect = queryObjectInfoCollect(context, "common", request.getType(), clazz);
         Map<String, Boolean> commonObjectInfoCollectMap = commonObjectInfoCollect.stream().filter(item -> StrUtil.isNotEmpty(item.getDefineInfoId())).collect(Collectors.toMap(ObjectInfoCollect::getDefineInfoId,ObjectInfoCollect::getVisiable));
@@ -391,6 +392,14 @@ public class AdmDictServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> imp
     }
 
     /**
+     * 转换排序字段
+     * @param request
+     */
+    private void revertSortField(AdmDictQueryCriteria request){
+     request.setOrders("showOrder asc, name desc");
+    }
+
+    /**
      * 设置信息点是否可见
      * @param admObjectInfos
      * @param objectInfoCollectMap
@@ -416,6 +425,8 @@ public class AdmDictServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> imp
                 }
             }
             admObjectInfo.setVisible(visiable);
+            admObjectInfo.setEditable(true);
+            admObjectInfo.setUnDisabled(true);
         }
     }
 
@@ -432,20 +443,72 @@ public class AdmDictServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> imp
         for (AdmObjectInfo admObjectInfo : admObjectInfos) {
             Boolean visiable = null;
             String id = admObjectInfo.getId();
+            //设置信息点是否可见
             if(CollUtil.isNotEmpty(objectInfoCollectMap)){
                 visiable = objectInfoCollectMap.get(id);
-            }else {
-                if(visiable == null && ("localId".equals(admObjectInfo.getCode()) || "localName".equals(admObjectInfo.getCode()))){
-                    visiable = true;
-                }
+            }
+            if(visiable == null && ("localId".equals(admObjectInfo.getCode()) || "localName".equals(admObjectInfo.getCode()))){
+                visiable = true;
             }
             if(visiable == null){
                 visiable = false;
             }
+            //信息点是否可编辑设置默认值
+            if(admObjectInfo.getEditable() == null){
+                List<String> unEditableList = checkoutDefInfoUnEditable();
+                if(unEditableList.contains(admObjectInfo.getCode())){
+                    admObjectInfo.setEditable(false);
+                }else {
+                    admObjectInfo.setEditable(true);
+                }
+            }
+            //是否禁止操作设置默认值
+            if(admObjectInfo.getUnDisabled() == null){
+                List<String> unDisableList = checkoutDefInfoUnDisable();
+                if(unDisableList.contains(admObjectInfo.getCode())){
+                    admObjectInfo.setUnDisabled(false);
+                }else {
+                    admObjectInfo.setUnDisabled(true);
+                }
+            }
             admObjectInfo.setVisible(visiable);
         }
     }
 
+
+    /**
+     * 校验信息点是否可编辑
+     * @return
+     */
+    public List<String> checkoutDefInfoUnEditable(){
+        List<String> list = new ArrayList<>();
+        list.add("id");
+        list.add("name");
+        list.add("qRCodePic");
+        list.add("defaultQRCode");
+        list.add("bimId");
+        list.add("bimFamilyName");
+        list.add("bimFamilySymbol");
+        return list;
+    }
+
+    /**
+     * 校验信息点是否禁止使用
+     * @return
+     */
+    public List<String> checkoutDefInfoUnDisable(){
+        List<String> list = new ArrayList<>();
+        list.add("id");
+        list.add("name");
+        list.add("localId");
+        list.add("localName");
+        list.add("qRCodePic");
+        list.add("defaultQRCode");
+        list.add("bimId");
+        list.add("bimFamilyName");
+        list.add("bimFamilySymbol");
+        return list;
+    }
     /**
      * 查询信息点采集信息
      * @param context
@@ -466,6 +529,22 @@ public class AdmDictServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> imp
         return (List<ObjectInfoCollect>) admResponse.getContent();
     }
 
+    private List<AdmObjectInfo> sortFuncidForEdit(List<AdmObjectInfo> list) {
+        List<AdmObjectInfo> resultOrders = new ArrayList<>();
+        List<AdmObjectInfo> defaultOrders = new ArrayList<>();
+        for (AdmObjectInfo admObjectInfo : list) {
+            if(admObjectInfo.getSort()!=null){
+                resultOrders.add(admObjectInfo);
+            }else{
+                defaultOrders.add(admObjectInfo);
+            }
+        }
+        if(CollUtil.isNotEmpty(defaultOrders)){
+            resultOrders.addAll(defaultOrders);
+        }
+        return resultOrders;
+    }
+
     /**
      * 统计类型下的非静态信息点
      * @param context

+ 43 - 6
src/main/java/com/persagy/proxy/adm/service/impl/AdmEquipmentServiceImpl.java

@@ -15,10 +15,13 @@ import com.persagy.dmp.define.entity.ObjectTypeDefine;
 import com.persagy.dmp.digital.client.DigitalRelationFacade;
 import com.persagy.dmp.digital.entity.ObjectRelation;
 import com.persagy.proxy.adm.constant.AdmCommonConstant;
-import com.persagy.proxy.adm.model.AdmEquipment;
-import com.persagy.proxy.adm.model.AdmProperty;
+import com.persagy.proxy.adm.model.*;
+import com.persagy.proxy.adm.request.AdmQueryCriteria;
+import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.IAdmComAndEquipService;
+import com.persagy.proxy.adm.service.IAdmDictService;
 import com.persagy.proxy.adm.service.IAdmEquipmentService;
+import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.adm.utils.AdmEntityTransferUtil;
 import com.persagy.proxy.adm.utils.ObjectNameUtil;
 import com.persagy.proxy.common.client.DmpRwdClient;
@@ -29,10 +32,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -48,6 +48,8 @@ public class AdmEquipmentServiceImpl extends AbstractAdmBaseServiceImpl<AdmEquip
     private DmpRwdClient rwdClient;
     @Autowired
     private ObjectMapper objectMapper;
+    @Autowired
+    private IAdmDictService dictService;
 
     @Override
     public List<AdmEquipment> doInsertEuip(InstanceUrlParam context, Class<AdmEquipment> clazz, List<AdmEquipment> voList) {
@@ -126,6 +128,41 @@ public class AdmEquipmentServiceImpl extends AbstractAdmBaseServiceImpl<AdmEquip
     }
 
     @Override
+    public AdmResponse doQuery(InstanceUrlParam context, AdmQueryCriteria request, Class<AdmEquipment> clazz) {
+        AdmResponse response = super.doQuery(context, request, clazz);
+        // 系统需要补充分类名称属性
+        ensureSpecialValues(context, (List<AdmEquipment>) response.getContent());
+        return response;
+    }
+
+    @Override
+    public void ensureSpecialValues(InstanceUrlParam context, List<AdmEquipment> vos) {
+        if(CollUtil.isEmpty(vos)) {
+            return;
+        }
+        // 查询对象类型 - 只找到这个接口,应提供一个按编码查编码名称Map的接口
+        AdmDict admDict = AdmDict.builder().type(AdmEquipment.OBJ_TYPE).build();
+        AdmResponse dicRs = dictService.queryCategory(AdmContextUtil.toDmpContext(), admDict, AdmObjectType.class);
+        List<AdmObjectType> dicList = (List<AdmObjectType>) dicRs.getContent();
+        if(CollUtil.isEmpty(dicList)) {
+            return;
+        }
+        // 转换为编码名称Map
+        Map<String, String> codeNameMap = CollUtil.fieldValueAsMap(dicList, "code", "name");
+        // 赋值
+        for(AdmEquipment vo:vos) {
+            String classCode = vo.getClassCode();
+            if(StrUtil.isEmpty(classCode)) {
+                continue;
+            }
+            Map<String, String> category = new HashMap<>(16);
+            category.put("code", classCode);
+            category.put("name", codeNameMap.get(vo.getClassCode()));
+            vo.setEquipCategory(category);
+        }
+    }
+
+    @Override
     public List<AdmEquipment> doInsertExt(InstanceUrlParam context, Class<AdmEquipment> clazz, List<AdmEquipment> voList) {
         List<AdmEquipment> vos = doInsert(context, AdmEquipment.class, voList);
         //TODO 创建资产

+ 47 - 35
src/main/java/com/persagy/proxy/adm/service/impl/AdmModelRelServiceImpl.java

@@ -3,8 +3,12 @@ package com.persagy.proxy.adm.service.impl;
 import cn.hutool.core.collection.CollUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ArrayNode;
 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.digital.entity.ObjectRelationProjectCal;
 import com.persagy.proxy.adm.constant.AdmCommonConstant;
 import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
 import com.persagy.proxy.adm.model.*;
@@ -18,9 +22,8 @@ import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
+import javax.management.Query;
+import java.util.*;
 
 /**
  * @ClassName AdmModelRelServiceImpl
@@ -43,6 +46,9 @@ public class AdmModelRelServiceImpl extends AbstractAdmBaseServiceImpl<AdmModelR
     @Autowired
     private IAdmISpaceService iSpaceService;
 
+    @Autowired
+    private IAdmObjectRelationCalService iAdmObjectRelationCalService;
+
     /**
      * 模型修改设备元空间的建筑楼层信息
      * @param context
@@ -58,10 +64,15 @@ public class AdmModelRelServiceImpl extends AbstractAdmBaseServiceImpl<AdmModelR
         floorCriteria.setModelId(vo.getModelId());
         List<AdmFloor> floorList = queryFloorEntity(context,floorCriteria);
         if(CollUtil.isNotEmpty(floorList)){
-            List<String> floorQueryTypes = getFloorQueryTypes(floorList);
-            //根据类型查询relation_type_project
-            //更新边类型计算状态:computationalState为2
-
+            Set<String> floorQueryTypes = getFloorQueryTypes(floorList);
+            List<ObjectRelationProjectCal> relationProjectCals = iAdmObjectRelationCalService.queryCalRelByRelationType(context, floorQueryTypes);
+            if(CollUtil.isNotEmpty(relationProjectCals)){
+                //更新边类型计算状态:computationalState为2
+                relationProjectCals.forEach(item->{
+                    item.setComputationalState(2);
+                });
+                iAdmObjectRelationCalService.updateObjectCalRel(context,relationProjectCals);
+            }
         }
         //2.修改设备和元空间的建筑楼层信息
         String oldBimId = vo.getOldBimId();
@@ -315,6 +326,7 @@ public class AdmModelRelServiceImpl extends AbstractAdmBaseServiceImpl<AdmModelR
         if(StringUtils.isNotEmpty(vo.getFloorId())){
             criteria.setFilters("id = '"+vo.getFloorId()+"'");
         }
+        criteria.setName("floor");
         AdmResponse admResponse = floorService.doQuery(context, criteria, AdmFloor.class);
         return (List<AdmFloor>)admResponse.getContent();
     }
@@ -324,38 +336,38 @@ public class AdmModelRelServiceImpl extends AbstractAdmBaseServiceImpl<AdmModelR
      * 获取楼层查询类型
      * @param floorList
      */
-    private List<String> getFloorQueryTypes(List<AdmFloor> floorList){
-        List<String> types = new ArrayList<>();
+    private Set<String> getFloorQueryTypes(List<AdmFloor> floorList){
+        Set<String> types = new HashSet<>();
         for (AdmFloor admFloor : floorList) {
             if(CollUtil.isNotEmpty(admFloor.getOutline())){
-                types.add("eq2fl");
-                types.add("fl2sp");
-                types.add("bd2sp");
+                types.add(AdmRelationTypeEnum.EQ2FL.getRelCode());
+                types.add(AdmRelationTypeEnum.FL2SP.getRelCode());
+                types.add(AdmRelationTypeEnum.BD2SP.getRelCode());
             }
-            types.add(AdmRelationTypeEnum.EQ2SP_IN.getRelCode());
-            types.add(AdmRelationTypeEnum.EQ2EQ_ACAIRNETWORK_2.getRelCode());
-            types.add(AdmRelationTypeEnum.EQ2EQ_CONDWATERNETWORK_1.getRelCode());
-            types.add(AdmRelationTypeEnum.EQ2EQ_VENTNETWORK_2.getRelCode());
-            types.add(AdmRelationTypeEnum.EQ2EQ_ACAIRNETWORK_3.getRelCode());
-            types.add(AdmRelationTypeEnum.EQ2EQ_HEATWATERLOOP_4.getRelCode());
-            types.add(AdmRelationTypeEnum.EQ2EQ_HEATWATERLOOP_1.getRelCode());
-            types.add(AdmRelationTypeEnum.EQ2EQ_DHWNETWORK_1.getRelCode());
-            types.add(AdmRelationTypeEnum.EQ2EQ_RECYCLEWATERNETWORK_1.getRelCode());
-            types.add(AdmRelationTypeEnum.EQ2EQ_FIREVENTNETWORK_1.getRelCode());
-            types.add(AdmRelationTypeEnum.EQ2EQ_FIREWATERNETWORK_1.getRelCode());
-            types.add(AdmRelationTypeEnum.EQ2EQ_VRFNETWORK_1.getRelCode());
-            types.add(AdmRelationTypeEnum.EQ2EQ_CHILLWATERLOOP_2.getRelCode());
-            types.add(AdmRelationTypeEnum.EQ2EQFRESHAIRNETWORK_1.getRelCode());
-            types.add(AdmRelationTypeEnum.EQ2EQ_CHILLWATERLOOP_1.getRelCode());
-            types.add(AdmRelationTypeEnum.EQ2EQ_DRINKINGWATERNETWORK_1.getRelCode());
-            types.add(AdmRelationTypeEnum.EQ2EQ_COOLINGWATERLOOP_2.getRelCode());
-            types.add(AdmRelationTypeEnum.EQ2EQ_VENTNETWORK_1.getRelCode());
-            types.add(AdmRelationTypeEnum.EQ2EQ_HEATWATERLOOP_2.getRelCode());
-            types.add(AdmRelationTypeEnum.EQ2EQ_COOLINGWATERLOOP_1.getRelCode());
-            types.add(AdmRelationTypeEnum.EQ2EQ_ACAIRNETWORK_1.getRelCode());
-            types.add(AdmRelationTypeEnum.EQ2EQ_SUPPLYWATERNETWORK_1.getRelCode());
-            types.add(AdmRelationTypeEnum.EQ2EQ_DRAININGWATERNETWORK_1.getRelCode());
         }
+        types.add(AdmRelationTypeEnum.EQ2SP_IN.getRelCode());
+        types.add(AdmRelationTypeEnum.EQ2EQ_ACAIRNETWORK_2.getRelCode());
+        types.add(AdmRelationTypeEnum.EQ2EQ_CONDWATERNETWORK_1.getRelCode());
+        types.add(AdmRelationTypeEnum.EQ2EQ_VENTNETWORK_2.getRelCode());
+        types.add(AdmRelationTypeEnum.EQ2EQ_ACAIRNETWORK_3.getRelCode());
+        types.add(AdmRelationTypeEnum.EQ2EQ_HEATWATERLOOP_4.getRelCode());
+        types.add(AdmRelationTypeEnum.EQ2EQ_HEATWATERLOOP_1.getRelCode());
+        types.add(AdmRelationTypeEnum.EQ2EQ_DHWNETWORK_1.getRelCode());
+        types.add(AdmRelationTypeEnum.EQ2EQ_RECYCLEWATERNETWORK_1.getRelCode());
+        types.add(AdmRelationTypeEnum.EQ2EQ_FIREVENTNETWORK_1.getRelCode());
+        types.add(AdmRelationTypeEnum.EQ2EQ_FIREWATERNETWORK_1.getRelCode());
+        types.add(AdmRelationTypeEnum.EQ2EQ_VRFNETWORK_1.getRelCode());
+        types.add(AdmRelationTypeEnum.EQ2EQ_CHILLWATERLOOP_2.getRelCode());
+        types.add(AdmRelationTypeEnum.EQ2EQFRESHAIRNETWORK_1.getRelCode());
+        types.add(AdmRelationTypeEnum.EQ2EQ_CHILLWATERLOOP_1.getRelCode());
+        types.add(AdmRelationTypeEnum.EQ2EQ_DRINKINGWATERNETWORK_1.getRelCode());
+        types.add(AdmRelationTypeEnum.EQ2EQ_COOLINGWATERLOOP_2.getRelCode());
+        types.add(AdmRelationTypeEnum.EQ2EQ_VENTNETWORK_1.getRelCode());
+        types.add(AdmRelationTypeEnum.EQ2EQ_HEATWATERLOOP_2.getRelCode());
+        types.add(AdmRelationTypeEnum.EQ2EQ_COOLINGWATERLOOP_1.getRelCode());
+        types.add(AdmRelationTypeEnum.EQ2EQ_ACAIRNETWORK_1.getRelCode());
+        types.add(AdmRelationTypeEnum.EQ2EQ_SUPPLYWATERNETWORK_1.getRelCode());
+        types.add(AdmRelationTypeEnum.EQ2EQ_DRAININGWATERNETWORK_1.getRelCode());
         return types;
     }
 }

+ 55 - 0
src/main/java/com/persagy/proxy/adm/service/impl/AdmObjectRelationCalServiceImpl.java

@@ -0,0 +1,55 @@
+package com.persagy.proxy.adm.service.impl;
+
+import com.fasterxml.jackson.databind.node.ArrayNode;
+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.digital.entity.ObjectRelationProjectCal;
+import com.persagy.proxy.adm.model.AdmModelRel;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.IAdmObjectRelationCalService;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * 标记关系计算
+ *
+ * @author:linhuili
+ * @date:2021/10/15
+ */
+@Service
+@Slf4j
+public class AdmObjectRelationCalServiceImpl extends AbstractAdmBaseServiceImpl<ObjectRelationProjectCal> implements IAdmObjectRelationCalService {
+
+    /**
+     * 根据关系类型查询标记计算关系
+     * @param context
+     * @param relationType
+     * @return
+     */
+    @Override
+    public List<ObjectRelationProjectCal> queryCalRelByRelationType(InstanceUrlParam context, Set<String> relationType){
+        //设置查询条件
+        QueryCriteria queryCriteria = new QueryCriteria();
+        ObjectNode criteria = JsonNodeFactory.instance.objectNode();
+        ArrayNode arrayNode = criteria.putObject("relCode").putArray("$in");
+        relationType.stream().forEach(relCode -> arrayNode.add(relCode));
+        queryCriteria.setCriteria(criteria);
+        //查询标记计算关系
+        AdmResponse admResponse = doQueryRelationProjectCal(context, queryCriteria, ObjectRelationProjectCal.class);
+        return (List<ObjectRelationProjectCal>)admResponse.getContent();
+    }
+
+    /**
+     * 更新标记计算关系
+     * @param objectRelationProjectCals
+     */
+    @Override
+    public void updateObjectCalRel(InstanceUrlParam context, List<ObjectRelationProjectCal> objectRelationProjectCals) {
+        doUpdateRelationProjectCal(context, ObjectRelationProjectCal.class, objectRelationProjectCals);
+    }
+}

+ 55 - 0
src/main/java/com/persagy/proxy/adm/service/impl/AdmSystemServiceImpl.java

@@ -1,9 +1,23 @@
 package com.persagy.proxy.adm.service.impl;
 
+import cn.hutool.core.collection.CollUtil;
+import com.persagy.proxy.adm.model.AdmDict;
+import com.persagy.proxy.adm.model.AdmEquipment;
+import com.persagy.proxy.adm.model.AdmObjectType;
 import com.persagy.proxy.adm.model.AdmSystem;
+import com.persagy.proxy.adm.request.AdmQueryCriteria;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.IAdmDictService;
+import com.persagy.proxy.adm.service.IAdmEquipmentService;
 import com.persagy.proxy.adm.service.IAdmSystemService;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
 /**
  * ADM 系统 实现类
  * @author lvxy
@@ -11,4 +25,45 @@ import org.springframework.stereotype.Service;
  */
 @Service
 public class AdmSystemServiceImpl extends AbstractAdmBaseServiceImpl<AdmSystem> implements IAdmSystemService {
+
+    @Autowired
+    private IAdmDictService dictService;
+    @Autowired
+    private IAdmEquipmentService equipmentService;
+
+    @Override
+    public AdmResponse doQuery(InstanceUrlParam context, AdmQueryCriteria request, Class<AdmSystem> clazz) {
+        AdmResponse response = super.doQuery(context, request, clazz);
+        // 系统需要补充分类名称属性
+        ensureSpecialValues(context, (List<AdmSystem>) response.getContent());
+        return response;
+    }
+
+    @Override
+    public void ensureSpecialValues(InstanceUrlParam context, List<AdmSystem> vos) {
+        if(CollUtil.isEmpty(vos)) {
+            return;
+        }
+        // 查询对象类型 - 只找到这个接口,应提供一个按编码查编码名称Map的接口
+        AdmDict admDict = AdmDict.builder().type(AdmSystem.OBJ_TYPE).build();
+        AdmResponse dicRs = dictService.queryCategory(context, admDict, AdmObjectType.class);
+        List<AdmObjectType> dicList = (List<AdmObjectType>) dicRs.getContent();
+        if(CollUtil.isEmpty(dicList)) {
+            return;
+        }
+        // 转换为编码名称Map
+        Map<String, String> codeNameMap = CollUtil.fieldValueAsMap(dicList, "code", "name");
+        // 给系统赋值 - 同时收集设备对象,扩展设备对象赋值
+        List<AdmEquipment> equipmentList = new ArrayList<>();
+        for(AdmSystem vo:vos) {
+            vo.setCategoryName(codeNameMap.get(vo.getClassCode()));
+            // 收集设备对象
+            if(CollUtil.isEmpty(vo.getEquipmentList())) {
+                continue;
+            }
+            equipmentList.addAll(vo.getEquipmentList());
+        }
+        // 对象扩展属性赋值
+        equipmentService.ensureSpecialValues(context, equipmentList);
+    }
 }

+ 1 - 1
src/main/java/com/persagy/proxy/common/client/DmpRwdClient.java

@@ -182,7 +182,7 @@ public interface DmpRwdClient {
      * @return: com.persagy.dmp.common.DmpResult
      */
     @PostMapping(DmpUrlConstant.RELATION_PROJECT_CAL_QUERY)
-    DmpResult<JSONArray> queryRelationProjectCal(@SpringQueryMap InstanceUrlParam objectUrlParam, @RequestBody JSONArray objectArr);
+    DmpResult<JSONArray> queryRelationProjectCal(@SpringQueryMap InstanceUrlParam objectUrlParam, @RequestBody JSONObject criteria);
 
 
     /**