基于javaweb+mysql的ssm+maven财务预算管理系统(java+ssm+jsp+mysql+layui+maven)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SSM+Maven财务预算管理系统(java+ssm+jsp+mysql+layui+maven)
一、项目简述 功能包括:实现公司对项目的管理。
二、项目运行 环境配置:
Jdk1.8 + Tomcat8.5 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)
项目技术:
JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等
if(role != null){
return ResultUtil.success(role);
}else {
return ResultUtil.unSuccess();
}catch (Exception e){
return ResultUtil.error(e);
/**
* 登录时将用户信息加入cookie中
* @param response
*/
return ResultUtil.unSuccess();
}catch (Exception e){
return ResultUtil.error(e);
@RequestMapping("/updateBill")
public Result update(Bill bill, HttpSession session){
if (Config.getSessionUser(session)!=null){
bill.setUserid(Config.getSessionUser(session).getId());
Utils.log(bill.toString());
try {
int num = billService.update(bill);
if(num>0){
return bill;
@RequestMapping(value = "/addBill",method = RequestMethod.POST)
public Result add(Bill bill, HttpSession session){
if (Config.getSessionUser(session)!=null){
bill.setUserid(Config.getSessionUser(session).getId());
Utils.log(bill.toString());
try {
int num = billService.add(bill);
if(num>0){
int billid = bill.getId();
bill = new Bill();
if (Config.getSessionUser(session)!=null){
bill.setUserid(Config.getSessionUser(session).getId());
Utils.log(bill.toString());
try {
int num = billService.add(bill);
if(num>0){
int billid = bill.getId();
bill = new Bill();
bill.setId(billid);
return ResultUtil.success("记账成功!",billService.findByWhereNoPage(bill));
// return ResultUtil.success("记账成功!",bill);
}else {
return ResultUtil.unSuccess();
privilegeService.addDefaultPrivilegesWhenAddRole(roleid);
return ResultUtil.unSuccess();
}catch (Exception e){
return ResultUtil.error(e);
@RequestMapping("/getRole/{id}")
public @ResponseBody Result getRoleById(@PathVariable String id){
try {
Role role = userInfoService.getRoleById(id);
if(role != null){
return ResultUtil.success(role);
}else {
//cookie 保存7天
cookie.setMaxAge(60*60*24*7);
response.addCookie(cookie);
/**
* 注销时删除cookie信息
* @param request
* @param response
*/
private void delCookieUser(HttpServletRequest request, HttpServletResponse response){
UserInfo user = getSessionUser(request.getSession());
Cookie cookie = new Cookie(Config.CURRENT_USERNAME,user.getUsername()+"_"+user.getId());
}else {
return ResultUtil.unSuccess();
}catch (Exception e){
return ResultUtil.error(e);
@RequestMapping("/role/add")
public @ResponseBody Result addRole(Role role){
try {
int num = userInfoService.addRole(role);
if(num>0){
privilegeService.addDefaultPrivilegesWhenAddRole(role.getRoleid().toString());
@RequestMapping("/bills")
public class BillController {
@Resource
private BillService billService;
/**
* 适用于统计图
* @param bill
* @return
*/
@RequestMapping("/getBillsToChart")
bill.setUserid(Config.getSessionUser(session).getId());
Utils.log(bill.toString());
try {
int num = billService.update(bill);
if(num>0){
return ResultUtil.success("修改成功!",null);
}else {
return ResultUtil.unSuccess();
}catch (Exception e){
return ResultUtil.error(e);
//用户不存在
return ResultUtil.success(-1);
if (userIsExisted && userInfo == null){
return ResultUtil.unSuccess("用户名或密码错误!");
}else {
//将用户信息存入session
userInfo = setSessionUserInfo(userInfo,request.getSession());
//将当前用户信息存入cookie
setCookieUser(request,response);
return ResultUtil.success("登录成功", userInfo);
@RequestMapping("/users/getUsersByWhere/{pageNo}/{pageSize}")
public @ResponseBody Result getUsersByWhere(UserInfo userInfo, @PathVariable int pageNo, @PathVariable int pageSize, HttpSession session){
if (userInfo.getRoleid() == -1){
userInfo.setRoleid(Config.getSessionUser(session).getRoleid());
Utils.log(userInfo.toString());
PageModel model = new PageModel<>(pageNo,userInfo);
model.setPageSize(pageSize);
return userInfoService.getUsersByWhere(model);
@RequestMapping("/user/add")
public @ResponseBody Result addUser(UserInfo userInfo){
System.out.println(userInfo);
try {
return ResultUtil.unSuccess();
}catch (Exception e){
return ResultUtil.error(e);
@RequestMapping("/user/update")
public @ResponseBody Result updateUser(UserInfo userInfo){
try {
int num = userInfoService.update(userInfo);
if(num>0){
return ResultUtil.success();
}else {
return ResultUtil.unSuccess();
}catch (Exception e){
return ResultUtil.error(e);
return ResultUtil.success(-1);
if (userIsExisted && userInfo == null){
return ResultUtil.unSuccess("用户名或密码错误!");
}else {
//将用户信息存入session
userInfo = setSessionUserInfo(userInfo,request.getSession());
//将当前用户信息存入cookie
setCookieUser(request,response);
return ResultUtil.success("登录成功", userInfo);
@RequestMapping("/users/getUsersByWhere/{pageNo}/{pageSize}")
public @ResponseBody Result getUsersByWhere(UserInfo userInfo, @PathVariable int pageNo, @PathVariable int pageSize, HttpSession session){
if ("".equals(userInfo.getHouseid())){
try {
int num = userInfoService.delete(id);
if(num>0){
return ResultUtil.success();
}else {
return ResultUtil.unSuccess();
}catch (Exception e){
return ResultUtil.error(e);
@RequestMapping("/getSessionUser")
@ResponseBody
public UserInfo getSessionUser(HttpSession session){
UserInfo sessionUser = (UserInfo) session.getAttribute(Config.CURRENT_USERNAME);
sessionUser.setPassword(null);
return sessionUser;
return ResultUtil.unSuccess();
}catch (Exception e){
return ResultUtil.error(e);
@RequestMapping("/role/add")
public @ResponseBody Result addRole(Role role){
try {
int num = userInfoService.addRole(role);
if(num>0){
privilegeService.addDefaultPrivilegesWhenAddRole(role.getRoleid().toString());
return ResultUtil.success();
}else {
return ResultUtil.unSuccess();
@RequestMapping(value = "/addBill",method = RequestMethod.POST)
public Result add(Bill bill, HttpSession session){
if (Config.getSessionUser(session)!=null){
bill.setUserid(Config.getSessionUser(session).getId());
Utils.log(bill.toString());
try {
int num = billService.add(bill);
if(num>0){
int billid = bill.getId();
bill = new Bill();
bill.setId(billid);
return ResultUtil.success("记账成功!",billService.findByWhereNoPage(bill));
// return ResultUtil.success("记账成功!",bill);
if("client".equals(request.getHeader("token")) && !userIsExisted){
//用户不存在
return ResultUtil.success(-1);
if (userIsExisted && userInfo == null){
return ResultUtil.unSuccess("用户名或密码错误!");
}else {
//将用户信息存入session
userInfo = setSessionUserInfo(userInfo,request.getSession());
//将当前用户信息存入cookie
setCookieUser(request,response);
int num = userInfoService.updateRole(role);
if(num>0){
return ResultUtil.success();
}else {
return ResultUtil.unSuccess();
}catch (Exception e){
return ResultUtil.error(e);
@RequestMapping("/role/del/{roleid}")
public @ResponseBody Result deleteRole(@PathVariable String roleid){
try {
privilegeService.delPrivilegesWenDelRole(roleid);
int num = userInfoService.deleteRole(roleid);
if(num>0){
return ResultUtil.success();