同步代码

This commit is contained in:
lulz1 2024-02-29 10:22:07 +08:00
parent 824bcc98cf
commit 5e119950e1
3 changed files with 8 additions and 3 deletions

View File

@ -94,4 +94,5 @@ public class OrderOutController {
public Result<List<RouteOrderPageRes>> queryNotSubmit(@RequestBody OrderQueryData queryData) { public Result<List<RouteOrderPageRes>> queryNotSubmit(@RequestBody OrderQueryData queryData) {
return Result.Success(SUCCESS, orderQuery.queryNotSubmit(queryData)); return Result.Success(SUCCESS, orderQuery.queryNotSubmit(queryData));
} }
} }

View File

@ -142,7 +142,8 @@ public class OrderQuery {
private static RouteOrderPageRes getRouteOrderPageRes(RouteOrder routeOrder) { private static RouteOrderPageRes getRouteOrderPageRes(RouteOrder routeOrder) {
User currentUser = BaseContext.getCurrentUser(); User currentUser = BaseContext.getCurrentUser();
RouteOrderPageRes res = BeanUtil.copyProperties(routeOrder.reloadStatus(), RouteOrderPageRes.class); RouteOrderPageRes res = BeanUtil.copyProperties(routeOrder.reloadStatus(), RouteOrderPageRes.class);
List<LocationRes> locationRes = routeOrder.getLegItems() List<Leg> legItems = routeOrder.getLegItems();
List<LocationRes> locationRes = legItems
.stream() .stream()
.flatMap(leg -> Stream.of(leg.getOriginLocation(), leg.getDestinationLocation())) .flatMap(leg -> Stream.of(leg.getOriginLocation(), leg.getDestinationLocation()))
.map(LocationRes::copyFrom) .map(LocationRes::copyFrom)
@ -324,8 +325,9 @@ public class OrderQuery {
} }
public List<RouteOrderPageRes> queryNotSubmit(OrderQueryData queryData) { public List<RouteOrderPageRes> queryNotSubmit(OrderQueryData queryData) {
List<RouteOrder> byActualOrderNoNotNull = routeRepository.findByActualOrderNoNotNull(queryData); List<RouteOrder> routeOrders = routeRepository.findByActualOrderNoNotNull(queryData);
return byActualOrderNoNotNull.stream().filter(order -> order.reloadStatus().getOrderStatus().equals(ORDER_STATUS_APPROVAL)) routeOrders.forEach(route -> orderDomainService.queryLocation(route.getLegItems()));
return routeOrders.stream().filter(order -> order.reloadStatus().getOrderStatus().equals(ORDER_STATUS_APPROVAL))
.map(OrderQuery::getRouteOrderPageRes) .map(OrderQuery::getRouteOrderPageRes)
.toList(); .toList();
} }

View File

@ -6,6 +6,7 @@ import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.Collection;
import java.util.List; import java.util.List;
@Repository @Repository
@ -23,4 +24,5 @@ public interface JdbcLocationRepository extends CrudRepository<Location, Long> {
List<Location> findByLocationNameContaining(String locationName); List<Location> findByLocationNameContaining(String locationName);
Location findByLocationName(String locationName); Location findByLocationName(String locationName);
} }