Commit c9a388ff authored by hanbing's avatar hanbing

运行计划,修复空指针异

parent b46d764a
package net.wanji.web.service.scheme.impl; package net.wanji.web.service.scheme.impl;
import cn.hutool.core.collection.CollectionUtil;
import net.wanji.web.common.constant.ControlModeConst; import net.wanji.web.common.constant.ControlModeConst;
import net.wanji.web.common.exception.PhaseNoNotUniqueException; import net.wanji.web.common.exception.PhaseNoNotUniqueException;
import net.wanji.web.dto.CrossIdDTO; import net.wanji.web.dto.CrossIdDTO;
...@@ -391,17 +392,19 @@ public class SchemeConfigServiceImpl implements SchemeConfigService { ...@@ -391,17 +392,19 @@ public class SchemeConfigServiceImpl implements SchemeConfigService {
List<String> laneIds = crossLaneLightsPOList.stream() List<String> laneIds = crossLaneLightsPOList.stream()
.map(CrossLaneLightsPO::getLaneId) .map(CrossLaneLightsPO::getLaneId)
.collect(Collectors.toList()); .collect(Collectors.toList());
List<LaneInfoPO> laneInfoPOList = laneInfoMapper.selectByLaneIds(laneIds); if (CollectionUtil.isNotEmpty(laneIds)) {
// 根据转向去重 List<LaneInfoPO> laneInfoPOList = laneInfoMapper.selectByLaneIds(laneIds);
TreeSet<LaneInfoPO> laneInfoPOTreeSet = laneInfoPOList.stream() // 根据转向去重
.collect(Collectors.toCollection( TreeSet<LaneInfoPO> laneInfoPOTreeSet = laneInfoPOList.stream()
() -> new TreeSet<>(Comparator.comparing(LaneInfoPO::getTurn)))); .collect(Collectors.toCollection(
for (LaneInfoPO laneInfoPO : laneInfoPOTreeSet) { () -> new TreeSet<>(Comparator.comparing(LaneInfoPO::getTurn))));
SaveSchemeConfigDTO.LaneListElement laneListElement = new SaveSchemeConfigDTO.LaneListElement(); for (LaneInfoPO laneInfoPO : laneInfoPOTreeSet) {
laneListElement.setDirection(laneInfoPO.getTurn()); SaveSchemeConfigDTO.LaneListElement laneListElement = new SaveSchemeConfigDTO.LaneListElement();
laneListElement.setLaneType(laneInfoPO.getCategory()); laneListElement.setDirection(laneInfoPO.getTurn());
laneListElement.setLaneType(laneInfoPO.getCategory());
laneList.add(laneListElement);
laneList.add(laneListElement);
}
} }
} }
} }
......
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