Browse Source

空间被删除解决,不识别房间

caiaf 3 years ago
parent
commit
5e322d4dd4

+ 7 - 4
revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/services/json/JSONAnalyzerService.kt

@@ -166,11 +166,14 @@ open class JSONAnalyzerService {
         }
         //---------------------------------------------------------
         //12.20临时演示方案,room当作space
-        result = result and SpaceAnalyzer.analyze(dataService.spaceService, baseObj, baseObj.elements!!.rooms)
-        if (!result) {
-            return "处理Room异常"
+        if(checkProject){
+            result = result and Space2Analyzer.analyze(dataService.spaceService, baseObj, baseObj.elements!!.rooms)
+            if (!result) {
+                return "处理Room异常"
+            }
         }
 
+
 //        //处理Room, 填充数据, replace插入表
 //        result = result and RoomAnalyzer.analyze(dataService.roomService, baseObj, baseObj.elements!!.rooms)
 //        if (!result) {
@@ -326,7 +329,7 @@ open class JSONAnalyzerService {
                 dataService.connectorService,
                 baseObj,
                 //连接件转换
-                baseObj.elements!!.connectors,
+                connectors,
                 bimIdPrefix,
                 revitIdMap
         )

+ 61 - 0
revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/services/json/Space2Analyzer.kt

@@ -0,0 +1,61 @@
+package cn.sagacloud.server.algorithm.services.json
+
+import cn.sagacloud.server.algorithm.models.entities.Space
+import cn.sagacloud.server.algorithm.models.jsonAnalyzer.AllComponents
+import cn.sagacloud.server.algorithm.models.jsonAnalyzer.BaseObj
+import cn.sagacloud.server.algorithm.services.CommonService
+import com.google.common.base.Strings
+import com.sybotan.database.SFilter
+import com.sybotan.service.SObjectService
+import com.sybotan.service.models.enums.SResponseType
+import com.sybotan.service.models.requests.SCreateRequest
+import java.util.ArrayList
+
+/**
+ *
+ *
+ * @author jxing
+ */
+object Space2Analyzer {
+
+    /**
+     * @Description: 房间和空间分析
+     */
+    fun analyze(spaceService: SObjectService<Space>, baseObj: BaseObj<AllComponents>, spaces: ArrayList<Space>?) : Boolean{
+        if(spaces == null || spaces.isEmpty())
+            return true
+        for(obj in spaces){
+            obj.id = CommonService.generateUUID(null, true)
+            obj.modelId = baseObj.modelId
+            if(obj.parameters != null){
+                var code : String = ""
+                for (param in obj.parameters!!){
+                    if(param.name.equals("名称")){
+                        if(param.value.isNullOrBlank()){
+                            obj.localName = obj.name
+                        }else
+                            obj.localName = param.value
+                    }else if(param.name.equals("编号") && param.value != null){
+                        code = param.value
+                    }else if(param.name.equals("2.空间标准类型编码")){
+                        obj.wDRoomFuncID = param.value
+                    }else if(param.name.equals("3.空间标准类型")){
+                        obj.wDRoomFuncName = param.value
+                    }else if(param.name.equals("2.房间标准类型编码")){
+                        obj.wDRoomFuncID = param.value
+                    }else if(param.name.equals("3.房间标准类型名称")){
+                        obj.wDRoomFuncName = param.value
+                    }
+                }
+                if(obj.localName == null || obj.localName!!.isEmpty() || obj.localName.equals("空间")){
+                    obj.localName = java.lang.String.join("", Strings.nullToEmpty(obj.localName), Strings.nullToEmpty(code))
+                }
+            }
+        }
+        spaceService.delete(SFilter.eq("modelId", baseObj.modelId!!), SFilter.eq("elementType","Room"))
+        val create = SCreateRequest<Space>()
+        create.content = spaces
+        val result = spaceService.createList(create)
+        return SResponseType.success == result.result
+    }
+}

+ 1 - 1
revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/services/json/SpaceAnalyzer.kt

@@ -52,7 +52,7 @@ object SpaceAnalyzer {
                 }
             }
         }
-        spaceService.delete(SFilter.eq("modelId", baseObj.modelId!!))
+        spaceService.delete(SFilter.eq("modelId", baseObj.modelId!!), SFilter.eq("elementType","Space"))
         val create = SCreateRequest<Space>()
         create.content = spaces
         val result = spaceService.createList(create)