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 @@ -56,6 +56,7 @@ public enum ErrorStatus implements BaseErrorCode {
UNBOOKMARK_FAILED(HttpStatus.BAD_REQUEST, "PLACE_010", "해당 공간 북마크 해제에 실패하였습니다."),
USERPLACE_NOT_FOUND(HttpStatus.BAD_REQUEST, "PLACE_011", "해당 유저의 저장 공간이 존재하지 않습니다."),
PLACE_NOT_FOUND(HttpStatus.BAD_REQUEST, "PLACE_012", "해당 공간이 존재하지 않습니다."),
PLACE_CLOSED(HttpStatus.BAD_REQUEST, "PLACE_013", "해당 공간은 오늘 휴무일입니다."),

;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package B1G4.bookmark.converter;

import B1G4.bookmark.apiPayload.code.status.ErrorStatus;
import B1G4.bookmark.apiPayload.exception.handler.PlaceHandler;
import B1G4.bookmark.domain.Congestion;
import B1G4.bookmark.domain.Place;
import B1G4.bookmark.web.dto.CongestionDTO.CongestionResponseDTO;
Expand Down Expand Up @@ -102,6 +104,12 @@ private static Congestion.CongestionBuilder setCongestionLevel(Congestion.Conges
public static List<CongestionResponseDTO.HourValueDTO> filterAndRoundCongestion(Congestion congestion, LocalTime openTime, LocalTime closeTime) {
List<CongestionResponseDTO.HourValueDTO> congestionData = new ArrayList<>();

try{
int hour = openTime.getHour();
}catch (Exception e){
throw new PlaceHandler(ErrorStatus.PLACE_CLOSED);
}

for (int hour = openTime.getHour(); hour <= closeTime.getHour(); hour++) {
float congestionLevel = getCongestionLevel(congestion, hour);
int roundedValue = Math.round(congestionLevel);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package B1G4.bookmark.service.CongestionService;

import B1G4.bookmark.apiPayload.code.status.ErrorStatus;
import B1G4.bookmark.apiPayload.exception.handler.PlaceHandler;
import B1G4.bookmark.converter.CongestionConverter;
import B1G4.bookmark.domain.Congestion;
import B1G4.bookmark.domain.OperatingTime;
Expand Down Expand Up @@ -38,8 +40,14 @@ public CongestionResponseDTO getCongestionGraph(Long placeId) {

OperatingTime operatingTime = operatingTimeRepository.findByPlaceAndDayOfWeek(place, currentDay);

LocalTime openTime = operatingTime.getOpenTime();
LocalTime closeTime = operatingTime.getCloseTime();
LocalTime openTime;
LocalTime closeTime;
try {
openTime = operatingTime.getOpenTime();
closeTime = operatingTime.getCloseTime();
}catch (Exception e){
throw new PlaceHandler(ErrorStatus.PLACE_CLOSED);
}

Congestion congestion = place.getCongestion();
if (congestion == null) {
Expand Down
Loading