|
@@ -80,6 +80,7 @@ open class CalcSpecialService {
|
|
|
|
|
|
val ductService = SObjectService(SMybatisDao(Duct::class.java))
|
|
|
val pipeService = SObjectService(SMybatisDao(Pipe::class.java))
|
|
|
+ val connectorService = SObjectService(SMybatisDao(Connector::class.java))
|
|
|
|
|
|
/**
|
|
|
* 管网系统设备分块
|
|
@@ -267,15 +268,31 @@ open class CalcSpecialService {
|
|
|
*/
|
|
|
fun calcNetworks(projectId: String): SBaseResponse{
|
|
|
val buildings = BuildingService.select(SFilter.eq("projectId",projectId)).exec()
|
|
|
+ val fMap = HashMap<String,HashSet<String>>()
|
|
|
+ val dMap = HashMap<String,HashSet<String>>()
|
|
|
+ val modelIds = ArrayList<String>()
|
|
|
+
|
|
|
for (building in buildings) {
|
|
|
val buildingId = building.id!!
|
|
|
val floors = FloorService.select(SFilter.eq("projectId",projectId), SFilter.eq("buildingId",buildingId)).exec()
|
|
|
- val connectedBlocks = ArrayList<ConnectedBlock>()
|
|
|
for (floor in floors) {
|
|
|
if (!floor.modelId.isNullOrEmpty()) {
|
|
|
- val connectors = mapper.connectorOrder(floor.modelId!!)
|
|
|
- val dcEquipments = EquipmentService.select(SFilter.eq("projectId",projectId), SFilter.eq("floorId",floor.id!!)).exec()
|
|
|
- val dcEquipMap = HashMap<String, Equipment>(1024)
|
|
|
+ modelIds.add(floor.modelId!!)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ val riserMap = riserConnect("DomainHvac","",modelIds)
|
|
|
+
|
|
|
+
|
|
|
+ val connectedBlocks = ArrayList<ConnectedBlock>()
|
|
|
+// for (floor in floors) {
|
|
|
+// if (!floor.modelId.isNullOrEmpty()) {
|
|
|
+// val connectors = mapper.connectorOrder(floor.modelId!!)
|
|
|
+ val connectors = connectorService.select(SFilter.inList("modelId",modelIds)).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>(4096)
|
|
|
for (equipment in dcEquipments) {
|
|
|
if(!equipment.bimId.isNullOrEmpty()){
|
|
|
dcEquipMap[equipment.bimId!!] = equipment
|
|
@@ -285,16 +302,22 @@ open class CalcSpecialService {
|
|
|
|
|
|
val connectorMap = HashMap<String, Connector>(100000)
|
|
|
val typeMap = HashMap<String, String>(20000)
|
|
|
+ val eqBelongMap = HashMap<String, String>(20000)
|
|
|
for (connector in connectors) {
|
|
|
- connectorMap[connector.revitId!!] = connector
|
|
|
+ connectorMap[connector.id!!] = connector
|
|
|
|
|
|
val belong = connector.belongBimId ?: continue
|
|
|
val belongType = connector.belongType
|
|
|
+ val id = connector.id!!
|
|
|
if (belongType != null) {
|
|
|
- typeMap[belong] = belongType
|
|
|
+ typeMap[id] = belongType
|
|
|
+ }
|
|
|
+ if(belongType == "Equipment"){
|
|
|
+ eqBelongMap[id] = belong
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
val belongMap = HashMap<String, HashSet<String>>()
|
|
|
val eqBelongSet = HashSet<String>()
|
|
|
//遍历连接件
|
|
@@ -302,14 +325,15 @@ open class CalcSpecialService {
|
|
|
//拿到所属类
|
|
|
val belongType = connector.belongType
|
|
|
//拿到所属id
|
|
|
- val belong = connector.belongBimId
|
|
|
+ val belong = connector.id
|
|
|
if(belong != null){
|
|
|
+ belongMap[belong] = HashSet()
|
|
|
eqBelongSet.add(belong)
|
|
|
//如果连接件有连接
|
|
|
- if (connector.connectedIds!!.size > 0) {
|
|
|
- val revitId = connector!!.connectedIds?.get(0)
|
|
|
- var currentConnector = connectorMap[revitId!!]
|
|
|
- val cBelong = currentConnector?.belongBimId
|
|
|
+ if (connector.connectIdJson!!.size > 0) {
|
|
|
+ val connectorId = connector!!.connectIdJson?.get(0)
|
|
|
+ var currentConnector = connectorMap[connectorId!!]
|
|
|
+ val cBelong = currentConnector?.id
|
|
|
if (cBelong != null) {
|
|
|
// if(belongType == "Equipment"){
|
|
|
// eqBelongSet.add(belong)
|
|
@@ -328,6 +352,15 @@ open class CalcSpecialService {
|
|
|
}else {
|
|
|
belongMap[belong] = HashSet()
|
|
|
}
|
|
|
+ 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
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
var fBlockId: Int =0
|
|
@@ -340,7 +373,7 @@ open class CalcSpecialService {
|
|
|
var dSet: HashSet<String>
|
|
|
println(eqBelongSet.size)
|
|
|
for (key in eqBelongSet) {
|
|
|
- val e1 = dcEquipMap[key]
|
|
|
+ val e1 = dcEquipMap[eqBelongMap[key]]
|
|
|
if(e1 == null || !enumList.contains(e1.classCode)){
|
|
|
continue
|
|
|
}
|
|
@@ -352,7 +385,7 @@ open class CalcSpecialService {
|
|
|
|
|
|
for (s in dSet!!) {
|
|
|
if(typeMap[s] == "Equipment" && key != s){
|
|
|
- val e2 = dcEquipMap[s]
|
|
|
+ val e2 = dcEquipMap[eqBelongMap[key]]
|
|
|
if(e2 == null || !enumList.contains(e2.classCode)){
|
|
|
continue
|
|
|
}
|
|
@@ -365,8 +398,8 @@ open class CalcSpecialService {
|
|
|
connectedBlock.id2 = e2.id!!
|
|
|
connectedBlock.type1 = "Equipment"
|
|
|
connectedBlock.type2 = "Equipment"
|
|
|
- connectedBlock.modelId1 = floor.modelId
|
|
|
- connectedBlock.modelId2 = floor.modelId
|
|
|
+ connectedBlock.modelId1 = connectorMap[key]!!.modelId
|
|
|
+ connectedBlock.modelId2 = connectorMap[s]!!.modelId
|
|
|
// connectedBlock.domain = connector.domain
|
|
|
// connectedBlock.mepSystemType = connector.mepSystemType
|
|
|
connectedBlock.projectId = projectId
|
|
@@ -381,12 +414,6 @@ open class CalcSpecialService {
|
|
|
|
|
|
}
|
|
|
}
|
|
|
-// if(listOf("Eq4403070003129ce8d657c94c648d2d164ccfc6802c",
|
|
|
-// "Eq4403070003db010203b5e54a0e8e4de56234cb6ac9",
|
|
|
-// "Eq4403070003666459bd6a7e434f8c091392bada823a",
|
|
|
-// "Eq4403070003956fbc1b234a4007bdce0653ae7faba2").contains(e1.id!!)){
|
|
|
-// fSet = fullDist(HashSet(belongSet),belongMap)
|
|
|
-// }
|
|
|
|
|
|
for (block in fBlockMap.keys) {
|
|
|
val set = fBlockMap[block]!!
|
|
@@ -408,9 +435,12 @@ open class CalcSpecialService {
|
|
|
// fSet = fullDist(HashSet(belongSet),belongMap)
|
|
|
// println(fSet.contains(key))
|
|
|
// println(fSet.size)
|
|
|
+
|
|
|
+ fMap[key] = fSet
|
|
|
+ dMap[key] = dSet
|
|
|
for (s in fSet!!) {
|
|
|
if(typeMap[s] == "Equipment" && key != s){
|
|
|
- val e2 = dcEquipMap[s]
|
|
|
+ val e2 = dcEquipMap[eqBelongMap[key]]
|
|
|
if(e2 == null || !enumList.contains(e2.classCode)){
|
|
|
continue
|
|
|
}
|
|
@@ -424,8 +454,8 @@ open class CalcSpecialService {
|
|
|
connectedBlock.id2 = e2.id!!
|
|
|
connectedBlock.type1 = "Equipment"
|
|
|
connectedBlock.type2 = "Equipment"
|
|
|
- connectedBlock.modelId1 = floor.modelId
|
|
|
- connectedBlock.modelId2 = floor.modelId
|
|
|
+ connectedBlock.modelId1 = connectorMap[key]!!.modelId
|
|
|
+ connectedBlock.modelId2 = connectorMap[s]!!.modelId
|
|
|
// connectedBlock.domain = connector.domain
|
|
|
// connectedBlock.mepSystemType = connector.mepSystemType
|
|
|
connectedBlock.projectId = projectId
|
|
@@ -440,34 +470,14 @@ open class CalcSpecialService {
|
|
|
|
|
|
}
|
|
|
}
|
|
|
-// for (block in dBlockMap.keys) {
|
|
|
-// val set = dBlockMap[block]!!
|
|
|
-// if(set.contains(key)){
|
|
|
-// dSet = set
|
|
|
-// cBlockId = block
|
|
|
-// break
|
|
|
-// }
|
|
|
-// }
|
|
|
-// if(dSet == null){
|
|
|
-// dSet = directDist(HashSet(belongSet),belongMap,typeMap)
|
|
|
-// dBlockId ++
|
|
|
-// cBlockId = dBlockId
|
|
|
-// dBlockMap[cBlockId] = dSet
|
|
|
-// }
|
|
|
|
|
|
|
|
|
-// val newWork = dist(ArrayList(belongSet),ArrayList(belongSet), belongMap,typeMap,ArrayList(belongSet),0)
|
|
|
-// val newWork = dist(HashSet(belongSet),HashSet(belongSet), belongMap,typeMap)
|
|
|
-// newWork.fullConnectors!!.removeAll(newWork.directConnectors!!)
|
|
|
-// for (s in newWork.fullConnectors!!) {
|
|
|
-//
|
|
|
-// }
|
|
|
-// for (s in newWork.directConnectors!!) {
|
|
|
-//
|
|
|
// }
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
|
|
|
}
|
|
@@ -477,7 +487,6 @@ open class CalcSpecialService {
|
|
|
connectedBlockService.createList(request)
|
|
|
}
|
|
|
|
|
|
-
|
|
|
return SBaseResponse(SResponseType.success, "")
|
|
|
|
|
|
}
|
|
@@ -551,39 +560,81 @@ open class CalcSpecialService {
|
|
|
* @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()))
|
|
|
- }
|
|
|
+ fun riserConnect(domain: String,memSystemType: String,modelIds: List<String>): HashMap<String,ArrayList<String>>{
|
|
|
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(domain == "DomainHvac"){
|
|
|
+ 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()))
|
|
|
+ }
|
|
|
+ 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
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
- if(itemList.size > 0){
|
|
|
- itemMap[lowerDuct.id!!] = itemList
|
|
|
- }
|
|
|
+ }
|
|
|
+ //水管的立管连接
|
|
|
+ }else if(domain == "DomainPiping"){
|
|
|
+ val pipes = ArrayList<List<Pipe>>()
|
|
|
+ val pipeList = pipeService.select(SFilter.inList("modelId",modelIds), SFilter.gt("riserState",0)).exec()
|
|
|
+ for (modelId in modelIds) {
|
|
|
+ pipes.add(pipeList.stream().filter { pipe -> pipe.modelId == modelId }.collect(Collectors.toList()))
|
|
|
+ }
|
|
|
+ for (index in pipes.indices-1) {
|
|
|
+ //低楼层管道
|
|
|
+ val lowerPipes = pipes[index].filter { d -> d.riserState == 2 || d.riserState == 3 }
|
|
|
+ //高楼层管道
|
|
|
+ val higherPipes = pipes[index+1].filter { d -> d.riserState == 1 || d.riserState == 3 }
|
|
|
+ for (lowerPipe in lowerPipes) {
|
|
|
+ val itemList = ArrayList<String>()
|
|
|
+ //允许的距离误差范围
|
|
|
+ val distance = lowerPipe.diameter!! /2
|
|
|
+ val lpoint = lowerPipe.location?.points?.get(0) ?: continue
|
|
|
+ for (higherPipe in higherPipes) {
|
|
|
+ val hpoint = higherPipe.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(higherPipe.id!!)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(itemList.size > 0){
|
|
|
+ itemMap[lowerPipe.id!!] = itemList
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
+ return itemMap
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
} // Class CalcSpecialService
|