@RequestMapping(value = "/assignConsultant", method = RequestMethod.POST) public String assignConsultant( @RequestParam("orderId") int orderId, @RequestParam("consultantId") int consultantId, ModelMap modelMap) { orderService.assignConsultant(orderId, consultantId); return getOrderDetails(orderId, modelMap); }
@RequestMapping(method = RequestMethod.GET) public String getOrderDetails(@RequestParam("orderId") int id, ModelMap modelMap) { SessionUtils.populateModelWithAuthenticatedRole(modelMap); Order order = orderService.getOrderByUId(id); switch (order.getOrderStatus()) { case PENDING: { ConsultantOrder consultantBid = bidService.getConsultantBid(id, SessionUtils.GetCurrentUser().getUserId()); modelMap.addAttribute("consultantBid", consultantBid); break; } case ACCEPTED: { List<ConsultantOrder> bidsPerOrder = bidService.getOrderBids(id); modelMap.addAttribute("orderBids", bidsPerOrder); break; } case ASSIGNED: case DONE: case INPROGRESS: { if (order.getConsultant() != null) { ConsultantOrder assignedConsultant = bidService.getConsultantBid(id, order.getConsultant().getUserId()); modelMap.addAttribute("assignedConsultant", assignedConsultant); } Payment payment = paymentService.getPaymentDetails(order.getOrderId(), order.getClient().getUserId()); if (payment != null) { modelMap.addAttribute("paymentInfo", payment); } break; } } modelMap.addAttribute("order", order); modelMap.addAttribute("maxNrOfDays", maxNrOfDays); modelMap.addAttribute("titlePage", "Detalii Comanda"); return "orderDetailsPage"; }