Java项目:SSM家庭理财管理系统

260 篇文章 9 订阅

作者主页:源码空间站2022

 简介:Java领域优质创作者、Java项目、学习资料、技术互助

文末获取源码

项目介绍

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
public class IncomeController {
	@Resource
	private IncomeService incomeService;
	@Resource
	private DatadicService datadicService;
	@Resource
	private UserService userService;

	@InitBinder
	public void initBinder(WebDataBinder binder) {
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		dateFormat.setLenient(false);
		binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true)); // true:允许输入空值,false:不能为空值
	}


	/**
	 * 收入信息管理页面
	 */
	@RequestMapping("/incomeManage.do")
	public String incomeManage(ModelMap map, HttpServletRequest request) {
		List<Datadic> list = datadicService.getDatadicIncome();
		map.addAttribute("incomes", list);
		
		HttpSession session = request.getSession();
		User curuser = (User)session.getAttribute(Constants.currentUserSessionKey);
		Map<String, Object> userMap = new HashMap<String, Object>();
		userMap.put("userid", curuser.getId());
		userMap.put("roleid", curuser.getRoleid());
		List<User> userlist = userService.getAllUser(userMap);
		map.addAttribute("allUsers", userlist);
		return "incomeManage";
	}

	/**
	 * 查询用户收入集合
	 * 
	 * @param page
	 * @param rows
	 * @param s_income
	 * @param response
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/incomelist.do")
	public String list(@RequestParam(value = "page", required = false) String page,
			@RequestParam(value = "rows", required = false) String rows, Income s_income, HttpServletResponse response)
			throws Exception {
		PageBean pageBean = new PageBean(Integer.parseInt(page), Integer.parseInt(rows));
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("incomer", StringUtil.formatLike(s_income.getIncomer()));
		map.put("source", StringUtil.formatLike(s_income.getSource()));
		map.put("dataid", s_income.getDataid());
		map.put("starttime", s_income.getStarttime());
		map.put("endtime", s_income.getEndtime());
		map.put("roleid", s_income.getRoleid());
		map.put("userid", s_income.getUserid());
		map.put("start", pageBean.getStart());
		map.put("size", pageBean.getPageSize());
		List<Income> incomeList = incomeService.findIncome(map);
		Long total = incomeService.getTotalIncome(map);
		JSONObject result = new JSONObject();
		JSONArray jsonArray = JSONArray.fromObject(incomeList);
		result.put("rows", jsonArray);
		result.put("total", total);
		ResponseUtil.write(response, result);
		return null;
	}

	/**
	 * 添加与修改用户
	 * 
	 * @param income
	 * @param response
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/incomesave.do")
	public String save(Income income, HttpServletResponse response) throws Exception {
		int resultTotal = 0; // 操作的记录条数
		JSONObject result = new JSONObject();
		
		if (income.getId() == null) {
			resultTotal = incomeService.addIncome(income);
		} else {
			resultTotal = incomeService.updateIncome(income);
		}

		if (resultTotal > 0) { // 执行成功
			result.put("errres", true);
			result.put("errmsg", "数据保存成功!");
		} else {
			result.put("errres", false);
			result.put("errmsg", "数据保存失败");
		}
		ResponseUtil.write(response, result);
		return null;
	}

	/**
	 * 删除用户
	 * 
	 * @param ids
	 * @param response
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/incomedelete.do")
	public String delete(@RequestParam(value = "ids") String ids, HttpServletResponse response) throws Exception {
		JSONObject result = new JSONObject();
		String[] idsStr = ids.split(",");
		for (int i = 0; i < idsStr.length; i++) {
			incomeService.deleteIncome(Integer.parseInt(idsStr[i]));
		}
		result.put("errres", true);
		result.put("errmsg", "数据删除成功!");
		ResponseUtil.write(response, result);
		return null;
	}

}

支出管理控制器

@Controller
public class PayController {
	
	
	@Resource
	private PayService payService;
	@Resource
	private DatadicService datadicService;
	@Resource
	private UserService userService;
	
	@InitBinder
	public void initBinder(WebDataBinder binder) {
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
		dateFormat.setLenient(false);
		binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true)); // true:允许输入空值,false:不能为空值
	}
	

	/**
	 * 支出信息管理页面
	 */
	@RequestMapping("/payManage.do")
	public String payManage(ModelMap map, HttpServletRequest request) {
		List<Datadic> list = datadicService.getDatadicPay();
		map.addAttribute("pays", list);
		HttpSession session = request.getSession();
		User curuser = (User)session.getAttribute(Constants.currentUserSessionKey);
		Map<String, Object> userMap = new HashMap<String, Object>();
		userMap.put("userid", curuser.getId());
		userMap.put("roleid", curuser.getRoleid());
		List<User> userlist = userService.getAllUser(userMap);
		map.addAttribute("allUsers", userlist);
		return "payManage";
	}

	/**
	 * 查询用户收入集合
	 * 
	 * @param page
	 * @param rows
	 * @param s_pay
	 * @param response
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/paylist.do")
	public String list(@RequestParam(value = "page", required = false) String page,
			@RequestParam(value = "rows", required = false) String rows, Pay s_pay, HttpServletResponse response)
			throws Exception {
		PageBean pageBean = new PageBean(Integer.parseInt(page), Integer.parseInt(rows));
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("payer", StringUtil.formatLike(s_pay.getPayer()));
		map.put("tword", StringUtil.formatLike(s_pay.getTword()));
		map.put("dataid", s_pay.getDataid());
		map.put("starttime", s_pay.getStarttime());
		map.put("endtime", s_pay.getEndtime());
		map.put("roleid", s_pay.getRoleid());
		map.put("userid", s_pay.getUserid());
		map.put("start", pageBean.getStart());
		map.put("size", pageBean.getPageSize());
		List<Pay> payList = payService.findPay(map);
		Long total = payService.getTotalPay(map);
		JSONObject result = new JSONObject();
		JSONArray jsonArray = JSONArray.fromObject(payList);
		result.put("rows", jsonArray);
		result.put("total", total);
		ResponseUtil.write(response, result);
		return null;
	}

	/**
	 * 添加与修改支出
	 * 
	 * @param pay
	 * @param response
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/paysave.do")
	public String save(Pay pay, HttpServletResponse response) throws Exception {
		int resultTotal = 0; // 操作的记录条数
		JSONObject result = new JSONObject();
		
		if (pay.getId() == null) {
			resultTotal = payService.addPay(pay);
		} else {
			resultTotal = payService.updatePay(pay);
		}

		if (resultTotal > 0) { // 执行成功
			result.put("errres", true);
			result.put("errmsg", "数据保存成功!");
		} else {
			result.put("errres", false);
			result.put("errmsg", "数据保存失败");
		}
		ResponseUtil.write(response, result);
		return null;
	}

	/**
	 * 删除用户
	 * 
	 * @param ids
	 * @param response
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/paydelete.do")
	public String delete(@RequestParam(value = "ids") String ids, HttpServletResponse response) throws Exception {
		JSONObject result = new JSONObject();
		String[] idsStr = ids.split(",");
		for (int i = 0; i < idsStr.length; i++) {
			payService.deletePay((Integer.parseInt(idsStr[i])));
		}
		result.put("errres", true);
		result.put("errmsg", "数据删除成功!");
		ResponseUtil.write(response, result);
		return null;
	}
	

}

收入管理控制器

@Controller
public class TradeController {
	@Resource
	private TradeService tradeService;
	@Resource
	private DatadicService datadicService;
	@Resource
	private UserService userService;
	@Resource
	private SharesService sharesService;

	@InitBinder
	public void initBinder(WebDataBinder binder) {
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		dateFormat.setLenient(false);
		binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true)); // true:允许输入空值,false:不能为空值
	}


	/**
	 * 收入信息管理页面
	 */
	@RequestMapping("/tradeManage.do")
	public String tradeManage(ModelMap map, HttpServletRequest request) {
		List<Datadic> list = datadicService.getDatadicTrade();
		map.addAttribute("trades", list);
		
		HttpSession session = request.getSession();
		User curuser = (User)session.getAttribute(Constants.currentUserSessionKey);
		Map<String, Object> userMap = new HashMap<String, Object>();
		userMap.put("userid", curuser.getId());
		userMap.put("roleid", curuser.getRoleid());
		List<User> userlist = userService.getAllUser(userMap);
		map.addAttribute("allUsers", userlist);
		List<Shares> shareslist = sharesService.getSharesName();
		map.addAttribute("allShares", shareslist);
		return "tradeManage";
	}

	/**
	 * 查询用户收入集合
	 * 
	 * @param page
	 * @param rows
	 * @param s_trade
	 * @param response
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/tradelist.do")
	public String list(@RequestParam(value = "page", required = false) String page,
			@RequestParam(value = "rows", required = false) String rows, Trade s_trade, HttpServletResponse response)
			throws Exception {
		PageBean pageBean = new PageBean(Integer.parseInt(page), Integer.parseInt(rows));
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("sharesname", StringUtil.formatLike(s_trade.getSharesname()));
		map.put("dataid", s_trade.getDataid());
		map.put("starttime", s_trade.getStarttime());
		map.put("endtime", s_trade.getEndtime());
		map.put("roleid", s_trade.getRoleid());
		map.put("userid", s_trade.getUserid());
		map.put("start", pageBean.getStart());
		map.put("size", pageBean.getPageSize());
		List<Trade> tradeList = tradeService.findTrade(map);
		Long total = tradeService.getTotalTrade(map);
		JSONObject result = new JSONObject();
		JSONArray jsonArray = JSONArray.fromObject(tradeList);
		result.put("rows", jsonArray);
		result.put("total", total);
		ResponseUtil.write(response, result);
		return null;
	}

	/**
	 * 添加与修改用户
	 * 
	 * @param trade
	 * @param response
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/tradesave.do")
	public String save(Trade trade, HttpServletResponse response) throws Exception {
		int resultTotal = 0; // 操作的记录条数
		JSONObject result = new JSONObject();
		
		if (trade.getId() == null) {
			resultTotal = tradeService.addTrade(trade);
		} else {
			resultTotal = tradeService.updateTrade(trade);
		}

		if (resultTotal > 0) { // 执行成功
			result.put("errres", true);
			result.put("errmsg", "数据保存成功!");
		} else {
			result.put("errres", false);
			result.put("errmsg", "数据保存失败");
		}
		ResponseUtil.write(response, result);
		return null;
	}

	/**
	 * 删除用户
	 * 
	 * @param ids
	 * @param response
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/tradedelete.do")
	public String delete(@RequestParam(value = "ids") String ids, HttpServletResponse response) throws Exception {
		JSONObject result = new JSONObject();
		String[] idsStr = ids.split(",");
		for (int i = 0; i < idsStr.length; i++) {
			tradeService.deleteTrade(Integer.parseInt(idsStr[i]));
		}
		result.put("errres", true);
		result.put("errmsg", "数据删除成功!");
		ResponseUtil.write(response, result);
		return null;
	}

}

如果也想学习本系统,下面领取。关注并回复:248ssm

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值