|
@@ -31,6 +31,7 @@ import com.persagy.database.SFilter
|
|
|
import com.persagy.mybatis.SMybatisDao
|
|
|
import com.persagy.server.datacenter.models.entities.dictnew.DictProject
|
|
|
import com.persagy.server.datacenter.models.entities.objects.Equipment
|
|
|
+import com.persagy.server.datacenter.models.entities.rel.REqForBd
|
|
|
import com.persagy.server.datacenter.models.entities.rel.REqForFl
|
|
|
import com.persagy.server.syn.Configure
|
|
|
import com.persagy.server.syn.models.api.obj.EquipApi
|
|
@@ -63,6 +64,8 @@ class RelToFromController {
|
|
|
|
|
|
/** 设备服务楼层 */
|
|
|
private val rEqForFlService = SBaseService(SMybatisDao(REqForFl::class.java))
|
|
|
+ /** 设备服务建筑 */
|
|
|
+ private val rEqForBdService = SBaseService(SMybatisDao(REqForBd::class.java))
|
|
|
/** 数据中心设备服务 */
|
|
|
private val equipmentService = SObjectService(SMybatisDao(Equipment::class.java))
|
|
|
/** 字典项目服务 */
|
|
@@ -124,7 +127,94 @@ class RelToFromController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 设备和建筑关系-同步到中台
|
|
|
+ *
|
|
|
+ * @param projectId 项目id
|
|
|
+ * @param graphCode 图类型
|
|
|
+ * @param type 边类型
|
|
|
+ * @param isDel 是否删除以前的关系
|
|
|
+ * @return 返回是否成功结果
|
|
|
+ */
|
|
|
+ @Operation(summary= "设备和楼层关系-同步到中台", description = "设备所在的建筑(图类型 MechInArch 边类型 Eq2Bd ),设备服务的建筑(图类型 MechForArch 边类型 Eq2Bd), ")
|
|
|
+ @PostMapping("/eq2bd")
|
|
|
+ fun eq2Bd(projectId: String,graphCode: String,type: String,isDel: Boolean = false): SBaseResponse {
|
|
|
+ try {
|
|
|
+ val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
|
|
|
+ if (graphCode == "MechInArch") {
|
|
|
+ val equipmentList = equipmentService.select(SFilter.eq("projectId", projectId)).exec()
|
|
|
+ if (equipmentList.size>0) {
|
|
|
+ for (equipment in equipmentList) {
|
|
|
+ val toJsonObjArray =
|
|
|
+ Configure.toJsonObjArray(graphCode, type, equipment.id!!, equipment.buildingId!!)
|
|
|
+ if (isDel) {
|
|
|
+ val toJsonObj = Configure.toJsonObj(graphCode, type, equipment.id!!, null)
|
|
|
+ EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
|
|
|
+ }
|
|
|
+ val createRel = EquipApi.createRel(dictProject!!.groupCode!!, projectId, toJsonObjArray)
|
|
|
+ if (!createRel){
|
|
|
+ logger.debug("设备所在建筑的关系失败:${toJsonObjArray.toJson()}")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (graphCode == "MechForArch") {
|
|
|
+ val rEqForFlList = rEqForBdService.select(SFilter.eq("projectId", projectId)).exec()
|
|
|
+ if (rEqForFlList.size>0) {
|
|
|
+ for (rEqForFl in rEqForFlList) {
|
|
|
+ if (isDel) {
|
|
|
+ val toJsonObj = Configure.toJsonObj(graphCode, type, rEqForFl.equipId!!, null)
|
|
|
+ EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
|
|
|
+ }
|
|
|
+ val toJsonObjArray =
|
|
|
+ Configure.toJsonObjArray(graphCode, type, rEqForFl.equipId!!, rEqForFl.buildingId!!)
|
|
|
+ val createRel = EquipApi.createRel(dictProject!!.groupCode!!, projectId, toJsonObjArray)
|
|
|
+ if (!createRel){
|
|
|
+ logger.debug("设备服务建筑的关系失败:${toJsonObjArray.toJson()}")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return SBaseResponse(SResponseType.success)
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
+ return SBaseResponse(SResponseType.failure,e.message!!)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
+ /**
|
|
|
+ * 设备和系统关系
|
|
|
+ */
|
|
|
+ @Operation(summary= "设备和系统关系-同步到中台", description = "系统下设备(图类型 MechSubset 边类型 Sy2Eq )")
|
|
|
+ @PostMapping("/sy2eq")
|
|
|
+ fun sy2Eq(projectId: String,graphCode: String,type: String,isDel: Boolean = false){
|
|
|
+ val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设备和竖井关系
|
|
|
+ */
|
|
|
+ @Operation(summary= "设备和竖井关系-同步到中台", description = "设备所在的竖井(图类型 MechInArch 边类型 Eq2Bd ),设备服务的竖井(图类型 MechForArch 边类型 Eq2Sh), ")
|
|
|
+ @PostMapping("/eq2sh")
|
|
|
+ fun eq2Sh(projectId: String,graphCode: String,type: String,isDel: Boolean = false){
|
|
|
+ val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设备和空间关系
|
|
|
+ */
|
|
|
+ @Operation(summary= "设备和空间关系-同步到中台", description = "设备所在的空间(图类型 MechInArch 边类型 Eq2Sp ),设备服务的空间(图类型 MechForArch 边类型 Eq2Sp), ")
|
|
|
+ @PostMapping("/eq2sp")
|
|
|
+ fun eq2Sp(projectId: String,graphCode: String,type: String,isDel: Boolean = false){
|
|
|
+ val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设备和部件关系
|
|
|
+ */
|
|
|
+ fun eq2Ec(projectId: String,graphCode: String,type: String,isDel: Boolean = false){
|
|
|
+ val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
|
|
|
+ }
|
|
|
|
|
|
|
|
|
}
|