|
@@ -190,6 +190,47 @@ class ObjectToFromController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 设备-数据中心同步到物理世界
|
|
|
+ */
|
|
|
+ @Operation(summary= "设备-数据中心同步到数据中台", description = "")
|
|
|
+ @PostMapping("/equipId")
|
|
|
+ fun equipSyncId(@RequestParam projectId: String,@RequestParam id: String): SBaseResponse {
|
|
|
+ try {
|
|
|
+ val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
|
|
|
+ val equipList = equipmentService.select(SFilter.eq("projectId", projectId),SFilter.eq("id", id)).exec()
|
|
|
+ for (equip in equipList) {
|
|
|
+ val createObj =
|
|
|
+ EquipApi.createObj(dictProject!!.groupCode!!, projectId, EquipUtil.equipTools(projectId, equip))
|
|
|
+ if (createObj!!.result == "success") {
|
|
|
+ val updateObj =
|
|
|
+ EquipApi.updateObj(dictProject!!.groupCode!!, projectId, EquipUtil.equipTools(projectId, equip))
|
|
|
+ if (updateObj!=null&&updateObj.result == "success") {
|
|
|
+ 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.plus(toJsonObjArray2[0])
|
|
|
+ }
|
|
|
+ val createRel = EquipApi.createRel(dictProject.groupCode!!, projectId, toJsonObjArray)
|
|
|
+ if (!createRel){
|
|
|
+ logger.debug("设备和楼层的关系失败:${equip.toJson()}")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return SBaseResponse(SResponseType.success)
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
+ return SBaseResponse(SResponseType.failure,e.message!!)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
* 系统
|
|
|
*/
|
|
|
@Operation(summary= "系统-数据中心同步到数据中台", description = "")
|