Browse Source

设备识别更新本地编码 且 不符合识别规则的构件抛弃

caiaf 3 years ago
parent
commit
fcad20ece7

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

@@ -134,35 +134,29 @@ object EquipmentAnalyzer {
 
                 //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?:"XXXXXX"
-                            obj.bimTypeName = equipComp.bimTypeName
-                            obj.wdCode = equipComp.aliasCode
-                            obj.aliasName = equipComp.aliasName
-                        }else{
-                            equipComp = equipCompService.select(SFilter.eq("bimTypeID",obj.bimTypeID!!), SFilter.or(SFilter.isNull("sysName"),SFilter.eq("sysName",""))).entity()
+                    val equipComps = equipCompService.select(SFilter.eq("bimTypeID",obj.bimTypeID!!)).exec()
+                    if(equipComps.size > 1){
+                        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?:"XXXXXX"
                                 obj.bimTypeName = equipComp.bimTypeName
                                 obj.wdCode = equipComp.aliasCode
                                 obj.aliasName = equipComp.aliasName
-                            }else{
+                            }else {
                                 obj.family = "OTXXXX"
                             }
-                            //未识别的设备类型,类型码转换为"OTXXXX",OT表示“其他系统”,“XXXX”表示未识别的设备
-                        }
-                    }else{
-                        equipComp = equipCompService.select(SFilter.eq("bimTypeID",obj.bimTypeID!!), SFilter.or(SFilter.isNull("sysName"),SFilter.eq("sysName",""))).entity()
-                        if(equipComp != null){
-                            obj.family = equipComp.classCode?:"XXXXXX"
-                            obj.bimTypeName = equipComp.bimTypeName
-                            obj.wdCode = equipComp.aliasCode
-                            obj.aliasName = equipComp.aliasName
                         }else{
                             obj.family = "OTXXXX"
                         }
+                    }else if(equipComps.size == 1){
+                        equipComp = equipComps[0]
+                        obj.family = equipComp.classCode?:"XXXXXX"
+                        obj.bimTypeName = equipComp.bimTypeName
+                        obj.wdCode = equipComp.aliasCode
+                        obj.aliasName = equipComp.aliasName
+                    }else {
+                        obj.family = "OTXXXX"
                     }
                     family = obj.family
                     if(!family.isNullOrEmpty()){