作者主页:夜未央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

- @Controller
- public class LoginController {
- @Autowired
- private LoginServiceImpl loginService = null;
- /**
- * @Author: admin
- * @Description:
- * @Param: [request, response]
- * @Return: void
- **/
-
- //获取验证码
- @RequestMapping(value = "/changeCode.do")
- @ResponseBody
- public void getIdentifyingCode(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException
- {
- // 验证码存储在session的identifyingCode,属性中
- CaptchaUtil.outputCaptcha(request, response);
- }
-
- // 获取员工登陆界面
- @RequestMapping("/")
- public String getLoginPage(){
- return "employee/login.html";
- }
-
- // 获取管理员登陆界面
- @RequestMapping("/admin.do")
- public String getAdminLoginPage(){
- return "admin/adminLogin.html";
- }
-
- //员工登录判断
- @RequestMapping(value = "/employeeLogin.do")
- @ResponseBody
- public Map
employeeLogin(Model model, HttpSession httpSession, String username, - String password, String identifyingcode)
- {
- String code = (String) httpSession.getAttribute("identifyingCode");
- HashMap
map = new HashMap(); - if(identifyingcode.equalsIgnoreCase(code)){
- Employee employee = null;
- try {
- employee = loginService.findEmployeeByIdAndPassword(username, password);
- } catch (CustomException e) {
- map.put("msg",e.getMessage());
- map.put("status","500");
- return map;
- }
- // 保存到session
- httpSession.setAttribute("employeeId",employee.geteId());
- map.put("url","/ssm_esms/loginSuccess.do");
- map.put("msg","成功");
- map.put("status","200");
- return map;
- }else{
- map.put("msg","验证码错误");
- map.put("status","0");
- return map;
- }
- }
-
-
-
- @RequestMapping(value = "/loginSuccess.do")
- public String loginSucceses(Model model) throws Exception
- {
- return "employee/index.html";
- }
-
-
- //管理员登录判断
- @RequestMapping(value = "/adminLogin.do")
- @ResponseBody
- public Map
adminLogin(Model model, HttpSession httpSession, String username, - String password, String identifyingcode)
- {
- String code = (String) httpSession.getAttribute("identifyingCode");
- HashMap
map = new HashMap(); - if(identifyingcode.equalsIgnoreCase(code)){
- SystemManager manager = null;
- try {
- manager = loginService.findSystemManagerByIdAndPassword(username, password);
- } catch (CustomException e) {
- map.put("msg",e.getMessage());
- map.put("status","500");
- return map;
- }
- // 保存到session
- httpSession.setAttribute("admin",manager);
- map.put("url","toPage.do?url=admin/index.html");
- map.put("msg","成功");
- map.put("status","200");
- return map;
- }else{
- map.put("msg","验证码错误");
- map.put("status","0");
- return map;
- }
- }
- @RequestMapping(value = "/getAdminAccount.do")
- @ResponseBody
- public String getAdminAccount(HttpSession httpSession){
- SystemManager systemManager = (SystemManager) httpSession.getAttribute("admin");
- // SystemManager manager = loginService.findSystemManagerById(id);
- return systemManager.getSmAccount();
- }
-
- @RequestMapping(value = "/getEmployeeAccount.do")
- @ResponseBody
- public Map
getEmployeeAccount(HttpSession httpSession){ - Integer id = (Integer) httpSession.getAttribute("employeeId");
- Employee employee = loginService.findEmployeeById(id);
- HashMap
map = new HashMap(); - map.put("account",employee.geteAccount());
- map.put("name",employee.geteName());
- return map;
- }
- @RequestMapping(value = "/logout.do")
- public String logout(HttpSession httpSession){
- httpSession.removeAttribute("employeeId");
- return "redirect:/";
- }
-
- @RequestMapping(value = "/logoutAdmin.do")
- public String logoutAdmin(HttpSession httpSession){
- httpSession.removeAttribute("admin");
- return "redirect:/admin.do";
- }
- }
- @Controller
- public class DownloadExcelController {
- @Autowired
- private IDownloadExcelService downloadExcelService;
-
- @RequestMapping(value = "downloadExcel.do")
- public void downloadExcel(HttpServletRequest request, HttpServletResponse response,String eAccount,Integer dId,String sTime) throws Exception{
- downloadExcelService.getSalaryExcel(request,response,eAccount,dId,sTime) ;
- }
- }
- public class LoginInterceptor implements HandlerInterceptor {
- @Override
- public boolean preHandle(HttpServletRequest httpServletRequest,
- HttpServletResponse httpServletResponse, Object o) throws Exception {
- // String requestUri = httpServletRequest.getRequestURI();
- // String contextPath = httpServletRequest.getContextPath();
- // String url = requestUri.substring(contextPath.length());
- // System.out.println(url);
- // System.out.println(requestUri);
- // if ("/".equals(url)){
- // return true;
- // }
- // if ("/employeeLogin.do".equals(url)){
- // return true;
- // }else{
- String string = (String) httpServletRequest.getSession().getAttribute("employeeId");
- SystemManager systemManager = (SystemManager) httpServletRequest.getSession().getAttribute("admin");
- if (string != null) {
- return true;
- } else if (string == null){
- httpServletResponse.sendRedirect("/");
- return false;
- } else if (systemManager != null) {
- return true;
- } else {
- httpServletResponse.sendRedirect("/admin.do");
- return false;
- }
- }
-
- @Override
- public void postHandle(HttpServletRequest httpServletRequest,
- HttpServletResponse httpServletResponse,
- Object o, ModelAndView modelAndView) throws Exception {
-
- }
-
- @Override
- public void afterCompletion(HttpServletRequest httpServletRequest,
- HttpServletResponse httpServletResponse,
- Object o, Exception e) throws Exception {
-
- }
- }
如果也想学习本系统,下面领取。关注并回复:107ssm