赞
踩
1、项目介绍
基于ssm的网上订餐管理系统、订餐管理系统、在线订餐管理系统、外卖订餐管理系统。
1.1、前台功能:用户注册、用户登录、我的购物车、我的订单商品列表、商品搜索、商品评论
1.2、后台功能:
用户管理:用户列表、用户删除、设为会员
商品管理:商品列表、添加商品、修改商品、删除商品、下架商品、商品分类管理
订单管理:订单列表、查看订单详细、订单发货
评论管理:评论列表、评论删除
管理员管理:角色管理、权限管理、管理员列表
2、技术框架
编程语言:Java
系统架构:B/S
前端框架:BootStrap、H-ui 、JSP
后端框架:SSM(pring、SpringMVC、MyBatis)
数据库:MySQL
Mavenx项目 :否
运行环境:JDK8+Idea+Tomcat 8.5+MySQL5.6
3、演示视频
B站演示视频地址:
基于ssm的网上订餐管理系统、订餐管理系统、在线订餐管理系统、外卖订餐管理系统,附源码+数据库,适合课程设计、毕业设计、大实验、大作业、实训
基于ssm的网上订餐管理系统、订餐管理系统、在线订餐管理系统、外卖订餐管理系统,附源码+数据库,适合课程设计、毕业设计、大实验、大作业、实训_哔哩哔哩_bilibili
4、功能截图
4.1、前台首页
4.2、前台登录
4.3、前台注册
4.4、商品详情
4.5、商品评价
4.6、我的购物车
4.7、下单支付
4.8、我的订单
4.9、商品搜索
4.10、管理员登录
4.11、用户管理
4.12、商品管理
4.13、商品分类管理
4.14、订单管理
4.15、评论管理
4.16、角色管理
4.17、权限管理
4.18、管理员管理
4.19、商家管理员登录
5、代码示例
- package com.byh.biyesheji.controller;
-
- import com.byh.biyesheji.pojo.User;
- import com.byh.biyesheji.service.UserService;
- import org.apache.shiro.SecurityUtils;
- import org.apache.shiro.authc.AuthenticationException;
- import org.apache.shiro.authc.UsernamePasswordToken;
- import org.apache.shiro.session.Session;
- import org.apache.shiro.subject.Subject;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Controller;
- import org.springframework.ui.Model;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
-
- import java.text.ParseException;
- import java.text.ParsePosition;
- import java.text.SimpleDateFormat;
- import java.util.Date;
-
- /**
- * 后台登陆
- */
- @Controller
- @RequestMapping("")
- public class LoginController {
-
- @Autowired
- UserService userService;
-
- @RequestMapping(value="/login",method=RequestMethod.POST)
- public String login(Model model, String name, String password){//throws ParseException
- Subject subject = SecurityUtils.getSubject();
- UsernamePasswordToken token = new UsernamePasswordToken(name,password);
- try {
- subject.login(token);
- User us = userService.getByName(name);
- String lastLoginTime = "";
- if(us!=null){
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- //上次时间
- Date time = us.getLasttime();
- lastLoginTime = sdf.format(time);
- //新时间
- String format = sdf.format(new Date());
- //string转date 不处理时间格式会不理想
- ParsePosition pos = new ParsePosition(0);
- Date strtodate = sdf.parse(format, pos);
- us.setLasttime(strtodate);
- userService.update(us);
- }
- if (us.getStatus()==1){
- Session session=subject.getSession();
- session.setAttribute("subject", subject);
- session.setAttribute("lastLoginTime",lastLoginTime);
- return "redirect:index";
- }else {
- model.addAttribute("error", "账号已被停用!");
- return "/login";
- }
-
- } catch (AuthenticationException e) {
- model.addAttribute("error", "验证失败!");
- return "/login";
- }
- }
-
-
- }
- package com.byh.biyesheji.controller;
-
- import com.byh.biyesheji.pojo.Category;
- import com.byh.biyesheji.pojo.Product;
- import com.byh.biyesheji.pojo.ProductVO;
- import com.byh.biyesheji.pojo.User;
- import com.byh.biyesheji.service.CategoryService;
- import com.byh.biyesheji.service.ProductService;
- import com.byh.biyesheji.service.UserService;
- import com.byh.biyesheji.util.Page;
- import com.byh.biyesheji.util.UploadUtil;
- import com.github.pagehelper.PageHelper;
- import com.github.pagehelper.PageInfo;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Controller;
- import org.springframework.ui.Model;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestParam;
- import org.springframework.web.bind.annotation.ResponseBody;
-
- import javax.servlet.http.HttpSession;
- import java.io.File;
- import java.io.IOException;
- import java.util.List;
-
- /**
- * 商品模块controller
- */
- @Controller
- @RequestMapping("/product")
- public class ProductController {
-
- @Autowired
- private ProductService productService;
- @Autowired
- private UserService userService;
- @Autowired
- private CategoryService categoryService;
-
- @RequestMapping("/list")
- public String list(Model model, Page page){
- PageHelper.offsetPage(page.getStart(),page.getCount());//分页查询
- List<Product> list= productService.list();
- int total = (int) new PageInfo<>(list).getTotal();//总条数
- page.setTotal(total);
-
- model.addAttribute("list",list);
- model.addAttribute("total",total);
- model.addAttribute("page", page);
-
- return "productmodule/product-list";
- }
-
-
- @RequestMapping("/enableStatus")
- @ResponseBody
- public String enableStatus(@RequestParam(value = "name") String name){
- return productService.enableStatus(name);
- }
-
- @RequestMapping("/stopStatus")
- @ResponseBody
- public String stopStatus(@RequestParam(value = "name") String name){
- return productService.stopStatus(name);
- }
-
- @RequestMapping("/productAddUI")
- public String addUI(Model model){
-
- List<Category> categoryList = categoryService.list();
-
- List<User> userList = userService.list();
-
- model.addAttribute("categoryList",categoryList);
- model.addAttribute("userList",userList);
-
- return "productmodule/product-add";
- }
-
- @RequestMapping("/addProduct")
- public String add(Product product, HttpSession session, UploadUtil upload) throws IOException {
-
- productService.save(product);
- if (upload != null) {
- String imageName = product.getId()+".jpg";
-
- File file = new File(session.getServletContext().getRealPath("/images/product"),imageName);
-
- System.out.println(session.getServletContext().getRealPath("/images/product"));
-
- file.getParentFile().mkdirs();
- upload.getImage().transferTo(file);
-
- System.out.println("["+product.getId()+","+"images/product/"+imageName+"]");
-
- ProductVO vo = new ProductVO();
- vo.setId(product.getId());
- vo.setImageUrl("images/product/"+imageName);
-
- productService.setImageURL(vo);
-
- System.out.println(productService.get(product.getId()));
- }
- return "redirect:list";
- }
-
- @RequestMapping("/deleteProduct")
- public String del(@RequestParam(value = "id")int id,HttpSession session){
- productService.del(id);
- String imageName = id+".jpg";
- File file = new File(session.getServletContext().getRealPath("/images/product"),imageName);
- file.delete();
- return "redirect:list";
- }
-
- @RequestMapping("/editProduct")
- public String editUI(@RequestParam(value = "id")int id,Model model){
- //获得要修改商品的信息
- Product product = productService.get(id);
- model.addAttribute("product",product);
- System.out.println(product);
-
- List<Category> categoryList = categoryService.list();
- List<User> userList = userService.list();
- //通过商品id 返回所属分类
- Category categoryByid = productService.getCategoryByCid(id);
- model.addAttribute("crrentCategory",categoryByid);
- //通过id返回所属商家
- User userById = userService.getUserByPid(id);
- model.addAttribute("crrentUser",userById);
-
- model.addAttribute("categoryList",categoryList);
- model.addAttribute("userList",userList);
-
- return "productmodule/product-edit";
- }
-
- @RequestMapping("/updateProduct")
- public String update(Product product, HttpSession session, UploadUtil upload) throws IOException {
- productService.update(product);
- if(upload!=null){
-
- String imageName = product.getId()+".jpg";
-
- File file = new File(session.getServletContext().getRealPath("/images/product"),imageName);
-
- file.getParentFile().mkdirs();
- upload.getImage().transferTo(file);
-
- ProductVO vo = new ProductVO();
- vo.setId(product.getId());
- vo.setImageUrl("images/product/"+imageName);
-
- productService.setImageURL(vo);
-
- }
-
- return "redirect:list";
- }
-
- }
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。