作者主页:夜未央5788
简介:Java领域优质创作者、Java项目、学习资料、技术互助
文末获取源码
Springboot餐厅点餐系统分为前后台,前台顾客可以进行点餐,后台可以由经理、收银员、厨师、服务员等角色登录;
前台主要功能如下:
桌位选择、菜品选择、提交菜单等功能;
后台主要功能如下:
主页控制台
员工列表:员工查询、新增、编辑、删除;
会员管理:会员列表、会员类型列表;
菜谱管理:菜品列表、种类列表;
订单管理:订单列表;
销售管理:销售统计、销量统计、交易记录;
制菜上菜管理:制菜任务列表、上菜任务列表、桌位上菜情况列表;
桌位管理:桌位列表;
使用人群:
正在做毕设的学生,或者需要项目实战练习的Java学习者
由于本程序规模不大,可供课程设计,毕业设计学习演示之用
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
4.数据库:MySql 5.7/8.0版本均可;
5.是否Maven项目:是;
后端:SpringBoot+Mybaits
前端:HTML+css+js+layui+Echarts
项目运行:
1. 使用Navicat或者其它工具,在mysql中创建对应sql文件名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
4. 控制台提示运行成功后再运行前端项目;
5. 运行项目,在浏览器中输入地址
后台登录地址:http://localhost:8181/restaurant/sysuser/login.html
前台点餐登录地址:http://localhost:8181/restaurant/guest/desklist.html
经理测试号 账号 18384623911 密码123456
收银员测试号 账号 18384623912 密码 123456
厨师测试号 账号 18384623913 密码 123456
服务员 账号 18384623914 密码 123456
为防止项目运行后图片找不到,请将“images”文件夹中的“restaurant”文件夹放到D盘根目录。如果想放到其他盘,请修改application.yml配置文件中对应路径
ClientDeskController
package com.lzy.liujing.restaurant.controller.clientController;
import com.lzy.liujing.restaurant.entity.*;
import com.lzy.liujing.restaurant.service.DeskService;
import com.lzy.liujing.restaurant.service.GoodsCategoryService;
import com.lzy.liujing.restaurant.service.GoodsService;
import com.lzy.liujing.restaurant.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpSession;
@Controller
@RequestMapping("/guest")
public class ClientDeskController{
@Autowired
private DeskService deskService;
@Autowired
private GoodsService goodsService;
@Autowired
private GoodsCategoryService goodsCategoryService;
/**
* 客户端桌位接口
*/
@PostMapping("/login.do")
@ResponseBody
private Result deskLogin(Desk desk,HttpSession session){
deskService.login(desk);
session.setAttribute("deskCode",desk.getDeskCode());
return ResultUtil.success();
}
@GetMapping("/logout.do/{deskCode}")
private String deskLoginOut(@PathVariable("deskCode") String deskCode,HttpSession session){
Desk desk = new Desk();
desk.setDeskCode(deskCode);
deskService.logout(desk);
session.removeAttribute("deskCode");
return "redirect:/guest/desklist.html";
}
@GetMapping("/desklist.html")
private String deskList(Model model, @RequestParam(value = "pageNum",defaultValue = "1") Integer pageNum){
CustomPageInfo customPageInfo = new CustomPageInfo<>();
customPageInfo.setPageSize(15);
customPageInfo.setPageNum(pageNum);
model.addAttribute("page",deskService.findPage(customPageInfo));
return "/client/deskPage";
}
@GetMapping("/main.html")
private String clientMain(Model model){
model.addAttribute("categoryList",goodsCategoryService.findAll());
return "/client/main";
}
@GetMapping("/goodspage.thml")
private String goodsPage(){
return "/client/goodsPage";
}
/**
* 商品列表html页面
* @param model
* @return
*/
@GetMapping("/goodslist.html/{categoryId}")
public String goodsList(Model model,@PathVariable("categoryId") Integer categoryId){
//0代表查询所有菜,即无条件查询
if (categoryId==0){
categoryId=null;
}
model.addAttribute("categoryId",categoryId);
return "/client/goodsPage";
}
/**
* 商品列表数据
* @param pageInfo
* @param goods
* @param goodsCategory
* @return
*/
@PostMapping("/goodslist.do")
@ResponseBody
public Result goodsList(CustomPageInfo pageInfo, Goods goods, GoodsCategory goodsCategory){
goods.setGoodsCategory(goodsCategory);
goods.setPutawayStatus(1);
pageInfo.setT(goods);
CustomPageInfo resultPage = goodsService.findPage(pageInfo);
return ResultUtil.success(resultPage.getList(),resultPage.getTotal());
}
}
ClientOrderController
package com.lzy.liujing.restaurant.controller.clientController;
import com.lzy.liujing.restaurant.entity.CustomPageInfo;
import com.lzy.liujing.restaurant.entity.Order;
import com.lzy.liujing.restaurant.entity.OrderDetail;
import com.lzy.liujing.restaurant.entity.Result;
import com.lzy.liujing.restaurant.service.OrderDetailService;
import com.lzy.liujing.restaurant.service.OrderService;
import com.lzy.liujing.restaurant.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Controller
@RequestMapping("/guest/client")
public class ClientOrderController{
@Autowired
private OrderService orderService;
@Autowired
private OrderDetailService orderDetailService;
/**
* 添加订单
* @return
*/
@PostMapping("/addorder.do")
@ResponseBody
private Result addOrder(@RequestBody Order order){
String orderCode = orderService.addOrder(order);
return ResultUtil.success(orderCode);
}
@GetMapping("/myOrder.do")
@ResponseBody
private Result myOrder(CustomPageInfo info,Order order){
OrderDetail orderDetail = new OrderDetail();
orderDetail.setOrder(order);
info.setT(orderDetail);
CustomPageInfo resultInfo = orderDetailService.findPage(info);
System.out.println(resultInfo.getList());
return ResultUtil.success(resultInfo.getList(),resultInfo.getTotal());
}
@GetMapping("/myOrder.html")
public String viewOrderDetail(@RequestParam("orderCode") String orderCode, Model model){
model.addAttribute("orderCode",orderCode);
return "/client/myOrder";
}
@PostMapping("/delGood.do")
@ResponseBody
public Result deleteByOrderDetailIds(@RequestParam("ids") String ids){
orderDetailService.deleteByIds(ids);
return ResultUtil.success();
}
}
CookAndServingController
package com.lzy.liujing.restaurant.controller.sysController;
import com.lzy.liujing.restaurant.entity.*;
import com.lzy.liujing.restaurant.service.CookAndServingService;
import com.lzy.liujing.restaurant.service.OrderDetailService;
import com.lzy.liujing.restaurant.service.OrderService;
import com.lzy.liujing.restaurant.utils.ResultUtil;
import org.apache.catalina.User;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.List;
/**
* 制菜上菜管理网络接口
*/
@Controller
@RequestMapping("/service")
public class CookAndServingController{
@Autowired
private CookAndServingService cookAndServingService;
@Autowired
private OrderService orderService;
@Autowired
private OrderDetailService orderDetailService;
/**
* 制菜任务列表HTML界面
* @return
*/
@GetMapping("/cookTask.html")
@RequiresPermissions("cooking:view")
public String cookTaskList(HttpSession session,Model model){
SysUser user = (SysUser) session.getAttribute("user");
model.addAttribute("role",user.getRole());
return "cook/cookTaskList";
}
/**
* 制菜任务列表数据接口
* @param pageInfo
* @return
*/
@GetMapping("/cookTask.do")
@RequiresPermissions("cooking:view")
@ResponseBody
public Result cookTaskList(CustomPageInfo pageInfo){
List resultList = cookAndServingService.cookTaskFindPage(pageInfo);
return ResultUtil.success(resultList,new Long((resultList.size())));
}
/**
* 开始制菜修改状态接口
* 获取前台传的数组,保存到List集合,必须添加value = "odIdList[]
* @param odIdList
* @return
*/
@PostMapping("/startCook.do")
@RequiresPermissions("cooking:edit")
@ResponseBody
public Result startCook(@RequestParam(value = "odIdList[]") List odIdList){
OrderDetail orderDetail = new OrderDetail();
orderDetail.setStatus(1);
orderDetail.setOdIdList(odIdList);
cookAndServingService.updateStatusByOdIds(orderDetail);
return ResultUtil.success();
}
/**
* 完成制菜修改状态接口
* 获取前台传的数组,保存到List集合,必须添加value = "odIdList[]
* @param odIdList
* @return
*/
@PostMapping("/finishCook.do")
@RequiresPermissions("cooking:edit")
@ResponseBody
public Result finishCook(@RequestParam(value = "odIdList[]") List odIdList){
OrderDetail orderDetail = new OrderDetail();
orderDetail.setStatus(2);
orderDetail.setOdIdList(odIdList);
cookAndServingService.updateStatusByOdIds(orderDetail);
return ResultUtil.success();
}
/**
* 上菜任务列表HTML界面
* @return
*/
@GetMapping("/servingTask.html")
@RequiresPermissions("serving:view")
public String servingTaskList(HttpSession session,Model model){
SysUser user = (SysUser) session.getAttribute("user");
model.addAttribute("role",user.getRole());
return "cook/servingTaskList";
}
/**
* 上菜任务列表数据接口
* @param pageInfo
* @return
*/
@GetMapping("/servingTask.do")
@RequiresPermissions("serving:view")
@ResponseBody
public Result servingTask(CustomPageInfo pageInfo){
CustomPageInfo resultInfo = cookAndServingService.servingTaskFindPage(pageInfo);
return ResultUtil.success(resultInfo.getList(),resultInfo.getTotal());
}
/**
* 完成上菜接口
* @param orderDetail
* @param order
* @return
*/
@GetMapping("/finishServing.do")
@RequiresPermissions("serving:edit")
@ResponseBody
public Result finishServing(OrderDetail orderDetail,Order order){
orderDetail.setOrder(order);
cookAndServingService.finishServing(orderDetail);
return ResultUtil.success();
}
/**
* 桌位上菜情况列表HTML界面
* @return
*/
@GetMapping("/dssList.html")
@RequiresPermissions("deskServing:view")
public String deskServingStatusList(){
return "/cook/deskServingStatus";
}
/**
* 桌位上菜情况列表数据接口
* @param pageInfo
* @param order
* @return
*/
@PostMapping("/dssList.do")
@RequiresPermissions("deskServing:view")
@ResponseBody
public Result deskServingStatusList(CustomPageInfo pageInfo,Order order){
order.setOverStatus(0);
pageInfo.setT(order);
CustomPageInfo resultInfo = orderService.findPage(pageInfo);
return ResultUtil.success(resultInfo.getList(),resultInfo.getTotal());
}
/**
* 桌位上菜详细情况HTML页面
* @param orderId
* @param model
* @return
*/
@GetMapping("/ssd.html/{orderId}")
@RequiresPermissions("deskServing:view")
public String servingStatusDetail(@PathVariable(value = "orderId") Long orderId, Model model){
model.addAttribute("orderId",orderId);
return "cook/servingStatusDetail";
}
/**
* 桌位上菜详细情况数据接口
* @param pageInfo
* @param orderId
* @return
*/
@GetMapping("/ssd.do/{orderId}")
@RequiresPermissions("deskServing:view")
@ResponseBody
public Result servingStatusDetail(CustomPageInfo pageInfo,@PathVariable(value = "orderId") Long orderId){
OrderDetail detail = new OrderDetail();
Order order = new Order();
order.setOrderId(orderId);
detail.setOrder(order);
pageInfo.setT(detail);
CustomPageInfo resultInfo = orderDetailService.findPage(pageInfo);
return ResultUtil.success(resultInfo.getList(),resultInfo.getTotal());
}
}
如果也想学习本系统,下面领取。关注并回复:169springboot