hjl
2024-07-18 b9da8289051937fbbbd47bbda97414ad6c769a90
ruoyi-service/ruoyi-worker/src/main/java/com/ruoyi/worker/service/impl/MasterWorkerServiceImpl.java
@@ -93,8 +93,18 @@
            OrderNotHandleVO vo = new OrderNotHandleVO(distance, orderListVO);
            list.add(vo);
        }
        List<OrderNotHandleVO> newList = new ArrayList<>();
        if (item) {
            return list.stream().map(OrderNotHandleVO::getOrderList).collect(Collectors.toList());
            // 已置顶订单
            List<OrderNotHandleVO> topSortNotNull = list.stream()
                    .filter(data -> data.getOrderList().getTopSort() != null).collect(Collectors.toList());
            newList.addAll(topSortNotNull);
            // 未置顶订单,根据距离由近到远排序
            List<OrderNotHandleVO> topSortNull = list.stream()
                    .filter(data -> data.getOrderList().getTopSort() == null).collect(Collectors.toList());
            topSortNull.sort(Comparator.comparing(OrderNotHandleVO::getDistance));
            newList.addAll(topSortNull);
            return newList.stream().map(OrderNotHandleVO::getOrderList).collect(Collectors.toList());
        } else {
            // 根据距离排序
            list.sort(Comparator.comparing(OrderNotHandleVO::getDistance));