赞
踩
基于javaweb+mysql的ssm校园外卖配送系统(java+ssm+jsp+js+jq+layui+mysql)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SSM校园外卖配送系统(java+ssm+jsp+js+jq+layui+mysql)
项目介绍
基于SSM的校园外卖配送系统
角色:管理员、用户、配送员
用户登录系统后,可以对个人中心,订单信息管理,订单取消管理,配送接单管理,取消配送管理,送达通知管理等功能
管理员登录系统后,可以对个人中心,用户管理,配送员管理,美食分类管理,特色美食管理,订单信息管理,订单取消管理,配送接单管理,取消配送管理,送达通知管理,系统管理等功能
配送员登录系统后,可以对个人中心,订单信息管理,配送接单管理,取消配送管理,送达通知管理等功能
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.是否Maven项目: 否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目 6.数据库:MySql 5.7/8.0等版本均可;
技术栈
后端:SSM(Spring+SpringMVC+Mybatis) 前端:JSP+CSS+JS+JQUERY+Layui
使用说明
if(user.getMember()==1 && odTotal>200) {//当会员为1时,说明不是会员,并且支付的金额大于200 user.setMember(2); System.out.println("进入方法后"+user.getMember()); user.setUMoney(user.getUMoney()+odTotal); System.out.println(user.getMember()); tbUserService.updateUserByUser(user); List<OrderDetail> details = orderDetailService.selectAllOrderByUId(orderDetail.getUId()); for (OrderDetail detail : details){ System.out.println("detail = " + detail.getOdCreateTime()); return "下单成功~";
TbUser tbUser = tbUserService.selectUserById(user.getUId()); //保存新数据,避免被原数据覆盖 System.out.println("tbUser = " + tbUser); user.setUUsername(tbUser.getUUsername()); user.setUPassword(tbUser.getPassword()); user.setUMoney(tbUser.getUMoney()); tbUserService.updateUserByUser(user); user = tbUserService.selectUserById(user.getUId()); UpdateSession.reloadUserAuthority(session,user); return "redirect:/myInfo"; @RequestMapping("/shenqinghuiyuan") public String shenqinghuiyuan(Integer uId, HttpSession session,Model model){ //更新操作 //保存新数据,避免被原数据覆盖
return "redirect:/myInfo"; @RequestMapping("/shenqinghuiyuan") public String shenqinghuiyuan(Integer uId, HttpSession session,Model model){ //更新操作 //保存新数据,避免被原数据覆盖 TbUser tbUser = tbUserService.selectUserById(uId); if(tbUser.getUMoney()>200){ tbUserService.updateMeber(uId); model.addAttribute("Member",2); model.addAttribute("error","申请成功,请重新登录后方可生效"); }else{ model.addAttribute("error","未满足条件");
//更新操作 TbUser user = tbUserService.selectUserById(uId); user.setUUrl(imgPath); tbUserService.updateUserByUser(user); user = tbUserService.selectUserById(uId); UpdateSession.reloadUserAuthority(session,user); return "redirect:/myInfo"; /*更新我的信息*/ @RequestMapping("/updateMyInfo") public String updateMyInfo(TbUser user, HttpSession session){ //更新操作 TbUser tbUser = tbUserService.selectUserById(user.getUId()); //保存新数据,避免被原数据覆盖 System.out.println("tbUser = " + tbUser);
model.addAttribute("orders",orders); model.addAttribute("allCount",allCount); model.addAttribute("pendingCount",pendingCount); model.addAttribute("receivedCount",receivedCount); model.addAttribute("finishCount",finishCount); return "menu/orderManage"; @RequestMapping("/myOrder") public String myOrder(Model model,int uId){ List<OrderDetail> myOrders = orderDetailService.selectAllOrderByUId(uId); TbUser user = tbUserService.selectUserById(uId);
model.addAttribute("msg","刚刚:注册成功,赶快登录进行登录吧~"); return "user/login"; /*插入用户数据,返回字符串信息*/ @ResponseBody @RequestMapping("/insertUserInfo") public String insertUserInfo(String uUsername, String uPassword, String uRole){ //查询是否存在用户名了 String msg = "未知错误!"; List<TbUser> users = tbUserService.selectUserByName(uUsername); if(users.size() == 0){ TbUser user = new TbUser();
TbUser adminUser = tbUserService.selectUserById(1); model.addAttribute("total",adminUser.getUMoney()); model.addAttribute("page",page); model.addAttribute("orders",orders); model.addAttribute("allCount",allCount); model.addAttribute("pendingCount",pendingCount); model.addAttribute("receivedCount",receivedCount); model.addAttribute("finishCount",finishCount); return "menu/orderManage"; @RequestMapping("/myOrder") public String myOrder(Model model,int uId){ List<OrderDetail> myOrders = orderDetailService.selectAllOrderByUId(uId); TbUser user = tbUserService.selectUserById(uId);
odDetail += "】"; //赋值 orderDetail.setOdDetail(odDetail); if(user.getMember()==2){ orderDetail.setOdTotal((int)(odTotal * 0.88)); }else{ orderDetail.setOdTotal(odTotal); orderDetail.setOdStatus(0); orderDetail.setOdNo(RandomNo.getRandomNo()); //完成插入 orderDetailService.insertOrder(orderDetail); //清空购物车 + 更新商品数据 for (ShoppingCart cart : carts){
@RequestMapping("/deleteUser/{uId}") public String deleteUser(@PathVariable("uId")int uId, Model model){ tbUserService.deleteUserById(uId); model.addAttribute("msg","删除成功!"); return "redirect:/userInfo"; @GetMapping("/myInfo") public String myInfo(Principal principal,Model model){ String str = principal.getName(); List<TbUser> list = tbUserService.selectAllUser(); for(TbUser tbUser:list) { if(tbUser.getUUsername().equals(str)){
List<TbUser> users = tbUserService.selectAllUser(); for (TbUser temp : users){ //验证成功,直接登录 if(uUsername.equals(temp.getUUsername())){ model.addAttribute("msg","刚刚:注册失败,该用户已存在!"); return "user/login"; TbUser user = new TbUser(); user.setUUsername(uUsername); user.setUPassword(uPassword); user.setURole(uRole); tbUserService.insertUser(user); model.addAttribute("msg","刚刚:注册成功,赶快登录进行登录吧~"); return "user/login";
/*去我的购物车页面*/ @RequestMapping("/shoppingCart") public String shoppingCart(Model model,int uId){ //查询购物车的商品 List<ShoppingCart> products = shoppingCartService.selectAllByUId(uId); int total = 0; for (ShoppingCart cart : products){ total += cart.getScPrice()*cart.getScAmount(); model.addAttribute("products",products); model.addAttribute("total",total); TbUser tbUser = tbUserService.selectUserById(uId); if(tbUser.getMember()==2){ int youhuitotal =(int) (total* 0.88);
List<OrderDetail> myOrders = orderDetailService.selectAllOrderByUId(uId); TbUser user = tbUserService.selectUserById(uId); model.addAttribute("myOrders",myOrders); model.addAttribute("total",user.getUMoney()); return "user/myOrder"; @ResponseBody @PostMapping("/toOrder") public String toOrder(OrderDetail orderDetail){ TbUser user = tbUserService.selectUserById(orderDetail.getUId()); //查询当前用户的所以购物车 List<ShoppingCart> carts = shoppingCartService.selectAllByUId(orderDetail.getUId()); //获取到具体商品
// model.addAttribute("msg","刚刚:该用户不存在,请重新输入!"); // return "user/login"; // } 订单详情管理控制层: @Controller public class OrderDetailController { @Resource OrderDetailServiceImpl orderDetailService; @Resource ShoppingCartServiceImpl shoppingCartService; @Resource
model.addAttribute("msg","刚刚:注册成功,赶快登录进行登录吧~"); return "user/login"; /*插入用户数据,返回字符串信息*/ @ResponseBody @RequestMapping("/insertUserInfo") public String insertUserInfo(String uUsername, String uPassword, String uRole){ //查询是否存在用户名了 String msg = "未知错误!"; List<TbUser> users = tbUserService.selectUserByName(uUsername); if(users.size() == 0){ TbUser user = new TbUser(); user.setUUsername(uUsername);
user.setUUsername(tbUser.getUUsername()); user.setUPassword(tbUser.getPassword()); user.setUMoney(tbUser.getUMoney()); tbUserService.updateUserByUser(user); user = tbUserService.selectUserById(user.getUId()); UpdateSession.reloadUserAuthority(session,user); return "redirect:/myInfo"; @RequestMapping("/shenqinghuiyuan") public String shenqinghuiyuan(Integer uId, HttpSession session,Model model){ //更新操作 //保存新数据,避免被原数据覆盖
/*如果 数量== 1,直接删除*/ ShoppingCart one = shoppingCartService.selectOneByMdIdAndUId(mdId, uId); if (one.getScAmount() == 1 ) { //删除数据 shoppingCartService.deleteById(one.getScId()); return "redirect:/shoppingCart?uId="+uId; }else{ //数量-1 one.setScAmount(one.getScAmount()-1); shoppingCartService.updateProduct(one); System.out.println("数量-1成功"); return "redirect:/shoppingCart?uId="+uId;
one.setScAmount(one.getScAmount()+1); shoppingCartService.updateProduct(one); System.out.println("数量+1成功"); return "redirect:/shoppingCart?uId="+uId; @RequestMapping("/shoppingCart-minus") public String shoppingCartMinus(int uId,int mdId){ /*如果 数量== 1,直接删除*/ ShoppingCart one = shoppingCartService.selectOneByMdIdAndUId(mdId, uId); if (one.getScAmount() == 1 ) { //删除数据 shoppingCartService.deleteById(one.getScId());
return "user/login"; @PostMapping("/register") public String register(String uUsername, String uPassword, String uRole,Model model){ List<TbUser> users = tbUserService.selectAllUser(); for (TbUser temp : users){ //验证成功,直接登录 if(uUsername.equals(temp.getUUsername())){ model.addAttribute("msg","刚刚:注册失败,该用户已存在!"); return "user/login"; TbUser user = new TbUser(); user.setUUsername(uUsername); user.setUPassword(uPassword); user.setURole(uRole); tbUserService.insertUser(user);
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。