caiaf il y a 3 ans
Parent
commit
c0befce687

+ 141 - 143
datacenter/src/main/kotlin/com/persagy/server/datacenter/services/relation_calc/CalcSpecialService.kt

@@ -288,198 +288,196 @@ open class CalcSpecialService {
 //            for (floor in floors) {
 //                if (!floor.modelId.isNullOrEmpty()) {
 //                    val connectors = mapper.connectorOrder(floor.modelId!!)
-                    val connectors = connectorService.select(SFilter.inList("modelId",modelIds), SFilter.ne("domain","DomainPiping")).exec()
+            val connectors = connectorService.select(SFilter.inList("modelId",modelIds), SFilter.ne("domain","DomainPiping")).exec()
 
 //                    val dcEquipments = EquipmentService.select(SFilter.eq("projectId",projectId), SFilter.eq("floorId",floor.id!!)).exec()
-                    val dcEquipments = EquipmentService.select(SFilter.eq("projectId",projectId),SFilter.eq("buildingId",building.id!!)).exec()
-                    val dcEquipMap = HashMap<String, Equipment>(10000)
-                    for (equipment in dcEquipments) {
-                        if(!equipment.bimId.isNullOrEmpty()){
-                            dcEquipMap[equipment.bimId!!] = equipment
-                        }
+            val dcEquipments = EquipmentService.select(SFilter.eq("projectId",projectId),SFilter.eq("buildingId",building.id!!)).exec()
+            val dcEquipMap = HashMap<String, Equipment>(10000)
+            for (equipment in dcEquipments) {
+                if(!equipment.bimId.isNullOrEmpty()){
+                    dcEquipMap[equipment.bimId!!] = equipment
+                }
 
+            }
+            val equipments = BaseDataService.equipmentService.select(SFilter.inList("modelId",modelIds)).projection("id").exec()
+            val equipIds = equipments.map { e -> e.id!! }
+            val connectorMap = HashMap<String, Connector>(100000)
+            val typeMap = HashMap<String, String>()
+            val eqBelongMap = HashMap<String, String>(10000)
+            for (connector in connectors) {
+                connectorMap[connector.id!!] = connector
+
+                val belong = connector.belong ?: continue
+                val belongType = connector.belongType
+                if (belongType != null) {
+                    if(belongType != "Equipment"){
+                        typeMap[belong] = belongType
+                    }else if(equipIds.contains(belong)){
+                        typeMap[belong] = belongType
                     }
-                    val equipments = BaseDataService.equipmentService.select(SFilter.inList("modelId",modelIds)).projection("id").exec()
-                    val equipIds = equipments.map { e -> e.id!! }
-                    val connectorMap = HashMap<String, Connector>(100000)
-                    val typeMap = HashMap<String, String>()
-                    val eqBelongMap = HashMap<String, String>(10000)
-                    for (connector in connectors) {
-                        connectorMap[connector.id!!] = connector
-
-                        val belong = connector.belong ?: continue
-                        val belongType = connector.belongType
-                        if (belongType != null) {
-                            if(belongType != "Equipment"){
-                                typeMap[belong] = belongType
-                            }else if(equipIds.contains(belong)){
-                                typeMap[belong] = belongType
-                            }
 
-                        }
+                }
 
 
-                    }
+            }
 
-                    val belongMap = HashMap<String, HashSet<String>>()
-                    val eqBelongSet = HashSet<String>()
-                    //遍历连接件
-                    for (connector in connectors) {
-                        //拿到所属类
-                        val belongType = connector.belongType
-                        //拿到所属id
-                        val belong = connector.belong
-                        if(belong == "6570cc5d8dff11eba822e9f08377214a"){
-                            print("111")
-                        }
-                        if(belong != null){
-                            if(belongType == "Equipment"){
-                                eqBelongMap[belong] = connector.belongBimId!!
-                            }
-                            if(!belongMap.containsKey(belong)){
-                                belongMap[belong] = HashSet()
-                            }
+            val belongMap = HashMap<String, HashSet<String>>()
+            val eqBelongSet = HashSet<String>()
+            //遍历连接件
+            for (connector in connectors) {
+                //拿到所属类
+                val belongType = connector.belongType
+                //拿到所属id
+                val belong = connector.belong
+
+                if(belong != null){
+                    if(belongType == "Equipment"){
+                        eqBelongMap[belong] = connector.belongBimId!!
+                    }
+                    if(!belongMap.containsKey(belong)){
+                        belongMap[belong] = HashSet()
+                    }
 //                            if(connector.belongType == "Equipment"){
 //                                eqBelongSet.add(belong)
 //                            }
 
-                            eqBelongSet.add(belong)
+                    eqBelongSet.add(belong)
 
-                            //如果连接件有连接
-                            if (connector.connectIdJson!!.size > 0) {
-                                val connectorId = connector!!.connectIdJson?.get(0)
-                                var currentConnector = connectorMap[connectorId!!]
-                                //系统不同
+                    //如果连接件有连接
+                    if (connector.connectIdJson!!.size > 0) {
+                        val connectorId = connector!!.connectIdJson?.get(0)
+                        var currentConnector = connectorMap[connectorId!!]
+                        //系统不同
 //                                if(connector.mepSystemType != currentConnector?.mepSystemType){
 //                                    continue
 //                                }
-                                val cBelong = currentConnector?.belong
-                                if (cBelong != null) {
-                                    val belongs = belongMap[belong]!!
-                                    belongs.add(cBelong)
-                                    belongMap[belong] = belongs
-                                }
-                            }
-                            if(connector.riserState != null && connector.riserState!! > 0 && listOf("Duct","Pipe").contains(connector.belongType)){
-                                for (key in riserMap.keys) {
-                                    if(key == belong){
-                                        belongMap[belong]!!.addAll(riserMap[key]!!)
+                        val cBelong = currentConnector?.belong
+                        if (cBelong != null) {
+                            val belongs = belongMap[belong]!!
+                            belongs.add(cBelong)
+                            belongMap[belong] = belongs
+                        }
+                    }
+//                    if(connector.riserState != null && connector.riserState!! > 0 && listOf("Duct","Pipe").contains(connector.belongType)){
+                    for (key in riserMap.keys) {
+                        if(key == belong){
+                            belongMap[belong]!!.addAll(riserMap[key]!!)
 
-                                        break
-                                    }
-                                }
-                            }
+                            break
                         }
                     }
-                    var fBlockId: Int =0
-                    var dBlockId: Int =0
-                    var cBlockId = 0
-                    val fBlockMap = HashMap<Int,HashSet<String>>()
+//                    }
+                }
+            }
+            var fBlockId: Int =0
+            var dBlockId: Int =0
+            var cBlockId = 0
+            val fBlockMap = HashMap<Int,HashSet<String>>()
 //                val dBlockMap = HashMap<Int,HashSet<String>>()
-                    val enumList = ClassCodeEnum.toSourceList(null)
-                    var fSet: HashSet<String>? = null
-                    var dSet: HashSet<String>
-                    println(eqBelongSet.size)
-                    for (key in eqBelongSet) {
+            val enumList = ClassCodeEnum.toSourceList(null)
+            var fSet: HashSet<String>? = null
+            var dSet: HashSet<String>
+            println(eqBelongSet.size)
+            for (key in eqBelongSet) {
 
 
-                        val belongSet = belongMap[key]!!
-                        dSet = directDist(HashSet(belongSet),belongMap,typeMap)
-                        dBlockId ++
+                val belongSet = belongMap[key]!!
+                dSet = directDist(HashSet(belongSet),belongMap,typeMap)
+                dBlockId ++
 
 
-                        fSet = null
-                        for (block in fBlockMap.keys) {
-                            val set = fBlockMap[block]!!
-                            if(set.contains(key)){
-                                fSet = set
-                                cBlockId = block
-                                break
-                            }
-                        }
-                        if(fSet == null){
-                            fSet = fullDist(HashSet(belongSet),belongMap)
-                            fBlockId ++
-                            cBlockId = fBlockId
-                            fBlockMap[cBlockId] = HashSet(fSet)
-                        }
+                fSet = null
+                for (block in fBlockMap.keys) {
+                    val set = fBlockMap[block]!!
+                    if(set.contains(key)){
+                        fSet = set
+                        cBlockId = block
+                        break
+                    }
+                }
+                if(fSet == null){
+                    fSet = fullDist(HashSet(belongSet),belongMap)
+                    fBlockId ++
+                    cBlockId = fBlockId
+                    fBlockMap[cBlockId] = HashSet(fSet)
+                }
 //                    fSet = fullDist(HashSet(belongSet),belongMap)
 //                    println(fSet.contains(key))
 //                    println(fSet.size)
 
-                        fMap[key] = fSet
-                        dMap[key] = dSet
+                fMap[key] = fSet
+                dMap[key] = dSet
 
 
-                        if(typeMap[key] == "Equipment"){
-                            val e1 = dcEquipMap[eqBelongMap[key]]
-                            if(e1 == null || !enumList.contains(e1.classCode)){
+                if(typeMap[key] == "Equipment"){
+                    val e1 = dcEquipMap[eqBelongMap[key]]
+                    if(e1 == null || !enumList.contains(e1.classCode)){
+                        continue
+                    }
+                    for (s in dSet!!) {
+                        if(typeMap[s] == "Equipment" && key != s){
+                            val e2 = dcEquipMap[eqBelongMap[s]]
+                            if(e2 == null || !enumList.contains(e2.classCode)){
                                 continue
                             }
-                            for (s in dSet!!) {
-                                if(typeMap[s] == "Equipment" && key != s){
-                                    val e2 = dcEquipMap[eqBelongMap[s]]
-                                    if(e2 == null || !enumList.contains(e2.classCode)){
-                                        continue
-                                    }
 //                                if(e1.classCode == e2.classCode){
 //                                    continue
 //                                }
 
-                                    val connectedBlock = ConnectedBlock()
-                                    connectedBlock.id1 = e1.id!!
-                                    connectedBlock.id2 = e2.id!!
-                                    connectedBlock.type1 = "Equipment"
-                                    connectedBlock.type2 = "Equipment"
-//                                connectedBlock.modelId1 = connectorMap[key]!!.modelId
-//                                connectedBlock.modelId2 = connectorMap[s]!!.modelId
+                            val connectedBlock = ConnectedBlock()
+                            connectedBlock.id1 = e1.id!!
+                            connectedBlock.id2 = e2.id!!
+                            connectedBlock.type1 = "Equipment"
+                            connectedBlock.type2 = "Equipment"
+                            connectedBlock.modelId1 = e1.floorId
+                            connectedBlock.modelId2 = e2.floorId
 //                                connectedBlock.domain = connector.domain
 //                                connectedBlock.mepSystemType = connector.mepSystemType
-                                    connectedBlock.projectId = projectId
-                                    connectedBlock.buildingId = buildingId
-                                    connectedBlock.depth = 0
-                                    connectedBlock.blockId = dBlockId.toString()
-                                    connectedBlock.typeCode1 = e1?.classCode
-                                    connectedBlock.typeCode2 = e2?.classCode
-                                    if (!connectedBlocks.contains(connectedBlock)) {
-                                        connectedBlocks.add(connectedBlock)
-                                    }
+                            connectedBlock.projectId = projectId
+                            connectedBlock.buildingId = buildingId
+                            connectedBlock.depth = 0
+                            connectedBlock.blockId = dBlockId.toString()
+                            connectedBlock.typeCode1 = e1?.classCode
+                            connectedBlock.typeCode2 = e2?.classCode
+                            if (!connectedBlocks.contains(connectedBlock)) {
+                                connectedBlocks.add(connectedBlock)
+                            }
 
-                                }
+                        }
+                    }
+                    for (s in fSet!!) {
+                        if(typeMap[s] == "Equipment" && key != s){
+                            val e2 = dcEquipMap[eqBelongMap[s]]
+                            if(e2 == null || !enumList.contains(e2.classCode)){
+                                continue
                             }
-                            for (s in fSet!!) {
-                                if(typeMap[s] == "Equipment" && key != s){
-                                    val e2 = dcEquipMap[eqBelongMap[s]]
-                                    if(e2 == null || !enumList.contains(e2.classCode)){
-                                        continue
-                                    }
 //                                if(e1.classCode == e2.classCode){
 //                                    continue
 //                                }
 
-                                    val connectedBlock = ConnectedBlock()
+                            val connectedBlock = ConnectedBlock()
 
-                                    connectedBlock.id1 = e1.id!!
-                                    connectedBlock.id2 = e2.id!!
-                                    connectedBlock.type1 = "Equipment"
-                                    connectedBlock.type2 = "Equipment"
-//                                connectedBlock.modelId1 = connectorMap[key]!!.modelId
-//                                connectedBlock.modelId2 = connectorMap[s]!!.modelId
+                            connectedBlock.id1 = e1.id!!
+                            connectedBlock.id2 = e2.id!!
+                            connectedBlock.type1 = "Equipment"
+                            connectedBlock.type2 = "Equipment"
+                            connectedBlock.modelId1 = e1.floorId
+                            connectedBlock.modelId2 = e2.floorId
 //                                connectedBlock.domain = connector.domain
 //                                connectedBlock.mepSystemType = connector.mepSystemType
-                                    connectedBlock.projectId = projectId
-                                    connectedBlock.buildingId = buildingId
-                                    connectedBlock.depth = 1
-                                    connectedBlock.blockId = cBlockId.toString()
-                                    connectedBlock.typeCode1 = e1?.classCode
-                                    connectedBlock.typeCode2 = e2?.classCode
-                                    if (!connectedBlocks.contains(connectedBlock)) {
-                                        connectedBlocks.add(connectedBlock)
-                                    }
-
-                                }
+                            connectedBlock.projectId = projectId
+                            connectedBlock.buildingId = buildingId
+                            connectedBlock.depth = 1
+                            connectedBlock.blockId = cBlockId.toString()
+                            connectedBlock.typeCode1 = e1?.classCode
+                            connectedBlock.typeCode2 = e2?.classCode
+                            if (!connectedBlocks.contains(connectedBlock)) {
+                                connectedBlocks.add(connectedBlock)
                             }
+
                         }
+                    }
+                }
 
 
 

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

@@ -1298,7 +1298,7 @@ open class ManualRelationCalcService {
                     list.add(SFilter.eq("classCode",manualRelationCalcRequest.categoryFrom!!))
                 }
                 if (!manualRelationCalcRequest.vagueFrom.isNullOrEmpty()) {
-                    list.add(SFilter.or(SFilter.contain("codeName",manualRelationCalcRequest.vagueFrom!!),SFilter.contain("localId",manualRelationCalcRequest.vagueFrom!!)
+                    list.add(SFilter.or(SFilter.contain("aliasName",manualRelationCalcRequest.vagueFrom!!),SFilter.contain("localId",manualRelationCalcRequest.vagueFrom!!)
                             ,SFilter.contain("bimTypeId",manualRelationCalcRequest.vagueFrom!!)))
                 }
 
@@ -1314,7 +1314,7 @@ open class ManualRelationCalcService {
                     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!!)
+                    list.add(SFilter.or(SFilter.contain("aliasName",manualRelationCalcRequest.vagueTo!!),SFilter.contain("localId1",manualRelationCalcRequest.vagueTo!!)
                             ,SFilter.contain("bimTypeId",manualRelationCalcRequest.vagueTo!!),SFilter.contain("systemCategotry",manualRelationCalcRequest.vagueTo!!)))
                 }
 

+ 200 - 56
datacenter/src/main/kotlin/com/persagy/server/datacenter/services/relation_calc/RelationCalcService.kt

@@ -1108,16 +1108,128 @@ open class RelationCalcService {
      *  @param  projectId   项目id
      *  @param  sign        是否要删除自动维护的关系(不填默认为false), boolean型, 值为true或false (true表示删除自动和手动维护的关系, false表示只删除手动计算的的关系)
      */
+//    fun calcEqForSp(tables: String?, projectId: String,graphCode: String,relType: String): SBaseResponse {
+//
+//
+//        try {
+//
+//
+//            val codeList= ClassCodeEnum.toSourceList(1)
+//            calcSpecialService.calcNetworks(projectId)
+//            val connectedBlocks = connectedBlockService.select(SFilter.eq("projectId",projectId), SFilter.or(SFilter.inList("typeCode1",codeList), SFilter.inList("typeCode2",codeList))).exec()
+//
+//            var sqlBuilder = arrayListOf(SFilter.eq("projectId", projectId), SFilter.eq("relationType", relType
+//            ), SFilter.eq("graphicType",graphCode))
+//
+//            if(tables != null){
+//                sqlBuilder.add(SFilter.eq("zoneType", tables!!))
+//            }
+//            val entity = relationTypeProjectservice.select(sqlBuilder).entity()
+//            if (entity != null) {
+//                entity.computationalState = 3
+//                relationTypeProjectservice.update(entity)
+//            }
+//            /** 启动计算   ******************************/
+//            val result = mapper.calcEq2Sp(projectId)
+//            logger.debug("计算结果= ${result}")
+//
+//            /*************************上面添加数据**********************************/
+//
+//            if (result != null && result == 0) {
+//
+//                if (entity != null) {
+//                    entity.computationalState = 1
+//                    entity.computingTime = IdUtils.time()
+//                    relationTypeProjectservice.update(entity)
+//                }
+//
+//                val sourceList = ClassCodeEnum.toSourceList(0)
+//                /** 处理关系 */
+//                val equipmentList = EquipmentService.select(SFilter.eq("projectId", projectId),
+//                        SFilter.inList("classCode",
+//                                arrayListOf("ACATIO", "ACVTIO","ACATFC","ACVTAC","FFSCIO"))).exec()
+//                val typeMap = HashMap<String,String>();
+//                if (equipmentList.size > 0) {
+//                    var listId = ArrayList<String>()
+//                    for (equipment in equipmentList) {
+//                        listId.add(equipment.id!!)
+//                        typeMap[equipment.id!!] = equipment.classCode!!
+//                    }
+//                    val rbuilder = arrayListOf(SFilter.eq("projectId", projectId),
+//                    SFilter.inList("id1", listId)
+//                    , SFilter.eq("graphCode", "MechInArch"), SFilter.eq("type",relType))
+//
+//                    if(tables != null){
+//                        rbuilder.add( SFilter.eq("zoneType",tables!!))
+//                    }
+//
+//                    val rEq2SpList = REq2SpService.select(rbuilder).exec()
+//                    val rEq2Sps = ArrayList<REq2Sp>()
+//                    if (rEq2SpList.size > 0) {
+//                        for (rEq2Sp in rEq2SpList) {
+//                            rEq2Sp.type = relType
+//                            rEq2Sp.graphCode = graphCode
+//                            rEq2Sps.add(rEq2Sp)
+////                            REq2SpService.replace(rEq2Sp)
+//                            //获取设备类型
+//                            val typeCode = typeMap[rEq2Sp.id1]
+//                            //如果是风口才计算关系
+//                            if( typeCode!= null && sourceList.contains(typeCode)){
+//                                for (connectedBlock in connectedBlocks) {
+//                                    val typeCode1 = connectedBlock.typeCode1
+//                                    val typeCode2 = connectedBlock.typeCode2
+//                                    if(codeList.contains(typeCode2) && connectedBlock.id1 == rEq2Sp.id1){
+//                                        val fullREq2Sp = REq2Sp()
+//                                        fullREq2Sp.type = relType
+//                                        fullREq2Sp.graphCode = graphCode
+//                                        fullREq2Sp.projectId = projectId
+//                                        fullREq2Sp.id1 = connectedBlock.id2
+//                                        fullREq2Sp.id2 = rEq2Sp.id2
+//                                        fullREq2Sp.zoneType = rEq2Sp.zoneType
+//                                        fullREq2Sp.sign =2
+//                                        rEq2Sps.add(fullREq2Sp)
+//                                    }else if(codeList.contains(typeCode1)  && connectedBlock.id2 == rEq2Sp.id1){
+//                                        val fullREq2Sp = REq2Sp()
+//                                        fullREq2Sp.type = relType
+//                                        fullREq2Sp.graphCode = graphCode
+//                                        fullREq2Sp.projectId = projectId
+//                                        fullREq2Sp.id1 = connectedBlock.id1
+//                                        fullREq2Sp.id2 = rEq2Sp.id2
+//                                        fullREq2Sp.zoneType = rEq2Sp.zoneType
+//                                        fullREq2Sp.sign =2
+//                                        rEq2Sps.add(fullREq2Sp)
+//                                    }
+//                                }
+//                            }
+//
+//                        }
+//                    }
+//                    for (rEq2Sp in rEq2Sps) {
+//                        REq2SpService.replace(rEq2Sp)
+//                    }
+//
+//                }
+//                /** 发送消息 */
+//                rabbitMqService.sendRel(Opt.projectId!!, "fengkou_for", "20", "123", "456")
+//                return SBaseResponse(SResponseType.success)
+//            } else {
+//                if (entity != null) {
+//                    entity.computationalState = 5
+//                    entity.computingTime = IdUtils.time()
+//                    relationTypeProjectservice.update(entity)
+//                }
+//            }
+//
+//            return SBaseResponse(SResponseType.failure)
+//        } catch (e: Exception) {
+//            e.printStackTrace()
+//            return SBaseResponse(SResponseType.failure, e.message!!)
+//        }
+//    }
     fun calcEqForSp(tables: String?, projectId: String,graphCode: String,relType: String): SBaseResponse {
 
 
         try {
-
-            calcSpecialService.calcNetworks(projectId)
-            val codeList= ClassCodeEnum.toSourceList(1)
-
-            val connectedBlocks = connectedBlockService.select(SFilter.eq("projectId",projectId), SFilter.or(SFilter.inList("typeCode1",codeList), SFilter.inList("typeCode2",codeList))).exec()
-
             var sqlBuilder = arrayListOf(SFilter.eq("projectId", projectId), SFilter.eq("relationType", relType
             ), SFilter.eq("graphicType",graphCode))
 
@@ -1125,25 +1237,40 @@ open class RelationCalcService {
                 sqlBuilder.add(SFilter.eq("zoneType", tables!!))
             }
             val entity = relationTypeProjectservice.select(sqlBuilder).entity()
-            if (entity != null) {
-                entity.computationalState = 3
-                relationTypeProjectservice.update(entity)
+            try {
+//                upDateBiaoji(projectId, "eq2fl", 3)
+//                upDateBiaoji(projectId, "fl2sp", 3)
+
+
+
+                if (entity != null) {
+                    entity.computationalState = 3
+                    entity.computingTime = IdUtils.time()
+                    relationTypeProjectservice.update(entity)
+                }
+            } catch (e: Exception) {
+                e.printStackTrace()
             }
             /** 启动计算   ******************************/
             val result = mapper.calcEq2Sp(projectId)
+//            var result = 0
             logger.debug("计算结果= ${result}")
 
             /*************************上面添加数据**********************************/
 
             if (result != null && result == 0) {
-
-                if (entity != null) {
-                    entity.computationalState = 1
-                    entity.computingTime = IdUtils.time()
-                    relationTypeProjectservice.update(entity)
+                try {
+//                    upDate(projectId, "fl2sp")
+//                    upDate(projectId, "eq2fl")
+                     if (entity != null) {
+                        entity.computationalState = 1
+                        entity.computingTime = IdUtils.time()
+                        relationTypeProjectservice.update(entity)
+                    }
+                } catch (e: Exception) {
+                    e.printStackTrace()
                 }
 
-                val sourceList = ClassCodeEnum.toSourceList(0)
                 /** 处理关系 */
                 val equipmentList = EquipmentService.select(SFilter.eq("projectId", projectId),
                         SFilter.inList("classCode",
@@ -1156,56 +1283,72 @@ open class RelationCalcService {
                         typeMap[equipment.id!!] = equipment.classCode!!
                     }
                     val rbuilder = arrayListOf(SFilter.eq("projectId", projectId),
-                    SFilter.inList("id1", listId)
-                    , SFilter.eq("graphCode", "MechInArch"), SFilter.eq("type",relType))
+                            SFilter.inList("id1", listId)
+                            , SFilter.eq("graphCode", "MechInArch"), SFilter.eq("type",relType))
 
                     if(tables != null){
                         rbuilder.add( SFilter.eq("zoneType",tables!!))
                     }
 
                     val rEq2SpList = REq2SpService.select(rbuilder).exec()
-                    val rEq2Sps = ArrayList<REq2Sp>()
+
                     if (rEq2SpList.size > 0) {
+
+                        calcSpecialService.calcNetworks(projectId)
+                        val codeList= ClassCodeEnum.toSourceList(1)
+
+                        val connectedBlocks = connectedBlockService.select(SFilter.eq("projectId",projectId), SFilter.or(SFilter.inList("typeCode1",codeList), SFilter.inList("typeCode2",codeList))).exec()
+
+                        val sourceList = ClassCodeEnum.toSourceList(0)
+                        val rEq2Sps = ArrayList<REq2Sp>()
+
                         for (rEq2Sp in rEq2SpList) {
-                            rEq2Sp.type = relType
-                            rEq2Sp.graphCode = graphCode
-                            rEq2Sps.add(rEq2Sp)
-//                            REq2SpService.replace(rEq2Sp)
-                            //获取设备类型
-                            val typeCode = typeMap[rEq2Sp.id1]
-                            //如果是风口才计算关系
-                            if( typeCode!= null && sourceList.contains(typeCode)){
-                                for (connectedBlock in connectedBlocks) {
-                                    val typeCode1 = connectedBlock.typeCode1
-                                    val typeCode2 = connectedBlock.typeCode2
-                                    if(codeList.contains(typeCode2) && connectedBlock.id1 == rEq2Sp.id1){
-                                        val fullREq2Sp = REq2Sp()
-                                        fullREq2Sp.type = relType
-                                        fullREq2Sp.graphCode = graphCode
-                                        fullREq2Sp.projectId = projectId
-                                        fullREq2Sp.id1 = connectedBlock.id2
-                                        fullREq2Sp.id2 = rEq2Sp.id2
-                                        fullREq2Sp.zoneType = rEq2Sp.zoneType
-                                        fullREq2Sp.sign =2
-                                        rEq2Sps.add(fullREq2Sp)
-                                    }else if(codeList.contains(typeCode1)  && connectedBlock.id2 == rEq2Sp.id1){
-                                        val fullREq2Sp = REq2Sp()
-                                        fullREq2Sp.type = relType
-                                        fullREq2Sp.graphCode = graphCode
-                                        fullREq2Sp.projectId = projectId
-                                        fullREq2Sp.id1 = connectedBlock.id1
-                                        fullREq2Sp.id2 = rEq2Sp.id2
-                                        fullREq2Sp.zoneType = rEq2Sp.zoneType
-                                        fullREq2Sp.sign =2
-                                        rEq2Sps.add(fullREq2Sp)
+                            try {
+                                rEq2Sp.type = relType
+                                rEq2Sp.graphCode = graphCode
+                                //获取设备类型
+                                val typeCode = typeMap[rEq2Sp.id1]
+                                rEq2Sps.add(rEq2Sp)
+
+                                //如果是风口才计算关系
+                                if( typeCode!= null && sourceList.contains(typeCode)){
+                                    for (connectedBlock in connectedBlocks) {
+                                        val typeCode1 = connectedBlock.typeCode1
+                                        val typeCode2 = connectedBlock.typeCode2
+                                        if(codeList.contains(typeCode2) && rEq2Sp.id1 == connectedBlock.id1){
+                                            val fullREq2Sp = REq2Sp()
+                                            fullREq2Sp.type = relType
+                                            fullREq2Sp.graphCode = graphCode
+                                            fullREq2Sp.projectId = projectId
+                                            fullREq2Sp.id1 = connectedBlock.id2
+                                            fullREq2Sp.id2 = rEq2Sp.id2
+                                            fullREq2Sp.zoneType = rEq2Sp.zoneType
+                                            fullREq2Sp.sign =2
+                                            rEq2Sps.add(fullREq2Sp)
+
+                                        }else if(codeList.contains(typeCode1) && rEq2Sp.id1 == connectedBlock.id2){
+                                            val fullREq2Sp = REq2Sp()
+                                            fullREq2Sp.type = relType
+                                            fullREq2Sp.graphCode = graphCode
+                                            fullREq2Sp.projectId = projectId
+                                            fullREq2Sp.id1 = connectedBlock.id2
+                                            fullREq2Sp.id2 = rEq2Sp.id2
+                                            fullREq2Sp.zoneType = rEq2Sp.zoneType
+                                            fullREq2Sp.sign =2
+                                            rEq2Sps.add(fullREq2Sp)
+
+                                        }
                                     }
                                 }
-                            }
 
+//                                REq2SpService.replace(rEq2Sp)
+                            } catch (e: Exception) {
+                                e.toString()
+                            }
+                        }
+                        for (rEq2Sp in rEq2Sps) {
+                            REq2SpService.replace(rEq2Sp)
                         }
-                    }
-                    for (rEq2Sp in rEq2Sps) {
-                        REq2SpService.replace(rEq2Sp)
                     }
 
                 }
@@ -1213,21 +1356,22 @@ open class RelationCalcService {
                 rabbitMqService.sendRel(Opt.projectId!!, "fengkou_for", "20", "123", "456")
                 return SBaseResponse(SResponseType.success)
             } else {
+//                upDateBiaoji(projectId, "eq2fl", 1)
+//                upDateBiaoji(projectId, "fl2sp", 1)
                 if (entity != null) {
-                    entity.computationalState = 5
+                    entity.computationalState = 1
                     entity.computingTime = IdUtils.time()
                     relationTypeProjectservice.update(entity)
                 }
             }
 
-            return SBaseResponse(SResponseType.failure)
+            return SBaseResponse(SResponseType.success)
         } catch (e: Exception) {
             e.printStackTrace()
             return SBaseResponse(SResponseType.failure, e.message!!)
         }
     }
 
-
     /**
      * @Description: 空间交通关系
      * @Param: