Skip to content

Commit

Permalink
fix: 위치 정보 범위 변경 상수로 관리
Browse files Browse the repository at this point in the history
  • Loading branch information
DongGeon0908 committed Apr 6, 2024
1 parent ab22e1f commit 7e6c4b4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/com/core/api/item/service/ItemService.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ public class ItemService {
private final ItemCommentLikeRepository itemCommentLikeRepository;
private final JPAQueryFactory jpaQueryFactory;

/** 해당 길이를 통해 위치 정보 범위 변경 */
public final static int ADDRESS_RANGE = 5000;

@Transactional
public ItemSaveResponseDto itemSave(AuthUser user, ItemSaveDto itemSaveDto) {
var address = addressClient.search(itemSaveDto.getLatitude(), itemSaveDto.getLongitude())
Expand Down Expand Up @@ -81,7 +84,7 @@ public List<ItemSaveResponseDto> itemList(BigDecimal latitude, BigDecimal longit
double lon = longitude.doubleValue();

return allItems.stream()
.filter(item -> GeoUtils.calculateDistance(lat, lon, item.getLatitude().doubleValue(), item.getLongitude().doubleValue()) <= 5000)
.filter(item -> GeoUtils.calculateDistance(lat, lon, item.getLatitude().doubleValue(), item.getLongitude().doubleValue()) <= ADDRESS_RANGE)
.map(ItemSaveResponseDto::new)
.toList();
}
Expand Down

0 comments on commit 7e6c4b4

Please sign in to comment.