|
5 | 5 | import com.example.Jinus.repository.cafeteria.CafeteriaDietRepository; |
6 | 6 | import com.example.Jinus.service.userInfo.UserService; |
7 | 7 | import com.example.Jinus.utility.JsonUtils; |
| 8 | +import com.example.Jinus.utility.SimpleTextResponse; |
8 | 9 | import org.slf4j.Logger; |
9 | 10 | import org.slf4j.LoggerFactory; |
10 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
@@ -48,11 +49,20 @@ public String processRequest(String userId, |
48 | 49 | // 데이터 전처리 |
49 | 50 | String date = getCurrentDate(rawDate); |
50 | 51 | int userCampusId = userService.getUserCampusId(userId); |
51 | | - userCampusId = (userCampusId == -1) ? 1 : userCampusId; |
52 | | - campusName = (campusName == null) ? campusService.getCampusName(userCampusId) : campusName; |
53 | | - String period = (rawPeriod.isEmpty()) ? getPeriodOfDay() : rawPeriod; |
| 52 | + int cafeteriaId; |
| 53 | + |
| 54 | + if (campusName == null) { |
| 55 | + campusName = userCampusId != -1 ? campusService.getCampusName(userCampusId) : "가좌캠퍼스"; |
| 56 | + } |
| 57 | + |
| 58 | + int campusId = campusService.getCampusIdByName(campusName); |
| 59 | + cafeteriaId = cafeteriaService.getCafeteriaIdByCampusId(cafeteriaName, campusId); |
54 | 60 |
|
55 | | - int cafeteriaId = cafeteriaService.getCafeteriaIdByCampusId(cafeteriaName, userCampusId); |
| 61 | + if (cafeteriaId == 0) { |
| 62 | + return SimpleTextResponse.simpleTextResponse("식당을 찾지 못했어!\n어떤 캠퍼스에 있는 식당인지 정확히 알려줘!"); |
| 63 | + } |
| 64 | + |
| 65 | + String period = (rawPeriod.isEmpty()) ? getPeriodOfDay() : rawPeriod; |
56 | 66 |
|
57 | 67 | HashMap<String, List<String>> categoryMenuMap = getCafeteriaDiet(LocalDate.parse(date), period, cafeteriaId); |
58 | 68 |
|
|
0 commit comments