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
Empty file.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.earseo.sight.dto.internal;

import com.earseo.sight.dto.projection.SightMetaDto;
import com.earseo.sight.entity.Theme;

public record SightMetaResponse(
String id,
Expand All @@ -10,7 +11,7 @@ public record SightMetaResponse(
Double latitude,
Double longitude,
String docentUrl,
String theme
Theme theme
) {
public static SightMetaResponse toDto(SightMetaDto dto) {
return new SightMetaResponse(
Expand All @@ -21,7 +22,7 @@ public static SightMetaResponse toDto(SightMetaDto dto) {
dto.mapY(),
dto.mapX(),
dto.docentUrl(),
dto.cat1()
Theme.valueOf(dto.cat1())
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ public record SightMapItemDto(
String contentId,
String title,
Double mapX,
Double mapY
Double mapY,
String cat1
) {
}
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.earseo.sight.dto.response;

import com.earseo.sight.dto.projection.CurationSightItemDto;
import com.earseo.sight.entity.SubTheme;
import io.swagger.v3.oas.annotations.media.Schema;

public record CurationSightResponse(
Expand All @@ -10,8 +11,8 @@ public record CurationSightResponse(
@Schema(description = "관광지 이름", example = "경복궁")
String title,

@Schema(description = "관광지 테마 (예: 문화시설, 자연관광지 등)", example = "인문")
String theme,
@Schema(description = "관광지 하위 테마 (코드)", example = "CU01")
SubTheme subTheme,

@Schema(description = "현재 위치로부터의 직선 거리 (미터)", example = "1234.56")
Double distance,
Expand All @@ -23,7 +24,7 @@ public static CurationSightResponse toDto(CurationSightItemDto dto) {
return new CurationSightResponse(
dto.contentId(),
dto.title(),
dto.cat2(),
SubTheme.valueOf(dto.cat2()),
dto.distance(),
dto.addr3()
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.earseo.sight.dto.response;

import com.earseo.sight.dto.projection.SearchSightItemDto;
import com.earseo.sight.entity.SubTheme;
import io.swagger.v3.oas.annotations.media.Schema;

public record SearchSightResponse(
Expand All @@ -10,8 +11,8 @@ public record SearchSightResponse(
@Schema(description = "관광지 이름", example = "경복궁")
String title,

@Schema(description = "관광지 중분류", example = "체험관광지")
String detailTheme,
@Schema(description = "관광지 하위 분류 (코드)", example = "체험관광지")
SubTheme subTheme,

@Schema(description = "주소 요약 (구/동 단위)", example = "서울 종로구")
String address,
Expand All @@ -29,7 +30,7 @@ public static SearchSightResponse toDto(SearchSightItemDto dto){
return new SearchSightResponse(
dto.contentId(),
dto.title(),
dto.cat2(),
SubTheme.valueOf(dto.cat2()),
dto.addr3(),
dto.mapX(),
dto.mapY(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.earseo.sight.dto.response;

import com.earseo.sight.dto.projection.SightDetailItemDto;
import com.earseo.sight.entity.SubTheme;
import com.earseo.sight.entity.Theme;
import io.swagger.v3.oas.annotations.media.Schema;

import java.util.List;
Expand All @@ -9,11 +11,11 @@ public record SightDetailInfoResponse(
@Schema(description = "관광지 고유 ID", example = "126508")
String id,

@Schema(description = "관광지 대분류", example = "인문(문화/예술/역사)")
String theme,
@Schema(description = "관광지 분류 (코드)", example = "CU")
Theme theme,

@Schema(description = "관광지 중분류", example = "체험관광지")
String detailTheme,
@Schema(description = "관광지 하위 분류 (코드)", example = "CU01")
SubTheme subTheme,

@Schema(description = "관광지 개요/설명", example = "조선시대 왕궁으로 500년 역사를 간직하고 있습니다")
String outl,
Expand Down Expand Up @@ -66,8 +68,8 @@ public record SightDetailInfoResponse(
public static SightDetailInfoResponse toDto(SightDetailItemDto dto, List<CurationResponse> curationList) {
return new SightDetailInfoResponse(
dto.contentId(),
dto.cat1(),
dto.cat2(),
Theme.valueOf(dto.cat1()),
SubTheme.valueOf(dto.cat2()),
dto.outl(),
dto.title(),
dto.addr1(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.earseo.sight.dto.response;

import com.earseo.sight.entity.Theme;
import io.swagger.v3.oas.annotations.media.Schema;

public record SightInfoResponse(
Expand All @@ -15,6 +16,9 @@ public record SightInfoResponse(
@Schema(description = "위도 (Latitude, Y좌표)", example = "37.5796")
Double latitude,

@Schema(description = "관광지 테마(코드)", example = "CU")
Theme theme,

@Schema(description = "이야기 스팟 조회용 GeoHash", example = "wydm6dqkm")
String geoHash
) {
Expand Down
Empty file.
6 changes: 4 additions & 2 deletions src/main/java/com/earseo/sight/entity/Sight.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ public class Sight {
@Column(name = "content_type_id")
private String contentTypeId;

@Enumerated(EnumType.STRING)
@Column(name = "cat1")
private String cat1;
private Theme cat1;

@Enumerated(EnumType.STRING)
@Column(name = "cat2")
private String cat2;
private SubTheme cat2;

@Column(name = "cat3")
private String cat3;
Expand Down
42 changes: 42 additions & 0 deletions src/main/java/com/earseo/sight/entity/SubTheme.java
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

관광지 테마와 서브 테마의 이름을 서버측에서 가지고 있을 예정이면, 분류코드를 자연어로 변환하는 API나 전체 코드 & 자연어 쌍을 조회하는 API가 필요할것으로 보입니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

프론트에서 enum으로 관리하는 편이 더 좋아보입니다. 이름은 혹시 추후에 어떻게 될지 몰라서 일단 가지고 있으려고 했습니다. 담당자와 상의하고 필요하다면 추가하겠습니다.

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.earseo.sight.entity;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum SubTheme {
//자연
NA01("자연관광지", "Natural Sites", Theme.NA),
NA02("관광자원", "Natural Resources", Theme.NA),

//문화
CU01("휴양관광지", "Recreational Sites", Theme.CU),
CU02("체험관광지", "Experience Programs", Theme.CU),
CU03("산업관광지", "Industrial Sites", Theme.CU),
CU04("문화시설", "Cultural Facilities", Theme.CU),

//예술
AR01("축제", "Festivals", Theme.AR),
AR02("공연/행사", "Events/Performances", Theme.AR),

//역사
HI01("역사관광지", "Historical Sites", Theme.HI),
HI02("건축/조형물", "Architectural Sights", Theme.HI),

//레포츠
LS01("레포츠소개", "Introduction", Theme.LS),
LS02("육상 레포츠", "Leisure/Sports (Land)", Theme.LS),
LS03("수상 레포츠", "Leisure/Sports (Water)", Theme.LS),
LS04("항공 레포츠", "Leisure/Sports (Sky)", Theme.LS),
LS05("복합 레포츠", "Leisure/Sports (Others)", Theme.LS),

//쇼핑
SH01("쇼핑", "Shopping", Theme.SH),
;

private final String koName;
private final String enName;
private final Theme theme;

}
19 changes: 19 additions & 0 deletions src/main/java/com/earseo/sight/entity/Theme.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.earseo.sight.entity;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum Theme {
NA("자연", "Nature"),
CU("문화", "Culture"),
AR("예술", "Art"),
HI("역사", "History"),
LS("레포츠", "Leisure/Sports"),
SH("쇼핑", "Shopping"),
;

private final String koName;
private final String enName;
}
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
public interface SightRepository extends JpaRepository<Sight, Long> {

@Query(value = """
SELECT s.content_id, s.title, s.map_x, s.map_y
SELECT s.content_id, s.title, s.map_x, s.map_y, s.cat1
FROM sight s
WHERE ST_Intersects(
s.geom,
Expand All @@ -26,7 +26,7 @@ List<SightMapItemDto> findByRectangle(
);

@Query(value = """
SELECT s.content_id, s.title, s.map_x, s.map_y
SELECT s.content_id, s.title, s.map_x, s.map_y, s.cat1
FROM sight s
WHERE ST_DWithin(
s.geom::geography,
Expand Down
Empty file.
6 changes: 4 additions & 2 deletions src/main/java/com/earseo/sight/service/InitService.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import com.earseo.sight.dto.etl.SightItemDto;
import com.earseo.sight.entity.Docent;
import com.earseo.sight.entity.Sight;
import com.earseo.sight.entity.SubTheme;
import com.earseo.sight.entity.Theme;
import com.earseo.sight.repository.DocentRepository;
import com.earseo.sight.repository.SightRepository;
import com.fasterxml.jackson.core.type.TypeReference;
Expand Down Expand Up @@ -91,8 +93,8 @@ private Sight convertSight(SightItemDto dto) {
return Sight.builder().
contentId(dto.contentId())
.contentTypeId(dto.contentTypeId())
.cat1(dto.cat1())
.cat2(dto.cat2())
.cat1(Theme.valueOf(dto.cat1()))
.cat2(SubTheme.valueOf(dto.cat2()))
.cat3(dto.cat3())
.ocat1(dto.ocat1())
.ocat2(dto.ocat2())
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/earseo/sight/service/SightService.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.earseo.sight.dto.response.*;
import com.earseo.sight.entity.Curation;
import com.earseo.sight.entity.Docent;
import com.earseo.sight.entity.Theme;
import com.earseo.sight.repository.CurationRepository;
import com.earseo.sight.repository.DocentRepository;
import com.earseo.sight.repository.SightRepository;
Expand Down Expand Up @@ -39,6 +40,7 @@ public SightMapInfoList getMapRectangle(Double minLongitude, Double minLatitude,
item.title(),
item.mapX(),
item.mapY(),
Theme.valueOf(item.cat1()),
getGeoHash(item.mapX(), item.mapY()))
).toList();

Expand All @@ -55,6 +57,7 @@ public SightMapInfoList getMapCircle(Double meters, Double longitude, Double lat
item.title(),
item.mapX(),
item.mapY(),
Theme.valueOf(item.cat1()),
getGeoHash(item.mapX(), item.mapY()))
).toList();

Expand Down
Loading