|
@@ -32,6 +32,7 @@ import com.persagy.database.functions.SLength
|
|
|
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.objects.Floor
|
|
|
import com.persagy.server.datacenter.models.entities.rel.*
|
|
|
import com.persagy.server.syn.Configure
|
|
|
import com.persagy.server.syn.models.api.obj.EquipApi
|
|
@@ -74,8 +75,40 @@ class RelToFromController {
|
|
|
private val rEqInShService = SBaseService(SMybatisDao(REqInSh::class.java))
|
|
|
/** 数据中心设备和空间关系 */
|
|
|
private val rEq2SpService = SObjectService(SMybatisDao(REq2Sp::class.java))
|
|
|
+ /** 数据中心系统所在竖井关系 */
|
|
|
+ private val syInShService = SObjectService(SMybatisDao(RSyInSh::class.java))
|
|
|
+ /** 数据中心系统服务于竖井关系 */
|
|
|
+ private val rSyForShService = SObjectService(SMybatisDao(RSyForSh::class.java))
|
|
|
+ /** 数据中心竖井下的业务空间关系 */
|
|
|
+ private val rSh2SpService = SObjectService(SMybatisDao(RSh2Sp::class.java))
|
|
|
+ /** 数据中心建筑下的竖井关系 */
|
|
|
+ private val rShInBdService = SObjectService(SMybatisDao(RShInBd::class.java))
|
|
|
+ /** 数据中心系统所在楼层关系 */
|
|
|
+ private val rSyInFlService = SObjectService(SMybatisDao(RSyInFl::class.java))
|
|
|
+ /** 数据中心系统服务于楼层关系 */
|
|
|
+ private val rSyForFlService = SObjectService(SMybatisDao(RSyForFl::class.java))
|
|
|
+ /** 数据中心系统所在的建筑体关系 */
|
|
|
+ private val rSyInBdService = SObjectService(SMybatisDao(RSyInBd::class.java))
|
|
|
+ /** 数据中心系统服务于楼层关系 */
|
|
|
+ private val rSyForBdService = SObjectService(SMybatisDao(RSyForBd::class.java))
|
|
|
+ /** 数据中心楼层下的业务空间关系 */
|
|
|
+ private val rSpinFlService = SObjectService(SMybatisDao(RSpinFl::class.java))
|
|
|
+ /** 数据中心建筑体下的业务空间关系 */
|
|
|
+ private val rSpinBdService = SObjectService(SMybatisDao(RSpinBd::class.java))
|
|
|
+ /** 数据中心系统和空间关系 */
|
|
|
+ private val rSy2SpService = SObjectService(SMybatisDao(RSy2Sp::class.java))
|
|
|
+ /** 数据中心竖井贯通关系 */
|
|
|
+ private val rShaftThroughShaftService = SObjectService(SMybatisDao(RShaftThroughShaft::class.java))
|
|
|
+ /** 数据中心楼层贯通关系 */
|
|
|
+ private val rFlThroughFlService = SObjectService(SMybatisDao(RFlThroughFl::class.java))
|
|
|
+ /** 空间和空间的关系 */
|
|
|
+ private val rSp2SpService = SObjectService(SMybatisDao(RSp2Sp::class.java))
|
|
|
+ /** 空间和空间的关系 */
|
|
|
+ private val rEq2EqService = SObjectService(SMybatisDao(REq2Eq::class.java))
|
|
|
/** 数据中心设备服务 */
|
|
|
private val equipmentService = SObjectService(SMybatisDao(Equipment::class.java))
|
|
|
+ /** 数据中心楼层服务 */
|
|
|
+ private val floorService = SObjectService(SMybatisDao(Floor::class.java))
|
|
|
/** 字典项目服务 */
|
|
|
private val dictProjectService = SBaseService(SMybatisDao(DictProject::class.java))
|
|
|
|
|
@@ -98,7 +131,7 @@ class RelToFromController {
|
|
|
if (equipmentList.size>0) {
|
|
|
for (equipment in equipmentList) {
|
|
|
val toJsonObjArray =
|
|
|
- Configure.toJsonObjArray(graphCode, type, equipment.id!!, equipment.floorId!!)
|
|
|
+ Configure.toJsonObjArray(graphCode, type, equipment.id!!, equipment.floorId!!)
|
|
|
if (isDel) {
|
|
|
val toJsonObj = Configure.toJsonObj(graphCode, type, equipment.id!!, null)
|
|
|
EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
|
|
@@ -118,7 +151,7 @@ class RelToFromController {
|
|
|
EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
|
|
|
}
|
|
|
val toJsonObjArray =
|
|
|
- Configure.toJsonObjArray(graphCode, type, rEqForFl.equipId!!, rEqForFl.floorId!!)
|
|
|
+ Configure.toJsonObjArray(graphCode, type, rEqForFl.equipId!!, rEqForFl.floorId!!)
|
|
|
val createRel = EquipApi.createRel(dictProject!!.groupCode!!, projectId, toJsonObjArray)
|
|
|
if (!createRel){
|
|
|
logger.debug("设备服务楼层的关系失败:${toJsonObjArray.toJson()}")
|
|
@@ -152,7 +185,7 @@ class RelToFromController {
|
|
|
if (equipmentList.size>0) {
|
|
|
for (equipment in equipmentList) {
|
|
|
val toJsonObjArray =
|
|
|
- Configure.toJsonObjArray(graphCode, type, equipment.id!!, equipment.buildingId!!)
|
|
|
+ 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)
|
|
@@ -172,7 +205,7 @@ class RelToFromController {
|
|
|
EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
|
|
|
}
|
|
|
val toJsonObjArray =
|
|
|
- Configure.toJsonObjArray(graphCode, type, rEqForFl.equipId!!, rEqForFl.buildingId!!)
|
|
|
+ Configure.toJsonObjArray(graphCode, type, rEqForFl.equipId!!, rEqForFl.buildingId!!)
|
|
|
val createRel = EquipApi.createRel(dictProject!!.groupCode!!, projectId, toJsonObjArray)
|
|
|
if (!createRel){
|
|
|
logger.debug("设备服务建筑的关系失败:${toJsonObjArray.toJson()}")
|
|
@@ -197,9 +230,9 @@ class RelToFromController {
|
|
|
try {
|
|
|
val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
|
|
|
val rSyEqList = rSyEqService.select(
|
|
|
- SFilter.eq("projectId", projectId),
|
|
|
- SFilter.eq("graphCode", graphCode),
|
|
|
- SFilter.eq("type", type)
|
|
|
+ SFilter.eq("projectId", projectId),
|
|
|
+ SFilter.eq("graphCode", graphCode),
|
|
|
+ SFilter.eq("type", type)
|
|
|
).exec()
|
|
|
if (rSyEqList.size>0){
|
|
|
for (rSyEq in rSyEqList){
|
|
@@ -208,7 +241,7 @@ class RelToFromController {
|
|
|
EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
|
|
|
}
|
|
|
val toJsonObjArray =
|
|
|
- Configure.toJsonObjArray(graphCode, type, rSyEq.sysId!!, rSyEq.equipId!!)
|
|
|
+ Configure.toJsonObjArray(graphCode, type, rSyEq.sysId!!, rSyEq.equipId!!)
|
|
|
val createRel = EquipApi.createRel(dictProject!!.groupCode!!, projectId, toJsonObjArray)
|
|
|
if (!createRel){
|
|
|
logger.debug("系统下的设备关系失败:${toJsonObjArray.toJson()}")
|
|
@@ -240,7 +273,7 @@ class RelToFromController {
|
|
|
EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
|
|
|
}
|
|
|
val toJsonObjArray =
|
|
|
- Configure.toJsonObjArray(graphCode, type, rEqInSh.equipId!!, rEqInSh.shaftId!!)
|
|
|
+ Configure.toJsonObjArray(graphCode, type, rEqInSh.equipId!!, rEqInSh.shaftId!!)
|
|
|
val createRel = EquipApi.createRel(dictProject!!.groupCode!!, projectId, toJsonObjArray)
|
|
|
if (!createRel){
|
|
|
logger.debug("设备所在竖井关系失败:${toJsonObjArray.toJson()}")
|
|
@@ -256,7 +289,7 @@ class RelToFromController {
|
|
|
EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
|
|
|
}
|
|
|
val toJsonObjArray =
|
|
|
- Configure.toJsonObjArray(graphCode, type, rEqForSh.equipId!!, rEqForSh.shaftId!!)
|
|
|
+ Configure.toJsonObjArray(graphCode, type, rEqForSh.equipId!!, rEqForSh.shaftId!!)
|
|
|
val createRel = EquipApi.createRel(dictProject!!.groupCode!!, projectId, toJsonObjArray)
|
|
|
if (!createRel){
|
|
|
logger.debug("设备服务的竖井关系失败:${toJsonObjArray.toJson()}")
|
|
@@ -280,9 +313,9 @@ class RelToFromController {
|
|
|
try {
|
|
|
val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
|
|
|
val rEq2SpList = rEq2SpService.select(
|
|
|
- SFilter.eq("id", projectId),
|
|
|
- SFilter.eq("graphCode", graphCode),
|
|
|
- SFilter.eq("type", type)
|
|
|
+ SFilter.eq("projectId", projectId),
|
|
|
+ SFilter.eq("graphCode", graphCode),
|
|
|
+ SFilter.eq("type", type)
|
|
|
).exec()
|
|
|
if (rEq2SpList.size>0) {
|
|
|
for (rEq2Sp in rEq2SpList) {
|
|
@@ -291,7 +324,7 @@ class RelToFromController {
|
|
|
EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
|
|
|
}
|
|
|
val toJsonObjArray =
|
|
|
- Configure.toJsonObjArray(graphCode, type, rEq2Sp.id1!!, rEq2Sp.id2!!)
|
|
|
+ Configure.toJsonObjArray(graphCode, type, rEq2Sp.id1!!, rEq2Sp.id2!!)
|
|
|
val createRel = EquipApi.createRel(dictProject!!.groupCode!!, projectId, toJsonObjArray)
|
|
|
if (!createRel){
|
|
|
logger.debug("设备和空间关系失败:${toJsonObjArray.toJson()}")
|
|
@@ -308,54 +341,528 @@ class RelToFromController {
|
|
|
/**
|
|
|
* 设备和部件关系
|
|
|
*/
|
|
|
- fun eq2Ec(projectId: String,graphCode: String,type: String,isDel: Boolean = false){
|
|
|
- val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
|
|
|
- val equipmentList =
|
|
|
- equipmentService.select(SFilter.eq("projectId", projectId), SFilter.lte(SLength("classCode"), 8)).exec()
|
|
|
- if (equipmentList.size>0) {
|
|
|
+ @Operation(summary= "设备和部件关系-同步到中台", description = "设备下部件(图类型 MechSubset 边类型 Eq2Ec )")
|
|
|
+ @PostMapping("/eq2ec")
|
|
|
+ fun eq2Ec(projectId: String,graphCode: String,type: String,isDel: Boolean = false): SBaseResponse {
|
|
|
+ try {
|
|
|
+ val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
|
|
|
+ val equipmentList =
|
|
|
+ equipmentService.select(SFilter.eq("projectId", projectId), SFilter.lte(SLength("classCode"), 8)).exec()
|
|
|
+ if (equipmentList.size>0) {
|
|
|
+ for (equipment in equipmentList) {
|
|
|
+ if (!equipment.parentId.isNullOrEmpty()){
|
|
|
+ if (isDel) {
|
|
|
+ val toJsonObj = Configure.toJsonObj(graphCode, type, equipment.parentId!!, null)
|
|
|
+ EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
|
|
|
+ }
|
|
|
+ val toJsonObjArray =
|
|
|
+ Configure.toJsonObjArray(graphCode, type, equipment.parentId!!, equipment.id!!)
|
|
|
+ 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!!)
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 系统所在的竖井,系统服务的竖井
|
|
|
*/
|
|
|
- fun sy2Sh(projectId: String,graphCode: String,type: String,isDel: Boolean = false){
|
|
|
+ @Operation(summary= "系统和竖井关系-同步到中台", description = "系统所在的竖井(图类型 MechInArch 边类型 Sy2Sh ),系统服务于竖井(图类型MechForArch 边类型 Sy2Sh )")
|
|
|
+ @PostMapping("/sy2sh")
|
|
|
+ fun sy2Sh(projectId: String,graphCode: String,type: String,isDel: Boolean = false): SBaseResponse{
|
|
|
+ try {
|
|
|
+ val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
|
|
|
+ if (graphCode == "MechInArch") {
|
|
|
+ val syInShList = syInShService.select(SFilter.eq("projectId", projectId)).exec()
|
|
|
+ if (syInShList.size>0) {
|
|
|
+
|
|
|
+ for (syInSh in syInShList) {
|
|
|
+ if (isDel) {
|
|
|
+ val toJsonObj = Configure.toJsonObj(graphCode, type, syInSh.sysId!!, null)
|
|
|
+ EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
|
|
|
+ }
|
|
|
+ val toJsonObjArray =
|
|
|
+ Configure.toJsonObjArray(graphCode, type, syInSh.sysId!!, syInSh.shaftId!!)
|
|
|
+ val createRel = EquipApi.createRel(dictProject!!.groupCode!!, projectId, toJsonObjArray)
|
|
|
+ if (!createRel){
|
|
|
+ logger.debug("系统所在竖井失败:${toJsonObjArray.toJson()}")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ } else if (graphCode == "MechForArch"){
|
|
|
+ val rSyForShList = rSyForShService.select(SFilter.eq("projectId", projectId)).exec()
|
|
|
+ if (rSyForShList.size>0) {
|
|
|
+ for (rSyForSh in rSyForShList ) {
|
|
|
+ if (isDel) {
|
|
|
+ val toJsonObj = Configure.toJsonObj(graphCode, type, rSyForSh.sysId!!, null)
|
|
|
+ EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
|
|
|
+ }
|
|
|
+ val toJsonObjArray =
|
|
|
+ Configure.toJsonObjArray(graphCode, type, rSyForSh.sysId!!, rSyForSh.shaftId!!)
|
|
|
+ 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!!)
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 竖井所在的空间
|
|
|
+ * 竖井下的业务空间
|
|
|
*/
|
|
|
- fun sh2Sp(projectId: String,graphCode: String,type: String,isDel: Boolean = false) {
|
|
|
+ @Operation(summary= "竖井下的业务空间关系-同步到中台", description = "竖井下的业务空间(图类型 ArchSubset 边类型 Sh2Sp )")
|
|
|
+ @PostMapping("/sh2sp")
|
|
|
+ fun sh2Sp(projectId: String,graphCode: String,type: String,isDel: Boolean = false): SBaseResponse {
|
|
|
+ try {
|
|
|
+ val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
|
|
|
+ val rSh2SpList = rSh2SpService.select(SFilter.eq("projectId", projectId)).exec()
|
|
|
+ if (rSh2SpList.size>0) {
|
|
|
+ for (rSh2Sp in rSh2SpList) {
|
|
|
+ if (isDel) {
|
|
|
+ val toJsonObj = Configure.toJsonObj(graphCode, type, rSh2Sp.id1!!, null)
|
|
|
+ EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
|
|
|
+ }
|
|
|
+ val toJsonObjArray =
|
|
|
+ Configure.toJsonObjArray(graphCode, type, rSh2Sp.id1!!, rSh2Sp.id2!!)
|
|
|
+ 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 = "建筑体下的竖井(图类型 ArchSubset 边类型 Bd2Sh )")
|
|
|
+ @PostMapping("/bd2sh")
|
|
|
+ fun bd2sh(projectId: String,graphCode: String,type: String,isDel: Boolean = false): SBaseResponse {
|
|
|
+ try {
|
|
|
+ val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
|
|
|
+ val rShInBdList = rShInBdService.select(SFilter.eq("projectId", projectId)).exec()
|
|
|
+ if (rShInBdList.size>0){
|
|
|
+ for (rShInBd in rShInBdList) {
|
|
|
+ if (isDel) {
|
|
|
+ val toJsonObj = Configure.toJsonObj(graphCode, type, rShInBd.buildingId!!, null)
|
|
|
+ EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
|
|
|
+ }
|
|
|
+ val toJsonObjArray =
|
|
|
+ Configure.toJsonObjArray(graphCode, type, rShInBd.buildingId!!, rShInBd.shaftId!!)
|
|
|
+ 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 = "竖井贯通关系(图类型 ThroughRelationship 边类型 Sh2Sh )")
|
|
|
+ @PostMapping("/sh2sh")
|
|
|
+ fun sh2sh(projectId: String,graphCode: String,type: String,isDel: Boolean = false): SBaseResponse {
|
|
|
+ try {
|
|
|
+ val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
|
|
|
+ val rShaftThroughShaftList = rShaftThroughShaftService.select(SFilter.eq("projectId", projectId)).exec()
|
|
|
+ if (rShaftThroughShaftList.size>0){
|
|
|
+ for (rShaftThroughShaft in rShaftThroughShaftList) {
|
|
|
+ if (isDel) {
|
|
|
+ val toJsonObj = Configure.toJsonObj(graphCode, type, rShaftThroughShaft.shaftId!!, null)
|
|
|
+ EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
|
|
|
+ }
|
|
|
+ val toJsonObjArray =
|
|
|
+ Configure.toJsonObjArray(graphCode, type, rShaftThroughShaft.shaftId!!, rShaftThroughShaft.shaftOtherId!!)
|
|
|
+ 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 = "系统所在的楼层(图类型 MechInArch 边类型 Sy2Fl ),系统服务于楼层(图类型MechForArch 边类型 Sy2Fl )")
|
|
|
+ @PostMapping("/sy2fl")
|
|
|
+ fun sy2fl(projectId: String,graphCode: String,type: String,isDel: Boolean = false): SBaseResponse{
|
|
|
+ try {
|
|
|
+ val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
|
|
|
+ if (graphCode == "MechInArch") {
|
|
|
+ val syInShList = rSyInFlService.select(SFilter.eq("projectId", projectId)).exec()
|
|
|
+ if (syInShList.size>0) {
|
|
|
+
|
|
|
+ for (syInSh in syInShList) {
|
|
|
+ if (isDel) {
|
|
|
+ val toJsonObj = Configure.toJsonObj(graphCode, type, syInSh.sysId!!, null)
|
|
|
+ EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
|
|
|
+ }
|
|
|
+ val toJsonObjArray =
|
|
|
+ Configure.toJsonObjArray(graphCode, type, syInSh.sysId!!, syInSh.floorId!!)
|
|
|
+ val createRel = EquipApi.createRel(dictProject!!.groupCode!!, projectId, toJsonObjArray)
|
|
|
+ if (!createRel){
|
|
|
+ logger.debug("系统所在的楼层失败:${toJsonObjArray.toJson()}")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ } else if (graphCode == "MechForArch"){
|
|
|
+ val rSyForShList = rSyForFlService.select(SFilter.eq("projectId", projectId)).exec()
|
|
|
+ if (rSyForShList.size>0) {
|
|
|
+ for (rSyForSh in rSyForShList ) {
|
|
|
+ if (isDel) {
|
|
|
+ val toJsonObj = Configure.toJsonObj(graphCode, type, rSyForSh.sysId!!, null)
|
|
|
+ EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
|
|
|
+ }
|
|
|
+ val toJsonObjArray =
|
|
|
+ Configure.toJsonObjArray(graphCode, type, rSyForSh.sysId!!, rSyForSh.floorId!!)
|
|
|
+ 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 = "系统所在的建筑体(图类型 MechInArch 边类型 Sy2Bd ),系统服务于建筑体(图类型MechForArch 边类型 Sy2Bd )")
|
|
|
+ @PostMapping("/sy2bd")
|
|
|
+ fun sy2bd(projectId: String,graphCode: String,type: String,isDel: Boolean = false): SBaseResponse{
|
|
|
+ try {
|
|
|
+ val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
|
|
|
+ if (graphCode == "MechInArch") {
|
|
|
+ val rSyInBdList = rSyInBdService.select(SFilter.eq("projectId", projectId)).exec()
|
|
|
+ if (rSyInBdList.size>0) {
|
|
|
+
|
|
|
+ for (rSyInBd in rSyInBdList) {
|
|
|
+ if (isDel) {
|
|
|
+ val toJsonObj = Configure.toJsonObj(graphCode, type, rSyInBd.sysId!!, null)
|
|
|
+ EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
|
|
|
+ }
|
|
|
+ val toJsonObjArray =
|
|
|
+ Configure.toJsonObjArray(graphCode, type, rSyInBd.sysId!!, rSyInBd.buildingId!!)
|
|
|
+ val createRel = EquipApi.createRel(dictProject!!.groupCode!!, projectId, toJsonObjArray)
|
|
|
+ if (!createRel){
|
|
|
+ logger.debug("系统所在的建筑体失败:${toJsonObjArray.toJson()}")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ } else if (graphCode == "MechForArch"){
|
|
|
+ val rSyForBdList = rSyForBdService.select(SFilter.eq("projectId", projectId)).exec()
|
|
|
+ if (rSyForBdList.size>0) {
|
|
|
+ for (rSyForBd in rSyForBdList ) {
|
|
|
+ if (isDel) {
|
|
|
+ val toJsonObj = Configure.toJsonObj(graphCode, type, rSyForBd.sysId!!, null)
|
|
|
+ EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
|
|
|
+ }
|
|
|
+ val toJsonObjArray =
|
|
|
+ Configure.toJsonObjArray(graphCode, type, rSyForBd.sysId!!, rSyForBd.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 = "建筑体下的楼层(图类型 ArchSubset 边类型 Bd2Fl )")
|
|
|
+ @PostMapping("/bd2fl")
|
|
|
+ fun bd2fl(projectId: String,graphCode: String,type: String,isDel: Boolean = false): SBaseResponse {
|
|
|
+ try {
|
|
|
+ val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
|
|
|
+ val floorList = floorService.select(SFilter.eq("projectId", projectId)).exec()
|
|
|
+ if (floorList.size>0){
|
|
|
+ for (floor in floorList) {
|
|
|
+ if (isDel) {
|
|
|
+ val toJsonObj = Configure.toJsonObj(graphCode, type, floor.buildingId!!, null)
|
|
|
+ EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
|
|
|
+ }
|
|
|
+ val toJsonObjArray =
|
|
|
+ Configure.toJsonObjArray(graphCode, type, floor.buildingId!!, floor.id!!)
|
|
|
+ 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 = "楼层下的业务空间(图类型 ArchSubset 边类型 Fl2Sp )")
|
|
|
+ @PostMapping("/fl2sp")
|
|
|
+ fun fl2sp(projectId: String,graphCode: String,type: String,isDel: Boolean = false): SBaseResponse {
|
|
|
+ try {
|
|
|
+ val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
|
|
|
+ val rSpinFlList = rSpinFlService.select(SFilter.eq("projectId", projectId)).exec()
|
|
|
+ if (rSpinFlList.size>0){
|
|
|
+ for (rSpinFl in rSpinFlList) {
|
|
|
+ if (isDel) {
|
|
|
+ val toJsonObj = Configure.toJsonObj(graphCode, type, rSpinFl.floorId!!, null)
|
|
|
+ EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
|
|
|
+ }
|
|
|
+ val toJsonObjArray =
|
|
|
+ Configure.toJsonObjArray(graphCode, type, rSpinFl.floorId!!, rSpinFl.spaceId!!)
|
|
|
+ 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 = "建筑体下的业务空间(图类型 ArchSubset 边类型 Bd2Sp )")
|
|
|
+ @PostMapping("/bd2sp")
|
|
|
+ fun bd2sp(projectId: String,graphCode: String,type: String,isDel: Boolean = false): SBaseResponse {
|
|
|
+ try {
|
|
|
+ val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
|
|
|
+ val rSpinBdList = rSpinBdService.select(SFilter.eq("projectId", projectId)).exec()
|
|
|
+ if (rSpinBdList.size>0){
|
|
|
+ for (rSpinBd in rSpinBdList) {
|
|
|
+ if (isDel) {
|
|
|
+ val toJsonObj = Configure.toJsonObj(graphCode, type, rSpinBd.buildingId!!, null)
|
|
|
+ EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
|
|
|
+ }
|
|
|
+ val toJsonObjArray =
|
|
|
+ Configure.toJsonObjArray(graphCode, type, rSpinBd.buildingId!!, rSpinBd.spaceId!!)
|
|
|
+ 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 = "楼层贯通关系(图类型 ThroughRelationship 边类型 Fl2Fl )")
|
|
|
+ @PostMapping("/fl2fl")
|
|
|
+ fun fl2fl(projectId: String,graphCode: String,type: String,isDel: Boolean = false): SBaseResponse {
|
|
|
+ try {
|
|
|
+ val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
|
|
|
+ val rFlThroughFlList = rFlThroughFlService.select(SFilter.eq("projectId", projectId)).exec()
|
|
|
+ if (rFlThroughFlList.size>0){
|
|
|
+ for (rFlThroughFl in rFlThroughFlList) {
|
|
|
+ if (isDel) {
|
|
|
+ val toJsonObj = Configure.toJsonObj(graphCode, type, rFlThroughFl.floorId!!, null)
|
|
|
+ EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
|
|
|
+ }
|
|
|
+ val toJsonObjArray =
|
|
|
+ Configure.toJsonObjArray(graphCode, type, rFlThroughFl.floorId!!, rFlThroughFl.floorOtherId!!)
|
|
|
+ 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!!)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 系统所在业务空间 ,系统服务于业务空间 Sy2Sp
|
|
|
+ */
|
|
|
+ @Operation(summary= "系统和业务空间关系-同步到中台", description = "系统所在业务空间(图类型 MechInArch 边类型 Sy2Bd ),系统服务于业务空间(图类型MechForArch 边类型 Sy2Bd )")
|
|
|
+ @PostMapping("/sy2sp")
|
|
|
+ fun sy2sp(projectId: String,graphCode: String,type: String,isDel: Boolean = false): SBaseResponse{
|
|
|
+ try {
|
|
|
+ val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
|
|
|
+ if (graphCode == "MechInArch") {
|
|
|
+ val rSy2SpList = rSy2SpService.select(SFilter.eq("projectId", projectId),
|
|
|
+ SFilter.eq("graphCode", graphCode),
|
|
|
+ SFilter.eq("type", type)).exec()
|
|
|
+ if (rSy2SpList.size>0) {
|
|
|
+
|
|
|
+ for (rSy2Sp in rSy2SpList) {
|
|
|
+ if (isDel) {
|
|
|
+ val toJsonObj = Configure.toJsonObj(graphCode, type, rSy2Sp.id1!!, null)
|
|
|
+ EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
|
|
|
+ }
|
|
|
+ val toJsonObjArray =
|
|
|
+ Configure.toJsonObjArray(graphCode, type, rSy2Sp.id1!!, rSy2Sp.id2!!)
|
|
|
+ val createRel = EquipApi.createRel(dictProject!!.groupCode!!, projectId, toJsonObjArray)
|
|
|
+ if (!createRel){
|
|
|
+ logger.debug("系统所在业务空间:${toJsonObjArray.toJson()}")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ } else if (graphCode == "MechForArch"){
|
|
|
+ val rSy2SpList = rSy2SpService.select(SFilter.eq("id", projectId),
|
|
|
+ SFilter.eq("graphCode", graphCode),
|
|
|
+ SFilter.eq("type", type)).exec()
|
|
|
+ if (rSy2SpList.size>0) {
|
|
|
+ for (rSy2Sp in rSy2SpList ) {
|
|
|
+ if (isDel) {
|
|
|
+ val toJsonObj = Configure.toJsonObj(graphCode, type, rSy2Sp.id1!!, null)
|
|
|
+ EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
|
|
|
+ }
|
|
|
+ val toJsonObjArray =
|
|
|
+ Configure.toJsonObjArray(graphCode, type, rSy2Sp.id1!!, rSy2Sp.id2!!)
|
|
|
+ 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 = "")
|
|
|
+ @PostMapping("/sp2sp")
|
|
|
+ fun sp2sp(projectId: String,graphCode: String,type: String,isDel: Boolean = false): SBaseResponse {
|
|
|
+ try {
|
|
|
+ val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
|
|
|
+ val rSp2SpList = rSp2SpService.select(SFilter.eq("projectId", projectId),
|
|
|
+ SFilter.eq("graphCode", graphCode),
|
|
|
+ SFilter.eq("type", type)).exec()
|
|
|
+ if (rSp2SpList.size>0) {
|
|
|
+ for (rSp2Sp in rSp2SpList) {
|
|
|
+ if (isDel) {
|
|
|
+ val toJsonObj = Configure.toJsonObj(graphCode, type, rSp2Sp.id1!!, null)
|
|
|
+ EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
|
|
|
+ }
|
|
|
+ val toJsonObjArray =
|
|
|
+ Configure.toJsonObjArray(graphCode, type, rSp2Sp.id1!!, rSp2Sp.id2!!)
|
|
|
+ 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 = "")
|
|
|
+ @PostMapping("/eq2eq")
|
|
|
+ fun eq2eq(projectId: String,graphCode: String,type: String,isDel: Boolean = false) : SBaseResponse {
|
|
|
+ try {
|
|
|
+ val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
|
|
|
+ val rEq2EqList = rEq2EqService.select(SFilter.eq("projectId", projectId),
|
|
|
+ SFilter.eq("graphCode", graphCode),
|
|
|
+ SFilter.eq("type", type)).exec()
|
|
|
+ if (rEq2EqList.size>0) {
|
|
|
+ for (rEq2Eq in rEq2EqList) {
|
|
|
+ if (isDel) {
|
|
|
+ val toJsonObj = Configure.toJsonObj(graphCode, type, rEq2Eq.id1!!, null)
|
|
|
+ EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
|
|
|
+ }
|
|
|
+ val toJsonObjArray =
|
|
|
+ Configure.toJsonObjArray(graphCode, type, rEq2Eq.id1!!, rEq2Eq.id2!!)
|
|
|
+ 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 = "")
|
|
|
+ @PostMapping("/all/rel")
|
|
|
+ fun allRel(projectId: String,graphCode: String,type: String,isDel: Boolean = false) {
|
|
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
}
|