Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/develop' into develop

lijie 3 anni fa
parent
commit
4983650452

+ 64 - 5
src/main/java/com/persagy/proxy/adm/controller/AdmBuildingController.java

@@ -1,12 +1,16 @@
 package com.persagy.proxy.adm.controller;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
+import com.persagy.dmp.common.model.entity.BaseEntity;
 import com.persagy.proxy.adm.constant.AdmCommonConstant;
-import com.persagy.proxy.adm.model.AdmBuilding;
+import com.persagy.proxy.adm.model.*;
 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.adm.service.IAdmBuildingService;
+import com.persagy.proxy.adm.service.*;
+import com.persagy.proxy.adm.utils.ObjectNameUtil;
+import com.persagy.proxy.common.entity.DmpResult;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -17,6 +21,7 @@ import org.springframework.web.bind.annotation.RestController;
 
 import javax.ws.rs.QueryParam;
 import java.util.List;
+import java.util.Map;
 
 /**
  * ADM 建筑 API
@@ -29,6 +34,14 @@ public class AdmBuildingController {
 
     @Autowired
     private IAdmBuildingService service;
+    @Autowired
+    private IAdmEquipmentService equipmentService;
+    @Autowired
+    private IAdmFloorService floorService;
+    @Autowired
+    private IAdmISpaceService iAdmISpaceService;
+    @Autowired
+    private IAdmSpaceService spaceService;
     @Value("${middleware.group.code}")
     private String groupCode;
 
@@ -44,6 +57,11 @@ public class AdmBuildingController {
         InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
         List<AdmBuilding> vos = CollUtil.newArrayList(createRequest.getContent());
         vos = service.doInsert(context, AdmBuilding.class, vos);
+        vos.stream().forEach(admBuilding -> {
+            if (StrUtil.isEmpty(admBuilding.getName())){
+                admBuilding.setName(ObjectNameUtil.objectName("建筑-"));
+            }
+        });
         return AdmResponse.success(vos);
     }
 
@@ -57,6 +75,44 @@ public class AdmBuildingController {
     public AdmResponse delete(@RequestBody List<AdmBuilding> vos) throws Exception {
         // 组装上下文条件
         InstanceUrlParam context = new InstanceUrlParam(groupCode, null, null, AdmCommonConstant.APP_ID);
+        if(CollUtil.isEmpty(vos)){
+            return AdmResponse.failure("参数不能为空");
+        }
+        //验证楼层 空间 设备 等信息是否存在,不存在关系可以删除
+        Map<String, AdmBuilding> admBuildingMap = CollUtil.fieldValueMap(vos, BaseEntity.PROP_ID);
+        String msg = "建筑下包含其他对象实例,请解除关系后删除";
+        AdmQueryCriteria admQueryCriteria = new AdmQueryCriteria();
+        StringBuilder stringBuilder = new StringBuilder();
+        stringBuilder.append("buildingId in [");
+        admBuildingMap.keySet().stream().forEach(buildingId -> {
+            stringBuilder.append("'").append(buildingId).append("'").append(",");
+        });
+
+        String filters = StrUtil.sub(stringBuilder.toString(),0, -1);
+        filters+= "]";
+
+        admQueryCriteria.setFilters(filters);
+        admQueryCriteria.setName("floor");
+        AdmResponse admResponseF = floorService.doQuery(context, admQueryCriteria, AdmFloor.class);
+        if(DmpResult.SUCCESS.equals(admResponseF.getResult()) && CollUtil.isNotEmpty(admResponseF.getContent())){
+            return AdmResponse.failure(msg);
+        }
+        admQueryCriteria.setName("space");
+        AdmResponse admResponseSpace = spaceService.doQuery(context, admQueryCriteria, AdmSpace.class);
+        if(admResponseSpace.getResult().equals(DmpResult.SUCCESS) && CollUtil.isNotEmpty(admResponseSpace.getContent())){
+            return AdmResponse.failure(msg);
+        }
+        admQueryCriteria.setName("ispace");
+        AdmResponse admResponseISpace = iAdmISpaceService.doQuery(context, admQueryCriteria, AdmISpace.class);
+        if(admResponseISpace.getResult().equals(DmpResult.SUCCESS) && CollUtil.isNotEmpty(admResponseISpace.getContent())){
+            return AdmResponse.failure(msg);
+        }
+
+        admQueryCriteria.setName("equipment");
+        AdmResponse admResponseEuip = equipmentService.doQuery(context, admQueryCriteria, AdmEquipment.class);
+        if(admResponseEuip.getResult().equals(DmpResult.SUCCESS) && CollUtil.isNotEmpty(admResponseEuip.getContent())){
+            return AdmResponse.failure(msg);
+        }
         service.doDelete(context, vos);
         return AdmResponse.success();
     }
@@ -69,9 +125,7 @@ public class AdmBuildingController {
      */
     @PostMapping("/single/delete")
     public AdmResponse deleteSingle(@RequestBody List<AdmBuilding> vos) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, null, AdmCommonConstant.APP_ID);
-        service.doDelete(context, vos);
+        delete(vos);
         return AdmResponse.success();
     }
 
@@ -86,6 +140,11 @@ public class AdmBuildingController {
         // 组装上下文条件
         InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
         List<AdmBuilding> vos = CollUtil.newArrayList(createRequest.getContent());
+        vos.forEach(admBuilding -> {
+            if(StrUtil.isEmpty(admBuilding.getName())){
+                admBuilding.setName(ObjectNameUtil.objectName("建筑-"));
+            }
+        });
         vos = service.doUpdate(context, AdmBuilding.class, vos);
         return AdmResponse.success(vos);
     }

+ 130 - 9
src/main/java/com/persagy/proxy/adm/controller/AdmFloorController.java

@@ -1,12 +1,22 @@
 package com.persagy.proxy.adm.controller;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
+import com.persagy.dmp.common.model.entity.BaseEntity;
 import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.model.AdmEquipment;
 import com.persagy.proxy.adm.model.AdmFloor;
+import com.persagy.proxy.adm.model.AdmISpace;
+import com.persagy.proxy.adm.model.AdmSpace;
 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.adm.service.IAdmEquipmentService;
 import com.persagy.proxy.adm.service.IAdmFloorService;
+import com.persagy.proxy.adm.service.IAdmISpaceService;
+import com.persagy.proxy.adm.service.IAdmSpaceService;
+import com.persagy.proxy.adm.utils.ObjectNameUtil;
+import com.persagy.proxy.common.entity.DmpResult;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -17,6 +27,7 @@ import org.springframework.web.bind.annotation.RestController;
 
 import javax.ws.rs.QueryParam;
 import java.util.List;
+import java.util.Map;
 
 /**
  * Adm 楼层 API
@@ -29,6 +40,12 @@ import java.util.List;
 public class AdmFloorController {
     @Autowired
     private IAdmFloorService service;
+    @Autowired
+    private IAdmEquipmentService equipmentService;
+    @Autowired
+    private IAdmISpaceService iAdmISpaceService;
+    @Autowired
+    private IAdmSpaceService spaceService;
     @Value("${middleware.group.code}")
     private String groupCode;
 
@@ -42,8 +59,41 @@ public class AdmFloorController {
     public AdmResponse create(@RequestBody AdmCreateRequest<AdmFloor> createRequest, @QueryParam("projectId") String projectId) throws Exception {
         // 组装上下文条件
         InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
-        //List<AdmFloor> vos = CollUtil.newArrayList(createRequest.getContent());
         List<AdmFloor> vos = service.doInsert(context, AdmFloor.class, createRequest.getContent());
+        for(AdmFloor floor : vos){
+            if(StrUtil.isEmpty(floor.getName())){
+                floor.setName(ObjectNameUtil.objectName("楼层-"));
+            }
+            if(floor.getFloorSequenceID() == null){
+                return AdmResponse.failure("楼层顺序号不可以为空或类型错误");
+            }
+        }
+        Map<String, AdmFloor> admFloorMap = CollUtil.fieldValueMap(vos, "buildingId");
+        if (CollUtil.isNotEmpty(admFloorMap)){
+            AdmQueryCriteria admQueryCriteria = new AdmQueryCriteria();
+            StringBuilder stringBuilder = new StringBuilder();
+            stringBuilder.append("buildingId in [");
+            admFloorMap.keySet().stream().forEach(buildingId -> {
+                stringBuilder.append("'").append(buildingId).append("'").append(",");
+            });
+            String filters = StrUtil.sub(stringBuilder.toString(),0, -1);
+            filters+= "]";
+            admQueryCriteria.setFilters(filters);
+            admQueryCriteria.setName("floor");
+            AdmResponse admResponseF = service.doQuery(context, admQueryCriteria, AdmFloor.class);
+            if(DmpResult.SUCCESS.equals(admResponseF.getResult()) && admResponseF.getTotal() > 0){
+                List<AdmFloor> vosOld = (List<AdmFloor>) admResponseF.getContent();
+                for(AdmFloor admFloorOld : vosOld){
+                    if(admFloorMap.containsKey(admFloorOld.getBuildingId())){
+                        AdmFloor admFloorNew = admFloorMap.get(admFloorOld.getBuildingId());
+                        //楼层序列号相同
+                        if(admFloorOld.getFloorSequenceID() !=null && admFloorNew.getFloorSequenceID().equals(admFloorOld.getFloorSequenceID())){
+                           return AdmResponse.failure("楼层顺序号不可以重复");
+                        }
+                    }
+                }
+            }
+        }
         return AdmResponse.success(vos);
     }
 
@@ -57,6 +107,36 @@ public class AdmFloorController {
     public AdmResponse delete(@QueryParam("projectId") String projectId, @RequestBody List<AdmFloor> vos) throws Exception {
         // 组装上下文条件
         InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        String msg = "楼层下包含其他对象实例,请解除关系后删除";
+        Map<String, AdmFloor> admFloorMap = CollUtil.fieldValueMap(vos, BaseEntity.PROP_ID);
+
+        AdmQueryCriteria admQueryCriteria = new AdmQueryCriteria();
+        StringBuilder stringBuilder = new StringBuilder();
+        stringBuilder.append("floorId in [");
+        admFloorMap.keySet().stream().forEach(buildingId -> {
+            stringBuilder.append("'").append(buildingId).append("'").append(",");
+        });
+        String filters = StrUtil.sub(stringBuilder.toString(),0, -1);
+        filters+= "]";
+
+        admQueryCriteria.setFilters(filters);
+        admQueryCriteria.setOnlyCount(true);
+
+        admQueryCriteria.setName("space");
+        AdmResponse admResponseSpace = spaceService.doQuery(context, admQueryCriteria, AdmSpace.class);
+        if(admResponseSpace.getResult().equals(DmpResult.SUCCESS) && CollUtil.isNotEmpty(admResponseSpace.getContent())){
+            return AdmResponse.failure(msg);
+        }
+        admQueryCriteria.setName("ispace");
+        AdmResponse admResponseISpace = iAdmISpaceService.doQuery(context, admQueryCriteria, AdmISpace.class);
+        if(admResponseISpace.getResult().equals(DmpResult.SUCCESS) && CollUtil.isNotEmpty(admResponseISpace.getContent())){
+            return AdmResponse.failure(msg);
+        }
+        admQueryCriteria.setName("equipment");
+        AdmResponse admResponseEuip = equipmentService.doQuery(context, admQueryCriteria, AdmEquipment.class);
+        if(admResponseEuip.getResult().equals(DmpResult.SUCCESS) && CollUtil.isNotEmpty(admResponseEuip.getContent())){
+            return AdmResponse.failure(msg);
+        }
         service.doDelete(context, vos);
         return AdmResponse.success();
     }
@@ -69,10 +149,8 @@ public class AdmFloorController {
      */
     @PostMapping("/single/delete")
     public AdmResponse deleteSingle(@QueryParam("projectId") String projectId, @RequestBody List<AdmFloor> vos) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
-        service.doDelete(context, vos);
-        return AdmResponse.success();
+       delete(projectId,vos);
+       return AdmResponse.success();
     }
 
     /**
@@ -86,6 +164,33 @@ public class AdmFloorController {
         // 组装上下文条件
         InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
         List<AdmFloor> vos = CollUtil.newArrayList(admFloor.getContent());
+        /** 遍历楼层列表 */
+        Map<String, AdmFloor> admFloorBdMap = CollUtil.fieldValueMap(vos, "buildingId");
+        if (CollUtil.isNotEmpty(admFloorBdMap)){
+            AdmQueryCriteria admQueryCriteria = new AdmQueryCriteria();
+            StringBuilder stringBuilder = new StringBuilder();
+            stringBuilder.append("buildingId in [");
+            admFloorBdMap.keySet().stream().forEach(buildingId -> {
+                stringBuilder.append("'").append(buildingId).append("'").append(",");
+            });
+            String filters = StrUtil.sub(stringBuilder.toString(),0, -1);
+            filters+= "]";
+            admQueryCriteria.setFilters(filters);
+            admQueryCriteria.setName("floor");
+            AdmResponse admResponseF = service.doQuery(context, admQueryCriteria, AdmFloor.class);
+            if(DmpResult.SUCCESS.equals(admResponseF.getResult()) && admResponseF.getTotal() > 0 && CollUtil.isNotEmpty(admResponseF.getContent())){
+                List<AdmFloor> vosOld = (List<AdmFloor>) admResponseF.getContent();
+                for(AdmFloor admFloorOld : vosOld){
+                    if(admFloorBdMap.containsKey(admFloorOld.getBuildingId())){
+                        AdmFloor admFloorNew = admFloorBdMap.get(admFloorOld.getBuildingId());
+                        //楼层序列号相同
+                        if(!admFloorOld.getId().equals(admFloorNew.getId()) && admFloorOld.getFloorSequenceID()!=null && admFloorNew.getFloorSequenceID().equals(admFloorOld.getFloorSequenceID())){
+                            return AdmResponse.failure("楼层顺序号不可以重复");
+                        }
+                    }
+                }
+            }
+        }
         vos = service.doUpdate(context, AdmFloor.class, vos);
         return AdmResponse.success(vos);
     }
@@ -100,10 +205,26 @@ public class AdmFloorController {
     @PostMapping("/update-outline")
     public AdmResponse updateOutline(@RequestBody AdmCreateRequest<AdmFloor> admFloor, @QueryParam("projectId") String projectId) throws Exception {
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
-        List<AdmFloor> vos = CollUtil.newArrayList(admFloor.getContent());
-        vos = service.doUpdateOutLine(context, AdmFloor.class, vos);
-        return AdmResponse.success(vos);
+        AdmResponse admResponse = update(admFloor,projectId);
+        //TODO 处理关系
+        /** 处理关系标记 */
+       /* val listtype = ArrayList<String>()
+        listtype.add("sh2bd")
+        listtype.add("bd2sp")
+        listtype.add("fl2sp")
+        listtype.add("syeq2bd")
+        listtype.add("sy2fl")
+        listtype.add("eq2fl")
+        listtype.add("pe2bd")
+        listtype.add("pe2fl")
+        for (type in listtype){
+            val entity = EquipmentService.relationTypeProjectservice.select(SFilter.eq("projectId", Opt.projectId!!), SFilter.eq("relationType", type)).entity()
+            if (entity!=null){
+                entity.computationalState = 2
+                EquipmentService.relationTypeProjectservice.update(entity)
+            }
+        }*/
+        return admResponse;
     }
 
 

+ 16 - 15
src/main/java/com/persagy/proxy/adm/controller/AdmSpaceController.java

@@ -3,9 +3,7 @@ package com.persagy.proxy.adm.controller;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
-import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-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;
@@ -18,7 +16,6 @@ import com.persagy.proxy.adm.service.IAdmBuildingService;
 import com.persagy.proxy.adm.service.IAdmFloorService;
 import com.persagy.proxy.adm.service.IAdmRelationService;
 import com.persagy.proxy.adm.service.IAdmSpaceService;
-import com.persagy.proxy.common.entity.DmpResult;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 import com.persagy.proxy.common.entity.RelationDTO;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -107,6 +104,12 @@ public class AdmSpaceController {
         // 组装上下文条件
         InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
         service.doDelete(context, vos);
+        QueryCriteria queryCriteria = new QueryCriteria();
+        vos.forEach(vo -> {
+            /** 清除空间和建筑楼层的的数据 */
+            dealRelation(vo.getId(),context,queryCriteria,"Bd2Sp");
+            dealRelation(vo.getId(),context,queryCriteria,"Fl2Sp");
+        });
         return AdmResponse.success();
     }
 
@@ -195,7 +198,6 @@ public class AdmSpaceController {
         }
         // 组装上下文条件
         InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
-        //List<AdmSpace> vos = service.doUpdateFloorORBuilding(context, upDataFloorAndBuildingRequestsList);
         //TODO 循环删除 需要改为 批量删除
         List<RelationDTO> RSpInBd_up = new ArrayList<>();
         List<RelationDTO> RSpInFl_up = new ArrayList<>();
@@ -207,17 +209,8 @@ public class AdmSpaceController {
             String type = requestData.getType();//classCode
 
             /** 清除空间和建筑楼层的的数据 */
-            ObjectNode rBd = JsonNodeFactory.instance.objectNode();
-            rBd.put("objTo",spaceId);
-            rBd.put("relCode","Bd2Sp");
-            queryCriteria.setCriteria(rBd);
-            relationService.doDelete(context, queryCriteria);
-
-            ObjectNode rFl = JsonNodeFactory.instance.objectNode();
-            rFl.put("objTo",spaceId);
-            rFl.put("relCode","Fl2Sp");
-            queryCriteria.setCriteria(rFl);
-            relationService.doDelete(context, queryCriteria);
+            dealRelation(spaceId,context,queryCriteria,"Bd2Sp");
+            dealRelation(spaceId,context,queryCriteria,"Fl2Sp");
 
             if(StrUtil.isNotEmpty(id)){
                 if(id.startsWith("Fl") && StrUtil.isNotEmpty(spaceId)){
@@ -367,4 +360,12 @@ public class AdmSpaceController {
         return service.doQuery(context, request, AdmSpace.class);
     }
 
+
+    private void dealRelation(String spaceId, InstanceUrlParam context, QueryCriteria queryCriteria, String relCode){
+        ObjectNode rBd = JsonNodeFactory.instance.objectNode();
+        rBd.put("objTo",spaceId);
+        rBd.put("relCode",relCode);
+        queryCriteria.setCriteria(rBd);
+        relationService.doDelete(context, queryCriteria);
+    }
 }

+ 10 - 3
src/main/java/com/persagy/proxy/adm/controller/AdmTenantController.java

@@ -1,12 +1,14 @@
 package com.persagy.proxy.adm.controller;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
 import com.persagy.proxy.adm.constant.AdmCommonConstant;
 import com.persagy.proxy.adm.model.AdmTenant;
 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.adm.service.IAdmTenantService;
+import com.persagy.proxy.adm.utils.ObjectNameUtil;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -44,7 +46,7 @@ public class AdmTenantController {
                              @RequestBody AdmQueryCriteria request) throws Exception {
         // 组装上下文条件
         InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
-        request.setName("tenant");
+        request.setName("virtual");
         request.setOnlyCount(true);
         return service.doQuery(context, request, AdmTenant.class);
     }
@@ -60,6 +62,11 @@ public class AdmTenantController {
         // 组装上下文条件
         InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
         List<AdmTenant> vos = CollUtil.newArrayList(createRequest.getContent());
+        vos.stream().forEach(admTenant -> {
+            if (StrUtil.isEmpty(admTenant.getName())){
+                admTenant.setName(ObjectNameUtil.objectName("租户-"));
+            }
+        });
         vos = service.doInsert(context, AdmTenant.class, vos);
         return AdmResponse.success(vos);
     }
@@ -105,7 +112,7 @@ public class AdmTenantController {
                              @RequestBody AdmQueryCriteria request) throws Exception {
         // 组装上下文条件
         InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
-        request.setName("tenant");
+        request.setName("virtual");
         return service.doQuery(context, request, AdmTenant.class);
     }
 
@@ -122,7 +129,7 @@ public class AdmTenantController {
                              @RequestBody AdmQueryCriteria request) throws Exception {
         // 组装上下文条件
         InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
-        request.setName("tenant");
+        request.setName("virtual");
         return service.doQuery(context, request, AdmTenant.class);
     }
 

+ 4 - 11
src/main/java/com/persagy/proxy/adm/model/AdmBuilding.java

@@ -2,6 +2,7 @@ package com.persagy.proxy.adm.model;
 
 import com.persagy.proxy.adm.annotations.CascadeColumn;
 import lombok.Data;
+import lombok.EqualsAndHashCode;
 
 import java.util.Date;
 import java.util.List;
@@ -13,10 +14,9 @@ import java.util.Map;
  * @date 2021-08-16
  */
 @Data
-public class AdmBuilding {
+@EqualsAndHashCode(callSuper = true)
+public class AdmBuilding extends AdmSBaseEntity<AdmBuilding>{
 
-    /** ID */
-    private String id;
     /** 名称 */
     private String name;
     /** 本地编码 */
@@ -31,14 +31,7 @@ public class AdmBuilding {
     private String buildQRCode;
     /** 对象类型 */
     private String objectType = "building";
-    /** 信息点 */
-    private Map<String, Object> infos;
-    /** 创建时间 */
-    private Date createTime;
-    /** 最后更新日期 */
-    private Date lastUpdate;
-    /** 统计信息 */
-    private Map<String, Object> statistics;
+
     /** 级联-项目 */
     @CascadeColumn(graphCode = "ArchSubset", relCode = "Pj2Bd", selectToObj = false)
     private AdmProject project;

+ 4 - 13
src/main/java/com/persagy/proxy/adm/model/AdmComponent.java

@@ -2,6 +2,7 @@ package com.persagy.proxy.adm.model;
 
 import com.persagy.proxy.adm.annotations.CascadeColumn;
 import lombok.Data;
+import lombok.EqualsAndHashCode;
 
 import java.util.Date;
 import java.util.List;
@@ -13,9 +14,9 @@ import java.util.Map;
  * @date 2021/8/17
  */
 @Data
-public class AdmComponent {
-        /** 部件ID */
-        private String id;
+@EqualsAndHashCode(callSuper = true)
+public class AdmComponent extends AdmSBaseEntity<AdmComponent>{
+
         /** 部件名称 */
         private String name;
         /** 本地编码 */
@@ -83,19 +84,9 @@ public class AdmComponent {
         private String systemName;
         /** 二维码图片 */
         private String qrcodePic;
-
-        /** 创建时间 */
-        private Date createTime;
-        /** 最后更新日期 */
-        private Date lastUpdate;
         /** 对象类型 */
         private String objectType = "component";
 
-        /** 信息点 */
-        private Map<String, Object> infos;
-        /** 统计信息 */
-        private Map<String, Object> statistics;
-
         /** 资产信息实体类   资产对应部件设施关系 资产→部件设施*/
         @CascadeColumn(graphCode = "Property2Mech", relCode = "Pe2Eq", selectToObj = false)
         private AdmProperty property;

+ 4 - 12
src/main/java/com/persagy/proxy/adm/model/AdmEquipment.java

@@ -2,6 +2,7 @@ package com.persagy.proxy.adm.model;
 
 import com.persagy.proxy.adm.annotations.CascadeColumn;
 import lombok.Data;
+import lombok.EqualsAndHashCode;
 
 import java.util.Date;
 import java.util.List;
@@ -13,9 +14,9 @@ import java.util.Map;
  * @date 2021/8/17
  */
 @Data
-public class AdmEquipment {
-    /** 设备ID */
-    private String id;
+@EqualsAndHashCode(callSuper = true)
+public class AdmEquipment extends AdmSBaseEntity<AdmEquipment>{
+
     /** 设备名称 */
     private String name;
     /** 本地编码 */
@@ -105,18 +106,9 @@ public class AdmEquipment {
     /** 二维码图片 */
     private String qrcodePic;
 
-    /** 创建时间 */
-    private Date createTime;
-    /** 最后更新日期 */
-    private Date lastUpdate;
     /** 对象类型 */
     private String objectType = "equipment";
 
-    /** 信息点 */
-    private Map<String, Object> infos;
-    /** 统计信息 */
-    private Map<String, Object> statistics;
-
     /** 资产信息实体类   资产对应设备设施关系 资产→设备设施*/
     @CascadeColumn(graphCode = "Property2Mech", relCode = "Pe2Eq", selectToObj = false)
     private AdmProperty property;

+ 4 - 12
src/main/java/com/persagy/proxy/adm/model/AdmFloor.java

@@ -3,6 +3,7 @@ package com.persagy.proxy.adm.model;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.proxy.adm.annotations.CascadeColumn;
 import lombok.Data;
+import lombok.EqualsAndHashCode;
 
 import java.util.Date;
 import java.util.List;
@@ -14,9 +15,9 @@ import java.util.Map;
  * @date 2021/8/16
  */
 @Data
-public class AdmFloor {
-    /** 楼层ID */
-    private String id;
+@EqualsAndHashCode(callSuper = true)
+public class AdmFloor extends AdmSBaseEntity<AdmFloor>{
+
     /** 名称 */
     private String name;
     /** 本地编码 */
@@ -42,8 +43,6 @@ public class AdmFloor {
     /** 楼层编码 */
     private String floorIdentity;
 
-    /** 信息点 */
-    private Map<String, Object> infos;
     /** 级联-建筑 */
     @CascadeColumn(graphCode = "ArchSubset", relCode = "Bd2Fl", selectToObj = false)
     private AdmBuilding building;
@@ -69,13 +68,6 @@ public class AdmFloor {
     /** 二维码图片 */
     private String qrcodePic;
 
-    /** 创建时间 */
-    private Date createTime;
-    /** 最后更新日期 */
-    private Date lastUpdate;
-
-    /** 统计信息 */
-    private Map<String, Object> statistics;
 
     /** 对象类型 */
     private String objectType = "floor";

+ 78 - 0
src/main/java/com/persagy/proxy/adm/model/AdmSBaseEntity.java

@@ -0,0 +1,78 @@
+package com.persagy.proxy.adm.model;
+import lombok.*;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Map;
+
+/**
+ * @author lvxy
+ * @date 2021/9/13
+ */
+@Data
+public abstract class AdmSBaseEntity<T> implements Serializable, Cloneable, Comparable {
+    /** 序列id */
+    private static final long serialVersionUID = -323111418861154334L;
+    /** hash码 */
+    @Getter(AccessLevel.NONE)
+    @Setter(AccessLevel.NONE)
+    private transient int hashCode = Integer.MIN_VALUE;
+
+    private String id;
+    /** 统计信息 */
+    private Map<String, Object> statistics;
+    /** 创建时间 */
+    private Date createTime;
+    /** 最后更新日期 */
+    private Date lastUpdate;
+    /** 信息点 */
+    private Map<String, Object> infos;
+
+
+    @Override
+    public boolean equals (Object obj) {
+        if (null == obj) {
+            return false;
+        }
+        if (!(obj instanceof AdmSBaseEntity)) {
+            return false;
+        } else {
+            AdmSBaseEntity entity = (AdmSBaseEntity) obj;
+            if (null == this.getId() || null == entity.getId()) {
+                return false;
+            } else {
+                return (this.getId().equals(entity.getId()));
+            }
+        }
+    }
+
+    @Override
+    public int hashCode () {
+        if (Integer.MIN_VALUE != this.hashCode) {
+            return this.hashCode;
+        }
+        if (null == this.getId()) {
+            return super.hashCode();
+        }
+        String hashStr = this.getClass().getName() + ":" + this.getId().hashCode();
+        this.hashCode = hashStr.hashCode();
+        return this.hashCode;
+    }
+
+    @Override
+    public int compareTo (Object obj) {
+        if (obj.hashCode() > hashCode()) {
+            return 1;
+        } else if (obj.hashCode() < hashCode()) {
+            return -1;
+        } else {
+            return 0;
+        }
+    }
+
+    @Override
+    public Object clone() throws CloneNotSupportedException {
+        return super.clone();
+    }
+
+}

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

@@ -2,6 +2,7 @@ package com.persagy.proxy.adm.model;
 
 import com.persagy.proxy.adm.annotations.CascadeColumn;
 import lombok.Data;
+import lombok.EqualsAndHashCode;
 
 import java.util.Date;
 import java.util.List;
@@ -13,10 +14,9 @@ import java.util.Map;
  * @date 2021/8/17
  */
 @Data
-public class AdmShaft {
+@EqualsAndHashCode(callSuper = true)
+public class AdmShaft extends AdmSBaseEntity<AdmShaft>{
 
-    /** 竖井id */
-    private String id;
     /** 竖井名称 */
     private String name;
     /** 竖井本地编码 */
@@ -39,8 +39,7 @@ public class AdmShaft {
     private Integer shaftSequenceId;
     /** 功能类型 */
     private String shaftfunctype;
-    /** 信息点 */
-    private Map<String, Object> infos;
+
 
     /** BIM模型中轮廓坐标 */
     private List<AdmPointPosition> outline;
@@ -61,12 +60,6 @@ public class AdmShaft {
     /** 竖井内的业务空间  self = true  同样的对象查询时 id可以互相调换查询   */
     @CascadeColumn(graphCode = "ArchSubset", relCode = "Sh2Sp")
     private List<AdmSpace> spaceList;
-    /** 统计信息 */
-    private Map<String, Object> statistics;
-    /** 创建时间 */
-    private Date createTime;
-    /** 最后更新日期 */
-    private Date lastUpdate;
 
     /** 对象类型code */
     private String classCode;

+ 5 - 10
src/main/java/com/persagy/proxy/adm/model/AdmSpace.java

@@ -2,6 +2,7 @@ package com.persagy.proxy.adm.model;
 
 import com.persagy.proxy.adm.annotations.CascadeColumn;
 import lombok.Data;
+import lombok.EqualsAndHashCode;
 
 import java.util.ArrayList;
 import java.util.Date;
@@ -14,10 +15,9 @@ import java.util.Map;
  * @date 2021/8/17
  */
 @Data
-public class AdmSpace {
+@EqualsAndHashCode(callSuper = true)
+public class AdmSpace extends AdmSBaseEntity<AdmSpace>{
 
-    /** 空间ID */
-    private String id;
     /** 名称 */
     private String name;
     /** 本地编码 */
@@ -92,15 +92,10 @@ public class AdmSpace {
 
     /** 二维码图片 */
     private String qrcodePic;
-    /** 创建时间 */
-    private Date createTime;
-    /** 最后更新日期 */
-    private Date lastUpdate;
+
 
     /** 信息点 */
-    private Map<String, Object> infos;
-    /** 统计信息 */
-    private Map<String, Object> statistics;
+    //private Map<String, Object> infos;
 
     /** 级联-设备 */
     @CascadeColumn(graphCode = "MechInArch", relCode = "Eq2Sp", selectToObj = false)

+ 3 - 13
src/main/java/com/persagy/proxy/adm/model/AdmSystem.java

@@ -2,6 +2,7 @@ package com.persagy.proxy.adm.model;
 
 import com.persagy.proxy.adm.annotations.CascadeColumn;
 import lombok.Data;
+import lombok.EqualsAndHashCode;
 
 import java.util.Date;
 import java.util.List;
@@ -13,10 +14,9 @@ import java.util.Map;
  * @date 2021/8/17
  */
 @Data
-public class AdmSystem {
+@EqualsAndHashCode(callSuper = true)
+public class AdmSystem extends AdmSBaseEntity<AdmSystem> {
 
-    /** ID */
-    private String id;
     /** 名称 */
     private String name;
     /** 本地编码 */
@@ -46,16 +46,6 @@ public class AdmSystem {
 
     /** 对象类型 */
     private String objectType = "system";
-    /** 创建时间 */
-    private Date createTime;
-    /** 最后更新日期 */
-    private Date lastUpdate;
-
-    /** 信息点 */
-    private Map<String, Object> infos;
-    /** 统计信息 */
-    private Map<String, Object> statistics;
-
 
     /** 级联-设备 */
     @CascadeColumn(graphCode = "MechSubset", relCode = "Sy2Eq")

+ 10 - 12
src/main/java/com/persagy/proxy/adm/model/AdmTenant.java

@@ -2,6 +2,7 @@ package com.persagy.proxy.adm.model;
 
 import com.persagy.proxy.adm.annotations.CascadeColumn;
 import lombok.Data;
+import lombok.EqualsAndHashCode;
 
 import java.util.Date;
 import java.util.List;
@@ -13,9 +14,9 @@ import java.util.Map;
  * @date 2021/8/17
  */
 @Data
-public class AdmTenant {
-    /** 租户id */
-    private String id;
+@EqualsAndHashCode(callSuper = true)
+public class AdmTenant extends AdmSBaseEntity<AdmTenant>{
+
     /** 租户名称 */
     private String name;
     /** 租户本地编码 */
@@ -28,20 +29,17 @@ public class AdmTenant {
     private String localName2;
     /** 项目id */
     private String projectId;
-    /** 信息点 */
-    private Map<String, Object> infos;
+
     /** 对象类型 */
-    private String objectType = "tenant";
+    private String objectType;
     /** 租户租赁的租户业务空间  self = true  同样的对象查询时 id可以互相调换查询   */
     @CascadeColumn(graphCode = "TenentInArch", relCode = "Tn2Sp", relValue = "TenantZone")
     private List<AdmSpace> zoneTenantList;
     /** 租户租赁的默认业务空间  self = true  同样的对象查询时 id可以互相调换查询   */
     @CascadeColumn(graphCode = "TenentInArch", relCode = "Tn2Sp", relValue = "GeneralZone")
     private List<AdmSpace> zoneGeneraltList;
-    /** 统计信息 */
-    private Map<String, Object> statistics;
-    /** 创建时间 */
-    private Date createTime;
-    /** 最后更新日期 */
-    private Date lastUpdate;
+
+    /** 租户  */
+    private String classCode = "VOTn";
+
 }

+ 0 - 3
src/main/java/com/persagy/proxy/adm/service/IAdmFloorService.java

@@ -5,8 +5,6 @@ import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 
-import java.util.List;
-
 /**
  * ADM 楼层 接口类
  * @author lvxy
@@ -14,7 +12,6 @@ import java.util.List;
  */
 public interface IAdmFloorService extends IAdmBaseService<AdmFloor>{
 
-    public List<AdmFloor> doUpdateOutLine(InstanceUrlParam context, Class<AdmFloor> clazz, List<AdmFloor> voList);
     /**
      * 查询outLine
      * @param request

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

@@ -130,8 +130,8 @@ public class AdmEquipmentServiceImpl extends AbstractAdmBaseServiceImpl<AdmEquip
 
         //创建设备
         List<AdmEquipment> vos = doInsert(context, AdmEquipment.class, voList);
-        //创建资产
-        //创建设备和系统关系 systemList
+        //TODO 创建资产
+        //TODO 创建设备和系统关系 systemList
         return null;
     }
 

+ 0 - 24
src/main/java/com/persagy/proxy/adm/service/impl/AdmFloorServiceImpl.java

@@ -17,30 +17,6 @@ import java.util.List;
  */
 @Service
 public class AdmFloorServiceImpl extends AbstractAdmBaseServiceImpl<AdmFloor> implements IAdmFloorService {
-    @Override
-    public List<AdmFloor> doUpdateOutLine(InstanceUrlParam context, Class<AdmFloor> clazz, List<AdmFloor> voList) {
-        //根据楼层id 更新中台的floor中infos.outline中的信息,outline中的id默认为空或者省略,查询需要单独处理
-        //更新outLing信息
-        List<AdmFloor> vList = doUpdate(context, clazz, voList);
-        //修改关系计算相关信息
-       /* List<String> listtype = new ArrayList<String>();
-        listtype.add("Sh2Bd");
-        listtype.add("Bd2Sp");
-        listtype.add("Fl2Sp");
-        listtype.add("Sy2Bd");
-        listtype.add("Sy2Fl");
-        listtype.add("Eq2Fl");
-        listtype.add("Pe2Bd");
-        listtype.add("Pe2Fl");
-        for (String type : listtype){
-            JSONObject entity =  EquipmentService.relationTypeProjectservice.select(SFilter.eq("projectId", Opt.projectId!!), SFilter.eq("relationType", type)).entity()
-            if (entity!=null){
-                entity.computationalState = 2
-                EquipmentService.relationTypeProjectservice.update(entity)
-            }
-        }*/
-        return vList;
-    }
 
     @Override
     public AdmResponse doQueryOutLine(InstanceUrlParam context, AdmQueryCriteria request, Class<AdmFloor> clazz) {