package com.persagy.server.services.relation_calc

import com.persagy.server.datacenter.models.entities.dict.DClassDef
import com.persagy.server.datacenter.models.entities.graphtype.RelationTypeProject
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.graphtype.rel.control.*
import com.persagy.server.datacenter.models.entities.graphtype.rel.drainage.*
import com.persagy.server.datacenter.models.entities.graphtype.rel.electricity.*
import com.persagy.server.datacenter.models.entities.graphtype.rel.hvac.*
import com.persagy.server.datacenter.models.entities.rel.*
import com.persagy.server.datacenter.models.requests.ManualRelationCalcDel
import com.persagy.server.datacenter.models.requests.ManualRelationCalcRequest
import com.persagy.server.datacenter.models.response.ManualRelationCalcResponse
import com.persagy.server.datacenter.models.response.ManualRelationCalcSCreateResponse
import com.persagy.server.services.objects.*
import com.persagy.server.services.rel.*
import com.persagy.base.extensions.toJson
import com.persagy.database.SFilter
import com.persagy.mybatis.SMybatisDao
import com.persagy.service.SObjectService
import com.persagy.service.SPageContext
import com.persagy.service.models.SCascadeQuery
import com.persagy.service.models.enums.SResponseType
import com.persagy.service.models.requests.SQueryRequest
import com.persagy.service.models.responses.SBaseResponse
import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
import java.text.SimpleDateFormat
import java.util.*

/**
 * 手动计算
 *
 * @author 张维新
 */
@Service
open class ManualRelationCalcService {
    companion object {
        /** 日志 */
        private val logger = LoggerFactory.getLogger(ManualRelationCalcService::class.java)
    } // Companion object

    /** 资产服务 */
    private val relPropertyService = SObjectService(SMybatisDao(RelProperty::class.java))
    /** 资产所在的空间 *******************************************************/
    private val rPeInSpBaseService = SObjectService(SMybatisDao(RPe2Sp::class.java))
    /** 设备服务于竖井 */
    private val rEq2ShService = SObjectService(SMybatisDao(REq2Sh::class.java))
    /** 设备服务于楼层 */
    private val rEq2FlService = SObjectService(SMybatisDao(REq2Fl::class.java))
    /** 设备服务于建筑 */
    private val rEq2BdService = SObjectService(SMybatisDao(REq2Bd::class.java))
    /** 系统和空间关系 */
    private val rSy2SpService = SObjectService(SMybatisDao(RSy2Sp::class.java))
    /** 系统和竖井关系 */
    private val rSy2ShService = SObjectService(SMybatisDao(RSy2Sh::class.java))
    /** 系统和楼层关系 */
    private val rSy2FlService = SObjectService(SMybatisDao(RSy2Fl::class.java))
    /** 系统和建筑关系 */
    private val rSy2BdService = SObjectService(SMybatisDao(RSy2Bd::class.java))
    /** 空间和空间的关系 */
    private val rSp2SpService = SObjectService(SMybatisDao(RSp2Sp::class.java))
    /** 设备和设备关系 */
    private val rEq2EqService = SObjectService(SMybatisDao(REq2Eq::class.java))
    /** 设备和系统关系 */
    private val rEq2SyService = SObjectService(SMybatisDao(REq2Sy::class.java))
    /** 设备和空间关系 */
    private val rEq2SpService = SObjectService(SMybatisDao(REq2Sp::class.java))

    /** 空间 */
    private val relZoneSpaceService = SObjectService(SMybatisDao(RelZoneSpace::class.java))
    /** 类型查询 */
    private val dClassDefService = SObjectService(SMybatisDao(DClassDef::class.java))
    /** 资产所在的竖井 */
    private val rPeInShService = SObjectService(SMybatisDao(RPeInSh::class.java))
    /** 资产和竖井的资产实例 */
    private val relPropertyShaftService = SObjectService(SMybatisDao(RelPropertyShaft::class.java))
    /** 竖井 */
    private val relShaftService = SObjectService(SMybatisDao(RelShaft::class.java))
    /** 设备和竖井的设备 */
    private val relEquipmentShaftService = SObjectService(SMybatisDao(RelEquipmentShaft::class.java))
    /** 设备和楼层的设备 */
    private val  relEquipmentFloorService = SObjectService(SMybatisDao(RelEquipmentFloor::class.java))
    /** 设备服务于建筑 设备 */
    private val relEquipmentBuildingService = SObjectService(SMybatisDao(RelEquipmentBuilding::class.java))
    /** 系统服务于业务空间 */
    private val relGeneralSystemService = SObjectService(SMybatisDao(RelGeneralSystem::class.java))
    /** 系统服务于竖井 */
    private val relGeneralSystemShaftService = SObjectService(SMybatisDao(RelGeneralSystemShaft::class.java))
    /** 系统服务于楼层 */
    private val relGeneralSystemFloorService = SObjectService(SMybatisDao(RelGeneralSystemFloor::class.java))
    /** 系统服务于建筑 */
    private val relGeneralSystemBuildingService = SObjectService(SMybatisDao(RelGeneralSystemBuilding::class.java))


    /**
     * 删除从对象 资产所在的业务空间
     */
    fun delPe2Space(manualRelationCalcDel: ManualRelationCalcDel):SBaseResponse{
        try {
            val projectId = SPageContext.getHeader("ProjectId")
            if (!manualRelationCalcDel.fromId.isNullOrEmpty()&&!manualRelationCalcDel.toId.isNullOrEmpty()){

                val delete = rPeInSpBaseService.delete(SFilter.eq("projectId", projectId!!),
                        SFilter.eq("equipId", manualRelationCalcDel.fromId!!), SFilter.eq("spaceId", manualRelationCalcDel.toId!!))
                if (delete){
                    return SBaseResponse(SResponseType.success)
                }else{
                    return  SBaseResponse(SResponseType.failure)
                }
            }else if(!manualRelationCalcDel.fromId.isNullOrEmpty()&&manualRelationCalcDel.toId.isNullOrEmpty()){
                val delete = rPeInSpBaseService.delete(SFilter.eq("projectId", projectId!!),
                        SFilter.eq("equipId", manualRelationCalcDel.fromId!!))
                if (delete){
                    return SBaseResponse(SResponseType.success)
                }else{
                    return  SBaseResponse(SResponseType.failure)
                }

            }else{
                /** 主对象和从对象都不可以为空 */
                return  SBaseResponse(SResponseType.failure)
            }
        } catch (e: Exception) {
            e.printStackTrace()
            return  SBaseResponse(SResponseType.failure,e.message.toString())
        }

    } // Fun

    /**
     * 删除从对象 资产所在的竖井
     */
    fun delPe2Shs(manualRelationCalcDel: ManualRelationCalcDel):SBaseResponse{
        try {
            val projectId = SPageContext.getHeader("ProjectId")
            if (!manualRelationCalcDel.fromId.isNullOrEmpty()&&!manualRelationCalcDel.toId.isNullOrEmpty()){

                val delete = rPeInShService.delete(SFilter.eq("projectId", projectId!!),
                        SFilter.eq("equipId", manualRelationCalcDel.fromId!!), SFilter.eq("shaftId", manualRelationCalcDel.toId!!))
                if (delete){
                    return SBaseResponse(SResponseType.success)
                }else{
                    return  SBaseResponse(SResponseType.failure)
                }
            }else if(!manualRelationCalcDel.fromId.isNullOrEmpty()&&manualRelationCalcDel.toId.isNullOrEmpty()){
                val delete = rPeInShService.delete(SFilter.eq("projectId", projectId!!),
                        SFilter.eq("equipId", manualRelationCalcDel.fromId!!))
                if (delete){
                    return SBaseResponse(SResponseType.success)
                }else{
                    return  SBaseResponse(SResponseType.failure)
                }

            }else{
                /** 主对象和从对象都不可以为空 */
                return  SBaseResponse(SResponseType.failure)
            }
        } catch (e: Exception) {
            e.printStackTrace()
            return  SBaseResponse(SResponseType.failure,e.message.toString())
        }
    } // Fun


    /**
     * 查询关系数据
     */
    fun query(manualRelationCalcRequest: ManualRelationCalcRequest): ManualRelationCalcResponse {

        try {
            /** 项目id */
            val projectId = SPageContext.getHeader("ProjectId")
            val list = ArrayList<SFilter>()
            list.add(SFilter.eq("projectId",projectId!!))
            /** 模糊查询 */
            if(!manualRelationCalcRequest.vague.isNullOrEmpty()){
                list.add( SFilter.or(SFilter.contain("id",manualRelationCalcRequest.vague!!),SFilter.contain("name",manualRelationCalcRequest.vague!!)
                        ,SFilter.contain("localName",manualRelationCalcRequest.vague!!),SFilter.contain("localId",manualRelationCalcRequest.vague!!)))
            }

            val sQueryRequest = SQueryRequest()

            if(manualRelationCalcRequest.pageNumber>0&&manualRelationCalcRequest.pageSize>0){
                SQueryRequest.maxRow = 400000
                sQueryRequest.pageSize= manualRelationCalcRequest.pageSize
                sQueryRequest.pageNumber = manualRelationCalcRequest.pageNumber
            }else{
                /** 控制条数 */
                SQueryRequest.maxRow = 100000
                sQueryRequest.pageSize= 100000
            }
            val sCascadeQueryList = ArrayList<SCascadeQuery>()
            /** 级联资产 */
            val sCascadeQuery = SCascadeQuery()
            sCascadeQuery.name = "objectInfo"
            sCascadeQueryList.add(sCascadeQuery)
            sQueryRequest.cascade = sCascadeQueryList

            if (manualRelationCalcRequest.relType == "pe2sp"){
                    /** 资产所在业务空间 */
                return queryPe2Sp(projectId,list,sQueryRequest,manualRelationCalcRequest)
            }else if (manualRelationCalcRequest.relType == "pe2sh"){
                    /** 资产所在竖井 */
                return queryPe2Sh(projectId,list,sQueryRequest,manualRelationCalcRequest)
            }else if (manualRelationCalcRequest.relType == "eq2sh_for"){
                    /** 设备服务于竖井 */
                return queryEqForSh(projectId,list,sQueryRequest,manualRelationCalcRequest)
            }else if (manualRelationCalcRequest.relType == "eq2fl_for"){
                    /** 设备服务于楼层 */
                return queryEqForFl(projectId,list,sQueryRequest,manualRelationCalcRequest)
            }else if (manualRelationCalcRequest.relType == "eq2bd_for"){
                    /** 设备服务于建筑 */
                return queryEqForBd(projectId,list,sQueryRequest,manualRelationCalcRequest)
            }else if (manualRelationCalcRequest.relType == "sy2sp_for"){
                /** 系统服务于业务空间 */
                return querySyForSp(projectId,list,sQueryRequest,manualRelationCalcRequest)
            }else if(manualRelationCalcRequest.relType == "sy2sh_for"){
                /** 系统服务于竖井 */
                return querySyForSh(projectId,list,sQueryRequest,manualRelationCalcRequest)
            }else if (manualRelationCalcRequest.relType == "sy2fl_for"){
                /** 系统服务于楼层 */
                return querySyForFl(projectId,list,sQueryRequest,manualRelationCalcRequest)
            }else if (manualRelationCalcRequest.relType == "sy2bd_for"){
                /** 系统服务于建筑 */
                return querySyForBd(projectId,list,sQueryRequest,manualRelationCalcRequest)
            }else if (manualRelationCalcRequest.relType == "sp2sp_ConvectionNetwork_1"||manualRelationCalcRequest.relType == "sp2sp_ConvectionNetwork_2"||manualRelationCalcRequest.relType == "sp2sp_ConvectionNetwork_3"
                    ||manualRelationCalcRequest.relType == "sp2sp_SpaceNeighborhood_5"||manualRelationCalcRequest.relType == "sp2sp_SpaceNeighborhood_2"||manualRelationCalcRequest.relType == "sp2sp_SpaceNeighborhood_4"
                    ||manualRelationCalcRequest.relType == "sp2sp_TrafficNetwork_3"||manualRelationCalcRequest.relType == "sp2sp_TrafficNetwork_2"||manualRelationCalcRequest.relType == "sp2sp_RadiationNetwork_1"
                    ||manualRelationCalcRequest.relType == "sp2sp_RadiationNetwork_2"||manualRelationCalcRequest.relType == "sp2sp_SpaceNeighborhood_1"||manualRelationCalcRequest.relType == "sp2sp_TrafficNetwork_1"
                    ||manualRelationCalcRequest.relType == "sp2sp_SpaceNeighborhood_3" ){
                /** 空间 空气自然对流 */
                return querySpAirConvection(projectId,list,sQueryRequest,manualRelationCalcRequest)
            }else if (manualRelationCalcRequest.relType == "eq2eq_LUDistribution_1"||manualRelationCalcRequest.relType == "eq2eq_LUDistribution_2"||manualRelationCalcRequest.relType == "eq2eq_HUDistribution_1"
                    ||manualRelationCalcRequest.relType == "eq2eq_HUDistribution_2"||manualRelationCalcRequest.relType == "eq2eq_EquipPower_1"||manualRelationCalcRequest.relType == "eq2eq_EquipPower_2"
                    ||manualRelationCalcRequest.relType == "eq2eq_EquipPower_3"||manualRelationCalcRequest.relType == "eq2eq_EquipPower_4"){
                /** 系统备用电源 */ /** 强电类 */
                    return queryElectricity(projectId,list,sQueryRequest,manualRelationCalcRequest)
            } else if (manualRelationCalcRequest.relType == "eq2eq_ACAirNetwork_1"||manualRelationCalcRequest.relType == "eq2eq_ACAirNetwork_3"||manualRelationCalcRequest.relType == "eq2eq_ACAirNetwork_2"
                    ||manualRelationCalcRequest.relType == "eq2eq_ChillWaterLoop_4"|| manualRelationCalcRequest.relType == "eq2eq_ChillWaterLoop_1"||manualRelationCalcRequest.relType == "eq2eq_ChillWaterLoop_3"
                    || manualRelationCalcRequest.relType == "eq2eq_ChillWaterLoop_2"||manualRelationCalcRequest.relType == "eq2eq_CondWaterNetwork_1"||manualRelationCalcRequest.relType == "eq2eq_CoolingWaterLoop_4"
                    ||manualRelationCalcRequest.relType == "eq2eq_CoolingWaterLoop_1"||manualRelationCalcRequest.relType == "eq2eq_CoolingWaterLoop_3"||manualRelationCalcRequest.relType == "eq2eq_CoolingWaterLoop_2"
                    ||manualRelationCalcRequest.relType == "eq2eqFreshAirNetwork_1"||manualRelationCalcRequest.relType == "eq2eq_HeatWaterLoop_4"||manualRelationCalcRequest.relType == "eq2eq_HeatWaterLoop_1"
                    ||manualRelationCalcRequest.relType == "eq2eq_HeatWaterLoop_3"||manualRelationCalcRequest.relType == "eq2eq_HeatWaterLoop_2"||manualRelationCalcRequest.relType == "eq2eq_VentNetwork_1"
                    ||manualRelationCalcRequest.relType == "eq2eq_VentNetwork_3"||manualRelationCalcRequest.relType == "eq2eq_VentNetwork_2"||manualRelationCalcRequest.relType == "eq2eq_VRFNetwork_1"){
                            /** 暖通空调类 */
                return hvac(projectId,list,sQueryRequest,manualRelationCalcRequest)
            }else if (manualRelationCalcRequest.relType == "eq2eq_SupplyWaterNetwork_1"||manualRelationCalcRequest.relType == "eq2eq_SupplyWaterNetwork_2"||manualRelationCalcRequest.relType == "eq2eq_DrainingWaterNetwork_1"||manualRelationCalcRequest.relType == "eq2eq_DrainingWaterNetwork_2"
               ||manualRelationCalcRequest.relType == "eq2eq_DrinkingWaterNetwork_1"||manualRelationCalcRequest.relType == "eq2eq_DrinkingWaterNetwork_2"||manualRelationCalcRequest.relType == "eq2eq_DHWNetwork_1"||manualRelationCalcRequest.relType == "eq2eq_DHWNetwork_2"
                    ||manualRelationCalcRequest.relType == "eq2eq_GasNetwork_1"||manualRelationCalcRequest.relType == "eq2eq_GasNetwork_2"||manualRelationCalcRequest.relType == "eq2eq_FireWaterNetwork_1"||manualRelationCalcRequest.relType == "eq2eq_FireWaterNetwork_2"
                    ||manualRelationCalcRequest.relType == "eq2eq_FireVentNetwork_1"||manualRelationCalcRequest.relType == "eq2eq_RecycleWaterNetwork_1" ||manualRelationCalcRequest.relType == "eq2eq_RecycleWaterNetwork_2"){
                    /** 给排水类 和 消防类 */
                return drainage(projectId,list,sQueryRequest,manualRelationCalcRequest)
            }else if (manualRelationCalcRequest.relType == "eq2eq_SensorNetwork_1"||manualRelationCalcRequest.relType == "eq2eq_ControlRelation_1"
                    ||manualRelationCalcRequest.relType == "eq2eq_SensorRelationship_ss2eq"||manualRelationCalcRequest.relType == "eq2eq_ValveRelationship_vv2eq"||manualRelationCalcRequest.relType =="eq2eq_ControlEquipNetwork"){
                /** 测控类 */
                return control(projectId,list,sQueryRequest,manualRelationCalcRequest)
            }else if (manualRelationCalcRequest.relType == "eq2eq_ControlRelation_2"||manualRelationCalcRequest.relType == "eq2sy_SensorRelationship_ss2sy"
               ||manualRelationCalcRequest.relType == "eq2sy_ValveRelationship_vv2sy"){
                /** 测控类 */
                return controlSy(projectId,list,sQueryRequest,manualRelationCalcRequest)
            }else if(manualRelationCalcRequest.relType == "eq2sp_SensorRelationship_ss2sp"){
                return ss2sps(projectId,list,sQueryRequest,manualRelationCalcRequest)
            }else if (manualRelationCalcRequest.relType == "eq2sp_x"){
                return  eq2spsOther(projectId,list,sQueryRequest,manualRelationCalcRequest)
            }else{
                /** 暂无数据 */
                val manualRelationCalcResponse = ManualRelationCalcResponse()
                manualRelationCalcResponse.result = SResponseType.success
                manualRelationCalcResponse.content = ArrayList<RelProperty>()
                return manualRelationCalcResponse
            }
            /** 暂无数据 */
            val manualRelationCalcResponse = ManualRelationCalcResponse()
            manualRelationCalcResponse.result = SResponseType.success
            manualRelationCalcResponse.content = ArrayList<RelProperty>()
            return manualRelationCalcResponse
        } catch (e: Exception) {
            e.printStackTrace()
            val manualRelationCalcResponse = ManualRelationCalcResponse()
            manualRelationCalcResponse.result = SResponseType.failure
            manualRelationCalcResponse.content = ArrayList<RelProperty>()
            manualRelationCalcResponse.message = e.message.toString()
            return manualRelationCalcResponse
        }
    }

    /**
     * 添加关系
     */
    fun addRel(relationAddRequest: RelationAddRequest): ManualRelationCalcSCreateResponse {
        /** 项目id */
        val projectId = SPageContext.getHeader("ProjectId")

        val sCreateResponse = ManualRelationCalcSCreateResponse()

        if (relationAddRequest.relType.isNullOrEmpty()){
            /** 关系类型不能为空 */
            sCreateResponse.result = SResponseType.failure
            sCreateResponse.message = "关系类型不能为空"
            return sCreateResponse
        }
        if (relationAddRequest.type.isNullOrEmpty()){
            /** 编码类型不能为空 */
            sCreateResponse.result = SResponseType.failure
            sCreateResponse.message = "识别编码不能为空"
            return sCreateResponse
        }
        if (relationAddRequest.mainContent.isNullOrEmpty()){
            /** 主对象内容不能为空 */
            sCreateResponse.result = SResponseType.failure
            sCreateResponse.message = "主对象编码不能为空"
            sCreateResponse.errorType = "1"
            return sCreateResponse
        }
        if (relationAddRequest.fromContent.isNullOrEmpty()){
            /** 从对象内容不能为空 */
            sCreateResponse.result = SResponseType.failure
            sCreateResponse.message = "从对象编码不能为空"
            sCreateResponse.errorType = "2"
            return sCreateResponse
        }
        if (!relationAddRequest.fromContent.isNullOrEmpty()&&relationAddRequest.fromContent!!.size<1){
            /** 从对象内容不能为空 */
            sCreateResponse.result = SResponseType.failure
            sCreateResponse.message = "从对象编码不能为空"
            sCreateResponse.errorType = "2"
            return sCreateResponse
        }

        try {
            val relationTypeProjectService = SObjectService(SMybatisDao(RelationTypeProject::class.java))
            val relationType = relationTypeProjectService.select(SFilter.eq("projectId", projectId!!),SFilter.eq("RelationType", relationAddRequest.relType!!)).entity()
            if (relationType!=null){
                relationType.computingTime = time()
                relationTypeProjectService.update(relationType)
            }
        } catch (e: Exception) {
            e.printStackTrace()
        }

        if (relationAddRequest.relType == "pe2sp"){
            if (!relationAddRequest.type.isNullOrEmpty()&&relationAddRequest.type == "cadId"){
                /** 从对象不存在cadId编码 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = "从对象不存在CADID编码"
                sCreateResponse.errorType = "2"
                return sCreateResponse
            }

            /** 查询资产 */
            val relPropertyList = relPropertyService.select(SFilter.eq("projectId", projectId!!), SFilter.eq(relationAddRequest.type!!, relationAddRequest.mainContent!!)).exec()

            if (relPropertyList.size<1){
                /** 主对象编码不存在 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = relationAddRequest.mainContent+":编码不存在"
                sCreateResponse.errorType = "1"
                return sCreateResponse
            }
            if (relPropertyList.size>1){
                /** 主对象编码识别到多个实例 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = relationAddRequest.mainContent+":编码存在多个实例"
                sCreateResponse.errorType = "1"
                return sCreateResponse
            }

            for (fromContent in relationAddRequest.fromContent!!){
                val relZoneSpaceList = relZoneSpaceService.select(SFilter.eq("projectId", projectId), SFilter.eq(relationAddRequest.type!!, fromContent!!)).exec()
                if (relZoneSpaceList.size<1){
                    /** 从对象编码不存在 */
                    sCreateResponse.result = SResponseType.failure
                    sCreateResponse.message = fromContent+":编码不存在"
                    sCreateResponse.errorType = "2"
                    return sCreateResponse
                }
                if (relZoneSpaceList.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 relZoneSpaceList = relZoneSpaceService.select(SFilter.eq("projectId", projectId), SFilter.inList(relationAddRequest.type!!, setCode.toList())).exec()
            /** 资产 */
            val relProperty = relPropertyList[0]

            for (relZoneSpace in relZoneSpaceList){
                val rPe2Sp = RPe2Sp()
                rPe2Sp.id2 = relZoneSpace.id
                rPe2Sp.type = "pe2sp"
                rPe2Sp.projectId = projectId
                rPe2Sp.zoneType = relZoneSpace.objectType
                rPe2Sp.id1 = relProperty.id
                rPe2Sp.sign = 1
                rPeInSpBaseService.replace(rPe2Sp)
            }
            sCreateResponse.result = SResponseType.success
            sCreateResponse.message = "添加成功"
            return sCreateResponse

        }else if(relationAddRequest.relType == "pe2sh") {
            if (!relationAddRequest.type.isNullOrEmpty()&&relationAddRequest.type == "cadId"){
                /** 从对象不存在cadId编码 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = "从对象不存在CADID编码"
                sCreateResponse.errorType = "2"
                return sCreateResponse
            }

            /** 查询资产 */
            val relPropertyList = relPropertyService.select(SFilter.eq("projectId", projectId!!), SFilter.eq(relationAddRequest.type!!, relationAddRequest.mainContent!!)).exec()

            if (relPropertyList.size<1){
                /** 主对象编码不存在 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = relationAddRequest.mainContent+":编码不存在"
                sCreateResponse.errorType = "1"
                return sCreateResponse
            }
            if (relPropertyList.size>1){
                /** 主对象编码识别到多个实例 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = relationAddRequest.mainContent+":编码存在多个实例"
                sCreateResponse.errorType = "1"
                return sCreateResponse
            }

            for (fromContent in relationAddRequest.fromContent!!){
                val relZoneSpaceList = relShaftService.select(SFilter.eq("projectId", projectId), SFilter.eq(relationAddRequest.type!!, fromContent!!)).exec()
                if (relZoneSpaceList.size<1){
                    /** 从对象编码不存在 */
                    sCreateResponse.result = SResponseType.failure
                    sCreateResponse.message = fromContent+":编码不存在"
                    sCreateResponse.errorType = "2"
                    return sCreateResponse
                }
                if (relZoneSpaceList.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 relZoneSpaceList = relShaftService.select(SFilter.eq("projectId", projectId), SFilter.inList(relationAddRequest.type!!, setCode.toList())).exec()
            /** 资产 */
            val relProperty = relPropertyList[0]

            for (relZoneSpace in relZoneSpaceList){
                val rPe2Sh = RPeInSh()
                rPe2Sh.shaftId = relZoneSpace.id
                rPe2Sh.projectId = projectId
                rPe2Sh.equipId = relProperty.id
//                rPe2Sh.type = "pe2sh"
                rPe2Sh.sign = 1
                rPeInShService.replace(rPe2Sh)
            }
            sCreateResponse.result = SResponseType.success
            sCreateResponse.message = "添加成功"
            return sCreateResponse
        }else if (relationAddRequest.relType == "eq2sh_for"){
                /** 设备服务于竖井 */
            if (!relationAddRequest.type.isNullOrEmpty()&&relationAddRequest.type == "cadId"){
                /** 从对象不存在cadId编码 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = "从对象不存在CADID编码"
                sCreateResponse.errorType = "2"
                return sCreateResponse
            }

            /** 查询资产 */
            val relPropertyList = relEquipmentShaftService.select(SFilter.eq("projectId", projectId!!), SFilter.eq(relationAddRequest.type!!, relationAddRequest.mainContent!!)).exec()

            if (relPropertyList.size<1){
                /** 主对象编码不存在 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = relationAddRequest.mainContent+":编码不存在"
                sCreateResponse.errorType = "1"
                return sCreateResponse
            }
            if (relPropertyList.size>1){
                /** 主对象编码识别到多个实例 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = relationAddRequest.mainContent+":编码存在多个实例"
                sCreateResponse.errorType = "1"
                return sCreateResponse
            }

            for (fromContent in relationAddRequest.fromContent!!){
                val relZoneSpaceList = relShaftService.select(SFilter.eq("projectId", projectId), SFilter.eq(relationAddRequest.type!!, fromContent!!)).exec()
                if (relZoneSpaceList.size<1){
                    /** 从对象编码不存在 */
                    sCreateResponse.result = SResponseType.failure
                    sCreateResponse.message = fromContent+":编码不存在"
                    sCreateResponse.errorType = "2"
                    return sCreateResponse
                }
                if (relZoneSpaceList.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 relZoneSpaceList = relShaftService.select(SFilter.eq("projectId", projectId), SFilter.inList(relationAddRequest.type!!, setCode.toList())).exec()
            /** 资产 */
            val relProperty = relPropertyList[0]

            for (relZoneSpace in relZoneSpaceList){
                val rEq2Sh = REqInSh()
                rEq2Sh.shaftId = relZoneSpace.id
                rEq2Sh.projectId = projectId
                rEq2Sh.equipId = relProperty.id
                rEq2Sh.sign = 1
                REqInShService.replace(rEq2Sh)
            }
            sCreateResponse.result = SResponseType.success
            sCreateResponse.message = "添加成功"
            return sCreateResponse

        }else if(relationAddRequest.relType == "eq2fl_for"){
            /** 设备服务于楼层 */
            if (!relationAddRequest.type.isNullOrEmpty()&&relationAddRequest.type == "cadId"){
                /** 从对象不存在cadId编码 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = "从对象不存在CADID编码"
                return sCreateResponse
            }

                /** 查询设备 */
                val relPropertyList = relEquipmentShaftService.select(SFilter.eq("projectId", projectId!!), SFilter.eq(relationAddRequest.type!!, relationAddRequest.mainContent!!)).exec()

                if (relPropertyList.size<1){
                    /** 主对象编码不存在 */
                    sCreateResponse.result = SResponseType.failure
                    sCreateResponse.message = relationAddRequest.mainContent+":编码不存在"
                    sCreateResponse.errorType = "1"
                    return sCreateResponse
                }
                if (relPropertyList.size>1){
                    /** 主对象编码识别到多个实例 */
                    sCreateResponse.result = SResponseType.failure
                    sCreateResponse.message = relationAddRequest.mainContent+":编码存在多个实例"
                    sCreateResponse.errorType = "1"
                    return sCreateResponse
                }

                for (fromContent in relationAddRequest.fromContent!!){
                    val relZoneSpaceList = FloorService.select(SFilter.eq("projectId", projectId), SFilter.eq(relationAddRequest.type!!, fromContent!!)).exec()
                    if (relZoneSpaceList.size<1){
                        /** 从对象编码不存在 */
                        sCreateResponse.result = SResponseType.failure
                        sCreateResponse.message = fromContent+":编码不存在"
                        sCreateResponse.errorType = "2"
                        return sCreateResponse
                    }
                    if (relZoneSpaceList.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 floorList = FloorService.select(SFilter.eq("projectId", projectId!!), SFilter.inList(relationAddRequest.type!!, setCode.toList())).exec()
                val relEquipment = relPropertyList[0]

            for (relZoneSpace in floorList){
                val rEq2Fl = REqForFl()
                rEq2Fl.floorId = relZoneSpace.id
                rEq2Fl.projectId = projectId
                rEq2Fl.equipId = relEquipment.id
//                rEq2Fl.type = "eq2fl_for"
                rEq2Fl.sign = 1
                REqForFlService.replace(rEq2Fl)
            }
            sCreateResponse.result = SResponseType.success
            sCreateResponse.message = "添加成功"
            return sCreateResponse

        }else if (relationAddRequest.relType == "eq2bd_for"){
            /** 设备服务于建筑 */
            if (!relationAddRequest.type.isNullOrEmpty()&&relationAddRequest.type == "cadId"){
                /** 从对象不存在cadId编码 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = "从对象不存在CADID编码"
                sCreateResponse.errorType = "2"
                return sCreateResponse
            }
            /** 查询设备 */
            val relPropertyList = EquipmentService.select(SFilter.eq("projectId", projectId!!), SFilter.eq(relationAddRequest.type!!, relationAddRequest.mainContent!!)).exec()

            if (relPropertyList.size<1){
                /** 主对象编码不存在 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = relationAddRequest.mainContent+":编码不存在"
                sCreateResponse.errorType = "1"
                return sCreateResponse
            }
            if (relPropertyList.size>1){
                /** 主对象编码识别到多个实例 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = relationAddRequest.mainContent+":编码存在多个实例"
                sCreateResponse.errorType = "1"
                return sCreateResponse
            }

            for (fromContent in relationAddRequest.fromContent!!){
                val relZoneSpaceList = BuildingService.select(SFilter.eq("projectId", projectId), SFilter.eq(relationAddRequest.type!!, fromContent!!)).exec()
                if (relZoneSpaceList.size<1){
                    /** 从对象编码不存在 */
                    sCreateResponse.result = SResponseType.failure
                    sCreateResponse.message = fromContent+":编码不存在"
                    sCreateResponse.errorType = "2"
                    return sCreateResponse
                }
                if (relZoneSpaceList.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 buildingList = BuildingService.select(SFilter.eq("projectId", projectId!!), SFilter.inList(relationAddRequest.type!!, setCode.toList())).exec()
            val relEquipment = relPropertyList[0]

            for (relZoneSpace in buildingList){
                val rEq2Bd = REq2Bd()
                rEq2Bd.id2 = relZoneSpace.id
                rEq2Bd.projectId = projectId
                rEq2Bd.id1 = relEquipment.id
                rEq2Bd.type = "eq2bd_for"
                rEq2Bd.sign = 1
                REqForBdService.replace(rEq2Bd)
            }
            sCreateResponse.result = SResponseType.success
            sCreateResponse.message = "添加成功"
            return sCreateResponse
        }else if ( relationAddRequest.relType == "sy2sp_for"){
            if (!relationAddRequest.type.isNullOrEmpty()&&relationAddRequest.type == "cadId"){
                /** 从对象不存在cadId编码 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = "主从对象不存在CADID编码"
                sCreateResponse.errorType = "1"
                return sCreateResponse
            }

            val generalSystemList = GeneralSystemService.select(SFilter.eq("projectId", projectId!!), SFilter.eq(relationAddRequest.type!!, relationAddRequest.mainContent!!)).exec()
            if (generalSystemList.size<1){
                /** 主对象编码不存在 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = relationAddRequest.mainContent+":编码不存在"
                sCreateResponse.errorType = "1"
                return sCreateResponse
            }
            if (generalSystemList.size>1){
                /** 主对象编码识别到多个实例 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = relationAddRequest.mainContent+":编码存在多个实例"
                sCreateResponse.errorType = "1"
                return sCreateResponse
            }

            for (fromContent in relationAddRequest.fromContent!!){
                val relZoneSpaceList = relZoneSpaceService.select(SFilter.eq("projectId", projectId), SFilter.eq(relationAddRequest.type!!, fromContent!!)).exec()
                if (relZoneSpaceList.size<1){
                    /** 从对象编码不存在 */
                    sCreateResponse.result = SResponseType.failure
                    sCreateResponse.message = fromContent+":编码不存在"
                    sCreateResponse.errorType = "2"
                    return sCreateResponse
                }
                if (relZoneSpaceList.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 relZoneSpaceList = relZoneSpaceService.select(SFilter.eq("projectId", projectId), SFilter.inList(relationAddRequest.type!!, setCode.toList())).exec()
            /** 系统 */
            val relProperty = generalSystemList[0]

            for (relZoneSpace in relZoneSpaceList){
                val rSy2Sp = RSy2Sp()
                rSy2Sp.id2 = relZoneSpace.id
                rSy2Sp.zoneType = relZoneSpace.objectType
                rSy2Sp.projectId = projectId
                rSy2Sp.id1 = relProperty.id
                rSy2Sp.type = "sy2sp_for"
                rSy2Sp.sign = 1
                rSy2SpService.replace(rSy2Sp)
            }
            sCreateResponse.result = SResponseType.success
            sCreateResponse.message = "添加成功"
            return sCreateResponse
        }else if (relationAddRequest.relType == "sy2sh_for"){

            if (!relationAddRequest.type.isNullOrEmpty()&&relationAddRequest.type == "cadId"){
                /** 从对象不存在cadId编码 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = "主从对象不存在CADID编码"
                sCreateResponse.errorType = "1"
                return sCreateResponse
            }

            val generalSystemList = GeneralSystemService.select(SFilter.eq("projectId", projectId!!), SFilter.eq(relationAddRequest.type!!, relationAddRequest.mainContent!!)).exec()
            if (generalSystemList.size<1){
                /** 主对象编码不存在 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = relationAddRequest.mainContent+":编码不存在"
                sCreateResponse.errorType = "1"
                return sCreateResponse
            }
            if (generalSystemList.size>1){
                /** 主对象编码识别到多个实例 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = relationAddRequest.mainContent+":编码存在多个实例"
                sCreateResponse.errorType = "1"
                return sCreateResponse
            }
            for (fromContent in relationAddRequest.fromContent!!){
                val relZoneSpaceList = relShaftService.select(SFilter.eq("projectId", projectId), SFilter.eq(relationAddRequest.type!!, fromContent!!)).exec()
                if (relZoneSpaceList.size<1){
                    /** 从对象编码不存在 */
                    sCreateResponse.result = SResponseType.failure
                    sCreateResponse.message = fromContent+":编码不存在"
                    sCreateResponse.errorType = "2"
                    return sCreateResponse
                }
                if (relZoneSpaceList.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 relZoneSpaceList = relShaftService.select(SFilter.eq("projectId", projectId), SFilter.inList(relationAddRequest.type!!, setCode.toList())).exec()
            /** 资产 */
            val relProperty = generalSystemList[0]

            for (relZoneSpace in relZoneSpaceList){
                val rSy2Sh = RSyForSh()
                rSy2Sh.shaftId = relZoneSpace.id
                rSy2Sh.projectId = projectId
                rSy2Sh.sysId = relProperty.id
//                rSy2Sh.type = "sy2sh_for"
                rSy2Sh.sign = 1
                RSyForShService.replace(rSy2Sh)
            }
            sCreateResponse.result = SResponseType.success
            sCreateResponse.message = "添加成功"
            return sCreateResponse
        }else if (relationAddRequest.relType == "sy2fl_for"){
            /** 系统服务于楼层 */
            if (!relationAddRequest.type.isNullOrEmpty()&&relationAddRequest.type == "cadId"){
                /** 从对象不存在cadId编码 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = "主从对象不存在CADID编码"
                return sCreateResponse
            }

            val generalSystemList = GeneralSystemService.select(SFilter.eq("projectId", projectId!!), SFilter.eq(relationAddRequest.type!!, relationAddRequest.mainContent!!)).exec()
            if (generalSystemList.size<1){
                /** 主对象编码不存在 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = relationAddRequest.mainContent+":编码不存在"
                sCreateResponse.errorType = "1"
                return sCreateResponse
            }
            if (generalSystemList.size>1){
                /** 主对象编码识别到多个实例 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = relationAddRequest.mainContent+":编码存在多个实例"
                sCreateResponse.errorType = "1"
                return sCreateResponse
            }

            for (fromContent in relationAddRequest.fromContent!!){
                val relZoneSpaceList = FloorService.select(SFilter.eq("projectId", projectId), SFilter.eq(relationAddRequest.type!!, fromContent!!)).exec()
                if (relZoneSpaceList.size<1){
                    /** 从对象编码不存在 */
                    sCreateResponse.result = SResponseType.failure
                    sCreateResponse.message = fromContent+":编码不存在"
                    sCreateResponse.errorType = "2"
                    return sCreateResponse
                }
                if (relZoneSpaceList.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 floorList = FloorService.select(SFilter.eq("projectId", projectId!!), SFilter.inList(relationAddRequest.type!!, setCode.toList())).exec()
            val relEquipment = generalSystemList[0]

            for (relZoneSpace in floorList){
                val rSy2Fl = RSyForFl()
                rSy2Fl.floorId = relZoneSpace.id
//                rSy2Fl.buildingId = relZoneSpace.buildId
                rSy2Fl.projectId = projectId
                rSy2Fl.sysId = relEquipment.id
//                rSy2Fl.type = "sy2fl_for"
                rSy2Fl.sign = 1
                RSyForFlService.replace(rSy2Fl)
            }
            sCreateResponse.result = SResponseType.success
            sCreateResponse.message = "添加成功"
            return sCreateResponse

        }else if (relationAddRequest.relType == "sy2bd_for"){
            /** 系统服务于楼层 */
            if (!relationAddRequest.type.isNullOrEmpty()&&relationAddRequest.type == "cadId"){
                /** 从对象不存在cadId编码 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = "主从对象不存在CADID编码"
                return sCreateResponse
            }

            val generalSystemList = GeneralSystemService.select(SFilter.eq("projectId", projectId!!), SFilter.eq(relationAddRequest.type!!, relationAddRequest.mainContent!!)).exec()
            if (generalSystemList.size<1){
                /** 主对象编码不存在 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = relationAddRequest.mainContent+":编码不存在"
                sCreateResponse.errorType = "1"
                return sCreateResponse
            }
            if (generalSystemList.size>1){
                /** 主对象编码识别到多个实例 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = relationAddRequest.mainContent+":编码存在多个实例"
                sCreateResponse.errorType = "1"
                return sCreateResponse
            }

            for (fromContent in relationAddRequest.fromContent!!){
                val relZoneSpaceList = BuildingService.select(SFilter.eq("projectId", projectId), SFilter.eq(relationAddRequest.type!!, fromContent!!)).exec()
                if (relZoneSpaceList.size<1){
                    /** 从对象编码不存在 */
                    sCreateResponse.result = SResponseType.failure
                    sCreateResponse.message = fromContent+":编码不存在"
                    sCreateResponse.errorType = "2"
                    return sCreateResponse
                }
                if (relZoneSpaceList.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 buildingList = BuildingService.select(SFilter.eq("projectId", projectId!!), SFilter.inList(relationAddRequest.type!!, setCode.toList())).exec()
            val relEquipment = generalSystemList[0]

            for (relZoneSpace in buildingList){
                val rSy2Bd = RSyForBd()
                rSy2Bd.buildingId = relZoneSpace.id
                rSy2Bd.projectId = projectId
                rSy2Bd.sysId = relEquipment.id
                rSy2Bd.sign = 1
                RSyForBdService.replace(rSy2Bd)
            }
            sCreateResponse.result = SResponseType.success
            sCreateResponse.message = "添加成功"
            return sCreateResponse
        }else if (relationAddRequest.relType == "sp2sp_ConvectionNetwork_1"||relationAddRequest.relType == "sp2sp_ConvectionNetwork_2"||relationAddRequest.relType == "sp2sp_ConvectionNetwork_3"
                ||relationAddRequest.relType == "sp2sp_SpaceNeighborhood_5"||relationAddRequest.relType == "sp2sp_SpaceNeighborhood_2"||relationAddRequest.relType == "sp2sp_SpaceNeighborhood_4"
                ||relationAddRequest.relType == "sp2sp_TrafficNetwork_3"||relationAddRequest.relType == "sp2sp_TrafficNetwork_2"||relationAddRequest.relType == "sp2sp_RadiationNetwork_1"
                ||relationAddRequest.relType == "sp2sp_RadiationNetwork_2"||relationAddRequest.relType == "sp2sp_SpaceNeighborhood_1"||relationAddRequest.relType == "sp2sp_TrafficNetwork_1"
                ||relationAddRequest.relType == "sp2sp_SpaceNeighborhood_3"
        ){

            if (!relationAddRequest.type.isNullOrEmpty()&&relationAddRequest.type == "cadId"){
                /** 从对象不存在cadId编码 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = "主从对象不存在CADID编码"
                return sCreateResponse
            }
            /**
             * 空间 空气自然对流       spairconvection                              sp2sp_ConvectionNetwork_1
             * 空间空气混合机械通风    spairmixing                                   sp2sp_ConvectionNetwork_2
             * 空气单向机械通风        spairunidirectional                           sp2sp_ConvectionNetwork_3
             * 空间连通关系           spconnectedsp                                   sp2sp_SpaceNeighborhood_5
             * 空间隔断有门           spdoors                                          sp2sp_SpaceNeighborhood_2
             * 空间隔断有门窗          spdoorswind                                     sp2sp_SpaceNeighborhood_4
             * 空间消防常关交通         spfireclose                                     sp2sp_TrafficNetwork_3
             * 空间消防常开交通         spfireopen                                      sp2sp_TrafficNetwork_2
             * 空间光照连通            splightconnection                               sp2sp_RadiationNetwork_1
             * 空间光照透明隔断         splighttrans                                    sp2sp_RadiationNetwork_2
             * 空间隔断无门窗          spnotdoorswind                                   sp2sp_SpaceNeighborhood_1
             * 空间普通交通           spordinary                                         sp2sp_TrafficNetwork_1
             * 空间隔断有窗           spwind                                            sp2sp_SpaceNeighborhood_3
             */
            val relZoneSpaceList = relZoneSpaceService.select(SFilter.eq("projectId", projectId!!), SFilter.eq(relationAddRequest.type!!, relationAddRequest.mainContent!!)).exec()
            if (relZoneSpaceList.size<1){
                /** 主对象编码不存在 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = relationAddRequest.mainContent+":编码不存在"
                sCreateResponse.errorType = "1"
                return sCreateResponse
            }
            if (relZoneSpaceList.size>1){
                /** 主对象编码识别到多个实例 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = relationAddRequest.mainContent+":编码存在多个实例"
                sCreateResponse.errorType = "1"
                return sCreateResponse
            }
            logger.debug("空间类型 = ${relZoneSpaceList.toJson()}")
            val relZoneSpace = relZoneSpaceList[0]
            for (fromContent in relationAddRequest.fromContent!!){
                /** 去除主对象空间id */
                val relZoneToSpaceList = relZoneSpaceService.select(SFilter.eq("projectId", projectId), SFilter.eq(relationAddRequest.type!!, fromContent!!),
                        SFilter.not(SFilter.eq("id",relZoneSpace.id!!)),SFilter.eq("objectType",relZoneSpace.objectType!!)).exec()
                if (relZoneToSpaceList.size == 0){
                    /** 从对象编码不存在 */
                    sCreateResponse.result = SResponseType.failure
                    sCreateResponse.message = fromContent+":编码不存在"
                    sCreateResponse.errorType = "2"
                    return sCreateResponse
                }
                if (relZoneToSpaceList.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 relZoneToSpaceList = relZoneSpaceService.select(SFilter.eq("projectId", projectId), SFilter.inList(relationAddRequest.type!!, setCode.toList()),
                    SFilter.not(SFilter.eq("id",relZoneSpace.id!!)),SFilter.eq("objectType",relZoneSpace.objectType!!)).exec()

            if (relationAddRequest.relType == "sp2sp_ConvectionNetwork_1"){
                for (relZoneTo in relZoneToSpaceList){
                    val rSp2Sp = RSp2Sp()
                    rSp2Sp.id1 = relZoneSpace.id
                    rSp2Sp.projectId = projectId
                    rSp2Sp.sign = 1
                    rSp2Sp.id2 = relZoneTo.id
                    rSp2Sp.type = "sp2sp_ConvectionNetwork_1"
                    rSp2Sp.zoneType = relZoneSpace.objectType
                    rSp2SpService.replace(rSp2Sp)
                }
            }else if (relationAddRequest.relType == "sp2sp_ConvectionNetwork_2"){
                for (relZoneTo in relZoneToSpaceList) {
                    val rSp2Sp = RSp2Sp()
                    rSp2Sp.id1 = relZoneSpace.id
                    rSp2Sp.projectId = projectId
                    rSp2Sp.sign = 1
                    rSp2Sp.id2 = relZoneTo.id
                    rSp2Sp.type = "sp2sp_ConvectionNetwork_2"
                    rSp2Sp.zoneType = relZoneSpace.objectType
                    rSp2SpService.replace(rSp2Sp)
                }
            }else if (relationAddRequest.relType == "sp2sp_ConvectionNetwork_3"){
                for (relZoneTo in relZoneToSpaceList) {
                    val rSp2Sp = RSp2Sp()
                    rSp2Sp.id1 = relZoneSpace.id
                    rSp2Sp.projectId = projectId
                    rSp2Sp.sign = 1
                    rSp2Sp.id2 = relZoneTo.id
                    rSp2Sp.type = "sp2sp_ConvectionNetwork_3"
                    rSp2Sp.zoneType = relZoneSpace.objectType
                    rSp2SpService.replace(rSp2Sp)
                }
            }else if (relationAddRequest.relType == "sp2sp_SpaceNeighborhood_5"){
                for (relZoneTo in relZoneToSpaceList) {
                    val rSp2Sp = RSp2Sp()
                    rSp2Sp.id1 = relZoneSpace.id
                    rSp2Sp.projectId = projectId
                    rSp2Sp.sign = 1
                    rSp2Sp.id2 = relZoneTo.id
                    rSp2Sp.type = "sp2sp_SpaceNeighborhood_5"
                    rSp2Sp.zoneType = relZoneSpace.objectType
                    rSp2SpService.replace(rSp2Sp)
                }
            }else if (relationAddRequest.relType == "sp2sp_SpaceNeighborhood_2"){
                for (relZoneTo in relZoneToSpaceList) {
                    val rSp2Sp = RSp2Sp()
                    rSp2Sp.id1 = relZoneSpace.id
                    rSp2Sp.projectId = projectId
                    rSp2Sp.sign = 1
                    rSp2Sp.id2 = relZoneTo.id
                    rSp2Sp.type = "sp2sp_SpaceNeighborhood_2"
                    rSp2Sp.zoneType = relZoneSpace.objectType
                    rSp2SpService.replace(rSp2Sp)
                }
            }else if (relationAddRequest.relType == "sp2sp_SpaceNeighborhood_4"){
                for (relZoneTo in relZoneToSpaceList) {
                    val rSp2Sp = RSp2Sp()
                    rSp2Sp.id1 = relZoneSpace.id
                    rSp2Sp.projectId = projectId
                    rSp2Sp.sign = 1
                    rSp2Sp.id2 = relZoneTo.id
                    rSp2Sp.type = "sp2sp_SpaceNeighborhood_4"
                    rSp2Sp.zoneType = relZoneSpace.objectType
                    rSp2SpService.replace(rSp2Sp)
                }
            }else if (relationAddRequest.relType == "sp2sp_TrafficNetwork_3"){
                for (relZoneTo in relZoneToSpaceList) {
                    val rSp2Sp = RSp2Sp()
                    rSp2Sp.id1 = relZoneSpace.id
                    rSp2Sp.projectId = projectId
                    rSp2Sp.sign = 1
                    rSp2Sp.id2 = relZoneTo.id
                    rSp2Sp.type = "sp2sp_TrafficNetwork_3"
                    rSp2Sp.zoneType = relZoneSpace.objectType
                    rSp2SpService.replace(rSp2Sp)
                }
            }else if (relationAddRequest.relType == "sp2sp_TrafficNetwork_2"){
                for (relZoneTo in relZoneToSpaceList) {
                    val rSp2Sp = RSp2Sp()
                    rSp2Sp.id1 = relZoneSpace.id
                    rSp2Sp.projectId = projectId
                    rSp2Sp.sign = 1
                    rSp2Sp.id2 = relZoneTo.id
                    rSp2Sp.type = "sp2sp_TrafficNetwork_2"
                    rSp2Sp.zoneType = relZoneSpace.objectType
                    rSp2SpService.replace(rSp2Sp)
                }
            }else if (relationAddRequest.relType == "sp2sp_RadiationNetwork_1"){
                for (relZoneTo in relZoneToSpaceList) {
                    val rSp2Sp = RSp2Sp()
                    rSp2Sp.id1 = relZoneSpace.id
                    rSp2Sp.projectId = projectId
                    rSp2Sp.sign = 1
                    rSp2Sp.id2 = relZoneTo.id
                    rSp2Sp.type = "sp2sp_RadiationNetwork_1"
                    rSp2Sp.zoneType = relZoneSpace.objectType
                    rSp2SpService.replace(rSp2Sp)
                }
            }else if (relationAddRequest.relType == "sp2sp_RadiationNetwork_2"){
                for (relZoneTo in relZoneToSpaceList) {
                    val rSp2Sp = RSp2Sp()
                    rSp2Sp.id1 = relZoneSpace.id
                    rSp2Sp.projectId = projectId
                    rSp2Sp.sign = 1
                    rSp2Sp.id2 = relZoneTo.id
                    rSp2Sp.type = "sp2sp_RadiationNetwork_2"
                    rSp2Sp.zoneType = relZoneSpace.objectType
                    rSp2SpService.replace(rSp2Sp)
                }
            }else if (relationAddRequest.relType == "sp2sp_SpaceNeighborhood_1"){
                for (relZoneTo in relZoneToSpaceList) {
                    val rSp2Sp = RSp2Sp()
                    rSp2Sp.id1 = relZoneSpace.id
                    rSp2Sp.projectId = projectId
                    rSp2Sp.sign = 1
                    rSp2Sp.id2 = relZoneTo.id
                    rSp2Sp.type = "sp2sp_SpaceNeighborhood_1"
                    rSp2Sp.zoneType = relZoneSpace.objectType
                    rSp2SpService.replace(rSp2Sp)
                }
            }else if (relationAddRequest.relType == "sp2sp_TrafficNetwork_1"){
                for (relZoneTo in relZoneToSpaceList) {
                    val rSp2Sp = RSp2Sp()
                    rSp2Sp.id1 = relZoneSpace.id
                    rSp2Sp.projectId = projectId
                    rSp2Sp.sign = 1
                    rSp2Sp.id2 = relZoneTo.id
                    rSp2Sp.type = "sp2sp_TrafficNetwork_1"
                    rSp2Sp.zoneType = relZoneSpace.objectType
                    rSp2SpService.replace(rSp2Sp)
                }
            }else if (relationAddRequest.relType == "sp2sp_SpaceNeighborhood_3"){
                for (relZoneTo in relZoneToSpaceList) {
                    val rSp2Sp = RSp2Sp()
                    rSp2Sp.id1 = relZoneSpace.id
                    rSp2Sp.projectId = projectId
                    rSp2Sp.sign = 1
                    rSp2Sp.id2 = relZoneTo.id
                    rSp2Sp.type = "sp2sp_SpaceNeighborhood_3"
                    rSp2Sp.zoneType = relZoneSpace.objectType
                    rSp2SpService.replace(rSp2Sp)
                }
            }
            sCreateResponse.result = SResponseType.success
            sCreateResponse.message = "添加成功"
            return sCreateResponse
        }else if (relationAddRequest.relType == "eq2eq_LUDistribution_1"||relationAddRequest.relType == "eq2eq_LUDistribution_2"||relationAddRequest.relType == "eq2eq_HUDistribution_1"
                ||relationAddRequest.relType == "eq2eq_HUDistribution_2"||relationAddRequest.relType == "eq2eq_EquipPower_1"||relationAddRequest.relType == "eq2eq_EquipPower_2"
                ||relationAddRequest.relType == "eq2eq_EquipPower_3"||relationAddRequest.relType == "eq2eq_EquipPower_4"){
                /** 强电类 */
                val equipmentList = EquipmentService.select(SFilter.eq("projectId", projectId!!), SFilter.eq(relationAddRequest.type!!, relationAddRequest.mainContent!!)).exec()
            if (equipmentList.size<1){
                /** 主对象编码不存在 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = relationAddRequest.mainContent+":编码不存在"
                sCreateResponse.errorType = "1"
                return sCreateResponse
            }
            if (equipmentList.size>1){
                /** 主对象编码识别到多个实例 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = relationAddRequest.mainContent+":编码存在多个实例"
                sCreateResponse.errorType = "1"
                return sCreateResponse
            }
            val equipment = equipmentList[0]
            for (fromContent in relationAddRequest.fromContent!!){
                /** 去除主对象空间id */
                val equipmentToList = EquipmentService.select(SFilter.eq("projectId", projectId), SFilter.eq(relationAddRequest.type!!, fromContent!!),
                        SFilter.not(SFilter.eq("id",equipment.id!!))).exec()
                if (equipmentToList.size<1){
                    /** 从对象编码不存在 */
                    sCreateResponse.result = SResponseType.failure
                    sCreateResponse.message = fromContent+":编码不存在"
                    sCreateResponse.errorType = "2"
                    return sCreateResponse
                }
                if (equipmentToList.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 equipmentToList = EquipmentService.select(SFilter.eq("projectId", projectId), SFilter.inList(relationAddRequest.type!!, setCode.toList()),
                    SFilter.not(SFilter.eq("id",equipment.id!!))).exec()
            if (relationAddRequest.relType == "eq2eq_HUDistribution_1"){ /** 高压变配电普通连接 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.type = "eq2eq_HUDistribution_1"
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_HUDistribution_2"){/** 高压变配电互备连接 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.type = "eq2eq_HUDistribution_2"
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_LUDistribution_1"){/** 低压配电普通连接 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.type = "eq2eq_LUDistribution_1"
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_LUDistribution_2"){/** 低压配电互备连接 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.type = "eq2eq_LUDistribution_2"
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_EquipPower_1"){/** 设备常规电源 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.type = "eq2eq_EquipPower_1"
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_EquipPower_2"){/** 设备备用电源 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.type = "eq2eq_EquipPower_2"
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_EquipPower_3"){/** 系统常规电源 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.type = "eq2eq_EquipPower_3"
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_EquipPower_4"){/** 系统备用电源 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.type = "eq2eq_EquipPower_4"
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2EqService.replace(rEq2Eq)
                }
            }
            sCreateResponse.result = SResponseType.success
            sCreateResponse.message = "添加成功"
            return sCreateResponse
        }else if (relationAddRequest.relType == "eq2eq_ACAirNetwork_1"||relationAddRequest.relType == "eq2eq_ACAirNetwork_3"||relationAddRequest.relType == "eq2eq_ACAirNetwork_2"
                ||relationAddRequest.relType == "eq2eq_ChillWaterLoop_4"|| relationAddRequest.relType == "eq2eq_ChillWaterLoop_1"||relationAddRequest.relType == "eq2eq_ChillWaterLoop_3"
                || relationAddRequest.relType == "eq2eq_ChillWaterLoop_2"||relationAddRequest.relType == "eq2eq_CondWaterNetwork_1"||relationAddRequest.relType == "eq2eq_CoolingWaterLoop_4"
                ||relationAddRequest.relType == "eq2eq_CoolingWaterLoop_1"||relationAddRequest.relType == "eq2eq_CoolingWaterLoop_3"||relationAddRequest.relType == "eq2eq_CoolingWaterLoop_2"
                ||relationAddRequest.relType == "eq2eqFreshAirNetwork_1"||relationAddRequest.relType == "eq2eq_HeatWaterLoop_4"||relationAddRequest.relType == "eq2eq_HeatWaterLoop_1"
                ||relationAddRequest.relType == "eq2eq_HeatWaterLoop_3"||relationAddRequest.relType == "eq2eq_HeatWaterLoop_2"||relationAddRequest.relType == "eq2eq_VentNetwork_1"
                ||relationAddRequest.relType == "eq2eq_VentNetwork_3"||relationAddRequest.relType == "eq2eq_VentNetwork_2"||relationAddRequest.relType == "eq2eq_VRFNetwork_1"){
                    /** 暖通空调类 */
            val equipmentList = EquipmentService.select(SFilter.eq("projectId", projectId!!), SFilter.eq(relationAddRequest.type!!, relationAddRequest.mainContent!!)).exec()
            if (equipmentList.size<1){
                /** 主对象编码不存在 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = relationAddRequest.mainContent+":编码不存在"
                sCreateResponse.errorType = "1"
                return sCreateResponse
            }
            if (equipmentList.size>1){
                /** 主对象编码识别到多个实例 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = relationAddRequest.mainContent+":编码存在多个实例"
                sCreateResponse.errorType = "1"
                return sCreateResponse
            }
            val equipment = equipmentList[0]
            for (fromContent in relationAddRequest.fromContent!!){
                /** 去除主对象空间id */
                val equipmentToList = EquipmentService.select(SFilter.eq("projectId", projectId), SFilter.eq(relationAddRequest.type!!, fromContent!!),
                        SFilter.not(SFilter.eq("id",equipment.id!!))).exec()
                if (equipmentToList.size<1){
                    /** 从对象编码不存在 */
                    sCreateResponse.result = SResponseType.failure
                    sCreateResponse.message = fromContent+":编码不存在"
                    sCreateResponse.errorType = "2"
                    return sCreateResponse
                }
                if (equipmentToList.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 equipmentToList = EquipmentService.select(SFilter.eq("projectId", projectId), SFilter.inList(relationAddRequest.type!!, setCode.toList()),
                    SFilter.not(SFilter.eq("id",equipment.id!!))).exec()
            if (relationAddRequest.relType == "eq2eq_ACAirNetwork_1"){ /** 空调送风 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_ACAirNetwork_1"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_ACAirNetwork_3"){/** 空调排风 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_ACAirNetwork_3"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_ACAirNetwork_2"){/** 空调回风 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_ACAirNetwork_2"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_ChillWaterLoop_4"){/** 空调冷冻水补水 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_ChillWaterLoop_4"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_ChillWaterLoop_1"){/** 空调冷冻水供水 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_ChillWaterLoop_1"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_ChillWaterLoop_3"){/** 空调冷冻水旁通 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_ChillWaterLoop_3"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_ChillWaterLoop_2"){/**  空调冷冻水回水*/
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_ChillWaterLoop_2"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_CondWaterNetwork_1"){/** 空调冷凝水网络 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_CondWaterNetwork_1"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_CoolingWaterLoop_4"){/** 空调冷却水补水 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_CoolingWaterLoop_4"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_CoolingWaterLoop_1"){/** 空调冷却水供水 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_CoolingWaterLoop_1"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_CoolingWaterLoop_3"){/** 空调冷却水旁通 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_CoolingWaterLoop_2"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_CoolingWaterLoop_2"){/** 空调冷却水回水 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_CoolingWaterLoop_2"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eqFreshAirNetwork_1"){/** 新风管网 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eqFreshAirNetwork_1"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_HeatWaterLoop_4"){/** 采暖水回水 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_HeatWaterLoop_4"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_HeatWaterLoop_1"){/** 采暖水供水 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_HeatWaterLoop_1"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_HeatWaterLoop_3"){/** 采暖水旁通 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_HeatWaterLoop_3"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_HeatWaterLoop_2"){/** 采暖水回水 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_HeatWaterLoop_2"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_VentNetwork_1"){/** 通风送风 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_VentNetwork_1"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_VentNetwork_3"){/** 通风不确定 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_VentNetwork_3"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_VentNetwork_2"){/** 通风排风 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_VentNetwork_2"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_VRFNetwork_1"){/** 多联机供回制冷剂 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_VRFNetwork_1"
                    rEq2EqService.replace(rEq2Eq)
                }
            }

            sCreateResponse.result = SResponseType.success
            sCreateResponse.message = "添加成功"
            return sCreateResponse
        }else if (relationAddRequest.relType == "eq2eq_SupplyWaterNetwork_1"||relationAddRequest.relType == "eq2eq_SupplyWaterNetwork_2"||relationAddRequest.relType == "eq2eq_DrainingWaterNetwork_1"||relationAddRequest.relType == "eq2eq_DrainingWaterNetwork_2"
                ||relationAddRequest.relType == "eq2eq_DrinkingWaterNetwork_1"||relationAddRequest.relType == "eq2eq_DrinkingWaterNetwork_2"||relationAddRequest.relType == "eq2eq_DHWNetwork_1"||relationAddRequest.relType == "eq2eq_DHWNetwork_2"
                ||relationAddRequest.relType == "eq2eq_GasNetwork_1"||relationAddRequest.relType == "eq2eq_GasNetwork_2"||relationAddRequest.relType == "eq2eq_FireWaterNetwork_1"||relationAddRequest.relType == "eq2eq_FireWaterNetwork_2"
                ||relationAddRequest.relType == "eq2eq_FireVentNetwork_1"||relationAddRequest.relType == "eq2eq_RecycleWaterNetwork_1" ||relationAddRequest.relType == "eq2eq_RecycleWaterNetwork_2"){
            /** 给排水类 和 消防类 */
            val equipmentList = EquipmentService.select(SFilter.eq("projectId", projectId!!), SFilter.eq(relationAddRequest.type!!, relationAddRequest.mainContent!!)).exec()
            if (equipmentList.size<1){
                /** 主对象编码不存在 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = relationAddRequest.mainContent+":编码不存在"
                sCreateResponse.errorType = "1"
                return sCreateResponse
            }
            if (equipmentList.size>1){
                /** 主对象编码识别到多个实例 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = relationAddRequest.mainContent+":编码存在多个实例"
                sCreateResponse.errorType = "1"
                return sCreateResponse
            }

            val equipment = equipmentList[0]
            for (fromContent in relationAddRequest.fromContent!!){
                /** 去除主对象空间id */
                val equipmentToList = EquipmentService.select(SFilter.eq("projectId", projectId), SFilter.eq(relationAddRequest.type!!, fromContent!!),
                        SFilter.not(SFilter.eq("id",equipment.id!!))).exec()
                if (equipmentToList.size<1){
                    /** 从对象编码不存在 */
                    sCreateResponse.result = SResponseType.failure
                    sCreateResponse.message = fromContent+":编码不存在"
                    sCreateResponse.errorType = "2"
                    return sCreateResponse
                }
                if (equipmentToList.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 equipmentToList = EquipmentService.select(SFilter.eq("projectId", projectId), SFilter.inList(relationAddRequest.type!!, setCode.toList()),
                    SFilter.not(SFilter.eq("id",equipment.id!!))).exec()

            if (relationAddRequest.relType == "eq2eq_SupplyWaterNetwork_1"){ /** 生活给水供水 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_SupplyWaterNetwork_1"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_SupplyWaterNetwork_2"){/** 生活给水旁通 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_SupplyWaterNetwork_2"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_DrainingWaterNetwork_1"){/** 污水排水 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_DrainingWaterNetwork_1"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_DrainingWaterNetwork_2"){/** 污水旁通 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_DrainingWaterNetwork_2"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_DrinkingWaterNetwork_1"){/** 直饮水供水 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_DrinkingWaterNetwork_1"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_DrinkingWaterNetwork_2"){/** 直饮水旁通 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_DrinkingWaterNetwork_2"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_DHWNetwork_1"){/** 生活热水供水 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_DHWNetwork_1"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_DHWNetwork_2"){/** 生活热水旁通 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_DHWNetwork_2"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_GasNetwork_1"){/** 燃气供气 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_GasNetwork_1"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_GasNetwork_2"){/** 燃气旁通 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_GasNetwork_2"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_FireWaterNetwork_1"){/** 消防供水网络 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_FireWaterNetwork_1"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_FireWaterNetwork_2"){/** 消防给水旁通 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_FireWaterNetwork_2"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_FireVentNetwork_1"){/** 消防排烟 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_FireVentNetwork_1"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_RecycleWaterNetwork_1"){/** 中水供水 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_RecycleWaterNetwork_1"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_RecycleWaterNetwork_2"){/** 中水旁通 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_RecycleWaterNetwork_2"
                    rEq2EqService.replace(rEq2Eq)
                }
            }

            sCreateResponse.result = SResponseType.success
            sCreateResponse.message = "添加成功"
            return sCreateResponse
        }else if (relationAddRequest.relType == "eq2eq_SensorNetwork_1"||relationAddRequest.relType == "eq2eq_ControlRelation_1"
                ||relationAddRequest.relType == "eq2eq_SensorRelationship_ss2eq"||relationAddRequest.relType == "eq2eq_ValveRelationship_vv2eq"||relationAddRequest.relType =="eq2eq_ControlEquipNetwork"){
                  /** 测控类 */
            /** 给排水类 和 消防类 */
            val equipmentList = EquipmentService.select(SFilter.eq("projectId", projectId!!), SFilter.eq(relationAddRequest.type!!, relationAddRequest.mainContent!!)).exec()
            if (equipmentList.size<1){
                /** 主对象编码不存在 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = relationAddRequest.mainContent+":编码不存在"
                sCreateResponse.errorType = "1"
                return sCreateResponse
            }
            if (equipmentList.size>1){
                /** 主对象编码识别到多个实例 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = relationAddRequest.mainContent+":编码存在多个实例"
                sCreateResponse.errorType = "1"
                return sCreateResponse
            }

            val equipment = equipmentList[0]
            for (fromContent in relationAddRequest.fromContent!!){
                /** 去除主对象空间id */
                val equipmentToList = EquipmentService.select(SFilter.eq("projectId", projectId), SFilter.eq(relationAddRequest.type!!, fromContent!!),
                        SFilter.not(SFilter.eq("id",equipment.id!!))).exec()
                if (equipmentToList.size<1){
                    /** 从对象编码不存在 */
                    sCreateResponse.result = SResponseType.failure
                    sCreateResponse.message = fromContent+":编码不存在"
                    sCreateResponse.errorType = "2"
                    return sCreateResponse
                }
                if (equipmentToList.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 equipmentToList = EquipmentService.select(SFilter.eq("projectId", projectId), SFilter.inList(relationAddRequest.type!!, setCode.toList()),
                    SFilter.not(SFilter.eq("id",equipment.id!!))).exec()
            /** 控制网络 */
            if (relationAddRequest.relType =="eq2eq_ControlEquipNetwork"){
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_ControlEquipNetwork"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_SensorNetwork_1"){ /** 通信连接 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_SensorNetwork_1"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_ControlRelation_1"){/** 设备控制关系 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_ControlRelation_1"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_SensorRelationship_ss2eq"){/** 传感器测量设备关系 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_SensorRelationship_ss2eq"
                    rEq2EqService.replace(rEq2Eq)
                }
            }else if (relationAddRequest.relType == "eq2eq_ValveRelationship_vv2eq"){/** 阀门限制设备关系 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Eq = REq2Eq()
                    rEq2Eq.id1 = equipment.id
                    rEq2Eq.projectId = projectId
                    rEq2Eq.sign = 1
                    rEq2Eq.id2 = equipmentTo.id
                    rEq2Eq.type = "eq2eq_ValveRelationship_vv2eq"
                    rEq2EqService.replace(rEq2Eq)
                }
            }
            sCreateResponse.result = SResponseType.success
            sCreateResponse.message = "添加成功"
            return sCreateResponse
        }else if (relationAddRequest.relType == "eq2eq_ControlRelation_2"||relationAddRequest.relType == "eq2sy_SensorRelationship_ss2sy"||relationAddRequest.relType == "eq2sy_ValveRelationship_vv2sy"){

            if (!relationAddRequest.type.isNullOrEmpty()&&relationAddRequest.type == "cadId"){
                /** 从对象不存在cadId编码 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = "从对象不存在CADID编码"
                sCreateResponse.errorType = "2"
                return sCreateResponse
            }
            /** 给排水类 和 消防类 */
            val equipmentList = EquipmentService.select(SFilter.eq("projectId", projectId!!), SFilter.eq(relationAddRequest.type!!, relationAddRequest.mainContent!!)).exec()
            if (equipmentList.size<1){
                /** 主对象编码不存在 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = relationAddRequest.mainContent+":编码不存在"
                sCreateResponse.errorType = "1"
                return sCreateResponse
            }
            if (equipmentList.size>1){
                /** 主对象编码识别到多个实例 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = relationAddRequest.mainContent+":编码存在多个实例"
                sCreateResponse.errorType = "1"
                return sCreateResponse
            }

            val equipment = equipmentList[0]
            for (fromContent in relationAddRequest.fromContent!!){
                /** 去除主对象空间id */
                val equipmentToList = GeneralSystemService.select(SFilter.eq("projectId", projectId), SFilter.eq(relationAddRequest.type!!, fromContent!!)).exec()
                if (equipmentToList.size<1){
                    /** 从对象编码不存在 */
                    sCreateResponse.result = SResponseType.failure
                    sCreateResponse.message = fromContent+":编码不存在"
                    sCreateResponse.errorType = "2"
                    return sCreateResponse
                }
                if (equipmentToList.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 equipmentToList = GeneralSystemService.select(SFilter.eq("projectId", projectId), SFilter.inList(relationAddRequest.type!!, setCode.toList())).exec()
            if (relationAddRequest.relType == "eq2eq_ControlRelation_2"){ /** 系统控制关系 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Sy = REq2Sy()
                    rEq2Sy.id1 = equipment.id
                    rEq2Sy.projectId = projectId
                    rEq2Sy.sign = 1
                    rEq2Sy.id2 = equipmentTo.id
                    rEq2Sy.type = "eq2eq_ControlRelation_2"
                    rEq2SyService.replace(rEq2Sy)
                }
            }else if (relationAddRequest.relType == "eq2sy_SensorRelationship_ss2sy"){ /** 传感器测量系统关系 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Sy = REq2Sy()
                    rEq2Sy.id1 = equipment.id
                    rEq2Sy.projectId = projectId
                    rEq2Sy.sign = 1
                    rEq2Sy.id2 = equipmentTo.id
                    rEq2Sy.type = "eq2sy_SensorRelationship_ss2sy"
                    rEq2SyService.replace(rEq2Sy)
                }
            }else if (relationAddRequest.relType == "eq2sy_ValveRelationship_vv2sy"){ /** 阀门限制系统关系 */
                for (equipmentTo in equipmentToList) {
                    val rEq2Sy = REq2Sy()
                    rEq2Sy.id1 = equipment.id
                    rEq2Sy.projectId = projectId
                    rEq2Sy.sign = 1
                    rEq2Sy.id2 = equipmentTo.id
                    rEq2Sy.type = "eq2sy_ValveRelationship_vv2sy"
                    rEq2SyService.replace(rEq2Sy)
                }
            }

            sCreateResponse.result = SResponseType.success
            sCreateResponse.message = "添加成功"
            return sCreateResponse
        }else if (relationAddRequest.relType == "eq2sp_SensorRelationship_ss2sp"){
            if (!relationAddRequest.type.isNullOrEmpty()&&relationAddRequest.type == "cadId"){
                /** 从对象不存在cadId编码 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = "从对象不存在CADID编码"
                sCreateResponse.errorType = "2"
                return sCreateResponse
            }
            /** 给排水类 和 消防类 */
            val equipmentList = EquipmentService.select(SFilter.eq("projectId", projectId!!), SFilter.eq(relationAddRequest.type!!, relationAddRequest.mainContent!!)).exec()
            if (equipmentList.size<1){
                /** 主对象编码不存在 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = relationAddRequest.mainContent+":编码不存在"
                sCreateResponse.errorType = "1"
                return sCreateResponse
            }
            if (equipmentList.size>1){
                /** 主对象编码识别到多个实例 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = relationAddRequest.mainContent+":编码存在多个实例"
                sCreateResponse.errorType = "1"
                return sCreateResponse
            }

            val equipment = equipmentList[0]

            for (fromContent in relationAddRequest.fromContent!!){
                /** 去除主对象空间id */
                val equipmentToList = ZoneSpaceBaseService.select(SFilter.eq("projectId", projectId), SFilter.eq(relationAddRequest.type!!, fromContent!!)).exec()
                if (equipmentToList.size<1){
                    /** 从对象编码不存在 */
                    sCreateResponse.result = SResponseType.failure
                    sCreateResponse.message = fromContent+":编码不存在"
                    sCreateResponse.errorType = "2"
                    return sCreateResponse
                }
                if (equipmentToList.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 equipmentToList = ZoneSpaceBaseService.select(SFilter.eq("projectId", projectId), SFilter.inList(relationAddRequest.type!!, setCode.toList())).exec()

            for (equipmentTo in equipmentToList) {
                val rEq2Sp = REq2Sp()
                rEq2Sp.id1 = equipment.id
                rEq2Sp.projectId = projectId
                rEq2Sp.sign = 1
                rEq2Sp.id2 = equipmentTo.id
                rEq2Sp.zoneType = equipmentTo.objectType
                rEq2Sp.type = "eq2sp_SensorRelationship_ss2sp"
                rEq2SpService.replace(rEq2Sp)
            }
            sCreateResponse.result = SResponseType.success
            sCreateResponse.message = "添加成功"
            return sCreateResponse
        }else if (relationAddRequest.relType == "eq2sp_x"){
            if (!relationAddRequest.type.isNullOrEmpty()&&relationAddRequest.type == "cadId"){
                /** 从对象不存在cadId编码 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = "从对象不存在CADID编码"
                sCreateResponse.errorType = "2"
                return sCreateResponse
            }
            /** 给排水类 和 消防类 */
            val equipmentList = EquipmentService.select(SFilter.eq("projectId", projectId!!), SFilter.eq(relationAddRequest.type!!, relationAddRequest.mainContent!!)).exec()
            if (equipmentList.size<1){
                /** 主对象编码不存在 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = relationAddRequest.mainContent+":编码不存在"
                sCreateResponse.errorType = "1"
                return sCreateResponse
            }
            if (equipmentList.size>1){
                /** 主对象编码识别到多个实例 */
                sCreateResponse.result = SResponseType.failure
                sCreateResponse.message = relationAddRequest.mainContent+":编码存在多个实例"
                sCreateResponse.errorType = "1"
                return sCreateResponse
            }

            val equipment = equipmentList[0]

            for (fromContent in relationAddRequest.fromContent!!){
                /** 去除主对象空间id */
                val equipmentToList = ZoneSpaceBaseService.select(SFilter.eq("projectId", projectId), SFilter.eq(relationAddRequest.type!!, fromContent!!)).exec()
                if (equipmentToList.size<1){
                    /** 从对象编码不存在 */
                    sCreateResponse.result = SResponseType.failure
                    sCreateResponse.message = fromContent+":编码不存在"
                    sCreateResponse.errorType = "2"
                    return sCreateResponse
                }
                if (equipmentToList.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 equipmentToList = ZoneSpaceBaseService.select(SFilter.eq("projectId", projectId), SFilter.inList(relationAddRequest.type!!, setCode.toList())).exec()

            for (equipmentTo in equipmentToList) {
                val rEq2Sp = REq2Sp()
                rEq2Sp.id1 = equipment.id
                rEq2Sp.projectId = projectId
                rEq2Sp.sign = 1
                rEq2Sp.id2 = equipmentTo.id
                rEq2Sp.zoneType = equipmentTo.objectType
                rEq2Sp.type = "eq2sp_x"
                rEq2SpService.replace(rEq2Sp)
            }
            sCreateResponse.result = SResponseType.success
            sCreateResponse.message = "添加成功"
            return sCreateResponse

        }else {
            sCreateResponse.result = SResponseType.success
            sCreateResponse.message = "添加成功"
            return sCreateResponse
        }
    } // Fun

    /**
     * 删除关系
     */
    fun delRel(manualRelationCalcDel: ManualRelationCalcDel):SBaseResponse{
        try {
            val projectId = SPageContext.getHeader("ProjectId")
            if (!manualRelationCalcDel.fromId.isNullOrEmpty()&&!manualRelationCalcDel.toId.isNullOrEmpty()){

                try {
                    val relationTypeProjectService = SObjectService(SMybatisDao(RelationTypeProject::class.java))
                    val relationType = relationTypeProjectService.select(SFilter.eq("projectId", projectId!!),SFilter.eq("RelationType", manualRelationCalcDel.relType!!)).entity()
                    if (relationType!=null){
                        relationType.computingTime = time()
                        relationTypeProjectService.update(relationType)
                    }
                } catch (e: Exception) {
                    e.printStackTrace()
                }


                var delete: Boolean = false
                if (manualRelationCalcDel.relType == "pe2sp"){ /** 资产所在的业务空间 */
                    delete = rPeInSpBaseService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "pe2sh"){/** 资产所在的竖井 */
                   delete = rPeInShService.delete(SFilter.eq("projectId", projectId!!),
                        SFilter.eq("equipId", manualRelationCalcDel.fromId!!), SFilter.eq("shaftId", manualRelationCalcDel.toId!!))
                }else if (manualRelationCalcDel.relType == "eq2sh_for"){/** 设备服务于竖井 */
                    delete = REqForShService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("equipId", manualRelationCalcDel.fromId!!), SFilter.eq("shaftId", manualRelationCalcDel.toId!!))
                }else if (manualRelationCalcDel.relType =="eq2fl_for"){/** 设备服务于楼层 */
                    delete = REqForFlService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("equipId", manualRelationCalcDel.fromId!!), SFilter.eq("floorId", manualRelationCalcDel.toId!!))
                }else if (manualRelationCalcDel.relType == "eq2bd_for"){/** 设备服务于建筑 */
                    delete = REqForBdService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("equipId", manualRelationCalcDel.fromId!!), SFilter.eq("buildingId", manualRelationCalcDel.toId!!))
                }else if (manualRelationCalcDel.relType == "sy2sp_for"){ /** 系统服务于业务空间 */
                    delete = RSyForSpBaseService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "sy2sh_for"){
                    /** 系统服务于竖井 */
                    delete = RSyForShService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("sysId", manualRelationCalcDel.fromId!!), SFilter.eq("shaftId", manualRelationCalcDel.toId!!))
                }else if (manualRelationCalcDel.relType == "sy2fl_for"){
                    /** 系统服务于楼层 */
                    delete = RSyForFlService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("sysId", manualRelationCalcDel.fromId!!), SFilter.eq("floorId", manualRelationCalcDel.toId!!))
                }else if (manualRelationCalcDel.relType == "sy2bd_for"){
                    /** 系统服务于建筑 */
                    delete = RSyForBdService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("sysId", manualRelationCalcDel.fromId!!), SFilter.eq("buildingId", manualRelationCalcDel.toId!!))
                }else if (manualRelationCalcDel.relType == "sp2sp_ConvectionNetwork_1"){
                        /** 空间 空气自然对流 */
                    delete = rSp2SpService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "sp2sp_ConvectionNetwork_2"){
                    /** 空间空气混合机械通风  */
                    delete = rSp2SpService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "sp2sp_ConvectionNetwork_3"){
                    /** 空气单向机械通风 */
                    delete = rSp2SpService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "sp2sp_SpaceNeighborhood_5"){
                    /** 空间连通关系  */
                    delete = rSp2SpService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id2", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "sp2sp_SpaceNeighborhood_2"){
                    /** 空间隔断有门  */
                    delete = rSp2SpService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "sp2sp_SpaceNeighborhood_4"){
                    /** 空间隔断有门窗  */
                    delete = rSp2SpService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "sp2sp_TrafficNetwork_3"){
                    /** 空间消防常关交通  */
                    delete = rSp2SpService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "sp2sp_TrafficNetwork_2"){
                    /** 空间消防常开交通  */
                    delete = rSp2SpService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "sp2sp_RadiationNetwork_1"){
                    /** 空间光照连通  */
                    delete = rSp2SpService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "sp2sp_RadiationNetwork_2"){
                    /** 空间光照透明隔断  */
                    delete = rSp2SpService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "sp2sp_SpaceNeighborhood_1"){
                    /** 空间隔断无门窗  */
                    delete = rSp2SpService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "sp2sp_TrafficNetwork_1"){
                    /** 空间普通交通  */
                    delete = rSp2SpService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "sp2sp_SpaceNeighborhood_3"){
                    /** 空间隔断有窗  */
                    delete = rSp2SpService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_HUDistribution_1"){ /** 高压变配电普通连接 */
                    /** 强电类 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                                SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_HUDistribution_2"){/** 高压变配电互备连接 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_LUDistribution_1"){/** 低压配电普通连接 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_LUDistribution_2"){/** 低压配电互备连接 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_EquipPower_1"){/** 设备常规电源 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_EquipPower_2"){/** 设备备用电源 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_EquipPower_3"){/** 系统常规电源 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_EquipPower_4"){/** 系统备用电源 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_ACAirNetwork_1"){ /** 空调送风 */
                    /** 暖通空调类 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_ACAirNetwork_3"){/** 空调排风 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_ACAirNetwork_2"){/** 空调回风 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_ChillWaterLoop_4"){/** 空调冷冻水补水 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_ChillWaterLoop_1"){/** 空调冷冻水供水 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_ChillWaterLoop_3"){/** 空调冷冻水旁通 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_ChillWaterLoop_2"){/**  空调冷冻水回水*/
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_CondWaterNetwork_1"){/** 空调冷凝水网络 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_CoolingWaterLoop_4"){/** 空调冷却水补水 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_CoolingWaterLoop_1"){/** 空调冷却水供水 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_CoolingWaterLoop_3"){/** 空调冷却水旁通 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_CoolingWaterLoop_2"){/** 空调冷却水回水 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eqFreshAirNetwork_1"){/** 新风管网 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_HeatWaterLoop_4"){/** 采暖水回水 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_HeatWaterLoop_1"){/** 采暖水供水 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_HeatWaterLoop_3"){/** 采暖水旁通 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_HeatWaterLoop_2"){/** 采暖水回水 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_VentNetwork_1"){/** 通风送风 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_VentNetwork_3"){/** 通风不确定 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_VentNetwork_2"){/** 通风排风 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_VRFNetwork_1"){/** 多联机供回制冷剂 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_SupplyWaterNetwork_1"){ /** 生活给水供水 */
                    /** 给排水类  */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_SupplyWaterNetwork_2"){/** 生活给水旁通 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_DrainingWaterNetwork_1"){/** 污水排水 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_DrainingWaterNetwork_2"){/** 污水旁通 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_DrinkingWaterNetwork_1"){/** 直饮水供水 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_DrinkingWaterNetwork_2"){/** 直饮水旁通 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_DHWNetwork_1"){/** 生活热水供水 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_DHWNetwork_2"){/** 生活热水旁通 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_GasNetwork_1"){/** 燃气供气 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_GasNetwork_2"){/** 燃气旁通 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_FireWaterNetwork_1"){/** 消防供水网络 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_FireWaterNetwork_2"){/** 消防给水旁通 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_FireVentNetwork_1"){/** 消防排烟 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_RecycleWaterNetwork_1"){/** 中水供水 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_RecycleWaterNetwork_2"){/** 中水旁通 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_SensorNetwork_1"){ /** 通信连接 */
                    /** 测控类 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_ControlRelation_1"){/** 设备控制关系 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_ControlEquipNetwork"){
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_SensorRelationship_ss2eq"){/** 传感器测量设备关系 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_ValveRelationship_vv2eq"){/** 阀门限制设备关系 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_ControlRelation_2"){ /** 系统控制关系 */
                    delete = rEq2SyService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2sy_SensorRelationship_ss2sy"){ /** 传感器测量系统关系 */
                    delete = rEq2SyService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2sy_ValveRelationship_vv2sy"){ /** 阀门限制系统关系 */
                    delete = rEq2SyService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType ==  "eq2sp_SensorRelationship_ss2sp"){/** 传感器测量空间关系 */
                    delete = rEq2SpService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType ==  "eq2sp_x"){
                    delete = rEq2SpService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!), SFilter.eq("id2", manualRelationCalcDel.toId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }

                if (delete){
                    return SBaseResponse(SResponseType.success)
                }else{
                    return  SBaseResponse(SResponseType.failure)
                }
            }else if(!manualRelationCalcDel.fromId.isNullOrEmpty()&&manualRelationCalcDel.toId.isNullOrEmpty()){

                try {
                    val relationTypeProjectService = SObjectService(SMybatisDao(RelationTypeProject::class.java))
                    val relationType = relationTypeProjectService.select(SFilter.eq("projectId", projectId!!),SFilter.eq("RelationType", manualRelationCalcDel.relType!!)).entity()
                    if (relationType!=null){
                        relationType.computingTime = time()
                        relationTypeProjectService.update(relationType)
                    }
                } catch (e: Exception) {
                    e.printStackTrace()
                }
                var delete = false
                if (manualRelationCalcDel.relType == "pe2sp"){ /** 资产所在的业务空间 */
                    delete = rPeInSpBaseService.delete(SFilter.eq("projectId", projectId!!),
                        SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "pe2sh"){/** 资产所在竖井 */
                    delete = rPeInShService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("equipId", manualRelationCalcDel.fromId!!))
                }else if (manualRelationCalcDel.relType == "eq2sh_for"){/** 设备服务于竖井 */
                    delete = rEq2ShService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("equipId", manualRelationCalcDel.fromId!!))
                }else if (manualRelationCalcDel.relType == "eq2fl_for"){/** 设备服务于楼层 */
                    delete =  rEq2FlService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("equipId", manualRelationCalcDel.fromId!!))
                }else if (manualRelationCalcDel.relType =="eq2bd_for"){/** 设备服务于建筑 */
                    delete = rEq2BdService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("equipId", manualRelationCalcDel.fromId!!))
                }else if (manualRelationCalcDel.relType == "sy2sp_for") {/** 系统服务于业务空间 */
                    delete = rSy2SpService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "sy2sh_for"){
                    /** 系统服务于竖井 */
                    delete = rSy2ShService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("sysId", manualRelationCalcDel.fromId!!))
                }else if (manualRelationCalcDel.relType == "sy2fl_for"){
                    /** 系统服务于楼层 */
                    delete = RSyForFlService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("sysId", manualRelationCalcDel.fromId!!))
                }else if (manualRelationCalcDel.relType == "sy2bd_for"){
                    delete = rSy2BdService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("sysId", manualRelationCalcDel.fromId!!))
                }else if (manualRelationCalcDel.relType == "sp2sp_ConvectionNetwork_1"){
                        /** 空间 空气自然对流 */
                    delete = rSp2SpService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "sp2sp_ConvectionNetwork_2"){
                    /** 空间空气混合机械通风  */
                    delete = rSp2SpService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "sp2sp_ConvectionNetwork_3"){
                    /** 空气单向机械通风 */
                    delete = rSp2SpService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "sp2sp_SpaceNeighborhood_5"){
                    /** 空间连通关系  */
                    delete = rSp2SpService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "sp2sp_SpaceNeighborhood_2"){
                    /** 空间隔断有门  */
                    delete = rSp2SpService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "sp2sp_SpaceNeighborhood_4"){
                    /** 空间隔断有门窗  */
                    delete = rSp2SpService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "sp2sp_TrafficNetwork_3"){
                    /** 空间消防常关交通  */
                    delete = rSp2SpService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "sp2sp_TrafficNetwork_2"){
                    /** 空间消防常开交通  */
                    delete = rSp2SpService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "sp2sp_RadiationNetwork_1"){
                    /** 空间光照连通  */
                    delete = rSp2SpService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "sp2sp_RadiationNetwork_2"){
                    /** 空间光照透明隔断  */
                    delete = rSp2SpService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "sp2sp_SpaceNeighborhood_1"){
                    /** 空间隔断无门窗  */
                    delete = rSp2SpService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "sp2sp_TrafficNetwork_1"){
                    /** 空间普通交通  */
                    delete = rSp2SpService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "sp2sp_SpaceNeighborhood_3"){
                    /** 空间隔断有窗  */
                    delete = rSp2SpService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_HUDistribution_1"){ /** 高压变配电普通连接 */
                    /** 强电类 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_HUDistribution_2"){/** 高压变配电互备连接 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_LUDistribution_1"){/** 低压配电普通连接 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_LUDistribution_2"){/** 低压配电互备连接 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_EquipPower_1"){/** 设备常规电源 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_EquipPower_2"){/** 设备备用电源 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_EquipPower_3"){/** 系统常规电源 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_EquipPower_4"){/** 系统备用电源 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_ACAirNetwork_1"){ /** 空调送风 */
                    /** 暖通空调类 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_ACAirNetwork_3"){/** 空调排风 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_ACAirNetwork_2"){/** 空调回风 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_ChillWaterLoop_4"){/** 空调冷冻水补水 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_ChillWaterLoop_1"){/** 空调冷冻水供水 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_ChillWaterLoop_3"){/** 空调冷冻水旁通 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_ChillWaterLoop_2"){/**  空调冷冻水回水*/
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_CondWaterNetwork_1"){/** 空调冷凝水网络 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_CoolingWaterLoop_4"){/** 空调冷却水补水 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_CoolingWaterLoop_1"){/** 空调冷却水供水 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_CoolingWaterLoop_3"){/** 空调冷却水旁通 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_CoolingWaterLoop_2"){/** 空调冷却水回水 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eqFreshAirNetwork_1"){/** 新风管网 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_HeatWaterLoop_4"){/** 采暖水回水 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_HeatWaterLoop_1"){/** 采暖水供水 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_HeatWaterLoop_3"){/** 采暖水旁通 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_HeatWaterLoop_2"){/** 采暖水回水 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_VentNetwork_1"){/** 通风送风 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_VentNetwork_3"){/** 通风不确定 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_VentNetwork_2"){/** 通风排风 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_VRFNetwork_1"){/** 多联机供回制冷剂 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_SupplyWaterNetwork_1"){ /** 生活给水供水 */
                    /** 给排水类  */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_SupplyWaterNetwork_2"){/** 生活给水旁通 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_DrainingWaterNetwork_1"){/** 污水排水 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_DrainingWaterNetwork_2"){/** 污水旁通 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_DrinkingWaterNetwork_1"){/** 直饮水供水 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_DrinkingWaterNetwork_2"){/** 直饮水旁通 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_DHWNetwork_1"){/** 生活热水供水 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_DHWNetwork_2"){/** 生活热水旁通 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_GasNetwork_1"){/** 燃气供气 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_GasNetwork_2"){/** 燃气旁通 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_FireWaterNetwork_1"){/** 消防供水网络 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_FireWaterNetwork_2"){/** 消防给水旁通 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_FireVentNetwork_1"){/** 消防排烟 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_RecycleWaterNetwork_1"){/** 中水供水 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_RecycleWaterNetwork_2"){/** 中水旁通 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_SensorNetwork_1"){ /** 通信连接 */
                    /** 测控类 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if(manualRelationCalcDel.relType == "eq2eq_ControlEquipNetwork"){
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_ControlRelation_1"){/** 设备控制关系 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_SensorRelationship_ss2eq"){/** 传感器测量设备关系 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_ValveRelationship_vv2eq"){/** 阀门限制设备关系 */
                    delete = rEq2EqService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2eq_ControlRelation_2"){ /** 系统控制关系 */
                    delete = rEq2SyService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2sy_SensorRelationship_ss2sy"){ /** 传感器测量系统关系 */
                    delete = rEq2SyService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2sy_ValveRelationship_vv2sy"){ /** 阀门限制系统关系 */
                    delete = rEq2SyService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType ==  "eq2sp_SensorRelationship_ss2sp"){/** 传感器测量空间关系 */
                    delete = rEq2SpService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }else if (manualRelationCalcDel.relType == "eq2sp_x"){
                    delete = rEq2SpService.delete(SFilter.eq("projectId", projectId!!),
                            SFilter.eq("id1", manualRelationCalcDel.fromId!!),SFilter.eq("type", manualRelationCalcDel.relType!!))
                }
                if (delete){
                    return SBaseResponse(SResponseType.success)
                }else{
                    return  SBaseResponse(SResponseType.failure)
                }
            }else{
                /** 主对象和从对象都不可以为空 */
                return  SBaseResponse(SResponseType.failure)
            }
        } catch (e: Exception) {
            e.printStackTrace()
            return  SBaseResponse(SResponseType.failure,e.message.toString())
        }
    } // Fun

    /**
     * 资产所在业务空间
     */
    fun queryPe2Sp(projectId: String,list: ArrayList<SFilter>,sQueryRequest: SQueryRequest,manualRelationCalcRequest: ManualRelationCalcRequest): ManualRelationCalcResponse{
        /** 资产所在业务空间 */
        val rPeInSpList = rPeInSpBaseService.select(SFilter.eq("projectId",projectId!!),SFilter.eq("type","pe2sp")).exec()
        if (rPeInSpList.size>0){
            if(manualRelationCalcRequest.objectType == "1"){
                val listId = ArrayList<String>()
                for (rPeInSp in rPeInSpList){
                    listId.add(rPeInSp.id1!!)
                }
                list.add(SFilter.inList("id",listId))
                val pageQuery = relPropertyService.pageQuery(sQueryRequest, list)
                val manualRelationCalcResponse = ManualRelationCalcResponse()
                manualRelationCalcResponse.direction = "Left"
                manualRelationCalcResponse.content = pageQuery.content
                manualRelationCalcResponse.message = pageQuery.message
                manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                manualRelationCalcResponse.pageSize = pageQuery.pageSize
                manualRelationCalcResponse.result = pageQuery.result
                manualRelationCalcResponse.total = pageQuery.total
                logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                return manualRelationCalcResponse
            }else if (manualRelationCalcRequest.objectType == "2"){
                val listId = ArrayList<String>()
                for (rPeInSp in rPeInSpList){
                    listId.add(rPeInSp.id2!!)
                }
                list.add(SFilter.inList("id",listId))

                val rPeInSpBaseLists = relZoneSpaceService.select(list).exec()
                if (rPeInSpBaseLists.size>0){
                    val listIds = ArrayList<String>()
                    for (rPeInSpBase in rPeInSpBaseLists){
                        listIds.add(rPeInSpBase.id!!)
                    }

                    val rPeInSpLists = rPeInSpBaseService.select(SFilter.eq("projectId", projectId!!), SFilter.inList("id2", listIds),SFilter.eq("type","pe2sp")).exec()

                    listIds.clear()
                    for (rPeInSp in rPeInSpLists){
                        listIds.add(rPeInSp.id1!!)
                    }

                    val listSFilter = ArrayList<SFilter>()
                    listSFilter.add(SFilter.eq("projectId",projectId))
                    listSFilter.add(SFilter.inList("id",listIds))
                    val pageQuery = relPropertyService.pageQuery(sQueryRequest, listSFilter)

                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    return manualRelationCalcResponse
                }else{
                    /** 暂无数据 */
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.result = SResponseType.success
                    manualRelationCalcResponse.content = ArrayList<RelProperty>()
                    return manualRelationCalcResponse
                }
            }
        }
        /** 暂无数据 */
        val manualRelationCalcResponse = ManualRelationCalcResponse()
        manualRelationCalcResponse.result = SResponseType.success
        manualRelationCalcResponse.content = ArrayList<RelProperty>()
        return manualRelationCalcResponse
    } // Fun

    /**
     * 资产所在竖井
     */
    fun queryPe2Sh(projectId: String,list: ArrayList<SFilter>,sQueryRequest: SQueryRequest,manualRelationCalcRequest: ManualRelationCalcRequest): ManualRelationCalcResponse {
        /** 资产所在竖井 */
        val rPeInShList = rPeInShService.select(SFilter.eq("projectId", projectId!!)).exec()
        if (rPeInShList.size>0){
            if (manualRelationCalcRequest.objectType == "1"){
                val listId = ArrayList<String>()
                for (rPeInSp in rPeInShList){
                    listId.add(rPeInSp.equipId!!)
                }
                list.add(SFilter.inList("id",listId))
                val pageQuery = relPropertyShaftService.pageQuery(sQueryRequest, list)
                val manualRelationCalcResponse = ManualRelationCalcResponse()
                manualRelationCalcResponse.direction = "Left"
                manualRelationCalcResponse.content = pageQuery.content
                manualRelationCalcResponse.message = pageQuery.message
                manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                manualRelationCalcResponse.pageSize = pageQuery.pageSize
                manualRelationCalcResponse.result = pageQuery.result
                manualRelationCalcResponse.total = pageQuery.total
                logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                return manualRelationCalcResponse

            }else if (manualRelationCalcRequest.objectType == "2"){
                val listId = ArrayList<String>()
                for (rPeInSh in rPeInShList){
                    listId.add(rPeInSh.shaftId!!)
                }
                list.add(SFilter.inList("id",listId))

                val relShaftList = relShaftService.select(list).exec()
                if (relShaftList.size>0){
                    val listIdShaft = ArrayList<String>()
                    for (relShaft in relShaftList){
                        listIdShaft.add(relShaft.id!!)
                    }
                    val rPeInShaftList = rPeInShService.select(SFilter.eq("projectId", projectId!!), SFilter.inList("shaftId", listIdShaft)).exec()
                    listIdShaft.clear()
                    for (rPeInShaftin in rPeInShaftList){
                        listIdShaft.add(rPeInShaftin.equipId!!)
                    }

                    val listSFilter = ArrayList<SFilter>()
                    listSFilter.add(SFilter.eq("projectId",projectId))
                    listSFilter.add(SFilter.inList("id",listIdShaft))
                    val pageQuery = relPropertyShaftService.pageQuery(sQueryRequest, listSFilter)

                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    return manualRelationCalcResponse
                }else {
                    /** 暂无数据 */
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.result = SResponseType.success
                    manualRelationCalcResponse.content = ArrayList<RelProperty>()
                    return manualRelationCalcResponse
                }
            }

        }
            /** 暂无数据 */
            val manualRelationCalcResponse = ManualRelationCalcResponse()
            manualRelationCalcResponse.result = SResponseType.success
            manualRelationCalcResponse.content = ArrayList<RelProperty>()
            return manualRelationCalcResponse

    } // Fun

    /**
     * 设备设施服务于竖井 eq2sh_for
     */
    fun queryEqForSh(projectId: String,list: ArrayList<SFilter>,sQueryRequest: SQueryRequest,manualRelationCalcRequest: ManualRelationCalcRequest): ManualRelationCalcResponse {
        /** 设备服务于竖井 */
        val rEqForShList = REqInShService.select(SFilter.eq("projectId", projectId)).exec()
        if (rEqForShList.size>0){

            if (manualRelationCalcRequest.objectType == "1"){

                val listId = ArrayList<String>()
                for (rPeInSp in rEqForShList){
                    listId.add(rPeInSp.equipId!!)
                }
                list.add(SFilter.inList("id",listId))
                val pageQuery = relEquipmentShaftService.pageQuery(sQueryRequest, list)
                val manualRelationCalcResponse = ManualRelationCalcResponse()
                manualRelationCalcResponse.direction = "Left"
                manualRelationCalcResponse.content = pageQuery.content
                manualRelationCalcResponse.message = pageQuery.message
                manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                manualRelationCalcResponse.pageSize = pageQuery.pageSize
                manualRelationCalcResponse.result = pageQuery.result
                manualRelationCalcResponse.total = pageQuery.total
                logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                return manualRelationCalcResponse

            }else if (manualRelationCalcRequest.objectType == "2"){
                val listId = ArrayList<String>()
                for (rPeInSh in rEqForShList){
                    listId.add(rPeInSh.shaftId!!)
                }
                list.add(SFilter.inList("id",listId))
                /** 竖井 */
                val relShaftList = relShaftService.select(list).exec()

                if (relShaftList.size>0){
                    val listIdShaft = ArrayList<String>()
                    for (relShaft in relShaftList){
                        listIdShaft.add(relShaft.id!!)
                    }
                    /** 设备服务的竖井 */
                    val rPeInShaftList = REqInShService.select(SFilter.eq("projectId", projectId!!), SFilter.inList("shaftId", listIdShaft)).exec()
                    listIdShaft.clear()
                    for (rPeInShaftin in rPeInShaftList){
                        listIdShaft.add(rPeInShaftin.equipId!!)
                    }
                    val listSFilter = ArrayList<SFilter>()
                    listSFilter.add(SFilter.eq("projectId",projectId))
                    listSFilter.add(SFilter.inList("id",listIdShaft))
                    /** 设备 */
                    val pageQuery = relEquipmentShaftService.pageQuery(sQueryRequest, listSFilter)

                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    return manualRelationCalcResponse
                }else{
                    /** 暂无数据 */
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.result = SResponseType.success
                    manualRelationCalcResponse.content = ArrayList<RelProperty>()
                    return manualRelationCalcResponse
                }
            }
        }
            /** 暂无数据 */
            val manualRelationCalcResponse = ManualRelationCalcResponse()
            manualRelationCalcResponse.result = SResponseType.success
            manualRelationCalcResponse.content = ArrayList<RelProperty>()
            return manualRelationCalcResponse
    } // Fun

    /**
     * 设备服务于楼层 eq2fl_for
     */
    fun queryEqForFl(projectId: String,list: ArrayList<SFilter>,sQueryRequest: SQueryRequest,manualRelationCalcRequest: ManualRelationCalcRequest): ManualRelationCalcResponse {
        val rEqForFlList = REqForFlService.select(SFilter.eq("projectId", projectId)).exec()
        if (rEqForFlList.size>0){

            if (manualRelationCalcRequest.objectType == "1"){
                val listId = ArrayList<String>()
                for (rPeInSp in rEqForFlList){
                    listId.add(rPeInSp.equipId!!)
                }
                list.add(SFilter.inList("id",listId))

                val pageQuery = relEquipmentFloorService.pageQuery(sQueryRequest, list)
                val manualRelationCalcResponse = ManualRelationCalcResponse()
                manualRelationCalcResponse.direction = "Left"
                manualRelationCalcResponse.content = pageQuery.content
                manualRelationCalcResponse.message = pageQuery.message
                manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                manualRelationCalcResponse.pageSize = pageQuery.pageSize
                manualRelationCalcResponse.result = pageQuery.result
                manualRelationCalcResponse.total = pageQuery.total
                logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                return manualRelationCalcResponse
            }else if (manualRelationCalcRequest.objectType == "2"){
                val listId = ArrayList<String>()
                for (rPeInSh in rEqForFlList){
                    listId.add(rPeInSh.floorId!!)
                }
                list.add(SFilter.inList("id",listId))
                val floorList = FloorService.select(list).exec()
                if (floorList.size>0){
                    val listFloorId = ArrayList<String>()
                    for (relShaft in floorList){
                        listFloorId.add(relShaft.id!!)
                    }

                    val rEqForFlList = REqForFlService.select(SFilter.eq("projectId", projectId!!), SFilter.inList("floorId", listFloorId)).exec()

                    listFloorId.clear()
                    for (rPeInShaftin in rEqForFlList){
                        listFloorId.add(rPeInShaftin.equipId!!)
                    }
                    val listSFilter = ArrayList<SFilter>()
                    listSFilter.add(SFilter.eq("projectId",projectId))
                    listSFilter.add(SFilter.inList("id",listFloorId))
                    /** 设备 */
                    val pageQuery = relEquipmentFloorService.pageQuery(sQueryRequest, listSFilter)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    return manualRelationCalcResponse
                }else{
                    /** 暂无数据 */
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.result = SResponseType.success
                    manualRelationCalcResponse.content = ArrayList<RelProperty>()
                    return manualRelationCalcResponse
                }
            }

        }
            /** 暂无数据 */
            val manualRelationCalcResponse = ManualRelationCalcResponse()
            manualRelationCalcResponse.result = SResponseType.success
            manualRelationCalcResponse.content = ArrayList<RelProperty>()
            return manualRelationCalcResponse

    }  // Fun

    /**
     * 设备服务于建筑  eq2bd_for
     */
    fun queryEqForBd(projectId: String,list: ArrayList<SFilter>,sQueryRequest: SQueryRequest,manualRelationCalcRequest: ManualRelationCalcRequest): ManualRelationCalcResponse{
        val rEqForBdList = REqForBdService.select(SFilter.eq("projectId", projectId)).exec()
        if (rEqForBdList.size>0){
            if (manualRelationCalcRequest.objectType == "1"){
                val listId = ArrayList<String>()
                for (rEqForBd in rEqForBdList){
                    listId.add(rEqForBd.id1!!)
                }
                list.add(SFilter.inList("id",listId))
                val pageQuery = relEquipmentBuildingService.pageQuery(sQueryRequest, list)
                val manualRelationCalcResponse = ManualRelationCalcResponse()
                manualRelationCalcResponse.direction = "Left"
                manualRelationCalcResponse.content = pageQuery.content
                manualRelationCalcResponse.message = pageQuery.message
                manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                manualRelationCalcResponse.pageSize = pageQuery.pageSize
                manualRelationCalcResponse.result = pageQuery.result
                manualRelationCalcResponse.total = pageQuery.total
                logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                return manualRelationCalcResponse

            }else if (manualRelationCalcRequest.objectType == "2"){
                val listId = ArrayList<String>()
                for (rEqForBd in rEqForBdList){
                    listId.add(rEqForBd.id2!!)
                }
                list.add(SFilter.inList("id",listId))
                val buildingList = BuildingService.select(list).exec()
                if (buildingList.size>0){
                    val listBuildingId = ArrayList<String>()
                    for (building in buildingList){
                        listBuildingId.add(building.id!!)
                    }

                    val rEqForBdLists = REqForBdService.select(SFilter.eq("projectId", projectId), SFilter.inList("buildingId", listBuildingId)).exec()
                    listBuildingId.clear()
                    for (rEqForBd in rEqForBdLists){
                        listBuildingId.add(rEqForBd.id1!!)
                    }
                    val listSFilter = ArrayList<SFilter>()
                    listSFilter.add(SFilter.eq("projectId",projectId))
                    listSFilter.add(SFilter.inList("id",listBuildingId))
                    /** 设备 */
                    val pageQuery = relEquipmentBuildingService.pageQuery(sQueryRequest, listSFilter)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    return manualRelationCalcResponse
                }else{
                    /** 暂无数据 */
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.result = SResponseType.success
                    manualRelationCalcResponse.content = ArrayList<RelProperty>()
                    return manualRelationCalcResponse
                }
            }
            /** 暂无数据 */
            val manualRelationCalcResponse = ManualRelationCalcResponse()
            manualRelationCalcResponse.result = SResponseType.success
            manualRelationCalcResponse.content = ArrayList<RelProperty>()
            return manualRelationCalcResponse
        }
        /** 暂无数据 */
        val manualRelationCalcResponse = ManualRelationCalcResponse()
        manualRelationCalcResponse.result = SResponseType.success
        manualRelationCalcResponse.content = ArrayList<RelProperty>()
        return manualRelationCalcResponse
    } // Fun

    /**
     * 系统服务于业务空间  sy2sp_for
     */
    fun querySyForSp(projectId: String,list: ArrayList<SFilter>,sQueryRequest: SQueryRequest,manualRelationCalcRequest: ManualRelationCalcRequest): ManualRelationCalcResponse{
        val rSyForSpBaseList = rSy2SpService.select(SFilter.eq("projectId", projectId),SFilter.eq("type", "sy2sp_for")).exec()
        if (rSyForSpBaseList.size>0){
            if (manualRelationCalcRequest.objectType == "1"){
                val listId = ArrayList<String>()
                for (rSyForSp in rSyForSpBaseList){
                    listId.add(rSyForSp.id1!!)
                }
                list.add(SFilter.inList("id",listId))
                val pageQuery = relGeneralSystemService.pageQuery(sQueryRequest, list)
                val manualRelationCalcResponse = ManualRelationCalcResponse()
                manualRelationCalcResponse.direction = "Left"
                manualRelationCalcResponse.content = pageQuery.content
                manualRelationCalcResponse.message = pageQuery.message
                manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                manualRelationCalcResponse.pageSize = pageQuery.pageSize
                manualRelationCalcResponse.result = pageQuery.result
                manualRelationCalcResponse.total = pageQuery.total
                logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                return manualRelationCalcResponse
            }else if (manualRelationCalcRequest.objectType == "2"){
                val listId = ArrayList<String>()
                for (rSyForSp in rSyForSpBaseList){
                    listId.add(rSyForSp.id2!!)
                }
                list.add(SFilter.inList("id",listId))

                val relZoneSpaceLists = relZoneSpaceService.select(list).exec()
                if (relZoneSpaceLists.size>0){
                    val listIds = ArrayList<String>()
                    for (relZoneSpace in relZoneSpaceLists){
                        listIds.add(relZoneSpace.id!!)
                    }

                    val rSyForSpBaseLists = rSy2SpService.select(SFilter.eq("projectId", projectId!!), SFilter.inList("id2", listIds),SFilter.eq("type", "sy2sp_for")).exec()
                    listIds.clear()
                    for (rSyForSp in rSyForSpBaseLists){
                        listIds.add(rSyForSp.id1!!)
                    }
                    val listSFilter = ArrayList<SFilter>()
                    listSFilter.add(SFilter.eq("projectId",projectId))
                    listSFilter.add(SFilter.inList("id",listIds))
                    val pageQuery = relGeneralSystemService.pageQuery(sQueryRequest, listSFilter)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    return manualRelationCalcResponse
                }else{
                    /** 暂无数据 */
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.result = SResponseType.success
                    manualRelationCalcResponse.content = ArrayList<RelProperty>()
                    return manualRelationCalcResponse
                }
            }
        }
        /** 暂无数据 */
        val manualRelationCalcResponse = ManualRelationCalcResponse()
        manualRelationCalcResponse.result = SResponseType.success
        manualRelationCalcResponse.content = ArrayList<RelProperty>()
        return manualRelationCalcResponse
    } // Fun

    /**
     * 系统服务于竖井 sy2sh_for
     */
    fun querySyForSh(projectId: String,list: ArrayList<SFilter>,sQueryRequest: SQueryRequest,manualRelationCalcRequest: ManualRelationCalcRequest): ManualRelationCalcResponse {

        val rSyForShList = RSyForShService.select(SFilter.eq("projectId", projectId)).exec()
        if (rSyForShList.size>0) {
            if (manualRelationCalcRequest.objectType == "1") {
                val listId = ArrayList<String>()
                for (rSyForSh in rSyForShList) {
                    listId.add(rSyForSh.sysId!!)
                }
                list.add(SFilter.inList("id", listId))
                val pageQuery = relGeneralSystemShaftService.pageQuery(sQueryRequest, list)
                val manualRelationCalcResponse = ManualRelationCalcResponse()
                manualRelationCalcResponse.direction = "Left"
                manualRelationCalcResponse.content = pageQuery.content
                manualRelationCalcResponse.message = pageQuery.message
                manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                manualRelationCalcResponse.pageSize = pageQuery.pageSize
                manualRelationCalcResponse.result = pageQuery.result
                manualRelationCalcResponse.total = pageQuery.total
                logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                return manualRelationCalcResponse

            } else if (manualRelationCalcRequest.objectType == "2") {
                val listId = ArrayList<String>()
                for (rSyForSh in rSyForShList) {
                    listId.add(rSyForSh.shaftId!!)
                }
                list.add(SFilter.inList("id", listId))
                /** 竖井 */
                val relShaftList = relShaftService.select(list).exec()

                if (relShaftList.size > 0) {
                    val listIdShaft = ArrayList<String>()
                    for (relShaft in relShaftList) {
                        listIdShaft.add(relShaft.id!!)
                    }
                    /** 系统服务的竖井 */
                    val rSyForShList = RSyForShService.select(SFilter.eq("projectId", projectId!!), SFilter.inList("shaftId", listIdShaft)).exec()
                    listIdShaft.clear()
                    for (rSyForSh in rSyForShList) {
                        listIdShaft.add(rSyForSh.sysId!!)
                    }
                    val listSFilter = ArrayList<SFilter>()
                    listSFilter.add(SFilter.eq("projectId", projectId))
                    listSFilter.add(SFilter.inList("id", listIdShaft))
                    /** 系统 */
                    val pageQuery = relGeneralSystemShaftService.pageQuery(sQueryRequest, listSFilter)

                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    return manualRelationCalcResponse
                }
                /** 暂无数据 */
                val manualRelationCalcResponse = ManualRelationCalcResponse()
                manualRelationCalcResponse.result = SResponseType.success
                manualRelationCalcResponse.content = ArrayList<RelProperty>()
                return manualRelationCalcResponse
            }
            /** 暂无数据 */
            val manualRelationCalcResponse = ManualRelationCalcResponse()
            manualRelationCalcResponse.result = SResponseType.success
            manualRelationCalcResponse.content = ArrayList<RelProperty>()
            return manualRelationCalcResponse
        }
        /** 暂无数据 */
        val manualRelationCalcResponse = ManualRelationCalcResponse()
        manualRelationCalcResponse.result = SResponseType.success
        manualRelationCalcResponse.content = ArrayList<RelProperty>()
        return manualRelationCalcResponse
    } // Fun

    /**
     * 系统服务于楼层  sy2fl_for
     */
    fun querySyForFl(projectId: String,list: ArrayList<SFilter>,sQueryRequest: SQueryRequest,manualRelationCalcRequest: ManualRelationCalcRequest): ManualRelationCalcResponse{
        val rSyForFlList = RSyForFlService.select(SFilter.eq("projectId", projectId)).exec()
        if (rSyForFlList.size>0){
            if (manualRelationCalcRequest.objectType == "1") {
                val listId = ArrayList<String>()
                for (rSyForFl in rSyForFlList) {
                    listId.add(rSyForFl.sysId!!)
                }
                list.add(SFilter.inList("id", listId))
                val pageQuery = relGeneralSystemFloorService.pageQuery(sQueryRequest, list)
                val manualRelationCalcResponse = ManualRelationCalcResponse()
                manualRelationCalcResponse.direction = "Left"
                manualRelationCalcResponse.content = pageQuery.content
                manualRelationCalcResponse.message = pageQuery.message
                manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                manualRelationCalcResponse.pageSize = pageQuery.pageSize
                manualRelationCalcResponse.result = pageQuery.result
                manualRelationCalcResponse.total = pageQuery.total
                logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                return manualRelationCalcResponse
            }else if (manualRelationCalcRequest.objectType == "2") {
                val listId = ArrayList<String>()
                for (rSyForFl in rSyForFlList) {
                    listId.add(rSyForFl.floorId!!)
                }
                list.add(SFilter.inList("id", listId))
                /** 楼层 */
                val floorList = FloorService.select(list).exec()
                if (floorList.size > 0) {
                    val listFloorId = ArrayList<String>()
                    for (relFloor in floorList) {
                        listFloorId.add(relFloor.id!!)
                    }

                    val rSyForFlList = RSyForFlService.select(SFilter.eq("projectId", projectId!!), SFilter.inList("floorId", listFloorId)).exec()

                    listFloorId.clear()
                    for (rSyForFl in rSyForFlList) {
                        listFloorId.add(rSyForFl.sysId!!)
                    }
                    val listSFilter = ArrayList<SFilter>()
                    listSFilter.add(SFilter.eq("projectId", projectId))
                    listSFilter.add(SFilter.inList("id", listFloorId))
                    /** 系统 */
                    val pageQuery = relGeneralSystemFloorService.pageQuery(sQueryRequest, listSFilter)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    return manualRelationCalcResponse
                }
            }
                /** 暂无数据 */
                val manualRelationCalcResponse = ManualRelationCalcResponse()
                manualRelationCalcResponse.result = SResponseType.success
                manualRelationCalcResponse.content = ArrayList<RelProperty>()
                return manualRelationCalcResponse
        }
        /** 暂无数据 */
        val manualRelationCalcResponse = ManualRelationCalcResponse()
        manualRelationCalcResponse.result = SResponseType.success
        manualRelationCalcResponse.content = ArrayList<RelProperty>()
        return manualRelationCalcResponse
    } // Fun

    /**
     * 系统服务于建筑 sy2bd_for
     */
    fun querySyForBd(projectId: String,list: ArrayList<SFilter>,sQueryRequest: SQueryRequest,manualRelationCalcRequest: ManualRelationCalcRequest): ManualRelationCalcResponse{
        val rSyForBdList = RSyForBdService.select(SFilter.eq("projectId", projectId)).exec()
        if (rSyForBdList.size>0){
            if (manualRelationCalcRequest.objectType == "1") {
                val listId = ArrayList<String>()
                for (rSyForBd in rSyForBdList) {
                    listId.add(rSyForBd.sysId!!)
                }
                list.add(SFilter.inList("id", listId))
                val pageQuery = relGeneralSystemBuildingService.pageQuery(sQueryRequest, list)
                val manualRelationCalcResponse = ManualRelationCalcResponse()
                manualRelationCalcResponse.direction = "Left"
                manualRelationCalcResponse.content = pageQuery.content
                manualRelationCalcResponse.message = pageQuery.message
                manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                manualRelationCalcResponse.pageSize = pageQuery.pageSize
                manualRelationCalcResponse.result = pageQuery.result
                manualRelationCalcResponse.total = pageQuery.total
                logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                return manualRelationCalcResponse
            }else if (manualRelationCalcRequest.objectType == "2"){
                val listId = ArrayList<String>()
                for (rSyForBd in rSyForBdList){
                    listId.add(rSyForBd.buildingId!!)
                }
                list.add(SFilter.inList("id",listId))
                val buildingList = BuildingService.select(list).exec()
                if (buildingList.size>0){
                    val listBuildingId = ArrayList<String>()
                    for (building in buildingList){
                        listBuildingId.add(building.id!!)
                    }
                    val rSyForBdLists = RSyForBdService.select(SFilter.eq("projectId", projectId), SFilter.inList("buildingId", listBuildingId)).exec()
                    listBuildingId.clear()
                    for (rSyForBd in rSyForBdLists){
                        listBuildingId.add(rSyForBd.sysId!!)
                    }
                    val listSFilter = ArrayList<SFilter>()
                    listSFilter.add(SFilter.eq("projectId",projectId))
                    listSFilter.add(SFilter.inList("id",listBuildingId))
                    /** 设备 */
                    val pageQuery = relGeneralSystemBuildingService.pageQuery(sQueryRequest, listSFilter)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    return manualRelationCalcResponse
                }else{
                    /** 暂无数据 */
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.result = SResponseType.success
                    manualRelationCalcResponse.content = ArrayList<RelProperty>()
                    return manualRelationCalcResponse
                }
            }
        }
        /** 暂无数据 */
        val manualRelationCalcResponse = ManualRelationCalcResponse()
        manualRelationCalcResponse.result = SResponseType.success
        manualRelationCalcResponse.content = ArrayList<RelProperty>()
        return manualRelationCalcResponse
    }

    /**
     * 空间 空气自然对流       spairconvection                              sp2sp_ConvectionNetwork_1
     * 空间空气混合机械通风    spairmixing                                   sp2sp_ConvectionNetwork_2
     * 空气单向机械通风        spairunidirectional                           sp2sp_ConvectionNetwork_3
     * 空间连通关系           spconnectedsp                                   sp2sp_SpaceNeighborhood_5
     * 空间隔断有门           spdoors                                          sp2sp_SpaceNeighborhood_2
     * 空间隔断有门窗          spdoorswind                                     sp2sp_SpaceNeighborhood_4
     * 空间消防常关交通         spfireclose                                     sp2sp_TrafficNetwork_3
     * 空间消防常开交通         spfireopen                                      sp2sp_TrafficNetwork_2
     * 空间光照连通            splightconnection                               sp2sp_RadiationNetwork_1
     * 空间光照透明隔断         splighttrans                                    sp2sp_RadiationNetwork_2
     * 空间隔断无门窗          spnotdoorswind                                   sp2sp_SpaceNeighborhood_1
     * 空间普通交通           spordinary                                         sp2sp_TrafficNetwork_1
     * 空间隔断有窗           spwind                                            sp2sp_SpaceNeighborhood_3
     */
    fun querySpAirConvection(projectId: String,list: ArrayList<SFilter>,sQueryRequest: SQueryRequest,manualRelationCalcRequest: ManualRelationCalcRequest): ManualRelationCalcResponse {

        /** 空间对象服务  空气自然对流 */
        val relZoneSpaceAirConvectionService =  SObjectService(SMybatisDao(RelZoneSpaceAirConvection::class.java))
        /** 空间 空气混合机械通风 */
        val relZoneSpaceAirMixingService =  SObjectService(SMybatisDao(RelZoneSpaceAirMixing::class.java))
        /** 空气单向机械通风 */
        val relZoneSpaceAirUnidirectionalService =  SObjectService(SMybatisDao(RelZoneSpaceAirUnidirectional::class.java))
        /** 空间连通关系 */
        val relZoneSpaceConnectedSpService =  SObjectService(SMybatisDao(RelZoneSpaceConnectedSp::class.java))
        /** 空间隔断有门 */
        val relZoneSpaceDoorsService =  SObjectService(SMybatisDao(RelZoneSpaceDoors::class.java))
        /** 空间隔断有门窗 */
        val relZoneSpaceDoorsWindService =  SObjectService(SMybatisDao(RelZoneSpaceDoorsWind::class.java))
        /** 空间消防常关交通 */
        val relZoneSpacefireCloseService =  SObjectService(SMybatisDao(RelZoneSpacefireClose::class.java))
        /** 空间消防常开交通 */
        val relZoneSpacefireOpenService =  SObjectService(SMybatisDao(RelZoneSpacefireOpen::class.java))
        /** 空间 光照连通 */
        val relZoneSpaceLightConnectionService =  SObjectService(SMybatisDao(RelZoneSpaceLightConnection::class.java))
        /** 空间光照透明隔断 */
        val relZoneSpaceLightTransService =  SObjectService(SMybatisDao(RelZoneSpaceLightTrans::class.java))
        /** 空间隔断无门窗 */
        val relZoneSpaceNotDoorsWindService =  SObjectService(SMybatisDao(RelZoneSpaceNotDoorsWind::class.java))
        /** 空间普通交通 */
        val relZoneSpaceOrdinaryService =  SObjectService(SMybatisDao(RelZoneSpaceOrdinary::class.java))
        /** 空间隔断有窗 */
        val relZoneSpaceWindService =  SObjectService(SMybatisDao(RelZoneSpaceWind::class.java))
        var type = ""
        if (manualRelationCalcRequest.relType == "sp2sp_ConvectionNetwork_1"){ /** 空间空气自然对流 */
            type = "sp2sp_ConvectionNetwork_1"
        }else if (manualRelationCalcRequest.relType == "sp2sp_ConvectionNetwork_2"){/** 空间空气混合机械通风 */
            type = "sp2sp_ConvectionNetwork_2"
        }else if (manualRelationCalcRequest.relType == "sp2sp_ConvectionNetwork_3"){/** 空气单向机械通风 */
            type = "sp2sp_ConvectionNetwork_3"
        }else if (manualRelationCalcRequest.relType == "sp2sp_SpaceNeighborhood_5"){/** 空间连通关系 */
            type = "sp2sp_SpaceNeighborhood_5"
        }else if (manualRelationCalcRequest.relType == "sp2sp_SpaceNeighborhood_2"){/** 空间隔断有门 */
            type = "sp2sp_SpaceNeighborhood_2"
        }else if (manualRelationCalcRequest.relType == "sp2sp_SpaceNeighborhood_4"){/** 空间隔断有门窗 */
            type = "sp2sp_SpaceNeighborhood_4"
        }else if (manualRelationCalcRequest.relType == "sp2sp_TrafficNetwork_3"){/** 空间消防常关交通 */
            type = "sp2sp_TrafficNetwork_3"
        }else if (manualRelationCalcRequest.relType == "sp2sp_TrafficNetwork_2"){/** 空间消防常开交通 */
            type = "sp2sp_TrafficNetwork_2"
        }else if (manualRelationCalcRequest.relType == "sp2sp_RadiationNetwork_1"){/** 空间光照连通 */
            type = "sp2sp_RadiationNetwork_1"
        }else if (manualRelationCalcRequest.relType == "sp2sp_RadiationNetwork_2"){/** 空间光照透明隔断 */
            type = "sp2sp_RadiationNetwork_2"
        }else if (manualRelationCalcRequest.relType == "sp2sp_SpaceNeighborhood_1"){/** 空间隔断无门窗 */
            type = "sp2sp_SpaceNeighborhood_1"
        }else if (manualRelationCalcRequest.relType == "sp2sp_TrafficNetwork_1"){/** 空间普通交通 */
            type = "sp2sp_TrafficNetwork_1"
        }else if (manualRelationCalcRequest.relType == "sp2sp_SpaceNeighborhood_3"){/** 空间隔断有窗 */
            type = "sp2sp_SpaceNeighborhood_3"
        }

        val select = rSp2SpService.select(SFilter.eq("projectId", projectId),SFilter.eq("type", type))
        val rSpAirConvectionList = select.exec()
        if (rSpAirConvectionList.size>0){
            if (manualRelationCalcRequest.objectType == "1") {
                val listId = ArrayList<String>()
                for (rSpAirConvection in rSpAirConvectionList) {
                    listId.add(rSpAirConvection.id1!!)
                }
                list.add(SFilter.inList("id", listId))

                if (manualRelationCalcRequest.relType == "sp2sp_ConvectionNetwork_1"){
                    /** 空间 空气自然对流 */
                    val pageQuery = relZoneSpaceAirConvectionService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "sp2sp_ConvectionNetwork_2"){
                    /** 空间 空气混合机械通风 */
                    val pageQuery = relZoneSpaceAirMixingService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "sp2sp_ConvectionNetwork_3") {
                    /** 空气单向机械通风 */
                    val pageQuery = relZoneSpaceAirUnidirectionalService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "sp2sp_SpaceNeighborhood_5") {
                    /** 空间连通关系 */
                    val pageQuery = relZoneSpaceConnectedSpService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "sp2sp_SpaceNeighborhood_2") {
                    /** 空间隔断有门 */
                    val pageQuery = relZoneSpaceDoorsService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "sp2sp_SpaceNeighborhood_4"){
                    /** 空间隔断有门窗 */
                    val pageQuery = relZoneSpaceDoorsWindService.pageQuery(sQueryRequest, list)
                    logger.debug("数据= ${pageQuery.toJson()} ***********************************************************************")
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "sp2sp_TrafficNetwork_3") {
                    /** 空间消防常关交通 */
                    val pageQuery = relZoneSpacefireCloseService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "sp2sp_TrafficNetwork_3") {
                    /** 空间消防常开交通 */
                    val pageQuery = relZoneSpacefireOpenService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "sp2sp_RadiationNetwork_1") {
                    /** 空间 光照连通 */
                    val pageQuery = relZoneSpaceLightConnectionService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "sp2sp_RadiationNetwork_2") {
                    /** 空间光照透明隔断 */
                    val pageQuery = relZoneSpaceLightTransService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "sp2sp_SpaceNeighborhood_1") {
                    /** 空间隔断无门窗 */
                    val pageQuery = relZoneSpaceNotDoorsWindService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "sp2sp_TrafficNetwork_1") {
                    /** 空间普通交通 */
                    val pageQuery = relZoneSpaceOrdinaryService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "sp2sp_SpaceNeighborhood_3"){
                    /** 空间隔断有窗 */
                    val pageQuery = relZoneSpaceWindService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }

            }else if (manualRelationCalcRequest.objectType == "2"){
                val listId = ArrayList<String>()
                for (rSpAirConvection in rSpAirConvectionList){
                    listId.add(rSpAirConvection.id2!!)
                }
                list.add(SFilter.inList("id",listId))
                val relZoneSpaceAirConvectionList = relZoneSpaceAirConvectionService.select(list).exec()
                if (relZoneSpaceAirConvectionList.size>0){
                    val listrelZoneSpaceAirId = ArrayList<String>()
                    for (relZoneSpaceAir in relZoneSpaceAirConvectionList){
                        listrelZoneSpaceAirId.add(relZoneSpaceAir.id!!)
                    }

                    var type = ""
                    if (manualRelationCalcRequest.relType == "sp2sp_ConvectionNetwork_1"){ /** 空间空气自然对流 */
                        type = "sp2sp_ConvectionNetwork_1"
                    }else if (manualRelationCalcRequest.relType == "sp2sp_ConvectionNetwork_2"){/** 空间空气混合机械通风 */
                        type = "sp2sp_ConvectionNetwork_2"
                    }else if (manualRelationCalcRequest.relType == "sp2sp_ConvectionNetwork_3"){/** 空气单向机械通风 */
                        type = "sp2sp_ConvectionNetwork_3"
                    }else if (manualRelationCalcRequest.relType == "sp2sp_SpaceNeighborhood_5"){/** 空间连通关系 */
                        type = "sp2sp_SpaceNeighborhood_5"
                    }else if (manualRelationCalcRequest.relType == "sp2sp_SpaceNeighborhood_2"){/** 空间隔断有门 */
                        type = "sp2sp_SpaceNeighborhood_2"
                    }else if (manualRelationCalcRequest.relType == "sp2sp_SpaceNeighborhood_4"){/** 空间隔断有门窗 */
                        type = "sp2sp_SpaceNeighborhood_4"
                    }else if (manualRelationCalcRequest.relType == "sp2sp_TrafficNetwork_3"){/** 空间消防常关交通 */
                        type = "sp2sp_TrafficNetwork_3"
                    }else if (manualRelationCalcRequest.relType == "sp2sp_TrafficNetwork_2"){/** 空间消防常开交通 */
                        type = "sp2sp_TrafficNetwork_2"
                    }else if (manualRelationCalcRequest.relType == "sp2sp_RadiationNetwork_1"){/** 空间光照连通 */
                        type = "sp2sp_RadiationNetwork_1"
                    }else if (manualRelationCalcRequest.relType == "sp2sp_RadiationNetwork_2"){/** 空间光照透明隔断 */
                        type = "sp2sp_RadiationNetwork_2"
                    }else if (manualRelationCalcRequest.relType == "sp2sp_SpaceNeighborhood_1"){/** 空间隔断无门窗 */
                        type = "sp2sp_SpaceNeighborhood_1"
                    }else if (manualRelationCalcRequest.relType == "sp2sp_TrafficNetwork_1"){/** 空间普通交通 */
                        type = "sp2sp_TrafficNetwork_1"
                    }else if (manualRelationCalcRequest.relType == "sp2sp_SpaceNeighborhood_3"){/** 空间隔断有窗 */
                        type = "sp2sp_SpaceNeighborhood_3"
                    }
                    val select = rSp2SpService.select(SFilter.eq("projectId", projectId), SFilter.inList("id2", listrelZoneSpaceAirId),SFilter.eq("type", type))

                    val rSpAirConvectionList = select.exec()
                    listrelZoneSpaceAirId.clear()
                    for (rSpAirConvec in rSpAirConvectionList){
                        listrelZoneSpaceAirId.add(rSpAirConvec.id1!!)
                    }
                    val listSFilter = ArrayList<SFilter>()
                    listSFilter.add(SFilter.eq("projectId",projectId))
                    listSFilter.add(SFilter.inList("id",listrelZoneSpaceAirId))
                    if (manualRelationCalcRequest.relType == "sp2sp_ConvectionNetwork_1"){
                        /** 空间 空气自然对流 */
                        val pageQuery = relZoneSpaceAirConvectionService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "sp2sp_ConvectionNetwork_2"){
                        /** 空间 空气混合机械通风 */
                        val pageQuery = relZoneSpaceAirMixingService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "sp2sp_ConvectionNetwork_3") {
                        /** 空气单向机械通风 */
                        val pageQuery = relZoneSpaceAirUnidirectionalService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "sp2sp_SpaceNeighborhood_5") {
                        /** 空间连通关系 */
                        val pageQuery = relZoneSpaceConnectedSpService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "sp2sp_SpaceNeighborhood_2") {
                        /** 空间隔断有门 */
                        val pageQuery = relZoneSpaceDoorsService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "sp2sp_SpaceNeighborhood_4") {
                        /** 空间隔断有门窗 */
                        val pageQuery = relZoneSpaceDoorsWindService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "sp2sp_TrafficNetwork_3") {
                        /** 空间消防常关交通 */
                        val pageQuery = relZoneSpacefireCloseService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "sp2sp_TrafficNetwork_2") {
                        /** 空间消防常开交通 */
                        val pageQuery = relZoneSpacefireOpenService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "sp2sp_RadiationNetwork_1") {
                        /** 空间光照连通 */
                        val pageQuery = relZoneSpaceLightConnectionService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "sp2sp_RadiationNetwork_2") {
                        /** 空间光照透明隔断 */
                        val pageQuery = relZoneSpaceLightTransService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "sp2sp_SpaceNeighborhood_1") {
                        /** 空间隔断无门窗 */
                        val pageQuery = relZoneSpaceNotDoorsWindService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "sp2sp_TrafficNetwork_1") {
                        /** 空间普通交通 */
                        val pageQuery = relZoneSpaceOrdinaryService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "sp2sp_SpaceNeighborhood_3") {
                        /** 空间隔断有窗 */
                        val pageQuery = relZoneSpaceWindService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        return manualRelationCalcResponse
                    }
                }
                /** 暂无数据 */
                val manualRelationCalcResponse = ManualRelationCalcResponse()
                manualRelationCalcResponse.result = SResponseType.success
                manualRelationCalcResponse.content = ArrayList<RelProperty>()
                return manualRelationCalcResponse
            }
        }
        /** 暂无数据 */
    val manualRelationCalcResponse = ManualRelationCalcResponse()
    manualRelationCalcResponse.result = SResponseType.success
    manualRelationCalcResponse.content = ArrayList<RelProperty>()
    return manualRelationCalcResponse
    } // Fun

    /**
     * 高压变配电普通连接    eqhubordinary        eq2eq_HUDistribution_1
     * 高压变配电互备连接    eqhubprepare         eq2eq_HUDistribution_2
     * 低压配电普通连接     eqlubordinary         eq2eq_LUDistribution_1
     * 低压配电互备连接     eqlubprepare          eq2eq_LUDistribution_2
     * 设备常规电源         eqroutinepower        eq2eq_EquipPower_1
     * 设备备用电源         eqsparepower          eq2eq_EquipPower_2
     * 系统常规电源         eqsyroutinepower      eq2eq_EquipPower_3
     * 系统备用电源         eqsysparepower        eq2eq_EquipPower_4
     */
    fun queryElectricity(projectId: String,list: ArrayList<SFilter>,sQueryRequest: SQueryRequest,manualRelationCalcRequest: ManualRelationCalcRequest): ManualRelationCalcResponse {

        /** 高压变配电普通连接 */
        val relEquipmentHubOrdinaryService =  SObjectService(SMybatisDao(RelEquipmentHubOrdinary::class.java))
        /** 高压变配电互备连接 */
        val relEquipmentHubPrepareService =  SObjectService(SMybatisDao(RelEquipmentHubPrepare::class.java))
        /** 低压配电普通连接 */
        val relEquipmentLubOrdinaryService =  SObjectService(SMybatisDao(RelEquipmentLubOrdinary::class.java))
        /** 低压配电互备连接 */
        val relEquipmentLubPrepareService =  SObjectService(SMybatisDao(RelEquipmentLubPrepare::class.java))
        /** 设备常规电源 */
        val relEquipmentRoutinePowerService =  SObjectService(SMybatisDao(RelEquipmentRoutinePower::class.java))
        /** 设备备用电源 */
        val relEquipmentSparePowerService =  SObjectService(SMybatisDao(RelEquipmentSparePower::class.java))
        /** 系统常规电源 */
        val relEquipmentSyRoutinePowerService =  SObjectService(SMybatisDao(RelEquipmentSyRoutinePower::class.java))
        /** 系统备用电源 */
        val relEquipmentSySparePowerService =  SObjectService(SMybatisDao(RelEquipmentSySparePower::class.java))
        var type = ""
        if (manualRelationCalcRequest.relType == "eq2eq_HUDistribution_1"){ /** 高压变配电普通连接 */
            type = "eq2eq_HUDistribution_1"
        }else if (manualRelationCalcRequest.relType == "eq2eq_HUDistribution_2"){/** 高压变配电互备连接 */
            type = "eq2eq_HUDistribution_2"
        }else if (manualRelationCalcRequest.relType == "eq2eq_LUDistribution_1"){/** 低压配电普通连接 */
            type = "eq2eq_LUDistribution_1"
        }else if (manualRelationCalcRequest.relType == "eq2eq_LUDistribution_2"){/** 低压配电互备连接 */
            type = "eq2eq_LUDistribution_2"
        }else if (manualRelationCalcRequest.relType == "eq2eq_EquipPower_1"){/** 设备常规电源 */
            type = "eq2eq_EquipPower_1"
        }else if (manualRelationCalcRequest.relType == "eq2eq_EquipPower_2"){/** 设备备用电源 */
            type = "eq2eq_EquipPower_2"
        }else if (manualRelationCalcRequest.relType == "eq2eq_EquipPower_3"){/** 系统常规电源 */
            type = "eq2eq_EquipPower_3"
        }else if (manualRelationCalcRequest.relType == "eq2eq_EquipPower_4"){/** 系统备用电源 */
            type = "eq2eq_EquipPower_4"
        }

        val select = rEq2EqService.select(SFilter.eq("projectId", projectId),SFilter.eq("type", type))
        val rSpAirConvectionList = select.exec()
        if (rSpAirConvectionList.size>0){
            if (manualRelationCalcRequest.objectType == "1") {
                val listId = ArrayList<String>()
                for (rSpAirConvection in rSpAirConvectionList) {
                    listId.add(rSpAirConvection.id1!!)
                }
                list.add(SFilter.inList("id", listId))
                if (manualRelationCalcRequest.relType == "eq2eq_HUDistribution_1"){
                    /** 高压变配电普通连接 */
                    val pageQuery = relEquipmentHubOrdinaryService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_HUDistribution_2"){
                    /** 高压变配电互备连接 */
                    val pageQuery = relEquipmentHubPrepareService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_LUDistribution_1"){
                    /** 低压配电普通连接 */
                    val pageQuery = relEquipmentLubOrdinaryService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_LUDistribution_2"){
                    /** 低压配电互备连接 */
                    val pageQuery = relEquipmentLubPrepareService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_EquipPower_1"){
                    /** 设备常规电源 */
                    val pageQuery = relEquipmentRoutinePowerService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_EquipPower_2"){
                    /** 设备备用电源 */
                    val pageQuery = relEquipmentSparePowerService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_EquipPower_3"){
                    /** 系统常规电源 */
                    val pageQuery = relEquipmentSyRoutinePowerService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_EquipPower_4"){
                    /** 系统备用电源 */
                    val pageQuery = relEquipmentSySparePowerService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }

            }else if (manualRelationCalcRequest.objectType == "2"){
                val listId = ArrayList<String>()
                for (rSpAirConvection in rSpAirConvectionList){
                    listId.add(rSpAirConvection.id2!!)
                }
                list.add(SFilter.inList("id",listId))
                val relZoneSpaceAirConvectionList = EquipmentService.select(list).exec()
                if (relZoneSpaceAirConvectionList.size>0){
                    val listrelZoneSpaceAirId = ArrayList<String>()
                    for (relZoneSpaceAir in relZoneSpaceAirConvectionList){
                        listrelZoneSpaceAirId.add(relZoneSpaceAir.id!!)
                    }

                    var type = ""
                    if (manualRelationCalcRequest.relType == "eq2eq_HUDistribution_1"){ /** 高压变配电普通连接 */
                        type = "eq2eq_HUDistribution_1"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_HUDistribution_2"){/** 高压变配电互备连接 */
                        type = "eq2eq_HUDistribution_2"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_LUDistribution_1"){/** 低压配电普通连接 */
                        type = "eq2eq_LUDistribution_1"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_LUDistribution_2"){/** 低压配电互备连接 */
                        type = "eq2eq_LUDistribution_2"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_EquipPower_1"){/** 设备常规电源 */
                        type = "eq2eq_EquipPower_1"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_EquipPower_2"){/** 设备备用电源 */
                        type = "eq2eq_EquipPower_2"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_EquipPower_3"){/** 系统常规电源 */
                        type = "eq2eq_EquipPower_3"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_EquipPower_4"){/** 系统备用电源 */
                        type = "eq2eq_EquipPower_4"
                    }
                    val select = rEq2EqService.select(SFilter.eq("projectId", projectId), SFilter.inList("id2", listrelZoneSpaceAirId),SFilter.eq("type", type))

                    val rSpAirConvectionList = select.exec()
                    listrelZoneSpaceAirId.clear()
                    for (rSpAirConvec in rSpAirConvectionList){
                        listrelZoneSpaceAirId.add(rSpAirConvec.id1!!)
                    }
                    val listSFilter = ArrayList<SFilter>()
                    listSFilter.add(SFilter.eq("projectId",projectId))
                    listSFilter.add(SFilter.inList("id",listrelZoneSpaceAirId))
                    if (manualRelationCalcRequest.relType == "eq2eq_HUDistribution_1"){
                        /** 高压变配电普通连接 */
                        val pageQuery = relEquipmentHubOrdinaryService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_HUDistribution_2"){
                        /** 高压变配电互备连接 */
                        val pageQuery = relEquipmentHubPrepareService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_LUDistribution_1"){
                        /** 低压配电普通连接 */
                        val pageQuery = relEquipmentLubOrdinaryService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_LUDistribution_2"){
                        /** 低压配电互备连接 */
                        val pageQuery = relEquipmentLubPrepareService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_EquipPower_1"){
                        /** 设备常规电源 */
                        val pageQuery = relEquipmentRoutinePowerService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_EquipPower_2"){
                        /** 设备备用电源 */
                        val pageQuery = relEquipmentSparePowerService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_EquipPower_3"){
                        /** 系统常规电源 */
                        val pageQuery = relEquipmentSyRoutinePowerService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_EquipPower_4"){/** 系统备用电源 */
                        val pageQuery = relEquipmentSySparePowerService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        return manualRelationCalcResponse
                    }
                }
                /** 暂无数据 */
                val manualRelationCalcResponse = ManualRelationCalcResponse()
                manualRelationCalcResponse.result = SResponseType.success
                manualRelationCalcResponse.content = ArrayList<RelProperty>()
                return manualRelationCalcResponse
            }
        }
        /** 暂无数据 */
        val manualRelationCalcResponse = ManualRelationCalcResponse()
        manualRelationCalcResponse.result = SResponseType.success
        manualRelationCalcResponse.content = ArrayList<RelProperty>()
        return manualRelationCalcResponse
    } // Fun

    /**
     *  暖通空调类
     *  空调送风             eq2eq_ACAirNetwork_1              eq2eq_ACAirNetwork_1
     *  空调排风             eq2eq_ACAirNetwork_3            eq2eq_ACAirNetwork_3
     *  空调回风             eq2eq_ACAirNetwork_2              eq2eq_ACAirNetwork_2
     * 空调冷冻水补水         eq2eq_ChillWaterLoop_4            eq2eq_ChillWaterLoop_4
     * 空调冷冻水供水         eq2eq_ChillWaterLoop_1              eq2eq_ChillWaterLoop_1
     * 空调冷冻水旁通          eq2eq_ChillWaterLoop_3           eq2eq_ChillWaterLoop_3
     * 空调冷冻水回水       eq2eq_ChillWaterLoop_2                eq2eq_ChillWaterLoop_2
     * 空调冷凝水排水       eq2eq_CondWaterNetwork_1                 eq2eq_CondWaterNetwork_1
     * 空调冷却水补水       eq2eq_CoolingWaterLoop_4             eq2eq_CoolingWaterLoop_4
     *  空调冷却水供水      eq2eq_CoolingWaterLoop_1              eq2eq_CoolingWaterLoop_1
     *  空调冷却水旁通      eq2eq_CoolingWaterLoop_3            eq2eq_CoolingWaterLoop_3
     *  空调冷却水回水      eq2eq_CoolingWaterLoop_2              eq2eq_CoolingWaterLoop_2
     *  新风送风           eq2eqFreshAirNetwork_1                eq2eqFreshAirNetwork_1
     *  采暖水补水          eq2eq_HeatWaterLoop_4                  eq2eq_HeatWaterLoop_4
     *  采暖水供水          eq2eq_HeatWaterLoop_1                   eq2eq_HeatWaterLoop_1
     *  采暖水旁通          eq2eq_HeatWaterLoop_3                 eq2eq_HeatWaterLoop_3
     *  采暖水回水           eq2eq_HeatWaterLoop_2                  eq2eq_HeatWaterLoop_2
     *  通风送风             eq2eq_VentNetwork_1                   eq2eq_VentNetwork_1
     *  通风不确定           eq2eq_VentNetwork_3                  eq2eq_VentNetwork_3
     *  通风排风             eq2eq_VentNetwork_2                   eq2eq_VentNetwork_2
     *  多联机供回制冷剂      eq2eq_VRFNetwork_1                   eq2eq_VRFNetwork_1
     */
    fun  hvac(projectId: String,list: ArrayList<SFilter>,sQueryRequest: SQueryRequest,manualRelationCalcRequest: ManualRelationCalcRequest): ManualRelationCalcResponse {
        /** 高压变配电普通连接 */
        val relEquipmentAcAirNetworkOneService =  SObjectService(SMybatisDao(RelEquipmentAcAirNetworkOne::class.java))
        val relEquipmenteq2eq_ACAirNetwork_3Service =  SObjectService(SMybatisDao(RelEquipmentAcAirNetworkThree::class.java))
        val relEquipmentAcAirNetworkTwoService =  SObjectService(SMybatisDao(RelEquipmentAcAirNetworkTwo::class.java))
        val relEquipmentChillWaterLoopFourService =  SObjectService(SMybatisDao(RelEquipmentChillWaterLoopFour::class.java))
        val relEquipmentChillWaterLoopOneService =  SObjectService(SMybatisDao(RelEquipmentChillWaterLoopOne::class.java))
        val relEquipmentChillWaterLoopThreeService =  SObjectService(SMybatisDao(RelEquipmentChillWaterLoopThree::class.java))
        val relEquipmentChillWaterLoopTwoService =  SObjectService(SMybatisDao(RelEquipmentChillWaterLoopTwo::class.java))
        val relEquipmentCondWaterNetworkService =  SObjectService(SMybatisDao(RelEquipmentCondWaterNetwork::class.java))
        val RelEquipmentCoolingWaterLoopFourService =  SObjectService(SMybatisDao(RelEquipmentCoolingWaterLoopFour::class.java))
        val relEquipmentCoolingWaterLoopOneService =  SObjectService(SMybatisDao(RelEquipmentCoolingWaterLoopOne::class.java))
        val relEquipmentCoolingWaterLoopThreeService =  SObjectService(SMybatisDao(RelEquipmentCoolingWaterLoopThree::class.java))
        val relEquipmentCoolingWaterLoopTwoService =  SObjectService(SMybatisDao(RelEquipmentCoolingWaterLoopTwo::class.java))
        val relEquipmentFreshAirNetworkOneService =  SObjectService(SMybatisDao(RelEquipmentFreshAirNetworkOne::class.java))
        val relEquipmentHeatWaterLoopFourService =  SObjectService(SMybatisDao(RelEquipmentHeatWaterLoopFour::class.java))
        val relEquipmentHeatWaterLoopOneService =  SObjectService(SMybatisDao(RelEquipmentHeatWaterLoopOne::class.java))
        val relEquipmentHeatWaterLoopThreeService =  SObjectService(SMybatisDao(RelEquipmentHeatWaterLoopThree::class.java))
        val relEquipmentHeatWaterLoopTwoService =  SObjectService(SMybatisDao(RelEquipmentHeatWaterLoopTwo::class.java))
        val relEquipmentVentNetworkOneService =  SObjectService(SMybatisDao(RelEquipmentVentNetworkOne::class.java))
        val relEquipmentVentNetworkThreeService =  SObjectService(SMybatisDao(RelEquipmentVentNetworkThree::class.java))
        val relEquipmentVentNetworkTwoService =  SObjectService(SMybatisDao(RelEquipmentVentNetworkTwo::class.java))
        val relEquipmentVrfNetworkOneService =  SObjectService(SMybatisDao(RelEquipmentVrfNetworkOne::class.java))
        var type = ""
        if (manualRelationCalcRequest.relType == "eq2eq_ACAirNetwork_1"){ /** 空调送风 */
            type = "eq2eq_ACAirNetwork_1"
        }else if (manualRelationCalcRequest.relType == "eq2eq_ACAirNetwork_3"){/** 空调排风 */
            type = "eq2eq_ACAirNetwork_3"
        }else if (manualRelationCalcRequest.relType == "eq2eq_ACAirNetwork_2"){/** 空调回风 */
            type = "eq2eq_ACAirNetwork_2"
        }else if (manualRelationCalcRequest.relType == "eq2eq_ChillWaterLoop_4"){/** 空调冷冻水补水 */
            type = "eq2eq_ChillWaterLoop_4"
        }else if (manualRelationCalcRequest.relType == "eq2eq_ChillWaterLoop_1"){/** 空调冷冻水供水 */
            type = "eq2eq_ChillWaterLoop_1"
        }else if (manualRelationCalcRequest.relType == "eq2eq_ChillWaterLoop_3"){/** 空调冷冻水旁通 */
            type = "eq2eq_ChillWaterLoop_3"
        }else if (manualRelationCalcRequest.relType == "eq2eq_ChillWaterLoop_2"){/**  空调冷冻水回水*/
            type = "eq2eq_ChillWaterLoop_2"
        }else if (manualRelationCalcRequest.relType == "eq2eq_CondWaterNetwork_1"){/** 空调冷凝水网络 */
            type = "eq2eq_CondWaterNetwork_1"
        }else if (manualRelationCalcRequest.relType == "eq2eq_CoolingWaterLoop_4"){/** 空调冷却水补水 */
            type = "eq2eq_CoolingWaterLoop_4"
        }else if (manualRelationCalcRequest.relType == "eq2eq_CoolingWaterLoop_1"){/** 空调冷却水供水 */
            type = "eq2eq_CoolingWaterLoop_1"
        }else if (manualRelationCalcRequest.relType == "eq2eq_CoolingWaterLoop_3"){/** 空调冷却水旁通 */
            type = "eq2eq_CoolingWaterLoop_3"
        }else if (manualRelationCalcRequest.relType == "eq2eq_CoolingWaterLoop_2"){/** 空调冷却水回水 */
            type = "eq2eq_CoolingWaterLoop_2"
        }else if (manualRelationCalcRequest.relType == "eq2eqFreshAirNetwork_1"){/** 新风管网 */
            type = "eq2eqFreshAirNetwork_1"
        }else if (manualRelationCalcRequest.relType == "eq2eq_HeatWaterLoop_4"){/** 采暖水回水 */
            type = "eq2eq_HeatWaterLoop_4"
        }else if (manualRelationCalcRequest.relType == "eq2eq_HeatWaterLoop_1"){/** 采暖水供水 */
            type = "eq2eq_HeatWaterLoop_1"
        }else if (manualRelationCalcRequest.relType == "eq2eq_HeatWaterLoop_3"){/** 采暖水旁通 */
            type = "eq2eq_HeatWaterLoop_3"
        }else if (manualRelationCalcRequest.relType == "eq2eq_HeatWaterLoop_2"){/** 采暖水回水 */
            type = "eq2eq_HeatWaterLoop_2"
        }else if (manualRelationCalcRequest.relType == "eq2eq_VentNetwork_1"){/** 通风送风 */
            type = "eq2eq_VentNetwork_1"
        }else if (manualRelationCalcRequest.relType == "eq2eq_VentNetwork_3"){/** 通风不确定 */
            type = "eq2eq_VentNetwork_3"
        }else if (manualRelationCalcRequest.relType == "eq2eq_VentNetwork_2"){/** 通风排风 */
            type = "eq2eq_VentNetwork_2"
        }else if (manualRelationCalcRequest.relType == "eq2eq_VRFNetwork_1"){/** 多联机供回制冷剂 */
            type = "eq2eq_VRFNetwork_1"
        }


        val select = rEq2EqService.select(SFilter.eq("projectId", projectId),SFilter.eq("type", type))

        val rSpAirConvectionList = select.exec()
        if (rSpAirConvectionList.size>0){
            if (manualRelationCalcRequest.objectType == "1") {
                val listId = ArrayList<String>()
                for (rSpAirConvection in rSpAirConvectionList) {
                    listId.add(rSpAirConvection.id1!!)
                }
                list.add(SFilter.inList("id", listId))
                if (manualRelationCalcRequest.relType == "eq2eq_ACAirNetwork_1"){ /** 空调送风 */
                    /** 空调送风 */
                    val pageQuery = relEquipmentAcAirNetworkOneService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_ACAirNetwork_3"){/** 空调排风 */
                    /** 空调回风 */
                    val pageQuery = relEquipmenteq2eq_ACAirNetwork_3Service.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_ACAirNetwork_2"){
                   /** 空调回风 */
                   val pageQuery = relEquipmentAcAirNetworkTwoService.pageQuery(sQueryRequest, list)
                   val manualRelationCalcResponse = ManualRelationCalcResponse()
                   manualRelationCalcResponse.direction = "Left"
                   manualRelationCalcResponse.content = pageQuery.content
                   manualRelationCalcResponse.message = pageQuery.message
                   manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                   manualRelationCalcResponse.pageSize = pageQuery.pageSize
                   manualRelationCalcResponse.result = pageQuery.result
                   manualRelationCalcResponse.total = pageQuery.total
                   logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                   return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_ChillWaterLoop_4"){/** 空调冷冻水补水 */
                    val pageQuery = relEquipmentChillWaterLoopFourService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_ChillWaterLoop_1"){/** 空调冷冻水供水 */
                    val pageQuery = relEquipmentChillWaterLoopOneService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_ChillWaterLoop_3"){/** 空调冷冻水旁通 */
                    val pageQuery = relEquipmentChillWaterLoopThreeService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_ChillWaterLoop_2"){/**  空调冷冻水回水*/
                    val pageQuery = relEquipmentChillWaterLoopTwoService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_CondWaterNetwork_1"){/** 空调冷凝水网络 */
                val pageQuery = relEquipmentCondWaterNetworkService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_CoolingWaterLoop_4"){/** 空调冷却水补水 */
                    val pageQuery = RelEquipmentCoolingWaterLoopFourService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_CoolingWaterLoop_1"){/** 空调冷却水供水 */
                    val pageQuery = relEquipmentCoolingWaterLoopOneService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_CoolingWaterLoop_3"){/** 空调冷却水旁通 */
                    val pageQuery = relEquipmentCoolingWaterLoopThreeService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_CoolingWaterLoop_2"){/** 空调冷却水回水 */
                    val pageQuery = relEquipmentCoolingWaterLoopTwoService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eqFreshAirNetwork_1"){/** 新风管网 */
                    val pageQuery = relEquipmentFreshAirNetworkOneService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_HeatWaterLoop_4"){/** 采暖水回水 */
                    val pageQuery = relEquipmentHeatWaterLoopFourService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_HeatWaterLoop_1"){/** 采暖水供水 */
                    val pageQuery = relEquipmentHeatWaterLoopOneService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_HeatWaterLoop_3"){/** 采暖水旁通 */
                    val pageQuery = relEquipmentHeatWaterLoopThreeService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_HeatWaterLoop_2"){/** 采暖水回水 */
                    val pageQuery = relEquipmentHeatWaterLoopTwoService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_VentNetwork_1"){/** 通风送风 */
                    val pageQuery = relEquipmentVentNetworkOneService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_VentNetwork_3"){/** 通风不确定 */
                    val pageQuery = relEquipmentVentNetworkThreeService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_VentNetwork_2"){/** 通风排风 */

                    val pageQuery = relEquipmentVentNetworkTwoService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_VRFNetwork_1"){/** 多联机供回制冷剂 */
                    val pageQuery = relEquipmentVrfNetworkOneService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }

            }else if (manualRelationCalcRequest.objectType == "2"){
                val listId = ArrayList<String>()
                for (rSpAirConvection in rSpAirConvectionList){
                    listId.add(rSpAirConvection.id2!!)
                }
                list.add(SFilter.inList("id",listId))
                val relZoneSpaceAirConvectionList = EquipmentService.select(list).exec()
                if (relZoneSpaceAirConvectionList.size>0){
                    val listrelZoneSpaceAirId = ArrayList<String>()
                    for (relZoneSpaceAir in relZoneSpaceAirConvectionList){
                        listrelZoneSpaceAirId.add(relZoneSpaceAir.id!!)
                    }

                    var type = ""
                    if (manualRelationCalcRequest.relType == "eq2eq_ACAirNetwork_1"){ /** 空调送风 */
                        type = "eq2eq_ACAirNetwork_1"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_ACAirNetwork_3"){/** 空调排风 */
                        type = "eq2eq_ACAirNetwork_3"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_ACAirNetwork_2"){/** 空调回风 */
                        type = "eq2eq_ACAirNetwork_2"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_ChillWaterLoop_4"){/** 空调冷冻水补水 */
                        type = "eq2eq_ChillWaterLoop_4"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_ChillWaterLoop_1"){/** 空调冷冻水供水 */
                        type = "eq2eq_ChillWaterLoop_1"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_ChillWaterLoop_3"){/** 空调冷冻水旁通 */
                        type = "eq2eq_ChillWaterLoop_3"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_ChillWaterLoop_2"){/**  空调冷冻水回水*/
                        type = "eq2eq_ChillWaterLoop_2"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_CondWaterNetwork_1"){/** 空调冷凝水网络 */
                        type = "eq2eq_CondWaterNetwork_1"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_CoolingWaterLoop_4"){/** 空调冷却水补水 */
                        type = "eq2eq_CoolingWaterLoop_4"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_CoolingWaterLoop_1"){/** 空调冷却水供水 */
                        type = "eq2eq_CoolingWaterLoop_1"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_CoolingWaterLoop_3"){/** 空调冷却水旁通 */
                        type = "eq2eq_CoolingWaterLoop_3"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_CoolingWaterLoop_2"){/** 空调冷却水回水 */
                        type = "eq2eq_CoolingWaterLoop_2"
                    }else if (manualRelationCalcRequest.relType == "eq2eqFreshAirNetwork_1"){/** 新风管网 */
                        type = "eq2eqFreshAirNetwork_1"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_HeatWaterLoop_4"){/** 采暖水回水 */
                        type = "eq2eq_HeatWaterLoop_4"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_HeatWaterLoop_1"){/** 采暖水供水 */
                        type = "eq2eq_HeatWaterLoop_1"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_HeatWaterLoop_3"){/** 采暖水旁通 */
                        type = "eq2eq_HeatWaterLoop_3"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_HeatWaterLoop_2"){/** 采暖水回水 */
                        type = "eq2eq_HeatWaterLoop_2"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_VentNetwork_1"){/** 通风送风 */
                        type = "eq2eq_VentNetwork_1"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_VentNetwork_3"){/** 通风不确定 */
                        type = "eq2eq_VentNetwork_3"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_VentNetwork_2"){/** 通风排风 */
                        type = "eq2eq_VentNetwork_2"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_VRFNetwork_1"){/** 多联机供回制冷剂 */
                        type = "eq2eq_VRFNetwork_1"
                    }
                    val select = rEq2EqService.select(SFilter.eq("projectId", projectId), SFilter.inList("id2", listrelZoneSpaceAirId),SFilter.eq("type", type))

                    val rSpAirConvectionList = select.exec()
                    listrelZoneSpaceAirId.clear()
                    for (rSpAirConvec in rSpAirConvectionList){
                        listrelZoneSpaceAirId.add(rSpAirConvec.id1!!)
                    }
                    val listSFilter = ArrayList<SFilter>()
                    listSFilter.add(SFilter.eq("projectId",projectId))
                    listSFilter.add(SFilter.inList("id",listrelZoneSpaceAirId))
                    if (manualRelationCalcRequest.relType == "eq2eq_ACAirNetwork_1"){ /** 空调送风 */
                        /** 空调送风 */
                        val pageQuery = relEquipmentAcAirNetworkOneService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_ACAirNetwork_3"){/** 空调排风 */
                        /** 空调回风 */
                        val pageQuery = relEquipmenteq2eq_ACAirNetwork_3Service.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_ACAirNetwork_2"){
                        /** 空调回风 */
                        val pageQuery = relEquipmentAcAirNetworkTwoService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_ChillWaterLoop_4"){/** 空调冷冻水补水 */
                    val pageQuery = relEquipmentChillWaterLoopFourService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_ChillWaterLoop_1"){/** 空调冷冻水供水 */
                    val pageQuery = relEquipmentChillWaterLoopOneService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_ChillWaterLoop_3"){/** 空调冷冻水旁通 */
                    val pageQuery = relEquipmentChillWaterLoopThreeService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_ChillWaterLoop_2"){/**  空调冷冻水回水*/
                    val pageQuery = relEquipmentChillWaterLoopTwoService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_CondWaterNetwork_1"){/** 空调冷凝水网络 */
                    val pageQuery = relEquipmentCondWaterNetworkService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_CoolingWaterLoop_4"){/** 空调冷却水补水 */
                    val pageQuery = RelEquipmentCoolingWaterLoopFourService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_CoolingWaterLoop_1"){/** 空调冷却水供水 */
                    val pageQuery = relEquipmentCoolingWaterLoopOneService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_CoolingWaterLoop_3"){/** 空调冷却水旁通 */
                    val pageQuery = relEquipmentCoolingWaterLoopThreeService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_CoolingWaterLoop_2"){/** 空调冷却水回水 */
                    val pageQuery = relEquipmentCoolingWaterLoopTwoService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eqFreshAirNetwork_1"){/** 新风管网 */
                    val pageQuery = relEquipmentFreshAirNetworkOneService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_HeatWaterLoop_4"){/** 采暖水回水 */
                    val pageQuery = relEquipmentHeatWaterLoopFourService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_HeatWaterLoop_1"){/** 采暖水供水 */
                    val pageQuery = relEquipmentHeatWaterLoopOneService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_HeatWaterLoop_3"){/** 采暖水旁通 */
                    val pageQuery = relEquipmentHeatWaterLoopThreeService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_HeatWaterLoop_2"){/** 采暖水回水 */
                    val pageQuery = relEquipmentHeatWaterLoopTwoService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_VentNetwork_1"){/** 通风送风 */
                    val pageQuery = relEquipmentVentNetworkOneService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_VentNetwork_3"){/** 通风不确定 */
                    val pageQuery = relEquipmentVentNetworkThreeService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_VentNetwork_2"){/** 通风排风 */

                    val pageQuery = relEquipmentVentNetworkTwoService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_VRFNetwork_1"){/** 多联机供回制冷剂 */
                    val pageQuery = relEquipmentVrfNetworkOneService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }
                }
                /** 暂无数据 */
                val manualRelationCalcResponse = ManualRelationCalcResponse()
                manualRelationCalcResponse.result = SResponseType.success
                manualRelationCalcResponse.content = ArrayList<RelProperty>()
                return manualRelationCalcResponse
            }
        }
        /** 暂无数据 */
        val manualRelationCalcResponse = ManualRelationCalcResponse()
        manualRelationCalcResponse.result = SResponseType.success
        manualRelationCalcResponse.content = ArrayList<RelProperty>()
        return manualRelationCalcResponse
    } // Fun hvac()

    /**
     * 给排水类
     * 生活给水供水      eq2eq_SupplyWaterNetwork_1
     * 生活给水旁通      eq2eq_SupplyWaterNetwork_2
     * 污水排水          eq2eq_DrainingWaterNetwork_1
     * 污水旁通         eq2eq_DrainingWaterNetwork_2
     *  中水供水         eq2eq_RecycleWaterNetwork_1
     *  中水旁通        eq2eq_RecycleWaterNetwork_2
     *  直饮水供水       eq2eq_DrinkingWaterNetwork_1
     *  直饮水旁通       eq2eq_DrinkingWaterNetwork_2
     *  生活热水供水      eq2eq_DHWNetwork_1
     *  生活热水旁通      eq2eq_DHWNetwork_2
     *  燃气供气           eq2eq_GasNetwork_1
     *  燃气旁通           eq2eq_GasNetwork_2
     *  消防类
     *  消防给水供水         eq2eq_FireWaterNetwork_1
     *  消防给水旁通         eq2eq_FireWaterNetwork_2
     *  消防排烟            eq2eq_FireVentNetwork_1
     */
    fun drainage(projectId: String,list: ArrayList<SFilter>,sQueryRequest: SQueryRequest,manualRelationCalcRequest: ManualRelationCalcRequest): ManualRelationCalcResponse {
        val relEquipmentDHWNetworkOneService =  SObjectService(SMybatisDao(RelEquipmentDHWNetworkOne::class.java))
        val relEquipmentDHWNetworkTwoService =  SObjectService(SMybatisDao(RelEquipmentDHWNetworkTwo::class.java))
        val relEquipmentDrainingWaterNetworkOneService =  SObjectService(SMybatisDao(RelEquipmentDrainingWaterNetworkOne::class.java))
        val relEquipmentDrainingWaterNetworkTwoService =  SObjectService(SMybatisDao(RelEquipmentDrainingWaterNetworkTwo::class.java))
        val relEquipmentDrinkingWaterNetworkOneService =  SObjectService(SMybatisDao(RelEquipmentDrinkingWaterNetworkOne::class.java))
        val relEquipmentDrinkingWaterNetworkTwoService =  SObjectService(SMybatisDao(RelEquipmentDrinkingWaterNetworkTwo::class.java))
        val relEquipmentFireVentNetworkOneService =  SObjectService(SMybatisDao(RelEquipmentFireVentNetworkOne::class.java))
        val relEquipmentFireWaterNetworkOneService =  SObjectService(SMybatisDao(RelEquipmentFireWaterNetworkOne::class.java))
        val relEquipmentFireWaterNetworkTwoService =  SObjectService(SMybatisDao(RelEquipmentFireWaterNetworkTwo::class.java))
        val relEquipmentGasNetworkOneService =  SObjectService(SMybatisDao(RelEquipmentGasNetworkOne::class.java))
        val relEquipmentGasNetworkTwoService =  SObjectService(SMybatisDao(RelEquipmentGasNetworkTwo::class.java))
        val relEquipmentRecycleWaterNetworkOneService =  SObjectService(SMybatisDao(RelEquipmentRecycleWaterNetworkOne::class.java))
        val relEquipmentRecycleWaterNetworkTwoService =  SObjectService(SMybatisDao(RelEquipmentRecycleWaterNetworkTwo::class.java))
        val relEquipmentSupplyWaterNetworkOneService =  SObjectService(SMybatisDao(RelEquipmentSupplyWaterNetworkOne::class.java))
        val relEquipmentSupplyWaterNetworkTwoService =  SObjectService(SMybatisDao(RelEquipmentSupplyWaterNetworkTwo::class.java))
        var type = ""
        if (manualRelationCalcRequest.relType == "eq2eq_SupplyWaterNetwork_1"){ /** 生活给水供水 */
            type = "eq2eq_SupplyWaterNetwork_1"
        }else if (manualRelationCalcRequest.relType == "eq2eq_SupplyWaterNetwork_2"){/** 生活给水旁通 */
            type = "eq2eq_SupplyWaterNetwork_2"
        }else if (manualRelationCalcRequest.relType == "eq2eq_DrainingWaterNetwork_1"){/** 污水排水 */
            type = "eq2eq_DrainingWaterNetwork_1"
        }else if (manualRelationCalcRequest.relType == "eq2eq_DrainingWaterNetwork_2"){/** 污水旁通 */
            type = "eq2eq_DrainingWaterNetwork_2"
        }else if (manualRelationCalcRequest.relType == "eq2eq_DrinkingWaterNetwork_1"){/** 直饮水供水 */
            type = "eq2eq_DrinkingWaterNetwork_1"
        }else if (manualRelationCalcRequest.relType == "eq2eq_DrinkingWaterNetwork_2"){/** 直饮水旁通 */
            type = "eq2eq_DrinkingWaterNetwork_2"
        }else if (manualRelationCalcRequest.relType == "eq2eq_DHWNetwork_1"){/** 生活热水供水 */
            type = "eq2eq_DHWNetwork_1"
        }else if (manualRelationCalcRequest.relType == "eq2eq_DHWNetwork_2"){/** 生活热水旁通 */
            type = "eq2eq_DHWNetwork_2"
        }else if (manualRelationCalcRequest.relType == "eq2eq_GasNetwork_1"){/** 燃气供气 */
            type = "eq2eq_GasNetwork_1"
        }else if (manualRelationCalcRequest.relType == "eq2eq_GasNetwork_2"){/** 燃气旁通 */
            type = "eq2eq_GasNetwork_2"
        }else if (manualRelationCalcRequest.relType == "eq2eq_FireWaterNetwork_1"){/** 消防供水网络 */
            type = "eq2eq_FireWaterNetwork_1"
        }else if (manualRelationCalcRequest.relType == "eq2eq_FireWaterNetwork_2"){/** 消防给水旁通 */
            type = "eq2eq_FireWaterNetwork_2"
        }else if (manualRelationCalcRequest.relType == "eq2eq_FireVentNetwork_1"){/** 消防排烟 */
            type = "eq2eq_FireVentNetwork_1"
        }else if (manualRelationCalcRequest.relType == "eq2eq_RecycleWaterNetwork_1"){/** 中水供水 */
            type = "eq2eq_RecycleWaterNetwork_1"
        }else if (manualRelationCalcRequest.relType == "eq2eq_RecycleWaterNetwork_2"){/** 中水旁通 */
            type = "eq2eq_RecycleWaterNetwork_2"
        }
        val select = rEq2EqService.select(SFilter.eq("projectId", projectId),SFilter.eq("type", type))

        val rSpAirConvectionList = select.exec()
        if (rSpAirConvectionList.size>0){
            if (manualRelationCalcRequest.objectType == "1") {
                val listId = ArrayList<String>()
                for (rSpAirConvection in rSpAirConvectionList) {
                    listId.add(rSpAirConvection.id1!!)
                }
                list.add(SFilter.inList("id", listId))
                if (manualRelationCalcRequest.relType == "eq2eq_SupplyWaterNetwork_1"){ /** 生活给水供水 */
                val pageQuery = relEquipmentSupplyWaterNetworkOneService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_SupplyWaterNetwork_2"){/** 生活给水旁通 */
                val pageQuery = relEquipmentSupplyWaterNetworkTwoService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_DrainingWaterNetwork_1"){/** 污水排水 */
                val pageQuery = relEquipmentDrainingWaterNetworkOneService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_DrainingWaterNetwork_2"){/** 污水旁通 */
                val pageQuery = relEquipmentDrainingWaterNetworkTwoService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_DrinkingWaterNetwork_1"){/** 直饮水供水 */
                val pageQuery = relEquipmentDrinkingWaterNetworkOneService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_DrinkingWaterNetwork_2"){/** 直饮水旁通 */
                val pageQuery = relEquipmentDrinkingWaterNetworkTwoService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_DHWNetwork_1"){/** 生活热水供水 */
                val pageQuery = relEquipmentDHWNetworkOneService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_DHWNetwork_2"){/** 生活热水旁通 */
                val pageQuery = relEquipmentDHWNetworkTwoService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_GasNetwork_1"){/** 燃气供气 */
                val pageQuery = relEquipmentGasNetworkOneService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_GasNetwork_2"){/** 燃气旁通 */
                val pageQuery = relEquipmentGasNetworkTwoService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_FireWaterNetwork_1"){/** 消防供水网络 */
                val pageQuery = relEquipmentFireWaterNetworkOneService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_FireWaterNetwork_2"){/** 消防给水旁通 */
                val pageQuery = relEquipmentFireWaterNetworkTwoService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_FireVentNetwork_1"){/** 消防排烟 */
                val pageQuery = relEquipmentFireVentNetworkOneService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_RecycleWaterNetwork_1"){/** 中水供水 */
                val pageQuery = relEquipmentRecycleWaterNetworkOneService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_RecycleWaterNetwork_2"){/** 中水旁通 */
                val pageQuery = relEquipmentRecycleWaterNetworkTwoService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }

            }else if (manualRelationCalcRequest.objectType == "2"){
                val listId = ArrayList<String>()
                for (rSpAirConvection in rSpAirConvectionList){
                    listId.add(rSpAirConvection.id2!!)
                }
                list.add(SFilter.inList("id",listId))
                val relZoneSpaceAirConvectionList = EquipmentService.select(list).exec()
                if (relZoneSpaceAirConvectionList.size>0){
                    val listrelZoneSpaceAirId = ArrayList<String>()
                    for (relZoneSpaceAir in relZoneSpaceAirConvectionList){
                        listrelZoneSpaceAirId.add(relZoneSpaceAir.id!!)
                    }
                    var type = ""
                    if (manualRelationCalcRequest.relType == "eq2eq_SupplyWaterNetwork_1"){ /** 生活给水供水 */
                        type = "eq2eq_SupplyWaterNetwork_1"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_SupplyWaterNetwork_2"){/** 生活给水旁通 */
                        type = "eq2eq_SupplyWaterNetwork_2"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_DrainingWaterNetwork_1"){/** 污水排水 */
                        type = "eq2eq_DrainingWaterNetwork_1"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_DrainingWaterNetwork_2"){/** 污水旁通 */
                        type = "eq2eq_DrainingWaterNetwork_2"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_DrinkingWaterNetwork_1"){/** 直饮水供水 */
                        type = "eq2eq_DrinkingWaterNetwork_1"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_DrinkingWaterNetwork_2"){/** 直饮水旁通 */
                        type = "eq2eq_DrinkingWaterNetwork_2"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_DHWNetwork_1"){/** 生活热水供水 */
                        type = "eq2eq_DHWNetwork_1"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_DHWNetwork_2"){/** 生活热水旁通 */
                        type = "eq2eq_DHWNetwork_2"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_GasNetwork_1"){/** 燃气供气 */
                        type = "eq2eq_GasNetwork_1"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_GasNetwork_2"){/** 燃气旁通 */
                        type = "eq2eq_GasNetwork_2"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_FireWaterNetwork_1"){/** 消防供水网络 */
                        type = "eq2eq_FireWaterNetwork_1"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_FireWaterNetwork_2"){/** 消防给水旁通 */
                        type = "eq2eq_FireWaterNetwork_2"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_FireVentNetwork_1"){/** 消防排烟 */
                        type = "eq2eq_FireVentNetwork_1"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_RecycleWaterNetwork_1"){/** 中水供水 */
                        type = "eq2eq_RecycleWaterNetwork_1"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_RecycleWaterNetwork_2"){/** 中水旁通 */
                        type = "eq2eq_RecycleWaterNetwork_2"
                    }
                    val select = rEq2EqService.select(SFilter.eq("projectId", projectId), SFilter.inList("id2", listrelZoneSpaceAirId),SFilter.eq("type", type))


                    val rSpAirConvectionList = select.exec()
                    listrelZoneSpaceAirId.clear()
                    for (rSpAirConvec in rSpAirConvectionList){
                        listrelZoneSpaceAirId.add(rSpAirConvec.id1!!)
                    }
                    val listSFilter = ArrayList<SFilter>()
                    listSFilter.add(SFilter.eq("projectId",projectId))
                    listSFilter.add(SFilter.inList("id",listrelZoneSpaceAirId))

                    if (manualRelationCalcRequest.relType == "eq2eq_SupplyWaterNetwork_1"){ /** 生活给水供水 */
                    val pageQuery = relEquipmentSupplyWaterNetworkOneService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_SupplyWaterNetwork_2"){/** 生活给水旁通 */
                    val pageQuery = relEquipmentSupplyWaterNetworkTwoService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_DrainingWaterNetwork_1"){/** 污水排水 */
                    val pageQuery = relEquipmentDrainingWaterNetworkOneService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_DrainingWaterNetwork_2"){/** 污水旁通 */
                    val pageQuery = relEquipmentDrainingWaterNetworkTwoService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_DrinkingWaterNetwork_1"){/** 直饮水供水 */
                    val pageQuery = relEquipmentDrinkingWaterNetworkOneService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_DrinkingWaterNetwork_2"){/** 直饮水旁通 */
                    val pageQuery = relEquipmentDrinkingWaterNetworkTwoService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_DHWNetwork_1"){/** 生活热水供水 */
                    val pageQuery = relEquipmentDHWNetworkOneService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_DHWNetwork_2"){/** 生活热水旁通 */
                    val pageQuery = relEquipmentDHWNetworkTwoService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_GasNetwork_1"){/** 燃气供气 */
                    val pageQuery = relEquipmentGasNetworkOneService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_GasNetwork_2"){/** 燃气旁通 */
                    val pageQuery = relEquipmentGasNetworkTwoService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_FireWaterNetwork_1"){/** 消防供水网络 */
                    val pageQuery = relEquipmentFireWaterNetworkOneService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_FireWaterNetwork_2"){/** 消防给水旁通 */
                    val pageQuery = relEquipmentFireWaterNetworkTwoService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_FireVentNetwork_1"){/** 消防排烟 */
                    val pageQuery = relEquipmentFireVentNetworkOneService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_RecycleWaterNetwork_1"){/** 中水供水 */
                    val pageQuery = relEquipmentRecycleWaterNetworkOneService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_RecycleWaterNetwork_2"){/** 中水旁通 */
                    val pageQuery = relEquipmentRecycleWaterNetworkTwoService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }
                }
                /** 暂无数据 */
                val manualRelationCalcResponse = ManualRelationCalcResponse()
                manualRelationCalcResponse.result = SResponseType.success
                manualRelationCalcResponse.content = ArrayList<RelProperty>()
                return manualRelationCalcResponse
            }
        }
        /** 暂无数据 */
        val manualRelationCalcResponse = ManualRelationCalcResponse()
        manualRelationCalcResponse.result = SResponseType.success
        manualRelationCalcResponse.content = ArrayList<RelProperty>()
        return manualRelationCalcResponse
    } // Fun


    /**
     * 测控类
     * 通信连接                 eq2eq_SensorNetwork_1
     * 设备控制关系              eq2eq_ControlRelation_1
     * 系统控制关系              eq2eq_ControlRelation_2   ****
     * 传感器测量设备关系            eq2eq_SensorRelationship_ss2eq
     * 传感器测量系统关系            eq2sy_SensorRelationship_ss2sy               ***
     * 传感器测量空间关系            ss2sp               ****
     * 阀门限制设备关系             eq2eq_ValveRelationship_vv2eq
     * 阀门限制系统关系             eq2sy_ValveRelationship_vv2sy               ****
     */
    fun control(projectId: String,list: ArrayList<SFilter>,sQueryRequest: SQueryRequest,manualRelationCalcRequest: ManualRelationCalcRequest): ManualRelationCalcResponse {

        val relEquipmentSensorNetworkOneService =  SObjectService(SMybatisDao(RelEquipmentSensorNetworkOne::class.java))
        val relEquipmentControlRelationOneService =  SObjectService(SMybatisDao(RelEquipmentControlRelationOne::class.java))
        val relEquipmentSs2EqService =  SObjectService(SMybatisDao(RelEquipmentSs2Eq::class.java))
        val relEquipmentVv2EqService =  SObjectService(SMybatisDao(RelEquipmentVv2Eq::class.java))
        val relEquipmentControlEquipNetworkService =  SObjectService(SMybatisDao(RelEquipmentEq2SpControlEquipNetwork::class.java))


        var type = ""
        if (manualRelationCalcRequest.relType == "eq2eq_SensorNetwork_1"){ /** 通信连接 */
            type = "eq2eq_SensorNetwork_1"
        }else if (manualRelationCalcRequest.relType == "eq2eq_ControlRelation_1"){/** 设备控制关系 */
            type = "eq2eq_ControlRelation_1"
        }else if (manualRelationCalcRequest.relType == "eq2eq_SensorRelationship_ss2eq"){/** 传感器测量设备关系 */
            type = "eq2eq_SensorRelationship_ss2eq"
        }else if (manualRelationCalcRequest.relType == "eq2eq_ValveRelationship_vv2eq"){/** 阀门限制设备关系 */
            type = "eq2eq_ValveRelationship_vv2eq"
        }else if(manualRelationCalcRequest.relType == "eq2eq_ControlEquipNetwork"){
            type = "eq2eq_ControlEquipNetwork"
        }
        val select = rEq2EqService.select(SFilter.eq("projectId", projectId),SFilter.eq("type", type))
        val rSpAirConvectionList = select.exec()
        if (rSpAirConvectionList.size>0){
            if (manualRelationCalcRequest.objectType == "1") {
                val listId = ArrayList<String>()
                for (rSpAirConvection in rSpAirConvectionList) {
                    listId.add(rSpAirConvection.id1!!)
                }
                list.add(SFilter.inList("id", listId))
                if (manualRelationCalcRequest.relType == "eq2eq_SensorNetwork_1"){ /** 通信连接 */
                val pageQuery = relEquipmentSensorNetworkOneService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_ControlRelation_1"){/** 设备控制关系 */
                val pageQuery = relEquipmentControlRelationOneService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_SensorRelationship_ss2eq"){/** 传感器测量设备关系 */
                val pageQuery = relEquipmentSs2EqService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2eq_ValveRelationship_vv2eq"){/** 阀门限制设备关系 */
                val pageQuery = relEquipmentVv2EqService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else  if(manualRelationCalcRequest.relType == "eq2eq_ControlEquipNetwork"){
                    val pageQuery = relEquipmentControlEquipNetworkService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }

            }else if (manualRelationCalcRequest.objectType == "2"){
                val listId = ArrayList<String>()
                for (rSpAirConvection in rSpAirConvectionList){
                    listId.add(rSpAirConvection.id2!!)
                }
                list.add(SFilter.inList("id",listId))
                val relZoneSpaceAirConvectionList = EquipmentService.select(list).exec()
                if (relZoneSpaceAirConvectionList.size>0){
                    val listrelZoneSpaceAirId = ArrayList<String>()
                    for (relZoneSpaceAir in relZoneSpaceAirConvectionList){
                        listrelZoneSpaceAirId.add(relZoneSpaceAir.id!!)
                    }
                    var type = ""
                    if (manualRelationCalcRequest.relType == "eq2eq_SensorNetwork_1"){ /** 通信连接 */
                        type = "eq2eq_SensorNetwork_1"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_ControlRelation_1"){/** 设备控制关系 */
                        type = "eq2eq_ControlRelation_1"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_SensorRelationship_ss2eq"){/** 传感器测量设备关系 */
                        type = "eq2eq_SensorRelationship_ss2eq"
                    }else if (manualRelationCalcRequest.relType == "eq2eq_ValveRelationship_vv2eq"){/** 阀门限制设备关系 */
                        type = "eq2eq_ValveRelationship_vv2eq"
                    }else if(manualRelationCalcRequest.relType == "eq2eq_ControlEquipNetwork"){
                        type = "eq2eq_ControlEquipNetwork"
                    }
                    val select = rEq2EqService.select(SFilter.eq("projectId", projectId), SFilter.inList("id2", listrelZoneSpaceAirId),SFilter.eq("type", type))

                    val rSpAirConvectionList = select.exec()
                    listrelZoneSpaceAirId.clear()
                    for (rSpAirConvec in rSpAirConvectionList){
                        listrelZoneSpaceAirId.add(rSpAirConvec.id1!!)
                    }
                    val listSFilter = ArrayList<SFilter>()
                    listSFilter.add(SFilter.eq("projectId",projectId))
                    listSFilter.add(SFilter.inList("id",listrelZoneSpaceAirId))

                    if (manualRelationCalcRequest.relType == "eq2eq_SensorNetwork_1"){ /** 通信连接 */
                    val pageQuery = relEquipmentSensorNetworkOneService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_ControlRelation_1"){/** 设备控制关系 */
                    val pageQuery = relEquipmentControlRelationOneService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_SensorRelationship_ss2eq"){/** 传感器测量设备关系 */
                    val pageQuery = relEquipmentSs2EqService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2eq_ValveRelationship_vv2eq"){/** 阀门限制设备关系 */
                    val pageQuery = relEquipmentVv2EqService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else  if(manualRelationCalcRequest.relType == "eq2eq_ControlEquipNetwork"){
                        val pageQuery = relEquipmentControlEquipNetworkService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }
                }
                /** 暂无数据 */
                val manualRelationCalcResponse = ManualRelationCalcResponse()
                manualRelationCalcResponse.result = SResponseType.success
                manualRelationCalcResponse.content = ArrayList<RelProperty>()
                return manualRelationCalcResponse
            }
        }
        /** 暂无数据 */
        val manualRelationCalcResponse = ManualRelationCalcResponse()
        manualRelationCalcResponse.result = SResponseType.success
        manualRelationCalcResponse.content = ArrayList<RelProperty>()
        return manualRelationCalcResponse

    } // Fun

    /**
     * 测控类
     *  传感器测量系统关系            eq2sy_SensorRelationship_ss2sy
     *  系统控制关系              eq2eq_ControlRelation_2
     *  阀门限制系统关系             eq2sy_ValveRelationship_vv2sy
     */
    fun  controlSy(projectId: String,list: ArrayList<SFilter>,sQueryRequest: SQueryRequest,manualRelationCalcRequest: ManualRelationCalcRequest): ManualRelationCalcResponse{

        val relEquipmentControlRelationTwoSyService =  SObjectService(SMybatisDao(RelEquipmentControlRelationTwoSy::class.java))
        val relEquipmentSs2SyService =  SObjectService(SMybatisDao(RelEquipmentSs2Sy::class.java))
        val relEquipmentVv2SyService =  SObjectService(SMybatisDao(RelEquipmentVv2Sy::class.java))


        val select = rEq2SyService.select(SFilter.eq("projectId", projectId),SFilter.eq("type", manualRelationCalcRequest.relType!!))

        val rSpAirConvectionList = select.exec()
        if (rSpAirConvectionList.size>0){
            if (manualRelationCalcRequest.objectType == "1") {
                val listId = ArrayList<String>()
                for (rSpAirConvection in rSpAirConvectionList) {
                    listId.add(rSpAirConvection.id1!!)
                }
                list.add(SFilter.inList("id", listId))

                if (manualRelationCalcRequest.relType == "eq2eq_ControlRelation_2"){ /** 系统控制关系 */
                val pageQuery = relEquipmentControlRelationTwoSyService.pageQuery(sQueryRequest, list)
                val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2sy_SensorRelationship_ss2sy"){ /** 传感器测量系统关系 */
                val pageQuery = relEquipmentSs2SyService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }else if (manualRelationCalcRequest.relType == "eq2sy_ValveRelationship_vv2sy"){ /** 阀门限制系统关系 */
                val pageQuery = relEquipmentVv2SyService.pageQuery(sQueryRequest, list)
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                    return manualRelationCalcResponse
                }
            }else if (manualRelationCalcRequest.objectType == "2"){
                val listId = ArrayList<String>()
                for (rSpAirConvection in rSpAirConvectionList){
                    listId.add(rSpAirConvection.id2!!)
                }
                list.add(SFilter.inList("id",listId))
                val relZoneSpaceAirConvectionList = relGeneralSystemService.select(list).exec()
                if (relZoneSpaceAirConvectionList.size>0){
                    val listrelZoneSpaceAirId = ArrayList<String>()
                    for (relZoneSpaceAir in relZoneSpaceAirConvectionList){
                        listrelZoneSpaceAirId.add(relZoneSpaceAir.id!!)
                    }
                    val select = rEq2SyService.select(SFilter.eq("projectId", projectId), SFilter.inList("id2", listrelZoneSpaceAirId),SFilter.eq("type", manualRelationCalcRequest.relType!!))

                    val rSpAirConvectionList = select.exec()
                    listrelZoneSpaceAirId.clear()
                    for (rSpAirConvec in rSpAirConvectionList){
                        listrelZoneSpaceAirId.add(rSpAirConvec.id1!!)
                    }

                    val listSFilter = ArrayList<SFilter>()
                    listSFilter.add(SFilter.eq("projectId",projectId))
                    listSFilter.add(SFilter.inList("id",listrelZoneSpaceAirId))

                    if (manualRelationCalcRequest.relType == "eq2eq_ControlRelation_2"){ /** 系统控制关系 */
                    val pageQuery = relEquipmentControlRelationTwoSyService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2sy_SensorRelationship_ss2sy"){ /** 传感器测量系统关系 */
                    val pageQuery = relEquipmentSs2SyService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }else if (manualRelationCalcRequest.relType == "eq2sy_ValveRelationship_vv2sy"){ /** 阀门限制系统关系 */
                    val pageQuery = relEquipmentVv2SyService.pageQuery(sQueryRequest, listSFilter)
                        val manualRelationCalcResponse = ManualRelationCalcResponse()
                        manualRelationCalcResponse.direction = "Left"
                        manualRelationCalcResponse.content = pageQuery.content
                        manualRelationCalcResponse.message = pageQuery.message
                        manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                        manualRelationCalcResponse.pageSize = pageQuery.pageSize
                        manualRelationCalcResponse.result = pageQuery.result
                        manualRelationCalcResponse.total = pageQuery.total
                        logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                        return manualRelationCalcResponse
                    }
                }
                /** 暂无数据 */
                val manualRelationCalcResponse = ManualRelationCalcResponse()
                manualRelationCalcResponse.result = SResponseType.success
                manualRelationCalcResponse.content = ArrayList<RelProperty>()
                return manualRelationCalcResponse
            }
        }

        /** 暂无数据 */
        val manualRelationCalcResponse = ManualRelationCalcResponse()
        manualRelationCalcResponse.result = SResponseType.success
        manualRelationCalcResponse.content = ArrayList<RelProperty>()
        return manualRelationCalcResponse
    } // Fun

    /**
     * 测控类
     * 传感器测量空间关系            ss2sp
     */
    fun ss2sps(projectId: String,list: ArrayList<SFilter>,sQueryRequest: SQueryRequest,manualRelationCalcRequest: ManualRelationCalcRequest): ManualRelationCalcResponse{
        val relEquipmentVv2SpService =  SObjectService(SMybatisDao(RelEquipmentVv2Sp::class.java))
        /** 资产所在业务空间 */
        val rPeInSpList = rEq2SpService.select(SFilter.eq("projectId",projectId!!),SFilter.eq("type",manualRelationCalcRequest.relType!!)).exec()
        if (rPeInSpList.size>0){
            if(manualRelationCalcRequest.objectType == "1"){
                val listId = ArrayList<String>()
                for (rPeInSp in rPeInSpList){
                    listId.add(rPeInSp.id1!!)
                }
                list.add(SFilter.inList("id",listId))
                val pageQuery = relEquipmentVv2SpService.pageQuery(sQueryRequest, list)
                val manualRelationCalcResponse = ManualRelationCalcResponse()
                manualRelationCalcResponse.direction = "Left"
                manualRelationCalcResponse.content = pageQuery.content
                manualRelationCalcResponse.message = pageQuery.message
                manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                manualRelationCalcResponse.pageSize = pageQuery.pageSize
                manualRelationCalcResponse.result = pageQuery.result
                manualRelationCalcResponse.total = pageQuery.total
                logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                return manualRelationCalcResponse
            }else if (manualRelationCalcRequest.objectType == "2"){
                val listId = ArrayList<String>()
                for (rPeInSp in rPeInSpList){
                    listId.add(rPeInSp.id2!!)
                }
                list.add(SFilter.inList("id",listId))

                val rPeInSpBaseLists = relZoneSpaceService.select(list).exec()
                if (rPeInSpBaseLists.size>0){
                    val listIds = ArrayList<String>()
                    for (rPeInSpBase in rPeInSpBaseLists){
                        listIds.add(rPeInSpBase.id!!)
                    }

                    val rPeInSpLists = rEq2SpService.select(SFilter.eq("projectId", projectId!!), SFilter.inList("id2", listIds),SFilter.eq("type",manualRelationCalcRequest.relType!!)).exec()

                    listIds.clear()
                    for (rPeInSp in rPeInSpLists){
                        listIds.add(rPeInSp.id1!!)
                    }

                    val listSFilter = ArrayList<SFilter>()
                    listSFilter.add(SFilter.eq("projectId",projectId))
                    listSFilter.add(SFilter.inList("id",listIds))
                    val pageQuery = relEquipmentVv2SpService.pageQuery(sQueryRequest, listSFilter)

                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    return manualRelationCalcResponse
                }else{
                    /** 暂无数据 */
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.result = SResponseType.success
                    manualRelationCalcResponse.content = ArrayList<RelProperty>()
                    return manualRelationCalcResponse
                }
            }
        }
        /** 暂无数据 */
        val manualRelationCalcResponse = ManualRelationCalcResponse()
        manualRelationCalcResponse.result = SResponseType.success
        manualRelationCalcResponse.content = ArrayList<RelProperty>()
        return manualRelationCalcResponse
    } // Fun


    /**
     * 测控类
     * 传感器测量空间关系            ss2sp
     */
    fun eq2spsOther(projectId: String,list: ArrayList<SFilter>,sQueryRequest: SQueryRequest,manualRelationCalcRequest: ManualRelationCalcRequest): ManualRelationCalcResponse{
        val relEquipmentVv2SpService =  SObjectService(SMybatisDao(RelEquipmentEq2SpOther::class.java))
        /** 资产所在业务空间 */
        val rPeInSpList = rEq2SpService.select(SFilter.eq("projectId",projectId!!),SFilter.eq("type",manualRelationCalcRequest.relType!!)).exec()
        if (rPeInSpList.size>0){
            if(manualRelationCalcRequest.objectType == "1"){
                val listId = ArrayList<String>()
                for (rPeInSp in rPeInSpList){
                    listId.add(rPeInSp.id1!!)
                }
                list.add(SFilter.inList("id",listId))
                val pageQuery = relEquipmentVv2SpService.pageQuery(sQueryRequest, list)
                val manualRelationCalcResponse = ManualRelationCalcResponse()
                manualRelationCalcResponse.direction = "Left"
                manualRelationCalcResponse.content = pageQuery.content
                manualRelationCalcResponse.message = pageQuery.message
                manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                manualRelationCalcResponse.pageSize = pageQuery.pageSize
                manualRelationCalcResponse.result = pageQuery.result
                manualRelationCalcResponse.total = pageQuery.total
                logger.debug("条件1= ${manualRelationCalcResponse.toJson()}")
                return manualRelationCalcResponse
            }else if (manualRelationCalcRequest.objectType == "2"){
                val listId = ArrayList<String>()
                for (rPeInSp in rPeInSpList){
                    listId.add(rPeInSp.id2!!)
                }
                list.add(SFilter.inList("id",listId))

                val rPeInSpBaseLists = relZoneSpaceService.select(list).exec()
                if (rPeInSpBaseLists.size>0){
                    val listIds = ArrayList<String>()
                    for (rPeInSpBase in rPeInSpBaseLists){
                        listIds.add(rPeInSpBase.id!!)
                    }

                    val rPeInSpLists = rEq2SpService.select(SFilter.eq("projectId", projectId!!), SFilter.inList("id2", listIds),SFilter.eq("type",manualRelationCalcRequest.relType!!)).exec()

                    listIds.clear()
                    for (rPeInSp in rPeInSpLists){
                        listIds.add(rPeInSp.id1!!)
                    }

                    val listSFilter = ArrayList<SFilter>()
                    listSFilter.add(SFilter.eq("projectId",projectId))
                    listSFilter.add(SFilter.inList("id",listIds))
                    val pageQuery = relEquipmentVv2SpService.pageQuery(sQueryRequest, listSFilter)

                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.direction = "Left"
                    manualRelationCalcResponse.content = pageQuery.content
                    manualRelationCalcResponse.message = pageQuery.message
                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
                    manualRelationCalcResponse.result = pageQuery.result
                    manualRelationCalcResponse.total = pageQuery.total
                    return manualRelationCalcResponse
                }else{
                    /** 暂无数据 */
                    val manualRelationCalcResponse = ManualRelationCalcResponse()
                    manualRelationCalcResponse.result = SResponseType.success
                    manualRelationCalcResponse.content = ArrayList<RelProperty>()
                    return manualRelationCalcResponse
                }
            }
        }
        /** 暂无数据 */
        val manualRelationCalcResponse = ManualRelationCalcResponse()
        manualRelationCalcResponse.result = SResponseType.success
        manualRelationCalcResponse.content = ArrayList<RelProperty>()
        return manualRelationCalcResponse
    } // Fun

    fun time():String {
        val df = SimpleDateFormat("yyyy-MM-dd HH:mm:ss") //设置日期格式
        println(df.format(Date())) // new Date()为获取当前系统时间
        return df.format(Date())
    } // Fun


} // Class ManualRelationCalcService