Commit e6116bca authored by hanbing's avatar hanbing

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

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