|
@@ -34,6 +34,7 @@ import com.persagy.server.datacenter.models.entities.graphtype.RelationTypeProje
|
|
|
import com.persagy.server.datacenter.models.entities.graphtype.block.RelationAddRequest
|
|
|
import com.persagy.server.datacenter.models.entities.graphtype.rel.*
|
|
|
import com.persagy.server.datacenter.models.entities.rel.*
|
|
|
+import com.persagy.server.datacenter.models.entities.rel.archforarch.RBd2Bd
|
|
|
import com.persagy.server.datacenter.models.response.ManualRelationCalcSCreateResponse
|
|
|
import com.persagy.server.jms.RabbitMqService
|
|
|
import com.persagy.server.services.objects.*
|
|
@@ -65,6 +66,10 @@ class ManualRelationAddService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /** 区域服务-建筑和建筑 */
|
|
|
+ private val rRBd2BdService = SObjectService(SMybatisDao(RBd2Bd::class.java))
|
|
|
+
|
|
|
+
|
|
|
|
|
|
/** 资产服务 */
|
|
|
private val relPropertyService = SObjectService(SMybatisDao(RelProperty::class.java))
|
|
@@ -1918,11 +1923,220 @@ class ManualRelationAddService {
|
|
|
sCreateResponse.message = "添加成功"
|
|
|
return sCreateResponse
|
|
|
|
|
|
- }else {
|
|
|
+ }else if (relationAddRequest.relType == "ArchForArch_Bd2Bd"||relationAddRequest.relType == "ArchForArch_Bd2Fl"||relationAddRequest.relType == "ArchForArch_Bd2Sh"
|
|
|
+ ||relationAddRequest.relType == "ArchForArch_Bd2Sp"||relationAddRequest.relType == "ArchForArch_Fl2Bd"||relationAddRequest.relType == "ArchForArch_Fl2Fl"
|
|
|
+ ||relationAddRequest.relType == "ArchForArch_Fl2Sh"||relationAddRequest.relType == "ArchForArch_Fl2Sp"||relationAddRequest.relType == "ArchForArch_Sh2Bd"||
|
|
|
+ relationAddRequest.relType == "ArchForArch_Sh2Fl"||relationAddRequest.relType == "ArchForArch_Sh2Sh"||relationAddRequest.relType == "ArchForArch_Sh2Sp"||relationAddRequest.relType == "ArchForArch_Sp2Bd"
|
|
|
+ ||relationAddRequest.relType == "ArchForArch_Sp2Fl"||relationAddRequest.relType == "ArchForArch_Sp2Sh"||relationAddRequest.relType == "ArchForArch_Sp2Sp"){
|
|
|
+// val sReplaceBuilder = SReplaceBuilder<RBd2Bd>(SMybatisDao(RBd2Bd::class.java))
|
|
|
+
|
|
|
+ if (!relationAddRequest.type.isNullOrEmpty()&&relationAddRequest.type == "cadId"){
|
|
|
+ /** 从对象不存在cadId编码 */
|
|
|
+ sCreateResponse.result = SResponseType.failure
|
|
|
+ sCreateResponse.message = "主对象不存在CADID编码"
|
|
|
+ sCreateResponse.errorType = "1"
|
|
|
+ return sCreateResponse
|
|
|
+ }
|
|
|
+ if (relationAddRequest.relType == "ArchForArch_Bd2Bd"||relationAddRequest.relType == "ArchForArch_Bd2Fl"||relationAddRequest.relType == "ArchForArch_Bd2Sh"
|
|
|
+ ||relationAddRequest.relType == "ArchForArch_Bd2Sp"){
|
|
|
+ /** 建筑服务于建筑 */
|
|
|
+ val buildingList = BuildingService.select(SFilter.eq("projectId", projectId!!), SFilter.eq(relationAddRequest.type!!, relationAddRequest.mainContent!!)).exec()
|
|
|
+ if (buildingList.size<1){
|
|
|
+ /** 主对象不存在 */
|
|
|
+ sCreateResponse.result = SResponseType.failure
|
|
|
+ sCreateResponse.message = relationAddRequest.mainContent+":不存在"
|
|
|
+ sCreateResponse.errorType = "1"
|
|
|
+ return sCreateResponse
|
|
|
+ }
|
|
|
+ if (buildingList.size>1){
|
|
|
+ /** 主对象编码识别到多个实例 */
|
|
|
+ sCreateResponse.result = SResponseType.failure
|
|
|
+ sCreateResponse.message = relationAddRequest.mainContent+":存在多个实例"
|
|
|
+ sCreateResponse.errorType = "1"
|
|
|
+ return sCreateResponse
|
|
|
+ }
|
|
|
+
|
|
|
+ val building = buildingList[0]
|
|
|
+ if (relationAddRequest.relType == "ArchForArch_Bd2Bd") {
|
|
|
+
|
|
|
+ for (fromContent in relationAddRequest.fromContent!!){
|
|
|
+ /** 去除主对象空间id */
|
|
|
+ val buildingToList = BuildingService.select(SFilter.eq("projectId", projectId), SFilter.eq(relationAddRequest.type!!, fromContent!!)).exec()
|
|
|
+ if (buildingToList.size<1){
|
|
|
+ /** 从对象不存在 */
|
|
|
+ sCreateResponse.result = SResponseType.failure
|
|
|
+ sCreateResponse.message = fromContent+":不存在"
|
|
|
+ sCreateResponse.errorType = "2"
|
|
|
+ return sCreateResponse
|
|
|
+ }
|
|
|
+ if (buildingToList.size>1){
|
|
|
+ /** 从对象编码识别到多个实例 */
|
|
|
+ sCreateResponse.result = SResponseType.failure
|
|
|
+ sCreateResponse.message = fromContent+":存在多个实例"
|
|
|
+ sCreateResponse.errorType = "2"
|
|
|
+ return sCreateResponse
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 处理关系 */
|
|
|
+ val setCode = HashSet<String>()
|
|
|
+ for (fromContent in relationAddRequest.fromContent!!){
|
|
|
+ setCode.add(fromContent)
|
|
|
+ }
|
|
|
+ /** 查询空间 */
|
|
|
+ val buildingToList = BuildingService.select(SFilter.eq("projectId", projectId), SFilter.inList(relationAddRequest.type!!, setCode.toList())).exec()
|
|
|
+ for (buildingTo in buildingToList) {
|
|
|
+ val rBd2Bd = RBd2Bd()
|
|
|
+ rBd2Bd.id1 = building.id
|
|
|
+ rBd2Bd.id2 = buildingTo.id
|
|
|
+ rBd2Bd.projectId = projectId
|
|
|
+ rBd2Bd.type = relationAddRequest.relType
|
|
|
+ rBd2Bd.sign = 1
|
|
|
+ rRBd2BdService.replace(rBd2Bd)
|
|
|
+ }
|
|
|
+ }else if (relationAddRequest.relType == "ArchForArch_Bd2Fl") {
|
|
|
+ for (fromContent in relationAddRequest.fromContent!!){
|
|
|
+ /** 去除主对象空间id */
|
|
|
+ val floorToList = FloorService.select(SFilter.eq("projectId", projectId), SFilter.eq(relationAddRequest.type!!, fromContent!!)).exec()
|
|
|
+ if (floorToList.size<1){
|
|
|
+ /** 从对象不存在 */
|
|
|
+ sCreateResponse.result = SResponseType.failure
|
|
|
+ sCreateResponse.message = fromContent+":不存在"
|
|
|
+ sCreateResponse.errorType = "2"
|
|
|
+ return sCreateResponse
|
|
|
+ }
|
|
|
+ if (floorToList.size>1){
|
|
|
+ /** 从对象编码识别到多个实例 */
|
|
|
+ sCreateResponse.result = SResponseType.failure
|
|
|
+ sCreateResponse.message = fromContent+":存在多个实例"
|
|
|
+ sCreateResponse.errorType = "2"
|
|
|
+ return sCreateResponse
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 处理关系 */
|
|
|
+ val setCode = HashSet<String>()
|
|
|
+ for (fromContent in relationAddRequest.fromContent!!){
|
|
|
+ setCode.add(fromContent)
|
|
|
+ }
|
|
|
+ /** 查询空间 */
|
|
|
+ val floorToList = FloorService.select(SFilter.eq("projectId", projectId), SFilter.inList(relationAddRequest.type!!, setCode.toList())).exec()
|
|
|
+ for (floorTo in floorToList) {
|
|
|
+ val rBd2Bd = RBd2Bd()
|
|
|
+ rBd2Bd.id1 = building.id
|
|
|
+ rBd2Bd.id2 = floorTo.id
|
|
|
+ rBd2Bd.projectId = projectId
|
|
|
+ rBd2Bd.type = relationAddRequest.relType
|
|
|
+ rBd2Bd.sign = 1
|
|
|
+// sReplaceBuilder.tableName = "relationship.r_bd2bd"
|
|
|
+//// rRBd2BdService.replace(rBd2Bd,sReplaceBuilder)
|
|
|
+ }
|
|
|
+
|
|
|
+ }else if (relationAddRequest.relType =="ArchForArch_Bd2Sh") {
|
|
|
+ for (fromContent in relationAddRequest.fromContent!!){
|
|
|
+ /** 去除主对象空间id */
|
|
|
+ val shaftToList = ShaftService.select(SFilter.eq("projectId", projectId), SFilter.eq(relationAddRequest.type!!, fromContent!!)).exec()
|
|
|
+ if (shaftToList.size<1){
|
|
|
+ /** 从对象不存在 */
|
|
|
+ sCreateResponse.result = SResponseType.failure
|
|
|
+ sCreateResponse.message = fromContent+":不存在"
|
|
|
+ sCreateResponse.errorType = "2"
|
|
|
+ return sCreateResponse
|
|
|
+ }
|
|
|
+ if (shaftToList.size>1){
|
|
|
+ /** 从对象编码识别到多个实例 */
|
|
|
+ sCreateResponse.result = SResponseType.failure
|
|
|
+ sCreateResponse.message = fromContent+":存在多个实例"
|
|
|
+ sCreateResponse.errorType = "2"
|
|
|
+ return sCreateResponse
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 处理关系 */
|
|
|
+ val setCode = HashSet<String>()
|
|
|
+ for (fromContent in relationAddRequest.fromContent!!){
|
|
|
+ setCode.add(fromContent)
|
|
|
+ }
|
|
|
+ /** 查询空间 */
|
|
|
+ val shaftToList = ShaftService.select(SFilter.eq("projectId", projectId), SFilter.inList(relationAddRequest.type!!, setCode.toList())).exec()
|
|
|
+ for (shaftTo in shaftToList) {
|
|
|
+ val rBd2Bd = RBd2Bd()
|
|
|
+ rBd2Bd.id1 = building.id
|
|
|
+ rBd2Bd.id2 = shaftTo.id
|
|
|
+ rBd2Bd.projectId = projectId
|
|
|
+ rBd2Bd.type = relationAddRequest.relType
|
|
|
+ rBd2Bd.sign = 1
|
|
|
+// sReplaceBuilder.tableName = "relationship.r_bd2sh"
|
|
|
+// rRBd2BdService.replace(rBd2Bd,sReplaceBuilder)
|
|
|
+ }
|
|
|
+ }else if (relationAddRequest.relType =="ArchForArch_Bd2Sh") {
|
|
|
+
|
|
|
+ }else if (relationAddRequest.relType =="ArchForArch_Bd2Sp") {
|
|
|
+
|
|
|
+ }
|
|
|
+ }else if (relationAddRequest.relType == "ArchForArch_Fl2Bd"||relationAddRequest.relType == "ArchForArch_Fl2Fl"
|
|
|
+ ||relationAddRequest.relType == "ArchForArch_Fl2Sh"||relationAddRequest.relType == "ArchForArch_Fl2Sp") {
|
|
|
+ /** 楼层服务 */
|
|
|
+ val floorList = FloorService.select(SFilter.eq("projectId", projectId!!), SFilter.eq(relationAddRequest.type!!, relationAddRequest.mainContent!!)).exec()
|
|
|
+ if (floorList.size<1){
|
|
|
+ /** 主对象不存在 */
|
|
|
+ sCreateResponse.result = SResponseType.failure
|
|
|
+ sCreateResponse.message = relationAddRequest.mainContent+":不存在"
|
|
|
+ sCreateResponse.errorType = "1"
|
|
|
+ return sCreateResponse
|
|
|
+ }
|
|
|
+ if (floorList.size>1){
|
|
|
+ /** 主对象编码识别到多个实例 */
|
|
|
+ sCreateResponse.result = SResponseType.failure
|
|
|
+ sCreateResponse.message = relationAddRequest.mainContent+":存在多个实例"
|
|
|
+ sCreateResponse.errorType = "1"
|
|
|
+ return sCreateResponse
|
|
|
+ }
|
|
|
+
|
|
|
+ if (relationAddRequest.relType == "ArchForArch_Fl2Bd") {
|
|
|
+
|
|
|
+ } else if (relationAddRequest.relType == "ArchForArch_Fl2Fl") {
|
|
|
+
|
|
|
+ } else if (relationAddRequest.relType == "ArchForArch_Fl2Sh") {
|
|
|
+
|
|
|
+ }else if (relationAddRequest.relType == "ArchForArch_Fl2Sp") {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }else if (relationAddRequest.relType == "ArchForArch_Sh2Bd"|| relationAddRequest.relType == "ArchForArch_Sh2Fl"||
|
|
|
+ relationAddRequest.relType == "ArchForArch_Sh2Sh"||relationAddRequest.relType == "ArchForArch_Sh2Sp") {
|
|
|
+ /** 楼层服务 */
|
|
|
+ val shaftList = ShaftService.select(SFilter.eq("projectId", projectId!!), SFilter.eq(relationAddRequest.type!!, relationAddRequest.mainContent!!)).exec()
|
|
|
+ if (shaftList.size<1){
|
|
|
+ /** 主对象不存在 */
|
|
|
+ sCreateResponse.result = SResponseType.failure
|
|
|
+ sCreateResponse.message = relationAddRequest.mainContent+":不存在"
|
|
|
+ sCreateResponse.errorType = "1"
|
|
|
+ return sCreateResponse
|
|
|
+ }
|
|
|
+ if (shaftList.size>1){
|
|
|
+ /** 主对象编码识别到多个实例 */
|
|
|
+ sCreateResponse.result = SResponseType.failure
|
|
|
+ sCreateResponse.message = relationAddRequest.mainContent+":存在多个实例"
|
|
|
+ sCreateResponse.errorType = "1"
|
|
|
+ return sCreateResponse
|
|
|
+ }
|
|
|
+ if (relationAddRequest.relType == "ArchForArch_Sh2Bd"){
|
|
|
+
|
|
|
+ }else if (relationAddRequest.relType == "ArchForArch_Sh2Fl"){
|
|
|
+
|
|
|
+ }else if (relationAddRequest.relType == "ArchForArch_Sh2Sh"){
|
|
|
+
|
|
|
+ }else if (relationAddRequest.relType == "ArchForArch_Sh2Sp"){
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
sCreateResponse.result = SResponseType.success
|
|
|
sCreateResponse.message = "添加成功"
|
|
|
- return sCreateResponse
|
|
|
- }
|
|
|
+
|
|
|
+ return sCreateResponse
|
|
|
} // Fun
|
|
|
|
|
|
|