Skip to content

Commit de5dafa

Browse files
authored
Merge pull request #246 from DevKor-github/feat/course
Fix: 오류 수정
2 parents 2c59770 + 77b3f2c commit de5dafa

3 files changed

Lines changed: 16 additions & 10 deletions

File tree

src/main/java/devkor/com/teamcback/domain/place/entity/CafeteriaMenu.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public class CafeteriaMenu extends BaseEntity {
2525
private String kind;
2626

2727
@Getter
28+
@Setter
2829
@Column(nullable = false, length = 500) // 식단 내용
2930
private String menu;
3031

src/main/java/devkor/com/teamcback/domain/place/service/CafeteriaMenuService.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,17 @@ else if(placeId == 2490) {
190190
// 메뉴가 존재하는 경우
191191
if(!content.equals(NO_MENU_INFO)) {
192192

193-
// 메뉴가 변경된 경우
194-
if (savedMenu == null || !savedMenu.getMenu().equals(content)) {
193+
// 메뉴가 추가된 경우
194+
if (savedMenu == null) {
195195
// 학식 메뉴 저장
196196
cafeteriaMenuRepository.save(new CafeteriaMenu(date, kind, content, placeId));
197197
}
198198

199+
// 메뉴가 변경된 경우
200+
else if(!savedMenu.getMenu().equals(content)) {
201+
savedMenu.setMenu(content);
202+
}
203+
199204
// 당일에 해당하는 경우 식당 설명 수정
200205
if(date.equals(LocalDate.now())) {
201206
if(!updated) {

src/main/java/devkor/com/teamcback/domain/search/dto/response/SearchPlaceRes.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,23 +58,23 @@ public class SearchPlaceRes {
5858

5959
public SearchPlaceRes(Place place, String imageUrl) {
6060
this.id = place.getId();
61-
this.buildingId = place.getBuilding().getId();
62-
this.buildingName = place.getBuilding().getName();
61+
this.buildingId = place.getBuilding() != null ? place.getBuilding().getId() : null;
62+
this.buildingName = place.getBuilding() != null ? place.getBuilding().getName() : "";
6363
this.name = place.getName();
6464
this.imageUrl = imageUrl != null ? imageUrl : place.getImageUrl();
6565
this.detail = place.getDetail();
6666
this.weekdayOperatingTime = place.getWeekdayOperatingTime();
6767
this.saturdayOperatingTime = place.getSaturdayOperatingTime();
6868
this.sundayOperatingTime = place.getSundayOperatingTime();
6969
this.isOperating = place.isOperating();
70-
this.needStudentCard = place.getBuilding().isNeedStudentCard();
70+
this.needStudentCard = place.getBuilding() != null ? place.getBuilding().isNeedStudentCard() : false;
7171
this.floor = place.getFloor();
72-
this.address = place.getBuilding().getAddress();
72+
this.address = place.getBuilding() != null ? place.getBuilding().getAddress() : "";
7373
this.plugAvailability = place.isPlugAvailability();
74-
this.longitude = place.getNode().getLongitude();
75-
this.latitude = place.getNode().getLatitude();
76-
this.xCoord = place.getNode().getXCoord();
77-
this.yCoord = place.getNode().getYCoord();
74+
this.longitude = place.getNode() != null ? place.getNode().getLongitude() : null;
75+
this.latitude = place.getNode() != null ? place.getNode().getLatitude() : null;
76+
this.xCoord = place.getNode() != null ? place.getNode().getXCoord() : null;
77+
this.yCoord = place.getNode() != null ? place.getNode().getYCoord() : null;
7878
this.locationType = LocationType.PLACE;
7979
this.placeType = place.getType();
8080
this.description = place.getDescription();

0 commit comments

Comments
 (0)