Bladeren bron

修改结构

caiaf 4 jaren geleden
bovenliggende
commit
ef3ab72475

+ 1 - 1
revit-algorithm/build.gradle

@@ -166,7 +166,7 @@ dependencyManagement {
 // 下面是配置文件选择
 /*******************************************************/
 
-sourceSets.main.resources.srcDirs = ['src/main/resources', 'src/main/resources-dev']
+sourceSets.main.resources.srcDirs = ['src/main/resources', 'src/main/resources-prod']
 //ext.needTest = 'true'
 
 task doWar{

+ 4 - 4
revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/backstage/model/datacenter/DCFloor.kt

@@ -17,8 +17,8 @@ class DCFloor {
     var id : String? = null
 
     // 更新FloorMap 为 文件服务器上的key
-    @JSONField(name = "structureInfo")
-    var structureInfo : HashMap<String, String>? = null
+    @JSONField(name = "infos")
+    var infos : HashMap<String, String>? = null
 
     @JSONField(name = "modelId")
     var modelId : String? = null
@@ -35,6 +35,6 @@ class DCFloor {
     var localName: String? = null
 
     /** 建筑id */
-    @JSONField(name = "buildId")
-    var buildId: String? = null
+    @JSONField(name = "buildingId")
+    var buildingId: String? = null
 }

+ 2 - 2
revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/backstage/sync/SyncEquipPart.kt

@@ -202,7 +202,7 @@ class SyncEquipPart : SyncObject{
                     if (dcFloor.outline != null) {
                         if (CommonService.isPointInPolygonCheckWithJdkGeneralPath(point, dcFloor.outline!!)) {
                             dcEquip.floorId = dcFloor.id
-                            dcEquip.buildingId = dcFloor.buildId
+                            dcEquip.buildingId = dcFloor.buildingId
                             break
                         }
                     }
@@ -210,7 +210,7 @@ class SyncEquipPart : SyncObject{
                 // 如果没找到所属楼层, 则使用默认楼层作为所属楼层
                 if(dcEquip.floorId == null && defaultDCFloor != null){
                     dcEquip.floorId = defaultDCFloor.id
-                    dcEquip.buildingId = defaultDCFloor.buildId
+                    dcEquip.buildingId = defaultDCFloor.buildingId
                 }
             }
             sb.clear()

+ 4 - 4
revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/backstage/sync/SyncEquipment.kt

@@ -221,7 +221,7 @@ class SyncEquipment : SyncObject{
             if (dcFloors!!.isNotEmpty()) {
                 var defaultDCFloor: DCFloor? = null
                 // 找到一个没有划分过的楼层作为默认所属楼层(没有outline)
-                for (dcFloor in dcFloors!!){
+                for (dcFloor in dcFloors!!) {
                     if(dcFloor.outline == null) {
                         defaultDCFloor = dcFloor
                         break
@@ -232,15 +232,15 @@ class SyncEquipment : SyncObject{
                         // 如果数据中心的楼层设置了outline, 判断是否在outline内
                         if (CommonService.isPointInPolygonCheckWithJdkGeneralPath(point, dcFloor.outline!!)) {
                             dcEquip.floorId = dcFloor.id
-                            dcEquip.buildingId = dcFloor.buildId
+                            dcEquip.buildingId = dcFloor.buildingId
                             break
                         }
                     }
                 }
                 // 如果没找到所属楼层, 则使用默认楼层作为所属楼层
-                if(dcEquip.floorId == null && defaultDCFloor != null){
+                if(dcEquip.buildingId == null && defaultDCFloor != null){
                     dcEquip.floorId = defaultDCFloor.id
-                    dcEquip.buildingId = defaultDCFloor.buildId
+                    dcEquip.buildingId = defaultDCFloor.buildingId
                 }
             }
             sb.clear()

+ 2 - 2
revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/backstage/sync/SyncISpace.kt

@@ -159,7 +159,7 @@ class SyncISpace : SyncObject {
                         // 如果数据中心的楼层设置了outline, 则只有跟outline重叠过的元空间才能添加楼层关系
                         if (CommonService.isPolygonOverlap(space.outline!![0], dcFloor.outline!!)) {
                             dcISpace.floorId = dcFloor.id
-                            dcISpace.buildingId = dcFloor.buildId
+                            dcISpace.buildingId = dcFloor.buildingId
                             break
                         }
                     }
@@ -167,7 +167,7 @@ class SyncISpace : SyncObject {
                 // 如果没找到所属楼层, 则使用默认楼层作为所属楼层
                 if(dcISpace.floorId == null && defaultDCFloor != null){
                     dcISpace.floorId = defaultDCFloor.id
-                    dcISpace.buildingId = defaultDCFloor.buildId
+                    dcISpace.buildingId = defaultDCFloor.buildingId
                 }
             }
             sb.clear()

+ 3 - 3
revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/backstage/sync/SyncUtil.kt

@@ -84,9 +84,9 @@ class SyncUtil {
         // 更新楼层的信息点 modelId 和 FloorMap
         for (dcFloor in syncFloor.dcFloor) {
             dcFloor.modelId = model.floorModelId
-            if (dcFloor.structureInfo == null)
-                dcFloor.structureInfo = HashMap()
-            dcFloor.structureInfo!!["FloorMap"] = "${myProperties.fileService.baseGraph}/${model.id}.jsonz"
+            if (dcFloor.infos == null)
+                dcFloor.infos = HashMap()
+            dcFloor.infos!!["floorMap"] = "${myProperties.fileService.baseGraph}/${model.id}.jsonz"
             syncFloor.syncUpdate(dcFloor)
         }
 

+ 50 - 0
revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/models/entities/UnrecognizedEquip.kt

@@ -0,0 +1,50 @@
+package cn.sagacloud.server.algorithm.models.entities
+
+import com.alibaba.fastjson.annotation.JSONField
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties
+import com.fasterxml.jackson.annotation.JsonProperty
+import io.swagger.annotations.ApiModel
+import io.swagger.annotations.ApiModelProperty
+import org.springframework.stereotype.Component
+import javax.persistence.Column
+import javax.persistence.Id
+import javax.persistence.Table
+
+/**
+ *
+ * @author  Cainga
+ * @date  2021/2/4 10:24
+ */
+@ApiModel(description = "未识别设备")
+@Table(name = "revit.unrecognized_equip")
+@JsonIgnoreProperties(ignoreUnknown = true)
+class UnrecognizedEquip {
+
+    /** uuid */
+    @ApiModelProperty(value = " uuid")
+    @Column(name = "id")
+    @Id
+    var id: String? = null
+
+    /** 项目id */
+    @ApiModelProperty(value = "项目id")
+    @Column(name = "project_id")
+    var projectId: String? = null
+
+    /** 万达BIMTypeID */
+    @ApiModelProperty(value = "万达BIMTypeID")
+    @Column(name = "bim_type_id")
+    var bimTypeId: String? = null
+
+    /** 类型中文名称 */
+    @ApiModelProperty(value = "类型中文名称")
+    @Column(name = "family_name")
+    var familyName: String? = null
+
+    /** 模型id */
+    @ApiModelProperty(value = "模型id")
+    @Column(name = "model_id")
+    var modelId: String? = null
+
+
+}

+ 1 - 0
revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/services/BaseDataService.kt

@@ -45,4 +45,5 @@ object BaseDataService {
     val equipCompService = SObjectService(SMybatisDao(EquipComp::class.java))  // 设备对照
     val pdCompService = SObjectService(SMybatisDao(PipeDuctComp::class.java))  // 管道对照
     val infoPointCompService = SObjectService(SMybatisDao(InfoPointComp::class.java))  // 信息点对照
+    val unrecognizedEquipService = SObjectService(SMybatisDao(UnrecognizedEquip::class.java))  // 未识别设备类
 }

+ 1 - 0
revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/services/endpoint/ModelFileService.kt

@@ -275,6 +275,7 @@ class ModelFileService {
             removeFromList(modelInFloorList, model.id!!)
             model.removed = true
             model.url = null
+            model.taskInfo = null
             dataService.modelFileService.update(model)
             val floorModel = FloorModel()
             floorModel.id = model.floorModelId

+ 25 - 8
revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/services/json/EquipmentAnalyzer.kt

@@ -9,6 +9,7 @@ import com.sybotan.service.SObjectService
 import com.sybotan.service.models.enums.SResponseType
 import com.sybotan.service.models.requests.SCreateRequest
 import java.util.*
+import kotlin.collections.ArrayList
 import kotlin.collections.HashMap
 
 /**
@@ -19,12 +20,12 @@ import kotlin.collections.HashMap
 object EquipmentAnalyzer {
 
 
-    fun analyze(equipmentService: SObjectService<Equipment>, baseObj: BaseObj<AllComponents>, equipments: ArrayList<Equipment>?, bimIdPrefix: String, equipMap: HashMap<String, BaseComponent>, flag: Boolean, equipCompService: SObjectService<EquipComp>, infoPointCompService: SObjectService<InfoPointComp>): Boolean {
+    fun analyze(equipmentService: SObjectService<Equipment>, baseObj: BaseObj<AllComponents>, equipments: ArrayList<Equipment>?, bimIdPrefix: String, equipMap: HashMap<String, BaseComponent>, flag: Boolean, equipCompService: SObjectService<EquipComp>, infoPointCompService: SObjectService<InfoPointComp>,unrecognizedEquipService: SObjectService<UnrecognizedEquip>): Boolean {
 
         if(flag){
             return analyze1(equipmentService,baseObj,equipments,bimIdPrefix,equipMap)
         }else{
-            return analyze2(equipmentService,baseObj,equipments,bimIdPrefix,equipMap,equipCompService,infoPointCompService)
+            return analyze2(equipmentService,baseObj,equipments,bimIdPrefix,equipMap,equipCompService,infoPointCompService,unrecognizedEquipService)
         }
     }
 
@@ -90,12 +91,13 @@ object EquipmentAnalyzer {
      * @Description: 第二版设备解析,正在使用的
      * 将设备的构建码转换为标准编码
      */
-    fun analyze2(equipmentService: SObjectService<Equipment>, baseObj: BaseObj<AllComponents>, equipments: ArrayList<Equipment>?, bimIdPrefix: String, equipMap: HashMap<String, BaseComponent>, equipCompService: SObjectService<EquipComp>, infoPointCompService: SObjectService<InfoPointComp>): Boolean {
+    fun analyze2(equipmentService: SObjectService<Equipment>, baseObj: BaseObj<AllComponents>, equipments: ArrayList<Equipment>?, bimIdPrefix: String, equipMap: HashMap<String, BaseComponent>, equipCompService: SObjectService<EquipComp>, infoPointCompService: SObjectService<InfoPointComp>,unrecognizedEquipService: SObjectService<UnrecognizedEquip>): Boolean {
         if (equipments == null || equipments.isEmpty())
             return true
 
 
         val newEquipmnets = ArrayList<Equipment>()
+        val unrecognizedEquips = ArrayList<UnrecognizedEquip>()
         for (obj in equipments) {
             obj.id = CommonService.generateUUID(null, true)
             obj.modelId = baseObj.modelId
@@ -115,7 +117,7 @@ object EquipmentAnalyzer {
                         obj.propertyId = param.value
                     } else if (param.name.equals("构件分类编码")) {
                         obj.bimTypeID = param.value
-                    } else if (param.name.equals("系统类")) {
+                    } else if (param.name.equals("系统类")) {
                         obj.sysName = param.value
                     }
 
@@ -141,6 +143,7 @@ object EquipmentAnalyzer {
                         }else{
                             //未识别的设备类型,类型码转换为"OTXXXX",OT表示“其他系统”,“XXXX”表示未识别的设备
                             obj.family = "OTXXXX"
+
                         }
                     }else{
                         equipComp = equipCompService.select(SFilter.eq("bimTypeID",obj.bimTypeID!!)).entity()
@@ -180,15 +183,29 @@ object EquipmentAnalyzer {
                         continue
                     }
                     obj.infos = infos
-//                    newEquipmnets.add(obj)
-                }
+                    if(obj.family != null && obj.family.equals("OTXXXX")){
+                        val unrecognizedEquip =  UnrecognizedEquip()
+                        unrecognizedEquip.id = UUID.randomUUID().toString()
+                        unrecognizedEquip.bimTypeId = obj.bimTypeID
+                        unrecognizedEquip.familyName = obj.familyName
+                        unrecognizedEquip.modelId = baseObj.modelId
+                        unrecognizedEquip.projectId = baseObj.mbiName
+                        unrecognizedEquips.add(unrecognizedEquip)
+                    }else{
+                        newEquipmnets.add(obj)
+                    }
 
+                }
             }
         }
         equipmentService.delete(SFilter.eq("modelId", baseObj.modelId!!))
+        unrecognizedEquipService.delete((SFilter.eq("modelId", baseObj.modelId!!)))
         val create = SCreateRequest<Equipment>()
-//        create.content = newEquipmnets
-        create.content = equipments
+        val createOther = SCreateRequest<UnrecognizedEquip>()
+        createOther.content = unrecognizedEquips
+        unrecognizedEquipService.createList(createOther)
+        create.content = newEquipmnets
+//        create.content = equipments
         val result = equipmentService.createList(create)
         return SResponseType.success == result.result
     }

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

@@ -278,9 +278,10 @@ open class JSONAnalyzerService {
                 baseObj,
                 baseObj.elements!!.equipments,
                 bimIdPrefix, revitIdMap,
-                checkProject(baseObj.mbiName),
+                checkProject(modelFile.projectId),
                 dataService.equipCompService,
-                dataService.infoPointCompService
+                dataService.infoPointCompService,
+                dataService.unrecognizedEquipService
         )
 
         if (!result) {