|
@@ -2,18 +2,18 @@ package com.zd.laboratory.service.impl;
|
|
|
|
|
|
|
|
import cn.hutool.core.date.StopWatch;
|
|
import cn.hutool.core.date.StopWatch;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
+import com.alibaba.nacos.shaded.org.checkerframework.checker.nullness.Opt;
|
|
|
import com.zd.algorithm.api.speaker.entity.ParamVo;
|
|
import com.zd.algorithm.api.speaker.entity.ParamVo;
|
|
|
import com.zd.algorithm.api.speaker.entity.PlayVo;
|
|
import com.zd.algorithm.api.speaker.entity.PlayVo;
|
|
|
import com.zd.algorithm.api.speaker.feign.RemoteSpeakService;
|
|
import com.zd.algorithm.api.speaker.feign.RemoteSpeakService;
|
|
|
-import com.zd.common.core.utils.*;
|
|
|
|
|
|
|
+import com.zd.common.core.utils.DateUtils;
|
|
|
|
|
+import com.zd.common.core.utils.SaveUtil;
|
|
|
|
|
+import com.zd.common.core.utils.SecurityUtils;
|
|
|
|
|
+import com.zd.common.core.utils.StringUtils;
|
|
|
import com.zd.laboratory.config.TimeWaitConfigUtils;
|
|
import com.zd.laboratory.config.TimeWaitConfigUtils;
|
|
|
-import com.zd.laboratory.domain.LabAudioSynthesis;
|
|
|
|
|
-import com.zd.laboratory.domain.LabBuildFloorLayout;
|
|
|
|
|
-import com.zd.laboratory.domain.LabExitLineVertex;
|
|
|
|
|
-import com.zd.laboratory.domain.LabExitPointRelay;
|
|
|
|
|
|
|
+import com.zd.laboratory.domain.*;
|
|
|
import com.zd.laboratory.domain.vo.*;
|
|
import com.zd.laboratory.domain.vo.*;
|
|
|
import com.zd.laboratory.mapper.*;
|
|
import com.zd.laboratory.mapper.*;
|
|
|
-import com.zd.laboratory.service.ILabBuildFloorLayoutService;
|
|
|
|
|
import com.zd.laboratory.service.ILabExitLineVertexService;
|
|
import com.zd.laboratory.service.ILabExitLineVertexService;
|
|
|
import com.zd.laboratory.socket.command.Symbol;
|
|
import com.zd.laboratory.socket.command.Symbol;
|
|
|
import com.zd.laboratory.socket.service.SocketService;
|
|
import com.zd.laboratory.socket.service.SocketService;
|
|
@@ -67,6 +67,12 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private LabBuildFloorLayoutMapper labBuildFloorLayoutMapper;
|
|
private LabBuildFloorLayoutMapper labBuildFloorLayoutMapper;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private LabSubjectMapper labSubjectMapper;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private LabHardwareStateMapper labHardwareStateMapper;
|
|
|
|
|
+
|
|
|
|
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(LabExitLineVertexServiceImpl.class);
|
|
private static final Logger log = LoggerFactory.getLogger(LabExitLineVertexServiceImpl.class);
|
|
|
|
|
|
|
@@ -124,7 +130,7 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
|
|
|
* @return 逃生线路主
|
|
* @return 逃生线路主
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public Map <String, Object> executeEvacuation(LabExitLineEvacuationVo labExitLineEvacuationVo) {
|
|
|
|
|
|
|
+ public Map<String,Object> executeEvacuation(LabExitLineEvacuationVo labExitLineEvacuationVo) {
|
|
|
//todo 根据实验室id查询出对应的pointName数据
|
|
//todo 根据实验室id查询出对应的pointName数据
|
|
|
LabBuildFloorLayout labBuildFloorLayout = new LabBuildFloorLayout();
|
|
LabBuildFloorLayout labBuildFloorLayout = new LabBuildFloorLayout();
|
|
|
labBuildFloorLayout.setBuildId(labExitLineEvacuationVo.getBuildId());
|
|
labBuildFloorLayout.setBuildId(labExitLineEvacuationVo.getBuildId());
|
|
@@ -180,6 +186,7 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
|
|
|
ArrayList <Integer[][]> oldList = flody(oldRelationalData);
|
|
ArrayList <Integer[][]> oldList = flody(oldRelationalData);
|
|
|
//计算楼层各个实验室的逃生线路
|
|
//计算楼层各个实验室的逃生线路
|
|
|
Map <String, Object> joinPointVOS = displayPath(list, newRelationalData, labExitLineEvacuationVo, oldList, oldRelationalData);
|
|
Map <String, Object> joinPointVOS = displayPath(list, newRelationalData, labExitLineEvacuationVo, oldList, oldRelationalData);
|
|
|
|
|
+
|
|
|
return joinPointVOS;
|
|
return joinPointVOS;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -188,6 +195,8 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
//todo 计算坏点(目前只有发生预案的实验室需要标记为坏点),需要把非坏点关联坏点点位全部改成无限大
|
|
//todo 计算坏点(目前只有发生预案的实验室需要标记为坏点),需要把非坏点关联坏点点位全部改成无限大
|
|
|
public void badPoints(List <LabExitLineJoinPointVO> newRelationalData, String badPointName) {
|
|
public void badPoints(List <LabExitLineJoinPointVO> newRelationalData, String badPointName) {
|
|
|
//这里计算预案发生的实验室坏点
|
|
//这里计算预案发生的实验室坏点
|
|
@@ -444,7 +453,7 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
|
|
|
//todo 针对实验室计算出当前实验室的各种线路,过滤到最优线路
|
|
//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) {
|
|
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) {
|
|
|
//输出源到目的地
|
|
//输出源到目的地
|
|
|
- logger.info("\n " + (linePointVOList.get(i).getPointName()) + "->" + (linePointVOList.get(i).getPointVOList().get(j).getPointName()) + " ");
|
|
|
|
|
|
|
+ System.out.println("\n " + (linePointVOList.get(i).getPointName()) + "->" + (linePointVOList.get(i).getPointVOList().get(j).getPointName()) + " ");
|
|
|
//保存两个点之间的途径点。
|
|
//保存两个点之间的途径点。
|
|
|
List <LabExitLineJoinPointVO> joinPointVOS = new ArrayList <>();
|
|
List <LabExitLineJoinPointVO> joinPointVOS = new ArrayList <>();
|
|
|
//todo 这里用map保存三个结果,一个是计算好的线路,一个是顶点名称,一个是计算的顶点到最优线路距离.
|
|
//todo 这里用map保存三个结果,一个是计算好的线路,一个是顶点名称,一个是计算的顶点到最优线路距离.
|
|
@@ -453,7 +462,17 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
|
|
|
if (linePointVOList.get(i).getPointVOList().get(j).getPointDistance() == M) {
|
|
if (linePointVOList.get(i).getPointVOList().get(j).getPointDistance() == M) {
|
|
|
logger.info(" NA ");
|
|
logger.info(" NA ");
|
|
|
//todo 这里原来是NA,也就是说没有匹配到线路,如果线路出现坏点,并且没有其他备用线路,那么就选择坏点线路
|
|
//todo 这里原来是NA,也就是说没有匹配到线路,如果线路出现坏点,并且没有其他备用线路,那么就选择坏点线路
|
|
|
- if(!labExitLineEvacuationVo.getStartPointName().equals(linePointVOList.get(i).getPointName())){
|
|
|
|
|
|
|
+ LongAdder adder = new LongAdder();
|
|
|
|
|
+ Optional.ofNullable(labExitLineEvacuationVo.getBadPointNames())
|
|
|
|
|
+ .orElseGet(Collections::emptyList)
|
|
|
|
|
+ .stream()
|
|
|
|
|
+ .forEach(p->{
|
|
|
|
|
+ if(p.equals(linePointVOList.get(i).getPointVOList().get(j).getPointName())){
|
|
|
|
|
+ adder.increment();
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ if(!labExitLineEvacuationVo.getStartPointName().equals(linePointVOList.get(i).getPointName()) && adder.intValue()<1){
|
|
|
getHistoryLinePoint(oldRelationalData, oldList.get(0), chain, i, j, joinPointVOS);
|
|
getHistoryLinePoint(oldRelationalData, oldList.get(0), chain, i, j, joinPointVOS);
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
@@ -505,6 +524,7 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
|
|
|
labExitLineVertex.setFloorId(lineVertexVo.getFloorId());
|
|
labExitLineVertex.setFloorId(lineVertexVo.getFloorId());
|
|
|
labExitLineVertex.setRelationalData(JSONArray.toJSONString(lineVertexVo.getRelationalData()));
|
|
labExitLineVertex.setRelationalData(JSONArray.toJSONString(lineVertexVo.getRelationalData()));
|
|
|
labExitLineVertex.setLayoutData(lineVertexVo.getLayoutData());
|
|
labExitLineVertex.setLayoutData(lineVertexVo.getLayoutData());
|
|
|
|
|
+ labExitLineVertex.setLayoutJoinData(lineVertexVo.getLayoutJoinData());
|
|
|
labExitLineVertex.setImgUrl(lineVertexVo.getImgUrl());
|
|
labExitLineVertex.setImgUrl(lineVertexVo.getImgUrl());
|
|
|
labExitLineVertex.setCanvasWidth(lineVertexVo.getCanvasWidth());
|
|
labExitLineVertex.setCanvasWidth(lineVertexVo.getCanvasWidth());
|
|
|
labExitLineVertex.setCanvasHeight(lineVertexVo.getCanvasHeight());
|
|
labExitLineVertex.setCanvasHeight(lineVertexVo.getCanvasHeight());
|
|
@@ -598,6 +618,52 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
|
|
|
return 1;
|
|
return 1;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public LabExitLineVertexInfoVo getFloorInfo(Long floorId) {
|
|
|
|
|
+ LabExitLineVertex labExitLineVertex = new LabExitLineVertex();
|
|
|
|
|
+ labExitLineVertex.setFloorId(floorId);
|
|
|
|
|
+ List<LabExitLineVertex> exitLineList = labExitLineVertexMapper.getExitLineVertexList(labExitLineVertex);
|
|
|
|
|
+ //布局图基础信息
|
|
|
|
|
+ LabExitLineVertexInfoVo labExitLineVertexInfoVo = new LabExitLineVertexInfoVo();
|
|
|
|
|
+ if(exitLineList.size()>0){
|
|
|
|
|
+ labExitLineVertexInfoVo.setLabExitLineVertex(exitLineList.get(0));
|
|
|
|
|
+ }
|
|
|
|
|
+ //获取布局图实验室信息信息
|
|
|
|
|
+ LabBuildFloorLayout labBuildFloorLayout = new LabBuildFloorLayout();
|
|
|
|
|
+ labBuildFloorLayout.setFloorId(floorId);
|
|
|
|
|
+ List <LabBuildFloorLayoutVo> buildFloorLayoutVoList = labBuildFloorLayoutMapper.selectLabBuildFloorLayoutList(labBuildFloorLayout);
|
|
|
|
|
+ labExitLineVertexInfoVo.setBuildFloorLayoutVoList(buildFloorLayoutVoList);
|
|
|
|
|
+ //处理布局图实验室id
|
|
|
|
|
+ List<Long> subIds = Optional.of(buildFloorLayoutVoList).orElseGet(Collections::emptyList)
|
|
|
|
|
+ .parallelStream()
|
|
|
|
|
+ .map(a->a.getSubId()).collect(Collectors.toList());
|
|
|
|
|
+ List<LabSubject> subjectList = labSubjectMapper.getByIds(subIds);
|
|
|
|
|
+
|
|
|
|
|
+ Optional.ofNullable(buildFloorLayoutVoList)
|
|
|
|
|
+ .orElseGet(Collections::emptyList)
|
|
|
|
|
+ .stream()
|
|
|
|
|
+ .forEach(a->Optional.ofNullable(subjectList)
|
|
|
|
|
+ .orElseGet(Collections::emptyList)
|
|
|
|
|
+ .stream()
|
|
|
|
|
+ .filter(b->a.getSubId().longValue()==b.getId())
|
|
|
|
|
+ .forEach(b->{
|
|
|
|
|
+ a.setSubName(b.getName());
|
|
|
|
|
+ }));
|
|
|
|
|
+ //实验室下的在线人员
|
|
|
|
|
+ List<LabSubjectByUserNumVo> subjectByUserNumVoList = labHardwareStateMapper.querySubsOnlineUser(subIds);
|
|
|
|
|
+ Optional.ofNullable(buildFloorLayoutVoList)
|
|
|
|
|
+ .orElseGet(Collections::emptyList)
|
|
|
|
|
+ .stream()
|
|
|
|
|
+ .forEach(a->Optional.ofNullable(subjectByUserNumVoList)
|
|
|
|
|
+ .orElseGet(Collections::emptyList)
|
|
|
|
|
+ .stream()
|
|
|
|
|
+ .filter(b->a.getSubId().longValue()==b.getSubId())
|
|
|
|
|
+ .forEach(b->{
|
|
|
|
|
+ a.setOnline(b.getUserNum());
|
|
|
|
|
+ }));
|
|
|
|
|
+ return labExitLineVertexInfoVo;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
public ArrayList <Integer[][]> flody(List <LabExitLineJoinPointVO> dist) {
|
|
public ArrayList <Integer[][]> flody(List <LabExitLineJoinPointVO> dist) {
|
|
|
Integer[][] path = new Integer[V][V];//存储的是从i->j经过的最后一个节点
|
|
Integer[][] path = new Integer[V][V];//存储的是从i->j经过的最后一个节点
|