package org.leopard.action.user;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import javax.servlet.http.HttpSession;
import net.sf.json.JSONArray;
import org.aspectj.util.FileUtil;
import org.hibernate.Session;
import org.leopard.action.BaseAction;
import org.leopard.model.dataDictionary.DataDictionary;
import org.leopard.model.menu.Menu;
import org.leopard.model.page.Page;
import org.leopard.model.role.Role;
import org.leopard.model.user.User;
import org.leopard.model.user.UserAttachFile;
import org.leopard.service.dataDictionary.DataDictionaryService;
import org.leopard.service.role.RoleService;
import org.leopard.service.user.UserService;
import org.leopard.utils.AntZipUtil;
import org.leopard.utils.ConstantUtils;
import org.leopard.utils.EnumFinal;
import org.leopard.utils.FileUtils;
import org.leopard.utils.InterfaceFinal;
import org.leopard.utils.MD5Utils;
import org.leopard.utils.PropertiesUtil;
import org.leopard.utils.ZipUtil;
/**
* 用户相关
* 注:请求http://loalhost:8080/user/userList.do进入主页面
*/
public class UserAction extends BaseAction{
/**把userService引入Action中*/
private UserService userService;
/**角色service*/
private RoleService roleService;
/**实例化user,引入user*/
private User user = new User();
/**获取用户列表的属性*/
private List<User> userList;
/**分页*/
private Page page;
/**ajax登录的时候判断是否是1*/
private int flag;
/**上传文件时接收文件的属性*/
private List<File> uploadFiles;
/**获取上传文件的文件名*/
private List<String> uploadFilesFileName;
/**负责获取用户附件列表的信息*/
private List<UserAttachFile> userAttachFiles;
/**获取用户的附件*/
private UserAttachFile userAttachFile = new UserAttachFile();
/**接收用于上传头像的属性*/
private File userPhotoFile;
/**负责获取用户上传头像文件的名称*/
private String userPhotoFileFileName;
/**是将项目统一用到的路径定义成全局常量*/
// private static final String path="d:/q_uploadFiles/";
/**接收json数据的变量*/
private String json;
/**注入数据字典中的service*/
private DataDictionaryService dataDictionaryService;
/**接收数据字典中的内容*/
private List<DataDictionary> dataDictionaryList;
/**在用户未登录的时候接收访问的url*/
private String prePage;
//用公共类获取想要的路径
String path=PropertiesUtil.getPath();
private DataDictionary dataDic=new DataDictionary();
public String exitFrame()
{
request.getSession().invalidate();
System.out.println("111111111111111**************");
return SUCCESS;
}
public void infoshow() {
System.out.println("+++++++++");
}
public void shows() {
System.out.println("+++++++++**********");
}
public void showstttt() {
System.out.println("+++++++++**********");
}
/**
* 在登录成功时将权限列表中的数据转化成json格式输出
* @param menuList
*
* @author 公司名 -- 用户名
*
* 2013-6-29 上午9:01:51
*/
public String tree()
{
List<Menu> menuList=(List<Menu>) request.getSession().getAttribute("menuList");
//将menuList转换成JSON数组形式
JSONArray fromObject = JSONArray.fromObject(menuList);
//将json转换成字符串为前台接收
json = fromObject.toString();
//输出json
System.out.println(json);
return SUCCESS;
}
public String infoout() {
return "666666666";
}
/**
* 因为框架在WEB-INF下所以一系列下的页面得进过Action
* 一下涉及到的方法有frameIndex,buttom,top,welcome
* @return
*
* @author 公司名 -- 用户名
*
* 2013-7-2 下午1:55:15
*/
public String frameIndex()
{
return SUCCESS;
}
public String buttom()
{
return SUCCESS;
}
public String top()
{
return SUCCESS;
}
public String mm() {
return "55555";
}
public String welcome()
{
return SUCCESS;
}
public String lodding()
{
return SUCCESS;
}
public String login()
{
return SUCCESS;
}
/**
* 当用户登录时的成功验证
* @throws Exception
*
* @author 公司名 -- 用户名
*
* 2013-7-2 下午1:58:05
*/
/**
* 这是在验证用户名的时候在struts.xml动态接受参数判断用户的验证结果,当然我自己用的是ajax方式登录的,
* 此时:我们应该明白redirect到login.jsp,并且能够显示错误信息的三种方法
*1.存入session
*2.ajax
*3.xml动态参数
*
* */
public String loginValidate() throws Exception
{
PrintWriter out = response.getWriter();
String code = (String) request.getSession().getAttribute("imageCode");
//将客户端输入的密码进行MD5加密
String userPwd= MD5Utils.toMD5(user.getUserPwd());
String imageCode=user.getImageCode();
if(code.equals(imageCode))
{ //验证码正确
user=userService.getUserInfo(user);
if(null!=user)
{ //用户名正确
System.out.println(MD5Utils.toMD5("123"));
if(userPwd.equals(user.getUserPwd()))
{//密码正确
System.out.println(MD5Utils.toMD5("123"));
request.getSession().setAttribute("userName", user);
List<Role> roleList=userService.getRoleListByUser(user);
List<Menu> menuList=roleService.getMenuListByRole(roleList);
System.out.println(menuList.size());
System.out.println(menuList.get(0).getMenuName());
request.getSession().setAttribute("menuList", menuList);
String retuenUrl = request.getParameter("returnURL");
System.out.println("sdggdfhsh"+retuenUrl);
if(null != retuenUrl && retuenUrl.length() >0)
{
//当未登录时的returnURL(这个是没用session的returnURL)
//out.print(InterfaceFinal.NO_LOGIN_RETURNURL);
}else{
out.print(ConstantUtils.LOGIN_SUCCESS);
}
}else{
//密码错误
out.print(ConstantUtils.PASSWORD_ERROR);
}
}else{
//用户名错误
out.print(ConstantUtils.USERNAME_ERROR);
}
}else{
//验证码错误
out.print(EnumFinal.VALIDATE_ERROR.getFlag());
}
return null;
}
/**
*
* 修改用户名的密码
*
* @author 公司名 -- 用户名
*
* 2013-6-26 下午7:48:27
*/
public void updateUserPwd()
{
//根据用户的id查看用户的信息
User userUpdatePwd = userService.getUserInfo(user.getId());
String password = userUpdatePwd.getUserPwd(); // 原密码
PrintWriter pw;
try {
pw = response.getWriter();
// 页面输入的密码和原密码不匹配
if (!password.equals(MD5Utils.toMD5(user.getOldPassword()))) {
pw.write("1");
} else {
//进行修改
user.setUserPwd(MD5Utils.toMD5(user.getUserPwd()));
userService.updateUserPwd(user);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
*
* 获取修改用户名修改的信息跳转到修改密码页面
* @return
* @throws Exception
*
* @author 公司名 -- 用户名
*
* 2013-6-26 下午7:48:58
*/
public String toUserUpdatePwd()
{
user = userService.getUserInfo(user.getId());
return "toUserUpdatePwd";
}
//添加
public String toaddUser() {
dataDictionaryList=dataDictionaryService.getDataDicList();
return SUCCESS;
}
/**
* 增加用户的一系列字段
* @return
*
* @author 公司名 -- 用户名
*
* 2013-7-2 下午1:58:48
*/
public String addUser() {
// 上传用户头像
String realPath=request.getRealPath("/");
String fileUUID=UUID.randomUUID().toString();
String fileSuffix=getSuffix(userPhotoFileFileName);
String photoName=fileUUID+fileSuffix;
FileUtils.upFile(userPhotoFile, photoName, realPath+"/photo/");
System.out.println(realPath+"/photo/");
//添加用户
user.setUserPhoto("/photo/"+photoName);
//将密码进行MD5加密并设置到数据库中
user.setUserPwd(MD5Utils.toMD5(user.getUserPwd()));
userService.addUser(user);
//上传用户附件
for(int i=0;i<uploadFiles.size();i++)
{
String uuid= UUID.randomUUID().toString();
Fi
没有合适的资源?快使用搜索试试~ 我知道了~
SSH框架+Quartz集群
共736个文件
svn-base:285个
class:78个
all-wcprops:66个
4星 · 超过85%的资源 需积分: 33 75 下载量 93 浏览量
2014-09-05
16:45:41
上传
评论
收藏 36MB RAR 举报
温馨提示
SSH框架,主要实现了OA中的RABC权限管理,整合了Quartz,并支持Quartz集群
资源推荐
资源详情
资源评论
收起资源包目录
SSH框架+Quartz集群 (736个子文件)
all-wcprops 7KB
all-wcprops 1KB
all-wcprops 1KB
all-wcprops 1010B
all-wcprops 990B
all-wcprops 964B
all-wcprops 935B
all-wcprops 888B
all-wcprops 824B
all-wcprops 812B
all-wcprops 678B
all-wcprops 669B
all-wcprops 658B
all-wcprops 657B
all-wcprops 594B
all-wcprops 552B
all-wcprops 508B
all-wcprops 504B
all-wcprops 484B
all-wcprops 456B
all-wcprops 447B
all-wcprops 442B
all-wcprops 442B
all-wcprops 429B
all-wcprops 413B
all-wcprops 413B
all-wcprops 412B
all-wcprops 412B
all-wcprops 412B
all-wcprops 412B
all-wcprops 404B
all-wcprops 400B
all-wcprops 384B
all-wcprops 384B
all-wcprops 384B
all-wcprops 384B
all-wcprops 383B
all-wcprops 376B
all-wcprops 363B
all-wcprops 295B
all-wcprops 272B
all-wcprops 272B
all-wcprops 272B
all-wcprops 272B
all-wcprops 258B
all-wcprops 254B
all-wcprops 254B
all-wcprops 254B
all-wcprops 244B
all-wcprops 242B
all-wcprops 240B
all-wcprops 234B
all-wcprops 228B
all-wcprops 224B
all-wcprops 220B
all-wcprops 214B
all-wcprops 208B
all-wcprops 107B
all-wcprops 107B
all-wcprops 105B
all-wcprops 103B
all-wcprops 102B
all-wcprops 101B
all-wcprops 99B
all-wcprops 97B
all-wcprops 91B
UserAction.class 15KB
AntZipUtil.class 9KB
UserDaoImpl.class 8KB
MD5Utils.class 8KB
FileUtils.class 6KB
User.class 5KB
RoleDaoImpl.class 5KB
DataDictionaryDaoImpl.class 4KB
ZipUtil.class 4KB
MenuAction.class 4KB
UserServiceImpl.class 4KB
ImageCodeServlet.class 4KB
LoginInterceotor.class 3KB
UserRoleAction.class 3KB
DataDictionaryAction.class 3KB
RoleServiceImpl.class 3KB
RoleAction.class 3KB
DataDictionaryServiceImpl.class 3KB
MyDetailQuartzJobBean.class 3KB
RoleDaoImpl$6.class 3KB
UserDaoImpl$8.class 2KB
BaseAction.class 2KB
RoleDaoImpl$1.class 2KB
MenuDaoImpl.class 2KB
UserRoleServiceImp.class 2KB
DataDictionaryDaoImpl$1.class 2KB
DataDictionaryDaoImpl$3.class 2KB
RoleMenuAction.class 2KB
RoleDaoImpl$5.class 2KB
UserRole.class 2KB
UserRoleDaoImp$1.class 2KB
DataDictionaryDaoImpl$2.class 2KB
Menu.class 2KB
RoleDaoImpl$4.class 2KB
共 736 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
- pbppoppa2018-03-20东西太多,我其实只想看集群quartz怎么实现。
- 佳艳2016-07-21感谢分享!有用
- liang_Henry2018-03-14下的时候忘记评论了。补充一下。仅供参考学习。
- bflcf0102015-05-06无数据库文件,无法调试
shaoyncsdn
- 粉丝: 3
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功