该系统框架后端采用SpringBoot、Mybatis框架,前端使用thymeleaf、bootstrap,适合基础中等或以下,做类似理财系统,要求页面美观度高的同学。主要功能包括:用户信息管理、理财产品管理、网贷管理、权限管理等。
**
- 系统登录
**
**
- 管理员首页
**
**
- 银行卡管理
**
**
- 零钱理财
**
**
- 权限管理
**
**
- 新增理财
**
**
- 网贷申请
**
拦截器配置
package com.bjpowernode.finance.common;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* 登陆拦截器:未登录用户不能访问系统界面
*/
public class LoginHandlerInterceptor implements HandlerInterceptor {
//目标方法执行之前
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
Object user = request.getSession().getAttribute("loginUser");
Object admin = request.getSession().getAttribute("loginAdmin");
if(user == null&&admin==null){
//未登陆,返回登陆页面
request.setAttribute("msg","没有权限请先登陆");
System.out.println("LoginHandlerInterceptor.preHandle" + "----------------未登入------拦截请求--------------->");
response.sendRedirect("/");
return false;
}else{
//已登陆,放行请求
return true;
}
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
}
}
校验登录
@GetMapping("/verifyLogin")
@ResponseBody
public Msg verifyLogin(@RequestParam("username") String username, @RequestParam("password") String password,
HttpSession session) {
User loginUser = userService.selectUserByTerms(username, password);
if (loginUser != null) {
//获取当前用户
Subject subject = SecurityUtils.getSubject();
//封装用户登录数据
UsernamePasswordToken token = new UsernamePasswordToken(username, password);
try {
subject.login(token);
return Msg.success().add("url", "/user/index.html");
} catch (UnknownAccountException | IncorrectCredentialsException e) {
return Msg.fail();
}
}
Admin admin = adminService.selectAdminByTerms(username, password);
if (admin != null) {
//获取当前用户
Subject subject = SecurityUtils.getSubject();
//封装用户登录数据
UsernamePasswordToken token = new UsernamePasswordToken(username, password);
try {
subject.login(token);
return Msg.success().add("url", "/admin/index.html");
} catch (UnknownAccountException | IncorrectCredentialsException e) {
//model.addAttribute("msg","密码错误");
return Msg.fail();
}
}
return Msg.fail();
}
好了,以上就是系统的实现过程