Skip to content

Commit

Permalink
Merge pull request #95 from SOPT-all/feat/93
Browse files Browse the repository at this point in the history
[FEAT] 지역 주소 대신 지역명을 기준으로 필터링하도록 수정
  • Loading branch information
airoca authored Jan 25, 2025
2 parents 2df70ee + 7da0de4 commit 49bae2f
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,15 @@ public ZzimCardListResponseDTO getZzimByLocation(Long userId, Long locationId) {
.orElseThrow(() -> new BusinessException(PostErrorMessage.LOCATION_NOT_FOUND));

if (locationEntity.getLocationTypeEntity().getLocationTypeId() == 1) {
return getZzimByAddress(userId, locationEntity.getLocationAddress());
return getZzimByAddress(userId, locationEntity.getLocationName());
} else if (locationEntity.getLocationTypeEntity().getLocationTypeId() == 2) {
return getZzimByAreaDong(userId, locationEntity.getLongitude(), locationEntity.getLatitude());
} else{
return getZzimByAreaStation(userId, locationEntity.getLongitude(), locationEntity.getLatitude());
}
}

private ZzimCardListResponseDTO getZzimByAddress(Long userId, String locationAddress) {
private ZzimCardListResponseDTO getZzimByAddress(Long userId, String locationName) {
List<ZzimPostEntity> zzimPostEntityList = zzimPostRepository.findByUser((userRepository.findById(userId)
.orElseThrow(() -> new BusinessException(UserErrorMessage.USER_NOT_FOUND))
));
Expand All @@ -212,11 +212,11 @@ private ZzimCardListResponseDTO getZzimByAddress(Long userId, String locationAdd
}
}

// placeAddress에 locationAddress 문자열이 포함된 데이터만 필터링
// placeAddress에 locationName 문자열이 포함된 데이터만 필터링
List<ZzimCardResponseDTO> zzimCardResponses = uniquePlacePostMap.values().stream()
.filter(zzimPostEntity -> {
PlaceEntity placeEntity = zzimPostEntity.getPost().getPlace();
return placeEntity.getPlaceAddress() != null && placeEntity.getPlaceAddress().contains(locationAddress);
return placeEntity.getPlaceAddress() != null && placeEntity.getPlaceAddress().contains(locationName);
})
.map(zzimPostEntity -> {
PostEntity postEntity = zzimPostEntity.getPost();
Expand Down

0 comments on commit 49bae2f

Please sign in to comment.