【发布时间】:2021-05-10 01:34:57
【问题描述】:
我的代码如下。我需要从 mongo db 获取每次旅行的票价,然后将每次旅行的所有票价相加得到总票价。我被一串我不知道如何阅读的 Mono 困住了。我尝试将其转换为 Flux,但我得到了 Flux
private int calculateDailyRate(final Entry<LocalDate, List<Trip>> entry) {
int dailyFare = 0;
List<Trip> trips = entry.getValue();
// Get the fare for each trip, and then sum up the list of fares to get the daily total fare
trips.stream().map(trip->fareLookupRepo.getFareRules(trip.getSecondOfDay(), trip.getTripDate().getDayOfWeek().getValue(),
trip.getFromZone(), trip.getToZone()).sort(Comparator.comparing(FareRule::getRate)).next().map(FareRule::getRate));
return dailyFare;
}
'''
【问题讨论】:
标签: spring-webflux