Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,18 @@ private PodResponse mapToPodResponseDto(Pod pod, Set<Long> jjimPodIds) {
return null; // PodType이 두 가지 외에는 처리되지 않음
}

private PodResponse mapToPodResponseDtoForMap(Pod pod, Set<Long> jjimPodIds, boolean includeAddress) {
boolean isJJim = jjimPodIds.contains(pod.getId());

if (pod.getPodType() == PodType.MINIMUM) {
return buildMinimumPodResponseDtoForMap(pod, isJJim, true);
} else if (pod.getPodType() == PodType.GROUP_BUY) {
return buildGroupBuyPodResponseDtoForMap(pod, isJJim, true);
}

return null; // PodType이 두 가지 외에는 처리되지 않음
}

//사용자 주변 팟 거리 계산 메서드
private double calculateDistance(double lat1, double lon1, Pod pod) {
double lat2 = pod.getAddress().getLatitude();
Expand Down Expand Up @@ -322,7 +334,7 @@ public List<PodResponse> getPodsInBounds(
Set<Long> jJimPodIds = getJJimPodIds(userId);

return pods.stream()
.map(pod -> mapToPodResponseDto(pod, jJimPodIds))
.map(pod -> mapToPodResponseDtoForMap(pod, jJimPodIds, true))
.collect(Collectors.toList());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.podmate.domain.pod.converter;

import com.podmate.domain.address.domain.entity.Address;
import com.podmate.domain.orderForm.domain.entity.OrderForm;
import com.podmate.domain.pod.domain.entity.Pod;
import com.podmate.domain.pod.dto.PodResponseDto;
Expand All @@ -13,7 +14,7 @@

public class PodConverter {
public static PodResponseDto.Minimum buildMinimumPodResponseDto(Pod pod, boolean isJJim) {
return PodResponseDto.Minimum.builder()
return PodResponseDto.Minimum.builder()
.podId(pod.getId())
.podName(pod.getPodName())
.podType(pod.getPodType().name())
Expand All @@ -24,6 +25,26 @@ public static PodResponseDto.Minimum buildMinimumPodResponseDto(Pod pod, boolean
.build();
}

public static PodResponseDto.Minimum buildMinimumPodResponseDtoForMap(Pod pod, boolean isJJim, boolean includeAddress) {
Address address = pod.getAddress();
return PodResponseDto.Minimum.builder()
.podId(pod.getId())
.podName(pod.getPodName())
.podType(pod.getPodType().name())
.platform(pod.getPlatform().name())
.goalAmount(pod.getGoalAmount())
.currentAmount(pod.getCurrentAmount())
.isJJim(isJJim)

// ✅ 주소 필드 세팅
.addressId(address.getId())
.roadAddress(address.getRoadAddress())
.latitude(address.getLatitude())
.longitude(address.getLongitude())

.build();
}

public static PodResponseDto.GroupBuy buildGroupBuyPodResponseDto(Pod pod, boolean isJJim) {
return PodResponseDto.GroupBuy.builder()
.podId(pod.getId())
Expand All @@ -36,6 +57,26 @@ public static PodResponseDto.GroupBuy buildGroupBuyPodResponseDto(Pod pod, boole
.build();
}

public static PodResponseDto.GroupBuy buildGroupBuyPodResponseDtoForMap(Pod pod, boolean isJJim, boolean includeAddress) {
Address address = pod.getAddress();
return PodResponseDto.GroupBuy.builder()
.podId(pod.getId())
.podName(pod.getPodName())
.podType(pod.getPodType().name())
.itemUrl(pod.getItemUrl())
.goalAmount(pod.getGoalAmount())
.currentAmount(pod.getCurrentAmount())
.isJJim(isJJim)

// 주소 필드 세팅
.addressId(address.getId())
.roadAddress(address.getRoadAddress())
.latitude(address.getLatitude())
.longitude(address.getLongitude())

.build();
}

public static PodResponseDto.MinimumDetail buildMinimumDetailResponseDto(Pod pod, boolean isJJim, PodResponseDto.PodLeader podLeaderDto) {
return PodResponseDto.MinimumDetail.builder()
.podId(pod.getId())
Expand Down
13 changes: 13 additions & 0 deletions be/src/main/java/com/podmate/domain/pod/dto/PodResponseDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ public static class Minimum implements PodResponse{
private int goalAmount; //목표 금액 or 목표 인원
private int currentAmount; //현재 금액 or 현재 인원
private boolean isJJim;

// 주소 필드 추가
private Long addressId;
private String roadAddress;
private double latitude;
private double longitude;
}

@Builder
Expand Down Expand Up @@ -91,6 +97,13 @@ public static class GroupBuy implements PodResponse{
private int goalAmount; //목표 금액 or 목표 인원
private int currentAmount; //현재 금액 or 현재 인원
private boolean isJJim;

// 주소 필드 추가
private Long addressId;
private String roadAddress;
private double latitude;
private double longitude;

}
@Builder
@Getter
Expand Down
Loading