|
|
@@ -30,6 +30,8 @@ import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.validation.Valid;
|
|
|
import java.io.IOException;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
@@ -153,6 +155,11 @@ public class VoyageController {
|
|
|
List<Long> routeIds = CollectionUtils.convertList(voyageRespVOS, VoyageRespVO::getRouteId);
|
|
|
List<ResourceRouteDO> routeList = routeService.getList(routeIds);
|
|
|
Map<Long, Integer> routeDoMap = CollectionUtils.convertMap(routeList, ResourceRouteDO::getId, ResourceRouteDO::getDirection);
|
|
|
+
|
|
|
+ // 把已经过期的航次放到后面
|
|
|
+ List<VoyageRespVO> expireVoyageList = new ArrayList<>();
|
|
|
+ List<VoyageRespVO> voyageList = new ArrayList<>();
|
|
|
+
|
|
|
voyageRespVOS.stream().forEach(voyageRespVO -> {
|
|
|
MapUtils.findAndThen(routeDoMap, voyageRespVO.getRouteId(), direction -> voyageRespVO.setDirection(direction));
|
|
|
if(routeDoMap.get(voyageRespVO.getRouteId()) == 2) {
|
|
|
@@ -160,8 +167,16 @@ public class VoyageController {
|
|
|
}else {
|
|
|
voyageRespVO.setFname(voyageRespVO.getName()+"-上水");
|
|
|
}
|
|
|
+ // 把已经过期的航次放到后面
|
|
|
+ if (voyageRespVO.getBoardingTime().isBefore(LocalDateTime.now())) {
|
|
|
+ expireVoyageList.add(voyageRespVO);
|
|
|
+ } else {
|
|
|
+ voyageList.add(voyageRespVO);
|
|
|
+ }
|
|
|
});
|
|
|
- return success(voyageRespVOS);
|
|
|
+ // 过期航次拼在后面
|
|
|
+ voyageList.addAll(expireVoyageList);
|
|
|
+ return success(voyageList);
|
|
|
}
|
|
|
|
|
|
@GetMapping("/listByShipId")
|