• Java项目:SSM律师事务所律师管理系统


    作者主页:夜未央5788

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

    文末获取源码

    项目介绍

    本项目包含管理员与用户两种角色;

    管理员角色包含以下功能:

    管理员登录,律师信息管理,预约审核管理,预约记录查看,拒绝预约查询,注册一个用户,个人信息修改等功能。

    用户角色包含以下功能:
    用户登录,律师信息查看,预约记录查询,预约某一个律师,取消预约管理,个人信息修改等功能。

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

    环境需要

    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项目:是;

    技术栈

    1. 后端:Spring+SpringMVC+Mybatis

    2. 前端:JSP+CSS+JavaScript+jQuery+bootstrap

    使用说明

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

    4. 运行项目,输入localhost:8080/ssm_lvshi_yuyue 登录
    管理员账号/密码:admin/admin
    用户账号/密码: user/123456 

    运行截图
    管理员角色

     

     

     

     

    用户页面

     

     

     

     

    代码相关

    登录管理控制器

    1. @Controller
    2. public class LoginController {
    3. @Autowired
    4. private LoginServiceImpl loginService = null;
    5. /**
    6. * @Author: admin
    7. * @Description:
    8. * @Param: [request, response]
    9. * @Return: void
    10. **/
    11. //获取验证码
    12. @RequestMapping(value = "/changeCode.do")
    13. @ResponseBody
    14. public void getIdentifyingCode(HttpServletRequest request, HttpServletResponse response)
    15. throws ServletException, IOException
    16. {
    17. // 验证码存储在session的identifyingCode,属性中
    18. CaptchaUtil.outputCaptcha(request, response);
    19. }
    20. // 获取员工登陆界面
    21. @RequestMapping("/")
    22. public String getLoginPage(){
    23. return "employee/login.html";
    24. }
    25. // 获取管理员登陆界面
    26. @RequestMapping("/admin.do")
    27. public String getAdminLoginPage(){
    28. return "admin/adminLogin.html";
    29. }
    30. //员工登录判断
    31. @RequestMapping(value = "/employeeLogin.do")
    32. @ResponseBody
    33. public Map employeeLogin(Model model, HttpSession httpSession, String username,
    34. String password, String identifyingcode)
    35. {
    36. String code = (String) httpSession.getAttribute("identifyingCode");
    37. HashMap map = new HashMap();
    38. if(identifyingcode.equalsIgnoreCase(code)){
    39. Employee employee = null;
    40. try {
    41. employee = loginService.findEmployeeByIdAndPassword(username, password);
    42. } catch (CustomException e) {
    43. map.put("msg",e.getMessage());
    44. map.put("status","500");
    45. return map;
    46. }
    47. // 保存到session
    48. httpSession.setAttribute("employeeId",employee.geteId());
    49. map.put("url","/ssm_esms/loginSuccess.do");
    50. map.put("msg","成功");
    51. map.put("status","200");
    52. return map;
    53. }else{
    54. map.put("msg","验证码错误");
    55. map.put("status","0");
    56. return map;
    57. }
    58. }
    59. @RequestMapping(value = "/loginSuccess.do")
    60. public String loginSucceses(Model model) throws Exception
    61. {
    62. return "employee/index.html";
    63. }
    64. //管理员登录判断
    65. @RequestMapping(value = "/adminLogin.do")
    66. @ResponseBody
    67. public Map adminLogin(Model model, HttpSession httpSession, String username,
    68. String password, String identifyingcode)
    69. {
    70. String code = (String) httpSession.getAttribute("identifyingCode");
    71. HashMap map = new HashMap();
    72. if(identifyingcode.equalsIgnoreCase(code)){
    73. SystemManager manager = null;
    74. try {
    75. manager = loginService.findSystemManagerByIdAndPassword(username, password);
    76. } catch (CustomException e) {
    77. map.put("msg",e.getMessage());
    78. map.put("status","500");
    79. return map;
    80. }
    81. // 保存到session
    82. httpSession.setAttribute("admin",manager);
    83. map.put("url","toPage.do?url=admin/index.html");
    84. map.put("msg","成功");
    85. map.put("status","200");
    86. return map;
    87. }else{
    88. map.put("msg","验证码错误");
    89. map.put("status","0");
    90. return map;
    91. }
    92. }
    93. @RequestMapping(value = "/getAdminAccount.do")
    94. @ResponseBody
    95. public String getAdminAccount(HttpSession httpSession){
    96. SystemManager systemManager = (SystemManager) httpSession.getAttribute("admin");
    97. // SystemManager manager = loginService.findSystemManagerById(id);
    98. return systemManager.getSmAccount();
    99. }
    100. @RequestMapping(value = "/getEmployeeAccount.do")
    101. @ResponseBody
    102. public Map getEmployeeAccount(HttpSession httpSession){
    103. Integer id = (Integer) httpSession.getAttribute("employeeId");
    104. Employee employee = loginService.findEmployeeById(id);
    105. HashMap map = new HashMap();
    106. map.put("account",employee.geteAccount());
    107. map.put("name",employee.geteName());
    108. return map;
    109. }
    110. @RequestMapping(value = "/logout.do")
    111. public String logout(HttpSession httpSession){
    112. httpSession.removeAttribute("employeeId");
    113. return "redirect:/";
    114. }
    115. @RequestMapping(value = "/logoutAdmin.do")
    116. public String logoutAdmin(HttpSession httpSession){
    117. httpSession.removeAttribute("admin");
    118. return "redirect:/admin.do";
    119. }
    120. }

     下载管理控制器

    1. @Controller
    2. public class DownloadExcelController {
    3. @Autowired
    4. private IDownloadExcelService downloadExcelService;
    5. @RequestMapping(value = "downloadExcel.do")
    6. public void downloadExcel(HttpServletRequest request, HttpServletResponse response,String eAccount,Integer dId,String sTime) throws Exception{
    7. downloadExcelService.getSalaryExcel(request,response,eAccount,dId,sTime) ;
    8. }
    9. }

    登录拦截器

    1. public class LoginInterceptor implements HandlerInterceptor {
    2. @Override
    3. public boolean preHandle(HttpServletRequest httpServletRequest,
    4. HttpServletResponse httpServletResponse, Object o) throws Exception {
    5. // String requestUri = httpServletRequest.getRequestURI();
    6. // String contextPath = httpServletRequest.getContextPath();
    7. // String url = requestUri.substring(contextPath.length());
    8. // System.out.println(url);
    9. // System.out.println(requestUri);
    10. // if ("/".equals(url)){
    11. // return true;
    12. // }
    13. // if ("/employeeLogin.do".equals(url)){
    14. // return true;
    15. // }else{
    16. String string = (String) httpServletRequest.getSession().getAttribute("employeeId");
    17. SystemManager systemManager = (SystemManager) httpServletRequest.getSession().getAttribute("admin");
    18. if (string != null) {
    19. return true;
    20. } else if (string == null){
    21. httpServletResponse.sendRedirect("/");
    22. return false;
    23. } else if (systemManager != null) {
    24. return true;
    25. } else {
    26. httpServletResponse.sendRedirect("/admin.do");
    27. return false;
    28. }
    29. }
    30. @Override
    31. public void postHandle(HttpServletRequest httpServletRequest,
    32. HttpServletResponse httpServletResponse,
    33. Object o, ModelAndView modelAndView) throws Exception {
    34. }
    35. @Override
    36. public void afterCompletion(HttpServletRequest httpServletRequest,
    37. HttpServletResponse httpServletResponse,
    38. Object o, Exception e) throws Exception {
    39. }
    40. }

     

    如果也想学习本系统,下面领取。关注并回复:107ssm 

  • 相关阅读:
    企业级自定义表单引擎解决方案(十四)--表单模板2
    springboot教务评教系统毕业设计源码252116
    主线程和子线程的关系(讨论主线程结束,子线程是否要回收)
    【python海洋专题九】Cartopy画地形等深线图
    代码随想录第二天
    08-RabbitMQ使用中的常见问题
    Go--切片,append
    python 自(3)1使用urlencode多个参数请求使用 2百度翻译post请求post无法添加路径 3百度翻译全部数据获取 4豆瓣get请
    R语言编写自定义的二元运算符:R将百分号(%…%)之间的任何文本识别为二元运算符
    百分位(P95,P99)统计awk脚本
  • 原文地址:https://blog.csdn.net/hanyunlong1989/article/details/126613748