|
@@ -34,6 +34,8 @@ import com.persagy.server.datacenter.datacenter.models.entities.graphtype.block.
|
|
|
import com.persagy.server.datacenter.wanda.rel.REq2Eq
|
|
|
import com.persagy.server.mappers.ICalcSpecialMapper
|
|
|
import com.persagy.server.datacenter.models.entities.Connector
|
|
|
+import com.persagy.server.datacenter.models.entities.Duct
|
|
|
+import com.persagy.server.datacenter.models.entities.Pipe
|
|
|
import com.persagy.server.datacenter.models.wrapperobj.ClassCodeEnum
|
|
|
import com.persagy.server.datacenter.services.objects.BuildingService
|
|
|
import com.persagy.server.datacenter.services.objects.EquipmentService
|
|
@@ -50,6 +52,10 @@ import com.persagy.service.models.responses.SBaseResponse
|
|
|
import org.json.JSONObject
|
|
|
import org.springframework.beans.factory.annotation.Autowired
|
|
|
import org.springframework.stereotype.Service
|
|
|
+import sun.java2d.pipe.LoopPipe
|
|
|
+import java.util.stream.Collectors
|
|
|
+import kotlin.math.pow
|
|
|
+import kotlin.math.sqrt
|
|
|
|
|
|
/**
|
|
|
* 关系计算-管网
|
|
@@ -72,6 +78,9 @@ open class CalcSpecialService {
|
|
|
val relationTypeProjectservice = SBaseService(SMybatisDao(RelationTypeProject::class.java))
|
|
|
val rEq2EqService = SObjectService(SMybatisDao(REq2Eq::class.java))
|
|
|
|
|
|
+ val ductService = SObjectService(SMybatisDao(Duct::class.java))
|
|
|
+ val pipeService = SObjectService(SMybatisDao(Pipe::class.java))
|
|
|
+
|
|
|
/**
|
|
|
* 管网系统设备分块
|
|
|
*@param calcName 计算关系名称
|
|
@@ -500,38 +509,6 @@ open class CalcSpecialService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// fun dist(list: ArrayList<String>,directList:ArrayList<String>, belongMap: HashMap<String,HashSet<String>>,typeMap: HashMap<String,String>,beforeList: ArrayList<String>,index: Int): NetWork {
|
|
|
-// var belong: String? = null
|
|
|
-// for(i in index until beforeList.size){
|
|
|
-// belong = beforeList[i]
|
|
|
-// if(belongMap[belong] != null){
|
|
|
-// val belongList = belongMap[belong]!!
|
|
|
-// for (s in belongList) {
|
|
|
-//// if(!directList.contains(s)){
|
|
|
-////
|
|
|
-//// }
|
|
|
-// if(!list.contains(s)){
|
|
|
-// list.add(s)
|
|
|
-// if(typeMap[belong] != "Equipment"){
|
|
|
-// directList.add(s)
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// return if(beforeList.containsAll(list)){
|
|
|
-// NetWork(list, directList)
|
|
|
-// }else{
|
|
|
-//// newList.clear()
|
|
|
-//// newList.addAll(list)
|
|
|
-//// newList.removeAll(beforeList)
|
|
|
-// println(list.size)
|
|
|
-// println("${HashSet<String>(list).size}=====")
|
|
|
-// dist(list,beforeList,belongMap,typeMap,ArrayList(list),beforeList.size)
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
fun fullDist(list: HashSet<String>, belongMap: HashMap<String,HashSet<String>>): HashSet<String>{
|
|
|
val beforeList = HashSet<String>(list)
|
|
|
for (belong in beforeList) {
|
|
@@ -569,15 +546,44 @@ open class CalcSpecialService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @Description: 立管连接
|
|
|
+ * @Param:
|
|
|
+ * @Return:
|
|
|
+ */
|
|
|
+ fun riserConnect(projectId: String,domain: String,memSystemType: String,modelIds: List<String>){
|
|
|
+ val ducts = ArrayList<List<Duct>>()
|
|
|
+ val ductList = ductService.select(SFilter.inList("modelId",modelIds), SFilter.gt("riserState",0)).exec()
|
|
|
+ for (modelId in modelIds) {
|
|
|
+ ducts.add(ductList.stream().filter { duct -> duct.modelId == modelId }.collect(Collectors.toList()))
|
|
|
+ }
|
|
|
+ val itemMap = HashMap<String,ArrayList<String>>()
|
|
|
+ for (index in ducts.indices-1) {
|
|
|
+ //低楼层管道
|
|
|
+ val lowerDucts = ducts[index].filter { d -> d.riserState == 2 || d.riserState == 3 }
|
|
|
+ //高楼层管道
|
|
|
+ val higherDucts = ducts[index+1].filter { d -> d.riserState == 1 || d.riserState == 3 }
|
|
|
+ for (lowerDuct in lowerDucts) {
|
|
|
+ val itemList = ArrayList<String>()
|
|
|
+ //允许的距离误差范围
|
|
|
+ val distance = if(lowerDuct.diameter!! > 0) lowerDuct.diameter!! /2 else (lowerDuct.width!!).coerceAtMost(lowerDuct.height!!) /2
|
|
|
+ val lpoint = lowerDuct.location?.points?.get(0) ?: continue
|
|
|
+ for (higherDuct in higherDucts) {
|
|
|
+ val hpoint = higherDuct.location?.points?.get(0)
|
|
|
+ if(hpoint != null){
|
|
|
+ // 求两个点的距离 是否在允许的误差范围内
|
|
|
+ val connected = sqrt((lpoint.x - hpoint.x).pow(2.0) + (lpoint.y - hpoint.y).pow(2.0)) < distance
|
|
|
+ if(connected){
|
|
|
+ itemList.add(higherDuct.id!!)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(itemList.size > 0){
|
|
|
+ itemMap[lowerDuct.id!!] = itemList
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
-// fun calcNetworks(projectId: String,buildingId: String): SBaseResponse{
|
|
|
-// val connectedBlocks = connectedBlockService.select(SFilter.eq("projectId",projectId), SFilter.eq("buildingId",buildingId)).exec()
|
|
|
-// val classCodeList = ArrayList<String>()
|
|
|
-// for (classCodeEnum in ClassCodeEnum.values()) {
|
|
|
-// classCodeList.add(classCodeEnum.name)
|
|
|
-// }
|
|
|
-// val cb = connectedBlocks.filter { s -> classCodeList.contains(s.typeCode1) || classCodeList.contains(s.typeCode2) }
|
|
|
-// }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
} // Class CalcSpecialService
|