-
Notifications
You must be signed in to change notification settings - Fork 0
✨️ feat/ZIP-29 : 대시보드 기능 구현 #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
fa49270
✨️ feat/ZIP-29 : 대시보드를 기능 구현
doup2001 3b8e244
♻️ refactor/ZIP-29 : N+1 문제 해결
doup2001 421c9d2
✨️ feat/ZIP-29 : 구현체 정의
doup2001 a3747eb
💡️style/ZIP-29 : 서비스 내 로그 제거
doup2001 36962be
✅test/ZIP-29 : 서비스 및 API 테스트 추가
doup2001 22afa77
Merge branch 'develop' into feat/ZIP-29-DashBoard
doup2001 08dfb81
✅test/ZIP-29 : 서비스 코드 중 변수 수정
doup2001 a93fb89
✅ test/ZIP-29 : 테스트 환경 주입
doup2001 45e1040
✅ test/ZIP-29 : 테스트의 변수 수정
doup2001 01dab61
✨ feat/ZIP-29 : 스웨거 인터페이스 생성
doup2001 5a7bb8c
✨ feat/ZIP-8 : 성능 향상을 위한 테스트 파이프라인 수정
doup2001 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/main/java/com/zipte/platform/server/application/in/dashboard/DashBoardUseCase.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,43 @@ | ||
| package com.zipte.platform.server.application.in.dashboard; | ||
|
|
||
| import com.zipte.platform.server.domain.estate.Estate; | ||
| import com.zipte.platform.server.domain.estate.EstatePrice; | ||
| import com.zipte.platform.server.domain.region.Region; | ||
| import com.zipte.platform.server.domain.region.RegionPrice; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public interface DashBoardUseCase { | ||
|
|
||
| /* | ||
| 매매 / 관심 지역 관심 지역 - 실거래가 동향 관심 지역으로 설정한 지역의 가격 변화에 대한 알림을 받는다. | ||
| 매매 / 관심 아파트 관심 아파트 - 시세 변화 관심 아파트의 가격 변화에 대한 알림을 받는다. | ||
| 전체 / 맞춤형 아파트 제공 맞춤형 추천 매물 현황 추천시스템을 통해 관심 아파트로 설정한 유사 아파트를 제공한다. | ||
| 나의 아파트 가격 변화 / 나의 아파트 가격 변화 조회 / 개인정보에 등록한 나의 아파트의 가격 변화를 그래프로 확인한다. | ||
| */ | ||
|
|
||
|
|
||
| /// 관심 지역 조회하기 | ||
| List<Region> getFavoriteRegion(Long userId); | ||
|
|
||
| /// 관심 지역 가격 조회하기 | ||
| List<RegionPrice> getFavoriteRegionPrices(Long userId); | ||
|
|
||
|
|
||
| /// 관심 아파트 목록 조회하기 | ||
| List<Estate> getFavoriteEstates(Long userId); | ||
|
|
||
|
|
||
| /// 관심 아파트 가격 목록 조회하기 | ||
| List<EstatePrice> getFavoriteEstatePrice(Long userId); | ||
|
|
||
|
|
||
| /// AI 추천 목록 조회하기 | ||
|
|
||
|
|
||
| /// 주거지 인증을 한 나의 아파트 조회하기 | ||
| List<EstatePrice> getMyEstatePrices(Long userId); | ||
|
|
||
|
|
||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
165 changes: 165 additions & 0 deletions
165
src/main/java/com/zipte/platform/server/application/service/DashBoardService.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,165 @@ | ||
| package com.zipte.platform.server.application.service; | ||
|
|
||
| import com.zipte.platform.core.response.ErrorCode; | ||
| import com.zipte.platform.server.application.in.dashboard.DashBoardUseCase; | ||
| import com.zipte.platform.server.application.out.estate.EstatePricePort; | ||
| import com.zipte.platform.server.application.out.estate.LoadEstatePort; | ||
| import com.zipte.platform.server.application.out.estateOwnership.EstateOwnerShipPort; | ||
| import com.zipte.platform.server.application.out.favorite.FavoritePort; | ||
| import com.zipte.platform.server.application.out.region.RegionPort; | ||
| import com.zipte.platform.server.application.out.region.RegionPricePort; | ||
| import com.zipte.platform.server.application.out.user.UserPort; | ||
| import com.zipte.platform.server.domain.estate.Estate; | ||
| import com.zipte.platform.server.domain.estate.EstatePrice; | ||
| import com.zipte.platform.server.domain.estateOwnership.EstateOwnership; | ||
| import com.zipte.platform.server.domain.favorite.Favorite; | ||
| import com.zipte.platform.server.domain.favorite.FavoriteType; | ||
| import com.zipte.platform.server.domain.region.Region; | ||
| import com.zipte.platform.server.domain.region.RegionPrice; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.stereotype.Service; | ||
| import org.springframework.transaction.annotation.Transactional; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
| import java.util.NoSuchElementException; | ||
|
|
||
| @Service | ||
| @Transactional | ||
| @RequiredArgsConstructor | ||
| public class DashBoardService implements DashBoardUseCase { | ||
|
|
||
|
|
||
| private final UserPort userPort; | ||
|
|
||
| private final FavoritePort favoritePort; | ||
|
|
||
| private final RegionPort regionPort; | ||
|
|
||
| private final RegionPricePort regionPricePort; | ||
|
|
||
| private final LoadEstatePort loadEstatePort; | ||
|
|
||
| private final EstatePricePort estatePricePort; | ||
|
|
||
| private final EstateOwnerShipPort estateOwnerShipPort; | ||
|
|
||
| /// 나의 관심 지역 조회 | ||
| @Override | ||
| public List<Region> getFavoriteRegion(Long userId) { | ||
| /// 유저 예외 처리 | ||
| if (userPort.checkExistingById(userId)) { | ||
| throw new NoSuchElementException(ErrorCode.NOT_USER.getMessage()); | ||
| } | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| /// 유저의 관심 지역 목록 조회하기 | ||
| List<Favorite> regionList = favoritePort.loadUserFavoriteByType(userId, FavoriteType.REGION); | ||
|
|
||
|
|
||
| /// 관심 지역 목록을 바탕으로 조회하기 | ||
| List<Region> response = new ArrayList<>(); | ||
|
|
||
|
|
||
| regionList.forEach(favorite -> { | ||
| String regionCode = favorite.getRegionCode(); | ||
| Region region = regionPort.loadRegion(regionCode) | ||
| .orElseThrow(() -> new NoSuchElementException(ErrorCode.NOT_REGION.getMessage())); | ||
|
|
||
| response.add(region); | ||
| }); | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| return response; | ||
| } | ||
|
|
||
| @Override | ||
| public List<RegionPrice> getFavoriteRegionPrices(Long userId) { | ||
|
|
||
| /// 유저 예외 처리 | ||
| if (userPort.checkExistingById(userId)) { | ||
| throw new NoSuchElementException(ErrorCode.NOT_USER.getMessage()); | ||
| } | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| /// 유저의 관심 지역 목록 조회하기 | ||
| List<Favorite> regionList = favoritePort.loadUserFavoriteByType(userId, FavoriteType.REGION); | ||
|
|
||
| /// 관심 지역 목록을 바탕으로 가격 조회하기 | ||
| List<RegionPrice> response = new ArrayList<>(); | ||
|
|
||
| regionList.forEach(region -> { | ||
| String regionCode = region.getRegionCode(); | ||
| RegionPrice regionPrice = regionPricePort.loadRegionPriceByCode(regionCode) | ||
| .orElseThrow(() -> new NoSuchElementException(ErrorCode.NOT_REGION_PRICE.getMessage())); | ||
|
|
||
| response.add(regionPrice); | ||
| }); | ||
|
|
||
| return response; | ||
| } | ||
|
|
||
|
|
||
| /// 나의 관심 아파트 조회 | ||
| @Override | ||
| public List<Estate> getFavoriteEstates(Long userId) { | ||
| /// 유저 예외 처리 | ||
| if (userPort.checkExistingById(userId)) { | ||
| throw new NoSuchElementException(ErrorCode.NOT_USER.getMessage()); | ||
| } | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| /// 유저의 관심 목록 조회하기 | ||
| List<Favorite> estateList = favoritePort.loadUserFavoriteByType(userId, FavoriteType.APARTMENT); | ||
|
|
||
| /// 유저 관련 아파트 조회 | ||
| List<Estate> response = new ArrayList<>(); | ||
|
|
||
|
|
||
| estateList.forEach(favorite -> { | ||
| String kaptCode = favorite.getKaptCode(); | ||
| Estate estate = loadEstatePort.loadEstateByCode(kaptCode) | ||
| .orElseThrow(() -> new NoSuchElementException(ErrorCode.NOT_ESTATE.getMessage())); | ||
| response.add(estate); | ||
| }); | ||
|
|
||
| return response; | ||
| } | ||
|
|
||
|
|
||
| @Override | ||
| public List<EstatePrice> getFavoriteEstatePrice(Long userId) { | ||
|
|
||
| /// 유저 예외 처리 | ||
| if (userPort.checkExistingById(userId)) { | ||
| throw new NoSuchElementException(ErrorCode.NOT_USER.getMessage()); | ||
| } | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| /// 유저의 관심 목록 조회하기 | ||
| List<Favorite> regionList = favoritePort.loadUserFavoriteByType(userId, FavoriteType.APARTMENT); | ||
|
|
||
| /// 관심 아파트 목록을 바탕으로 가격 조회하기 | ||
| // flatMap을 통해 새롭게 정의 해봄 | ||
| return regionList.stream() | ||
| .map(Favorite::getKaptCode) | ||
| .map(estatePricePort::loadAllEstatePrices) | ||
| .flatMap(List::stream) | ||
| .toList(); | ||
| } | ||
|
|
||
|
|
||
| /// 나의 소유 아파트 조회 | ||
| @Override | ||
| public List<EstatePrice> getMyEstatePrices(Long userId) { | ||
|
|
||
| /// 유저 예외 처리 | ||
| if (userPort.checkExistingById(userId)) { | ||
| throw new NoSuchElementException(ErrorCode.NOT_USER.getMessage()); | ||
| } | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| /// 나의 주거지 인증 아파트 목록 조회 | ||
| List<EstateOwnership> ownerships = estateOwnerShipPort.loadMyOwnerships(userId); | ||
|
|
||
| return ownerships.stream() | ||
| .map(EstateOwnership::getKaptCode) | ||
| .map(estatePricePort::loadAllEstatePrices) | ||
| .flatMap(List::stream) | ||
| .toList(); | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.