Java项目:169Springboot餐厅点餐系统

 作者主页:夜未央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());
    }
}

DataAnalysisController

package com.lzy.liujing.restaurant.controller.sysController;

import com.lzy.liujing.restaurant.entity.Result;
import com.lzy.liujing.restaurant.entity.chart.*;
import com.lzy.liujing.restaurant.service.DataAnalysisService;
import com.lzy.liujing.restaurant.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 图表分析接口
 */
@Controller
@RequestMapping("/analysis")
public class DataAnalysisController{
    @Autowired
    private DataAnalysisService dataAnalysisService;
    /**
     * 销量统计HTML页面
     * @return
     */
    @GetMapping("/salesVolume.html")
    public String salesVolume(){
        return "chart/salesVolume";
    }

    /**
     * 销售统计HTML页面
     * @return
     */
    @GetMapping("/salesStatistics.html")
    public String salesStatistics(){
        return "/chart/salesStatistics";
    }

    /**
     * 查询近几天的菜品销量排行top10数据接口
     * @return
     */
    @GetMapping("/gssByDays.do")
    @ResponseBody
    public Result goodsSalesSortByDays(GoodsSalesChart goodsSalesChart){
        //默认查询top12
        goodsSalesChart.setNumber(12);
        List result = dataAnalysisService.findSalesSortByDays(goodsSalesChart);
        return ResultUtil.success(result,new Long(result.size()));
    }
    /**
     * 查询近几天的菜品销量排行词云数据接口
     * @return
     */
    @GetMapping("/gwcByDays.do")
    @ResponseBody
    public Result goodsWordCloudBynDays(GoodsSalesChart goodsSalesChart){
        //默认查询top12
        goodsSalesChart.setNumber(20);
        List result = dataAnalysisService.findSalesSortByDays(goodsSalesChart);
        return ResultUtil.success(result,new Long(result.size()));
    }
    /**
     * 查询近几天的菜系销量数据
     * @return
     */
    @GetMapping("/gcsByDays.do")
    @ResponseBody
    public Result goodsCategorySalesByDays(GoodsCategorySalesChart gcsChart){
        List result = dataAnalysisService.findGoodsCategorySalesByDays(gcsChart);
        return ResultUtil.success(result,new Long(result.size()));
    }

    /**
     * 查询近几天的营业情况数据
     * @return
     */
    @GetMapping("/ssByDays.do")
    @ResponseBody
    public Result salesStatisticsByDay(SalesStatisticsChart ssChart){
        List result = dataAnalysisService.findSalesStatisticsByDays(ssChart);
        return ResultUtil.success(result,new Long(result.size()));
    }

    /**
     * 查询近几天会员增长数接口
     * @param memberChart
     * @return
     */
    @GetMapping("/mAddByDays.do")
    @ResponseBody
    public Result memberAddByDays(MemberChart memberChart){
        List result  = dataAnalysisService.findMemberAddByDays(memberChart);
        return ResultUtil.success(result,new Long(result.size()));
    }

    /**
     * 查询各类型会员数量
     * @return
     */
    @GetMapping("/mcRate.do")
    @ResponseBody
    public Result memberCategoryRate(){
        List result  = dataAnalysisService.findMemberCategoryRate();
        return ResultUtil.success(result,new Long(result.size()));
    }
    /**
     * 查询每天(8-24)点中每小时的顾客数量接口
     * @return
     */
    @GetMapping("/peopleByHour.do")
    @ResponseBody
    public Result peopleByHours(){
        List result  = dataAnalysisService.findPeopleByHours();
        return ResultUtil.success(result,new Long(result.size()));
    }
}

DeskController

package com.lzy.liujing.restaurant.controller.sysController;

import com.lzy.liujing.restaurant.entity.CustomPageInfo;
import com.lzy.liujing.restaurant.entity.Desk;
import com.lzy.liujing.restaurant.entity.Result;
import com.lzy.liujing.restaurant.entity.SysUser;
import com.lzy.liujing.restaurant.service.DeskService;
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("/desk")
public class DeskController {
    @Autowired
    private DeskService deskService;

    @GetMapping("/list.html")
    private String deskList(HttpSession session,Model model){
        SysUser user = (SysUser) session.getAttribute("user");
        model.addAttribute("role",user.getRole());
        return "desk/list";
    }

    @PostMapping("/list.do")
    @ResponseBody
    private Result deskList(CustomPageInfo pageInfo,Desk desk){
        pageInfo.setT(desk);
        CustomPageInfo resultInfo = deskService.findPage(pageInfo);
        return ResultUtil.success(resultInfo.getList(),resultInfo.getTotal());
    }

    @GetMapping("/add.html")
    private String addDesk(){
        return "desk/add";
    }

    @PostMapping("/add.do")
    @ResponseBody
    private Result addDesk(Desk desk){
        deskService.insert(desk);
        return ResultUtil.success();
    }

    @GetMapping("/edit.html/{deskId}")
    private String editDesk(@PathVariable("deskId") Integer deskId, Model model){
        model.addAttribute("desk",deskService.findById(deskId));
        return "desk/edit";
    }

    @PostMapping("/edit.do")
    @ResponseBody
    private Result editDesk(Desk desk){
        deskService.update(desk);
        return ResultUtil.success();
    }

    @PostMapping("/del.do")
    @ResponseBody
    private Result delDesk(@RequestParam("ids") String strIds){
        deskService.deleteByIds(strIds);
        return ResultUtil.success();
    }
}

 如果也想学习本系统,下面领取。关注并回复:169springboot

你可能感兴趣的:(java,开发语言)