Ejemplo n.º 1
0
  @Override
  public void init(Task task, Model model) {
    Order order = orderService.find(task.getOrderId());
    model.addAttribute(
        "containerListForm",
        new VesselContainerListForm(scService.initVesselContainers(task.getOrderId())));
    model.addAttribute("action", "/task/" + task.getId());

    buildPurchase(task, model, order);
  }
Ejemplo n.º 2
0
  @RequestMapping(method = RequestMethod.POST, params = "definitionKey=" + DefinitionKey.recordTory)
  public String save(
      @PathVariable String taskId,
      RailContainerListForm railContainerListForm,
      Model model,
      RedirectAttributes redirectAttributes) {
    logger.debug("taskId: {}", taskId);
    logger.debug("railContainerListForm: {}", railContainerListForm);

    Long orderId = taskService.getOrderIdByTaskId(taskId);

    Iterable<RailContainer> iterable = scService.initializeRailContainers(orderId);
    for (RailContainer oldOne : iterable) {
      for (RailContainer newOne : railContainerListForm.getList()) {
        if (oldOne.getId() == newOne.getId()) {
          oldOne.setStationToa(newOne.getStationToa());
        }
        continue;
      }
    }
    railContainerService.save(iterable);
    redirectAttributes.addFlashAttribute("alert", new Alert("save.success"));
    return computeRedirect(taskId);
  }