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 @@ -97,7 +97,7 @@ public ChatResponse createPlaceInfoResponse(String message, List<Place> places,
.description(languageService.getPlaceDescription(place, language))
.address(languageService.getPlaceAddress(place, language))
.themes(place.getThemes())
.costInfo(place.getCostInfo())
.costInfo(languageService.getPlaceCostInfo(place, language))
.build())
.toList();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,18 +290,19 @@ private String createDocumentFromPlace(Place place) {

private String createDocumentFromPlace(Place place, String language) {
StringBuilder document = new StringBuilder();

// 언어별 필드 활용
String placeName = languageService.getPlaceName(place, language);
String placeDescription = languageService.getPlaceDescription(place, language);
String placeAddress = languageService.getPlaceAddress(place, language);

String placeCostInfo = languageService.getPlaceCostInfo(place, language);

document.append("장소명: ").append(placeName).append("\n");
document.append("설명: ").append(placeDescription).append("\n");
document.append("주소: ").append(placeAddress).append("\n");
document.append("지역: ").append(place.getRegion().getNameKo()).append("\n");
document.append("테마: ").append(String.join(", ", place.getThemes())).append("\n");
document.append("비용정보: ").append(place.getCostInfo()).append("\n");
document.append("비용정보: ").append(placeCostInfo).append("\n");

if (place.getContactInfo() != null) {
document.append("연락처: ").append(place.getContactInfo()).append("\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,21 @@ public String getPlaceAddress(com.mey.backend.domain.place.entity.Place place, S
};
}

/**
* Place 데이터에서 해당 언어의 비용 정보를 가져옵니다.
*/
public String getPlaceCostInfo(com.mey.backend.domain.place.entity.Place place, String language) {
return switch (language) {
case "ko" -> place.getCostInfoKo();
case "en" -> place.getCostInfoEn() != null ? place.getCostInfoEn() : place.getCostInfoKo();
case "ja" -> place.getCostInfoJp() != null ? place.getCostInfoJp() :
(place.getCostInfoEn() != null ? place.getCostInfoEn() : place.getCostInfoKo());
case "zh" -> place.getCostInfoCh() != null ? place.getCostInfoCh() :
(place.getCostInfoEn() != null ? place.getCostInfoEn() : place.getCostInfoKo());
default -> place.getCostInfoKo();
};
}

/**
* Route 데이터에서 해당 언어의 제목을 가져옵니다.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ private String createPlaceContext(com.mey.backend.domain.place.entity.Place plac
String placeName = languageService.getPlaceName(place, language);
String placeDescription = languageService.getPlaceDescription(place, language);
String placeAddress = languageService.getPlaceAddress(place, language);
String placeCostInfo = languageService.getPlaceCostInfo(place, language);

return switch (language) {
case "ko" -> String.format("""
Expand All @@ -308,7 +309,7 @@ private String createPlaceContext(com.mey.backend.domain.place.entity.Place plac
placeAddress,
place.getRegion().getNameKo(),
String.join(", ", place.getThemes()),
place.getCostInfo(),
placeCostInfo,
place.getContactInfo() != null ? place.getContactInfo() : "정보 없음"
);
case "en" -> String.format("""
Expand All @@ -325,7 +326,7 @@ private String createPlaceContext(com.mey.backend.domain.place.entity.Place plac
placeAddress,
place.getRegion().getNameKo(),
String.join(", ", place.getThemes()),
place.getCostInfo(),
placeCostInfo,
place.getContactInfo() != null ? place.getContactInfo() : "No information"
);
case "ja" -> String.format("""
Expand All @@ -342,7 +343,7 @@ private String createPlaceContext(com.mey.backend.domain.place.entity.Place plac
placeAddress,
place.getRegion().getNameKo(),
String.join(", ", place.getThemes()),
place.getCostInfo(),
placeCostInfo,
place.getContactInfo() != null ? place.getContactInfo() : "情報なし"
);
case "zh" -> String.format("""
Expand All @@ -359,7 +360,7 @@ private String createPlaceContext(com.mey.backend.domain.place.entity.Place plac
placeAddress,
place.getRegion().getNameKo(),
String.join(", ", place.getThemes()),
place.getCostInfo(),
placeCostInfo,
place.getContactInfo() != null ? place.getContactInfo() : "无信息"
);
default -> createPlaceContext(place, "ko"); // 기본값
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ public class PlaceResponseDto {
private Map<String, String> openingHours;
private List<String> themes;

private String costInfo;
private String costInfoKo;
private String costInfoEn;
private String costInfoJp;
private String costInfoCh;

public PlaceResponseDto(Place place) {
this.id = place.getPlaceId();
Expand All @@ -67,6 +70,9 @@ public PlaceResponseDto(Place place) {
this.tourApiPlaceId = place.getTourApiPlaceId();
this.openingHours = place.getOpeningHours();
this.themes = place.getThemes();
this.costInfo = place.getCostInfo();
this.costInfoKo = place.getCostInfoKo();
this.costInfoEn = place.getCostInfoEn();
this.costInfoJp = place.getCostInfoJp();
this.costInfoCh = place.getCostInfoCh();
}
}
8 changes: 7 additions & 1 deletion src/main/java/com/mey/backend/domain/place/entity/Place.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,11 @@ public class Place extends BaseTimeEntity {
@Column(nullable = false, columnDefinition = "json")
private List<String> themes;

private String costInfo;
private String costInfoKo;

private String costInfoEn;

private String costInfoJp;

private String costInfoCh;
}
Loading