package com.fh.controller.system.user;
import java.io.PrintWriter;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
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.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import com.fh.controller.base.BaseController;
import com.fh.entity.Page;
import com.fh.entity.system.Menu;
import com.fh.entity.system.Role;
import com.fh.service.system.menu.MenuService;
import com.fh.service.system.role.RoleService;
import com.fh.service.system.user.UserService;
import com.fh.util.AppUtil;
import com.fh.util.Const;
import com.fh.util.FileDownload;
import com.fh.util.FileUpload;
import com.fh.util.GetPinyin;
import com.fh.util.ObjectExcelRead;
import com.fh.util.PageData;
import com.fh.util.ObjectExcelView;
import com.fh.util.PathUtil;
import com.fh.util.Tools;
/**
* 类名称:UserController
* 创建人:FH
* 创建时间:2014年6月28日
* @version
*/
@Controller
@RequestMapping(value="/user")
public class UserController extends BaseController {
@Resource(name="userService")
private UserService userService;
@Resource(name="roleService")
private RoleService roleService;
@Resource(name="menuService")
private MenuService menuService;
/**
* 保存用户
*/
@RequestMapping(value="/saveU")
public ModelAndView saveU(PrintWriter out) throws Exception{
ModelAndView mv = this.getModelAndView();
PageData pd = new PageData();
pd = this.getPageData();
pd.put("USER_ID", this.get32UUID()); //ID
pd.put("RIGHTS", ""); //权限
pd.put("LAST_LOGIN", ""); //最后登录时间
pd.put("IP", ""); //IP
pd.put("STATUS", "0"); //状态
pd.put("SKIN", "default"); //默认皮肤
pd.put("PASSWORD", new SimpleHash("SHA-1", pd.getString("USERNAME"), pd.getString("PASSWORD")).toString());
if(null == userService.findByUId(pd)){
userService.saveU(pd);
mv.addObject("msg","success");
}else{
mv.addObject("msg","failed");
}
mv.setViewName("save_result");
return mv;
}
/**
* 判断用户名是否存在
*/
@RequestMapping(value="/hasU")
public void hasU(PrintWriter out){
PageData pd = new PageData();
try{
pd = this.getPageData();
if(userService.findByUId(pd) != null){
out.write("error");
}else{
out.write("success");
}
out.close();
} catch(Exception e){
logger.error(e.toString(), e);
}
}
/**
* 判断邮箱是否存在
*/
@RequestMapping(value="/hasE")
public void hasE(PrintWriter out){
PageData pd = new PageData();
try{
pd = this.getPageData();
if(userService.findByUE(pd) != null){
out.write("error");
}else{
out.write("success");
}
out.close();
} catch(Exception e){
logger.error(e.toString(), e);
}
}
/**
* 判断编码是否存在
*/
@RequestMapping(value="/hasN")
public void hasN(PrintWriter out){
PageData pd = new PageData();
try{
pd = this.getPageData();
if(userService.findByUN(pd) != null){
out.write("error");
}else{
out.write("success");
}
out.close();
} catch(Exception e){
logger.error(e.toString(), e);
}
}
/**
* 修改用户
*/
@RequestMapping(value="/editU")
public ModelAndView editU(PrintWriter out) throws Exception{
ModelAndView mv = this.getModelAndView();
PageData pd = new PageData();
pd = this.getPageData();
if(pd.getString("PASSWORD") != null && !"".equals(pd.getString("PASSWORD"))){
pd.put("PASSWORD", new SimpleHash("SHA-1", pd.getString("USERNAME"), pd.getString("PASSWORD")).toString());
}
userService.editU(pd);
mv.addObject("msg","success");
mv.setViewName("save_result");
return mv;
}
/**
* 去修改用户页面
*/
@RequestMapping(value="/goEditU")
public ModelAndView goEditU() throws Exception{
ModelAndView mv = this.getModelAndView();
PageData pd = new PageData();
pd = this.getPageData();
//顶部修改个人资料
String fx = pd.getString("fx");
//System.out.println(fx);
if("head".equals(fx)){
mv.addObject("fx", "head");
}else{
mv.addObject("fx", "user");
}
List<Role> roleList = roleService.listAllERRoles(); //列出所有二级角色
pd = userService.findByUiId(pd); //根据ID读取
mv.setViewName("system/user/user_edit");
mv.addObject("msg", "editU");
mv.addObject("pd", pd);
mv.addObject("roleList", roleList);
return mv;
}
/**
* 去新增用户页面
*/
@RequestMapping(value="/goAddU")
public ModelAndView goAddU()throws Exception{
ModelAndView mv = this.getModelAndView();
PageData pd = new PageData();
pd = this.getPageData();
List<Role> roleList;
roleList = roleService.listAllERRoles(); //列出所有二级角色
mv.setViewName("system/user/user_edit");
mv.addObject("msg", "saveU");
mv.addObject("pd", pd);
mv.addObject("roleList", roleList);
return mv;
}
/**
* 显示用户列表(用户组)
*/
@RequestMapping(value="/listUsers")
public ModelAndView listUsers(Page page)throws Exception{
ModelAndView mv = this.getModelAndView();
PageData pd = new PageData();
pd = this.getPageData();
String USERNAME = pd.getString("USERNAME");
if(null != USERNAME && !"".equals(USERNAME)){
USERNAME = USERNAME.trim();
pd.put("USERNAME", USERNAME);
}
String lastLoginStart = pd.getString("lastLoginStart");
String lastLoginEnd = pd.getString("lastLoginEnd");
if(lastLoginStart != null && !"".equals(lastLoginStart)){
lastLoginStart = lastLoginStart+" 00:00:00";
pd.put("lastLoginStart", lastLoginStart);
}
if(lastLoginEnd != null && !"".equals(lastLoginEnd)){
lastLoginEnd = lastLoginEnd+" 00:00:00";
pd.put("lastLoginEnd", lastLoginEnd);
}
page.setPd(pd);
List<PageData> userList = userService.listPdPageUser(page); //列出用户列表
List<Role> roleList = roleService.listAllERRoles(); //列出所有二级角色
/*调用权限*/
this.getHC(); //================================================================================
/*调用权限*/
mv.setViewName("system/user/user_list");
mv.addObject("userList", userList);
mv.addObject("roleList", roleList);
mv.addObject("pd", pd);
return mv;
}
/**
* 显示用户列表(tab方式)
*/
@RequestMapping(value="/listtabUsers")
public ModelAndView listtabUsers(Page page)throws Exception{
ModelAndView mv = this.getModelAndView();
PageData pd = new PageData();
pd = this.getPageData();
List<PageData> userList = userService.listAllUser(pd); //列出用户列表
/*调用权限*/
this.getHC(); //================================================================================
/*调用权限*/
mv.setViewName("system/user/user_tb_list");
mv.addObject("userList", userList);
mv.addObject("pd", pd);
return mv;
}
/**
* 删除用户
*/
@RequestMapping(value="/deleteU")
public void deleteU(PrintWriter out){
PageData pd =
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
代码是我在淘宝上购买的,用来学习,资料齐全,分享给大家 .权限完善(增删改查权限方法中再校验) .代码生成器增加表前缀维护 .界面新增微信模块(文本回复、图文回复、应用命令) .加入二维码模块 .地图工具 .系统设置加入图片水印设置 .系统设置加入微信接口设置 .加入EHCACHE缓存配置 .主框架改为 restful 风格 .增加接口测试模块 .增加独立发送邮件模块 .增加兼容jdk6,tomcat6 .优化兼容linux .代码目录结构完善了一些 .新增图片管理模块 .jsp页面放入 WEB-INF 目录下 .登录异步验证 .加入标签页功能
资源推荐
资源详情
资源评论
收起资源包目录
spring mvc bootstrap后台框架 (858个子文件)
UserController.class 13KB
RoleController.class 12KB
LoginController.class 12KB
WeixinController.class 11KB
PicturesController.class 11KB
AppuserController.class 10KB
Uploader.class 10KB
HeadController.class 10KB
PagePlugin.class 9KB
Page.class 8KB
SmsUtil.class 6KB
Tools.class 6KB
MenuController.class 6KB
DictionariesController.class 6KB
FileUtil.class 5KB
SimpleMailSender.class 5KB
RoleService.class 5KB
AppUtil.class 5KB
LoginHandlerInterceptor.class 5KB
ObjectExcelView.class 4KB
CreateCodeController.class 4KB
SecCodeController.class 4KB
WeixinController$1.class 4KB
PageData.class 4KB
DateUtil.class 4KB
GetPinyin.class 4KB
JPushClientUtil.class 3KB
UserService.class 3KB
Freemarker.class 3KB
ObjectExcelRead.class 3KB
DaoSupport.class 3KB
MapDistance.class 3KB
MenuService.class 3KB
MailSenderInfo.class 3KB
AppuserService.class 3KB
Menu.class 3KB
PathUtil.class 3KB
User.class 3KB
SortUtil.class 3KB
PicturesService.class 2KB
Const.class 2KB
FileZip.class 2KB
ImageAnd64Binary.class 2KB
Logger.class 2KB
FileUpload.class 2KB
Role.class 2KB
WebSocket.class 2KB
DictionariesService.class 2KB
BaseController.class 2KB
AppKuController.class 2KB
DelAllFile.class 2KB
ReflectHelper.class 2KB
LatLonUtil.class 2KB
FileDownload.class 2KB
RequestUtil.class 2KB
MD5.class 2KB
MyExceptionResolver.class 2KB
RightsHelper.class 2KB
startFilter.class 2KB
ShiroRealm.class 2KB
PublicUtil.class 1KB
LoginFilter.class 1KB
WeixinController$2.class 1KB
ServiceHelper.class 1KB
Constants.class 1KB
StringUtil.class 1KB
WebAppContextListener.class 1KB
MyX509TrustManager.class 915B
UuidUtil.class 906B
MyAuthenticator.class 776B
startFilter$1.class 558B
DAO.class 466B
.classpath 829B
org.eclipse.wst.common.component 563B
org.eclipse.wst.jsdt.ui.superType.container 49B
ace.css 458KB
ace.min.css 135KB
ace.min.css 135KB
bootstrap.min.css 106KB
bootstrap.min.css 103KB
bootstrap.min.css 103KB
style.css 76KB
icon.css 45KB
ueditor.css 43KB
form.css 34KB
ueditor.min.css 33KB
font-awesome.css 26KB
font-awesome-ie7.min.css 25KB
font-awesome-ie7.min.css 25KB
video-js.css 21KB
font-awesome.css 19KB
ace-skins.min.css 18KB
ace-skins.min.css 18KB
bootstrap-responsive.min.css 16KB
bootstrap-responsive.min.css 16KB
bootstrap-responsive.min.css 16KB
datepicker.css 16KB
datepicker.css 16KB
font-awesome.min.css 15KB
font-awesome.min.css 15KB
共 858 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9
1234434343
- 粉丝: 0
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页