Skip to content

Commit

Permalink
feat: RouteDetailResponse에 LocalDateTime추가
Browse files Browse the repository at this point in the history
<description>
<issue-number>
  • Loading branch information
Moon-1C committed Jun 4, 2024
1 parent d2ba565 commit 5214102
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public RouteDetailResponse execute(
// todo
if (traffics.isEmpty()) {
return RouteDetailResponse.builder()
.nowTime(LocalDateTime.now())
.totalTime(primaryData.getTotalTime())
.trafficCount(0)
.departureTimes(new ArrayList<>())
Expand Down Expand Up @@ -95,15 +96,18 @@ public RouteDetailResponse execute(

Map<Long, PredictedData> AllPredictedDataMap = allPredictResponse.getPredictedDataMap();

LocalDateTime now = LocalDateTime.now();
// 처음 내가 지나가는 신호등의 예측 출발시간 3개
List<LocalDateTime> departureTimes =
calDepartureTimes(firestPredictedDataMap, firstTraffic, primaryData.getUntilTrafficTime());
calDepartureTimes(
firestPredictedDataMap, firstTraffic, primaryData.getUntilTrafficTime(), now);

removeNullInPredictedDataMap(firestPredictedDataMap);

removeNullInPredictedDataMap(AllPredictedDataMap);

return RouteDetailResponse.builder()
.nowTime(now)
.totalTime(primaryData.getTotalTime())
.trafficCount(traffics.size())
.departureTimes(departureTimes)
Expand Down Expand Up @@ -157,7 +161,8 @@ public static List<PointDetail> convertLineStringToPointDetailList(LineString li
private List<LocalDateTime> calDepartureTimes(
Map<Long, PredictedData> predictedDataMap,
TrafficEntity firstTraffic,
Integer untilFirstTrafficTime) {
Integer untilFirstTrafficTime,
LocalDateTime now) {

PredictedData predictedData = predictedDataMap.get(firstTraffic.getId());
predictedData.isAllPredicted();
Expand All @@ -167,8 +172,6 @@ private List<LocalDateTime> calDepartureTimes(
Float redCycle = predictedData.getRedCycle();
Float greenCycle = predictedData.getGreenCycle();

LocalDateTime now = LocalDateTime.now();

LocalDateTime firstGreenTime =
getFirstGreenTime(currentColor, currentTimeLeft, redCycle, greenCycle, now);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
@Builder
public class RouteDetailResponse {

public LocalDateTime nowTime;
public Integer totalTime;
public Integer trafficCount;
public List<LocalDateTime> departureTimes;
Expand Down

0 comments on commit 5214102

Please sign in to comment.