Skip to content

Commit

Permalink
refactor : 역 이름 안에 괄호가 존재할경우 괄호를 제외한 역 이름만 검색하도록 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
1000kkannoo committed Feb 28, 2024
1 parent 4848f84 commit 8bfda52
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,8 @@ private static Participation getGroupAdmin(Space space) {
// 모임 장소 추천 조회 리스트 API
public List<SpacePlaceResponse> keywordCentralizedMeetingSpot(Double x, Double y, String local, String keyword) {
// 네이버 API 요청
URI uri = createNaverRequestUri(local, keyword);
String station = getStation(local);
URI uri = createNaverRequestUri(station, keyword);
ResponseEntity<NaverMapListDto> naverResponse = restTemplate.getForEntity(uri.toString(), NaverMapListDto.class);

// 응답 처리
Expand All @@ -280,7 +281,17 @@ public List<SpacePlaceResponse> keywordCentralizedMeetingSpot(Double x, Double y
// 장소 정보 가져오기
List<NaverMapListDto.placeList> placeList = optionalBody.get().getResult().getPlace().getList();

return placeList.stream().map(toPlaceEntity(x, y, local)).toList();
return placeList.stream().map(toPlaceEntity(x, y, station)).toList();
}

private static String getStation(String local) {
String station = local;
int index = local.indexOf("("); // 괄호의 위치를 찾음
if (index != -1) { // 괄호가 존재한다면
station = local.substring(0, index);
}

return station;
}

// 모임 참여자 정보 리스트 조회 API
Expand Down

0 comments on commit 8bfda52

Please sign in to comment.