|
@@ -274,36 +274,49 @@ class ObjectFromToControllers {
|
|
|
val equipSynApi = EquipApi.equipSynApi(dictProject!!.groupCode!!,projectId, page,"equipment")
|
|
|
val equipDataList = equipSynApi.data
|
|
|
for (equipData in equipDataList!!){
|
|
|
- val equipSyn = EquipUtil.equipSyns(projectId, dictProject!!.groupCode!!, equipData)
|
|
|
- logger.debug("设备=${equipSyn.toJson()}")
|
|
|
- if (isBuildingFloor){
|
|
|
- /** 查询建筑 */
|
|
|
- val equipInBuildingList = EquipApi.equipInBuilding(dictProject!!.groupCode!!,projectId, equipSyn.id!!)
|
|
|
- if (equipInBuildingList.size>0){
|
|
|
- val hashMap = equipInBuildingList[0]
|
|
|
- if (hashMap.containsKey("objTo")){
|
|
|
- equipSyn.buildingId = hashMap["objTo"].toString()
|
|
|
+ try {
|
|
|
+ val equipSyn = EquipUtil.equipSyns(projectId, dictProject!!.groupCode!!, equipData)
|
|
|
+ logger.debug("设备=${equipSyn.toJson()}")
|
|
|
+ if (isBuildingFloor){
|
|
|
+ /** 查询建筑 */
|
|
|
+ val equipInBuildingList = EquipApi.equipInBuilding(dictProject!!.groupCode!!,projectId, equipSyn.id!!)
|
|
|
+ if (equipInBuildingList.size>0){
|
|
|
+ val hashMap = equipInBuildingList[0]
|
|
|
+ if (hashMap.containsKey("objTo")){
|
|
|
+ equipSyn.buildingId = hashMap["objTo"].toString()
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- /** 查询楼层 */
|
|
|
- val equipInFloorList = EquipApi.equipInFloor(dictProject!!.groupCode!!,projectId, equipSyn.id!!)
|
|
|
- if (equipInFloorList.size>0){
|
|
|
-
|
|
|
- val hashMap = equipInFloorList[0]
|
|
|
- if (hashMap.containsKey("objTo")){
|
|
|
- equipSyn.floorId = hashMap["objTo"].toString()
|
|
|
+ /** 查询楼层 */
|
|
|
+ val equipInFloorList = EquipApi.equipInFloor(dictProject!!.groupCode!!,projectId, equipSyn.id!!)
|
|
|
+ if (equipInFloorList.size>0){
|
|
|
+ val hashMap = equipInFloorList[0]
|
|
|
+ if (hashMap.containsKey("objTo")){
|
|
|
+ equipSyn.floorId = hashMap["objTo"].toString()
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- if (equipSyn.buildingId.isNullOrEmpty()){
|
|
|
- if (!equipSyn.floorId.isNullOrEmpty()){
|
|
|
- val floor = BaseDataService.floorService.select(SFilter.eq("id", equipSyn.floorId!!)).entity()
|
|
|
- if (floor!=null){
|
|
|
- equipSyn.buildingId = floor.buildingId
|
|
|
+ if (!equipSyn.buildingId.isNullOrEmpty()){
|
|
|
+ val entity =
|
|
|
+ BaseDataService.buildingService.select(SFilter.eq("id", equipSyn.buildingId!!))
|
|
|
+ .entity()
|
|
|
+ if (entity!=null) {
|
|
|
+ if (!equipSyn.floorId.isNullOrEmpty()){
|
|
|
+ val floor = BaseDataService.floorService.select(SFilter.eq("id", equipSyn.floorId!!)).entity()
|
|
|
+ if (floor==null){
|
|
|
+ equipSyn.floorId = null
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ equipSyn.floorId = null
|
|
|
+ equipSyn.buildingId = null
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
+ BaseDataService.equipmentService.replace(equipSyn)
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
+
|
|
|
}
|
|
|
- BaseDataService.equipmentService.replace(equipSyn)
|
|
|
|
|
|
}
|
|
|
if (equipSynApi.data!!.size>= 1000){
|
|
@@ -318,33 +331,37 @@ class ObjectFromToControllers {
|
|
|
val equipDataList = equipSynApi.data
|
|
|
for (equipData in equipDataList!!){
|
|
|
val equipSyn = EquipUtil.equipSyns(project.id!!, dictProject.groupCode!!, equipData)
|
|
|
- if (isBuildingFloor){
|
|
|
- /** 查询建筑 */
|
|
|
- val equipInBuildingList = EquipApi.equipInBuilding(dictProject.groupCode!!,project.id!!, equipSyn.id!!)
|
|
|
- if (equipInBuildingList.size>0){
|
|
|
- val hashMap = equipInBuildingList[0]
|
|
|
- if (hashMap.containsKey("objTo")){
|
|
|
- equipSyn.buildingId = hashMap["objTo"].toString()
|
|
|
+ try {
|
|
|
+ if (isBuildingFloor){
|
|
|
+ /** 查询建筑 */
|
|
|
+ val equipInBuildingList = EquipApi.equipInBuilding(dictProject.groupCode!!,project.id!!, equipSyn.id!!)
|
|
|
+ if (equipInBuildingList.size>0){
|
|
|
+ val hashMap = equipInBuildingList[0]
|
|
|
+ if (hashMap.containsKey("objTo")){
|
|
|
+ equipSyn.buildingId = hashMap["objTo"].toString()
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- /** 查询楼层 */
|
|
|
- val equipInFloorList = EquipApi.equipInFloor(dictProject.groupCode!!,project.id!!, equipSyn.id!!)
|
|
|
- if (equipInFloorList.size>0){
|
|
|
- val hashMap = equipInFloorList[0]
|
|
|
- if (hashMap.containsKey("objTo")){
|
|
|
- equipSyn.floorId = hashMap["objTo"].toString()
|
|
|
+ /** 查询楼层 */
|
|
|
+ val equipInFloorList = EquipApi.equipInFloor(dictProject.groupCode!!,project.id!!, equipSyn.id!!)
|
|
|
+ if (equipInFloorList.size>0){
|
|
|
+ val hashMap = equipInFloorList[0]
|
|
|
+ if (hashMap.containsKey("objTo")){
|
|
|
+ equipSyn.floorId = hashMap["objTo"].toString()
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- if (equipSyn.buildingId.isNullOrEmpty()&&!equipSyn.floorId.isNullOrEmpty()){
|
|
|
- if (!equipSyn.floorId.isNullOrEmpty()){
|
|
|
- val floor = BaseDataService.floorService.select(SFilter.eq("id", equipSyn.floorId!!)).entity()
|
|
|
- if (floor!=null){
|
|
|
- equipSyn.buildingId = floor.buildingId
|
|
|
+ if (!equipSyn.buildingId.isNullOrEmpty()&&!equipSyn.floorId.isNullOrEmpty()){
|
|
|
+ if (!equipSyn.floorId.isNullOrEmpty()){
|
|
|
+ val floor = BaseDataService.floorService.select(SFilter.eq("id", equipSyn.floorId!!)).entity()
|
|
|
+ if (floor!=null){
|
|
|
+ equipSyn.buildingId = floor.buildingId
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ BaseDataService.equipmentService.replace(equipSyn)
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
}
|
|
|
- BaseDataService.equipmentService.replace(equipSyn)
|
|
|
}
|
|
|
if (equipSynApi.data!!.size>= 1000){
|
|
|
num ++
|