diff --git a/src/main/java/club/joylink/rtss/controller/publish/MapController.java b/src/main/java/club/joylink/rtss/controller/publish/MapController.java index 64009d08a..954a8f1e3 100644 --- a/src/main/java/club/joylink/rtss/controller/publish/MapController.java +++ b/src/main/java/club/joylink/rtss/controller/publish/MapController.java @@ -254,6 +254,12 @@ public class MapController { return this.iMapService.querySectionsUnderTheStation(id, stationCode); } + @ApiOperation("获取集中站下所有区段") + @GetMapping("/{id}/deviceStation/{stationCode}/sections") + public List querySectionBelongTheDeviceStation(@PathVariable Long id, @PathVariable String stationCode) { + return this.iMapService.querySectionBelongTheDeviceStation(id, stationCode); + } + @ApiOperation(value = "获取地图站台关联的屏蔽门") @GetMapping("/{id}/stand/{standCode}/psd") public List getStandPsds(@PathVariable Long id, diff --git a/src/main/java/club/joylink/rtss/services/IMapService.java b/src/main/java/club/joylink/rtss/services/IMapService.java index 4549e4d82..ac68dbb77 100644 --- a/src/main/java/club/joylink/rtss/services/IMapService.java +++ b/src/main/java/club/joylink/rtss/services/IMapService.java @@ -292,4 +292,9 @@ public interface IMapService { * 查询地图下的所有区段 */ List querySectionsUnderMap(Long id); + + /** + * 查询属于该集中站的区段 + */ + List querySectionBelongTheDeviceStation(Long mapId, String stationCode); } diff --git a/src/main/java/club/joylink/rtss/services/MapService.java b/src/main/java/club/joylink/rtss/services/MapService.java index b74cb10aa..ac894a784 100644 --- a/src/main/java/club/joylink/rtss/services/MapService.java +++ b/src/main/java/club/joylink/rtss/services/MapService.java @@ -42,7 +42,6 @@ import java.text.Collator; import java.time.LocalDateTime; import java.util.*; import java.util.function.Function; -import java.util.stream.Collector; import java.util.stream.Collectors; /** @@ -869,6 +868,13 @@ public class MapService implements IMapService { return mapDetail.getGraphDataNew().getSectionList(); } + @Override + public List querySectionBelongTheDeviceStation(Long mapId, String stationCode) { + MapVO mapDetail = getMapDetail(mapId); + return mapDetail.getGraphDataNew().getSectionList().stream() + .filter(section -> section.getStationCode().equals(stationCode)).collect(Collectors.toList()); + } + /** * 该版本的地图数据是否存在 */