package com.hyts.wcms.web.admin;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import com.hyts.wcms.AppUtil;
import com.hyts.wcms.entity.Page;
import com.hyts.wcms.entity.system.Role;
import com.hyts.wcms.entity.system.User;
import com.hyts.wcms.util.*;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.hyts.wcms.entity.system.AppUser;
import com.hyts.wcms.entity.system.Menu;
import com.hyts.wcms.page.PageData;
import com.hyts.wcms.srv.admin.AppuserService;
import com.hyts.wcms.srv.admin.MenuService;
import com.hyts.wcms.srv.admin.RoleService;
import com.hyts.wcms.srv.admin.UserService;
import com.hyts.wcms.web.base.BaseController;
import com.hyts.wcms.website.AndorraService;
import com.hyts.wcms.website.JobService;
import com.hyts.wcms.website.NewsService;
import com.hyts.wcms.website.NoticeService;
import com.hyts.wcms.website.OrderService;
import com.hyts.wcms.website.RoomService;
import lombok.extern.slf4j.Slf4j;
/*
* 总入口
*/
@Slf4j
@Controller
public class LoginController extends BaseController {
@Resource(name = "userService")
private UserService userService;
@Resource(name = "menuService")
private MenuService menuService;
@Resource(name = "roleService")
private RoleService roleService;
@Resource(name = "appuserService")
private AppuserService appUserService;
@Resource(name = "noticeService")
private NoticeService noticeService;
@Resource(name = "roomService")
private RoomService roomService;
@Resource(name = "newsService")
private NewsService newsService;
@Resource(name = "orderService")
private OrderService orderService;
@Resource(name = "andorraService")
private AndorraService andorraService;
@Resource(name = "jobService")
private JobService jobService;
/**
* 获取登录用户的IP
*
* @throws Exception
*/
public void getRemortIP(String USERNAME) throws Exception {
PageData pd = new PageData();
HttpServletRequest request = this.getRequest();
String ip = "";
if (request.getHeader("x-forwarded-for") == null) {
ip = request.getRemoteAddr();
} else {
ip = request.getHeader("x-forwarded-for");
}
pd.put("USERNAME", USERNAME);
pd.put("IP", ip);
userService.saveIP(pd);
}
/**
* 访问登录页
*
* @return
*/
@RequestMapping(value = {"/login_toLogin","","/"})
public ModelAndView toLogin() throws Exception {
ModelAndView mv = this.getModelAndView();
PageData pd = new PageData();
pd = this.getPageData();
pd.put("SYSNAME", Tools.readTxtFile(Const.SYSNAME)); //读取系统名称
mv.setViewName("system/admin/login");
mv.addObject("pd", pd);
return mv;
}
/**
* 网站首页中访问登录页
*
* @return
*/
@RequestMapping(value = "/login_to3wLogin")
public ModelAndView to3wLogin() throws Exception {
ModelAndView mv = this.getModelAndView();
PageData pd = new PageData();
pd = this.getPageData();
pd.put("SYSNAME", Tools.readTxtFile(Const.SYSNAME)); //读取系统名称
mv.setViewName("www/3wlogin");
mv.addObject("pd", pd);
return mv;
}
@RequestMapping(value = "/toMyReserve")
public ModelAndView toMyReserve() throws Exception {
ModelAndView mv = this.getModelAndView();
//根据shiro管理的session取得用户信息
Subject currentUser = SecurityUtils.getSubject();
Session session = currentUser.getSession();
AppUser appUser = (AppUser) session.getAttribute(Const.SESSION_CUSTOMER_USER);
mv.setViewName("www/myReserve");
if (appUser != null) {
mv.addObject("USER_ID", appUser.getUSER_ID());
}
mv.addObject("appUser", appUser);
return mv;
}
@RequestMapping(value = "/toMyCollect")
public ModelAndView toMyCollect() throws Exception {
ModelAndView mv = this.getModelAndView();
//根据shiro管理的session取得用户信息
Subject currentUser = SecurityUtils.getSubject();
Session session = currentUser.getSession();
AppUser appUser = (AppUser) session.getAttribute(Const.SESSION_CUSTOMER_USER);
if (appUser != null) {
mv.addObject("USER_ID", appUser.getUSER_ID());
}
mv.addObject("appUser", appUser);
mv.setViewName("www/myCollect");
return mv;
}
@RequestMapping(value = "/doCollect")
public ModelAndView doCollect(PrintWriter out) throws Exception {
ModelAndView mv = this.getModelAndView();
// PageData pd = new PageData();
// pd = this.getPageData();
try {
//根据shiro管理的session取得用户信息
// Subject currentUser = SecurityUtils.getSubject();
// Session session = currentUser.getSession();
// AppUser appUser = (AppUser)session.getAttribute(Const.SESSION_CUSTOMER_USER);
//
// if(appUser != null){
// orderService.edit4Collect(pd);
// }
//
// mv.addObject("appUser", appUser);
//避免页面转发后乱码问题
mv.setViewName("redirect:/collect");
} catch (Exception e) {
log.error(e.toString(), e);
}
return mv;
}
@RequestMapping(value = "/collect")
public ModelAndView collect() throws Exception {
ModelAndView mv = this.getModelAndView();
PageData pd = new PageData();
pd = this.getPageData();
try {
//根据shiro管理的session取得用户信息
Subject currentUser = SecurityUtils.getSubject();
Session session = currentUser.getSession();
AppUser appUser = (AppUser) session.getAttribute(Const.SESSION_CUSTOMER_USER);
if (appUser != null) {
orderService.edit4Collect(pd);
}
mv.addObject("appUser", appUser);
mv.setViewName("www/myCollect");
} catch (Exception e) {
log.error(e.toString(), e);
}
return mv;
}
/**
* 客户端首页注册
*
* @return
* @throws Exception
*/
@RequestMapping(value = "/register")
public ModelAndView register() throws Exception {
ModelAndView mv = this.getModelAndView();
PageData pd = new PageData();
pd = this.getPageData();
pd.put("SYSNAME", Tools.readTxtFile(Const.SYSNAME)); //读取系统名称
setCustomerUserModel(mv);
mv.setViewName("www/register");
mv.addObject("pd", pd);
return mv;
}
private void setCustomerUserModel(ModelAndView mv) {
//根据shiro管理的session取得用户信息
Subject currentUser = SecurityUtils.getSubject();
Session session = currentUser.getSession();
AppUser appUser = (AppUser) session.getAttribute(Const.SESSION_CUSTOMER_USER);
if (appUser != null) {
mv.addObject("USER_ID", appUser.getUSER_ID());
}
mv.addObject("appUser", appUser);
}
/**
* 去关于我们页面信息展示
*
* @return
*/
@Re
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
网站信息管理系统模板 - 基于Java开发,包含844个文件,如PNG、JS、GIF、JSP、JAVA、JPG、CSS、SWF、XML和HTML等。该系统主要用于管理网站信息服务,提供了一个基础框架模板,为开发者提供了一个高效、易用的信息管理解决方案。
资源推荐
资源详情
资源评论
收起资源包目录
基于Java的网站信息管理系统模板设计源码 (853个子文件)
welcome.jsp.bak 18KB
ace.css 487KB
ace.min.css 135KB
bootstrap.css 128KB
bootstrap.min.css 106KB
bootstrap.min.css 103KB
style.css 82KB
icon.css 45KB
ueditor.css 41KB
form.css 34KB
ueditor.min.css 33KB
font-awesome.css 28KB
font-awesome-ie7.min.css 25KB
icomoon.css 23KB
video-js.css 22KB
ace-skins.min.css 18KB
font-awesome.css 18KB
bootstrap-responsive.min.css 16KB
bootstrap-responsive.min.css 16KB
datepicker.css 16KB
font-awesome.min.css 15KB
chosen.css 15KB
main.css 14KB
index.css 12KB
video-js.min.css 11KB
fullcalendar.css 11KB
animate-custom.css 9KB
ace-responsive.min.css 9KB
style.css 9KB
basic.css 7KB
zTreeStyle.css 7KB
shCoreDefault.css 7KB
zTreeStyle.css 6KB
position.css 6KB
video.css 5KB
colorbox.css 5KB
matrix-login.css 5KB
daterangepicker.css 4KB
aindex.css 4KB
index.css 4KB
ace-ie.min.css 4KB
zoomimage.css 3KB
image.css 3KB
newscenter.css 3KB
bootstrap-timepicker.css 3KB
recruitment.css 3KB
main.css 3KB
jquery-ui-1.10.2.custom.min.css 3KB
colorpicker.css 3KB
contactus.css 2KB
camera.css 2KB
emotion.css 2KB
jquery.gritter.css 2KB
common.css 2KB
custom.css 2KB
uploadify.css 2KB
dialogbase.css 2KB
code.css 2KB
investcases.css 1KB
recruitinner.css 1KB
aboutus.css 1KB
edittable.css 1KB
reset.css 1KB
prettify.css 869B
button.min.css 731B
newsinner.css 689B
investment.css 603B
webuploader.css 567B
businessarchi.css 432B
reset.css 312B
import_basic.css 180B
iframe.css 41B
import_skin.css 20B
zoomout.cur 326B
zoomin.cur 326B
Thumbs.db 161KB
Thumbs.db 27KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
fontawesome-webfont.eot 71KB
fontawesome-webfont.eot 55KB
icomoon-.eot 54KB
icomoon.eot 54KB
glyphicons-halflings-regular.eot 20KB
glyphicons-halflings-regular.eot 14KB
vjs.eot 3KB
docTemplate.ftl 212KB
jsp_list_Template.ftl 16KB
controllerTemplate.ftl 9KB
jsp_edit_Template.ftl 5KB
mapperOracleTemplate.ftl 2KB
mapperMysqlTemplate.ftl 2KB
serviceTemplate.ftl 2KB
oracle_SQL_Template.ftl 1KB
mysql_SQL_Template.ftl 578B
jiazai.gif 59KB
wface.gif 49KB
jxface2.gif 40KB
共 853 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9
资源评论
沐知全栈开发
- 粉丝: 4771
- 资源: 3372
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 简单的Python示例,演示了如何使用TCP/IP协议进行基本的客户端和服务器通信
- 考试.sql
- keil2 + proteus + 8051.exe
- 1961ee27df03bd4595d28e24b00dde4e_744c805f7e4fb4d40fa3f695bfbab035_8(1).c
- mediapipe-0.9.0.1-cp37-cp37m-win-amd64.whl.zip
- windows注册表编辑工具
- mediapipe-0.9.0.1-cp37-cp37m-win-amd64.whl.zip
- 校园通行码预约管理系统20240522075502
- 车类型数据集6250张VOC+YOLO格式.zip
- The PyTorch implementation of STGCN.STGCN-main.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功