Java 实战项目之在线点餐系统的实现流程

一、项目简述

功能包括: 在线点餐,评论,购物车,下单,支付,管理员,店家多 商家管理,后台评论管理,订单管理,商品管理等等。

二、项目运行

环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持) 项目技术: JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等。

Java 实战项目之在线点餐系统的实现流程_第1张图片

Java 实战项目之在线点餐系统的实现流程_第2张图片

Java 实战项目之在线点餐系统的实现流程_第3张图片

Java 实战项目之在线点餐系统的实现流程_第4张图片

Java 实战项目之在线点餐系统的实现流程_第5张图片

用户模块:

/**
 * 用户模块controller
 */
@Controller
@RequestMapping("/customer")
public class CustomerController {
    @Autowired
    private CustomerService customerService;
    @RequestMapping("/list")
    public String list(Model model, Page page)
    {
        PageHelper.offsetPage(page.getStart(),page.getCount());//分页查询
        List list= customerService.list();
        int total = (int) new PageInfo<>(list).getTotal();//总条数
        page.setTotal(total);
        model.addAttribute("list",list);
        model.addAttribute("totals",total);
        return "cstpage/cst-list";
    }
    /**
     * 设置会员
     * @param id
     * @return
     */
    @RequestMapping("/shezhihuiyuan")
    @ResponseBody
    public String shezhihuiyuan(int id){
        customerService.shezhihuiyuan(id);
        return "success";
    }
 
    @RequestMapping("/del")
    public String del(int id)
    {
        customerService.del(id);
        return "redirect:list";
    }
}

后台登陆模块:

/**
 * 后台登陆
 */
@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";
        }
    }
 
 
}

评论模块:

/**
 * 评论模块controller
 */
@Controller
@RequestMapping("/review")
public class ReviewController {
 
    @Autowired
    private ReviewService reviewService;
    @Autowired
    private ProductService productService;
 
    @RequestMapping("/list")
    public String list(Model model, Page page){
        PageHelper.offsetPage(page.getStart(),page.getCount());//分页查询
        List list= reviewService.list();
        int total = (int) new PageInfo<>(list).getTotal();//总条数
        page.setTotal(total);
 
        model.addAttribute("totals",list.size());
        model.addAttribute("list",list);
        return "pinglunpage/pinglun";
    }
 
    @RequestMapping("/del")
    public String del(int id){
        reviewService.del(id);
        return "redirect:list";
    }
 
}

权限模块 :

/**
 * 权限模块controller
 */
@Controller
@RequestMapping("/config")
public class PermissionController {
    @Autowired
    PermissionService permissionService;
 
    /**
     * 添加权限页面
     * @return
     */
 
    @RequestMapping("/adminPerAddUI")
    public String addUI(){
        return "syspage/admin-permission-add";
    }
 
    /**
     * 权限列表
     * @param model
     * @param page
     * @return
     */
    @RequestMapping("/listPermission")
    public String list(Model model, Page page){
        PageHelper.offsetPage(page.getStart(),page.getCount());//分页查询
        List ps= permissionService.list();
        int total = (int) new PageInfo<>(ps).getTotal();//总条数
        page.setTotal(total);
 
        model.addAttribute("ps", ps);
        model.addAttribute("perCount",ps.size());
        return "syspage/admin-permission";
    }
 
    @RequestMapping("/editPermission")
    public String list(Model model,long id){
        Permission permission =permissionService.get(id);
        model.addAttribute("permission", permission);
        return "syspage/admin-permission-edit";
    }
 
    @RequestMapping("/updatePermission")
    public String update(Permission permission){
        permissionService.update(permission);
        return "redirect:listPermission";
    }
 
    @RequestMapping("/addPermission")
    public String list(Model model,Permission permission){
        permissionService.add(permission);
        return "redirect:listPermission";
    }
 
    @RequestMapping("/deletePermission")
    public String delete(Model model,long id){
        permissionService.delete(id);
        return "redirect:listPermission";
    }   
 
}

以上就是Java 实战项目之在线点餐系统的实现流程的详细内容,更多关于Java 在线点餐系统的资料请关注脚本之家其它相关文章!

你可能感兴趣的:(Java 实战项目之在线点餐系统的实现流程)