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