春花直播搜索引擎营销优化诊断训练
作者主页:Java毕设网
简介:Java领域优质创作者、Java项目、学习资料、技术互助
文末获取源码
一、相关文档
系统中的核心用户是系统管理员,管理员登录后,通过管理员菜单来管理后台系统。主要功能有:个人中心、用户管理、食堂管理、食堂菜单管理、菜系分类管理、消息留言管理、留言板管理、系统管理、订单管理等功能。
用户进入系统可以进行个人中心、消息留言管理、我的收藏管理、订单管理等。
二、项目介绍
角色:管理员、用户
前台用户可以实现商品浏览,加入购物车,加入收藏,预定,选座,个人信息管理,收货信息管理,收藏管理,评论功能,我的订单等。
食堂:个人中心、修改密码、个人信息、食堂菜单管理、菜系分类管理、消息留言管理、订单管理
系统管理员,管理员登录后,通过管理员菜单来管理后台系统。主要功能有:个人中心、用户管理、食堂管理、食堂菜单管理、菜系分类管理、消息留言管理、留言板管理、系统管理、订单管理等功能。
由于本程序规模不大,可供课程设计,毕业设计学习演示之用
三、环境需要
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
五、使用说明
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,修改配置,运行项目;
3. 将项目中db.xml配置文件中的数据库配置改为自己的配置,然后运行;
前台:http://localhost:8080/jspmjy54g/front/index.jsp
后台:http://localhost:8080/jspmjy54g/jsp/login.jsp
六、运行截图
前台界面
后台界面
七、相关代码
订单管理控制器
@RestController
@RequestMapping("/orders")
public class OrdersController {@Autowiredprivate OrdersService ordersService;/*** 后端列表*/@RequestMapping("/page")public R page(@RequestParam Map<String, Object> params,OrdersEntity orders, HttpServletRequest request){if(!request.getSession().getAttribute("role").toString().equals("管理员")) {orders.setUserid((Long)request.getSession().getAttribute("userId"));}EntityWrapper<OrdersEntity> ew = new EntityWrapper<OrdersEntity>();PageUtils page = ordersService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, orders), params), params));request.setAttribute("data", page);return R.ok().put("data", page);}/*** 前端列表*/@RequestMapping("/list")public R list(@RequestParam Map<String, Object> params,OrdersEntity orders, HttpServletRequest request){EntityWrapper<OrdersEntity> ew = new EntityWrapper<OrdersEntity>();PageUtils page = ordersService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, orders), params), params));request.setAttribute("data", page);return R.ok().put("data", page);}/*** 列表*/@RequestMapping("/lists")public R list( OrdersEntity orders){EntityWrapper<OrdersEntity> ew = new EntityWrapper<OrdersEntity>();ew.allEq(MPUtil.allEQMapPre( orders, "orders")); return R.ok().put("data", ordersService.selectListView(ew));}/*** 查询*/@RequestMapping("/query")public R query(OrdersEntity orders){EntityWrapper< OrdersEntity> ew = new EntityWrapper< OrdersEntity>();ew.allEq(MPUtil.allEQMapPre( orders, "orders")); OrdersView ordersView = ordersService.selectView(ew);return R.ok("查询订单成功").put("data", ordersView);}/*** 后端详情*/@RequestMapping("/info/{id}")public R info(@PathVariable("id") Long id){OrdersEntity orders = ordersService.selectById(id);return R.ok().put("data", orders);}/*** 前端详情*/@RequestMapping("/detail/{id}")public R detail(@PathVariable("id") Long id){OrdersEntity orders = ordersService.selectById(id);return R.ok().put("data", orders);}/*** 后端保存*/@RequestMapping("/save")public R save(@RequestBody OrdersEntity orders, HttpServletRequest request){orders.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());//ValidatorUtils.validateEntity(orders);orders.setUserid((Long)request.getSession().getAttribute("userId"));ordersService.insert(orders);return R.ok();}/*** 前端保存*/@RequestMapping("/add")public R add(@RequestBody OrdersEntity orders, HttpServletRequest request){orders.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());//ValidatorUtils.validateEntity(orders);ordersService.insert(orders);return R.ok();}/*** 修改*/@RequestMapping("/update")public R update(@RequestBody OrdersEntity orders, HttpServletRequest request){//ValidatorUtils.validateEntity(orders);ordersService.updateById(orders);//全部更新return R.ok();}/*** 删除*/@RequestMapping("/delete")public R delete(@RequestBody Long[] ids){ordersService.deleteBatchIds(Arrays.asList(ids));return R.ok();}/*** 提醒接口*/@RequestMapping("/remind/{columnName}/{type}")public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, @PathVariable("type") String type,@RequestParam Map<String, Object> map) {map.put("column", columnName);map.put("type", type);if(type.equals("2")) {SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");Calendar c = Calendar.getInstance();Date remindStartDate = null;Date remindEndDate = null;if(map.get("remindstart")!=null) {Integer remindStart = Integer.parseInt(map.get("remindstart").toString());c.setTime(new Date()); c.add(Calendar.DAY_OF_MONTH,remindStart);remindStartDate = c.getTime();map.put("remindstart", sdf.format(remindStartDate));}if(map.get("remindend")!=null) {Integer remindEnd = Integer.parseInt(map.get("remindend").toString());c.setTime(new Date());c.add(Calendar.DAY_OF_MONTH,remindEnd);remindEndDate = c.getTime();map.put("remindend", sdf.format(remindEndDate));}}Wrapper<OrdersEntity> wrapper = new EntityWrapper<OrdersEntity>();if(map.get("remindstart")!=null) {wrapper.ge(columnName, map.get("remindstart"));}if(map.get("remindend")!=null) {wrapper.le(columnName, map.get("remindend"));}if(!request.getSession().getAttribute("role").toString().equals("管理员")) {wrapper.eq("userid", (Long)request.getSession().getAttribute("userId"));}int count = ordersService.selectCount(wrapper);return R.ok().put("count", count);}}
食堂相关控制器
@RestController
@RequestMapping("/shitang")
public class ShitangController {@Autowiredprivate ShitangService shitangService;@Autowiredprivate TokenService tokenService;/*** 登录*/@IgnoreAuth@RequestMapping(value = "/login")public R login(String username, String password, String captcha, HttpServletRequest request) {ShitangEntity user = shitangService.selectOne(new EntityWrapper<ShitangEntity>().eq("shitanghao", username));if(user==null || !user.getMima().equals(password)) {return R.error("账号或密码不正确");}String token = tokenService.generateToken(user.getId(), username,"shitang", "管理员" );return R.ok().put("token", token);}/*** 注册*/@IgnoreAuth@RequestMapping("/register")public R register(@RequestBody ShitangEntity shitang){//ValidatorUtils.validateEntity(shitang);ShitangEntity user = shitangService.selectOne(new EntityWrapper<ShitangEntity>().eq("shitanghao", shitang.getShitanghao()));if(user!=null) {return R.error("注册用户已存在");}Long uId = new Date().getTime();shitang.setId(uId);shitangService.insert(shitang);return R.ok();}/*** 退出*/@RequestMapping("/logout")public R logout(HttpServletRequest request) {request.getSession().invalidate();return R.ok("退出成功");}/*** 获取用户的session用户信息*/@RequestMapping("/session")public R getCurrUser(HttpServletRequest request){Long id = (Long)request.getSession().getAttribute("userId");ShitangEntity user = shitangService.selectById(id);return R.ok().put("data", user);}/*** 密码重置*/@IgnoreAuth@RequestMapping(value = "/resetPass")public R resetPass(String username, HttpServletRequest request){ShitangEntity user = shitangService.selectOne(new EntityWrapper<ShitangEntity>().eq("shitanghao", username));if(user==null) {return R.error("账号不存在");}user.setMima("123456");shitangService.updateById(user);return R.ok("密码已重置为:123456");}/*** 后端列表*/@RequestMapping("/page")public R page(@RequestParam Map<String, Object> params,ShitangEntity shitang, HttpServletRequest request){EntityWrapper<ShitangEntity> ew = new EntityWrapper<ShitangEntity>();PageUtils page = shitangService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, shitang), params), params));request.setAttribute("data", page);return R.ok().put("data", page);}/*** 前端列表*/@RequestMapping("/list")public R list(@RequestParam Map<String, Object> params,ShitangEntity shitang, HttpServletRequest request){EntityWrapper<ShitangEntity> ew = new EntityWrapper<ShitangEntity>();PageUtils page = shitangService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, shitang), params), params));request.setAttribute("data", page);return R.ok().put("data", page);}/*** 列表*/@RequestMapping("/lists")public R list( ShitangEntity shitang){EntityWrapper<ShitangEntity> ew = new EntityWrapper<ShitangEntity>();ew.allEq(MPUtil.allEQMapPre( shitang, "shitang")); return R.ok().put("data", shitangService.selectListView(ew));}/*** 查询*/@RequestMapping("/query")public R query(ShitangEntity shitang){EntityWrapper< ShitangEntity> ew = new EntityWrapper< ShitangEntity>();ew.allEq(MPUtil.allEQMapPre( shitang, "shitang")); ShitangView shitangView = shitangService.selectView(ew);return R.ok("查询食堂成功").put("data", shitangView);}/*** 后端详情*/@RequestMapping("/info/{id}")public R info(@PathVariable("id") Long id){ShitangEntity shitang = shitangService.selectById(id);return R.ok().put("data", shitang);}/*** 前端详情*/@RequestMapping("/detail/{id}")public R detail(@PathVariable("id") Long id){ShitangEntity shitang = shitangService.selectById(id);return R.ok().put("data", shitang);}/*** 后端保存*/@RequestMapping("/save")public R save(@RequestBody ShitangEntity shitang, HttpServletRequest request){shitang.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());//ValidatorUtils.validateEntity(shitang);ShitangEntity user = shitangService.selectOne(new EntityWrapper<ShitangEntity>().eq("shitanghao", shitang.getShitanghao()));if(user!=null) {return R.error("用户已存在");}shitang.setId(new Date().getTime());shitangService.insert(shitang);return R.ok();}/*** 前端保存*/@RequestMapping("/add")public R add(@RequestBody ShitangEntity shitang, HttpServletRequest request){shitang.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());//ValidatorUtils.validateEntity(shitang);ShitangEntity user = shitangService.selectOne(new EntityWrapper<ShitangEntity>().eq("shitanghao", shitang.getShitanghao()));if(user!=null) {return R.error("用户已存在");}shitang.setId(new Date().getTime());shitangService.insert(shitang);return R.ok();}/*** 修改*/@RequestMapping("/update")public R update(@RequestBody ShitangEntity shitang, HttpServletRequest request){//ValidatorUtils.validateEntity(shitang);shitangService.updateById(shitang);//全部更新return R.ok();}/*** 删除*/@RequestMapping("/delete")public R delete(@RequestBody Long[] ids){shitangService.deleteBatchIds(Arrays.asList(ids));return R.ok();}/*** 提醒接口*/@RequestMapping("/remind/{columnName}/{type}")public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, @PathVariable("type") String type,@RequestParam Map<String, Object> map) {map.put("column", columnName);map.put("type", type);if(type.equals("2")) {SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");Calendar c = Calendar.getInstance();Date remindStartDate = null;Date remindEndDate = null;if(map.get("remindstart")!=null) {Integer remindStart = Integer.parseInt(map.get("remindstart").toString());c.setTime(new Date()); c.add(Calendar.DAY_OF_MONTH,remindStart);remindStartDate = c.getTime();map.put("remindstart", sdf.format(remindStartDate));}if(map.get("remindend")!=null) {Integer remindEnd = Integer.parseInt(map.get("remindend").toString());c.setTime(new Date());c.add(Calendar.DAY_OF_MONTH,remindEnd);remindEndDate = c.getTime();map.put("remindend", sdf.format(remindEndDate));}}Wrapper<ShitangEntity> wrapper = new EntityWrapper<ShitangEntity>();if(map.get("remindstart")!=null) {wrapper.ge(columnName, map.get("remindstart"));}if(map.get("remindend")!=null) {wrapper.le(columnName, map.get("remindend"));}int count = shitangService.selectCount(wrapper);return R.ok().put("count", count);}}