package com.action;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.entity.Article;
import com.entity.Cart;
import com.entity.Cate;
import com.entity.City;
import com.entity.Details;
import com.entity.Equipment;
import com.entity.Orders;
import com.entity.Topic;
import com.entity.Users;
import com.service.ArticleService;
import com.service.CartService;
import com.service.CateService;
import com.service.CarnieService;
import com.service.CityService;
import com.service.DetailsService;
import com.service.EquipmentService;
import com.service.OrdersService;
import com.service.TopicService;
import com.service.UsersService;
import com.util.VeDate;
//定义为控制器
@Controller
// 设置路径
@RequestMapping("/index")
public class IndexAction extends BaseAction {
@Autowired
@Resource
private UsersService usersService;
@Autowired
@Resource
private ArticleService articleService;
@Autowired
@Resource
private CateService cateService;
@Autowired
@Resource
private CityService cityService;
@Autowired
@Resource
private CarnieService carnieService;
@Autowired
@Resource
private EquipmentService equipmentService;
@Autowired
@Resource
private CartService cartService;
@Autowired
@Resource
private OrdersService ordersService;
@Autowired
@Resource
private DetailsService detailsService;
@Autowired
@Resource
private TopicService topicService;
// 公共方法 提供公共查询数据
private void front() {
this.getRequest().setAttribute("title", "在线设施订票系统");
List<Cate> cateList = this.cateService.getAllCate();
this.getRequest().setAttribute("cateList", cateList);
List<Equipment> hotList = this.equipmentService.getEquipmentByHot();
this.getRequest().setAttribute("hotList", hotList);
}
// 首页显示
@RequestMapping("index.action")
public String index() {
this.front();
List<Cate> cateList = this.cateService.getCateFront();
List<Cate> frontList = new ArrayList<Cate>();
for (Cate cate : cateList) {
List<Equipment> flimList = this.equipmentService.getEquipmentByCate(cate.getCateid());
cate.setFlimList(flimList);
frontList.add(cate);
}
this.getRequest().setAttribute("frontList", frontList);
return "users/index";
}
// 公告
@RequestMapping("article.action")
public String article(String number) {
this.front();
List<Article> articleList = new ArrayList<Article>();
List<Article> tempList = this.articleService.getAllArticle();
int pageNumber = tempList.size();
int maxPage = pageNumber;
if (maxPage % 12 == 0) {
maxPage = maxPage / 12;
} else {
maxPage = maxPage / 12 + 1;
}
if (number == null) {
number = "0";
}
int start = Integer.parseInt(number) * 12;
int over = (Integer.parseInt(number) + 1) * 12;
int count = pageNumber - over;
if (count <= 0) {
over = pageNumber;
}
for (int i = start; i < over; i++) {
Article x = tempList.get(i);
articleList.add(x);
}
String html = "";
StringBuffer buffer = new StringBuffer();
buffer.append(" 共为");
buffer.append(maxPage);
buffer.append("页 共有");
buffer.append(pageNumber);
buffer.append("条 当前为第");
buffer.append((Integer.parseInt(number) + 1));
buffer.append("页 ");
if ((Integer.parseInt(number) + 1) == 1) {
buffer.append("首页");
} else {
buffer.append("<a href=\"index/article.action?number=0\">首页</a>");
}
buffer.append(" ");
if ((Integer.parseInt(number) + 1) == 1) {
buffer.append("上一页");
} else {
buffer.append("<a href=\"index/article.action?number=" + (Integer.parseInt(number) - 1) + "\">上一页</a>");
}
buffer.append(" ");
if (maxPage <= (Integer.parseInt(number) + 1)) {
buffer.append("下一页");
} else {
buffer.append("<a href=\"index/article.action?number=" + (Integer.parseInt(number) + 1) + "\">下一页</a>");
}
buffer.append(" ");
if (maxPage <= (Integer.parseInt(number) + 1)) {
buffer.append("尾页");
} else {
buffer.append("<a href=\"index/article.action?number=" + (maxPage - 1) + "\">尾页</a>");
}
html = buffer.toString();
this.getRequest().setAttribute("html", html);
this.getRequest().setAttribute("articleList", articleList);
return "users/article";
}
// 阅读公告
@RequestMapping("read.action")
public String read(String id) {
this.front();
Article article = this.articleService.getArticleById(id);
article.setHits("" + (Integer.parseInt(article.getHits()) + 1));
this.articleService.updateArticle(article);
this.getRequest().setAttribute("article", article);
return "users/read";
}
// 准备登录
@RequestMapping("preLogin.action")
public String prelogin() {
this.front();
return "users/login";
}
// 用户登录
@RequestMapping("login.action")
public String login() {
this.front();
String username = this.getRequest().getParameter("username");
String password = this.getRequest().getParameter("password");
Users u = new Users();
u.setUsername(username);
List<Users> usersList = this.usersService.getUsersByCond(u);
if (usersList.size() == 0) {
this.getSession().setAttribute("message", "用户名不存在");
return "redirect:/index/preLogin.action";
} else {
Users users = usersList.get(0);
if (password.equals(users.getPassword())) {
this.getSession().setAttribute("userid", users.getUsersid());
this.getSession().setAttribute("username", users.getUsername());
this.getSession().setAttribute("users", users);
return "redirect:/index/index.action";
} else {
this.getSession().setAttribute("message", "密码错误");
return "redirect:/index/preLogin.action";
}
}
}
// 准备注册
@RequestMapping("preReg.action")
public String preReg() {
this.front();
return "users/register";
}
// 用户注册
@RequestMapping("register.action")
public String register(Users users) {
this.front();
Users u = new Users();
u.setUsername(users.getUsername());
List<Users> usersList = this.usersService.getUsersByCond(u);
if (usersList.size() == 0) {
users.setRegdate(VeDate.getStringDateShort());
this.usersService.insertUsers(users);
} else {
this.getSession().setAttribute("message", "用户名已存在");
return "redirect:/index/preReg.action";
}
return "redirect:/index/preLogin.action";
}
// 退出登录
@RequestMapping("exit.action")
public String exit() {
this.front();
this.getSession().removeAttribute("userid");
this.getSession().removeAttribute("username");
this.getSession().removeAttribute("users");
return "index";
}
// 准备修改密码
@RequestMapping("prePwd.action")
public String prePwd() {
this.front();
if (this.getSession().getAttribute("userid") == null) {
return "redirect:/index/preLogin.action";
}
return "users/editpwd";
}
// 修改密码
@RequestMapping("editpwd.action")
public String editpwd() {
this.front();
if (this.getSession().getAttribute("userid") == null) {
return "redirect:/index/preLogin.action";
}
String userid = (String) this.getSession().getAttribute("userid");
String password = this.getRequest().getParameter("password");
String repassword = this.getRequest().getParameter("repassword");
Users users = this.usersService.getUsersById(userid);
if (password.equals(users.getPassword())) {
users.setPassword(repassword);
this.usersService.updateUsers(users);
} else {
this.getSession().setAttribute("message", "旧密码错误");
return "redirect:/index/pr
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
一、项目简介 本项目是一套基于ssm在线电影订票系统,主要针对计算机相关专业的正在做毕设的学生与需要项目实战练习的Java学习者。 包含:项目源码、数据库脚本等,该项目附带全部源码可作为毕设使用。 项目都经过严格调试,eclipse 确保可以运行! 该系统功能完善、界面美观、操作简单、功能齐全、管理便捷,具有很高的实际应用价值 二、技术实现 后端:spring,springmvc,mybatis,mysql 前端采用:jsp,jquery,css 运行环境及开发工具:jdk8,idea或者eclipse,Navicat 三、系统功能 系统用户分为两种种角色:管理员,普通用户 主要功能包括: 前台: 用户的登录,注册 首页,轮播图,电影分类,热门电影,加入购物车,用户评论,评分 下单,订单信息,我的订单列表,付款,订单明细,修改密码等 后台: 管理员信息管理,网站用户信息管理,新闻公告信息管理,订单信息管理,评价信息管理等 详见 https://blog.csdn.net/weixin_43860634/article/details/128885200
资源推荐
资源详情
资源评论
收起资源包目录
基于ssm框架实现的在线电影订票系统 (6242个子文件)
$CACHE_FILE$ 6KB
IndexAction.class 20KB
IndexAction.class 20KB
IndexAction.class 20KB
VeDate.class 10KB
VeDate.class 10KB
VeDate.class 10KB
AdminAction.class 6KB
AdminAction.class 6KB
AdminAction.class 6KB
DetailsAction.class 5KB
DetailsAction.class 5KB
DetailsAction.class 5KB
EquipmentAction.class 5KB
EquipmentAction.class 5KB
TopicAction.class 5KB
TopicAction.class 5KB
TopicAction.class 5KB
FilmAction.class 5KB
FilmAction.class 5KB
CartAction.class 5KB
CartAction.class 5KB
CartAction.class 5KB
OrdersAction.class 4KB
OrdersAction.class 4KB
OrdersAction.class 4KB
CinemaAction.class 4KB
CarnieAction.class 4KB
CarnieAction.class 4KB
UsersAction.class 4KB
UsersAction.class 4KB
UsersAction.class 4KB
ArticleAction.class 4KB
ArticleAction.class 4KB
ArticleAction.class 4KB
CateAction.class 4KB
CateAction.class 4KB
CateAction.class 4KB
CityAction.class 4KB
CityAction.class 4KB
CityAction.class 4KB
PageHelper.class 4KB
PageHelper.class 4KB
PageHelper.class 4KB
UploadAction.class 3KB
UploadAction.class 3KB
UploadAction.class 3KB
Equipment.class 3KB
Equipment.class 3KB
Film.class 3KB
Film.class 3KB
BaseAction.class 3KB
BaseAction.class 3KB
BaseAction.class 3KB
Details.class 3KB
Details.class 3KB
Details.class 3KB
AjaxAction.class 2KB
AjaxAction.class 2KB
AjaxAction.class 2KB
Excel.class 2KB
Excel.class 2KB
Excel.class 2KB
EquipmentServiceImpl.class 2KB
EquipmentServiceImpl.class 2KB
Topic.class 2KB
Topic.class 2KB
Cart.class 2KB
Cart.class 2KB
Users.class 2KB
Users.class 2KB
Users.class 2KB
FilmServiceImpl.class 2KB
FilmServiceImpl.class 2KB
Topic.class 2KB
Cart.class 2KB
Orders.class 2KB
Cinema.class 2KB
Carnie.class 2KB
Orders.class 2KB
Carnie.class 2KB
Orders.class 2KB
Cate.class 2KB
Cate.class 2KB
Cate.class 2KB
CateServiceImpl.class 2KB
CateServiceImpl.class 2KB
CateServiceImpl.class 2KB
ArticleServiceImpl.class 2KB
DetailsServiceImpl.class 2KB
ArticleServiceImpl.class 2KB
DetailsServiceImpl.class 2KB
DetailsServiceImpl.class 2KB
ArticleServiceImpl.class 2KB
CinemaServiceImpl.class 2KB
OrdersServiceImpl.class 2KB
CarnieServiceImpl.class 2KB
OrdersServiceImpl.class 2KB
CarnieServiceImpl.class 2KB
OrdersServiceImpl.class 2KB
共 6242 条
- 1
- 2
- 3
- 4
- 5
- 6
- 63
飞翔的佩奇
- 粉丝: 3709
- 资源: 819
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 51单片机C开发实例带讲解视频8-8点阵静止显示
- 51单片机C开发实例带讲解视频16-16点阵例程包
- 电子通信设计资料PWM调试LED灯显示
- SGBM(Semi-Global Block Matching)是一种用于计算双目视觉中视差(disparity)的半全局匹配算
- SMA-GPR基于黏菌算法优化高斯过程回归的数据回归预测(Matlab完整源码和数据)
- settings.xml文件
- 计算机专业精品毕业设计&课程设计-基于SSM++jsp的精品酒销售管理系统
- 电子通信设计资料单片机之红外发射接受
- 基于SSM VUE和遗传算法的中药药对挖掘系统项目(免费提供全套java开源项目源码+论文)
- 电子通信设计资料可编程继电器模块应用程序
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
前往页