今天给大家分享一个基于SSM的在线电影购票系统,分享给大家,希望多多支持
源码在文章末尾链接获取

目录

项目简述

运行环境

项目技术

用户前后台功能实现

首页

电影详细图

电影购票 

影城介绍

个人中心

​编辑 

支付模拟 

用户信息修改

管理员功能实现

电影类别管理

电影信息管理 

放映大厅管理 

订单管理 

部分核心代码: 

controller层

ReceptionController

ViewController

源码链接

链接:https://pan.baidu.com/s/1xVPWEbrR_c6tetYyi7h4uw 提取码:nb7y

欢迎点赞,收藏! 


项目简述

功能: 分为管理员后台和普通用户前台电影购买
前台电影系统:首页、电影展示、大厅安排、支付模拟、电影院位置
管理员用户:包括电影类别管理、电影信息管理、放映大厅管理、订单管理等模块

运行环境

Jdk1.8 + Tomcat8.5 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)

项目技术

Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + maven等等

用户前后台功能实现

首页

 

电影详细图

电影购票
 

 

影城介绍

个人中心

 

支付模拟 

 

用户信息修改

 

 

管理员功能实现

电影类别管理

 

电影信息管理 

放映大厅管理 

订单管理 

部分核心代码: 

controller层

@Controller@RequestMapping("/root")public class AdminController {@Autowiredprivate FilmCategoryService filmCategoryService;@Autowiredprivate FilmService filmService;@Autowiredprivate AdminService adminService;@Autowiredprivate PlayService playService;@Autowiredprivate RoomService roomService;@Autowiredprivate TicketService ticketService;//输入/root/admin 打开后台登陆首页@RequestMapping("/admin")public String admin(Model model, HttpServletRequest request){HttpSession session=request.getSession();Admin admin= (Admin) session.getAttribute("admin");model.addAttribute("admin",admin);return "admin/admin/admin";}@RequestMapping("/tuichu")@ResponseBodypublic String tui(HttpServletRequest request){HttpSession session=request.getSession();session.removeAttribute("admin");return "admin/login";}@RequestMapping("/home")public String home(){return "admin/admin/home";}@RequestMapping("/type")public String type(Integer page, Model model){model.addAttribute("type",filmCategoryService.list(page,null));return "admin/admin/type";}@RequestMapping(value = "/typedelete",method = RequestMethod.POST)@ResponseBodypublic Integer typedelete(FilmCategory filmCategory){filmCategory.setIsDelete(0);return filmCategoryService.update(filmCategory);}@RequestMapping("/isfilm")public String isfilm(Integer page,Model model){model.addAttribute("map",filmService.list(page,5));model.addAttribute("type",filmCategoryService.all());model.addAttribute("is",1);return "admin/admin/isfilm";}/** * 添加类型 * @param filmCategory * @return */@RequestMapping("/add")@ResponseBodypublic Integer add(FilmCategory filmCategory){return filmCategoryService.add(filmCategory);}@RequestMapping("/typeupdate")@ResponseBodypublic Integer typeupdate(FilmCategory filmCategory){return filmCategoryService.update(filmCategory);}@RequestMapping("/addfilm")@ResponseBodypublic Integer addfilm(FilmPojo filmPojo, HttpServletRequest request){System.out.println(filmPojo);return filmService.add(filmPojo,request);}@RequestMapping("/xiajia")@ResponseBodypublic Integer xiajia(DeleteAndUp deleteAndUp){if (deleteAndUp.getMode().equals("下架")){return filmService.delete(deleteAndUp.getId());}else if (deleteAndUp.getMode().equals("上架")){return filmService.up(deleteAndUp.getId());}return 0;}@RequestMapping("/isdelete")public String isdelete(Integer page,Model model){model.addAttribute("map",filmService.isDelete(page,5));model.addAttribute("type",filmCategoryService.all());model.addAttribute("is",0);return "admin/admin/isfilm";}@RequestMapping("/room")public String room(Integer page,Model model){if (page==null){page=1;}model.addAttribute("is",1);model.addAttribute("film",filmService.listF());model.addAttribute("room",roomService.list());Map map=playService.list(page);model.addAttribute("map",map);return "admin/admin/room";}@RequestMapping("/deroom")public String deroom(Integer page,Model model){if (page==null){page=1;}model.addAttribute("is",0);model.addAttribute("film",filmService.listF());model.addAttribute("room",roomService.list());Map map=playService.delist(page);model.addAttribute("map",map);return "admin/admin/room";}@RequestMapping("/ticket")public String ticket(Integer page,Model model){if (page==null){page=1;}Map map=ticketService.getAllUserList(page);model.addAttribute("map",map);return "admin/admin/allTickets";}@RequestMapping("/ticketDel")@ResponseBodypublic Integer ticketDel(Ticket ticket){//System.out.println(ticket.getTicketId());return ticketService.deleteById(ticket.getTicketId());}@RequestMapping("/play")@ResponseBodypublic Integer play(DeleteAndUp deleteAndUp){Play play=new Play();if (deleteAndUp.getMode().equals("下档")){play.setPlayId(deleteAndUp.getId());play.setIsDelete(0);}else if (deleteAndUp.getMode().equals("上映")){play.setPlayId(deleteAndUp.getId());play.setIsDelete(1);}returnplayService.update(play);}@RequestMapping("/playAdd")@ResponseBodypublic Integer playAdd(PlayPojo play){System.out.println(play);return playService.add(play);}}

ReceptionController

 

@Controllerpublic class ReceptionController {@Autowiredprivate UserService userService;@Autowiredprivate FilmService filmService;@Autowiredprivate PlayService playService;@Autowiredprivate TicketService ticketService;//首页 8080/film 打开电影首页@RequestMapping("/")public String index(@ModelAttribute Users user, HttpServletRequest request, Model model){HttpSession session=request.getSession();user= (Users) session.getAttribute("user");Map map =filmService.list(1,8);model.addAttribute("map",map); /// System.out.println(user);if (user!=null){model.addAttribute("user",user);}/*else {Users u = new Users();u.setUserName("1");model.addAttribute("userb", u);}*/return "user/home";}@RequestMapping("/list")public ModelAndView List(){ModelAndView modelAndView=new ModelAndView("user/listfilm");//每页显示8部电影Map map= filmService.list(1,8);modelAndView.addObject("map",map);return modelAndView;}@RequestMapping("/filmlist")public ModelAndView filmList(Integer page){ModelAndView modelAndView=new ModelAndView("user/listfilm");//从第page开始 再选出8个 如果有的话Map map= filmService.list(page,8);modelAndView.addObject("map",map);return modelAndView;}//电影详情@RequestMapping("/filma")public String film(Integer filmId,Users user,HttpServletRequest request,Model model){HttpSession session=request.getSession();user= (Users) session.getAttribute("user");model.addAttribute("user",user);Film film=filmService.film(filmId);model.addAttribute("film",film);//System.out.println(film);return "user/film";}/** * 购票界面 */@RequestMapping("/goupiao")public String goupiao(Integer filmId,Users user,HttpServletRequest request,Model model){HttpSession session=request.getSession();user= (Users) session.getAttribute("user");model.addAttribute("user",user);List list=playService.filmById(filmId);if (list.size()!=0) {model.addAttribute("list", list);Play play = playService.playById(list.get(0).getPlayId());// System.out.println("a"+play);model.addAttribute("play", play);return "user/goupiao";}else {Film film=filmService.film(filmId);model.addAttribute("film",film);return "user/noPlay"; //没有档期 没有排档期}}/** * 跟换排期 */@RequestMapping("/goupiao2")public String goupiao2(Integer playId,Users user,HttpServletRequest request,Model model){HttpSession session=request.getSession();user= (Users) session.getAttribute("user");model.addAttribute("user",user);Play play=playService.playById(playId);model.addAttribute("play",play);List list=playService.filmById(play.getFilm().getFilmId());model.addAttribute("list",list);model.addAttribute("index",playId);return "user/goupiao";}/** * 登录*/@RequestMapping("/login")@ResponseBodypublic Users login(Users users, HttpServletRequest request){Users user= null;user = userService.login(users,request);//System.out.println(user);if (user!=null){HttpSession session=request.getSession();session.setAttribute("user",user);//System.out.println(session.getAttribute("user"));return user;}else{Users users1=new Users();users1.setUserId(0); //创造一个假的 说明数据库中没有这个 前端用return users1;}}/** * 用户退出 */@RequestMapping("/tui")@ResponseBodypublic String tui(HttpServletRequest request){HttpSession session=request.getSession();session.removeAttribute("user");return "";}/** * 购买电影票 */@RequestMapping(value = "/goumai",method = RequestMethod.POST)@ResponseBodypublic Integer goumai(Tic tic, HttpServletRequest request){HttpSession session=request.getSession();Users user= (Users) session.getAttribute("user");tic.setUserId(user.getUserId()); // System.out.println(tic);int a=ticketService.add(tic,user);return a;}/** * 影城介绍 */@RequestMapping("/we")public String we(@ModelAttribute Users user, HttpServletRequest request,Model model){HttpSession session=request.getSession();user= (Users) session.getAttribute("user");System.out.println(user);if (user!=null){model.addAttribute("user",user);}else {Users u = new Users();u.setUserName("1");model.addAttribute("userb", u);}return "user/jies";}@RequestMapping("/mohu")public String mohu(String name,Integer page,Model model){Map map=filmService.mohu(name,page);model.addAttribute("map",map);return "user/listfilm";}@RequestMapping("/personal")public String personal(Integer page,HttpServletRequest request,Model model){Users users=new Users();HttpSession session=request.getSession();users= (Users) session.getAttribute("user");//System.out.println(users);if (page==null){page=1;}if (users!=null){/*修改完后时实更新*/Map map=ticketService.userList(page,users.getUserId());model.addAttribute("map",map);/*model.addAttribute("user",users);*/Users u=userService.upLogin(users,request);session.setAttribute("user",u);model.addAttribute("user",session.getAttribute("user"));}else{Map map=new HashMap();map.put("pages",0);map.put("pageNum",0);model.addAttribute("map",map);}return "user/personal";}@RequestMapping(value = "/update",method = RequestMethod.POST)public String update(UserPojo userPojo, HttpServletRequest request){Users users=new Users();HttpSession session=request.getSession();users= (Users) session.getAttribute("user");userPojo.setUserId(users.getUserId());userService.update(userPojo,request);return "redirect:/personal";}@RequestMapping(value = "/updateMoney",method = RequestMethod.POST)public String updateMoney(UserPojo userPojo, HttpServletRequest request){Users users=new Users();HttpSession session=request.getSession();users= (Users) session.getAttribute("user");userPojo.setUserId(users.getUserId());userService.updateMoney(userPojo,request);return "redirect:/personal";}/** *已被购买的 */@RequestMapping("/mai")@ResponseBodypublic String mai(Integer playId, Users user){ // System.out.println(playId);List list=ticketService.playById(playId); // System.out.println(list);/* model.addAttribute("ticket",list);*/Map map=new HashMap();map.put("ticket",list);String a= JSON.toJSONString(map);return a;}@RequestMapping("/zhu")@ResponseBodypublic Integer zhu(Users users){return userService.add(users);}}

ViewController

@Controllerpublic class ViewController {@Autowiredprivate AdminService adminService;/** * 登录界面 * @return */@RequestMapping("/adminlogin")public String adminLogin(){return "admin/login";}@RequestMapping("/loginadmin")@ResponseBodypublic String admin(Admin admin, HttpServletRequest request, Model model){Admin a= null;try {a = adminService.login(admin);} catch (UnsupportedEncodingException e) {e.printStackTrace();}System.out.println(a);if (a!=null){HttpSession session=request.getSession();session.setAttribute("admin",a);model.addAttribute("admin",a);return "ok";}return "redirect:/root/admin";}}

源码链接

链接:https://pan.baidu.com/s/1xVPWEbrR_c6tetYyi7h4uw 
提取码:nb7y

欢迎点赞,收藏!