Skip to content

Commit

Permalink
[HOTFIX] 소켓 id를 group id 로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
ohksj77 committed Jan 16, 2024
1 parent aac2eeb commit b66d576
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -23,8 +21,8 @@ public class GeoService {
private final RedisTemplate<String, String> 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
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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());
}
Expand Down

0 comments on commit b66d576

Please sign in to comment.