瀏覽代碼

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

zhangqiankun 3 年之前
父節點
當前提交
902484e8c9

+ 1 - 1
src/main/java/com/persagy/proxy/adm/constant/AdmRelationTypeEnum.java

@@ -188,7 +188,7 @@ public enum AdmRelationTypeEnum {
     /**光照连通-空间-空间-【全部关系总览】*/
     SP2SP_RADIATIONNETWORK_1("sp2sp_RadiationNetwork_1","RadiationNetwork","Connect",AdmObjectType.SPACE.getIndex(),AdmObjectType.SPACE.getIndex(),true,true,true,false,true,true,CollUtil.newHashSet("LightingZone")),
     /**竖井下的业务空间-竖井→空间-【竖井台账】*/
-    SH2SP("sh2sp","ShaftandSpace","Sh2Sp",AdmObjectType.SHAFT.getIndex(),AdmObjectType.SPACE.getIndex(),false,false,false,false,false,false),
+    SH2SP("sh2sp","ArchSubset","Sh2Sp",AdmObjectType.SHAFT.getIndex(),AdmObjectType.SPACE.getIndex(),false,false,false,false,false,false),
     /**采暖水旁通-供暖集水器-供暖分水器,液体管道-*/
     EQ2EQ_HEATWATERLOOP_3("eq2eq_HeatWaterLoop_3","HeatWaterLoop","Bypass",AdmObjectType.EQUIPMENT.getIndex(),AdmObjectType.EQUIPMENT.getIndex(),false,true,false,false,false,false),
     /**空调冷却水供水-空调冷却水供水相关设备,沿水流方向-*/

+ 3 - 3
src/main/java/com/persagy/proxy/adm/request/AdmQueryCriteria.java

@@ -47,7 +47,7 @@ public class AdmQueryCriteria {
 
     /**
      * 设置关系条件
-     * @param isFrom
+     * @param isFrom 是否查询from结果
      * @param graphCode
      * @param relCode
      * @param objId
@@ -58,7 +58,7 @@ public class AdmQueryCriteria {
 
     /**
      * 设置关系条件
-     * @param isFrom
+     * @param isFrom 是否查询from结果
      * @param graphCode
      * @param relCode
      * @param objId
@@ -70,7 +70,7 @@ public class AdmQueryCriteria {
 
     /**
      * 设置关系条件
-     * @param isFrom
+     * @param isFrom 是否查询from结果
      * @param graphCode
      * @param relCode
      * @param relValue

+ 9 - 5
src/main/java/com/persagy/proxy/adm/request/AdmResponse.java

@@ -35,17 +35,21 @@ public class AdmResponse {
     private Integer pageSize;
     /** 查询到的数据列表 */
     private List<?> content;
+    /**楼层id*/
+    private String floorId;
+    /**空间功能类型*/
+    private String zoneType;
 
     public static AdmResponse success() {
-        return new AdmResponse(SUCCESS, "", 0L,null, 1, 500, new ArrayList<>(1));
+        return new AdmResponse(SUCCESS, "", 0L,null, 1, 500, new ArrayList<>(1),null,null);
     }
 
     public static AdmResponse failure(String message) {
-        return new AdmResponse(FAILURE, message, null, null, null, null, new ArrayList<>(1));
+        return new AdmResponse(FAILURE, message, null, null, null, null, new ArrayList<>(1),null,null);
     }
 
     public static AdmResponse success(List<?> content) {
-        return new AdmResponse(SUCCESS, "", CollUtil.isEmpty(content) ? 0L :content.size()*1L,null, 1, 500, CollUtil.isEmpty(content) ? new ArrayList<>(1): content);
+        return new AdmResponse(SUCCESS, "", CollUtil.isEmpty(content) ? 0L :content.size()*1L,null, 1, 500, CollUtil.isEmpty(content) ? new ArrayList<>(1): content,null,null);
     }
 
     /**
@@ -66,9 +70,9 @@ public class AdmResponse {
         Integer pageNo = admRequest == null ? null : admRequest.getPageNumber();
         Integer pageSize = admRequest == null ? null : admRequest.getPageSize();
         if(admRequest.isOnlyCount()){
-            return new AdmResponse(SUCCESS, null, null,total, pageNo, pageSize, CollUtil.isEmpty(admVOs) ? new ArrayList<>(1) : admVOs);
+            return new AdmResponse(SUCCESS, null, null,total, pageNo, pageSize, CollUtil.isEmpty(admVOs) ? new ArrayList<>(1) : admVOs,null,null);
         }else {
-            return new AdmResponse(SUCCESS, null, total,null, pageNo, pageSize, CollUtil.isEmpty(admVOs) ? new ArrayList<>(1) : admVOs);
+            return new AdmResponse(SUCCESS, null, total,null, pageNo, pageSize, CollUtil.isEmpty(admVOs) ? new ArrayList<>(1) : admVOs,null,null);
         }
     }
 }

+ 61 - 27
src/main/java/com/persagy/proxy/object/controller/AdmEquipmentController.java

@@ -14,7 +14,6 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.google.common.collect.Sets;
 import com.persagy.dmp.basic.dto.RequestData;
 import com.persagy.dmp.basic.model.QueryCriteria;
-import com.persagy.dmp.basic.utils.JsonNodeUtils;
 import com.persagy.dmp.common.context.AppContext;
 import com.persagy.dmp.common.exception.BusinessException;
 import com.persagy.dmp.common.helper.SpringHelper;
@@ -177,15 +176,54 @@ public class AdmEquipmentController {
 			ObjectNode node = JsonNodeFactory.instance.objectNode();
 			node.put("graphCode", graphCode);
 			admEquipmentMap.keySet().stream().forEach(equipId -> {
-				node.put("relCode", "Eq2Bd");
-				node.put("objFrom", equipId);
-				criteria.setCriteria(node);
-				relationService.doDelete(AdmContextUtil.toDmpContext(), criteria);
-
-				node.put("relCode", "Eq2Fl");
-				node.put("objFrom", equipId);
-				criteria.setCriteria(node);
-				relationService.doDelete(AdmContextUtil.toDmpContext(), criteria);
+				AdmEquipment admEquipment = admEquipmentMap.get(equipId);
+				//处理建筑 楼层信息点
+				int removeflBd = 0 ;//关系处理 0不删除 1删除bd 2删除fl 3都删除
+				String flowBuild = admEquipment.getFlowBuild();
+				if(StrUtil.isNotEmpty(flowBuild)){
+					if(!flowBuild.contains("-")){
+						if(flowBuild.startsWith("Bd")){
+							admEquipment.setBuildingId(flowBuild);
+							if(StrUtil.isNotEmpty(admEquipment.getFloorId())){
+								Map<String, Object> infos = new HashMap<String,Object>(16);
+								infos.put("$remove", Arrays.asList("floorId"));
+								admEquipment.setInfos(infos);
+								removeflBd = 2;
+							}
+						}
+					}else {
+						String[] str = flowBuild.split("-");
+						if(str[0].startsWith("Bd")){
+							admEquipment.setBuildingId(str[0]);
+							admEquipment.setFloorId(str[1]);
+						}else{
+							admEquipment.setBuildingId(str[1]);
+							admEquipment.setFloorId(str[0]);
+						}
+						removeflBd = 3;
+					}
+					admEquipment.setFlowBuild(null);
+				}else{
+					if(StrUtil.isAllNotEmpty(admEquipment.getBuildingId(),admEquipment.getFloorId())){
+						Map<String, Object> infos = new HashMap<String,Object>(16);
+						infos.put("$remove",Arrays.asList("floorId","buildingId"));
+						admEquipment.setInfos(infos);
+						removeflBd = 3;
+					}
+				}
+				//删除关系 然后重建
+				if(removeflBd == 3 || removeflBd == 2){
+					node.put("relCode", "Eq2Fl");
+					node.put("objFrom", equipId);
+					criteria.setCriteria(node);
+					relationService.doDelete(AdmContextUtil.toDmpContext(), criteria);
+				}
+				if(removeflBd == 3 || removeflBd == 1){
+					node.put("relCode", "Eq2Bd");
+					node.put("objFrom", equipId);
+					criteria.setCriteria(node);
+					relationService.doDelete(AdmContextUtil.toDmpContext(), criteria);
+				}
 			});
 
 			List<RelationDTO> relationDTOList = new ArrayList<>(vos.size());
@@ -204,27 +242,23 @@ public class AdmEquipmentController {
 				relationService.doSave(AdmContextUtil.toDmpContext(), relationDTOList);
 			}
 			//处理设备更新特殊数据
-            List<AdmEquipment> equipmentList = new ArrayList<>(vos.size());
             vos.stream().forEach(equipment -> {
-                if(CollUtil.isNotEmpty(equipment.getInfos())){
-                    AdmEquipment admEquipment = new AdmEquipment();
-                    admEquipment.setId(equipment.getId());
-                    admEquipment.setInfos(equipment.getInfos());
-                    ObjectNode objectNode = JsonNodeUtils.toObjectNode(admEquipment, "infos", null);
-                    AdmEquipment admEquipmentNew = JsonNodeUtils.toEntity(objectNode, AdmEquipment.class, "infos");
-                    if(CollUtil.isNotEmpty(equipment.getNullList())){
-                    	admEquipmentNew.setNullList(equipment.getNullList());
-					}
-                    if(StrUtil.isNotEmpty(equipment.getFloorId())){
-                    	admEquipmentNew.setFloorId(equipment.getFloorId());
+				//特殊处理位置信息
+				if(StrUtil.isNotEmpty(equipment.getBimLocation())){
+					Map<String,Object> infos = equipment.getInfos();
+					if(CollUtil.isEmpty(infos)){
+						infos = new HashMap<String, Object>();
+						infos.put("bimLocation", equipment.getBimLocation());
+						equipment.setInfos(infos);
 					}
-					if(StrUtil.isNotEmpty(equipment.getBuildingId())){
-						admEquipmentNew.setBuildingId(equipment.getBuildingId());
-					}
-                    equipmentList.add(admEquipmentNew);
+				}
+                if(CollUtil.isNotEmpty(equipment.getInfos())){
+                	Object localId = equipment.getInfos().get("localId");
+                   if(localId != null && StrUtil.isNotEmpty(localId.toString())){
+						equipment.setLocalId(localId.toString());
+				   }
                 }
             });
-            vos = equipmentList;
         }
         vos = service.doUpdate(AdmContextUtil.toDmpContext(), AdmEquipment.class, vos);
         return AdmResponse.success(vos);

+ 3 - 1
src/main/java/com/persagy/proxy/object/controller/AdmISpaceController.java

@@ -113,7 +113,9 @@ public class AdmISpaceController {
             String filters = " floorId = '"+param.getString("floorId")+"' ";
             request.setFilters(filters);
         }
-        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmISpace.class);
+        AdmResponse admResponse = service.doQuery(AdmContextUtil.toDmpContext(), request, AdmISpace.class);
+        admResponse.setMessage(param.getString("floorId"));
+        return admResponse;
     }
 
 }

+ 24 - 18
src/main/java/com/persagy/proxy/object/controller/AdmSpaceController.java

@@ -8,7 +8,6 @@ import com.fasterxml.jackson.databind.node.JsonNodeFactory;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.dmp.basic.model.QueryCriteria;
 import com.persagy.dmp.basic.utils.JsonNodeUtils;
-import com.persagy.dmp.common.model.entity.BaseEntity;
 import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
 import com.persagy.proxy.adm.handler.SpaceRelationInfoHandler;
 import com.persagy.proxy.adm.request.*;
@@ -125,36 +124,26 @@ public class AdmSpaceController {
     public AdmResponse update(@RequestBody AdmCreateRequest<AdmSpace> createRequest, @QueryParam("projectId") String projectId) throws Exception {
         List<AdmSpace> vos = CollUtil.newArrayList(createRequest.getContent());
         if(CollUtil.isNotEmpty(vos)) {
-            Map<String, AdmSpace> admSpaceMap = CollUtil.fieldValueMap(vos, BaseEntity.PROP_ID);
             AdmRelationTypeEnum typeEnumBd = AdmRelationTypeEnum.BD2SP;
-
             AdmRelationTypeEnum typeEnumFl = AdmRelationTypeEnum.FL2SP;
             QueryCriteria criteria = new QueryCriteria();
             ObjectNode node = JsonNodeFactory.instance.objectNode();
 
             List<RelationDTO> relationDTOList = new ArrayList<>(vos.size());
             vos.stream().forEach(admSpace -> {
-                //删除关系 然后重建
-                node.put("relCode", typeEnumBd.getRelCode());
-                node.put("objTo", admSpace.getId());
-                node.put("graphCode", typeEnumBd.getGraphCode());
-                criteria.setCriteria(node);
-                relationService.doDelete(AdmContextUtil.toDmpContext(), criteria);
-
-                node.put("relCode", typeEnumFl.getRelCode());
-                node.put("objTo",  admSpace.getId());
-                node.put("graphCode", typeEnumFl.getGraphCode());
-                criteria.setCriteria(node);
-                relationService.doDelete(AdmContextUtil.toDmpContext(), criteria);
                 //处理建筑 楼层信息点
+                int removeflBd = 0 ;//关系处理 0 不删除 1 删除bd 2 删除fl 3 都删除
                 if(StrUtil.isNotEmpty(admSpace.getFlowBuild())){
                     String flowBuild = admSpace.getFlowBuild();
                     if(!flowBuild.contains("-")){
                         if(flowBuild.startsWith("Bd")){
                             admSpace.setBuildingId(flowBuild);
-                            Map<String, Object> infos = new HashMap<String,Object>(16);
-                            infos.put("$remove", Arrays.asList("floorId"));
-                            admSpace.setInfos(infos);
+                            if(StrUtil.isNotEmpty(admSpace.getFloorId())){
+                                Map<String, Object> infos = new HashMap<String,Object>(16);
+                                infos.put("$remove", Arrays.asList("floorId"));
+                                admSpace.setInfos(infos);
+                                removeflBd = 2;
+                            }
                         }
                     }else {
                         String[] str = flowBuild.split("-");
@@ -165,12 +154,29 @@ public class AdmSpaceController {
                             admSpace.setBuildingId(str[1]);
                             admSpace.setFloorId(str[0]);
                         }
+                        removeflBd = 3;
                     }
                     admSpace.setFlowBuild(null);
                 }else{
                     Map<String, Object> infos = new HashMap<String,Object>(16);
                     infos.put("$remove",Arrays.asList("floorId","buildingId"));
                     admSpace.setInfos(infos);
+                    removeflBd = 3;
+                }
+                //删除关系 然后重建
+                if(removeflBd == 3 || removeflBd == 2){
+                    node.put("relCode", typeEnumFl.getRelCode());
+                    node.put("objTo",  admSpace.getId());
+                    node.put("graphCode", typeEnumFl.getGraphCode());
+                    criteria.setCriteria(node);
+                    relationService.doDelete(AdmContextUtil.toDmpContext(), criteria);
+                }
+                if(removeflBd == 3 || removeflBd == 1){
+                    node.put("relCode", typeEnumBd.getRelCode());
+                    node.put("objTo", admSpace.getId());
+                    node.put("graphCode", typeEnumBd.getGraphCode());
+                    criteria.setCriteria(node);
+                    relationService.doDelete(AdmContextUtil.toDmpContext(), criteria);
                 }
             });
             vos.stream().forEach(space -> {

+ 2 - 0
src/main/java/com/persagy/proxy/object/model/AdmEquipment.java

@@ -116,6 +116,8 @@ public class AdmEquipment extends AdmBaseEntity<AdmEquipment> {
     private String objectType = OBJ_TYPE;
     /** 设备分类 */
     private Map<String, String> equipCategory;
+    /** 更新的时候使用此字段保存楼层和建筑id */
+    private String flowBuild;
 
     /** 资产信息实体类   资产对应设备设施关系 资产→设备设施*/
     @CascadeColumn(graphCode = "Property2Mech", relCode = "Pe2Eq", selectToObj = false)

+ 7 - 2
src/main/java/com/persagy/proxy/report/controller/AdmSpaceInfoController.java

@@ -154,7 +154,7 @@ public class AdmSpaceInfoController {
 			sb.append("floorId = '").append(request.getFloorId()).append("'; ");
 		}
 		// 补充模型条件
-		if(StrUtil.isNotBlank(request.getFloorId())) {
+		if(StrUtil.isNotBlank(floor.getModelId())) {
 			sb.append("modelId = '").append(floor.getModelId()).append("'; ");
 		}
 		if(sb.length() > 0) {
@@ -175,8 +175,13 @@ public class AdmSpaceInfoController {
 					iSpaceList.add(iSpace);
 				}
 			}
-			return AdmResponse.success(iSpaceList);
+			AdmResponse admResponse = AdmResponse.success(iSpaceList);
+			admResponse.setFloorId(request.getFloorId());
+			admResponse.setZoneType(objectType);
+			return admResponse;
 		}else{
+			responseIspace.setFloorId(request.getFloorId());
+			responseIspace.setZoneType(objectType);
 			return responseIspace;
 		}
 	}

+ 13 - 10
src/main/java/com/persagy/proxy/report/controller/ComponentStatisticsController.java

@@ -8,14 +8,16 @@ import com.persagy.proxy.adm.constant.AdmCommonConstant;
 import com.persagy.proxy.adm.constant.AdmObjectType;
 import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
 import com.persagy.proxy.adm.constant.SpaceTypeEnum;
-import com.persagy.proxy.object.model.AdmEquipment;
 import com.persagy.proxy.adm.request.AdmCountResponse;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
-import com.persagy.proxy.object.service.IAdmEquipmentService;
-import com.persagy.proxy.report.service.IRelationReportService;
 import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.object.model.AdmEquipment;
+import com.persagy.proxy.object.model.AdmShaft;
+import com.persagy.proxy.object.service.IAdmEquipmentService;
+import com.persagy.proxy.object.service.IAdmShaftService;
+import com.persagy.proxy.report.service.IRelationReportService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -40,6 +42,8 @@ public class ComponentStatisticsController {
 
 	@Autowired
 	private IRelationReportService relationReportService;
+	@Autowired
+	private IAdmShaftService shaftService;
 	
 	/**
 	 * 台账中待删除的对象
@@ -149,17 +153,16 @@ public class ComponentStatisticsController {
 	
 	/**
 	 * 竖井-关联业务空间完成度
-	 * @param request
 	 * @return
 	 */
 	@RequestMapping(value = "/shaft2sp-count")
-	public AdmCountResponse shaft2spCount(HttpServletRequest request) {
-		String groupCode = request.getHeader(AdmCommonConstant.GROUP_CODE_HEADER);
-		String projectId = request.getHeader(AdmCommonConstant.PROJECT_ID_HEADER);
-		
-		long count = this.relationReportService.countRelationObject(groupCode, projectId, AdmRelationTypeEnum.SH2SP.getGraphCode(), 
+	public AdmResponse shaft2spCount() {
+		AdmQueryCriteria request = new AdmQueryCriteria();
+		request.setName("shaft");
+		request.setOnlyCount(true);
+		request.resetRelationCond(true, AdmRelationTypeEnum.SH2SP.getGraphCode(),
 				AdmRelationTypeEnum.SH2SP.getRelCode(), null);
-		return AdmCountResponse.success(count);
+		return shaftService.doQuery(AdmContextUtil.toDmpContext(), request, AdmShaft.class);
 	}
 	
 	/**