基于ssm的网上订餐管理系统、订餐管理系统、在线订餐管理系统、外卖订餐管理系统,附源码+数据库

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";
    }

}

  • 2
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

java源码集合

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值