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 @@ -3,6 +3,7 @@
import com.earseo.sight.common.BaseResponse;
import com.earseo.sight.dto.request.CurationCreateRequest;
import com.earseo.sight.dto.request.CurationUpdateRequest;
import com.earseo.sight.dto.request.InitRequest;
import com.earseo.sight.dto.response.CurationDeleteResponse;
import com.earseo.sight.dto.response.CurationResponse;
import com.earseo.sight.service.CurationService;
Expand All @@ -28,9 +29,13 @@ public class SightAdminController {
private final CurationService curationService;

@PostMapping("/init")
public ResponseEntity<BaseResponse<String>> initSight() {
initService.initSight();
initService.initDocent();
public ResponseEntity<BaseResponse<String>> initSight(
@RequestBody
@Valid
InitRequest request
) {
initService.initSight(request.lang());
initService.initDocent(request.lang());
return ResponseEntity.ok(BaseResponse.ok(null));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public ResponseEntity<BaseResponse<SightMapInfoList>> getSightRectangle(
Double maxLatitude
) {

return ResponseEntity.ok(BaseResponse.ok(sightService.getMapRectangle(minLongitude, minLatitude, maxLongitude, maxLatitude)));
return ResponseEntity.ok(BaseResponse.ok(sightService.getMapRectangle(minLongitude, minLatitude, maxLongitude, maxLatitude, "ko")));
}


Expand Down Expand Up @@ -217,7 +217,7 @@ public ResponseEntity<BaseResponse<SightMapInfoList>> getSightCircle(
@DecimalMax(value = "39", message = "위도는 39 이하여야 합니다")
Double latitude
) {
return ResponseEntity.ok(BaseResponse.ok(sightService.getMapCircle(meters, longitude, latitude)));
return ResponseEntity.ok(BaseResponse.ok(sightService.getMapCircle(meters, longitude, latitude, "ko")));
}

@Operation(
Expand Down Expand Up @@ -321,7 +321,7 @@ public ResponseEntity<BaseResponse<SightDetailInfoResponse>> getSightDetail(
@RequestHeader(value = "X-USER-ID", required = false)
Long memberId
) {
return ResponseEntity.ok(BaseResponse.ok(sightService.getSightDetailInfo(id, longitude, latitude, memberId)));
return ResponseEntity.ok(BaseResponse.ok(sightService.getSightDetailInfo(id, longitude, latitude, memberId, "ko")));
}

@Operation(
Expand Down Expand Up @@ -591,7 +591,7 @@ public ResponseEntity<BaseResponse<SearchSightList>> searchTitle(
Integer limit
) {
return ResponseEntity.ok(BaseResponse.ok(
sightService.searchSight(keyword, longitude, latitude, minLongitude, minLatitude, maxLongitude, maxLatitude, limit)
sightService.searchSight(keyword, longitude, latitude, minLongitude, minLatitude, maxLongitude, maxLatitude, limit, "ko")
));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public ResponseEntity<BaseResponse<BookmarkStatusResponse>> addBookmark(
@NotBlank(message = "관광지 ID는 필수입니다")
String sightId
) {
return ResponseEntity.ok(BaseResponse.ok(bookmarkService.addBookmark(memberId, sightId)));
return ResponseEntity.ok(BaseResponse.ok(bookmarkService.addBookmark(memberId, sightId, "ko")));
}

@Operation(
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/earseo/sight/dto/etl/SightItemDto.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.earseo.sight.dto.etl;

public record SightItemDto(String contentId, String contentTypeId, String cat1,
String cat2, String cat3, String ocat1, String ocat2, String ocat3,
String outl, String title, String addr1, String addr2, String addr3,
String cat2, String cat1Code, String cat2Code, String title,
String addr1, String addr2, String addr3,
Double mapX, Double mapY, String modifiedtime, String tel, Integer mLevel, String overview,
String originImgUrl, String smallImgUrl, String usetime, String restdate, String parking, String usefee) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static SightMetaResponse toDto(SightMetaDto dto) {
dto.mapY(),
dto.mapX(),
dto.docentUrl(),
Theme.valueOf(dto.cat1())
Theme.valueOf(dto.theme())
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
public record CurationSightItemDto(
String contentId,
String title,
String cat2,
String subTheme,
String originImgUrl,
Double mapX,
Double mapY,
Double distance,
String addr3
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public record SearchSightItemDto(
String contentId,
String title,
String cat2,
String subTheme,
String addr3,
Double mapX,
Double mapY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

public record SightDetailItemDto(
String contentId,
String cat1,
String cat2,
String outl,
String theme,
String subTheme,
String overview,
String title,
String addr1,
String addr3,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.earseo.sight.dto.projection;

import com.earseo.sight.entity.Theme;

public record SightMapItemDto(
String contentId,
String title,
Double mapX,
Double mapY,
String cat1
String theme
) {
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.earseo.sight.dto.projection;

import com.earseo.sight.entity.Theme;

public record SightMetaDto(
String contentId,
String title,
Expand All @@ -8,6 +10,6 @@ public record SightMetaDto(
Double mapY,
Double mapX,
String docentUrl,
String cat1
String theme
) {
}
6 changes: 6 additions & 0 deletions src/main/java/com/earseo/sight/dto/request/InitRequest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.earseo.sight.dto.request;

public record InitRequest(
String lang
) {
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.earseo.sight.dto.response;

import ch.hsr.geohash.GeoHash;
import com.earseo.sight.dto.projection.CurationSightItemDto;
import com.earseo.sight.entity.SubTheme;
import io.swagger.v3.oas.annotations.media.Schema;
Expand All @@ -14,19 +15,35 @@ public record CurationSightResponse(
@Schema(description = "관광지 하위 테마 (코드)", example = "CU01")
SubTheme subTheme,

@Schema(description = "대표 이미지 URL", example = "https://example.com/image.jpg")
String imgUrl,

@Schema(description = "경/위도")
PathPoint point,

@Schema(description = "현재 위치로부터의 직선 거리 (미터)", example = "1234.56")
Double distance,

@Schema(description = "주소 요약 (구/동 단위)", example = "서울 종로구")
String address
String address,

@Schema(description = "이야기 스팟 조회용 GeoHash", example = "wydm6dqkm")
String geoHash
) {
public static CurationSightResponse toDto(CurationSightItemDto dto) {
return new CurationSightResponse(
dto.contentId(),
dto.title(),
SubTheme.valueOf(dto.cat2()),
SubTheme.valueOf(dto.subTheme()),
dto.originImgUrl(),
new PathPoint(dto.mapX(), dto.mapY()),
dto.distance(),
dto.addr3()
dto.addr3(),
getGeoHash(dto.mapX(), dto.mapY())
);
}

private static String getGeoHash(double longitude, double latitude) {
return GeoHash.withCharacterPrecision(latitude, longitude, 9).toBase32();
}
}
12 changes: 12 additions & 0 deletions src/main/java/com/earseo/sight/dto/response/PathPoint.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.earseo.sight.dto.response;

import io.swagger.v3.oas.annotations.media.Schema;

public record PathPoint(
@Schema(description = "경도", example = "127.9768")
Double longitude,

@Schema(description = "위도", example = "37.5759")
Double latitude
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static SearchSightResponse toDto(SearchSightItemDto dto){
return new SearchSightResponse(
dto.contentId(),
dto.title(),
SubTheme.valueOf(dto.cat2()),
SubTheme.valueOf(dto.subTheme()),
dto.addr3(),
dto.mapX(),
dto.mapY(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public record SightDetailInfoResponse(
SubTheme subTheme,

@Schema(description = "관광지 개요/설명", example = "조선시대 왕궁으로 500년 역사를 간직하고 있습니다")
String outl,
String overview,

@Schema(description = "관광지 이름", example = "경복궁")
String title,
Expand Down Expand Up @@ -68,9 +68,9 @@ public record SightDetailInfoResponse(
public static SightDetailInfoResponse toDto(SightDetailItemDto dto, List<CurationResponse> curationList) {
return new SightDetailInfoResponse(
dto.contentId(),
Theme.valueOf(dto.cat1()),
SubTheme.valueOf(dto.cat2()),
dto.outl(),
Theme.valueOf(dto.theme()),
SubTheme.valueOf(dto.subTheme()),
dto.overview(),
dto.title(),
dto.addr1(),
dto.addr3(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,22 @@
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class Sight {
@Table(name = "en_sight")
public class EnSight {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@Column(name = "content_id", nullable = false, unique = true)
private String contentId;

@Column(name = "content_type_id")
private String contentTypeId;

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

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

@Column(name = "cat3")
private String cat3;

@Column(name = "ocat1")
private String ocat1;

@Column(name = "ocat2")
private String ocat2;

@Column(name = "ocat3")
private String ocat3;

@Column(name = "outl", columnDefinition = "TEXT")
private String outl;
@Column(name = "sub_theme")
private SubTheme subTheme;

@Column(name = "title")
private String title;
Expand All @@ -64,24 +47,15 @@ public class Sight {
@Column(name = "map_y")
private Double mapY;

@Column(name = "modifiedtime")
private String modifiedtime;

@Column(name = "tel", columnDefinition = "TEXT")
private String tel;

@Column(name = "m_level")
private Integer mLevel;

@Column(name = "overview", columnDefinition = "TEXT")
private String overview;

@Column(name = "origin_img_url", columnDefinition = "TEXT")
private String originImgUrl;

@Column(name = "small_img_url", columnDefinition = "TEXT")
private String smallImgUrl;

@Column(name = "use_time", columnDefinition = "TEXT")
private String usetime;

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

import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.locationtech.jts.geom.Point;

@Entity
@Getter
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Table(name = "ko_sight")
public class KoSight {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@Column(name = "content_id", nullable = false, unique = true)
private String contentId;

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

@Enumerated(EnumType.STRING)
@Column(name = "sub_theme")
private SubTheme subTheme;

@Column(name = "title")
private String title;

@Column(name = "addr1")
private String addr1;

@Column(name = "addr2")
private String addr2;

@Column(name = "addr3")
private String addr3;

@Column(name = "map_x")
private Double mapX;

@Column(name = "map_y")
private Double mapY;

@Column(name = "tel", columnDefinition = "TEXT")
private String tel;

@Column(name = "overview", columnDefinition = "TEXT")
private String overview;

@Column(name = "origin_img_url", columnDefinition = "TEXT")
private String originImgUrl;

@Column(name = "use_time", columnDefinition = "TEXT")
private String usetime;

@Column(name = "rest_date", columnDefinition = "TEXT")
private String restdate;

@Column(name = "parking", columnDefinition = "TEXT")
private String parking;

@Column(name = "use_fee", columnDefinition = "TEXT")
private String usefee;

@Column(name = "geom", columnDefinition = "geometry(Point,4326)")
private Point geom;
}
Loading
Loading