|
@@ -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
|
|
|
}
|