|
|
@@ -140,7 +140,7 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
|
|
|
*/
|
|
|
@Override
|
|
|
public Map<String,Object> executeEvacuation(LabExitLineEvacuationVo labExitLineEvacuationVo) {
|
|
|
- //todo 根据实验室id查询出对应的pointName数据
|
|
|
+ // 根据实验室id查询出对应的pointName数据
|
|
|
LabBuildFloorLayout labBuildFloorLayout = new LabBuildFloorLayout();
|
|
|
labBuildFloorLayout.setBuildId(labExitLineEvacuationVo.getBuildId());
|
|
|
labBuildFloorLayout.setFloorId(labExitLineEvacuationVo.getFloorId());
|
|
|
@@ -157,7 +157,7 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
|
|
|
if (labExitLineVOList.size() > 0) {
|
|
|
String relationData = labExitLineVOList.get(0).getRelationalData();
|
|
|
List <LabExitLineJoinPointVO> newRelationalData = JSONArray.parseArray(relationData, LabExitLineJoinPointVO.class);
|
|
|
- //todo 这里赛选出pointName 的对应的key 的真实pointName 这里赛选门对应的坏点和实验室对应的起点标记坏点
|
|
|
+ // 这里赛选出pointName 的对应的key 的真实pointName 这里赛选门对应的坏点和实验室对应的起点标记坏点
|
|
|
Optional.ofNullable(newRelationalData)
|
|
|
.orElseGet(Collections::emptyList)
|
|
|
.stream()
|
|
|
@@ -182,7 +182,7 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
|
|
|
|
|
|
//这里需要在通过floyd计算一次原始数据,作为发生预案的楼层,只有一个疏散口,那么所有的实验室,都向这个疏散口撤离。
|
|
|
List <LabExitLineJoinPointVO> oldRelationalData = JSONArray.parseArray(relationData, LabExitLineJoinPointVO.class);
|
|
|
- //todo 这里只赛选门对应的坏点的数据,用作计算备用线路用
|
|
|
+ // 这里只赛选门对应的坏点的数据,用作计算备用线路用
|
|
|
Optional.ofNullable(oldRelationalData)
|
|
|
.orElseGet(Collections::emptyList)
|
|
|
.stream()
|
|
|
@@ -211,7 +211,7 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
|
|
|
exitPointRelay.setBuildId(labExitLineEvacuationVo.getBuildId());
|
|
|
exitPointRelay.setFloorId(labExitLineEvacuationVo.getFloorId());
|
|
|
List <LabExitPointRelay> labExitPointRelays = labExitPointRelayMapper.selectLabExitPointRelayList(exitPointRelay);
|
|
|
- //todo 关闭继电器开关
|
|
|
+ // 关闭继电器开关
|
|
|
for(LabExitPointRelay relay : labExitPointRelays) {
|
|
|
try {
|
|
|
if (relay.getRelayType().intValue() == 1) {
|
|
|
@@ -235,11 +235,11 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
- //todo 关闭喇叭
|
|
|
+ // 关闭喇叭
|
|
|
closeHorn(labExitLineEvacuationVo);
|
|
|
}
|
|
|
|
|
|
- //todo 计算坏点(目前只有发生预案的实验室需要标记为坏点),需要把非坏点关联坏点点位全部改成无限大
|
|
|
+ // 计算坏点(目前只有发生预案的实验室需要标记为坏点),需要把非坏点关联坏点点位全部改成无限大
|
|
|
public void badPoints(List <LabExitLineJoinPointVO> newRelationalData, String badPointName) {
|
|
|
//这里计算预案发生的实验室坏点
|
|
|
Optional.ofNullable(newRelationalData).orElseGet(Collections::emptyList)
|
|
|
@@ -252,7 +252,7 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- //todo 计算交通点,把所有关闭的逃生口,全部标记为通道
|
|
|
+ // 计算交通点,把所有关闭的逃生口,全部标记为通道
|
|
|
public void crossPoints(List <LabExitLineJoinPointVO> newRelationalData, String badPointName) {
|
|
|
//这里计算预案发生的实验室坏点
|
|
|
Optional.ofNullable(newRelationalData).orElseGet(Collections::emptyList)
|
|
|
@@ -265,7 +265,7 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- //todo 计算完成的路线,灯的数据
|
|
|
+ // 计算完成的路线,灯的数据
|
|
|
public Map <String, Object> displayPath(ArrayList <Integer[][]> list, List <LabExitLineJoinPointVO> linePointVOList, LabExitLineEvacuationVo labExitLineEvacuationVo, ArrayList <Integer[][]> oldList, List <LabExitLineJoinPointVO> oldRelationalData) {
|
|
|
|
|
|
logger.info("当前线程:{}", Thread.currentThread().getName());
|
|
|
@@ -295,9 +295,9 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
|
|
|
return filterLinePoint(completableFutures, labExitLineEvacuationVo.getStartPointName(), labExitLineEvacuationVo);
|
|
|
}
|
|
|
|
|
|
- //todo 预案触发实验室的主线路到逃生点全部返回,其他实验室赛选过滤最优线路,如果和主线路有重叠或者逆向,需要移除重叠以后的数据点。
|
|
|
+ // 预案触发实验室的主线路到逃生点全部返回,其他实验室赛选过滤最优线路,如果和主线路有重叠或者逆向,需要移除重叠以后的数据点。
|
|
|
public Map <String, Object> filterLinePoint(List <CompletableFuture <Map <String, Object>>> completableFutures, final String startPointName, LabExitLineEvacuationVo labExitLineEvacuationVo) {
|
|
|
- //todo 断言名字是否相同
|
|
|
+ // 断言名字是否相同
|
|
|
Predicate <String> checkPointName = x -> startPointName.equals(x);
|
|
|
List <List <LabExitLineJoinPointVO>> startPointList = new ArrayList <>();
|
|
|
Map <String, Integer> sortKeyMap = new LinkedHashMap <>();
|
|
|
@@ -326,13 +326,13 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
|
|
|
});
|
|
|
|
|
|
|
|
|
- //todo 将过滤好的otherPointMap转换成list
|
|
|
+ // 将过滤好的otherPointMap转换成list
|
|
|
Function <Map <String, List <LabExitLineJoinPointVO>>, List <List <LabExitLineJoinPointVO>>> otherPointList =
|
|
|
a -> a.entrySet().stream().map(Map.Entry::getValue).collect(Collectors.toList());
|
|
|
|
|
|
Map <String, Object> allPointMap = new LinkedHashMap <>();
|
|
|
joinLine(allPointMap, startPointList, labExitLineEvacuationVo).accept(otherPointList.apply(otherPointMap));
|
|
|
- //todo 开启逃生灯绑定继电器的数据 采用线程异步调用
|
|
|
+ // 开启逃生灯绑定继电器的数据 采用线程异步调用
|
|
|
new Thread(()->openLightJoinRelay((Set <LabExitLineJoinPointVO>) allPointMap.get("lightPointSet"),labExitLineEvacuationVo)).start();
|
|
|
return allPointMap;
|
|
|
}
|
|
|
@@ -351,7 +351,7 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
|
|
|
labExitPointRelay.setBuildId(labExitLineEvacuationVo.getBuildId());
|
|
|
labExitPointRelay.setFloorId(labExitLineEvacuationVo.getFloorId());
|
|
|
List <LabExitPointRelay> labExitPointRelays = labExitPointRelayMapper.selectLabExitPointRelayList(labExitPointRelay);
|
|
|
- //todo 这里需要两层for循环,比对点名称一样的,开启继电器开关
|
|
|
+ // 这里需要两层for循环,比对点名称一样的,开启继电器开关
|
|
|
Consumer<LabExitPointRelay> consumer = a->Optional.ofNullable(lightPointList).orElseGet(Collections::emptySet)
|
|
|
.stream()
|
|
|
.filter(b->b.getKey().equals(a.getPointName()))
|
|
|
@@ -381,7 +381,7 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
|
|
|
Optional.ofNullable(labExitPointRelays).orElseGet(Collections::emptyList)
|
|
|
.stream()
|
|
|
.forEach(a->consumer.accept(a));
|
|
|
- //todo 调用楼层的喇叭
|
|
|
+ // 调用楼层的喇叭
|
|
|
openHorn(labExitLineEvacuationVo);
|
|
|
}
|
|
|
|
|
|
@@ -474,11 +474,11 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
|
|
|
Set <LabExitLineJoinPointVO> lightPointSet = new LinkedHashSet <>();
|
|
|
List <List <LabExitLineJoinPointVO>> groupPointList = new ArrayList <>();
|
|
|
|
|
|
- //todo 添加一个过滤只有灯点的消费者
|
|
|
+ // 添加一个过滤只有灯点的消费者
|
|
|
Consumer <List <LabExitLineJoinPointVO>> lightPoint = a -> Optional.ofNullable(a).orElseGet(Collections::emptyList)
|
|
|
.stream()
|
|
|
.filter(b -> b.getPointAttribute() == 2).forEach(b -> lightPointSet.add(b));
|
|
|
- //todo 预案点保存线路和灯
|
|
|
+ // 预案点保存线路和灯
|
|
|
Consumer <List <List <LabExitLineJoinPointVO>>> consumer1 = a -> Optional.ofNullable(a)
|
|
|
.orElseGet(Collections::emptyList)
|
|
|
.stream()
|
|
|
@@ -486,13 +486,13 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
|
|
|
linePointSet.addAll(b);
|
|
|
//属性是2,说明只返回灯点
|
|
|
lightPoint.accept(b);
|
|
|
- //todo 在添加一个完成线路点的集合
|
|
|
+ // 在添加一个完成线路点的集合
|
|
|
suppleBuildAndFloor(b.stream().collect(Collectors.toSet()), labExitLineEvacuationVo);
|
|
|
groupPointList.add(b);
|
|
|
});
|
|
|
consumer1.accept(startPointList);
|
|
|
|
|
|
- //todo 加一个子线路的消费者,如果子线路和主线路重合,需要给删除的delAdder添加1,否则0
|
|
|
+ // 加一个子线路的消费者,如果子线路和主线路重合,需要给删除的delAdder添加1,否则0
|
|
|
LongAdder delAdder = new LongAdder();
|
|
|
Consumer <LabExitLineJoinPointVO> checkSonPoint = x -> startPointList.stream().forEach(b -> {
|
|
|
Optional.ofNullable(b).orElseGet(Collections::emptyList)
|
|
|
@@ -504,12 +504,12 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
- //todo 其他点保存线路和灯
|
|
|
+ // 其他点保存线路和灯
|
|
|
Consumer <List <List <LabExitLineJoinPointVO>>> consumer2 = a -> Optional.ofNullable(a)
|
|
|
.orElseGet(Collections::emptyList)
|
|
|
.stream()
|
|
|
.forEach(b -> {
|
|
|
- //todo 这里判断是否一直删除,boolean不能传入,暂时用这个校验
|
|
|
+ // 这里判断是否一直删除,boolean不能传入,暂时用这个校验
|
|
|
delAdder.reset();
|
|
|
Optional.ofNullable(b).orElseGet(Collections::emptyList)
|
|
|
.stream()
|
|
|
@@ -523,7 +523,7 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
- //todo 在添加一个完成线路点的集合
|
|
|
+ // 在添加一个完成线路点的集合
|
|
|
suppleBuildAndFloor(b.stream().collect(Collectors.toSet()), labExitLineEvacuationVo);
|
|
|
groupPointList.add(b);
|
|
|
});
|
|
|
@@ -550,18 +550,16 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
|
|
|
}
|
|
|
|
|
|
|
|
|
- //todo 针对实验室计算出当前实验室的各种线路,过滤到最优线路
|
|
|
+ // 针对实验室计算出当前实验室的各种线路,过滤到最优线路
|
|
|
public CompletableFuture <Map <String, Object>> optimalRoute(List <LabExitLineJoinPointVO> linePointVOList, Integer[][] path, Integer[] chain, int i, int j, ArrayList <Integer[][]> oldList, List <LabExitLineJoinPointVO> oldRelationalData,LabExitLineEvacuationVo labExitLineEvacuationVo) {
|
|
|
- //输出源到目的地
|
|
|
- System.out.println("\n " + (linePointVOList.get(i).getPointName()) + "->" + (linePointVOList.get(i).getPointVOList().get(j).getPointName()) + " ");
|
|
|
//保存两个点之间的途径点。
|
|
|
List <LabExitLineJoinPointVO> joinPointVOS = new ArrayList <>();
|
|
|
- //todo 这里用map保存三个结果,一个是计算好的线路,一个是顶点名称,一个是计算的顶点到最优线路距离.
|
|
|
+ // 这里用map保存三个结果,一个是计算好的线路,一个是顶点名称,一个是计算的顶点到最优线路距离.
|
|
|
Map <String, Object> joinPointMap = new HashMap <>();
|
|
|
//输出最短路径的长度
|
|
|
if (linePointVOList.get(i).getPointVOList().get(j).getPointDistance() == M) {
|
|
|
logger.info(" NA ");
|
|
|
- //todo 这里原来是NA,也就是说没有匹配到线路,如果线路出现坏点,并且没有其他备用线路,那么就选择坏点线路
|
|
|
+ // 这里原来是NA,也就是说没有匹配到线路,如果线路出现坏点,并且没有其他备用线路,那么就选择坏点线路
|
|
|
LongAdder adder = new LongAdder();
|
|
|
Optional.ofNullable(labExitLineEvacuationVo.getBadPointNames())
|
|
|
.orElseGet(Collections::emptyList)
|
|
|
@@ -634,7 +632,7 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
|
|
|
SaveUtil.setCommonAttr(labExitLineVertex);
|
|
|
labExitLineVertexMapper.insertLabExitLineVertex(labExitLineVertex);
|
|
|
|
|
|
- //todo 循环插入点和实验室id关系布局数据
|
|
|
+ // 循环插入点和实验室id关系布局数据
|
|
|
Consumer<List<LabBuildFloorLayout>> consumer = a -> Optional.ofNullable(a)
|
|
|
.orElseGet(Collections::emptyList)
|
|
|
.stream()
|
|
|
@@ -646,21 +644,21 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
|
|
|
SaveUtil.setCommonAttr(b);
|
|
|
labBuildFloorLayoutMapper.insertLabBuildFloorLayout(b);
|
|
|
});
|
|
|
- //todo 删除布局图点和实验室id关系数据
|
|
|
+ // 删除布局图点和实验室id关系数据
|
|
|
LabBuildFloorLayout labBuildFloorLayout = new LabBuildFloorLayout();
|
|
|
labBuildFloorLayout.setBuildId(lineVertexVo.getBuildId());
|
|
|
labBuildFloorLayout.setFloorId(lineVertexVo.getFloorId());
|
|
|
labBuildFloorLayoutMapper.deleteLabBuildFloorLayout(labBuildFloorLayout);
|
|
|
- //todo 消费者调用函数
|
|
|
+ // 消费者调用函数
|
|
|
consumer.accept(lineVertexVo.getBuildFloorLayouts());
|
|
|
|
|
|
|
|
|
- //todo 删除点和继电器绑定关系
|
|
|
+ // 删除点和继电器绑定关系
|
|
|
LabExitPointRelay exitPointRelay = new LabExitPointRelay();
|
|
|
exitPointRelay.setBuildId(lineVertexVo.getBuildId());
|
|
|
exitPointRelay.setFloorId(lineVertexVo.getFloorId());
|
|
|
labExitPointRelayMapper.deleteLabExitPointRelay(exitPointRelay);
|
|
|
- //todo 点和继电器绑定关系
|
|
|
+ // 点和继电器绑定关系
|
|
|
Optional.ofNullable(lineVertexVo.getExitPointRelayList())
|
|
|
.orElseGet(Collections::emptyList)
|
|
|
.stream()
|
|
|
@@ -683,12 +681,12 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
|
|
|
// SaveUtil.setCommonAttr(b);
|
|
|
// labExitJoinSubpointMapper.insertLabExitJoinSubpoint(b);
|
|
|
// });
|
|
|
-// //todo 删除楼层的点和实验室id关系数据
|
|
|
+// // 删除楼层的点和实验室id关系数据
|
|
|
// LabExitJoinSubpoint labExitJoinSubpoint = new LabExitJoinSubpoint();
|
|
|
// labExitJoinSubpoint.setBuildId(lineVertexVo.getBuildId());
|
|
|
// labExitJoinSubpoint.setFloorId(lineVertexVo.getFloorId());
|
|
|
// labExitJoinSubpointMapper.deleteLabExitJoinSubpointByFloorId(labExitJoinSubpoint);
|
|
|
-// //todo 消费者调用函数
|
|
|
+// // 消费者调用函数
|
|
|
// consumer.accept(lineVertexVo.getJoinSubpointList());
|
|
|
return 1;
|
|
|
}
|