//
//
//
package com.action;
import com.entity.Topic;
import com.entity.Orders;
import com.entity.Details;
import com.entity.City;
import com.entity.Cart;
import com.util.VeDate;
import com.entity.Users;
import com.entity.Article;
import java.util.Iterator;
import java.util.ArrayList;
import com.entity.Film;
import com.entity.Cate;
import java.util.List;
import com.service.TopicService;
import com.service.DetailsService;
import com.service.OrdersService;
import com.service.CartService;
import com.service.FilmService;
import com.service.CinemaService;
import com.service.CityService;
import com.service.CateService;
import com.service.ArticleService;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import com.service.UsersService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
@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 CinemaService cinemaService;
@Autowired
@Resource
private FilmService filmService;
@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", (Object)"\u5728\u7ebf\u7535\u5f71\u8ba2\u7968\u7cfb\u7edf");
final List<Cate> cateList = this.cateService.getAllCate();
this.getRequest().setAttribute("cateList", (Object)cateList);
final List<Film> hotList = this.filmService.getFilmByHot();
this.getRequest().setAttribute("hotList", (Object)hotList);
}
@RequestMapping({ "index.action" })
public String index() {
this.front();
final List<Cate> cateList = this.cateService.getCateFront();
final List<Cate> frontList = new ArrayList<Cate>();
for (final Cate cate : cateList) {
final List<Film> flimList = this.filmService.getFilmByCate(cate.getCateid());
cate.setFlimList(flimList);
frontList.add(cate);
}
this.getRequest().setAttribute("frontList", (Object)frontList);
return "users/index";
}
@RequestMapping({ "article.action" })
public String article(String number) {
this.front();
final List<Article> articleList = new ArrayList<Article>();
final List<Article> tempList = this.articleService.getAllArticle();
int maxPage;
final int pageNumber = maxPage = tempList.size();
if (maxPage % 12 == 0) {
maxPage /= 12;
}
else {
maxPage = maxPage / 12 + 1;
}
if (number == null) {
number = "0";
}
final int start = Integer.parseInt(number) * 12;
int over = (Integer.parseInt(number) + 1) * 12;
final int count = pageNumber - over;
if (count <= 0) {
over = pageNumber;
}
for (int i = start; i < over; ++i) {
final Article x = tempList.get(i);
articleList.add(x);
}
String html = "";
final StringBuffer buffer = new StringBuffer();
buffer.append(" \u5171\u4e3a");
buffer.append(maxPage);
buffer.append("\u9875 \u5171\u6709");
buffer.append(pageNumber);
buffer.append("\u6761 \u5f53\u524d\u4e3a\u7b2c");
buffer.append(Integer.parseInt(number) + 1);
buffer.append("\u9875 ");
if (Integer.parseInt(number) + 1 == 1) {
buffer.append("\u9996\u9875");
}
else {
buffer.append("<a href=\"index/article.action?number=0\">\u9996\u9875</a>");
}
buffer.append(" ");
if (Integer.parseInt(number) + 1 == 1) {
buffer.append("\u4e0a\u4e00\u9875");
}
else {
buffer.append("<a href=\"index/article.action?number=" + (Integer.parseInt(number) - 1) + "\">\u4e0a\u4e00\u9875</a>");
}
buffer.append(" ");
if (maxPage <= Integer.parseInt(number) + 1) {
buffer.append("\u4e0b\u4e00\u9875");
}
else {
buffer.append("<a href=\"index/article.action?number=" + (Integer.parseInt(number) + 1) + "\">\u4e0b\u4e00\u9875</a>");
}
buffer.append(" ");
if (maxPage <= Integer.parseInt(number) + 1) {
buffer.append("\u5c3e\u9875");
}
else {
buffer.append("<a href=\"index/article.action?number=" + (maxPage - 1) + "\">\u5c3e\u9875</a>");
}
html = buffer.toString();
this.getRequest().setAttribute("html", (Object)html);
this.getRequest().setAttribute("articleList", (Object)articleList);
return "users/article";
}
@RequestMapping({ "read.action" })
public String read(final String id) {
this.front();
final Article article = this.articleService.getArticleById(id);
article.setHits(new StringBuilder().append(Integer.parseInt(article.getHits()) + 1).toString());
this.articleService.updateArticle(article);
this.getRequest().setAttribute("article", (Object)article);
return "users/read";
}
@RequestMapping({ "preLogin.action" })
public String prelogin() {
this.front();
return "users/login";
}
@RequestMapping({ "login.action" })
public String login() {
this.front();
final String username = this.getRequest().getParameter("username");
final String password = this.getRequest().getParameter("password");
final Users u = new Users();
u.setUsername(username);
final List<Users> usersList = this.usersService.getUsersByCond(u);
if (usersList.size() == 0) {
this.getSession().setAttribute("message", (Object)"\u7528\u6237\u540d\u4e0d\u5b58\u5728");
return "redirect:/index/preLogin.action";
}
final Users users = usersList.get(0);
if (password.equals(users.getPassword())) {
this.getSession().setAttribute("userid", (Object)users.getUsersid());
this.getSession().setAttribute("username", (Object)users.getUsername());
this.getSession().setAttribute("users", (Object)users);
return "redirect:/index/index.action";
}
this.getSession().setAttribute("message", (Object)"\u5bc6\u7801\u9519\u8bef");
return "redirect:/index/preLogin.action";
}
@RequestMapping({ "preReg.action" })
public String preReg() {
this.front();
return "users/register";
}
@RequestMapping({ "register.action" })
public String register(final Users users) {
this.front();
final Users u = new Users();
u.setUsername(users.getUsername());
final List<Users> usersList = this.usersService.getUsersByCond(u);
if (usersList.size() == 0) {
users.setRegdate(VeDate.getStringDateShort());
this.usersService.insertUsers(users);
return "redirect:/index/preLogin.action";
}
this.getSession().setAttribute("message", (Object)"\u7528\u6237\u540d\u5df2\u5b58\u5728");
return "redirect:/index/preReg.action";
}
@RequestMapping({ "exit.action" })
public String exit() {
this.front();
this.getSession().removeAttribute("userid");
this.getSession().removeAttribute("username");
this.getSession().removeAttribute("user
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
本人十余年JAVA架构设计经验,擅长JAVA高可用、分布式、高并发系统架构设计。有志于做JAVA系统性的技术提升的同学可与我联系,交个朋友哦~ 本人十余年JAVA架构设计经验,擅长JAVA高可用、分布式、高并发系统架构设计。有志于做JAVA系统性的技术提升的同学可与我联系,交个朋友哦~ 本人十余年JAVA架构设计经验,擅长JAVA高可用、分布式、高并发系统架构设计。有志于做JAVA系统性的技术提升的同学可与我联系,交个朋友哦~
资源推荐
资源详情
资源评论
收起资源包目录
《毕业设计&代码复用》--JSP基于SSM电影售票管理系统设计毕业源码案例设计.zip (2000个子文件)
IndexAction.class 20KB
VeDate.class 10KB
AdminAction.class 6KB
DetailsAction.class 5KB
TopicAction.class 5KB
FilmAction.class 5KB
CartAction.class 5KB
OrdersAction.class 5KB
CinemaAction.class 5KB
UsersAction.class 4KB
ArticleAction.class 4KB
CateAction.class 4KB
CityAction.class 4KB
PageHelper.class 4KB
UploadAction.class 3KB
Film.class 3KB
BaseAction.class 3KB
Details.class 3KB
AjaxAction.class 2KB
Excel.class 2KB
Users.class 2KB
Topic.class 2KB
FilmServiceImpl.class 2KB
Cart.class 2KB
Cinema.class 2KB
Orders.class 2KB
Cate.class 2KB
CateServiceImpl.class 2KB
DetailsServiceImpl.class 2KB
ArticleServiceImpl.class 2KB
CinemaServiceImpl.class 2KB
OrdersServiceImpl.class 2KB
Admin.class 2KB
Article.class 2KB
UsersServiceImpl.class 2KB
AdminServiceImpl.class 2KB
TopicServiceImpl.class 2KB
CityServiceImpl.class 2KB
CartServiceImpl.class 2KB
MD5.class 1KB
City.class 918B
FilmService.class 850B
FilmDAO.class 837B
ArticleService.class 706B
DetailsService.class 706B
DetailsDAO.class 693B
ArticleDAO.class 693B
CinemaService.class 690B
OrdersService.class 690B
CateService.class 689B
CinemaDAO.class 677B
OrdersDAO.class 677B
CateDAO.class 676B
AdminService.class 674B
TopicService.class 674B
UsersService.class 674B
TopicDAO.class 661B
UsersDAO.class 661B
AdminDAO.class 661B
CityService.class 658B
CartService.class 658B
CityDAO.class 645B
CartDAO.class 645B
.classpath 841B
org.eclipse.wst.common.component 482B
org.eclipse.wst.jsdt.ui.superType.container 49B
style.css 102KB
main.css 95KB
editor_ie7.css 48KB
editor_iequirks.css 47KB
editor_ie8.css 46KB
editor_ie.css 46KB
editor_gecko.css 45KB
editor.css 45KB
ui_custom.css 34KB
prettyPhoto.css 19KB
elfinder.css 18KB
dialog_ie7.css 17KB
dialog_ie8.css 16KB
dialog_iequirks.css 16KB
dialog_ie.css 16KB
dialog.css 15KB
fullcalendar.css 8KB
datatable.css 8KB
datepicker.css 4KB
datepicker.css 4KB
reset.css 3KB
style.css 3KB
contents.css 2KB
templates.css 2KB
toolbar.css 1KB
wsc.css 1KB
WdatePicker.css 192B
Thumbs.db 20KB
logos.gif 52KB
bg.gif 18KB
loader7.gif 9KB
service.gif 8KB
salesTitBg.gif 6KB
loader.gif 6KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
季风泯灭的季节
- 粉丝: 2075
- 资源: 3370
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于Python智能红绿灯控制系统的开发-实时交通流量检测与红绿灯状态优化切换实现方案含代码
- Java-Java资源
- jsBook-跨年倒计时html代码
- New-Year-Card-新年倒计时
- 跨年烟花大屏show-跨年
- fireworks-烟花代码
- vue-mapvgl-烟花代码
- CS-Books-Store-计算机网络课后题答案
- front-end-Doc-烟花代码大全html
- html新年快乐3d烟花代码HTML/CSS/JS实现新年快乐动态3D烟花特效及应用案例
- Front-end-tutorial-烟花代码大全html
- walle-web-烟花代码
- hardseed-python新年快乐代码
- JavaFamily-master-上学的小垃圾
- 基于HTML5的交互式新年倒计时与动态烟花展示
- 元旦烟花html,Web前端技术实现元旦烟花动画特效:HTML/CSS/JavaScript联合演示
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功