فهرست منبع

****************************************提交分类************************************

weixinVSjinlai 4 سال پیش
والد
کامیت
6d5b79f6e6

+ 63 - 156
datacenter/src/main/kotlin/com/persagy/server/datacenter/services/relation_calc/ManualRelationCalcService.kt

@@ -169,159 +169,8 @@ open class ManualRelationCalcService {
     private val relGeneralSystemBuildingService = SObjectService(SMybatisDao(RelGeneralSystemBuilding::class.java))
 
 
-
-    /**
-     * 查询关系数据
-     */
-//    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"
-//            if (!manualRelationCalcRequest.category.isNullOrEmpty()) {
-//                sCascadeQuery.filters = "zoneType = '${manualRelationCalcRequest.category}'"
-//            }
-//            sCascadeQueryList.add(sCascadeQuery)
-//            sQueryRequest.cascade = sCascadeQueryList
-//
-//
-//            if (manualRelationCalcRequest.graphicType == "ArchSubset" && manualRelationCalcRequest.relType == "Bd2Sp") {
-//
-//            } else if (manualRelationCalcRequest.graphicType == "ArchSubset" && manualRelationCalcRequest.relType == "Fl2Sp") {
-//
-//            } else if (manualRelationCalcRequest.graphicType == "MechInArch" && manualRelationCalcRequest.relType == "Eq2Bd") {
-//
-//            } else if (manualRelationCalcRequest.graphicType == "MechInArch" && manualRelationCalcRequest.relType == "Eq2Fl") {
-//
-//            } else if (manualRelationCalcRequest.graphicType == "ArchForArch" && manualRelationCalcRequest.relType == "Sp2Sp") {
-//
-//            } else if (manualRelationCalcRequest.graphicType == "MechSubset" && manualRelationCalcRequest.relType == "Sy2Eq") {
-//
-//            } else if (manualRelationCalcRequest.graphicType == "MechInArch" && manualRelationCalcRequest.relType == "Eq2Sp") {
-//
-//            } else if (manualRelationCalcRequest.graphicType == "MechForArch" && manualRelationCalcRequest.relType == "Eq2Sp") {
-//
-//            }
-//
-//            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  queryRel(manualRelationCalcRequest: ManualRelationCalcRequest): ManualRelationCalcResponse {
 
-        val listId1 = HashSet<String>()
-
-        listId1.add("11")
-        listId1.add("22")
-        logger.debug("测试=${listId1.toJson()}")
         if (manualRelationCalcRequest.graphicType == "ArchSubset" && manualRelationCalcRequest.relType == "Bd2Sp") {
             return queryBd2Sp(manualRelationCalcRequest)
             } else if (manualRelationCalcRequest.graphicType == "ArchSubset" && manualRelationCalcRequest.relType == "Fl2Sp") {
@@ -335,9 +184,9 @@ open class ManualRelationCalcService {
             } else if (manualRelationCalcRequest.graphicType == "MechSubset" && manualRelationCalcRequest.relType == "Sy2Eq") {
             return querySy2Eq(manualRelationCalcRequest)
             } else if (manualRelationCalcRequest.graphicType == "MechInArch" && manualRelationCalcRequest.relType == "Eq2Sp") {
-            return ManualRelationCalcResponse()
+            return queryEq2Sp(manualRelationCalcRequest)
             }else if (manualRelationCalcRequest.graphicType == "MechForArch" && manualRelationCalcRequest.relType == "Eq2Sp"){
-            return ManualRelationCalcResponse()
+            return queryEq2Sp(manualRelationCalcRequest)
             }
         return ManualRelationCalcResponse()
 
@@ -1155,7 +1004,7 @@ open class ManualRelationCalcService {
                     val listSF = ArrayList<SFilter>()
                     sCascadeQuery.filters = "id in ${listId2.toJson()}"
                     listSF.add(SFilter.inList("id",listId1.toList()))
-                    list.add(SFilter.eq("projectId",Opt.projectId!!))
+                    listSF.add(SFilter.eq("projectId",Opt.projectId!!))
                     val pageQuery = relSp2SpSpaceService.pageQuery(sQueryRequest, listSF)
                     manualRelationCalcResponse.content = pageQuery.content
                     manualRelationCalcResponse.message = pageQuery.message
@@ -1178,7 +1027,7 @@ open class ManualRelationCalcService {
     /**
      * 空间和空间
      */
-    fun queryEq2Sp(manualRelationCalcRequest: ManualRelationCalcRequest){
+    fun queryEq2Sp(manualRelationCalcRequest: ManualRelationCalcRequest): ManualRelationCalcResponse{
         val sQueryRequest = SQueryRequest()
         if(manualRelationCalcRequest.pageNumber>0&&manualRelationCalcRequest.pageSize>0){
             SQueryRequest.maxRow = 400000
@@ -1205,17 +1054,75 @@ open class ManualRelationCalcService {
                 , SFilter.eq("zoneType", manualRelationCalcRequest.zoneType!!)).exec()
         if (rEq2SpList.size>0) {
             if (manualRelationCalcRequest.objectType == "1") {
+                if (!manualRelationCalcRequest.categoryFrom.isNullOrEmpty()){
+                    list.add(SFilter.eq("classCode",manualRelationCalcRequest.categoryFrom!!))
+                }
+                    if (!manualRelationCalcRequest.vagueFrom.isNullOrEmpty()) {
+                        list.add(SFilter.or(SFilter.contain("codeName",manualRelationCalcRequest.vagueFrom!!),SFilter.contain("localId1",manualRelationCalcRequest.vagueFrom!!)
+                                ,SFilter.contain("bimTypeId",manualRelationCalcRequest.vagueFrom!!),SFilter.contain("systemCategotry",manualRelationCalcRequest.vagueFrom!!)))
+                    }
 
+                val pageQuery = relEq2SpEquipService.pageQuery(sQueryRequest, list)
+                manualRelationCalcResponse.content = pageQuery.content
+                manualRelationCalcResponse.message = pageQuery.message
+                manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
+                manualRelationCalcResponse.pageSize = pageQuery.pageSize
+                manualRelationCalcResponse.result = pageQuery.result
+                manualRelationCalcResponse.total = pageQuery.total
             }else if (manualRelationCalcRequest.objectType == "2" ||manualRelationCalcRequest.objectType == "3"){
+                if (!manualRelationCalcRequest.categoryFrom.isNullOrEmpty()){
+                    list.add(SFilter.eq("classCode",manualRelationCalcRequest.categoryFrom!!))
+                }
+                if (!manualRelationCalcRequest.vagueFrom.isNullOrEmpty()) {
+                    list.add(SFilter.or(SFilter.contain("codeName",manualRelationCalcRequest.vagueTo!!),SFilter.contain("localId1",manualRelationCalcRequest.vagueTo!!)
+                            ,SFilter.contain("bimTypeId",manualRelationCalcRequest.vagueTo!!),SFilter.contain("systemCategotry",manualRelationCalcRequest.vagueTo!!)))
+                }
 
-            } else {
+                if (!manualRelationCalcRequest.vagueTo.isNullOrEmpty()){
+                    list.add(SFilter.or(SFilter.contain("localName2",manualRelationCalcRequest.vagueTo!!),SFilter.contain("localId2",manualRelationCalcRequest.vagueTo!!)))
+                }
+                if (!manualRelationCalcRequest.zoneType.isNullOrEmpty()){
+                    list.add(SFilter.eq("zoneType",manualRelationCalcRequest.zoneType!!))
+                }
+                val rEq2SpTwoList = rEq2SpTwoService.select(list).exec()
+                if (rEq2SpTwoList.size>0){
+                    for (rEq2SpTwo in rEq2SpTwoList){
+
+                    }
+
+                    val listId1 = ArrayList<String>()
+                    val listId2 = ArrayList<String>()
+                    for (rEq2SpTwo in rEq2SpTwoList){
+                        listId1.add(rEq2SpTwo.id1!!)
+                        listId2.add(rEq2SpTwo.id2!!)
+                    }
 
+                    val listSF = ArrayList<SFilter>()
+                    sCascadeQuery.filters = "id in ${listId2.toJson()}"
+                    listSF.add(SFilter.inList("id",listId1.toList()))
+                    listSF.add(SFilter.eq("projectId",Opt.projectId!!))
+                    val pageQuery = relEq2SpEquipService.pageQuery(sQueryRequest, listSF)
+                    manualRelationCalcResponse.content = pageQuery.content
+                    manualRelationCalcResponse.message = pageQuery.message
+                    manualRelationCalcResponse.pageNumber = pageQuery.pageNumber
+                    manualRelationCalcResponse.pageSize = pageQuery.pageSize
+                    manualRelationCalcResponse.result = pageQuery.result
+                    manualRelationCalcResponse.total = pageQuery.total
+                }else {
+                    manualRelationCalcResponse.content = ArrayList()
+                    manualRelationCalcResponse.result = SResponseType.success
+                }
+
+            } else {
+                manualRelationCalcResponse.content = ArrayList()
+                manualRelationCalcResponse.result = SResponseType.success
             }
 
         }else {
             manualRelationCalcResponse.content = ArrayList()
             manualRelationCalcResponse.result = SResponseType.success
         }
+        return  manualRelationCalcResponse
     }