-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
514618c
commit fa05d33
Showing
2 changed files
with
25 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/kotlin/com/walking/api/traffic/usecase/InfoFavoriteTrafficUseCase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.walking.api.traffic.usecase | ||
|
||
import com.walking.api.repository.dao.traffic.TrafficRepository | ||
import com.walking.api.traffic.service.TrafficPredictService | ||
import com.walking.api.traffic.service.dto.TPQuery | ||
import com.walking.api.traffic.service.model.PredictTargetTraffic | ||
import org.springframework.stereotype.Service | ||
import java.util.stream.Collectors | ||
|
||
@Service | ||
class InfoFavoriteTrafficUseCase( | ||
private val trafficRepository: TrafficRepository, | ||
private val trafficPredictService: TrafficPredictService | ||
) { | ||
fun execute(): Map<Long, PredictTargetTraffic> { | ||
val allIds: List<Long> = trafficRepository.findAll().stream() | ||
.map { it.id } | ||
.collect(Collectors.toList()) | ||
val query = TPQuery(allIds) | ||
return trafficPredictService.execute(query).predictedData | ||
} | ||
} |