fix:修复添加行程出现的缓存问题

This commit is contained in:
lulz1 2024-07-09 15:37:43 +08:00
parent 75152cea8a
commit 8c81472f71
1 changed files with 3 additions and 3 deletions

View File

@ -41,7 +41,7 @@ public class RouteCacheService {
.orElse(List.of())
.stream().filter(Objects::nonNull).toList();
if (!routeIdsByEmployeeNo.isEmpty()) {
return queryByIdIn(routeIdsByEmployeeNo);
return queryByIdIn(routeIdsByEmployeeNo).stream().filter(Objects::nonNull).toList();
}
log.info("开始缓存用户行程规划单");
List<RouteOrder> routeOrders = jdbcRouteRepository.findByUserIdOrApproveOrderNo_Creator(employeeNo, employeeNo);
@ -54,7 +54,7 @@ public class RouteCacheService {
invalidateUserRoutesCache(employeeNo);
//获取当前用户所有的订单 缓存用户的routeIds列表
routeCacheManage.getRouteIdsByEmployeeNo(employeeNo, routeOrders, null);
return routeOrders;
return routeOrders.stream().filter(Objects::nonNull).toList();
}
public RouteOrder reloadRouteOrderInCache(RouteOrder routeOrder) {
@ -190,7 +190,7 @@ public class RouteCacheService {
List<Long> routeIds = routeCacheManage.getRouteIdsByEmployeeNo(userId, null, null);
if (routeIds == null || routeIds.size() <= 2) {
List<RouteOrder> routeOrders = preloadUserRoutes(userId);
routeIds = routeOrders.stream().filter(Objects::nonNull).map(RouteOrder::getRouteId).toList();
routeIds = routeOrders.stream().map(RouteOrder::getRouteId).toList();
}
if (!routeIds.contains(routeId)) {
List<Long> newRouteIds = new ArrayList<>(routeIds);