三方线上美食城|基于Springboot的三方线上美食商城系统

news/2025/3/30 3:30:30/

收藏点赞不迷路  关注作者有好处

文末获取源码 

项目编号:BS-SC-023

前言:

随着21世纪的进步,社会的生活节奏越来越快,网络的迅速崛起,互联网已日益成为提供信息的最佳渠道和连步进去传统的流通领域,传统的餐饮业也面连着巨大的挑战,网上订餐主要是针对白领还有大学生这些特定群体,一些白领在中午时间或者晚上高峰时间就餐,许多顺客由于高峰时间拥挤根本没时间来享受美味,这样既可以提前订餐不浪费中午午休的时间,也可以和同事加深感情,更可以每天换各种各样的菜式,保证每天工作的效率和身体的健康,这些问题就产生了快捷订餐的要求,最快的方式莫过于利用计算机网络,将餐饮业和计算机网络结合起来,就形成了网上订餐系统,能足不出户,轻松闲逸地实现自己订购餐饮和食品(包括饭、菜、众饭便当等)。网上订餐不仅减少了传统店面所需面临的租金问题,还能提供24小时不打烊服务,让顾客随时随地点餐的同时,也为商家减少了许多负担。

一,项目简介

本项目主要基于Springboot框架开发和实现了一个三方的美食商城系统,主要包含买方,卖方,管理员三种用户角色,不同的角色在系统中操作的功能模块是不一样的。

买方用户需要注册登陆后方可进行相应的操作,主要包含餐品分类浏览,详情查看,加入购物车,联系商家,查看自己的订单等功能,也可对餐品进行相应评论操作。

卖房用户注册登陆后可以进行相应的售卖商品操作,主要包含添加商品,查看购买我商品的订单信息,对发布的商品进行维护管理等功能。

管理员用户登陆系统后台,主要进行用户管理,商品类型管理,商品管理,订单管理,评论管理,系统管理,角色管理,权限管理,日志管理等相关功能模块。

系统整体功能完整,实现了一个基于买房,商家和平台用户的几种不同角色的应用,很适合做毕设。

二,环境介绍

语言环境:Java:  jdk1.8

数据库:Mysql: mysql5.7

应用服务器:Tomcat:  tomcat8.5.31

开发工具:IDEA或eclipse

后台开发技术:Springboot+Mybatis

前台开发技术:Bootstrap+Ajax

三,系统展示

系统首页

注册登陆

浏览商品添加购物车

查看购物车

我的订单

个人中心

商品评论

卖家登陆

发布售卖 商品

查看己售订单

商品信息维护

后台管理系统-用户登陆

后台管理首页

菜单管理

角色管理

管理员管理

分类管理

商品管理

用户管理

新闻公告管理

订单管理

四,核心代码展示

package com.dong.controller.admin;import com.dong.config.TitleConfig;
import com.dong.exception.CodeMsg;
import com.dong.exception.Result;
import com.dong.pojo.Category;
import com.dong.service.CategoryService;
import com.dong.utils.CategoryUtil;
import com.dong.utils.ValidataUtil;
import com.dong.vo.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;/*** 分类管理控制器*/
@Controller
@RequestMapping("admin/category")
public class CategoryController {@Autowiredprivate TitleConfig titleConfig;@Autowiredprivate CategoryService categoryService;@GetMapping("list")public String list(@RequestParam(value ="name",defaultValue = "") String name, PageResult pageResult, Model model){model.addAttribute("title",titleConfig.getCategoryTitle() );model.addAttribute("name",name );model.addAttribute("pageResult", categoryService.selectPage(name, pageResult));model.addAttribute("parentList", CategoryUtil.getParentCategory(categoryService.selectAll()));return "/admin/category/list";}@GetMapping("add")public String add(Model model){model.addAttribute("parentList",  CategoryUtil.getParentCategory(categoryService.selectAll()));return "/admin/category/add";}@PostMapping("add")@ResponseBodypublic Result<Boolean> add(Category category){CodeMsg validata = ValidataUtil.validata(category);if(validata.getCode()!=CodeMsg.SUCCESS.getCode()){return Result.exception(validata);}try {categoryService.saveCategory(category);}catch (Exception e){return Result.exception(CodeMsg.ADMIN_CATEGORY_ADD_ERROR);}return Result.success(true);}@GetMapping("edit")public String edit(Model model,@RequestParam(value = "id",required = true) Integer id){model.addAttribute("category", categoryService.selectCategoryById(id));model.addAttribute("parentList", CategoryUtil.getParentCategory(categoryService.selectAll()));return "/admin/category/edit";}@PutMapping("edit")@ResponseBodypublic Result<Boolean> edit(Category category){CodeMsg validata = ValidataUtil.validata(category);if(validata.getCode()!=CodeMsg.SUCCESS.getCode()){return Result.exception(validata);}try {categoryService.updateCategory(category);}catch (Exception e){Result.exception(CodeMsg.ADMIN_CATEGORY_EDIT_ERROR);}return Result.success(true);}@DeleteMapping("delete")@ResponseBodypublic Result<Boolean> delete(@RequestParam(value = "id",required = true) Integer id){try {categoryService.deleteCategory(id);}catch (Exception e){Result.exception(CodeMsg.ADMIN_CATEGORY_DELETE_ERROR);}return Result.success(true);}}

package com.dong.controller.admin;import com.dong.config.TitleConfig;
import com.dong.exception.Result;
import com.dong.service.CommentService;
import com.dong.vo.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;/*** 评论控制器*/
@Controller
@RequestMapping("admin/comment")
public class CommentController {@Autowiredprivate CommentService commentService;@Autowiredprivate TitleConfig titleConfig;@GetMapping("list")public String list(PageResult pageResult, @RequestParam(value = "name",required = false,defaultValue = " ") String name, Model model){model.addAttribute("title",titleConfig.getCommentTitle());model.addAttribute("name",name );model.addAttribute("pageResult",commentService.selectPage(pageResult,name));return "admin/comment/list";}@DeleteMapping("delete")@ResponseBodypublic Result<Boolean> delete(@RequestParam(value = "id",required = true)Integer id){commentService.deleteComment(id);return Result.success(true);}
}
package com.dong.controller.admin;import com.dong.config.TitleConfig;
import com.dong.exception.CodeMsg;
import com.dong.exception.Result;
import com.dong.service.GoodService;
import com.dong.vo.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;/*** 商品管理控制器*/
@RequestMapping("admin/good")
@Controller
public class GoodController {@Autowiredprivate GoodService goodService;@Autowiredprivate TitleConfig titleConfig;@GetMapping("list")public String list(Model model, @RequestParam(value = "name",required = false,defaultValue = "") String name, PageResult pageResult){model.addAttribute("title", titleConfig.getGoodTitle());model.addAttribute("name",name );model.addAttribute("pageResult",goodService.selectPages(pageResult,name ));return "/admin/good/list";}@DeleteMapping("delete")@ResponseBodypublic Result<Boolean> delete(@RequestParam(value = "id") Integer id){try {goodService.deleteGood(id);} catch (Exception e) {return Result.exception(CodeMsg.ADMIN_GOODS_DELETE_ERROR);}return Result.success(true);}
}
package com.dong.controller.admin;import com.dong.constant.SessionConstant;
import com.dong.exception.CodeMsg;
import com.dong.exception.Result;
import com.dong.listener.SessionListener;
import com.dong.pojo.User;
import com.dong.service.LogService;
import com.dong.service.UserService;
import com.dong.utils.StringUtil;
import com.dong.utils.ValidataUtil;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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.Date;/*** 系统控制器*/
@Controller
@RequestMapping("system")
public class SystemController {@Autowiredprivate UserService userService;@Autowiredprivate LogService logService;Logger logger= LoggerFactory.getLogger(UserController.class);/*** 管理员登录* @param user* @param cpacha* @param session* @return*/@PostMapping(value = "/login_form")@ResponseBodypublic Result<Boolean> Login(User user, String cpacha,HttpSession session){CodeMsg validata = ValidataUtil.validata(user);if(validata.getCode()!=CodeMsg.SUCCESS.getCode()){return Result.exception(validata);}if(StringUtils.isEmpty(cpacha)){return Result.exception(CodeMsg.CPACHA_EMPTY);}Object adminCpacha =session.getAttribute("admin_login");if(adminCpacha==null){return Result.exception(CodeMsg.SESSION_EXPIRED);}if(!cpacha.equalsIgnoreCase(adminCpacha.toString())){return Result.exception(CodeMsg.CPACHA_ERROR);}User users = userService.selectUserByName(user.getUsername());if(users==null){return Result.exception(CodeMsg.ADMIN_USERNAME_EXIST);}if(!users.getPassword().equals(user.getPassword())){return Result.exception(CodeMsg.ADMIN_PASSWORD_ERROR);}if(users.getStatus()==User.ADMIN_USER_STATUS_UNABLE){return Result.exception(CodeMsg.ADMIN_USER_UNABLE);}//检查一切符合,可以登录,将用户信息存放至sessionsession.setAttribute(SessionConstant.USER_SESSION, users);//销毁验证码session.removeAttribute("admin_login");logger.info("用户成功登录,user="+users);logService.addLog(user.getUsername(),"【"+user.getUsername()+"】"+"用户在"+ StringUtil.dataFormat(new Date(), "yyyy-MM-dd HH:mm:ss")+"登录系统!");return Result.success(true);}/*** 后台主页* @param model* @return*/@GetMapping(value = "index")public String index(Model model){model.addAttribute("userTotal", userService.selectUserTotal());model.addAttribute("operatorLogTotal", logService.selectLogTotal());model.addAttribute("operatorLogs", logService.selectRecentLog());model.addAttribute("onlineUserTotal", SessionListener.onlineUserCount);return "admin/system/index";}/*** 修改信息* @param user* @param session* @return*/@PutMapping(value = "update_userinfo")@ResponseBodypublic Result<Boolean> update_userinfo(User user,HttpSession session){User users =(User) session.getAttribute(SessionConstant.USER_SESSION);if(userService.selectUserByName(user.getUsername()) != null){return  Result.exception(CodeMsg.ADMIN_USERNAME_EXIST);}users.setImage(user.getImage());users.setEmail(user.getEmail());users.setMobile(user.getMobile());userService.updateUser(user);logService.addLog(user.getUsername(),"【"+user.getUsername()+"】"+"用户在"+ StringUtil.dataFormat(new Date(), "yyyy-MM-dd HH:mm:ss")+"修改了自己的信息!");return Result.success(true);}/*** 修改密码* @param oldpwd* @param newpwd* @param id* @param session* @return*/@PutMapping(value = "update_pwd")@ResponseBodypublic Result<Boolean> update_pwd(@RequestParam(value = "oldPwd",required = true) String oldpwd,@RequestParam(value = "newPwd",required = true) String newpwd,@RequestParam(value = "id",required = true) Integer id,HttpSession session){User user =(User) session.getAttribute(SessionConstant.USER_SESSION);if(!user.getPassword().equals(oldpwd)){return Result.exception(CodeMsg.ADMIN_USER_UPDATE_PWD_ERROR);}if(StringUtils.isEmpty(newpwd)){return Result.exception(CodeMsg.ADMIN_USER_UPDATE_PWD_EMPTY);}if(newpwd.length()<6){return Result.exception(CodeMsg.ADMIN_PASSWORD_MINLENGTH);}if(newpwd.length()>18){return Result.exception(CodeMsg.ADMIN_PASSWORD_MAXLENGTH);}User user1 = new User();user1.setId(id);user1.setPassword(newpwd);userService.updateUser(user1);user.setPassword(newpwd);logService.addLog(user.getUsername(),"【"+user.getUsername()+"】"+"用户在"+ StringUtil.dataFormat(new Date(), "yyyy-MM-dd HH:mm:ss")+"更新了自己的密码!");return Result.success(true);}/*** 退出登录* @param session* @return*/@GetMapping(value = "logout")public String logout(HttpSession session){session.removeAttribute(SessionConstant.USER_SESSION);return "redirect:login";}
}

五,项目总结

在国外,许多知名餐饮企业多年前就开始提供网上订餐服务了,众所周知,肯德基、麦当劳等快餐巨头是最早开始的。现在网上订餐对餐饮企业的门槛不断降低,越来越多的餐饮企业开始提供网上订餐服务。人们只需一部电脑和一张银行卡,就可全天订座。以往一家有名的餐厅,你需要提前很多时间或安排人手前往餐厅预定,这种做法大大影响了办事效率,与现代人的生活节奏不符。如今人们只需提前登录该餐厅网站预定,而不是把大量时间浪费在无谓的路程上。网上订餐的流程一般是餐饮企业先开通网上订餐服务,再由专业的物流配送公司运送。消费者只需在网上选择餐饮企业提供的菜品,就有配送公司送货上门。网上订餐的方式已经被国外的许多家庭所认可。

在国内,2012年之前我国使用的订餐方式大都还停留在电话订餐的层次上。毋容置疑,电话订餐方便,随时打一个电话就可以预定餐品。这种订餐方式逐渐受到消费者的认可,使用量逐年增长,很多问题开始凸显出来。例如订餐效率低,信息的处理程序繁杂,耗费大量人力资源。由于这些缺点,单独的电话订餐很难满足现代人的需求。总体而言,该行业发展不够迅速,国内也缺乏龙头企业。经过这几年的初步发展和互联网技术的不断进步,网络订餐市场被迅速催化。这种双赢的模式逐渐被消费者与企业认可。网上订餐成为现在炙手可热的新兴行业,美团、饿了么等国内知名app已经成为人们生活中不可或缺的一部分。


http://www.ppmy.cn/news/1583544.html

相关文章

我又又又又又又又又更新了~~~纯手工编写C++画图,有注释~~~~~~

本次更新内容&#xff1a; 更改托盘图标&#xff0c;在桌面新建快捷方式 提前申明&#xff1a;如果运行不了&#xff0c;请到主页查看RedpandaDevc下载&#xff0c;若还是不行就卸了重装。 版本号&#xff1a;1.13.8 480行 //版本号 :v1.13.8 //最终归属权为作者(饼干帅成渣…

DeepSeek 助力 Vue3 开发:打造丝滑的表格(Table)之添加行拖拽排序功能示例3,TableView16_03 拖拽视觉反馈示例

前言:哈喽,大家好,今天给大家分享一篇文章!并提供具体代码帮助大家深入理解,彻底掌握!创作不易,如果能帮助到大家或者给大家一些灵感和启发,欢迎收藏+关注哦 💕 目录 DeepSeek 助力 Vue3 开发:打造丝滑的表格(Table)之添加行拖拽排序功能示例3,TableView16_03 拖…

每天认识一个设计模式-建造者模式:复杂对象的“装配式革命“

一、前言 在软件开发的广袤领域中&#xff0c;随着项目规模日益庞大、业务逻辑愈发复杂&#xff0c;对象的创建过程也变得千头万绪。 早期简单的对象创建方式&#xff0c;在面对复杂对象时&#xff0c;逐渐显露出代码臃肿、耦合度高、可维护性差等弊端&#xff0c;设计模式的…

人工智能与无人机:无人机的进步与应用技术详解

人工智能&#xff08;Artificial Intelligence&#xff0c;简称AI&#xff09;是一门研究、开发用于模拟、延伸和扩展人类智能的理论、方法、技术及应用系统的新技术科学。 无人机&#xff0c;全称为无人驾驶飞行器&#xff08;UAV&#xff09;&#xff0c;也称为无人机器人、…

前端安全加密方式

前端安全加密是保障数据传输和存储安全的重要环节&#xff0c;以下是常见的加密方式及安全实践&#xff1a; 一、加密方式分类 1. 对称加密&#xff08;Symmetric Encryption&#xff09; 原理&#xff1a; 使用同一个密钥加密和解密。常用算法&#xff1a; AES&#xff08;…

汽车高级驾驶辅助系统应用存储MRAM

高级驾驶辅助系统和先进的互连航空电子技术等应用要求元件能够承受恶劣的环境条件&#xff0c;并具有较高的耐用性。闪存虽然在某些条件下性能可靠&#xff0c;但在耐用性方面存在局限性&#xff0c;因此无法满足这些严格的要求。 在实时传感器数据处理或高可靠性通信等对时间…

【八股】未知宽高元素水平垂直居中的三种方法

在笔试/面试中&#xff0c;经常出现的一个问题就是&#xff1a;如何实现元素水平垂直居中&#xff1f; 本文会直接使用代码&#xff0c;介绍未知宽高元素水平垂直居中的三种方法&#xff1a; 方法一&#xff1a;绝对定位absolute //绝对定位&#xff0c;将元素的左右位置设置…

Spring MVC 配置详解与入门案例

目录 引言 一、Spring MVC 的发展背景 1. Model I 与 Model II 2. MVC 模式 二、Spring MVC 入门案例 1. 创建 WEB 工程并引入依赖 2. 配置 web.xml 3. 配置 springmvc.xml 4. 创建控制器和视图 5. 部署并测试 三、Spring MVC 原理 1. 核心组件 2. 请求处理流程 …