// 팝업창에서 메뉴선택 ///////////////////////////////////// @RequestMapping(value = "/select", method = RequestMethod.GET) @ResponseBody public String SelectMenu( HttpSession session, HttpServletResponse resp, HttpServletRequest req, Model model, @RequestParam("foodname") String foodName) { System.out.println(" [ 선택한 메뉴가져왔어 ] "); System.out.println(foodName); List<Menu> menus = saleService.getSelectMenus(foodName); Gson gson = new GsonBuilder().setPrettyPrinting().create(); System.out.println(menus); model.addAttribute("menus", menus); System.out.println(menus); String result = gson.toJson(menus); System.out.println(result); resp.setContentType("application/json;charset=utf-8"); return result; }
@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 = "/orderform", method = RequestMethod.GET) public String SelectAllMenu(Model model) { List<Menu> menus = saleService.getAllMenus(); model.addAttribute("menus", menus); System.out.println(" [ 모든 메뉴가져왔어 ] "); return "sale/orderform"; }
// 주문하기버튼 눌렀을때 데이터 넘겨주는거 @RequestMapping(value = "/tableinsertmenu.action", method = RequestMethod.POST) public String Table_InsertMenu(Menu menu) { System.out.println("여기까지오니??"); saleService.tableInsertMenu(menu); System.out.println("insert menu 성공 "); return "redirect:/sale/salehome_test2_eunyoung.action"; }
@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()); }
// 윤수오빠화면으로 테스트해봄 --박은영 @RequestMapping(value = "/salehome_test.action", method = RequestMethod.GET) public String SaleHome( Model model, String storeCode1, HttpSession session, HttpServletRequest req) { System.out.println("salehome.test storecode " + storeCode1); List<StoreTable> st = tableService.selectCurrentTables(storeCode1); model.addAttribute("st", st); List<Menu> menus = saleService.getAllMenus(); model.addAttribute("menus", menus); // Integer recentableNo=tableService.selectRecentTableNo(storeCode1); // model.addAttribute("recentno", recentableNo); return "sale/salehome_test2_eunyoung"; }
@RequestMapping(value = "/orderhome_test", method = RequestMethod.GET) public String OrderHome( HttpSession session, HttpServletRequest req, Model model, @RequestParam("totalno") int totaltableno) { List<Menu> menus = saleService.getAllMenus(); model.addAttribute("menus", menus); // System.out.println(" [ 주문해야해 ] "); // // int foodCode = (req.getParameter("foodCode")) model.addAttribute("totaltableno", totaltableno); return "sale/orderhome_test"; }