@RequestMapping(value = "/pos_popup.action", method = RequestMethod.GET) @ResponseBody public String PosOrderHome( HttpSession session, HttpServletRequest req, Model model, @RequestParam("totalno") int totaltableno) { List<Orders> orders = saleService.getOnProcessingOrderByTotalTableNo(totaltableno); for (Orders order : orders) { for (OrderDetail detail : order.getOrderDetails()) { try { detail.setFoodName(URLEncoder.encode(detail.getFoodName(), "utf-8")); } catch (Exception ex) { } } } Gson gson = new GsonBuilder().setPrettyPrinting().create(); String json = gson.toJson(orders); return json; }
@RequestMapping(value = "/updateOrder.action", method = RequestMethod.POST) @ResponseBody public String updateOrder(@RequestParam("order") String order) { Gson gson = new Gson(); Orders orders = gson.fromJson(order, Orders.class); saleService.updateOrder(orders); return String.valueOf(orders.getOrderNo()); }