|
@@ -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:
|