|
2 | 2 |
|
3 | 3 | import com.back.web7_9_codecrete_be.domain.location.dto.response.KakaoLocalResponse; |
4 | 4 | import com.back.web7_9_codecrete_be.domain.location.dto.response.KakaoMobilityResponse; |
| 5 | +import com.back.web7_9_codecrete_be.domain.location.dto.response.KakaoRouteTransitResponse; |
5 | 6 | import com.back.web7_9_codecrete_be.domain.location.service.KakaoLocalService; |
6 | 7 | import com.back.web7_9_codecrete_be.global.error.code.LocationErrorCode; |
7 | 8 | import com.back.web7_9_codecrete_be.global.error.exception.BusinessException; |
@@ -117,5 +118,28 @@ public KakaoMobilityResponse.Summary navigateSummary( |
117 | 118 | return route0.getSummary(); |
118 | 119 |
|
119 | 120 | } |
| 121 | + |
| 122 | + @PostMapping("/navigate/onlyguide") |
| 123 | + public List<KakaoRouteTransitResponse.Guide> navigateOnlyGuides( |
| 124 | + @RequestParam double startX, |
| 125 | + @RequestParam double startY, |
| 126 | + @RequestParam double endX, |
| 127 | + @RequestParam double endY, |
| 128 | + @RequestParam double wayX, |
| 129 | + @RequestParam double wayY |
| 130 | + ) { |
| 131 | + KakaoRouteTransitResponse res = kakaoLocalService.NaviSearchTransit(startX, startY, endX, endY, wayX, wayY); |
| 132 | + |
| 133 | + if (res == null || res.getRoutes() == null || res.getRoutes().isEmpty()) { |
| 134 | + return List.of(); |
| 135 | + } |
| 136 | + |
| 137 | + KakaoRouteTransitResponse.Route route0 = res.getRoutes().get(0); |
| 138 | + |
| 139 | + return route0.getSections().stream() |
| 140 | + .filter(section -> section.getGuides() != null && !section.getGuides().isEmpty()) |
| 141 | + .flatMap(section -> section.getGuides().stream()) |
| 142 | + .toList(); |
| 143 | + } |
120 | 144 | } |
121 | 145 |
|
0 commit comments