From 8b87917834fd4c0f7a61050c2a581a82f8d33e1f Mon Sep 17 00:00:00 2001 From: sungjindev Date: Thu, 8 Feb 2024 16:24:07 +0900 Subject: [PATCH 01/21] =?UTF-8?q?feat=20:=20=EA=B0=80=EA=B2=8C=20=EC=9D=B4?= =?UTF-8?q?=EB=A6=84,=20=EC=97=85=EC=A2=85,=20=EC=A3=BC=EC=86=8C=EC=97=90?= =?UTF-8?q?=20=EB=8C=80=ED=95=9C=20=EA=B2=80=EC=83=89=EC=9D=84=ED=95=98?= =?UTF-8?q?=EA=B3=A0=20=ED=95=98=EB=B2=84=EC=82=AC=EC=9D=B8=20=EA=B3=B5?= =?UTF-8?q?=EC=8B=9D=EC=9D=84=20=EC=9D=B4=EC=9A=A9=ED=95=B4=20=EA=B0=80?= =?UTF-8?q?=EA=B9=8C=EC=9A=B4=20=EC=88=9C=EC=9C=BC=EB=A1=9C=20=EC=B5=9C?= =?UTF-8?q?=EB=8C=80=2075=EA=B0=9C=EC=9D=98=20=EA=B0=80=EA=B2=8C=20?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=20=EB=A6=AC=ED=84=B4=ED=95=B4=EC=A3=BC?= =?UTF-8?q?=EB=8A=94=20=EC=BF=BC=EB=A6=AC=20=EA=B5=AC=ED=98=84=20(#89)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dao/StoreCertificationRepository.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/java/com/nainga/nainga/domain/storecertification/dao/StoreCertificationRepository.java b/src/main/java/com/nainga/nainga/domain/storecertification/dao/StoreCertificationRepository.java index cbfc48d..98be9b0 100644 --- a/src/main/java/com/nainga/nainga/domain/storecertification/dao/StoreCertificationRepository.java +++ b/src/main/java/com/nainga/nainga/domain/storecertification/dao/StoreCertificationRepository.java @@ -78,5 +78,21 @@ public List findStoreCertificationsByStoreId(Long storeId) { return query.getResultList(); } + + //검색어를 이용해 가게 이름, 업종, 주소에 대해 검색하고 나온 검색 결과 중 사용자로부터 가까운 순으로 최대 75개의 가게 정보를 리턴 + public List searchStoreCertificationsByLocation(Location currentLocation, String searchKeyword) { //사용자의 현재 (경도, 위도) 좌표와 검색 키워드를 전달 받기 + TypedQuery query = em.createQuery( + "SELECT sc FROM StoreCertification sc " + + "JOIN FETCH sc.store s " + + "JOIN FETCH sc.certification c " + + "WHERE sc.store.displayName LIKE CONCAT('%', :searchKeyword, '%') " + //가게 이름에 대한 검색 + "OR sc.store.primaryTypeDisplayName LIKE CONCAT('%', :searchKeyword, '%') " + //업종에 대한 검색 + "OR sc.store.formattedAddress LIKE CONCAT('%', :searchKeyword, '%') " + //주소에 대한 검색 + "ORDER BY (6371 * acos(cos(radians(36.628486474734)) * cos(radians(ST_Y(:currentLocation))) * cos(radians(ST_X(:currentLocation)) - radians(127.4574415007155)) + sin(radians(36.628486474734)) * sin(radians(ST_Y(:currentLocation))))) LIMIT 75", //하버사인 공식을 이용해 두 좌표상 거리 구하기 + StoreCertification.class).setParameter("currentLocation", currentLocation) + .setParameter("searchKeyword", searchKeyword); + + return query.getResultList(); + } } From 2edbba0a0528b93da0e82147b70f8f27c8bee3fe Mon Sep 17 00:00:00 2001 From: sungjindev Date: Thu, 8 Feb 2024 16:32:48 +0900 Subject: [PATCH 02/21] =?UTF-8?q?searchStoreCertificationsByLocationAndKey?= =?UTF-8?q?word=20Service=20=EB=A1=9C=EC=A7=81=20=EA=B5=AC=ED=98=84=20(#89?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StoreCertificationService.java | 31 +++++++++++++++++++ .../dao/StoreCertificationRepository.java | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/nainga/nainga/domain/storecertification/application/StoreCertificationService.java b/src/main/java/com/nainga/nainga/domain/storecertification/application/StoreCertificationService.java index 7357590..b365434 100644 --- a/src/main/java/com/nainga/nainga/domain/storecertification/application/StoreCertificationService.java +++ b/src/main/java/com/nainga/nainga/domain/storecertification/application/StoreCertificationService.java @@ -90,6 +90,37 @@ public List> findStoreCertifications return storeCertificationsByLocationListResponses; } + //검색어를 이용해 가게 이름, 업종, 주소에 대해 검색하고 나온 검색 결과 중 사용자로부터 가까운 순으로 최대 75개의 가게 정보를 리턴 + //단 이 로직은 UX를 고려해서 총 75개의 가게를 15개씩 쪼개서 5회차로 나누어 보내는 로직은 구현하지 않기로 결정 + public List searchStoreCertificationsByLocationAndKeyword(Location currentLocation, String searchKeyword) { + List storeCertificationsByLocation = storeCertificationRepository.searchStoreCertificationsByLocationAndKeyword(currentLocation, searchKeyword); + List storeCertificationsByLocationResponses = new ArrayList<>(); //반환해줄 StoreCertificationsByLocationResponse들의 List + + Map isChecked = new HashMap<>(); //이미 조회한 가게인지 여부를 저장하는 HashMap + + for (StoreCertification storeCertification : storeCertificationsByLocation) { + if (!duplicatedStoreIds.contains(storeCertification.getStore().getId())) { + storeCertificationsByLocationResponses.add(new StoreCertificationsByLocationResponse(storeCertification)); + } else { + Boolean result = isChecked.get(storeCertification.getStore().getId()); + if (result == null) { + StoreCertificationsByLocationResponse storeCertificationsByLocationResponse = new StoreCertificationsByLocationResponse(storeCertification); + + List storeCertificationsByStoreId = storeCertificationRepository.findStoreCertificationsByStoreId(storeCertification.getStore().getId()); + for (StoreCertification storeCertificationByStoreId : storeCertificationsByStoreId) { //위에서 이미 추가해준 인증제 이름일 경우 제외 + if(!storeCertificationByStoreId.getCertification().getName().equals(storeCertification.getCertification().getName())) + storeCertificationsByLocationResponse.getCertificationName().add(storeCertificationByStoreId.getCertification().getName()); + } + + storeCertificationsByLocationResponses.add(storeCertificationsByLocationResponse); + isChecked.put(storeCertification.getStore().getId(), true); //체크되었다고 기록 + } + } + } + + return storeCertificationsByLocationResponses; + } + public List getDuplicatedStoreIds() { return duplicatedStoreIds; } diff --git a/src/main/java/com/nainga/nainga/domain/storecertification/dao/StoreCertificationRepository.java b/src/main/java/com/nainga/nainga/domain/storecertification/dao/StoreCertificationRepository.java index 98be9b0..50d608b 100644 --- a/src/main/java/com/nainga/nainga/domain/storecertification/dao/StoreCertificationRepository.java +++ b/src/main/java/com/nainga/nainga/domain/storecertification/dao/StoreCertificationRepository.java @@ -80,7 +80,7 @@ public List findStoreCertificationsByStoreId(Long storeId) { } //검색어를 이용해 가게 이름, 업종, 주소에 대해 검색하고 나온 검색 결과 중 사용자로부터 가까운 순으로 최대 75개의 가게 정보를 리턴 - public List searchStoreCertificationsByLocation(Location currentLocation, String searchKeyword) { //사용자의 현재 (경도, 위도) 좌표와 검색 키워드를 전달 받기 + public List searchStoreCertificationsByLocationAndKeyword(Location currentLocation, String searchKeyword) { //사용자의 현재 (경도, 위도) 좌표와 검색 키워드를 전달 받기 TypedQuery query = em.createQuery( "SELECT sc FROM StoreCertification sc " + "JOIN FETCH sc.store s " + From 19f46fa1260652cf81846fb44e98d0e08bb6d8d3 Mon Sep 17 00:00:00 2001 From: sungjindev Date: Thu, 8 Feb 2024 16:41:26 +0900 Subject: [PATCH 03/21] =?UTF-8?q?feat=20:=20searchStoreCertificationsByLoc?= =?UTF-8?q?ationAndKeyword=20API=20=EB=A1=9C=EC=A7=81=20=EA=B5=AC=ED=98=84?= =?UTF-8?q?=20(#89)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/StoreCertificationApi.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/main/java/com/nainga/nainga/domain/storecertification/api/StoreCertificationApi.java b/src/main/java/com/nainga/nainga/domain/storecertification/api/StoreCertificationApi.java index 6be8642..b6b231b 100644 --- a/src/main/java/com/nainga/nainga/domain/storecertification/api/StoreCertificationApi.java +++ b/src/main/java/com/nainga/nainga/domain/storecertification/api/StoreCertificationApi.java @@ -95,4 +95,29 @@ public Result>> findStoreCertif List> storeCertificationsByLocationRandomly = storeCertificationService.findStoreCertificationsByLocationRandomly(new Location(nwLong, nwLat), new Location(swLong, swLat), new Location(seLong, seLat), new Location(neLong, neLat)); return new Result<>(Result.CODE_SUCCESS, Result.MESSAGE_OK, storeCertificationsByLocationRandomly); } + + //검색어를 이용해 가게 이름, 업종, 주소에 대해 검색하고 나온 검색 결과 중 사용자로부터 가까운 순으로 최대 75개의 가게 정보를 리턴 + @Tag(name = "가게 상세 정보") + @Operation(summary = "사용자 위치 및 검색어 기반 가게 상세 정보 제공", description = "현재 사용자의 위치 좌표와 검색 키워드를 전달받아 가게 DB에서 검색한 뒤, 사용자와 가까운 순으로 최대 75개의 가게 상세 정보를 반환해줍니다.

" + + "[Request Body]
" + + "currLong: 현재 사용자의 위치 좌표 경도값
" + + "currLat: 현재 사용자의 위치 좌표 위도값
" + + "searchKeyword: 검색할 키워드

" + + "[Response Body]
" + + "id: Database 내 Primary Key값
" + + "displayName: 가게 이름
" + + "primaryTypeDisplayName: 업종
" + + "formattedAddress: 주소
" + + "phoneNumber: 전화번호
" + + "location: (경도, 위도) 가게 좌표
" + + "regularOpeningHours: 영업 시간
" + + "=> 특정 요일이 휴무인 경우에는 해당 요일에 대한 데이터가 들어있지 않습니다. Break time이 있는 경우 동일한 요일에 대해 영업 시간 데이터가 여러 개 존재할 수 있습니다.
" + + "localPhotos: 저장된 가게 사진 URL
" + + "certificationName: 가게의 인증제 목록
" + + "=> 각 인증제별 순서는 보장되지 않습니다.") + @GetMapping("api/v1/storecertification/byLocationAndKeyword") + public Result> searchStoreCertificationsByLocationAndKeyword(@RequestParam("currLong") double currLong, @RequestParam("currLat") double currLat, @RequestParam("searchKeyword") String searchKeyword) { + List storeCertificationsByLocationAndKeyword = storeCertificationService.searchStoreCertificationsByLocationAndKeyword(new Location(currLong, currLat), searchKeyword); + return new Result<>(Result.CODE_SUCCESS, Result.MESSAGE_OK, storeCertificationsByLocationAndKeyword); + } } \ No newline at end of file From c862a4c58ce1cdfbb8e99ee84d4fa42f37bd3894 Mon Sep 17 00:00:00 2001 From: hoon Date: Thu, 8 Feb 2024 16:50:27 +0900 Subject: [PATCH 04/21] =?UTF-8?q?feat=20:=20=EB=94=94=EB=B2=84=EA=B7=B8,?= =?UTF-8?q?=20=EC=9D=B8=ED=8F=AC=20=EB=A1=9C=EA=B7=B8=20=EC=A0=80=EC=9E=A5?= =?UTF-8?q?=EA=B8=B0=EA=B0=84=20=EB=8B=A8=EC=B6=95=20(#73)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/logback-spring.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index 76ade3f..5a882f2 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -23,7 +23,7 @@ logs/debug/debug-%d{yyyy-MM-dd}.log - 30 + 10 1GB @@ -39,7 +39,7 @@ logs/info/info-%d{yyyy-MM-dd}.log - 30 + 10 1GB From 170873a4ab1e69e3ec3b3fdcfc0370213f26b23e Mon Sep 17 00:00:00 2001 From: hoon Date: Thu, 8 Feb 2024 17:35:16 +0900 Subject: [PATCH 05/21] =?UTF-8?q?feat=20:=20backend-submodule=20=EB=82=B4?= =?UTF-8?q?=EC=9A=A9=20=EC=A0=81=EC=9A=A9=20=20(#73)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/backend-submodule | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/backend-submodule b/src/main/resources/backend-submodule index 67e3a62..732770b 160000 --- a/src/main/resources/backend-submodule +++ b/src/main/resources/backend-submodule @@ -1 +1 @@ -Subproject commit 67e3a628d394ee510efccd846b3e70e63ce63e42 +Subproject commit 732770ba3e8a25abfb4212a7a75175249e2c099e From 80a7aa7ae7ceb76e281c239db65e08124e0f0c05 Mon Sep 17 00:00:00 2001 From: hoon Date: Thu, 8 Feb 2024 17:36:54 +0900 Subject: [PATCH 06/21] =?UTF-8?q?feat=20:=20=EC=9A=B4=EC=98=81=EC=84=9C?= =?UTF-8?q?=EB=B2=84=20=EB=B0=B0=ED=8F=AC=EC=8B=9C=20=EB=94=94=EC=8A=A4?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=95=8C=EB=A6=BC=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?=EB=B0=8F=20=EC=9A=B4=EC=98=81=EC=84=9C=EB=B2=84=EB=A1=9C=20?= =?UTF-8?q?=EC=98=AE=EA=B8=B0=EB=8A=94=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20(#73)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/action-production-cd.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/action-production-cd.yml b/.github/workflows/action-production-cd.yml index 6068852..9491a9d 100644 --- a/.github/workflows/action-production-cd.yml +++ b/.github/workflows/action-production-cd.yml @@ -5,6 +5,9 @@ on: push: branches: - main + pull_request: # 테스트 트리거 + branches: + - develop # 코드의 내용을 이 파일을 실행하여 action을 수행하는 주체(Github Actions에서 사용하는 VM)가 읽을 수 있도록 권한을 설정 permissions: @@ -47,7 +50,7 @@ jobs: username: ${{ secrets.KCS_USERNAME_PROD }} host: ${{ secrets.KCS_HOST_PROD }} key: ${{ secrets.KCS_KEY_PROD }} - source: "src/main/resources/backend-submodule/docker-compose.yml,src/main/resources/backend-submodule/nginx/nginx.conf" + source: "src/main/resources/backend-submodule" target: "/home/g22203/" # Docker hub 로그인 @@ -68,6 +71,14 @@ jobs: cache-from: type=gha cache-to: type=gha, mode=max + # Discord 에 알람 보내기 + - name: Discord notification + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_PROD }} + uses: Ilshidur/action-discord@master + with: + args: '{{ EVENT_PAYLOAD.repository.full_name }} 가 배포 되었 습니다. 운영 서버가 재시작 됩니다.' + # appleboy/ssh-action@master 액션을 사용하여 지정한 서버에 ssh로 접속하고, script를 실행합니다. # 실행 시, docker-compose를 사용합니다. - name: Deploy to server @@ -83,5 +94,4 @@ jobs: docker rmi $(docker images -q) cp -f ./src/main/resources/backend-submodule/docker-compose.yml . cp -rf ./src/main/resources/backend-submodule/nginx . - rm -r src docker-compose -f docker-compose.yml up -d \ No newline at end of file From 2da5e0cfaad8a28e7566e1e83ad2ce6ca5eea0df Mon Sep 17 00:00:00 2001 From: hoon Date: Thu, 8 Feb 2024 16:50:27 +0900 Subject: [PATCH 07/21] =?UTF-8?q?feat=20:=20=EB=94=94=EB=B2=84=EA=B7=B8,?= =?UTF-8?q?=20=EC=9D=B8=ED=8F=AC=20=EB=A1=9C=EA=B7=B8=20=EC=A0=80=EC=9E=A5?= =?UTF-8?q?=EA=B8=B0=EA=B0=84=20=EB=8B=A8=EC=B6=95=20(#90)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/logback-spring.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index 76ade3f..5a882f2 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -23,7 +23,7 @@ logs/debug/debug-%d{yyyy-MM-dd}.log - 30 + 10 1GB @@ -39,7 +39,7 @@ logs/info/info-%d{yyyy-MM-dd}.log - 30 + 10 1GB From 61ac54fc03ab0b9960cbe548b5c7de0c5030a61b Mon Sep 17 00:00:00 2001 From: hoon Date: Thu, 8 Feb 2024 17:35:16 +0900 Subject: [PATCH 08/21] =?UTF-8?q?feat=20:=20backend-submodule=20=EB=82=B4?= =?UTF-8?q?=EC=9A=A9=20=EC=A0=81=EC=9A=A9=20(#90)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/backend-submodule | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/backend-submodule b/src/main/resources/backend-submodule index 67e3a62..732770b 160000 --- a/src/main/resources/backend-submodule +++ b/src/main/resources/backend-submodule @@ -1 +1 @@ -Subproject commit 67e3a628d394ee510efccd846b3e70e63ce63e42 +Subproject commit 732770ba3e8a25abfb4212a7a75175249e2c099e From a3649fc0807e6a95d4b5b71a88095bd4f858a10e Mon Sep 17 00:00:00 2001 From: hoon Date: Thu, 8 Feb 2024 17:36:54 +0900 Subject: [PATCH 09/21] =?UTF-8?q?feat=20:=20=EC=9A=B4=EC=98=81=EC=84=9C?= =?UTF-8?q?=EB=B2=84=20=EB=B0=B0=ED=8F=AC=EC=8B=9C=20=EB=94=94=EC=8A=A4?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=95=8C=EB=A6=BC=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?=EB=B0=8F=20=EC=9A=B4=EC=98=81=EC=84=9C=EB=B2=84=EB=A1=9C=20?= =?UTF-8?q?=EC=98=AE=EA=B8=B0=EB=8A=94=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20(#90)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/action-production-cd.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/action-production-cd.yml b/.github/workflows/action-production-cd.yml index 6068852..9491a9d 100644 --- a/.github/workflows/action-production-cd.yml +++ b/.github/workflows/action-production-cd.yml @@ -5,6 +5,9 @@ on: push: branches: - main + pull_request: # 테스트 트리거 + branches: + - develop # 코드의 내용을 이 파일을 실행하여 action을 수행하는 주체(Github Actions에서 사용하는 VM)가 읽을 수 있도록 권한을 설정 permissions: @@ -47,7 +50,7 @@ jobs: username: ${{ secrets.KCS_USERNAME_PROD }} host: ${{ secrets.KCS_HOST_PROD }} key: ${{ secrets.KCS_KEY_PROD }} - source: "src/main/resources/backend-submodule/docker-compose.yml,src/main/resources/backend-submodule/nginx/nginx.conf" + source: "src/main/resources/backend-submodule" target: "/home/g22203/" # Docker hub 로그인 @@ -68,6 +71,14 @@ jobs: cache-from: type=gha cache-to: type=gha, mode=max + # Discord 에 알람 보내기 + - name: Discord notification + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_PROD }} + uses: Ilshidur/action-discord@master + with: + args: '{{ EVENT_PAYLOAD.repository.full_name }} 가 배포 되었 습니다. 운영 서버가 재시작 됩니다.' + # appleboy/ssh-action@master 액션을 사용하여 지정한 서버에 ssh로 접속하고, script를 실행합니다. # 실행 시, docker-compose를 사용합니다. - name: Deploy to server @@ -83,5 +94,4 @@ jobs: docker rmi $(docker images -q) cp -f ./src/main/resources/backend-submodule/docker-compose.yml . cp -rf ./src/main/resources/backend-submodule/nginx . - rm -r src docker-compose -f docker-compose.yml up -d \ No newline at end of file From 1cfcfcd7088d0dfbbe6f87c061f125f347ad3d70 Mon Sep 17 00:00:00 2001 From: hoon Date: Thu, 8 Feb 2024 17:49:56 +0900 Subject: [PATCH 10/21] =?UTF-8?q?fix=20:=20=EC=98=A4=ED=83=80=EC=88=98?= =?UTF-8?q?=EC=A0=95=20(#90)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/backend-submodule | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/backend-submodule b/src/main/resources/backend-submodule index 732770b..90aaaac 160000 --- a/src/main/resources/backend-submodule +++ b/src/main/resources/backend-submodule @@ -1 +1 @@ -Subproject commit 732770ba3e8a25abfb4212a7a75175249e2c099e +Subproject commit 90aaaac39dafe9b6e32cf2799cda8a677f3afb5b From fa3b772bad580f653c605f4b306bb1462a333064 Mon Sep 17 00:00:00 2001 From: hoon Date: Thu, 8 Feb 2024 18:03:28 +0900 Subject: [PATCH 11/21] =?UTF-8?q?fix=20:=20=EC=98=A4=ED=83=80=EC=88=98?= =?UTF-8?q?=EC=A0=95=20(#90)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/resources/backend-submodule | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/resources/backend-submodule b/src/test/resources/backend-submodule index 67e3a62..732770b 160000 --- a/src/test/resources/backend-submodule +++ b/src/test/resources/backend-submodule @@ -1 +1 @@ -Subproject commit 67e3a628d394ee510efccd846b3e70e63ce63e42 +Subproject commit 732770ba3e8a25abfb4212a7a75175249e2c099e From a1de0fc768cdd300fbc7858d87561533554e04ba Mon Sep 17 00:00:00 2001 From: sungjindev Date: Thu, 8 Feb 2024 18:15:07 +0900 Subject: [PATCH 12/21] =?UTF-8?q?fix=20:=20StoreCertification=20=ED=85=8C?= =?UTF-8?q?=EC=9D=B4=EB=B8=94=20=EC=95=88=EC=97=90=EB=8A=94=20=EC=B4=9D=20?= =?UTF-8?q?3=EA=B0=9C=EC=9D=98=20=EC=9D=B8=EC=A6=9D=EC=A0=9C=EB=A5=BC=20?= =?UTF-8?q?=EA=B0=80=EC=A7=80=EB=8A=94=20=EA=B0=80=EA=B2=8C=EB=93=A4?= =?UTF-8?q?=EB=8F=84=20=ED=8F=AC=ED=95=A8=EB=90=98=EC=96=B4=20=EC=9E=88?= =?UTF-8?q?=EC=9C=BC=EB=AF=80=EB=A1=9C=20Query=20limit=EB=A5=BC=2075?= =?UTF-8?q?=EC=97=90=EC=84=9C=20225=EB=A1=9C=20=EC=88=98=EC=A0=95=20(#89)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/StoreCertificationApi.java | 3 ++- .../StoreCertificationService.java | 5 ++-- .../dao/StoreCertificationRepository.java | 26 +++++++++++-------- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/nainga/nainga/domain/storecertification/api/StoreCertificationApi.java b/src/main/java/com/nainga/nainga/domain/storecertification/api/StoreCertificationApi.java index b6b231b..3c7edfe 100644 --- a/src/main/java/com/nainga/nainga/domain/storecertification/api/StoreCertificationApi.java +++ b/src/main/java/com/nainga/nainga/domain/storecertification/api/StoreCertificationApi.java @@ -117,7 +117,8 @@ public Result>> findStoreCertif "=> 각 인증제별 순서는 보장되지 않습니다.") @GetMapping("api/v1/storecertification/byLocationAndKeyword") public Result> searchStoreCertificationsByLocationAndKeyword(@RequestParam("currLong") double currLong, @RequestParam("currLat") double currLat, @RequestParam("searchKeyword") String searchKeyword) { - List storeCertificationsByLocationAndKeyword = storeCertificationService.searchStoreCertificationsByLocationAndKeyword(new Location(currLong, currLat), searchKeyword); + System.out.println("API searchKeyword = " + searchKeyword); + List storeCertificationsByLocationAndKeyword = storeCertificationService.searchStoreCertificationsByLocationAndKeyword(currLong, currLat, searchKeyword); return new Result<>(Result.CODE_SUCCESS, Result.MESSAGE_OK, storeCertificationsByLocationAndKeyword); } } \ No newline at end of file diff --git a/src/main/java/com/nainga/nainga/domain/storecertification/application/StoreCertificationService.java b/src/main/java/com/nainga/nainga/domain/storecertification/application/StoreCertificationService.java index b365434..fb084f0 100644 --- a/src/main/java/com/nainga/nainga/domain/storecertification/application/StoreCertificationService.java +++ b/src/main/java/com/nainga/nainga/domain/storecertification/application/StoreCertificationService.java @@ -92,8 +92,9 @@ public List> findStoreCertifications //검색어를 이용해 가게 이름, 업종, 주소에 대해 검색하고 나온 검색 결과 중 사용자로부터 가까운 순으로 최대 75개의 가게 정보를 리턴 //단 이 로직은 UX를 고려해서 총 75개의 가게를 15개씩 쪼개서 5회차로 나누어 보내는 로직은 구현하지 않기로 결정 - public List searchStoreCertificationsByLocationAndKeyword(Location currentLocation, String searchKeyword) { - List storeCertificationsByLocation = storeCertificationRepository.searchStoreCertificationsByLocationAndKeyword(currentLocation, searchKeyword); + public List searchStoreCertificationsByLocationAndKeyword(Double currLong, Double currLat, String searchKeyword) { + List storeCertificationsByLocation = storeCertificationRepository.searchStoreCertificationsByLocationAndKeyword(currLong, currLat, searchKeyword); + System.out.println("storeCertificationsByLocation.size() = " + storeCertificationsByLocation.size()); List storeCertificationsByLocationResponses = new ArrayList<>(); //반환해줄 StoreCertificationsByLocationResponse들의 List Map isChecked = new HashMap<>(); //이미 조회한 가게인지 여부를 저장하는 HashMap diff --git a/src/main/java/com/nainga/nainga/domain/storecertification/dao/StoreCertificationRepository.java b/src/main/java/com/nainga/nainga/domain/storecertification/dao/StoreCertificationRepository.java index 50d608b..c8350ca 100644 --- a/src/main/java/com/nainga/nainga/domain/storecertification/dao/StoreCertificationRepository.java +++ b/src/main/java/com/nainga/nainga/domain/storecertification/dao/StoreCertificationRepository.java @@ -80,19 +80,23 @@ public List findStoreCertificationsByStoreId(Long storeId) { } //검색어를 이용해 가게 이름, 업종, 주소에 대해 검색하고 나온 검색 결과 중 사용자로부터 가까운 순으로 최대 75개의 가게 정보를 리턴 - public List searchStoreCertificationsByLocationAndKeyword(Location currentLocation, String searchKeyword) { //사용자의 현재 (경도, 위도) 좌표와 검색 키워드를 전달 받기 - TypedQuery query = em.createQuery( - "SELECT sc FROM StoreCertification sc " + - "JOIN FETCH sc.store s " + - "JOIN FETCH sc.certification c " + - "WHERE sc.store.displayName LIKE CONCAT('%', :searchKeyword, '%') " + //가게 이름에 대한 검색 - "OR sc.store.primaryTypeDisplayName LIKE CONCAT('%', :searchKeyword, '%') " + //업종에 대한 검색 - "OR sc.store.formattedAddress LIKE CONCAT('%', :searchKeyword, '%') " + //주소에 대한 검색 - "ORDER BY (6371 * acos(cos(radians(36.628486474734)) * cos(radians(ST_Y(:currentLocation))) * cos(radians(ST_X(:currentLocation)) - radians(127.4574415007155)) + sin(radians(36.628486474734)) * sin(radians(ST_Y(:currentLocation))))) LIMIT 75", //하버사인 공식을 이용해 두 좌표상 거리 구하기 - StoreCertification.class).setParameter("currentLocation", currentLocation) - .setParameter("searchKeyword", searchKeyword); + public List searchStoreCertificationsByLocationAndKeyword(Double currLong, Double currLat, String searchKeyword) { + System.out.println("searchKeyword = " + searchKeyword); + String nativeQuery = "SELECT sc.* FROM store_certification sc " + + "JOIN store AS s ON sc.store_id = s.store_id " + + "JOIN certification AS c ON sc.certification_id = c.certification_id " + + "WHERE s.display_name LIKE :searchKeyword " + + "OR s.primary_type_display_name LIKE :searchKeyword " + + "OR s.formatted_address LIKE :searchKeyword " + + "ORDER BY (6371 * acos(cos(radians(:currLat)) * cos(radians(ST_Y(s.location))) * cos(radians(ST_X(s.location)) - radians(:currLong)) + sin(radians(:currLat)) * sin(radians(ST_Y(s.location))))) limit 225"; //세 인증제를 모두 가지고 있는 가게가 있으므로 3 * 75 = 225 + + Query query = em.createNativeQuery(nativeQuery, StoreCertification.class) + .setParameter("currLong", currLong) + .setParameter("currLat", currLat) + .setParameter("searchKeyword", "%" + searchKeyword + "%"); return query.getResultList(); } + } From b896e18897107579d7df6babe056b14a8e7873af Mon Sep 17 00:00:00 2001 From: hoon Date: Thu, 8 Feb 2024 18:18:58 +0900 Subject: [PATCH 13/21] =?UTF-8?q?feat=20:=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=ED=8A=B8=EB=A6=AC=EA=B1=B0=20=EC=B6=94=EA=B0=80=20(#90)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/action-develop-cd.yml | 3 +++ .github/workflows/action-production-cd.yml | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/action-develop-cd.yml b/.github/workflows/action-develop-cd.yml index e654d6a..02a271e 100644 --- a/.github/workflows/action-develop-cd.yml +++ b/.github/workflows/action-develop-cd.yml @@ -5,6 +5,9 @@ on: push: branches: - develop + pull_request: # 테스트 트리거 + branches: + - develop # 코드의 내용을 이 파일을 실행하여 action을 수행하는 주체(Github Actions에서 사용하는 VM)가 읽을 수 있도록 권한을 설정 permissions: diff --git a/.github/workflows/action-production-cd.yml b/.github/workflows/action-production-cd.yml index 9491a9d..f57da3a 100644 --- a/.github/workflows/action-production-cd.yml +++ b/.github/workflows/action-production-cd.yml @@ -5,9 +5,9 @@ on: push: branches: - main - pull_request: # 테스트 트리거 - branches: - - develop +# pull_request: # 테스트 트리거 +# branches: +# - develop # 코드의 내용을 이 파일을 실행하여 action을 수행하는 주체(Github Actions에서 사용하는 VM)가 읽을 수 있도록 권한을 설정 permissions: From 9ef99b78ffd07de506d5041672a8eb3a8448d90e Mon Sep 17 00:00:00 2001 From: sungjindev Date: Thu, 8 Feb 2024 18:20:01 +0900 Subject: [PATCH 14/21] =?UTF-8?q?fix=20:=20searchStoreCertificationsByLoca?= =?UTF-8?q?tionAndKeyword=20=EC=84=9C=EB=B9=84=EC=8A=A4=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=20=EB=82=B4=20=EA=B0=80=EA=B2=8C=EB=A5=BC=2075?= =?UTF-8?q?=EA=B0=9C=EA=B9=8C=EC=A7=80=EB=A7=8C=20=EC=84=A0=ED=83=9D?= =?UTF-8?q?=ED=95=98=EB=8F=84=EB=A1=9D=20=EB=A1=9C=EC=A7=81=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84=20(#89)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/StoreCertificationApi.java | 1 - .../application/StoreCertificationService.java | 12 ++++++++++-- .../dao/StoreCertificationRepository.java | 1 - 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/nainga/nainga/domain/storecertification/api/StoreCertificationApi.java b/src/main/java/com/nainga/nainga/domain/storecertification/api/StoreCertificationApi.java index 3c7edfe..16e7f09 100644 --- a/src/main/java/com/nainga/nainga/domain/storecertification/api/StoreCertificationApi.java +++ b/src/main/java/com/nainga/nainga/domain/storecertification/api/StoreCertificationApi.java @@ -117,7 +117,6 @@ public Result>> findStoreCertif "=> 각 인증제별 순서는 보장되지 않습니다.") @GetMapping("api/v1/storecertification/byLocationAndKeyword") public Result> searchStoreCertificationsByLocationAndKeyword(@RequestParam("currLong") double currLong, @RequestParam("currLat") double currLat, @RequestParam("searchKeyword") String searchKeyword) { - System.out.println("API searchKeyword = " + searchKeyword); List storeCertificationsByLocationAndKeyword = storeCertificationService.searchStoreCertificationsByLocationAndKeyword(currLong, currLat, searchKeyword); return new Result<>(Result.CODE_SUCCESS, Result.MESSAGE_OK, storeCertificationsByLocationAndKeyword); } diff --git a/src/main/java/com/nainga/nainga/domain/storecertification/application/StoreCertificationService.java b/src/main/java/com/nainga/nainga/domain/storecertification/application/StoreCertificationService.java index fb084f0..be89a23 100644 --- a/src/main/java/com/nainga/nainga/domain/storecertification/application/StoreCertificationService.java +++ b/src/main/java/com/nainga/nainga/domain/storecertification/application/StoreCertificationService.java @@ -94,7 +94,6 @@ public List> findStoreCertifications //단 이 로직은 UX를 고려해서 총 75개의 가게를 15개씩 쪼개서 5회차로 나누어 보내는 로직은 구현하지 않기로 결정 public List searchStoreCertificationsByLocationAndKeyword(Double currLong, Double currLat, String searchKeyword) { List storeCertificationsByLocation = storeCertificationRepository.searchStoreCertificationsByLocationAndKeyword(currLong, currLat, searchKeyword); - System.out.println("storeCertificationsByLocation.size() = " + storeCertificationsByLocation.size()); List storeCertificationsByLocationResponses = new ArrayList<>(); //반환해줄 StoreCertificationsByLocationResponse들의 List Map isChecked = new HashMap<>(); //이미 조회한 가게인지 여부를 저장하는 HashMap @@ -119,7 +118,16 @@ public List searchStoreCertificationsByLo } } - return storeCertificationsByLocationResponses; + List storeCertificationsByLocationListResponses = new ArrayList<>(); + + for(int i=1; i <= storeCertificationsByLocationResponses.size(); ++i) { + storeCertificationsByLocationListResponses.add(storeCertificationsByLocationResponses.get(i-1)); + if (i == 75 || i == storeCertificationsByLocationResponses.size()) { //요구사항에 따른 가게 최대 개수가 75개 이므로, 0부터 74까지만! + break; + } + } + + return storeCertificationsByLocationListResponses; } public List getDuplicatedStoreIds() { diff --git a/src/main/java/com/nainga/nainga/domain/storecertification/dao/StoreCertificationRepository.java b/src/main/java/com/nainga/nainga/domain/storecertification/dao/StoreCertificationRepository.java index c8350ca..ae7df88 100644 --- a/src/main/java/com/nainga/nainga/domain/storecertification/dao/StoreCertificationRepository.java +++ b/src/main/java/com/nainga/nainga/domain/storecertification/dao/StoreCertificationRepository.java @@ -81,7 +81,6 @@ public List findStoreCertificationsByStoreId(Long storeId) { //검색어를 이용해 가게 이름, 업종, 주소에 대해 검색하고 나온 검색 결과 중 사용자로부터 가까운 순으로 최대 75개의 가게 정보를 리턴 public List searchStoreCertificationsByLocationAndKeyword(Double currLong, Double currLat, String searchKeyword) { - System.out.println("searchKeyword = " + searchKeyword); String nativeQuery = "SELECT sc.* FROM store_certification sc " + "JOIN store AS s ON sc.store_id = s.store_id " + "JOIN certification AS c ON sc.certification_id = c.certification_id " + From d84ad433974c30a8ea4846084dab8d8048ecc667 Mon Sep 17 00:00:00 2001 From: hoon Date: Thu, 8 Feb 2024 20:08:43 +0900 Subject: [PATCH 15/21] =?UTF-8?q?feat=20:=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=ED=8A=B8=EB=A6=AC=EA=B1=B0=20=EC=A0=9C=EA=B1=B0=20(#90)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/action-develop-cd.yml | 3 --- .github/workflows/action-production-cd.yml | 3 --- 2 files changed, 6 deletions(-) diff --git a/.github/workflows/action-develop-cd.yml b/.github/workflows/action-develop-cd.yml index 02a271e..e654d6a 100644 --- a/.github/workflows/action-develop-cd.yml +++ b/.github/workflows/action-develop-cd.yml @@ -5,9 +5,6 @@ on: push: branches: - develop - pull_request: # 테스트 트리거 - branches: - - develop # 코드의 내용을 이 파일을 실행하여 action을 수행하는 주체(Github Actions에서 사용하는 VM)가 읽을 수 있도록 권한을 설정 permissions: diff --git a/.github/workflows/action-production-cd.yml b/.github/workflows/action-production-cd.yml index f57da3a..d0aa6b5 100644 --- a/.github/workflows/action-production-cd.yml +++ b/.github/workflows/action-production-cd.yml @@ -5,9 +5,6 @@ on: push: branches: - main -# pull_request: # 테스트 트리거 -# branches: -# - develop # 코드의 내용을 이 파일을 실행하여 action을 수행하는 주체(Github Actions에서 사용하는 VM)가 읽을 수 있도록 권한을 설정 permissions: From e026e072f828f524dcc5477d874a21e22903e479 Mon Sep 17 00:00:00 2001 From: hoon Date: Thu, 8 Feb 2024 20:08:54 +0900 Subject: [PATCH 16/21] =?UTF-8?q?feat=20:=20backend-submodule=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9=20(#90)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/backend-submodule | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/backend-submodule b/src/main/resources/backend-submodule index 90aaaac..6ee111c 160000 --- a/src/main/resources/backend-submodule +++ b/src/main/resources/backend-submodule @@ -1 +1 @@ -Subproject commit 90aaaac39dafe9b6e32cf2799cda8a677f3afb5b +Subproject commit 6ee111c8697d5426fe4c7ee77e345f83d518b162 From c8b3859d75df8975918e0a8d84da00e091eabb58 Mon Sep 17 00:00:00 2001 From: sungjindev Date: Thu, 8 Feb 2024 23:26:04 +0900 Subject: [PATCH 17/21] =?UTF-8?q?fix=20:=20=EC=9A=94=EA=B5=AC=EC=82=AC?= =?UTF-8?q?=ED=95=AD=20=EB=B3=80=EA=B2=BD=EC=97=90=20=EB=94=B0=EB=A5=B8=20?= =?UTF-8?q?Return=ED=95=98=EB=8A=94=20=EC=B5=9C=EB=8C=80=20=EA=B0=80?= =?UTF-8?q?=EA=B2=8C=EC=9D=98=20=EC=88=98=EB=A5=BC=2075=EA=B0=9C=EC=97=90?= =?UTF-8?q?=EC=84=9C=2030=EA=B0=9C=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20(#89)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../storecertification/api/StoreCertificationApi.java | 4 ++-- .../application/StoreCertificationService.java | 6 +++--- .../dao/StoreCertificationRepository.java | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/nainga/nainga/domain/storecertification/api/StoreCertificationApi.java b/src/main/java/com/nainga/nainga/domain/storecertification/api/StoreCertificationApi.java index 16e7f09..09f3a67 100644 --- a/src/main/java/com/nainga/nainga/domain/storecertification/api/StoreCertificationApi.java +++ b/src/main/java/com/nainga/nainga/domain/storecertification/api/StoreCertificationApi.java @@ -96,9 +96,9 @@ public Result>> findStoreCertif return new Result<>(Result.CODE_SUCCESS, Result.MESSAGE_OK, storeCertificationsByLocationRandomly); } - //검색어를 이용해 가게 이름, 업종, 주소에 대해 검색하고 나온 검색 결과 중 사용자로부터 가까운 순으로 최대 75개의 가게 정보를 리턴 + //검색어를 이용해 가게 이름, 업종, 주소에 대해 검색하고 나온 검색 결과 중 사용자로부터 가까운 순으로 최대 30개의 가게 정보를 리턴 @Tag(name = "가게 상세 정보") - @Operation(summary = "사용자 위치 및 검색어 기반 가게 상세 정보 제공", description = "현재 사용자의 위치 좌표와 검색 키워드를 전달받아 가게 DB에서 검색한 뒤, 사용자와 가까운 순으로 최대 75개의 가게 상세 정보를 반환해줍니다.

" + + @Operation(summary = "사용자 위치 및 검색어 기반 가게 상세 정보 제공", description = "현재 사용자의 위치 좌표와 검색 키워드를 전달받아 가게 DB에서 검색한 뒤, 사용자와 가까운 순으로 최대 30개의 가게 상세 정보를 반환해줍니다.

" + "[Request Body]
" + "currLong: 현재 사용자의 위치 좌표 경도값
" + "currLat: 현재 사용자의 위치 좌표 위도값
" + diff --git a/src/main/java/com/nainga/nainga/domain/storecertification/application/StoreCertificationService.java b/src/main/java/com/nainga/nainga/domain/storecertification/application/StoreCertificationService.java index be89a23..2f85cba 100644 --- a/src/main/java/com/nainga/nainga/domain/storecertification/application/StoreCertificationService.java +++ b/src/main/java/com/nainga/nainga/domain/storecertification/application/StoreCertificationService.java @@ -90,8 +90,8 @@ public List> findStoreCertifications return storeCertificationsByLocationListResponses; } - //검색어를 이용해 가게 이름, 업종, 주소에 대해 검색하고 나온 검색 결과 중 사용자로부터 가까운 순으로 최대 75개의 가게 정보를 리턴 - //단 이 로직은 UX를 고려해서 총 75개의 가게를 15개씩 쪼개서 5회차로 나누어 보내는 로직은 구현하지 않기로 결정 + //검색어를 이용해 가게 이름, 업종, 주소에 대해 검색하고 나온 검색 결과 중 사용자로부터 가까운 순으로 최대 30개의 가게 정보를 리턴 + //단 이 로직은 UX를 고려해서 총 30개의 가게를 15개씩 쪼개서 5회차로 나누어 보내는 로직은 구현하지 않기로 결정 public List searchStoreCertificationsByLocationAndKeyword(Double currLong, Double currLat, String searchKeyword) { List storeCertificationsByLocation = storeCertificationRepository.searchStoreCertificationsByLocationAndKeyword(currLong, currLat, searchKeyword); List storeCertificationsByLocationResponses = new ArrayList<>(); //반환해줄 StoreCertificationsByLocationResponse들의 List @@ -122,7 +122,7 @@ public List searchStoreCertificationsByLo for(int i=1; i <= storeCertificationsByLocationResponses.size(); ++i) { storeCertificationsByLocationListResponses.add(storeCertificationsByLocationResponses.get(i-1)); - if (i == 75 || i == storeCertificationsByLocationResponses.size()) { //요구사항에 따른 가게 최대 개수가 75개 이므로, 0부터 74까지만! + if (i == 30 || i == storeCertificationsByLocationResponses.size()) { //요구사항에 따른 가게 최대 개수가 30개 이므로, 1부터 30까지만! break; } } diff --git a/src/main/java/com/nainga/nainga/domain/storecertification/dao/StoreCertificationRepository.java b/src/main/java/com/nainga/nainga/domain/storecertification/dao/StoreCertificationRepository.java index ae7df88..eb0656a 100644 --- a/src/main/java/com/nainga/nainga/domain/storecertification/dao/StoreCertificationRepository.java +++ b/src/main/java/com/nainga/nainga/domain/storecertification/dao/StoreCertificationRepository.java @@ -79,7 +79,7 @@ public List findStoreCertificationsByStoreId(Long storeId) { return query.getResultList(); } - //검색어를 이용해 가게 이름, 업종, 주소에 대해 검색하고 나온 검색 결과 중 사용자로부터 가까운 순으로 최대 75개의 가게 정보를 리턴 + //검색어를 이용해 가게 이름, 업종, 주소에 대해 검색하고 나온 검색 결과 중 사용자로부터 가까운 순으로 최대 30개의 가게 정보를 리턴 public List searchStoreCertificationsByLocationAndKeyword(Double currLong, Double currLat, String searchKeyword) { String nativeQuery = "SELECT sc.* FROM store_certification sc " + "JOIN store AS s ON sc.store_id = s.store_id " + @@ -87,7 +87,7 @@ public List searchStoreCertificationsByLocationAndKeyword(Do "WHERE s.display_name LIKE :searchKeyword " + "OR s.primary_type_display_name LIKE :searchKeyword " + "OR s.formatted_address LIKE :searchKeyword " + - "ORDER BY (6371 * acos(cos(radians(:currLat)) * cos(radians(ST_Y(s.location))) * cos(radians(ST_X(s.location)) - radians(:currLong)) + sin(radians(:currLat)) * sin(radians(ST_Y(s.location))))) limit 225"; //세 인증제를 모두 가지고 있는 가게가 있으므로 3 * 75 = 225 + "ORDER BY (6371 * acos(cos(radians(:currLat)) * cos(radians(ST_Y(s.location))) * cos(radians(ST_X(s.location)) - radians(:currLong)) + sin(radians(:currLat)) * sin(radians(ST_Y(s.location))))) limit 90"; //세 인증제를 모두 가지고 있는 가게가 있으므로 3 * 30 = 90 Query query = em.createNativeQuery(nativeQuery, StoreCertification.class) .setParameter("currLong", currLong) From ee34525301c1c972f8fa64e9bd5a92175e8c5396 Mon Sep 17 00:00:00 2001 From: sungjindev Date: Fri, 9 Feb 2024 21:12:37 +0900 Subject: [PATCH 18/21] =?UTF-8?q?fix=20:=20StoreAPI=20=EB=82=B4=20?= =?UTF-8?q?=EB=AA=A8=EB=93=A0=20API=20Versiong=20=EB=B0=A9=EC=8B=9D=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20(#93)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/nainga/nainga/domain/store/api/StoreApi.java | 12 ++++++------ src/test/resources/backend-submodule | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/nainga/nainga/domain/store/api/StoreApi.java b/src/main/java/com/nainga/nainga/domain/store/api/StoreApi.java index 559911b..a9a8b5a 100644 --- a/src/main/java/com/nainga/nainga/domain/store/api/StoreApi.java +++ b/src/main/java/com/nainga/nainga/domain/store/api/StoreApi.java @@ -25,7 +25,7 @@ public class StoreApi { @Hidden @Tag(name = "초기 Data 생성") @Operation(summary = "모범음식점 데이터 생성", description = "[WARNING] DB에 처음으로 모든 모범음식점 데이터를 주입해주는 API입니다. DB에 엄청난 부하가 가는 작업으로, 합의 없이 실행시켜선 안됩니다!") - @GetMapping("api/v1/store/mobeom") + @GetMapping("api/store/mobeom/v1") public Result createAllMobeomStores(@RequestParam(value = "fileName") String fileName) { mobeomGoogleMapStoreService.createAllMobeomStores(fileName); return new Result<>(Result.CODE_SUCCESS, Result.MESSAGE_OK, null); @@ -34,7 +34,7 @@ public Result createAllMobeomStores(@RequestParam(value = "fileName") St @Hidden @Tag(name = "초기 Data 생성") @Operation(summary = "지정한 Credit까지만 사용하여 모범음식점 데이터 생성", description = "[WARNING] 지정한 Credit까지만 사용하여 그동안 DB에 모범음식점 데이터를 주입해주는 API입니다. DB에 엄청난 부하가 가는 작업으로, 합의 없이 실행시켜선 안됩니다!") - @GetMapping("api/v1/store/dividedMobeom") + @GetMapping("api/store/dividedMobeom/v1") public Result createDividedMobeomStores(@RequestParam(value = "fileName") String fileName, @RequestParam(value = "dollars") double dollars, @RequestParam(value = "startIndex") int startIndex) { CreateDividedMobeomStoresResponse response = mobeomGoogleMapStoreService.createDividedMobeomStores(fileName, dollars, startIndex); System.out.println("response = " + response); //편하게 콘솔 로그에서 확인하기 위한 용도 @@ -44,7 +44,7 @@ public Result createDividedMobeomStores(@Requ @Hidden @Tag(name = "초기 Data 생성") @Operation(summary = "안심식당 데이터 생성", description = "[WARNING] DB에 처음으로 모든 안심식당 데이터를 주입해주는 API입니다. DB에 엄청난 부하가 가는 작업으로, 합의 없이 실행시켜선 안됩니다!") - @GetMapping("api/v1/store/safe") + @GetMapping("api/store/safe/v1") public Result createAllSafeStores(@RequestParam(value = "fileName") String fileName) { safeGoogleMapStoreService.createAllSafeStores(fileName); return new Result<>(Result.CODE_SUCCESS, Result.MESSAGE_OK, null); @@ -53,7 +53,7 @@ public Result createAllSafeStores(@RequestParam(value = "fileName") Stri @Hidden @Tag(name = "초기 Data 생성") @Operation(summary = "지정한 Credit까지만 사용하여 안심식당 데이터 생성", description = "[WARNING] 지정한 Credit까지만 사용하여 그동안 DB에 안심식당 데이터를 주입해주는 API입니다. DB에 엄청난 부하가 가는 작업으로, 합의 없이 실행시켜선 안됩니다!") - @GetMapping("api/v1/store/dividedSafe") + @GetMapping("api/store/dividedSafe/v1") public Result createDividedSafeStores(@RequestParam(value = "fileName") String fileName, @RequestParam(value = "dollars") double dollars, @RequestParam(value = "startIndex") int startIndex) { CreateDividedSafeStoresResponse response = safeGoogleMapStoreService.createDividedSafeStores(fileName, dollars, startIndex); System.out.println("response = " + response); //편하게 콘솔 로그에서 확인하기 위한 용도 @@ -63,7 +63,7 @@ public Result createDividedSafeStores(@RequestP @Hidden @Tag(name = "초기 Data 생성") @Operation(summary = "착한가격업소 데이터 생성", description = "[WARNING] DB에 처음으로 모든 착한가격업소 데이터를 주입해주는 API입니다. DB에 엄청난 부하가 가는 작업으로, 합의 없이 실행시켜선 안됩니다!") - @GetMapping("api/v1/store/goodPrice") + @GetMapping("api/store/goodPrice/v1") public Result createAllGoodPriceStores(@RequestParam(value = "fileName") String fileName) { goodPriceGoogleMapStoreService.createAllGoodPriceStores(fileName); return new Result<>(Result.CODE_SUCCESS, Result.MESSAGE_OK, null); @@ -72,7 +72,7 @@ public Result createAllGoodPriceStores(@RequestParam(value = "fileName") @Hidden @Tag(name = "초기 Data 생성") @Operation(summary = "지정한 Credit까지만 사용하여 착한가격업소 데이터 생성", description = "[WARNING] 지정한 Credit까지만 사용하여 그동안 DB에 착한가격업소 데이터를 주입해주는 API입니다. DB에 엄청난 부하가 가는 작업으로, 합의 없이 실행시켜선 안됩니다!") - @GetMapping("api/v1/store/dividedGoodPrice") + @GetMapping("api/store/dividedGoodPrice/v1") public Result createDividedGoodPriceStores(@RequestParam(value = "fileName") String fileName, @RequestParam(value = "dollars") double dollars, @RequestParam(value = "startIndex") int startIndex) { CreateDividedGoodPriceStoresResponse response = goodPriceGoogleMapStoreService.createDividedGoodPriceStores(fileName, dollars, startIndex); System.out.println("response = " + response); //편하게 콘솔 로그에서 확인하기 위한 용도 diff --git a/src/test/resources/backend-submodule b/src/test/resources/backend-submodule index 732770b..6ee111c 160000 --- a/src/test/resources/backend-submodule +++ b/src/test/resources/backend-submodule @@ -1 +1 @@ -Subproject commit 732770ba3e8a25abfb4212a7a75175249e2c099e +Subproject commit 6ee111c8697d5426fe4c7ee77e345f83d518b162 From 9245fa2f014046d8bd7bd1e3880170485d4d8fc1 Mon Sep 17 00:00:00 2001 From: sungjindev Date: Fri, 9 Feb 2024 21:38:16 +0900 Subject: [PATCH 19/21] =?UTF-8?q?fix=20:=20StoreCertificationAPI=20?= =?UTF-8?q?=EB=82=B4=20=EB=AA=A8=EB=93=A0=20API=20Versiong=20=EB=B0=A9?= =?UTF-8?q?=EC=8B=9D=20=EB=B3=80=EA=B2=BD=20(#93)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/StoreCertificationApi.java | 67 +++++++++++++++++-- 1 file changed, 62 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/nainga/nainga/domain/storecertification/api/StoreCertificationApi.java b/src/main/java/com/nainga/nainga/domain/storecertification/api/StoreCertificationApi.java index 09f3a67..9b22055 100644 --- a/src/main/java/com/nainga/nainga/domain/storecertification/api/StoreCertificationApi.java +++ b/src/main/java/com/nainga/nainga/domain/storecertification/api/StoreCertificationApi.java @@ -24,7 +24,7 @@ public class StoreCertificationApi { private final StoreCertificationService storeCertificationService; //총 사각형 영역의 네 꼭짓점 좌표를 받아, 해당 가게들의 상세 정보를 반환 - @Tag(name = "가게 상세 정보") + @Tag(name = "[Legacy] 가게 상세 정보") @Operation(summary = "사용자 위치 기반 가게 상세 정보 제공 V1", description = "총 사각형 영역의 네 꼭짓점 좌표를 받아 해당 가게들의 상세 정보를 반환해줍니다.

" + "[Request Body]
" + "nwLong: 북서쪽 좌표 경도
" + @@ -44,7 +44,7 @@ public class StoreCertificationApi { "certificationName: 가게의 인증제 목록
" + "=> 각 인증제별 순서는 보장되지 않습니다.") @GetMapping("api/v1/storecertification/byLocation") - public Result> findStoreCertificationsByLocation(@RequestParam("nwLong") double nwLong, @RequestParam("nwLat") double nwLat, @RequestParam("swLong") double swLong, @RequestParam("swLat") double swLat, @RequestParam("seLong") double seLong, @RequestParam("seLat") double seLat, @RequestParam("neLong") double neLong, @RequestParam("neLat") double neLat) { + public Result> findStoreCertificationsByLocationLegacy(@RequestParam("nwLong") double nwLong, @RequestParam("nwLat") double nwLat, @RequestParam("swLong") double swLong, @RequestParam("swLat") double swLat, @RequestParam("seLong") double seLong, @RequestParam("seLat") double seLat, @RequestParam("neLong") double neLong, @RequestParam("neLat") double neLat) { List storeCertificationsByLocation = storeCertificationService.findStoreCertificationsByLocation(new Location(nwLong, nwLat), new Location(swLong, swLat), new Location(seLong, seLat), new Location(neLong, neLat)); List storeIdsWithMultipleCertifications = storeCertificationService.getDuplicatedStoreIds(); //여러 인증제를 가지고 있는 가게의 id 리스트 List storeCertificationsByLocationResponses = new ArrayList<>(); //반환해줄 StoreCertificationsByLocationResponse들의 List @@ -71,7 +71,7 @@ public Result> findStoreCertificatio } //총 사각형 영역의 네 꼭짓점 좌표를 받아 최대 75개를 랜덤하게 뽑아낸 뒤, 해당 가게들의 상세 정보를 반환 - @Tag(name = "가게 상세 정보") + @Tag(name = "[Legacy] 가게 상세 정보") @Operation(summary = "사용자 위치 기반 가게 상세 정보 제공 V2", description = "총 사각형 영역의 네 꼭짓점 좌표를 받아 최대 75개를 랜덤하게 뽑아낸 뒤, 해당 가게들의 상세 정보를 반환해줍니다.

" + "[Request Body]
" + "nwLong: 북서쪽 좌표 경도
" + @@ -91,13 +91,13 @@ public Result> findStoreCertificatio "certificationName: 가게의 인증제 목록
" + "=> 각 인증제별 순서는 보장되지 않습니다.") @GetMapping("api/v2/storecertification/byLocation") - public Result>> findStoreCertificationsByLocationRandomly(@RequestParam("nwLong") double nwLong, @RequestParam("nwLat") double nwLat, @RequestParam("swLong") double swLong, @RequestParam("swLat") double swLat, @RequestParam("seLong") double seLong, @RequestParam("seLat") double seLat, @RequestParam("neLong") double neLong, @RequestParam("neLat") double neLat) { + public Result>> findStoreCertificationsByLocationRandomlyLegacy(@RequestParam("nwLong") double nwLong, @RequestParam("nwLat") double nwLat, @RequestParam("swLong") double swLong, @RequestParam("swLat") double swLat, @RequestParam("seLong") double seLong, @RequestParam("seLat") double seLat, @RequestParam("neLong") double neLong, @RequestParam("neLat") double neLat) { List> storeCertificationsByLocationRandomly = storeCertificationService.findStoreCertificationsByLocationRandomly(new Location(nwLong, nwLat), new Location(swLong, swLat), new Location(seLong, seLat), new Location(neLong, neLat)); return new Result<>(Result.CODE_SUCCESS, Result.MESSAGE_OK, storeCertificationsByLocationRandomly); } //검색어를 이용해 가게 이름, 업종, 주소에 대해 검색하고 나온 검색 결과 중 사용자로부터 가까운 순으로 최대 30개의 가게 정보를 리턴 - @Tag(name = "가게 상세 정보") + @Tag(name = "[Legacy] 가게 상세 정보") @Operation(summary = "사용자 위치 및 검색어 기반 가게 상세 정보 제공", description = "현재 사용자의 위치 좌표와 검색 키워드를 전달받아 가게 DB에서 검색한 뒤, 사용자와 가까운 순으로 최대 30개의 가게 상세 정보를 반환해줍니다.

" + "[Request Body]
" + "currLong: 현재 사용자의 위치 좌표 경도값
" + @@ -116,8 +116,65 @@ public Result>> findStoreCertif "certificationName: 가게의 인증제 목록
" + "=> 각 인증제별 순서는 보장되지 않습니다.") @GetMapping("api/v1/storecertification/byLocationAndKeyword") + public Result> searchStoreCertificationsByLocationAndKeywordLegacy(@RequestParam("currLong") double currLong, @RequestParam("currLat") double currLat, @RequestParam("searchKeyword") String searchKeyword) { + List storeCertificationsByLocationAndKeyword = storeCertificationService.searchStoreCertificationsByLocationAndKeyword(currLong, currLat, searchKeyword); + return new Result<>(Result.CODE_SUCCESS, Result.MESSAGE_OK, storeCertificationsByLocationAndKeyword); + } + + /* + 이 이하로는 모두 새로운 API Versioning 적용! Version이 URI에서 제일 뒤에 가도록 변경하였습니다. + 한 동안은 전 API Versioning 방식과 후 API Versioning 방식 모두 유지시키고 나중에는 최근 API Versioning 방식만 남겨둘 계획입니다. + */ + + //총 사각형 영역의 네 꼭짓점 좌표를 받아 최대 75개를 랜덤하게 뽑아낸 뒤, 해당 가게들의 상세 정보를 반환 + @Tag(name = "[New] 가게 상세 정보") + @Operation(summary = "사용자 위치 기반 가게 상세 정보 제공 V2", description = "총 사각형 영역의 네 꼭짓점 좌표를 받아 최대 75개를 랜덤하게 뽑아낸 뒤, 해당 가게들의 상세 정보를 반환해줍니다.

" + + "[Request Body]
" + + "nwLong: 북서쪽 좌표 경도
" + + "nwLat: 북서쪽 좌표 위도
" + + "seLong: 남동쪽 좌표 경도
" + + "seLat: 남동쪽 좌표 위도

" + + "[Response Body]
" + + "id: Database 내 Primary Key값
" + + "displayName: 가게 이름
" + + "primaryTypeDisplayName: 업종
" + + "formattedAddress: 주소
" + + "phoneNumber: 전화번호
" + + "location: (경도, 위도) 가게 좌표
" + + "regularOpeningHours: 영업 시간
" + + "=> 특정 요일이 휴무인 경우에는 해당 요일에 대한 데이터가 들어있지 않습니다. Break time이 있는 경우 동일한 요일에 대해 영업 시간 데이터가 여러 개 존재할 수 있습니다.
" + + "localPhotos: 저장된 가게 사진 URL
" + + "certificationName: 가게의 인증제 목록
" + + "=> 각 인증제별 순서는 보장되지 않습니다.") + @GetMapping("api/storecertification/byLocation/v2") + public Result>> findStoreCertificationsByLocationRandomly(@RequestParam("nwLong") double nwLong, @RequestParam("nwLat") double nwLat, @RequestParam("swLong") double swLong, @RequestParam("swLat") double swLat, @RequestParam("seLong") double seLong, @RequestParam("seLat") double seLat, @RequestParam("neLong") double neLong, @RequestParam("neLat") double neLat) { + List> storeCertificationsByLocationRandomly = storeCertificationService.findStoreCertificationsByLocationRandomly(new Location(nwLong, nwLat), new Location(swLong, swLat), new Location(seLong, seLat), new Location(neLong, neLat)); + return new Result<>(Result.CODE_SUCCESS, Result.MESSAGE_OK, storeCertificationsByLocationRandomly); + } + + //검색어를 이용해 가게 이름, 업종, 주소에 대해 검색하고 나온 검색 결과 중 사용자로부터 가까운 순으로 최대 30개의 가게 정보를 리턴 + @Tag(name = "[New] 가게 상세 정보") + @Operation(summary = "사용자 위치 및 검색어 기반 가게 상세 정보 제공", description = "현재 사용자의 위치 좌표와 검색 키워드를 전달받아 가게 DB에서 검색한 뒤, 사용자와 가까운 순으로 최대 30개의 가게 상세 정보를 반환해줍니다.

" + + "[Request Body]
" + + "currLong: 현재 사용자의 위치 좌표 경도값
" + + "currLat: 현재 사용자의 위치 좌표 위도값
" + + "searchKeyword: 검색할 키워드

" + + "[Response Body]
" + + "id: Database 내 Primary Key값
" + + "displayName: 가게 이름
" + + "primaryTypeDisplayName: 업종
" + + "formattedAddress: 주소
" + + "phoneNumber: 전화번호
" + + "location: (경도, 위도) 가게 좌표
" + + "regularOpeningHours: 영업 시간
" + + "=> 특정 요일이 휴무인 경우에는 해당 요일에 대한 데이터가 들어있지 않습니다. Break time이 있는 경우 동일한 요일에 대해 영업 시간 데이터가 여러 개 존재할 수 있습니다.
" + + "localPhotos: 저장된 가게 사진 URL
" + + "certificationName: 가게의 인증제 목록
" + + "=> 각 인증제별 순서는 보장되지 않습니다.") + @GetMapping("api/storecertification/byLocationAndKeyword/v1") public Result> searchStoreCertificationsByLocationAndKeyword(@RequestParam("currLong") double currLong, @RequestParam("currLat") double currLat, @RequestParam("searchKeyword") String searchKeyword) { List storeCertificationsByLocationAndKeyword = storeCertificationService.searchStoreCertificationsByLocationAndKeyword(currLong, currLat, searchKeyword); return new Result<>(Result.CODE_SUCCESS, Result.MESSAGE_OK, storeCertificationsByLocationAndKeyword); } + } \ No newline at end of file From e9bcdf738f0cc50ac71f39f306ce35fbde541db6 Mon Sep 17 00:00:00 2001 From: sungjindev Date: Fri, 9 Feb 2024 21:45:12 +0900 Subject: [PATCH 20/21] =?UTF-8?q?fix=20:=20GCS=20=EA=B4=80=EB=A0=A8=20API?= =?UTF-8?q?=20=EB=82=B4=20=EB=AA=A8=EB=93=A0=20API=20Versiong=20=EB=B0=A9?= =?UTF-8?q?=EC=8B=9D=20=EB=B3=80=EA=B2=BD=20(#93)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/nainga/nainga/global/config/SwaggerConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/nainga/nainga/global/config/SwaggerConfig.java b/src/main/java/com/nainga/nainga/global/config/SwaggerConfig.java index 0472428..7a30728 100644 --- a/src/main/java/com/nainga/nainga/global/config/SwaggerConfig.java +++ b/src/main/java/com/nainga/nainga/global/config/SwaggerConfig.java @@ -32,7 +32,7 @@ public OpenAPI customOpenAPI() { "참고로 Swagger 상에서는 Base URL이 달라 테스트가 불가능합니다.
" + "만약 테스트를 원하신다면 브라우저 상에서 직접 URL을 입력해주시면 됩니다.
" + "예) https://storage.googleapis.com/kcs-dev-bucket1/ad06294c-d4ed-42bd-9839-82af8714bd1e") - .tags(List.of("가게 상세 정보")) + .tags(List.of("[New] 가게 상세 정보")) .responses(new ApiResponses().addApiResponse("200", new ApiResponse().description("OK") .content(new Content().addMediaType("image/jpeg", new MediaType() From d406b1a060786b65b366ca53435ef7e8d049e1ab Mon Sep 17 00:00:00 2001 From: hoon Date: Thu, 15 Feb 2024 01:09:02 +0900 Subject: [PATCH 21/21] =?UTF-8?q?fix=20:=20=EB=AA=A8=EB=8B=88=ED=84=B0?= =?UTF-8?q?=EB=A7=81=20=EC=98=A4=ED=83=80=20=ED=8C=8C=EC=9D=BC=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20(#96)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/backend-submodule | 2 +- src/test/resources/backend-submodule | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/backend-submodule b/src/main/resources/backend-submodule index 6ee111c..864e24e 160000 --- a/src/main/resources/backend-submodule +++ b/src/main/resources/backend-submodule @@ -1 +1 @@ -Subproject commit 6ee111c8697d5426fe4c7ee77e345f83d518b162 +Subproject commit 864e24eecb92e71b9c8988e9684e4faf9802dcd8 diff --git a/src/test/resources/backend-submodule b/src/test/resources/backend-submodule index 6ee111c..732770b 160000 --- a/src/test/resources/backend-submodule +++ b/src/test/resources/backend-submodule @@ -1 +1 @@ -Subproject commit 6ee111c8697d5426fe4c7ee77e345f83d518b162 +Subproject commit 732770ba3e8a25abfb4212a7a75175249e2c099e