caiaf hace 4 años
padre
commit
0e1a4502b2

+ 1 - 1
revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/controllers/modelFile/FloorModelController.kt

@@ -250,7 +250,7 @@ class FloorModelController {
 //                }
                 val bimId = CommonService.generateBIMIDPrefix(floor.projectId!!, floor.folderId!!, floor.floorName!!, false)
                 val bindFloorRequest = BindFloorRequest()
-                bindFloorRequest.attributeMap["FloorElevation"] = model.baseLevel
+                bindFloorRequest.attributeMap["floorElevation"] = model.baseLevel
                 bindFloorRequest.bimId = bimId
 //                bindFloorRequest.oldBimId = prevBimId
                 bindFloorRequest.floorId = request.floorId

+ 1 - 1
revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/models/entities/DictComp.kt

@@ -14,7 +14,7 @@ import javax.persistence.Table
  * @date  2020/12/3 15:53
  */
 
-@ApiModel(description = "设备对照")
+@ApiModel(description = "字典对照")
 @Table(name = "revit.dict_comp")
 @JsonIgnoreProperties(ignoreUnknown = true)
 open class DictComp {

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

@@ -133,6 +133,13 @@ class Equipment : BaseComponent(){
     @JsonProperty("BIMTypeID")
     var bimTypeID: String? = null
 
+    /** 系统分类 */
+    @ApiModelProperty(value = "系统分类")
+    @Column(name = "sys_name")
+    @JSONField(name = "SysName")
+    @JsonProperty("SysName")
+    var sysName: String? = null
+
 
     /** 初始4位部件类型编码 */
     @ApiModelProperty(value = "初始4位部件类型编码")

+ 44 - 11
revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/models/entities/Room.kt

@@ -4,7 +4,10 @@ import cn.sagacloud.server.algorithm.models.jsonAnalyzer.Location
 import cn.sagacloud.server.algorithm.models.jsonAnalyzer.Parameter
 import cn.sagacloud.server.algorithm.models.jsonAnalyzer.Point
 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 javax.persistence.Column
 import javax.persistence.Table
 
@@ -15,30 +18,35 @@ import javax.persistence.Table
  */
 @ApiModel(description = "房间")
 @Table(name = "revit.room")
-open class Room : BaseComponent(){
+@JsonIgnoreProperties(ignoreUnknown = true)
+class Room : BaseComponent(){
 
     /** 轮廓线段 */
 //   @Schema(description = "轮廓线段")
     @Column(name = "boundary_segments")
-   @JSONField(name = "BoundarySegment")
+    @JSONField(name = "BoundarySegment")
+    @JsonProperty("BoundarySegments")
     var boundarySegment: ArrayList<ArrayList<String>>? = null
 
     /** 空间高度 */
 //   @Schema(description = "空间高度")
     @Column(name = "height")
-   @JSONField(name = "Height")
+    @JSONField(name = "Height")
+    @JsonProperty("Height")
     var height: Double? = null
 
     /** 定位点 */
 //   @Schema(description = "定位点")
     @Column(name = "location")
-   @JSONField(name = "Location")
+    @JSONField(name = "Location")
+    @JsonProperty("Location")
     var location: Location? = null
 
     /** 空间轮廓 */
 //   @Schema(description = "空间轮廓")
     @Column(name = "outline")
-   @JSONField(name = "Outline")
+    @JSONField(name = "Outline")
+    @JsonProperty("Outline")
     var outline: ArrayList<ArrayList<Point>>? = null
 
 //    /** 对应Revit模型id */
@@ -48,8 +56,9 @@ open class Room : BaseComponent(){
 
     /** 参数列表 */
 //   @Schema(description = "参数列表")
-   @Column(name = "parameters")
-   @JSONField(name = "Parameters")
+    @Column(name = "parameters")
+    @JSONField(name = "Parameters")
+    @JsonProperty("Parameters")
     var parameters: ArrayList<Parameter>? = null
 
 
@@ -60,14 +69,38 @@ open class Room : BaseComponent(){
 
     /** 名称 */
 //   @Schema(description = "名称")
-   @Column(name = "name")
-   @JSONField(name = "Name")
+    @Column(name = "name")
+    @JSONField(name = "Name")
+    @JsonProperty("Name")
     var name: String? = null
 
     /** 本地名称 */
 //   @Schema(description = "本地名称")
-   @Column(name = "local_name")
-   @JSONField(name = "LocalName")
+    @Column(name = "local_name")
+    @JSONField(name = "LocalName")
+    @JsonProperty("LocalName")
     var localName: String? = null
 
+    /** 本地编码 */
+    @ApiModelProperty(value = "本地编码")
+    @JSONField(name = "LocalId")
+    @Column(name = "local_id")
+    @JsonProperty("LocalId")
+    var localId: String? = null
+
+    /** 万达专用信息点 */
+    @ApiModelProperty(value = "万达专用信息点")
+    @Column(name = "wd_room_func_id")
+    @JSONField(name = "WDRoomFuncID")
+    @JsonProperty("WDRoomFuncID")
+    var wDRoomFuncID: String? = null
+
+
+    /** 万达专用信息点 */
+    @ApiModelProperty(value = "万达专用信息点")
+    @Column(name = "wd_room_func_name")
+    @JSONField(name = "WDRoomFuncName")
+    @JsonProperty("WDRoomFuncName")
+    var wDRoomFuncName : String? = null
+
 }

+ 7 - 1
revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/models/jsonAnalyzer/AllComponents.kt

@@ -90,7 +90,13 @@ class AllComponents{
     @JsonProperty("Windows")
     var windows : ArrayList<Window>? = null
 
+//    @JSONField(name = "Rooms")
+//    @JsonProperty("Rooms")
+//    var rooms : ArrayList<Room>? = null
+
+    //---------------------------------------------------------
+    //12.20临时演示方案,room当作space
     @JSONField(name = "Rooms")
     @JsonProperty("Rooms")
-    var rooms : ArrayList<Room>? = null
+    var rooms : ArrayList<Space>? = null
 }

+ 6 - 6
revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/models/request/BindFloorRequest.kt

@@ -9,21 +9,21 @@ import com.alibaba.fastjson.annotation.JSONField
  */
 class BindFloorRequest {
 
-    @JSONField(name = "AttributeMap")
+    @JSONField(name = "attributeMap")
     val attributeMap : HashMap<String, Any?> = HashMap()
 
-    @JSONField(name = "BimId")
+    @JSONField(name = "bimId")
     var bimId : String? = null
 
-    @JSONField(name = "FloorId")
+    @JSONField(name = "floorId")
     var floorId : String? = null
 
-    @JSONField(name = "OldBimId")
+    @JSONField(name = "oldBimId")
     var oldBimId : String? = null
 
-    @JSONField(name = "FloorMap")
+    @JSONField(name = "floorMap")
     var floorMap : String? = null
 
-    @JSONField(name = "ModelId")
+    @JSONField(name = "modelId")
     var modelId : String? = null
 }

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

@@ -41,6 +41,7 @@ object BaseDataService {
 
     val roomService = SObjectService(SMybatisDao(Room::class.java))  // 房间
     val projectService = SObjectService(SMybatisDao(Project::class.java))  // 项目
-    val dictCompService = SObjectService(SMybatisDao(DictComp::class.java))  // 设备对照
+    val dictCompService = SObjectService(SMybatisDao(DictComp::class.java))  // 字典对照
+    val equipCompService = SObjectService(SMybatisDao(EquipComp::class.java))  // 设备对照
     val infoPointCompService = SObjectService(SMybatisDao(InfoPointComp::class.java))  // 信息点对照
 }

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

@@ -17,6 +17,11 @@ import kotlin.collections.HashMap
  * @author jxing
  */
 object EquipmentAnalyzer {
+
+    /**
+     * @Description: 第一版设备解析,后面可能会删除
+     * 将设备的编码转换为标准编码
+     */
     fun analyze(equipmentService: SObjectService<Equipment>, baseObj: BaseObj<AllComponents>, equipments: ArrayList<Equipment>?, bimIdPrefix: String, equipMap: HashMap<String, BaseComponent>, flag: Boolean, dictCompService: SObjectService<DictComp>, infoPointCompService: SObjectService<InfoPointComp>): Boolean {
         if (equipments == null || equipments.isEmpty())
             return true
@@ -44,13 +49,6 @@ object EquipmentAnalyzer {
             if (obj.revitId != null && obj.revitId!!.isNotEmpty())
                 equipMap[obj.revitId!!] = obj
             if (obj.parameters != null) {
-//                //原始信息点存储
-//                if (flag && null != family) {
-//                    //拷贝源参数
-//                    val json = obj.parameters!!.toJson();
-//                    val parameters = JSON.parseObject(json,ArrayList<Parameter>().javaClass)
-//                    obj.initParameters = parameters
-//                }
                 var infos = HashMap<String, String>()
 
                 for (param in obj.parameters!!) {
@@ -83,6 +81,112 @@ object EquipmentAnalyzer {
         return SResponseType.success == result.result
     }
 
+    /**
+     * @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 {
+        if (equipments == null || equipments.isEmpty())
+            return true
+
+
+        val newEquipmnets = ArrayList<Equipment>()
+        for (obj in equipments) {
+            obj.id = CommonService.generateUUID(null, true)
+            obj.modelId = baseObj.modelId
+            var family: String? = null
+            val familyName = obj.familyName
+//            if (!flag && !familyName.isNullOrEmpty()) {
+//                    family = familyName!!.substring(0, familyName.indexOf("-"))
+//                    obj.family = family
+//            }
+            obj.bimId = "${bimIdPrefix}${obj.sourceId}"
+            if (obj.revitId != null && obj.revitId!!.isNotEmpty())
+                equipMap[obj.revitId!!] = obj
+            if (obj.parameters != null) {
+                var infos = HashMap<String, String>()
+
+                for (param in obj.parameters!!) {
+                    if (param.name.equals("设备本地名称")) {
+                        obj.localName = param.value
+                    } else if (param.name.equals("设备本地编码")) {
+                        obj.localId = param.value
+                    } else if (param.name.equals("PropertyID", true)) {
+                        obj.propertyId = param.value
+                    } else if (param.name.equals("构件分类编码")) {
+                        obj.bimTypeID = param.value
+                    } else if (param.name.equals("系统分类")) {
+                        obj.sysName = param.value
+                    }
+
+
+                    if (null != family && !param.name.isNullOrEmpty()) {
+                        //信息点编码转换
+                        val infoPointComp = infoPointCompService.select(SFilter.eq("family", family), SFilter.eq("infoPointCode", param.name!!)).entity()
+                        if (infoPointComp != null) {
+                            infos[infoPointComp.sInfoPointCode!!] = param.value ?: ""
+                        } else {
+                            infos[param.name!!] = param.value ?: ""
+                        }
+                    }
+                }
+                var equipComp: EquipComp? = null
+
+                //bimtypeID转换,设备构建码没有抛弃,查不到抛弃
+                if(! obj.bimTypeID.isNullOrEmpty()){
+                    if(! obj.sysName.isNullOrEmpty()){
+                        equipComp = equipCompService.select(SFilter.eq("bimTypeID",obj.bimTypeID!!), SFilter.eq("sysName",obj.sysName!!)).entity()
+                        if(equipComp != null){
+                            obj.family = equipComp.classCode
+                        }
+                    }else{
+                        equipComp = equipCompService.select(SFilter.eq("bimTypeID",obj.bimTypeID!!)).entity()
+                        if(equipComp != null){
+                            obj.family = equipComp.classCode
+                        }
+                    }
+                    if(!obj.family.isNullOrEmpty()){
+
+                        //信息点编码转换
+                        for (param in obj.parameters!!) {
+                            if (param.name.equals("设备本地名称")) {
+
+                            } else if (param.name.equals("设备本地编码")) {
+
+                            } else if (param.name.equals("PropertyID", true)) {
+
+                            } else if (param.name.equals("构件分类编码")) {
+
+                            } else if (param.name.equals("系统分类")) {
+
+                            }else{
+                                //信息点编码转换
+                                val infoPointComp = infoPointCompService.select(SFilter.eq("family", family!!), SFilter.eq("infoPointCode", param.name!!)).entity()
+                                if (infoPointComp != null) {
+                                    infos[infoPointComp.sInfoPointCode!!] = param.value ?: ""
+                                } else {
+                                    infos[param.name!!] = param.value ?: ""
+                                }
+                            }
+
+                        }
+
+                    }else{
+                        continue
+                    }
+                    obj.infos = infos
+                    newEquipmnets.add(obj)
+                }
+
+            }
+        }
+        equipmentService.delete(SFilter.eq("modelId", baseObj.modelId!!))
+        val create = SCreateRequest<Equipment>()
+        create.content = newEquipmnets
+        val result = equipmentService.createList(create)
+        return SResponseType.success == result.result
+    }
+
     fun analyzeComponent(componentService: SObjectService<EquipPart>, baseObj: BaseObj<AllComponents>, equipParts: ArrayList<EquipPart>?, bimIdPrefix: String, equipMap: HashMap<String, BaseComponent>): Boolean {
         if (equipParts == null || equipParts.isEmpty())
             return true

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

@@ -161,13 +161,19 @@ open class JSONAnalyzerService {
         if (!result) {
             return "处理Space异常"
         }
-
-        //处理Room, 填充数据, replace插入表
-        result = result and RoomAnalyzer.analyze(dataService.roomService, baseObj, baseObj.elements!!.rooms)
+        //---------------------------------------------------------
+        //12.20临时演示方案,room当作space
+        result = result and SpaceAnalyzer.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) {
+//            return "处理Room异常"
+//        }
+
 
         // 处理BoundarySegment, 填充数据, replace方式插入表
         result = result and BoundarySegmentAnalyzer.analyze(
@@ -244,15 +250,24 @@ open class JSONAnalyzerService {
             return "处理joinObject异常"
         }
         // 处理equipment
-        result = result and EquipmentAnalyzer.analyze(
+//        result = result and EquipmentAnalyzer.analyze(
+//                dataService.equipmentService,
+//                baseObj,
+//                baseObj.elements!!.equipments,
+//                bimIdPrefix, revitIdMap,
+//                checkProject(baseObj.mbiName),
+//                dataService.dictCompService,
+//                dataService.infoPointCompService
+//        )
+        result = result and EquipmentAnalyzer.analyze2(
                 dataService.equipmentService,
                 baseObj,
                 baseObj.elements!!.equipments,
                 bimIdPrefix, revitIdMap,
-                checkProject(baseObj.mbiName),
-                dataService.dictCompService,
+                dataService.equipCompService,
                 dataService.infoPointCompService
         )
+
         if (!result) {
             return "处理equipment异常"
         }

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

@@ -33,6 +33,10 @@ object RoomAnalyzer {
                             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
                     }
                 }
                 if(obj.localName == null || obj.localName!!.isEmpty() ){

+ 2 - 1
revit-algorithm/src/main/resources-prod/application.yml

@@ -74,7 +74,8 @@ properties:
   #文件服务器配置
   fileService:
     # 基本属性
-    url:                               http://api.sagacloud.cn/dp-auxiliary/image-service/ # http://47.93.33.207:28888/image-service/ #http://adm.sagacloud.cn/image-service/
+    #url:                               http://api.sagacloud.cn/dp-auxiliary/image-service/ # http://47.93.33.207:28888/image-service/ #http://adm.sagacloud.cn/image-service/
+    url:                               http://60.205.177.43:8080/image-service/
     systemId:                          revit
     secret:                            63afbef6906c342b
     dir:                               model

scheduler/src/main/resources-prod/application.yml → scheduler/src/main/resources-prod/application60.yml