Javaweb家庭理财管理系统(SSM+layui+Mysql)
源码获取:私信博主
项目介绍
本系统的业务包括用户登录、用户管理、资金账户、收入管理、支出管理、资金分布、资金分析、理财预测。
环境需要
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等版本均可;
技术栈
1. 后端:Spring springmvc mybatis
2. 前端:JSP+layui+css+html
使用说明
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2.使用IDEA/Eclipse/MyEclipse导入项目,配置tomcat,
3. 将项目中WebRoot/WEB-INF/applicationContext.xml配置文件中的数据库配置改为自己的配置,然后运行;
4.运行成功后,在浏览器中输入:http://localhost:8080/money
账号密码:admin/admin
资金账户控制层:
@Controller @RequestMapping("/account") public class AccountController extends BaseController{ // Servrice start @Inject //自动注入,不需要生成set方法了。 private AccountService accountService; @RequestMapping("list") public String list(Model model, Account account, String pageNow) { return Common.BACKGROUND_PATH+"/account/list"; } @ResponseBody @RequestMapping("queryAccName") public Map<String, Object> queryAccName() { Map<String, Object> map = new HashMap<String, Object>(); List<Account> aaa= accountService.queryAccName(); map.put("queryAccName", aaa); return map; } @ResponseBody @RequestMapping("querySumMoney") public Map<String, Object> querySumMoney(Pages pages, String accTimeS){ return QueryUtil.formatMap(accountService.querySumMoney(pages, accTimeS)); } /** * @param model * 存放返回界面的model * @return */ @ResponseBody @RequestMapping("query") public Map<String, Object> query(Pages pages, Account account){ return QueryUtil.formatMap(accountService.query(pages, account)); } /** * 保存数据 * * @param model * @param videoType * @return * @throws Exception */ @RequestMapping("add") @ResponseBody public Map<String, Object> add(Account account) { Map<String, Object> map = new HashMap<String, Object>(); try { /*SimpleDateFormat df = new SimpleDateFormat("yyyy-MM"); account.setAccTimeS(df.format(new Date())); List<Account> list = accountService.queryByCondition(account); if(list.size() > 0){ map.put("flag", "1"); }else{ accountService.add(account); map.put("flag", "true"); }*/ accountService.add(account); map.put("flag", "true"); } catch (Exception e) { map.put("flag", "false"); } return map; }
资金支出控制层:
@Controller @RequestMapping("/disburse") public class DisburseController extends BaseController{ // Servrice start @Inject //自动注入,不需要生成set方法了。 private DisburseService disburseService; @Inject //自动注入,不需要生成set方法了。 private IncomeService incomeService; @Inject //自动注入,不需要生成set方法了。 private AccountService accountService; /** * 加载图表 * @return */ @RequestMapping("getChartCount") @ResponseBody public Map<String, Object> getChartCount(String time,Model model) { Map<String, Object> map = new HashMap<String, Object>(); try{ List<Income> Income= incomeService.queryInMon(time); List<Disburse> Disburse=disburseService.queryOutMon(time); List<Account> Account=accountService.queryMonSumOutAndIn(); map.put("Income", Income); map.put("Account", Account); map.put("Disburse", Disburse); map.put("flag", "true"); } catch (Exception e) { map.put("flag", "false"); e.printStackTrace(); } return map; } /** * @zhangjianbao.java@foxmail.com * @return */ @RequestMapping("list") public String list(Model model, Disburse disburse, String pageNow) { return Common.BACKGROUND_PATH+"/disburse/list"; } /** * @param model * 存放返回界面的model * @return */ @ResponseBody @RequestMapping("query") public Map<String, Object> query(Pages pages, Disburse disburse){ return QueryUtil.formatMap(disburseService.query(pages, disburse)); } /** * @param model * 存放返回界面的model * @return */ @ResponseBody @RequestMapping("queryMon") public Map<String, Object> queryMon(Pages pages, Disburse disburse){ return QueryUtil.formatMap(disburseService.queryMon(pages, disburse)); } /** * 保存数据 * * @param model * @param videoType * @return * @throws Exception */ @RequestMapping("add") @ResponseBody public Map<String, Object> add(Disburse disburse) { Map<String, Object> map = new HashMap<String, Object>(); try { HomeUser homeUser = ShiroUtils.getCurrentUser(); disburse.setUserId(homeUser.getGuid()); disburse.setFullName(homeUser.getFullName()); disburseService.add(disburse); map.put("flag", "true"); } catch (Exception e) { map.put("flag", "false"); } return map; } /** * 跑到新增界面 * * @param model * @return */ @RequestMapping("addUI") public String addUI(Model model, Disburse disburse) { String id = disburse.getGuid(); if(StringUtils.isEmpty(id)){ return Common.BACKGROUND_PATH + "homeHinance/disburse/addDisburse"; }else{ disburse = disburseService.getById(id); model.addAttribute("disburse", disburse); return Common.BACKGROUND_PATH + "homeHinance/disburse/addDisburse"; } } /** * 跑到新增界面 * * @param model * @return */ @RequestMapping("editUI") public String editUI(Model model,String disburseId) { Disburse disburse = disburseService.getById(disburseId); model.addAttribute("disburse", disburse); return Common.BACKGROUND_PATH+"/disburse/edit"; } /** * 验证账号是否存在 * @author gangtong * Email:zhangjianbao.java@foxmail.com * date:2014-2-19 * @param name * @return */ @RequestMapping("isExist") @ResponseBody public boolean isExist(String name){ Disburse disburse = disburseService.isExist(name); if(disburse == null){ return true; }else{ return false; } } /** * 删除 * * @param model * @param videoTypeId * @return * @throws Exception */ @ResponseBody @RequestMapping("deleteById") public Map<String, Object> deleteById(Model model, String ids) { Map<String, Object> map = new HashMap<String, Object>(); try { String id[] = ids.split(","); for (String string : id) { if(!Common.isEmpty(string)){ disburseService.delete(string); } } map.put("flag", "true"); } catch (Exception e) { map.put("flag", "false"); } return map; }
资金收入控制层:
@Controller @RequestMapping("/income") public class IncomeController extends BaseController{ // Servrice start @Inject //自动注入,不需要生成set方法了。 private IncomeService incomeService; /** * @zhangjianbao.java@foxmail.com * @return */ @RequestMapping("list") public String list(Model model, Income income, String pageNow) { return Common.BACKGROUND_PATH+"/income/list"; } /** * @param model * 存放返回界面的model * @return */ @ResponseBody @RequestMapping("query") public Map<String, Object> query(Pages pages, Income income){ return QueryUtil.formatMap(incomeService.query(pages, income)); } /** * @param model * 存放返回界面的model * @return */ @ResponseBody @RequestMapping("queryMon") public Map<String, Object> queryMon(Pages pages, Income income){ return QueryUtil.formatMap(incomeService.queryMon(pages, income)); } /** * @param model * 存放返回界面的model * @return */ @ResponseBody @RequestMapping("queryForecast") public Map<String, Object> queryForecast(Pages pages,String inTimeS){ return QueryUtil.formatMap( incomeService.queryForecast(pages,inTimeS)); } @RequestMapping("querySum") @ResponseBody public List<Income> querySum(){ List<Income> list= incomeService.querySum(); return list; } /** * 保存数据 * * @param model * @param videoType * @return * @throws Exception */ @RequestMapping("add") @ResponseBody public Map<String, Object> add(Income income) { Map<String, Object> map = new HashMap<String, Object>(); try { HomeUser homeUser = ShiroUtils.getCurrentUser(); income.setUserId(homeUser.getGuid()); income.setFullName(homeUser.getFullName()); incomeService.add(income); map.put("flag", "true"); } catch (Exception e) { map.put("flag", "false"); } return map; } /** * 跑到新增界面 * * @param model * @return */ @RequestMapping("addUI") public String addUI(Model model,Income income) { String id = income.getGuid(); if(StringUtils.isEmpty(id)){ return Common.BACKGROUND_PATH + "homeHinance/income/addIncome"; }else{ income = incomeService.getById(id); model.addAttribute("income", income); return Common.BACKGROUND_PATH + "homeHinance/income/addIncome"; } } /** * 跑到新增界面 * * @param model * @return */ @RequestMapping("editUI") public String editUI(Model model,String incomeId) { Income income = incomeService.getById(incomeId); model.addAttribute("income", income); return Common.BACKGROUND_PATH+"/income/edit"; } /** * 验证账号是否存在 * @author gangtong * Email:zhangjianbao.java@foxmail.com * date:2014-2-19 * @param name * @return */ @RequestMapping("isExist") @ResponseBody public boolean isExist(String name){ Income income = incomeService.isExist(name); if(income == null){ return true; }else{ return false; } } /** * 删除 * * @param model * @param videoTypeId * @return * @throws Exception */ @ResponseBody @RequestMapping("deleteById") public Map<String, Object> deleteById(Model model, String ids) { Map<String, Object> map = new HashMap<String, Object>(); try { String id[] = ids.split(","); for (String string : id) { if(!Common.isEmpty(string)){ incomeService.delete(string); } } map.put("flag", "true"); } catch (Exception e) { map.put("flag", "false"); } return map; }