From c360853fe3497f42894e841be6e70fc47d03adeb Mon Sep 17 00:00:00 2001 From: gkfktkrh153 Date: Wed, 3 Jan 2024 08:23:43 +0900 Subject: [PATCH 1/2] =?UTF-8?q?refactor=20:=20=EC=A7=80=EC=A0=95=20?= =?UTF-8?q?=ED=83=9C=EA=B7=B8=20=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/api/trip/common/init/InitData.java | 3 ++- .../api/trip/common/naverapi/NaverApiService.java | 12 ++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/api/trip/common/init/InitData.java b/src/main/java/com/api/trip/common/init/InitData.java index 9a9cbb0..07c557e 100644 --- a/src/main/java/com/api/trip/common/init/InitData.java +++ b/src/main/java/com/api/trip/common/init/InitData.java @@ -43,7 +43,8 @@ public CommandLineRunner init() { private void createTag() { - String[] tags = {"부산", "제주", "서울", "요트", "경주", "눈꽃여행", "기차"}; + String[] tags = {"부산", "제주", "서울", "강원", "경남", "춘천", "목포", "여수", "안동", "경주", "대구", "대전", "전주" + ,"눈꽃", "스키", "보드", "바다", "요트", "해양스포츠", "단풍", "골프"}; for (String name : tags) { Tag tag = Tag.builder() diff --git a/src/main/java/com/api/trip/common/naverapi/NaverApiService.java b/src/main/java/com/api/trip/common/naverapi/NaverApiService.java index 77d141b..ca80f01 100644 --- a/src/main/java/com/api/trip/common/naverapi/NaverApiService.java +++ b/src/main/java/com/api/trip/common/naverapi/NaverApiService.java @@ -12,7 +12,8 @@ @Service public class NaverApiService { - private final List tagList = Arrays.asList("부산", "제주", "서울", "크루즈", "일출", "해수욕장"); + private final List tagList = Arrays.asList("부산", "제주", "서울", "강원", "경남", "춘천", "목포", "여수", "안동", "경주", "대구", "대전", "전주" + ,"눈꽃", "스키", "보드", "바다", "요트", "해양스포츠", "단풍", "골프"); public List doFilterCategory(List items){ List filteredItems = new ArrayList<>(); @@ -43,6 +44,13 @@ public List toCreateItemRequest(List items){ } public List extractTagNames(String title){ - return tagList.stream().filter(tag -> title.contains(tag)).toList(); + List list = tagList.stream().filter(tag -> title.contains(tag)).toList(); + + if(title.contains("양양") || title.contains("속초") || title.contains("강릉")) + list.add("강원"); + if(title.contains("여수") || title.contains("순천")) + list.add("여수"); + + return list; } } From 08b58ab98232eaa2db6ffd0a5876f81c6865ccda Mon Sep 17 00:00:00 2001 From: gkfktkrh153 Date: Wed, 3 Jan 2024 08:29:48 +0900 Subject: [PATCH 2/2] . --- src/main/java/com/api/trip/common/naverapi/NaverApiService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/api/trip/common/naverapi/NaverApiService.java b/src/main/java/com/api/trip/common/naverapi/NaverApiService.java index ca80f01..568e5a7 100644 --- a/src/main/java/com/api/trip/common/naverapi/NaverApiService.java +++ b/src/main/java/com/api/trip/common/naverapi/NaverApiService.java @@ -46,7 +46,7 @@ public List toCreateItemRequest(List items){ public List extractTagNames(String title){ List list = tagList.stream().filter(tag -> title.contains(tag)).toList(); - if(title.contains("양양") || title.contains("속초") || title.contains("강릉")) + if(title.contains("양양") || title.contains("속초") || title.contains("강릉") || title.contains("평창") || title.contains("강원")) list.add("강원"); if(title.contains("여수") || title.contains("순천")) list.add("여수");