Browse Source

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

lijie 3 years ago
parent
commit
100c31df18

+ 16 - 11
src/main/java/com/persagy/proxy/object/controller/AdmSpaceController.java

@@ -127,7 +127,7 @@ public class AdmSpaceController {
             ObjectNode node = JsonNodeFactory.instance.objectNode();
 
             List<RelationDTO> relationDTOList = new ArrayList<>(vos.size());
-            vos.stream().forEach(admSpace -> {
+            vos.forEach(admSpace -> {
                 //处理建筑 楼层信息点
                 int removeflBd = 0 ;//关系处理 0 不删除 1 删除bd 2 删除fl 3 都删除
                 if(StrUtil.isNotEmpty(admSpace.getFlowBuild())){
@@ -275,6 +275,12 @@ public class AdmSpaceController {
             String id = requestData.getId();
             String type = requestData.getType();//classCode
 
+            //更新实体
+            AdmSpace space = new AdmSpace();
+            space.setId(spaceId);
+            space.setObjectType(AdmSpace.OBJ_TYPE);
+            space.setClassCode(type);
+
             /** 清除空间和建筑楼层的的数据 */
             dealRelation(spaceId, queryCriteria,"Bd2Sp", false);
             dealRelation(spaceId, queryCriteria,"Fl2Sp", false);
@@ -285,6 +291,7 @@ public class AdmSpaceController {
                     admQueryCriteria.setName(AdmFloor.OBJ_TYPE);
                     admQueryCriteria.setFilters("id = '"+id+"'");
                     AdmResponse admResponseFl = floorService.query(admQueryCriteria);
+
                     if(CollUtil.isNotEmpty(admResponseFl.getContent())){
                         AdmFloor floor = (AdmFloor) admResponseFl.getContent().get(0);
                         if (floor!=null){
@@ -303,11 +310,7 @@ public class AdmSpaceController {
                             rFl_up.setObjFrom(floor.getId());
                             RSpInFl_up.add(rFl_up);
 
-                            //更新实体
-                            AdmSpace space = new AdmSpace();
-                            space.setId(spaceId);
-                            space.setObjectType(AdmSpace.OBJ_TYPE);
-                            space.setClassCode(type);
+                            //楼层 建筑信息点维护
                             space.setBuildingId(floor.getBuildingId());
                             space.setFloorId(floor.getId());
                             space_up.add(space);
@@ -331,17 +334,19 @@ public class AdmSpaceController {
                     rBd_up.setObjFrom(id);
                     RSpInBd_up.add(rBd_up);
 
-                    //更新实体
-                    AdmSpace space = new AdmSpace();
-                    space.setId(spaceId);
-                    space.setObjectType(AdmSpace.OBJ_TYPE);
-                    space.setClassCode(type);
+                    //楼层 建筑信息点维护
                     space.setBuildingId(id);
                     Map<String, Object> info = new HashMap<>(1);
                     info.put("$remove",Arrays.asList("floorId"));
                     space.setInfos(info);
                     space_up.add(space);
                 }
+            }else{
+                //楼层 建筑信息点维护 清除
+                Map<String, Object> info = new HashMap<>(1);
+                info.put("$remove",Arrays.asList("floorId","buildingId"));
+                space.setInfos(info);
+                space_up.add(space);
             }
         });
         service.doUpdate( AdmContextUtil.toDmpContext(), AdmSpace.class, space_up);

+ 5 - 1
src/main/java/com/persagy/proxy/object/service/impl/AdmSpaceServiceImpl.java

@@ -690,7 +690,11 @@ public class AdmSpaceServiceImpl extends AbstractAdmBaseServiceImpl<AdmSpace> im
      * @return
      */
     private int countSpace(InstanceUrlParam context, String classCode, String objFrom){
-        QueryCriteria queryCriteria = ensureQueryCommParm(new QueryCriteria(), context, CollUtil.newArrayList(classCode),"space");
+        QueryCriteria queryCriteriaSpace = new QueryCriteria();
+        ObjectNode criteria = JsonNodeFactory.instance.objectNode();
+        criteria.put("state", 1);
+        queryCriteriaSpace.setCriteria(criteria);
+        QueryCriteria queryCriteria = ensureQueryCommParm(queryCriteriaSpace, context, CollUtil.newArrayList(classCode),"space");
         addRelationTo(queryCriteria, objFrom,"Fl2Sp");
         queryCriteria.setOnlyCount(true);
         DmpResult<JSONArray> dmpResult = queryObj(context, queryCriteria);

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

@@ -1,10 +1,7 @@
 package com.persagy.proxy.report.controller;
 
-import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
-import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.dmp.common.constant.ResponseCode;
 import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
 import com.persagy.proxy.adm.request.AdmDCSQueryRequest;
@@ -12,7 +9,6 @@ import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.object.model.AdmEquipment;
-import com.persagy.proxy.object.model.AdmFloor;
 import com.persagy.proxy.object.model.AdmISpace;
 import com.persagy.proxy.object.model.AdmSystem;
 import com.persagy.proxy.object.service.*;
@@ -24,8 +20,6 @@ import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.QueryParam;
-import java.util.ArrayList;
-import java.util.List;
 import java.util.Set;
 
 /**
@@ -131,6 +125,20 @@ public class AdmSpaceInfoController {
 	 */
 	@PostMapping("/unspace-ispace")
 	public AdmResponse unSpaceIspace(@QueryParam("objectType") String objectType, @RequestBody AdmDCSQueryRequest request) {
+		//因现有floor没有轮廓线,先不做元空间和floor的轮廓的判断,使用关系查询
+		request.setName(AdmISpace.OBJ_TYPE);
+		// 设置关系条件
+		AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.SP2SI;
+		request.resetRelationCond(false, null, typeEnum.getRelCode(), objectType, null, false);
+		request.addFilters("floorId = '"+request.getFloorId()+"'");
+		AdmResponse responseIspace = ispaceService.doQuery(AdmContextUtil.toDmpContext(),request, AdmISpace.class);
+		responseIspace.setFloorId(request.getFloorId());
+		responseIspace.setZoneType(objectType);
+		return responseIspace;
+	}
+	/*
+	@PostMapping("/unspace-ispace")
+	public AdmResponse unSpaceIspace(@QueryParam("objectType") String objectType, @RequestBody AdmDCSQueryRequest request) {
 		// 查询楼层信息 需要楼层信息中的outline modelId
 		AdmQueryCriteria admQueryCriteriaFl = new AdmQueryCriteria();
 		admQueryCriteriaFl.setName(AdmFloor.OBJ_TYPE);
@@ -174,7 +182,7 @@ public class AdmSpaceInfoController {
 			responseIspace.setZoneType(objectType);
 			return responseIspace;
 		}
-	}
+	}*/
 
 	private AdmResponse unSpaceEq(String type, String spaceId, AdmQueryCriteria request, String graphCode) {
 		if (StrUtil.isBlank(spaceId)) {