| | |
| | | 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)); |