Fix : 수정

This commit is contained in:
lsh9672 2025-06-13 01:20:50 +09:00
parent 60ee715d3e
commit a2fa6870e5
4 changed files with 24 additions and 6 deletions

View File

@ -24,4 +24,22 @@ public class PageResponse<T> {
private Boolean first; private Boolean first;
private Boolean last; private Boolean last;
private Boolean empty; private Boolean empty;
/**
* PageResponse 생성을 위한 정적 팩토리 메서드
*/
public static <T> PageResponse<T> of(List<T> content, Integer page, Integer size, Long totalElements) {
Integer totalPages = (int) Math.ceil((double) totalElements / size);
return PageResponse.<T>builder()
.content(content)
.page(page)
.size(size)
.totalElements(totalElements)
.totalPages(totalPages)
.first(page == 0)
.last(page >= totalPages - 1)
.empty(content.isEmpty())
.build();
}
} }

View File

@ -87,11 +87,11 @@ public class StoreRecommendInteractor implements StoreRecommendUseCase {
List<RecommendStoreResponse> responses = convertToResponseList(pagedStores); List<RecommendStoreResponse> responses = convertToResponseList(pagedStores);
return PageResponse.of(responses, pageable.getPageNumber(), pageable.getPageSize(), stores.size()); return PageResponse.of(responses, pageable.getPageNumber(), pageable.getPageSize(), Long.valueOf(stores.size()));
} catch (Exception e) { } catch (Exception e) {
log.error("위치 기반 매장 추천 실패: lat={}, lng={}", latitude, longitude, e); log.error("위치 기반 매장 추천 실패: lat={}, lng={}", latitude, longitude, e);
return PageResponse.of(getDefaultRecommendations(), 0, pageable.getPageSize(), 0); return PageResponse.of(getDefaultRecommendations(), 0, pageable.getPageSize(), 0L);
} }
} }
@ -217,7 +217,7 @@ public class StoreRecommendInteractor implements StoreRecommendUseCase {
.address("서울시 강남구 테헤란로 123") .address("서울시 강남구 테헤란로 123")
.category("한식") .category("한식")
.rating(4.5) .rating(4.5)
.distance(500) .distance(500.0)
.tags(Arrays.asList("맛있는", "친절한")) .tags(Arrays.asList("맛있는", "친절한"))
.recommendReason("인기 매장입니다") .recommendReason("인기 매장입니다")
.build() .build()

View File

@ -57,7 +57,7 @@ public class TasteAnalysisInteractor implements TasteAnalysisUseCase {
.categoryScores(categoryScores) .categoryScores(categoryScores)
.preferredTags(profile.getPreferredTags()) .preferredTags(profile.getPreferredTags())
.pricePreference(profile.getPricePreference()) .pricePreference(profile.getPricePreference())
.distancePreference(profile.getDistancePreference()) .distancePreference((double)profile.getDistancePreference())
.analysisDate(profile.getUpdatedAt()) .analysisDate(profile.getUpdatedAt())
.build(); .build();
} }

View File

@ -26,8 +26,8 @@ public class StoreDetailResponse {
@Schema(description = "평점", example = "4.5") @Schema(description = "평점", example = "4.5")
private Double rating; private Double rating;
@Schema(description = "거리(미터)", example = "500") @Schema(description = "거리(미터)", example = "500.0") // Double로 수정
private Integer distance; private Double distance;
@Schema(description = "태그 목록", example = "[\"맛집\", \"혼밥\", \"가성비\"]") @Schema(description = "태그 목록", example = "[\"맛집\", \"혼밥\", \"가성비\"]")
private List<String> tags; private List<String> tags;