项目介绍

SSM家庭理财管理系统,分为管理员与普通用户两种角色;
管理员角色包含以下功能:
收支管理:收入信息维护、支出信息维护;
财务管理:证券账户管理、持股管理、证券流水账管理;
报表管理:按时间收入报表、按时间支出报表、按类型报表;
用户报表:用户信息管理、修改用户信息、修改密码、安全退出;

普通用户角色包含以下功能:
收支管理:收入信息维护、支出信息维护;
财务管理:证券账户管理、持股管理、证券流水账管理;
报表管理:按时间收入报表、按时间支出报表、按类型报表;
用户报表:修改用户信息、修改密码、安全退出;

环境需要

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.是否Maven项目: 是;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目 
6.数据库:MySql 5.7/8.0等版本均可;

技术栈

1. 后端:Spring+springmvc+mybatis

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

使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应sql文件名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,修改配置;
3. 将项目中db.properties配置文件中的数据库配置改为自己的用户名密码,然后运行;
4. 运行成功后,在浏览器中输入:http://localhost:8080/ffms/index.do
管理员账号密码:admin/123456
普通用户账号密码:user/123456

家庭财务系统课设java 家庭理财管理系统java_java

家庭财务系统课设java 家庭理财管理系统java_bootstrap_02

家庭财务系统课设java 家庭理财管理系统java_bootstrap_03

 

家庭财务系统课设java 家庭理财管理系统java_bootstrap_04

家庭财务系统课设java 家庭理财管理系统java_SSM_05

家庭财务系统课设java 家庭理财管理系统java_java_06

用户管理控制层: 

@Controller
@RequestMapping("/user")
public class UserController {
    @Autowired
    UserService userService;

    @RequestMapping(value = {"/list"})
    public String toUserList() {
        return "userList";
    }

    @RequestMapping(value = {"/add"})
    public ModelAndView toUserAdd() {
        ModelAndView mav = new ModelAndView();
        mav.setViewName("userAdd");
        return mav;
    }

    @RequestMapping(value = {"/getUserList"})
    @ResponseBody
    public UserListStatus getUserList(@RequestBody UserListCombination userListCombination,HttpSession session) {
        UserListStatus uls = new UserListStatus();
        User user =(User) session.getAttribute("user");
        List<User> userList =userService.list(userListCombination,user.getFid());
        uls.setData(userList);
        uls.setCount(userService.getCountByUser(user.getFid()));
        return uls;
    }

    @RequestMapping(value = {"/center"})
    public ModelAndView toUser(HttpSession session) {
        User user = (User) session.getAttribute("user");
        List<User> us = userService.list(user.getUid());
        ModelAndView mav = new ModelAndView();
        mav.setViewName("user");
        mav.addObject("userInfo", us.get(0));
        return mav;
    }

    @RequestMapping(value = {"/userDelete"})
    @ResponseBody
    public String deleteUser(HttpSession session, @RequestBody User user) {
        userService.delete(user.getUid());
        return "redirect:list";
    }

    @RequestMapping(value = {"/Edit"})
    public String toUserEdit() {
        return "userEdit";
    }

    @RequestMapping(value = {"/userEdit"})
    @ResponseBody
    public UserListStatus editUser(@RequestBody User user, HttpSession session) {
        UserListStatus rs = new UserListStatus();
        userService.update(user);
        rs.setCode(200);
        rs.setMsg("添加成功!");
        // 要更新session中的用户的值
        List<User> us = userService.list(user.getUid());
        User newUser = us.get(0);
        newUser.setPassword("");
        session.setAttribute("user", newUser);
        rs.setData(us);
        return rs;
    }

    @RequestMapping(value = {"/userAdd"})
    @ResponseBody
    public RegisterStatus addUser(@RequestBody User user) {
        // 封装返回的JSON数据
        RegisterStatus rs = new RegisterStatus();
        if (userService.isExists(user.getName())) {
            rs.setCode(405);
            rs.setInfo("用户名已经存在!");
        } else {
            userService.add(user);
            rs.setCode(200);
            rs.setInfo("添加成功!");
        }
        return rs;
    }

    /*.@RequestMapping(value={"/UserUpload"})
    public String upload(User user, HttpServletRequest request,Model model)throws Exception{
        System.out.println(request.getParameter("name"));
        String sqlPath=null;
        String localPath="D:\\CuitJavaEEPractice\\CuitJavaEEPractice\\src\\main\\webapp\\asset\\avatar\\";
        String filename=null;
        if(!user.getAvatar().isEmpty()){
            String uuid= UUID.randomUUID().toString().replaceAll("-","");
            String contentType=user.getAvatar().getContentType();
            String suffixName=contentType.substring(contentType.indexOf("/"+1));
            filename=uuid+"."+suffixName;
            System.out.println(filename);
            user.getAvatar().transferTo(newFile(localPath+filename));
        }
        sqlPath="/image/"+filename;
        user.setAvatar(sqlPath);
        userService.add(user);
        model.addAttribute("user",user);
        return "User";
    }*/
}

 登录管理控制层:

@Controller
@RequestMapping("/login")
public class LoginController {
    @Autowired
    private LoginService loginService;

    /**
     * 登录界面
     *
     * @return String
     */
    @RequestMapping(value = {"/log"})
    public String toLogin() {
        // 跳转到login.jsp页面。
        return "login";
    }

    /**
     * 注册界面
     *
     * @return String
     */
    @RequestMapping(value = {"/reg"})
    public String toRegister() {
        // 跳转到login.jsp页面。
        return "register";
    }

    /**
     * 用户注销
     *
     * @param session 用户会话
     * @return 返回到登录界面
     */
    @RequestMapping(value = {"/out"})
    public String doLogin(HttpSession session) {
        session.removeAttribute("user");
        return "redirect:log";
    }

    /**
     * 登录功能
     *
     * @return String 登录结果
     */
    @RequestMapping(value = {"/do"})
    @ResponseBody
    public LoginStatus doLogin(HttpSession session, @RequestBody User user) {
        // 用户登录检查
        User loginUser = loginService.getUserByUsernameAndPassword(user);
        LoginStatus ls = new LoginStatus();
        if (loginUser != null) {
            // 登录成功:设置用户登录状态,并返回信息
            loginUser.setPassword(null);
            session.setAttribute("user", loginUser);
            ls.setCode(200);
            ls.setInfo("登录成功!");
            ls.setUser(loginUser);
            return ls;
        } else {
            // 登录失败:返回错误信息
            ls.setCode(502);
            ls.setInfo("姓名或密码有误!");
            return ls;
        }
    }

    @RequestMapping(value = {"/rDo"})
    @ResponseBody
    public RegisterStatus doLogin(HttpSession session, @RequestBody UserAndFamily userAndFamily) {
        RegisterStatus registerStatus = new RegisterStatus();
        // 首先判断用户是否存在
        User existUser = loginService.getUserByUsername(userAndFamily.getUser().getName());
        if (existUser != null) {
            registerStatus.setInfo("姓名已经存在!");
            registerStatus.setCode(400);
            return registerStatus;
        }
        // 新用户注册
        loginService.addUserAndFamily(userAndFamily);
        registerStatus.setInfo("登记家庭成功!");
        registerStatus.setCode(200);
        return registerStatus;
    }


}

账单管理控制层: 

@Controller
@RequestMapping("/accountInfo")
public class AccountInfoController {
    @Autowired
    AccountInfoService accountInfoService;

    /**
     * 跳转到添加账单页面
     */
    @RequestMapping(value = {"/addInfo"})
    public String toAddAccount(Model model, HttpSession session) {
        User user = (User) session.getAttribute("user");
        model.addAttribute("uid", user.getUid());
        return "addAccount";
    }

    /**
     * 跳转到账单详情
     */
    @RequestMapping(value = {"/queryInfo"})
    public String toAccountInfo(int acid, Model model) {
        model.addAttribute("acid", acid);
        return "accountInfo";
    }

    /**
     * 跳转到账单修改页面
     */
    @RequestMapping(value = {"/modifyInfo"})
    public String toModifyInfo(int acid, Model model) {
        Account account = accountInfoService.queryAccountInfoById(acid);
        model.addAttribute("account", account);
        return "modifyInfo";
    }

    /**
     * 查询账单分类
     */
    @RequestMapping(value = {"/queryAccountType"})
    @ResponseBody
    public List<AccountType> queryAccountType() {
        List<AccountType> list = accountInfoService.queryAccountType();
        return list;
    }

    /**
     * 查询账单
     */
    @RequestMapping(value = {"/queryAccount"})
    @ResponseBody
    public AccountAndIEType queryInfo(int acid) {
        Account account = accountInfoService.queryAccountInfoById(acid);
        int type = account.getTid();
        String name = accountInfoService.queryAccountTypeById(type);
        AccountAndIEType at = new AccountAndIEType();
        at.setAcid(account.getAcid());
        at.setAmount(account.getAmount());
        at.setDate(account.getDate());
        at.setIsExpose(account.getIsExpose());
        at.setRemarks(account.getRemarks());
        at.setIetype(account.getIetype());
        at.setTypeName(name);
        return at;
    }

    /**
     * 保存账单信息
     */
    @RequestMapping(value = {"/saveAccount"})
    @ResponseBody
    public String addAccount(Account account) {
        account.setIsAvaliable(1);
        int count = accountInfoService.addAccount(account);
        if (count >= 1) {
            return "success";
        } else {
            return "error";
        }
    }

    /**
     * 修改账单信息
     */
    @RequestMapping(value = {"/modifyAccount"})
    @ResponseBody
    public String modifyInfo(Account account) {
        int count = accountInfoService.modifyAccount(account);
        if (count == 1) {
            return "success";
        } else {
            return "error";
        }
    }

    /**
     * 删除账单
     */
    @RequestMapping(value = {"/deleteAccount"})
    @ResponseBody
    public String deleteInfo(@RequestBody Account account) throws JsonProcessingException {
        int count = accountInfoService.deleteAccount(account.getAcid());
        ObjectMapper objectMapper = new ObjectMapper();
        if (count == 1) {
            Map<String, String> msg = new HashMap<>();
            msg.put("code", "200");
            msg.put("msg", "success");
            return objectMapper.writeValueAsString(msg);
        } else {
            Map<String, String> msg = new HashMap<>();
            msg.put("code", "500");
            msg.put("msg", "error");
            return objectMapper.writeValueAsString(msg);
        }
    }
}