diff --git a/backend/src/main/java/com/twtw/backend/domain/location/controller/LocationController.java b/backend/src/main/java/com/twtw/backend/domain/location/controller/LocationController.java index d4792564..e342596c 100644 --- a/backend/src/main/java/com/twtw/backend/domain/location/controller/LocationController.java +++ b/backend/src/main/java/com/twtw/backend/domain/location/controller/LocationController.java @@ -21,13 +21,13 @@ public class LocationController { private final RabbitTemplate rabbitTemplate; private final LocationService locationService; - @MessageMapping("map.share.{planId}") + @MessageMapping("map.share.{groupId}") public void share( - @DestinationVariable final UUID planId, + @DestinationVariable final UUID groupId, @Payload final LocationRequest locationRequest) { rabbitTemplate.convertAndSend( RabbitMQConstant.LOCATION_EXCHANGE.getName(), - RabbitMQConstant.LOCATION_ROUTING_KEY_PREFIX.getName() + planId, - locationService.addInfo(planId, locationRequest)); + RabbitMQConstant.LOCATION_ROUTING_KEY_PREFIX.getName() + groupId, + locationService.addInfo(groupId, locationRequest)); } } diff --git a/backend/src/main/java/com/twtw/backend/domain/location/service/GeoService.java b/backend/src/main/java/com/twtw/backend/domain/location/service/GeoService.java index 457e6e8e..d7e6283f 100644 --- a/backend/src/main/java/com/twtw/backend/domain/location/service/GeoService.java +++ b/backend/src/main/java/com/twtw/backend/domain/location/service/GeoService.java @@ -1,13 +1,11 @@ package com.twtw.backend.domain.location.service; +import com.twtw.backend.domain.group.entity.Group; import com.twtw.backend.domain.location.dto.collection.MemberDistances; import com.twtw.backend.domain.location.dto.request.LocationRequest; import com.twtw.backend.domain.location.dto.response.AverageCoordinate; import com.twtw.backend.domain.member.entity.Member; -import com.twtw.backend.domain.plan.entity.Plan; - import lombok.RequiredArgsConstructor; - import org.springframework.data.geo.Metrics; import org.springframework.data.geo.Point; import org.springframework.data.redis.core.RedisTemplate; @@ -23,8 +21,8 @@ public class GeoService { private final RedisTemplate redisTemplate; public AverageCoordinate saveLocation( - final Plan plan, final Member member, final LocationRequest locationRequest) { - final String planId = plan.getId().toString(); + final Group group, final Member member, final LocationRequest locationRequest) { + final String planId = group.getId().toString(); final String memberId = member.getId().toString(); redisTemplate diff --git a/backend/src/main/java/com/twtw/backend/domain/location/service/LocationService.java b/backend/src/main/java/com/twtw/backend/domain/location/service/LocationService.java index e0bc817e..15191fd6 100644 --- a/backend/src/main/java/com/twtw/backend/domain/location/service/LocationService.java +++ b/backend/src/main/java/com/twtw/backend/domain/location/service/LocationService.java @@ -1,5 +1,7 @@ package com.twtw.backend.domain.location.service; +import com.twtw.backend.domain.group.entity.Group; +import com.twtw.backend.domain.group.service.GroupService; import com.twtw.backend.domain.location.dto.request.LocationRequest; import com.twtw.backend.domain.location.dto.response.AverageCoordinate; import com.twtw.backend.domain.location.dto.response.LocationResponse; @@ -23,19 +25,19 @@ public class LocationService { private final LocationMapper locationMapper; private final MemberService memberService; - private final PlanService planService; + private final GroupService groupService; private final GeoService geoService; @Transactional - public LocationResponse addInfo(final UUID planId, final LocationRequest locationRequest) { + public LocationResponse addInfo(final UUID groupId, final LocationRequest locationRequest) { final Member member = memberService.getMemberById(locationRequest.getMemberId()); - final Plan plan = planService.getPlanEntity(planId); + final Group group = groupService.getGroupEntity(groupId); - plan.updateMemberLocation( + group.updateMemberLocation( member, locationRequest.getLongitude(), locationRequest.getLatitude()); final AverageCoordinate averageCoordinate = - geoService.saveLocation(plan, member, locationRequest); + geoService.saveLocation(group, member, locationRequest); return locationMapper.toResponse(locationRequest, averageCoordinate, LocalDateTime.now()); }