From 5a35805f31621c665cb975232f09f8e9550c3398 Mon Sep 17 00:00:00 2001 From: choidongkuen Date: Sun, 11 Feb 2024 13:03:04 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20TeumTeumService=20=EB=A6=AC?= =?UTF-8?q?=ED=8C=A9=ED=86=A0=EB=A7=81=20(#178)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../net/teumteum/teum_teum/service/TeumTeumService.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/teumteum/teum_teum/service/TeumTeumService.java b/src/main/java/net/teumteum/teum_teum/service/TeumTeumService.java index 050e086..dd69880 100644 --- a/src/main/java/net/teumteum/teum_teum/service/TeumTeumService.java +++ b/src/main/java/net/teumteum/teum_teum/service/TeumTeumService.java @@ -9,20 +9,20 @@ import java.util.Set; import java.util.stream.Collectors; import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; import net.teumteum.core.security.service.RedisService; import net.teumteum.teum_teum.domain.UserLocation; import net.teumteum.teum_teum.domain.request.UserLocationRequest; import net.teumteum.teum_teum.domain.response.UserAroundLocationsResponse; import org.springframework.stereotype.Service; -@Slf4j + @Service @RequiredArgsConstructor public class TeumTeumService { private static final int SEARCH_LIMIT = 6; - private static final long USER_LOCATION_DATA_DURATION = 30L; + private static final long USER_LOCATION_DATA_DURATION = 10L; + private static final int AROUND_USER_LOCATION_DISTANCE = 100; private final RedisService redisService; @@ -37,7 +37,7 @@ private UserAroundLocationsResponse getUserAroundLocations(UserLocationRequest r Set aroundUserLocations = allUserLocations.stream() .filter(userLocation -> !userLocation.id().equals(request.id())) .filter(userLocation -> calculateDistance(request.latitude(), request.longitude(), - userLocation.latitude(), userLocation.longitude()) <= 100) + userLocation.latitude(), userLocation.longitude()) <= AROUND_USER_LOCATION_DISTANCE) .sorted(comparingDouble(userLocation -> calculateDistance(request.latitude(), request.longitude(), userLocation.latitude(), userLocation.longitude()))