Commit e6116bca authored by hanbing's avatar hanbing

[update] 方案配置,回显按车道序号排序

parent 7f4f3240
......@@ -59,8 +59,6 @@ public class CrossConfigController {
})
public JsonViewObject listLaneInfo(@RequestBody @Valid CrossIdDTO crossIdDTO) {
SaveLaneInfoDTO saveLaneInfoDTO = crossConfigService.listLaneInfo(crossIdDTO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(saveLaneInfoDTO);
return JsonViewObject.newInstance().success(saveLaneInfoDTO);
}
}
......@@ -90,8 +90,6 @@ public class SchemeConfigController {
})
public JsonViewObject listSchemeConfig(@RequestBody CrossIdDTO crossIdDTO) {
SaveSchemeConfigDTO saveSchemeConfigDTO = schemeConfigService.listSchemeConfig(crossIdDTO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(saveSchemeConfigDTO);
return JsonViewObject.newInstance().success(saveSchemeConfigDTO);
}
}
......@@ -406,7 +406,7 @@ public class CrossConfigServiceImpl implements CrossConfigService {
CrossDirInfoPO crossDirInfoPO = crossDirInfoMapper.selectByCrossIdAndDirType(crossId, key);
Integer isPedestrian = crossDirInfoPO.getIsPedestrian();
dirListElement.setIsPersonCross(isPedestrian);
// 构造内层List
// 构造laneList
List<LaneInfoPO> value = entry.getValue();
List<LaneInfoPO> sortedValue = value.stream().
sorted(Comparator.comparing(LaneInfoPO::getSort)).
......
......@@ -37,7 +37,6 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.TreeSet;
import java.util.stream.Collectors;
/**
......@@ -117,7 +116,6 @@ public class SchemeConfigServiceImpl implements SchemeConfigService {
// 构造方案列表
List<SaveSchemeConfigDTO.PhaseScheme> phaseSchemeList = buildPhaseSchemeList(crossId);
saveSchemeConfigDTO.setPhaseSchemeList(phaseSchemeList);
// todo 暂时只有环式
saveSchemeConfigDTO.setTimeType(2);
return saveSchemeConfigDTO;
......@@ -365,7 +363,7 @@ public class SchemeConfigServiceImpl implements SchemeConfigService {
}
}
// 构造车道列表
List<SaveSchemeConfigDTO.LaneListElement> laneList = buildLaneList(crossId, dir, phaseId);
List<SaveSchemeConfigDTO.LaneListElement> laneList = buildLaneList(dir, phaseId);
dirListElement.setLaneList(laneList);
dirList.add(dirListElement);
......@@ -378,12 +376,11 @@ public class SchemeConfigServiceImpl implements SchemeConfigService {
*
* @author Kent HAN
* @date 2023/1/12 15:02
* @param crossId
* @param dir
* @param phaseId
* @return java.util.List<net.wanji.web.dto.SaveSchemeConfigDTO.LaneListElement>
*/
private List<SaveSchemeConfigDTO.LaneListElement> buildLaneList(String crossId, Integer dir, Integer phaseId) {
private List<SaveSchemeConfigDTO.LaneListElement> buildLaneList(Integer dir, Integer phaseId) {
List<SaveSchemeConfigDTO.LaneListElement> laneList = new ArrayList<>();
List<CrossPhaseLightsPO> crossPhaseLightsPOList = crossPhaseLightsMapper.selectByPhaseId(phaseId);
List<Integer> lightsIds = crossPhaseLightsPOList.stream()
......@@ -400,15 +397,14 @@ public class SchemeConfigServiceImpl implements SchemeConfigService {
.collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(laneIds)) {
List<LaneInfoPO> laneInfoPOList = laneInfoMapper.selectByLaneIds(laneIds);
// 根据转向去重
TreeSet<LaneInfoPO> laneInfoPOTreeSet = laneInfoPOList.stream()
.collect(Collectors.toCollection(
() -> new TreeSet<>(Comparator.comparing(LaneInfoPO::getTurn))));
for (LaneInfoPO laneInfoPO : laneInfoPOTreeSet) {
// 根据sort排序
List<LaneInfoPO> collect = laneInfoPOList.stream()
.sorted(Comparator.comparing(LaneInfoPO::getSort))
.collect(Collectors.toList());
for (LaneInfoPO laneInfoPO : collect) {
SaveSchemeConfigDTO.LaneListElement laneListElement = new SaveSchemeConfigDTO.LaneListElement();
laneListElement.setDirection(laneInfoPO.getTurn());
laneListElement.setLaneType(laneInfoPO.getCategory());
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