|
@@ -159,28 +159,31 @@ class ObjectToFromController {
|
|
|
fun equipSync(@RequestParam projectId: String): SBaseResponse {
|
|
|
try {
|
|
|
val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
|
|
|
- val equipList = equipmentService.select(SFilter.eq("projectId", projectId)).exec()
|
|
|
+ val equipList = equipmentService.select(SFilter.eq("projectId", projectId)).order("lastUpdate desc").exec()
|
|
|
for (equip in equipList) {
|
|
|
val createObj =
|
|
|
EquipApi.createObj(dictProject!!.groupCode!!, projectId, EquipUtil.equipTools(projectId, equip))
|
|
|
if (!createObj) {
|
|
|
- val updateObj =
|
|
|
- EquipApi.updateObj(dictProject!!.groupCode!!, projectId, EquipUtil.equipTools(projectId, equip))
|
|
|
- if (!updateObj) {
|
|
|
- logger.debug("设备更新失败:${equip.toJson()}")
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
- if (!equip.buildingId.isNullOrEmpty()) {
|
|
|
- val toJsonObjArray =
|
|
|
- Configure.toJsonObjArray("MechInArch", "Eq2Bd", equip.id!!, equip.buildingId!!)
|
|
|
- val toJsonObjArray2 =
|
|
|
- Configure.toJsonObjArray("MechInArch", "Eq2Fl", equip.id!!, equip.floorId!!)
|
|
|
- toJsonObjArray.add(toJsonObjArray2[0])
|
|
|
- val createRel = EquipApi.createRel(dictProject.groupCode!!, projectId, toJsonObjArray)
|
|
|
- if (!createRel){
|
|
|
- logger.debug("设备和楼层的关系失败:${equip.toJson()}")
|
|
|
- }
|
|
|
+ val updateObj =
|
|
|
+ EquipApi.updateObj(dictProject!!.groupCode!!, projectId, EquipUtil.equipTools(projectId, equip))
|
|
|
+ if (!updateObj) {
|
|
|
+ logger.debug("设备更新失败:${equip.toJson()}")
|
|
|
}
|
|
|
+// if (!equip.buildingId.isNullOrEmpty()) {
|
|
|
+// val toJsonObjArray =
|
|
|
+// Configure.toJsonObjArray("MechInArch", "Eq2Bd", equip.id!!, equip.buildingId!!)
|
|
|
+// if (!equip.floorId.isNullOrEmpty()){
|
|
|
+// val toJsonObjArray2 =
|
|
|
+// Configure.toJsonObjArray("MechInArch", "Eq2Fl", equip.id!!, equip.floorId!!)
|
|
|
+// toJsonObjArray.add(toJsonObjArray2[0])
|
|
|
+// }
|
|
|
+// val createRel = EquipApi.createRel(dictProject.groupCode!!, projectId, toJsonObjArray)
|
|
|
+// if (!createRel){
|
|
|
+// logger.debug("设备和楼层的关系失败:${equip.toJson()}")
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|
|
|
return SBaseResponse(SResponseType.success)
|
|
|
} catch (e: Exception) {
|