• SSH智能社区住户信息管理系统


    作者主页:夜未央5788

     简介:Java领域优质创作者、Java项目、学习资料、技术互助

    文末获取源码

    项目介绍

    本项目为基于SSH的智能社区住户信息管理系统;
    管理员角色包含以下功能:
    管理员登录,小区信息管理,社区基本信息管理,居民管理,工作人员管理,房屋管理,停车位管理,居民收费管理,小区快递管理,用户管理,物业管理,一卡通管理,费用项目管理,报修管理,维修管理等功能。

    由于本程序规模不大,可供课程设计,毕业设计学习演示之用

    环境需要

    1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
    2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
    3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
    4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 
    5.数据库:MySql 5.7版本;

    6.是否Maven项目: 否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目

    技术栈

    1. 后端:Spring Struts Hibernate

    2. 前端:JSP+css+javascript+jQuery

    使用说明

    1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
    2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
    若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
    3. 将项目中hibernate.cfg.xml配置文件中的数据库配置改为自己的配置;
    4. 运行项目,在浏览器中输入http://localhost:8080/ 登录

    管理员账号/密码:admin/admin

    运行截图

     

     

     

     

     

     

    代码相关

    用户管理控制器

    1. public class UserAction extends ActionSupport {
    2. /**
    3. *
    4. */
    5. private static final long serialVersionUID = 1L;
    6. private List<UserBean> userList;// 用户信息集合
    7. private List<RoleBean> roleList;
    8. private UserBean model;
    9. private String id;
    10. private String tips;
    11. private PagerView pager = new PagerView();
    12. UserDao userDao;
    13. @Resource(name = "userDao")
    14. public void setUserDao(UserDao userDao) {
    15. this.userDao = userDao;
    16. }
    17. @Override
    18. public String execute() throws Exception {
    19. initData();
    20. return "success";
    21. }
    22. /**
    23. * 初始化数据
    24. */
    25. public void initData() {
    26. pager.setAllData(userDao.getDataNum());
    27. userList = userDao.getUserList(pager);
    28. roleList = userDao.getRoleList();
    29. }
    30. /**
    31. * 判断主键是否重复
    32. *
    33. * @throws IOException
    34. */
    35. public void exists() throws IOException {
    36. HttpServletResponse response = ServletActionContext.getResponse();
    37. PrintWriter out = response.getWriter();
    38. int result = userDao.exists(id) ? 1 : 0;
    39. out.print(result);
    40. out.flush();// 刷新
    41. out.close();// 关闭
    42. }
    43. /**
    44. * 物业费用信息添加
    45. *
    46. * @return 0[失败] >0[成功]
    47. */
    48. public String userAdd() {
    49. int result = 0;
    50. model.setUserPwd(EncryptHelper.md5(model.getUserPwd()));
    51. result = userDao.userAdd(model);
    52. if (result > 0) {
    53. tips = "添加成功!";
    54. } else {
    55. tips = "添加失败!";
    56. }
    57. initData();
    58. return "success";
    59. }
    60. /**
    61. * 删除单条信息
    62. *
    63. * @return true:删除成功;false:删除失败
    64. */
    65. public String delInfo() {
    66. int result = userDao.delInfo(id);
    67. if (result > 0) {
    68. setTips("删除成功!");
    69. } else {
    70. setTips("删除失败!");
    71. }
    72. initData();
    73. return "success";
    74. }
    75. /**
    76. * 删除所选中的记录
    77. *
    78. * @return
    79. */
    80. public String deleteUserLists() {
    81. HttpServletRequest request = ServletActionContext.getRequest();
    82. // 获取所选中的,名字叫delCost的复选框按钮的值
    83. String[] userList = request.getParameterValues("delUser");
    84. int result = 0;
    85. for (String item : userList) {
    86. result += userDao.delInfo(item);
    87. }
    88. this.tips = "成功删除了" + result + "条记录";
    89. initData();
    90. return "success";
    91. }
    92. /**
    93. * 根据费用编号获取要修改的物业费用信息
    94. *
    95. * @throws IOException
    96. */
    97. public void getUserModel() throws IOException {
    98. HttpServletResponse response = ServletActionContext.getResponse();
    99. response.setContentType("text/html");
    100. response.setCharacterEncoding("UTF-8");
    101. PrintWriter out = response.getWriter();// 获取out
    102. out.print(JSONObject.fromObject(userDao.getEditInfo(id)));
    103. out.flush();
    104. out.close();
    105. }
    106. /**
    107. * 修改物业费用信息
    108. *
    109. * @return 受影响的行数
    110. */
    111. public String userEdit() {
    112. int result = 0;
    113. model.setUserPwd(EncryptHelper.md5(model.getUserPwd()));
    114. result = userDao.userUpdate(model);
    115. if (result > 0) {
    116. tips = "修改成功!";
    117. } else {
    118. tips = "修改失败!";
    119. }
    120. initData();
    121. return "success";
    122. }
    123. public List<UserBean> getUserList() {
    124. return userList;
    125. }
    126. public void setCostList(List<UserBean> userList) {
    127. this.userList = userList;
    128. }
    129. public String getId() {
    130. return id;
    131. }
    132. public void setId(String id) {
    133. this.id = id;
    134. }
    135. public String getTips() {
    136. return tips;
    137. }
    138. public void setTips(String tips) {
    139. this.tips = tips;
    140. }
    141. public PagerView getPager() {
    142. return pager;
    143. }
    144. public void setPager(PagerView pager) {
    145. this.pager = pager;
    146. }
    147. /**
    148. * @return the roleList
    149. */
    150. public List<RoleBean> getRoleList() {
    151. return roleList;
    152. }
    153. /**
    154. * @param roleList
    155. * the roleList to set
    156. */
    157. public void setRoleList(List<RoleBean> roleList) {
    158. this.roleList = roleList;
    159. }
    160. /**
    161. * @return the model
    162. */
    163. public UserBean getModel() {
    164. return model;
    165. }
    166. /**
    167. * @param model
    168. * the model to set
    169. */
    170. public void setModel(UserBean model) {
    171. this.model = model;
    172. }
    173. /**
    174. * @param userList
    175. * the userList to set
    176. */
    177. public void setUserList(List<UserBean> userList) {
    178. this.userList = userList;
    179. }
    180. }

    登陆控制器

    1. @SuppressWarnings("serial")
    2. public class LoginAction extends ActionSupport implements SessionAware {
    3. private String tips;
    4. private List<UserBean> userlist;
    5. private UserBean model;
    6. private Map<String, Object> session;
    7. private PagerView pager = new PagerView();
    8. private String account;
    9. private String userPwd;
    10. private String userName;
    11. private String identityCard;
    12. private UserBean userbean = new UserBean();
    13. UserDao userDao;
    14. LoginDao loginDao;
    15. @Resource(name = "loginDao")
    16. public void setLogindao(LoginDao loginDao) {
    17. this.loginDao = loginDao;
    18. }
    19. @Override
    20. public String execute() throws Exception {
    21. return super.execute();
    22. }
    23. // 管理员登陆验证
    24. public String LoginUser() {
    25. if (loginDao.userLogin(account, EncryptHelper.md5(userPwd))) {
    26. HttpServletRequest request = ServletActionContext.getRequest();
    27. UserBean userbean = loginDao.getUserLoginInfo(account);
    28. request.getSession().setAttribute("identity", userbean);
    29. tips = "登录成功";
    30. return "bbb";
    31. } else {
    32. tips = "账号或密码错误!";
    33. return "ccc";
    34. }
    35. }
    36. /**
    37. * 重置密码
    38. *
    39. */
    40. public String reSet() {
    41. HttpServletRequest request = ServletActionContext.getRequest();
    42. HttpSession session = request.getSession();
    43. String userPwd = request.getParameter("userPwd");
    44. userbean = (UserBean) session.getAttribute("identity");
    45. int result = 0;
    46. result = loginDao.reSet(userbean.getUserId(), userPwd);
    47. if (result > 0) {
    48. } else {
    49. }
    50. tips = "请使用新密码登录!";
    51. return "ddd";
    52. }
    53. /*
    54. * public void userUpdate(){ HttpServletRequest request =
    55. * ServletActionContext.getRequest(); HttpSession session =
    56. * request.getSession(); UserBean model = new UserBean(); String userPwd =
    57. * (String)session.getAttribute("userPwd"); model =
    58. * loginDao.getUserLoginInfo(account); session.putValue("", model);
    59. * model.setUserPwd(userPwd); model.setAccount(account.toString());
    60. * userDao.userUpdate(model); }
    61. */
    62. public String userUpdate() {
    63. HttpServletRequest request = ServletActionContext.getRequest();
    64. /*
    65. * HttpSession session = request.getSession(); UserBean model = new
    66. * UserBean(); String userPwd = (String)session.getAttribute("userPwd");
    67. */
    68. model = loginDao.getUserLoginInfo(account);
    69. session.put("AdminMain", model);
    70. model.setUserPwd(EncryptHelper.md5(userPwd));
    71. model.setAccount(account.toString());
    72. model.setUserName(userName);
    73. model.setIdentityCard(identityCard);
    74. loginDao.update(model);
    75. return "ddd";
    76. }
    77. /**
    78. * 登出
    79. */
    80. public String loginOut() {
    81. HttpServletRequest request = ServletActionContext.getRequest();
    82. request.getSession().removeAttribute("identity");// 将登录信息移除
    83. return "ccc";
    84. }
    85. public String getAccount() {
    86. return account;
    87. }
    88. public void setAccount(String account) {
    89. this.account = account;
    90. }
    91. public void setSession(Map<String, Object> session) {
    92. this.session = session;
    93. }
    94. /**
    95. * @return the pager
    96. */
    97. public PagerView getPager() {
    98. return pager;
    99. }
    100. /**
    101. * @param pager
    102. * the pager to set
    103. */
    104. public void setPager(PagerView pager) {
    105. this.pager = pager;
    106. }
    107. /**
    108. * @return the userPwd
    109. */
    110. public String getUserPwd() {
    111. return userPwd;
    112. }
    113. /**
    114. * @param userPwd
    115. * the userPwd to set
    116. */
    117. public void setUserPwd(String userPwd) {
    118. this.userPwd = userPwd;
    119. }
    120. /**
    121. * @return the loginbean
    122. */
    123. /*
    124. * public LoginBean getLoginbean() { return loginbean; }
    125. */
    126. /**
    127. * @param loginbean
    128. * the loginbean to set
    129. */
    130. /*
    131. * public void setLoginbean(LoginBean loginbean) { this.loginbean =
    132. * loginbean; }
    133. */
    134. /**
    135. * @param userlist
    136. * the userlist to set
    137. */
    138. public void setUserlist(List<UserBean> userlist) {
    139. this.userlist = userlist;
    140. }
    141. /**
    142. * @return the userbean
    143. */
    144. public UserBean getUserbean() {
    145. return userbean;
    146. }
    147. /**
    148. * @param userbean
    149. * the userbean to set
    150. */
    151. public void setUserbean(UserBean userbean) {
    152. this.userbean = userbean;
    153. }
    154. /**
    155. * @return the model
    156. */
    157. public UserBean getModel() {
    158. return model;
    159. }
    160. /**
    161. * @return the userlist
    162. */
    163. public List<UserBean> getUserlist() {
    164. return userlist;
    165. }
    166. /**
    167. * @param model
    168. * the model to set
    169. */
    170. public void setModel(UserBean model) {
    171. this.model = model;
    172. }
    173. /**
    174. * @return the tips
    175. */
    176. public String getTips() {
    177. return tips;
    178. }
    179. /**
    180. * @param tips
    181. * the tips to set
    182. */
    183. public void setTips(String tips) {
    184. this.tips = tips;
    185. }
    186. /**
    187. * @return the session
    188. */
    189. public Map<String, Object> getSession() {
    190. return session;
    191. }
    192. /**
    193. * @return the userName
    194. */
    195. public String getUserName() {
    196. return userName;
    197. }
    198. /**
    199. * @param userName
    200. * the userName to set
    201. */
    202. public void setUserName(String userName) {
    203. this.userName = userName;
    204. }
    205. /**
    206. * @return the identityCard
    207. */
    208. public String getIdentityCard() {
    209. return identityCard;
    210. }
    211. /**
    212. * @param identityCard
    213. * the identityCard to set
    214. */
    215. public void setIdentityCard(String identityCard) {
    216. this.identityCard = identityCard;
    217. }
    218. }

     如果也想学习本系统,下面领取。回复:115ssh 

  • 相关阅读:
    图文并茂——队列的实现 ,C语言实现
    PostgreSQL-存储过程使用入门
    Spark 3.0 - 10.Ml 常用 Sample 采样方法
    力扣-删除有序数组中的重复项-Java
    Linux CC++ 网络编程博客
    基础知识汇总一
    字符串笔记-字符串哈希
    three.js学习笔记(十九)——后期处理
    【LeetCode】每日一题 2023_11_9 逃离火灾(bfs 练习)
    第58篇-京东滑块流程分析【2023-09-26】
  • 原文地址:https://blog.csdn.net/hanyunlong1989/article/details/125626980