基于javaweb+mysql的springboot理财管理系统设计和实现(java+springboot+ssm+thymeleaf+html)

基于javaweb+mysql的springboot理财管理系统设计和实现(java+springboot+ssm+thymeleaf+html)

私信源码获取及调试交流

运行环境

Java≥8、MySQL≥5.7

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

基于javaweb的SpringBoot理财管理系统设计和实现(java+springboot+ssm+thymeleaf+html)

spring boot,spring,spring mvc,mybatis,shiro框架分页处理使用了pagehelper进行操作,前台使用了模板语言thymeleaf,界面较为炫酷,适合年轻朋友。开发工具采用的是IDEA。该系统主要解决了理财中的一些问题,包含功能:权限管理,用户信息管理,理财产品管理等内容。

主要分为管理员和普通用户两种用户;

1.管理员模块主要包括:

用户信息管理:用户信息、银行卡、个人征信;

理财产品管理:零钱理财、工资理财、期限理财、基金理财、精选银行;

权限管理:用户权限、管理员权限

网贷管理:网贷审核、网贷信息;

2.普通用户模块主要包括

个人理财:零钱理财、工资理财、期限理财、基金理财、银行推荐;

金融工具:资金记录、安全网贷;

个人中心:我的理财、我的借贷、银行卡管理、账户安全;


@Controller
public class ChangeMoneyController {
    @Autowired
    ChangeMoneyService changeMoneyService;
    @Autowired
    UserChangeMoneyService userChangeMoneyService;
    @Autowired
    FlowOfFundsService flowOfFundsService;

    /**
     * 跳转到零钱理财界面(用户)
     * @param model
     * @return
     */
    @RequestMapping("/user/finance/toChangeMoney.html")
    public String toChangemoney(Model model){
        List<ChangeMoney> list = changeMoneyService.selectAllChangeMoney();
        model.addAttribute("changeMoneyList",list);
        model.addAttribute("pageTopBarInfo","零钱理财界面");
        model.addAttribute("activeUrl1","financeActive");
        model.addAttribute("activeUrl2","changeMoneyActive");
        return "/user/finance/changemoney";
    }

    /**
     * 买入工资理财产品
     * @param changeMoneyId
     * @param userId
        Integer result = userChangeMoneyService.insertUserChangeMoney(ucm);
        if (result==1){
            FlowOfFunds fof = new FlowOfFunds();
            fof.setUserid(userId);
            fof.setFlowmoney(cm.getInvesmoney());
            fof.setType(1);
            fof.setSource(cm.getName());
            fof.setCreatetime(new Date());
            fof.setFunddesc("无");
            flowOfFundsService.insertFlowOfFunds(fof);
            return Msg.success();
        }else {
            return Msg.fail();
        }
    }

    /**
     * 跳转到零钱理财管理界面(管理员)
     * @param pageNum
     * @param pageSize
     * @param model
     * @param session
     * @return
     */
    @GetMapping("/admin/finance/toChangeMoney.html")
    public String toUserInfo(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                             @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
                             Model model, HttpSession session) {
        PageHelper.startPage(pageNum, pageSize);
        List<ChangeMoney> list = changeMoneyService.selectAllChangeMoney();
        PageInfo<ChangeMoney> pageInfo = new PageInfo<ChangeMoney>(list, 5);
        model.addAttribute("finacnePageInfo",pageInfo);
        model.addAttribute("financeList",list);

        model.addAttribute("activeUrl1", "financeActive");
        model.addAttribute("activeUrl2", "changemoneyActive");
        model.addAttribute("pageTopBarInfo", "零钱理财管理界面");
        return "/admin/finance/changemoney";
    }

    /**
     * 新增零钱理财产品
     * @param changeMoney
     * @return
     */
    @PostMapping("/admin/addChangeMoney")
        List<TermFinancial> list = termFinancialService.selectAllTermFinancial();
        model.addAttribute("termFinancialList", list);
        model.addAttribute("pageTopBarInfo", "期限理财界面");
        model.addAttribute("activeUrl1", "financeActive");
        model.addAttribute("activeUrl2", "termFinancialActive");
        return "/user/finance/termfinancial";
    }

    /**
     * 购买工资理财产品
     *
     * @param termFinancialId
     * @param userId
     * @return
     */
    @PostMapping("/user/buyTermFinancial")
    @ResponseBody
    public Msg buyTermFinancial(@RequestParam("termFinancialId") Integer termFinancialId,
                                @RequestParam("userId") Integer userId) {
        UserTermFinancial utf = new UserTermFinancial();
        utf.setUserid(userId);
        utf.setTermid(termFinancialId);
        utf.setStarttime(new Date());
        TermFinancial tf = termFinancialService.selectTermFinancialById(termFinancialId);
        utf.setAveryield(tf.getAnnualincome());
        utf.setProfit(tf.getAnnualincome().multiply(tf.getLeastmoney()));
        utf.setStatus(1);
        Integer result = userTermFinancialService.insertUserTermFinancial(utf);
        if (result == 1) {
            FlowOfFunds fof = new FlowOfFunds();
            fof.setUserid(userId);
            fof.setFlowmoney(tf.getLeastmoney());
            fof.setType(1);
            fof.setSource(tf.getName());
            fof.setCreatetime(new Date());
            fof.setFunddesc("无");
            flowOfFundsService.insertFlowOfFunds(fof);
            return Msg.success();
        }
        return Msg.fail();
    }

    /**
     * 跳转到期限理财管理界面(管理员)
     * @param pageNum
     * @param pageSize
     * @param model
        if (result == 1) {
            return Msg.success();
        }
        return Msg.fail();
    }

    /**
     * 修改银行卡时回显银行卡信息
     *
     * @param id
     * @return
     */
    @GetMapping("/user/getBankCardById/{id}")
    @ResponseBody
    public Msg getBankCardById(@PathVariable("id") Integer id) {
        Bankcard bankcard = bankCardService.selectBankCardById(id);
        return Msg.success().add("bankcard", bankcard);
    }

    /**
     * 修改银行卡信息
     *
     * @param id
     * @param bankcard
     * @return
     */
    @PutMapping("/user/updateBankCard/{update-id}")
    @ResponseBody
    public Msg updateBankCard(@PathVariable("update-id") Integer id, Bankcard bankcard) {
        bankcard.setId(id);
        Integer result = bankCardService.updateBankCard(bankcard);
        if (result == 1) {
            return Msg.success();
        }
        return Msg.fail();
    }

    /**
     * 删除银行卡
     *
     * @param id
     * @return
     */
    @DeleteMapping("/user/deleteBankCard/{id}")
    @ResponseBody
    public Msg deleteBankCard(@PathVariable("id") Integer id) {
        Integer result = bankCardService.deleteBankCardById(id);
        fundProduct.setId(id);
        Integer result = fundProductService.updateFundProduct(fundProduct);
        if (result==1){
            return Msg.success();
        }
        return Msg.fail();
    }

    /**
     * 删除
     * @param id
     * @return
     */
    @DeleteMapping("/admin/deleteFundProductById/{id}")
    @ResponseBody
    public Msg deleteFundProductById(@PathVariable("id") Integer id){
        Integer result = fundProductService.deleteFundProductById(id);
        if (result==1){
            return Msg.success();
        }
        return Msg.fail();
    }
}

@Controller

@Controller
@RequestMapping("/login")
public class LoginController {
    @Autowired
    UserService userService;

    @Autowired
    AdminService adminService;

    //public static final Map<String, HttpSession> USR_SESSION = new HashMap<>();
    public static String last_login = "";

    @GetMapping("/loginVerifyUsername/{username}")
    @ResponseBody
    public Msg loginVerifyUsername(@PathVariable("username") String username) {
        User user = userService.selectUserByTerms(username, null);
        if (user != null) {
            return Msg.success();
        }
        Admin admin = adminService.selectAdminByTerms(username, null);
        if (admin != null) {
            return Msg.success();
        }
        return Msg.fail();
    }

    @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();
     * @param session
     * @return
     */
    @GetMapping("/admin/permission/toUserPermissions.html")
    public String toUserPermission(Model model, HttpSession session) {
        List<UserPermissions> list = userPermissionsService.selectUserPermissionsByUserId(1);
        ArrayList<String> list2 = new ArrayList<>();
        for (UserPermissions userPermissions : list) {
            list2.add(userPermissions.getPermissions().getPermission());
        }
        model.addAttribute("permissionsList", list2);
        //session.setAttribute("permissionsList",list);

        model.addAttribute("activeUrl1", "permissionActive");
        model.addAttribute("activeUrl2", "userPermissionsActive");
        model.addAttribute("pageTopBarInfo", "用户权限管理界面");
        return "/admin/permission/userpermissions";
    }

    /**
     * 更新用户权限
     * @param userPermissions
     * @return
     */
    @PutMapping("/admin/updateUserPermissions")
    @ResponseBody
    public Msg updateUserPermissions(@RequestParam("userPermissions")String userPermissions){
        String[] strings = userPermissions.split(";");
        //System.out.println(strings.length+":"+ Arrays.toString(strings));
        userPermissionsService.deleteAllUserPermissionsByUserId(1);
        for (String string : strings) {
            UserPermissions up = new UserPermissions();
            up.setUserid(1);
            up.setPermissionid(permissionsService.selectPermissionsByPermission(string).get(0).getId());
            userPermissionsService.insertUserPermissions(up);
        }
        return Msg.success();
    }

    @GetMapping("/admin/permission/toAdminPermissions.html")
    public String toAdminPermission(Model model, HttpSession session) {
        List<AdminPermissions> list = adminPermissionsService.selectAdminPermissionsByAdminId(1);
        ArrayList<String> list2 = new ArrayList<>();
        for (AdminPermissions adminPermissions : list) {
        Info info = infoService.selectInfoById(id);
        info.setStatus(1);
        Integer result = infoService.updateInfo(info);
        if (result == 1) {
            return Msg.success();
        }
        return Msg.fail();
    }

    /**
     * 删除消息
     * @param id
     * @return
     */
    @DeleteMapping("/user/deleteInfo/{infoId}")
    @ResponseBody
    public Msg deleteInfo(@PathVariable("infoId") Integer id) {
        Integer result = infoService.deleteInfobyId(id);
        if (result == 1) {
            return Msg.success();
        }
        return Msg.fail();
    }
}

@Controller
public class RecoderController {

    @Autowired
    FlowOfFundsService flowOfFundsService;

    /**
     * 跳转到资金记录界面
     * @param model
     * @return
     */
    @RequestMapping("/user/tools/toRecord.html")
    public String toRecoder(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                            @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
        }
        Admin admin = adminService.selectAdminByTerms(username, null);
        if (admin != null) {
            return Msg.success();
        }
        return Msg.fail();
    }

    @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
     */
    @DeleteMapping("/admin/deleteBankById/{id}")
    @ResponseBody
    public Msg deleteBankById(@PathVariable("id") Integer id){
        Integer result = bankService.deleteBankById(id);
        if (result==1){
            return Msg.success();
        }
        return Msg.fail();
    }
}

@Controller
@RequestMapping("/login")
public class LoginController {
    @Autowired
    UserService userService;

    @Autowired
    AdminService adminService;

    //public static final Map<String, HttpSession> USR_SESSION = new HashMap<>();
    public static String last_login = "";

    @GetMapping("/loginVerifyUsername/{username}")
    @ResponseBody
    public Msg loginVerifyUsername(@PathVariable("username") String username) {
        User user = userService.selectUserByTerms(username, null);
        if (user != null) {
            return Msg.success();
        }
        Admin admin = adminService.selectAdminByTerms(username, null);
        if (admin != null) {
            return Msg.success();
        }
        return Msg.fail();
     * @return
     */
    @DeleteMapping("/admin/deleteFundProductById/{id}")
    @ResponseBody
    public Msg deleteFundProductById(@PathVariable("id") Integer id){
        Integer result = fundProductService.deleteFundProductById(id);
        if (result==1){
            return Msg.success();
        }
        return Msg.fail();
    }
}

@Controller
public class ChangeMoneyController {
    @Autowired
    ChangeMoneyService changeMoneyService;
    @Autowired
    UserChangeMoneyService userChangeMoneyService;
    @Autowired
    FlowOfFundsService flowOfFundsService;

    /**
     * 跳转到零钱理财界面(用户)
     * @param model
     * @return
     */
    @RequestMapping("/user/finance/toChangeMoney.html")
    public String toChangemoney(Model model){
        List<ChangeMoney> list = changeMoneyService.selectAllChangeMoney();
        model.addAttribute("changeMoneyList",list);
        model.addAttribute("pageTopBarInfo","零钱理财界面");
        model.addAttribute("activeUrl1","financeActive");
        model.addAttribute("activeUrl1", "userInfoActive");
        model.addAttribute("activeUrl2", "userInfoActive");
        model.addAttribute("pageTopBarInfo", "用户信息界面");
        return "/admin/userinfo/userinfo";
    }

    /**
     * 添加用户(管理员)
     * @param user
     * @return
     */
    @PostMapping("/user/addUser")
    @ResponseBody
    public Msg addUser(User user){
        user.setStatus(0);
        user.setReputation("良好");
        Integer result = userService.insertUser(user);
        if (result==1){
            return Msg.success();
        }
        return Msg.fail();
    }

    /**
     * 更新用户信息时回显用户信息(管理员)
     * @param id
     * @return
     */
    @GetMapping("/user/getUserById/{id}")
    @ResponseBody
    public Msg getUserInfoById(@PathVariable("id")Integer id){
        User user = userService.selectUserById(id);
        return Msg.success().add("user",user);
    }

    /**
     * 删除用户(管理员)
     * @param id
     * @param session
     * @return
     */
    @DeleteMapping("/user/deleteUserById/{id}")
    @ResponseBody
    public Msg deleteUserById(@PathVariable("id")Integer id,HttpSession session){
            Info info = new Info();
            info.setSendid(admin.getId());
            info.setReceiveid(loan.getLoanid());
            info.setCreatetime(new Date());
            info.setTitle("网贷审核通过");
            info.setInfodesc("用户" + loan.getUser().getUsername() + "的" + loan.getAmount() + "元网贷申请审核通过!审核人为:" + admin.getUsername());
            info.setStatus(0);
            infoService.insertInfo(info);
            return Msg.success();
        }
        return Msg.fail();
    }

    /**
     * 审核不通过
     *
     * @param id
     * @return
     */
    @PutMapping("/loan/notPassApplyStatus/{id}")
    @ResponseBody
    public Msg notPassApplyStatus(@PathVariable("id") Integer id, HttpSession session) {
        Admin admin = (Admin) session.getAttribute("loginAdmin");
        Loan loan = loanService.selectLoanById(id);
        loan.setExamineid(admin.getId());
        loan.setApplystatus(1);
        Integer result = loanService.updateLoan(loan);
        if (result == 1) {
            Info info = new Info();
            info.setSendid(admin.getId());
            info.setReceiveid(loan.getUser().getId());
            info.setCreatetime(new Date());
            info.setTitle("网贷审核未通过");
            info.setInfodesc("用户" + loan.getUser().getUsername() + "的" + loan.getAmount() + "元网贷申请审核未通过!审核人为:" + admin.getUsername());
            info.setStatus(0);
            infoService.insertInfo(info);
            return Msg.success();
        }
        return Msg.fail();
    }

    /**
        return "/user/personal/myfinance";
    }

    @PutMapping("/user/revokeUserChangeMoney")
    @ResponseBody
    public Msg revokeUserChangeMoney(@RequestParam("userChangeMoneyId") Integer userChangeMoneyId, HttpSession session) {
        UserChangeMoney ucm = userChangeMoneyService.selectUserChangeMoneyById(userChangeMoneyId);
        ucm.setStatus(3);
        Integer result = userChangeMoneyService.updateUserChangeMoney(ucm);
        if (result == 1) {
            session.setAttribute("myFinanceActiveUrl", "changeMoneyActive");
            return Msg.success();
        }
        return Msg.fail();
    }

    @PutMapping("/user/revokeUserPayMoney")
    @ResponseBody
    public Msg revokeUserPayMoney(@RequestParam("userPayMoneyId") Integer userPayMoneyId, HttpSession session) {
        UserPayMoney upm = userPayMoneyService.selectUserPayMoneyById(userPayMoneyId);
        upm.setStatus(3);
        Integer result = userPayMoneyService.updateUserPayMoney(upm);

        if (result == 1) {
            session.setAttribute("myFinanceActiveUrl", "payMoneyActive");
            return Msg.success();
        }
        return Msg.fail();
    }

    @PutMapping("/user/revokeUserTermFinancial")
    @ResponseBody
    public Msg revokeUserTermFinancial(@RequestParam("userTermFinancialId") Integer userTermFinancialId, HttpSession session) {
        UserTermFinancial utf = userTermFinancialService.selectUserTermFinancialById(userTermFinancialId);
        utf.setStatus(3);
        Integer result = userTermFinancialService.updateUserTermFinancial(utf);

        if (result == 1) {
            session.setAttribute("myFinanceActiveUrl", "termFinancialActive");
            return Msg.success();
        }
        return Msg.fail();
    }


@Controller
public class MainController {
    @Autowired
    UserService userService;
    @Autowired
    AdminService adminService;
    @Autowired
    NewsService newsService;

    /**
     * 404页面
     */
    @GetMapping(value = "/error/404")
    public String error_404() {
        return "error/404";
    }

    /**
     * 500页面
     */
    @GetMapping(value = "/error/500")
    public String error_500() {
        return "error/500";
    }

    /**
     * 错误界面返回
     * @param session
     * @return
			return value;
		}

	}
}

@Controller
public class InfoController {
    @Autowired
    InfoService infoService;

    /**
     * 跳转到我的消息界面
     * @param pageNum
     * @param pageSize
     * @param model
     * @param session
     * @return
     */
    @RequestMapping("/user/personal/toMyInfo.html")
    public String toMyInfo(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                           @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
                           Model model, HttpSession session) {
        User loginUser = (User) session.getAttribute("loginUser");

        PageHelper.startPage(pageNum, pageSize);
        List<Info> list = infoService.selectInfoOrderByUserIdDesc(loginUser.getId());
        PageInfo<Info> pageInfo = new PageInfo<Info>(list, 5);
        model.addAttribute("infoPageInfo", pageInfo);
        model.addAttribute("infoList", list);
        model.addAttribute("pageTopBarInfo", "我的消息界面");
        return "/user/personal/myinfo";
    }

    /**
     * 更新消息(已读)
     * @param id
     * @return
     */

        model.addAttribute("activeUrl1", "financeActive");
        model.addAttribute("activeUrl2", "changemoneyActive");
        model.addAttribute("pageTopBarInfo", "零钱理财管理界面");
        return "/admin/finance/changemoney";
    }

    /**
     * 新增零钱理财产品
     * @param changeMoney
     * @return
     */
    @PostMapping("/admin/addChangeMoney")
    @ResponseBody
    public Msg addChangeMoney(ChangeMoney changeMoney){
        Integer result = changeMoneyService.insertChangeMoney(changeMoney);
        if (result==1){
            return Msg.success();
        }
        return Msg.fail();
    }

    /**
     * 更新时回显信息
     * @param id
     * @return
     */
    @GetMapping("/admin/getChangeMoneyInfoById/{id}")
    @ResponseBody
    public Msg getChangeMoneyInfoById(@PathVariable("id") Integer id){
        ChangeMoney changeMoney = changeMoneyService.selectChangeMoneyById(id);
        return Msg.success().add("changeMoney",changeMoney);
    }

    /**
     * 更新
     * @param id
     * @param changeMoney
     * @return
     */
    @PutMapping("/admin/updateChangeMoney/{id}")
    @PutMapping("/loan/remindPay/{id}")
    @ResponseBody
    public Msg remindPay(@PathVariable("id") Integer id, HttpSession session) {
        Admin admin = (Admin) session.getAttribute("loginAdmin");
        Loan loan = loanService.selectLoanById(id);
        Info info = new Info();
        info.setSendid(admin.getId());
        info.setReceiveid(loan.getUser().getId());
        info.setCreatetime(new Date());
        info.setTitle("还款通知");
        info.setInfodesc("用户" + loan.getUser().getUsername() + "申请的" + loan.getAmount() + "元网贷该还款了!该提醒发送人为:" + admin.getUsername());
        info.setStatus(0);
        Integer result = infoService.insertInfo(info);
        if (result == 1) {
            return Msg.success();
        }
        return Msg.fail();
    }
}

@Controller
public class UserController {

    @Autowired
    UserService userService;

    /**
     * 跳转到账户安全界面(用户)(修改密码)
     *
     * @param model
     * @return
     */
    @RequestMapping("/user/personal/toSecurity.html")
    public String toSecurity(Model model) {
        model.addAttribute("pageTopBarInfo", "账户安全界面");
        model.addAttribute("activeUrl1", "personalActive");
        model.addAttribute("activeUrl2", "securityActive");
        return "/user/personal/security";

请添加图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

java毕业

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值