コード例 #1
0
  @RequestMapping(value = "/selectRoute.do", method = RequestMethod.GET)
  public ModelAndView selectRoute(
      @RequestParam(value = STATION_LEAVING_STATION) String leavingStation,
      @RequestParam(value = STATION_ARRIVAL_STATION) String arrivalStation,
      @RequestParam(value = ROUTE_YEAR) String routeYY,
      @RequestParam(value = ROUTE_MONTH) String routeMM,
      @RequestParam(value = ROUTE_DAY) String routeDD) {

    List<Route> listOfRoutes = iRouteService.getAllRoutes(leavingStation, arrivalStation);
    LocalDate routeDate =
        LocalDate.of(
            Integer.parseInt(routeYY), Integer.parseInt(routeMM), Integer.parseInt(routeDD));
    List<Train> listOfTrains = new ArrayList<Train>();
    for (int i = 0; i < listOfRoutes.size(); i++) {
      Train train = iTrainService.getTrainByDateAndRoute(routeDate, listOfRoutes.get(i));
      if (train != null) {
        listOfTrains.add(train);
      }
    }
    if (listOfTrains.size() != 0) {
      return new ModelAndView(PAGE_PRINT_ROUTES, "listOfTrains", listOfTrains);
    }
    return new ModelAndView(PAGE_MAIN);
  }
コード例 #2
0
 @RequestMapping(value = "/getAllRoutesForAction.do", method = RequestMethod.GET)
 public ModelAndView selectAllRoutesForActions() {
   return new ModelAndView(
       PAGE_GET_ALL_ROUTES_FOR_ACTIONS, ROUTE_LIST_OF_ROUTES, iRouteService.getAllRoutes());
 }