作者主页:夜未央5788
简介: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.数据库:MySql 5.7版本;
6.是否Maven项目:否;
1. 后端:Spring+SpringMVC+Mybatis
2. 前端:JSP+jQuery+Ajax
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中springmvc-servlet.xml配置文件中的数据库配置改为自己的配置;
4. 运行项目,
前台运行地址:输入localhost:8080/ssm_zxdydp/index/index.action 登录
用户账号/密码: ls/lisi
后台运行地址:localhost:8080/ssm_zxdydp/admin/index.jsp
管理员账号/密码:admin/admin


- package net.dqsy.manager.controller;
-
- import net.dqsy.manager.pojo.Account;
- import net.dqsy.manager.service.IAccountService;
- import net.dqsy.manager.web.util.IpUtil;
- import net.dqsy.manager.web.util.LocalizationUtil;
- import net.dqsy.manager.web.util.MD5Util;
- import net.dqsy.manager.web.util.PageUtil;
- import net.dqsy.manager.web.util.ParamUtils;
- import net.dqsy.manager.web.util.ResultUtil;
- import org.apache.commons.lang3.StringUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.servlet.ModelAndView;
-
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import java.util.Arrays;
- import java.util.Date;
- import java.util.List;
-
- @Controller
- @RequestMapping("account")
- public class AccountController{
-
- @Autowired
- private IAccountService accountService;
- @RequestMapping(value = "list")
- public ModelAndView list(HttpServletRequest request, HttpServletResponse response){
-
- Account account = (Account) request.getSession().getAttribute("currentAccount");
-
- int start = ParamUtils.getIntParameter(request, "page", 1);
- int limit = ParamUtils.getIntParameter(request, "limit", 10);
- String userName = ParamUtils.getParameter(request, "s_userName");
- if(StringUtils.isBlank(userName) || "null".equals(userName)){
- userName = null;
- }
-
- int totalCount = accountService.getTotalCount(Arrays.asList(Account.ACCOUNT_MANAGER, Account.ACCOUNT_STUDENT), userName);
- List
accountList = accountService.findAccountList(Arrays.asList(Account.ACCOUNT_MANAGER, Account.ACCOUNT_STUDENT), userName, start, limit); -
- String pagation = PageUtil.getPagation("/account/list&s_userName=" + userName, totalCount, start, limit);
-
- ModelAndView mav = new ModelAndView("account/list");
- mav.getModel().put("accountList", accountList);
- mav.getModel().put("pageCode", pagation);
- return mav;
- }
- @RequestMapping(value = "add")
- public void add(HttpServletRequest request, HttpServletResponse response){
-
- Long account_id = ParamUtils.getLongParameter(request, "account_id", 0L);
- String username = ParamUtils.getParameter(request, "username");
- int sex = ParamUtils.getIntParameter(request, "sex", 1);
- String mobile = ParamUtils.getParameter(request, "mobile");
- String email = ParamUtils.getParameter(request, "email", "");
- String screenName = ParamUtils.getParameter(request, "screenName", "");
-
-
- if(account_id == 0L || StringUtils.isBlank(username)){
- ResultUtil.fail(LocalizationUtil.getClientString("Account_22", request), response);
- return;
- }
-
-
- Account oldAccount = accountService.findAccountById(account_id);
- if(oldAccount != null){
- oldAccount.setId(account_id);
- oldAccount.setUsername(username);
- oldAccount.setMobile(mobile);
- oldAccount.setSex(sex);
- oldAccount.setEmail(email);
- oldAccount.setScreenName(screenName);
- accountService.update(oldAccount);
- }else{
- Account account = new Account();
- account.setId(account_id);
- account.setUsername(username);
- account.setMobile(mobile);
- account.setSex(sex);
- account.setCreateTime(new Date());
- account.setActivated(true);
- account.setEnabled(true);
- account.setRegisterIp(IpUtil.getIpStr(request));
- account.setPassword(MD5Util.getMD5("123456".getBytes()));
- account.setScreenName(username);
- account.setLocale(request.getLocale().getLanguage() +"_"+request.getLocale().getCountry());
- account.setRegisterTime(new Date());
- account.setCreateTime(new Date());
- account.setType(Account.ACCOUNT_STUDENT);
- accountService.save(account);
- }
-
- ResultUtil.success(response);
-
- }
- @RequestMapping(value = "detail")
- public void detail(HttpServletRequest request, HttpServletResponse response){
- Long account_id = ParamUtils.getLongParameter(request, "account_id", 0L);
- if(account_id == 0L){
- ResultUtil.fail(LocalizationUtil.getClientString("Account_22", request), response);
- return;
- }
-
- Account account = accountService.findAccountById(account_id);
- ResultUtil.success(account, response);
-
- }
- @RequestMapping(value = "delete")
- public void delete(HttpServletRequest request, HttpServletResponse response){
- Long account_id = ParamUtils.getLongParameter(request, "account_id", 0L);
- if(account_id == 0L){
- ResultUtil.fail(LocalizationUtil.getClientString("Account_22", request), response);
- return;
- }
- accountService.deteleById(account_id);
-
- Account account = accountService.findAccountById(account_id);
- ResultUtil.success(account, response);
-
- }
-
-
-
- }
- package net.dqsy.manager.controller;
-
- import net.dqsy.manager.pojo.Account;
- import net.dqsy.manager.pojo.Activity;
- import net.dqsy.manager.pojo.DepartmentMember;
- import net.dqsy.manager.service.IActivityService;
- import net.dqsy.manager.service.IDepartmentMemberService;
- import net.dqsy.manager.service.junkword.SensitiveService;
- import net.dqsy.manager.web.util.PageUtil;
- import net.dqsy.manager.web.util.ParamUtils;
- import net.dqsy.manager.web.util.ResultUtil;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.servlet.ModelAndView;
-
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import java.text.ParseException;
- import java.text.SimpleDateFormat;
- import java.util.Arrays;
- import java.util.Date;
- import java.util.List;
-
- @Controller
- @RequestMapping("activity")
- public class ActivityController{
-
- @Autowired
- private IActivityService activityService;
- @Autowired
- private SensitiveService sensitiveService;
- @Autowired
- private IDepartmentMemberService departmentMemberService;
- @RequestMapping(value = "list", method = RequestMethod.GET)
- public ModelAndView list(HttpServletRequest request, HttpServletResponse response){
-
- int type = ParamUtils.getIntParameter(request, "type", 1);
- int start = ParamUtils.getIntParameter(request, "start", 1);
- int limit = ParamUtils.getIntParameter(request, "limit", 10);
- int totalCount = activityService.getTotalCount(Arrays.asList(type));
- List
list = activityService.findList(Arrays.asList(type), start, limit); -
- String pagation = PageUtil.getPagation("/activityRedirectController.do?action=list", totalCount, start, limit);
-
- ModelAndView mav = new ModelAndView("activity/list");
- mav.getModel().put("activityList", list);
- mav.getModel().put("pageCode", pagation);
- return mav;
- }
-
- @RequestMapping(value = "add", method = RequestMethod.GET)
- public ModelAndView add(HttpServletRequest request, HttpServletResponse response){
- ModelAndView mav = new ModelAndView("activity/activity_add");
- return mav;
- }
-
- @RequestMapping("addActivity")
- public void addActivity(HttpServletRequest request, HttpServletResponse response) throws ParseException {
- Account account = (Account) request.getSession().getAttribute("currentAccount");
- if (account == null) {
- ResultUtil.fail(response);
- return;
- }
-
- String title = ParamUtils.getParameter(request, "title");
- String subTitle = ParamUtils.getParameter(request, "subTitle");
- int limitNum = ParamUtils.getIntParameter(request, "limitNum", 0);
- String startTime = ParamUtils.getParameter(request, "startTime");
- String endTime = ParamUtils.getParameter(request, "endTime");
- String content = ParamUtils.getParameter(request, "content");
-
- // 初始化时设置 日期和时间模式
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- Date start = sdf.parse(startTime);
- Date end = sdf.parse(endTime);
-
- DepartmentMember member = departmentMemberService.findMemberByAccountId(account.getId());
- if(member == null){
- ResultUtil.fail(response);
- return;
- }
- Activity activity = new Activity();
- activity.setTitle(title);
- activity.setSubTitle(subTitle);
- activity.setContent(content);
- activity.setLimitNum(limitNum);
- activity.setStartTime(start);
- activity.setEndTime(end);
- activity.setDepartmentMemberId(member.getDepartmentId());
- activity.setDepartmentId(member.getDepartmentId());
- activity.setType(Activity.ACTIVITY);
- activityService.add(activity);
- ResultUtil.success(response);
-
- }
-
- @RequestMapping("detail")
- public ModelAndView detail(HttpServletRequest request, HttpServletResponse response){
-
- Long activityId = ParamUtils.getLongParameter(request, "activityId");
-
- Activity activity = activityService.findById(activityId);
-
- ModelAndView mav = new ModelAndView("activity/detail");
- mav.getModel().put("activity",activity);
- return mav;
- }
- @RequestMapping("delete")
- public void delete(HttpServletRequest request, HttpServletResponse response){
- Long activityId = ParamUtils.getLongParameter(request, "activityId");
- Activity activity = activityService.findById(activityId);
- if(activity == null){
- ResultUtil.fail(response);
- return;
- }
- activityService.deleteById(activity.getId());
- ResultUtil.success(response);
- }
-
-
-
-
- }
- package net.dqsy.manager.controller;
-
- import net.dqsy.manager.pojo.Account;
- import net.dqsy.manager.pojo.Department;
- import net.dqsy.manager.pojo.DepartmentApply;
- import net.dqsy.manager.pojo.DepartmentMember;
- import net.dqsy.manager.service.IAccountService;
- import net.dqsy.manager.service.IDepartmentApplyService;
- import net.dqsy.manager.service.IDepartmentMemberService;
- import net.dqsy.manager.service.IDepartmentService;
- import net.dqsy.manager.service.junkword.SensitiveService;
- import net.dqsy.manager.web.util.LocalizationUtil;
- import net.dqsy.manager.web.util.PageUtil;
- import net.dqsy.manager.web.util.ParamUtils;
- import net.dqsy.manager.web.util.ResultUtil;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.servlet.ModelAndView;
-
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
-
- import java.util.ArrayList;
- import java.util.Date;
- import java.util.List;
-
- @Controller
- @RequestMapping("departmentApply")
- public class DepartmentApplyController {
- @Autowired
- private SensitiveService sensitiveService;
- @Autowired
- private IDepartmentService departmentService;
- @Autowired
- private IDepartmentApplyService departmentApplyService;
- @Autowired
- private IDepartmentMemberService departmentMemberService;
- @Autowired
- private IAccountService accountService;
-
- @RequestMapping("add")
- public ModelAndView add(HttpServletRequest request, HttpServletResponse response){
- Account account = (Account) request.getSession().getAttribute("currentAccount");
- if (account == null) {
- ModelAndView mav = new ModelAndView("redirect:/index");
- return mav;
- }
- List
departmentList = departmentService.findList(0, 1, 0); - ModelAndView mav = new ModelAndView("departmentApply/apply");
- mav.getModel().put("departmentList", departmentList);
- return mav;
- }
-
- @RequestMapping("list")
- public ModelAndView list(HttpServletRequest request, HttpServletResponse response){
- Account account = (Account) request.getSession().getAttribute("currentAccount");
- if (account == null) {
- ModelAndView mav = new ModelAndView("redirect:/index");
- return mav;
- }
- int start = ParamUtils.getIntParameter(request, "start", 1);
- int limit = ParamUtils.getIntParameter(request, "limit", 10);
- List
list = departmentApplyService.findApplyList(account.getId(), start, limit); - if(list.size()> 0){
- for(DepartmentApply departmentApply :list){
- Department department = departmentService.findDepartmentById(departmentApply.getDepartmentId());
- if(department != null){
- departmentApply.setDepartmentName(department.getName());
- if (departmentApply.getType() == 6) {
- departmentApply.setTypeName("部长");
- } else if (departmentApply.getType() == 5) {
- departmentApply.setTypeName("副部长");
- } else if (departmentApply.getType() == 4) {
- departmentApply.setTypeName("部员");
- }
- }
-
- if(departmentApply.getStatus() == DepartmentApply.NEW&&accountService.findAccountById(departmentApply.getAccountId()).getType()!=6){
- departmentApply.setStatusName("待审核");
- }else if(departmentApply.getStatus() == DepartmentApply.PASS||accountService.findAccountById(departmentApply.getAccountId()).getType()==6){
- departmentApply.setStatusName("通过");
- }else if(departmentApply.getStatus() == DepartmentApply.REJECT){
- departmentApply.setStatusName("拒绝");
- }
- }
- }
- int totalCount = departmentApplyService.getTotalCount(account.getId());
- String pagation = PageUtil.getPagation("/departmentApply/list", totalCount, start, limit);
-
- ModelAndView mav = new ModelAndView("departmentApply/list");
- mav.getModel().put("pageCode", pagation);
- mav.getModel().put("applyList", list);
- return mav;
- }
-
-
- @RequestMapping("getDepartmentList")
- public void getDepartmentList(HttpServletRequest request, HttpServletResponse response){
-
- Account account = (Account) request.getSession().getAttribute("currentAccount");
- if (account == null) {
- ResultUtil.fail(LocalizationUtil.getClientString("Account_22", request), response);
- return;
- }
- List
departmentList = departmentService.findList(0, 1, 0); - ResultUtil.success(departmentList, response);
- }
-
-
- /**
- * 提交申请
- *
- * @param request
- * @param response
- */
- @RequestMapping("apply")
- public void apply(HttpServletRequest request, HttpServletResponse response) {
-
- Account account = (Account) request.getSession().getAttribute("currentAccount");
- if (account == null) {
- ResultUtil.fail("请登录", response);
- }
-
- long departmentId = ParamUtils.getLongParameter(request, "departmentId", 0L);
-
- Department department = departmentService.findDepartmentById(departmentId);
- if (department == null) {
- ResultUtil.fail(LocalizationUtil.getClientString("Account_22", request), response);
- return;
- }
- int type = ParamUtils.getIntParameter(request, "type", 0);
-
- String content = ParamUtils.getParameter(request, "content", "");
- content = sensitiveService.filter(content);
-
- DepartmentApply apply = new DepartmentApply();
- apply.setAccountId(account.getId());
- apply.setContent(content);
- apply.setCreateTime(new Date());
- apply.setDepartmentId(departmentId);
- apply.setType(type);
- if(accountService.findAccountById(account.getId()).getType() == 6) {
- DepartmentMember member = new DepartmentMember();
- member.setAccountId(apply.getAccountId());
- member.setCreateTime(new Date());
- member.setDepartmentId(apply.getDepartmentId());
- member.setRemark("");
- member.setRole(apply.getType());
- member.setStatus(1);
- apply.setStatus(DepartmentApply.PASS);
- DepartmentMember dbDepartmentMember = departmentMemberService.findMemberByAccountId(apply.getAccountId());
- if(dbDepartmentMember == null) {
- departmentMemberService.insert(member);
- }else {
- departmentMemberService.update(member);
- }
- }else {
- apply.setStatus(DepartmentApply.NEW);
- }
- apply.setStatus(DepartmentApply.NEW);
- departmentApplyService.add(apply);
- ResultUtil.success(response);
- }
- @RequestMapping("delete")
- public void delete(HttpServletRequest request, HttpServletResponse response){
-
- Long applyId = ParamUtils.getLongParameter(request, "applyId");
- DepartmentApply apply = departmentApplyService.findById(applyId);
- if(apply == null){
- ResultUtil.fail(LocalizationUtil.getClientString("Account_22", request), response);
- return;
- }
- departmentApplyService.deleteById(apply.getId());
- ResultUtil.success(response);
- }
-
-
- @RequestMapping("detail")
- public ModelAndView detail(HttpServletRequest request, HttpServletResponse response){
- Account account = (Account) request.getSession().getAttribute("currentAccount");
- if (account == null) {
- ModelAndView mav = new ModelAndView("redirect:/index");
- return mav;
- }
- Long applyId = ParamUtils.getLongParameter(request, "applyId");
- DepartmentApply apply = departmentApplyService.findById(applyId);
- ModelAndView mav = new ModelAndView("departmentApply/detail");
- Department department = departmentService.findDepartmentById(apply.getDepartmentId());
- apply.setDepartmentName(department.getName());
- if (apply.getType() == 6) {
- apply.setTypeName("部长");
- } else if (apply.getType() == 5) {
- apply.setTypeName("副部长");
- } else if (apply.getType() == 4) {
- apply.setTypeName("部员");
- }
- if(apply.getStatus() == DepartmentApply.NEW&&accountService.findAccountById(apply.getAccountId()).getType()!=6){
- apply.setStatusName("待审核");
- }else if(apply.getStatus() == DepartmentApply.PASS||accountService.findAccountById(apply.getAccountId()).getType()==6){
- apply.setStatusName("通过");
- }else if(apply.getStatus() == DepartmentApply.REJECT){
- apply.setStatusName("拒绝");
- }
- long accountId = apply.getAccountId();
- Account account1 = accountService.findAccountById(accountId);
-
- if(account.getType() == Account.ACCOUNT_ADMIN || account.getType() == Account.ACCOUNT_MANAGER){
- if(apply.getStatus() == DepartmentApply.NEW){
- mav.getModel().put("manager", "true");
- }
- }
- mav.getModel().put("apply", apply);
- mav.getModel().put("applyName", account1.getUsername());
- return mav;
- }
-
-
- @RequestMapping("applyList")
- public ModelAndView applyList(HttpServletRequest request, HttpServletResponse response){
- int start = ParamUtils.getIntParameter(request, "start", 1);
- int limit = ParamUtils.getIntParameter(request, "limit", 10);
- List
list = departmentApplyService.findApplyList(0, start, limit); - if(list.size()> 0){
- for(DepartmentApply departmentApply :list){
- Department department = departmentService.findDepartmentById(departmentApply.getDepartmentId());
- departmentApply.setDepartmentName(department.getName());
- if (departmentApply.getType() == 6) {
- departmentApply.setTypeName("部长");
- } else if (departmentApply.getType() == 5) {
- departmentApply.setTypeName("副部长");
- } else if (departmentApply.getType() == 4) {
- departmentApply.setTypeName("部员");
- }
-
- if(departmentApply.getStatus() == DepartmentApply.NEW&&accountService.findAccountById(departmentApply.getAccountId()).getType()!=6){
- departmentApply.setStatusName("待审核");
- }else if(departmentApply.getStatus() == DepartmentApply.PASS||accountService.findAccountById(departmentApply.getAccountId()).getType()==6){
- departmentApply.setStatusName("通过");
- }else if(departmentApply.getStatus() == DepartmentApply.REJECT){
- departmentApply.setStatusName("拒绝");
- }
- }
- }
- int totalCount = departmentApplyService.getTotalCount(0);
- String pagation = PageUtil.getPagation("/departmentApply/applyList", totalCount, start, limit);
- ModelAndView mav = new ModelAndView("departmentApply/pendList");
- mav.getModel().put("pageCode", pagation);
- mav.getModel().put("applyList", list);
- return mav;
- }
-
-
-
-
- @RequestMapping("pend")
- public void pend(HttpServletRequest request, HttpServletResponse response){
-
- Account account = (Account) request.getSession().getAttribute("currentAccount");
- if (account == null) {
- ResultUtil.fail(LocalizationUtil.getClientString("Account_22", request), response);
- return;
- }
- long applyId = ParamUtils.getLongParameter(request, "applyId", 0L);
-
- DepartmentApply departmentApply = departmentApplyService.findById(applyId);
- if(departmentApply == null){
- ResultUtil.fail(LocalizationUtil.getClientString("Account_22", request), response);
- return;
- }
- int status = ParamUtils.getIntParameter(request, "status", 0);
- if(status == 0){
- ResultUtil.fail(LocalizationUtil.getClientString("Account_22", request), response);
- return;
- }
- if(status == DepartmentApply.PASS){
- DepartmentMember member = new DepartmentMember();
- member.setAccountId(departmentApply.getAccountId());
- member.setCreateTime(new Date());
- member.setDepartmentId(departmentApply.getDepartmentId());
- member.setRemark("");
- member.setRole(departmentApply.getType());
- member.setStatus(1);
- DepartmentMember dbDepartmentMember = departmentMemberService.findMemberByAccountId(departmentApply.getAccountId());
- if(dbDepartmentMember == null) {
- departmentMemberService.insert(member);
- }else {
- departmentMemberService.update(member);
- }
- Account applyAccount = accountService.findAccountById(departmentApply.getAccountId());
- applyAccount.setType(departmentApply.getType());
- // 更改用户状态
- accountService.update(applyAccount);
-
- }
- departmentApplyService.update(applyId, status);
- ResultUtil.success(response);
- }
-
-
- }
如果也想学习本系统,下面领取。关注并回复:066ssm