コード例 #1
0
  @RequestMapping(value = "/me", method = RequestMethod.GET)
  public @ResponseBody RouteExecution getMy() {
    String token = request.getHeader("authToken");
    Truck truck = truckRepository.getTruckByToken(token);

    return repository.getCurrentRouteExecution(truck);
  }
コード例 #2
0
  @RequestMapping(value = "/updatePosition", method = RequestMethod.POST)
  public @ResponseBody RouteExecutionPoint updatePosition(
      @RequestBody RouteExecutionPoint routeExecutionPoint) {
    String token = request.getHeader("authToken");
    Truck truck = truckRepository.getTruckByToken(token);
    RouteExecutionPeriod routeExecutionPeriod = repository.getCurrentRouteExecutionPeriod(truck);

    repository.addPointToRouteExecutionPeriod(routeExecutionPeriod, routeExecutionPoint);

    return routeExecutionPoint;
  }
コード例 #3
0
  @RequestMapping(value = "/stop", method = RequestMethod.POST)
  public @ResponseBody RouteExecutionPeriod stop(@RequestBody Date executionDate) {
    String token = request.getHeader("authToken");
    Truck truck = truckRepository.getTruckByToken(token);
    RouteExecutionPeriod routeExecutionPeriod = repository.getCurrentRouteExecutionPeriod(truck);

    routeExecutionPeriod.setEndDate(executionDate);

    repository.update(routeExecutionPeriod);

    return routeExecutionPeriod;
  }
コード例 #4
0
  @RequestMapping(value = "/start", method = RequestMethod.POST)
  public @ResponseBody RouteExecutionPeriod start(@RequestBody Date executionDate) {
    String token = request.getHeader("authToken");
    Truck truck = truckRepository.getTruckByToken(token);
    RouteExecution routeExecution = repository.getCurrentRouteExecution(truck);

    RouteExecutionPeriod routeExecutionPeriod = new RouteExecutionPeriod();
    routeExecutionPeriod.setStartDate(executionDate);

    repository.addPeriodToRouteExecution(routeExecution, routeExecutionPeriod);

    return routeExecutionPeriod;
  }