Commit 9acb81ab authored by fengyasheng's avatar fengyasheng

路口周报1.1空指针修正

parent 7fdf6bf8
......@@ -60,7 +60,10 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService {
List<CrossRidLaneVO> crossRidLaneVOS = new ArrayList<>();
for (String laneName : laneNameMap.keySet()) {
List<CrossRidLaneDTO> laneDTOS = laneNameMap.get(laneName).stream().filter(x->x.getLaneType() == 2).collect(Collectors.toList());
List<CrossRidLaneDTO> laneDTOS = laneNameMap.get(laneName).stream().filter(x -> ObjectUtil.isNotEmpty(x.getLaneType()) && x.getLaneType() == 2).collect(Collectors.toList());
if(ObjectUtil.isEmpty(laneDTOS)){
continue;
}
CrossRidLaneVO crossRidLaneVO = new CrossRidLaneVO();
crossRidLaneVO.setLaneName(laneName);
if (ObjectUtil.isEmpty(laneDTOS.get(0).getInDir()) || ObjectUtil.isEmpty(laneDTOS.get(0).getOutDir())) {
......@@ -68,14 +71,14 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService {
} else {
crossRidLaneVO.setLaneDir(CrossDirEnum.getDesc(laneDTOS.get(0).getInDir()) + CrossDirEnum.getDesc(laneDTOS.get(0).getOutDir()) + "走向");
}
Map<String, List<CrossRidLaneDTO>> endCrossRoadMap = laneNameMap.get(laneName).stream().filter(x -> x.getLaneType() == 1 && x.getCrossId().equals(x.getStartCrossId())).collect(Collectors.groupingBy(CrossRidLaneDTO::getEndCrossId));
Map<String, List<CrossRidLaneDTO>> startCrossRoadMap = laneNameMap.get(laneName).stream().filter(x -> x.getLaneType() == 1 && x.getCrossId().equals(x.getEndCrossId())).collect(Collectors.groupingBy(CrossRidLaneDTO::getStartCrossId));
Map<String, List<CrossRidLaneDTO>> endCrossRoadMap = laneNameMap.get(laneName).stream().filter(x ->ObjectUtil.isNotEmpty(x.getLaneType()) && x.getLaneType() == 1 && x.getCrossId().equals(x.getStartCrossId())).collect(Collectors.groupingBy(CrossRidLaneDTO::getEndCrossId));
Map<String, List<CrossRidLaneDTO>> startCrossRoadMap = laneNameMap.get(laneName).stream().filter(x ->ObjectUtil.isNotEmpty(x.getLaneType()) && x.getLaneType() == 1 && x.getCrossId().equals(x.getEndCrossId())).collect(Collectors.groupingBy(CrossRidLaneDTO::getStartCrossId));
int maxCount = 0;
for (String endCrossId : endCrossRoadMap.keySet()) {
for (String startCrossId : startCrossRoadMap.keySet()) {
if(endCrossId.equals(startCrossId)){
if (endCrossId.equals(startCrossId)) {
int count = endCrossRoadMap.get(endCrossId).size() + startCrossRoadMap.get(startCrossId).size();
if(count>maxCount){
if (count > maxCount) {
maxCount = count;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment