本文主要是介绍Java项目:家庭理财管理系统(java+SSM+bootstrap+highcharts+Mysql),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
源码获取:俺的博客首页 "资源" 里下载!
项目介绍
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
用户管理控制层:
@Controller
@RequestMapping("/user")
public class UserController {@AutowiredUserService 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"})@ResponseBodypublic 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"})@ResponseBodypublic 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"})@ResponseBodypublic 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"})@ResponseBodypublic 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 {@Autowiredprivate 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"})@ResponseBodypublic 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"})@ResponseBodypublic 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 {@AutowiredAccountInfoService 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"})@ResponseBodypublic List<AccountType> queryAccountType() {List<AccountType> list = accountInfoService.queryAccountType();return list;}/*** 查询账单*/@RequestMapping(value = {"/queryAccount"})@ResponseBodypublic 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"})@ResponseBodypublic String addAccount(Account account) {account.setIsAvaliable(1);int count = accountInfoService.addAccount(account);if (count >= 1) {return "success";} else {return "error";}}/*** 修改账单信息*/@RequestMapping(value = {"/modifyAccount"})@ResponseBodypublic String modifyInfo(Account account) {int count = accountInfoService.modifyAccount(account);if (count == 1) {return "success";} else {return "error";}}/*** 删除账单*/@RequestMapping(value = {"/deleteAccount"})@ResponseBodypublic 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);}}
}
源码获取:俺的博客首页 "资源" 里下载!
这篇关于Java项目:家庭理财管理系统(java+SSM+bootstrap+highcharts+Mysql)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!