Java项目:停车位租赁系统(java+SSM+JSP+Maven+mysql)

源码获取:博客首页 "资源" 里下载!

项目介绍

该系统采用了经典的springmvc,spring,mybatis的框架组合,对于物业公司来说,有助于管理车位信息。系统分为了两个角色:车主和租客。


车主主要功能包括:

停车位信息
停车位列表
添加停车位
租赁合同管理
在租列表
已退租列表
车位申请列表
停车位申请
退租申请
故障处理
待处理故障
已处理故障
租金信息
我要收租
租客待缴租金
租客已缴租金
我的日程
查看日程
添加日程

租客主要功能包括:

停车位信息
停车位列表:申请停车位
租赁信息
我的租赁
已退租列表
我的申请
停车位申请列表
退租申请列表
租金信息
待缴租金
已缴租金
故障处理
我要报障
未处理故障
已处理故障


环境需要

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


使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 将项目中yml配置文件中的数据库配置改为自己的配置
3. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat,然后运行;
4. 运行项目,项目路径必须是parkMaster,输入http://localhost:8080/parkMaster/login.action 登录
5. 车主: 账户:admin  密码:123456 
6. 租客: 用户名:zyx 密码:12345

Java项目:停车位租赁系统(java+SSM+JSP+Maven+mysql)_第1张图片

 Java项目:停车位租赁系统(java+SSM+JSP+Maven+mysql)_第2张图片

 Java项目:停车位租赁系统(java+SSM+JSP+Maven+mysql)_第3张图片

 Java项目:停车位租赁系统(java+SSM+JSP+Maven+mysql)_第4张图片

 Java项目:停车位租赁系统(java+SSM+JSP+Maven+mysql)_第5张图片

车辆管理控制层:

@Controller
public class CarController {
	@Autowired
	   @Qualifier("pmsService")
	private PmsService pmsService;
	
	 @RequestMapping(value= {"/carMg"})
	  public String carMg(@ModelAttribute("car") Car car) {
	
		return "manager/carMg";
	}
	 
	@RequestMapping(value="/manager/car-list")
	 public void selectRepair(
			 HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException{
		request.setCharacterEncoding("UTF-8");
		String key = request.getParameter("key");
		String pageNoStr = request.getParameter("pageNo");
		String rowMaxStr = request.getParameter("rowMax");

		int pageNo = Integer.valueOf(pageNoStr);
		int rowMax = Integer.valueOf(rowMaxStr);
		
		Car car = new Car();
		car.setUserId(key);
		
		
		PageVO  page = pmsService.listCar(car, pageNo, rowMax);

		response.reset();
		response.setContentType("text/plain;charset=UTF-8");
		response.getWriter().print(JSON.toJSONString(page));
		response.flushBuffer();
}
	@RequestMapping(value="/manager/addCar")
	 public void addCar(@ModelAttribute("car") Car car){	
		pmsService.addCar(car);
		System.out.println("add car :"+ car.getCarNum());	
		car = null;
	}
   
   @RequestMapping(value="/manager/updateCar")
	 public void updateCar(@ModelAttribute("car") Car car){
		pmsService.modifyCar(car);
		System.out.println("modify Car :"+ car.getCarNum());
	}
   
   
   @RequestMapping(value="/manager/deleteCar")
	 public void deleteCar(@RequestBody Car car, HttpServletResponse response){  	    	   	 
	   String carNum = car.getCarNum();
  	
  	
		pmsService.removeCarById(carNum);
		
		
		System.out.println("delete Car :"+ carNum);	
		
	}
   
   @RequestMapping(value="/manager/loadEditCar")
   @ResponseBody
	 public  Object loadEditCar(@RequestParam(value="carNum",required=false) String carNum){
   	
		Car car = new Car();
		car = pmsService.findCarById(carNum);
		System.out.println("load Car :"+ carNum);
		return car;
	}
}

用户管理控制器:

/**
 * 用户管理控制器
 *
 */
@RestController
@RequestMapping("user")
public class UserController {

	@Autowired
	private UserService userService;

	/*
	 * 加载用户列表返回DataGridView
	 */
	@RequestMapping("loadAllUser")
	public DataGridView loadAllmeenu(UserVo userVo) {
		return this.userService.queryAllUser(userVo);
	}

	/*
	 * 注册用户--查询用户名是否存在
	 */
	@RequestMapping("queryLoginName")
	public ResultObj queryLoginName(UserVo userVo) {
		Integer count = this.userService.queryLoginName(userVo.getLoginname());
		if (count != 0) {
			return ResultObj.USER_EXIST;
		}
		return null;
	}

	/*
	 * 注册用户
	 */
	@RequestMapping("signup")
	public ResultObj signup(UserVo userVo) {
		try {
			String code = WebUtils.getHttpSession().getAttribute("code").toString();
			if (userVo.getCode().toLowerCase().equals(code)) {
				this.userService.signUpUser(userVo);
				return ResultObj.SIGNUP_SUCCESS;
			} else {
				return ResultObj.USER_SIGNUP_CODE_ERROR_MSG;
			}
		} catch (Exception e) {
			e.printStackTrace();
			return ResultObj.SIGNUP_ERROR;
		}
	}

	/*
	 * 添加用户
	 */
	@RequestMapping("addUser")
	public ResultObj addUser(UserVo userVo) {
		try {
			this.userService.addUser(userVo);
			return ResultObj.ADD_SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();
			return ResultObj.ADD_ERROR;
		}
	}

	/*
	 * 修改用户
	 */
	@RequestMapping("updateUser")
	public ResultObj updateUser(UserVo userVo) {
		try {
			this.userService.updateUser(userVo);
			return ResultObj.UPDATE_SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();
			return ResultObj.UPDATE_ERROR;
		}
	}

	/*
	 * 删除用户
	 */
	@RequestMapping("deleteUser")
	public ResultObj deleteUser(UserVo userVo) {
		System.out.println(userVo);
		System.out.println(userVo.getUserid());
		try {
			this.userService.deleteUser(userVo.getUserid());
			return ResultObj.DELETE_SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();
			return ResultObj.DELETE_ERROR;
		}
	}

	/*
	 * 批量删除用户
	 */
	@RequestMapping("deleteBatchUser")
	public ResultObj deleteBatchUser(UserVo userVo) {
		try {
			this.userService.deleteBatchUser(userVo.getIds());
			return ResultObj.DELETE_SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();
			return ResultObj.DELETE_ERROR;
		}
	}

	/*
	 * 重置用户密码
	 */
	@RequestMapping("resetUserPwd")
	public ResultObj resetUserPwd(UserVo userVo) {
		try {
			this.userService.resetUserPwd(userVo.getUserid());
			return ResultObj.RESET_SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();
			return ResultObj.RESET_ERROR;
		}
	}

	/*
	 * 加载用户管理分配的分配角色的数据
	 */
	@RequestMapping("initUserRole")
	public DataGridView initUserRole(UserVo userVo) {
		return this.userService.queryUserRole(userVo.getUserid());
	}

	/*
	 * 保存用户和角色的关系
	 */
	@RequestMapping("saveUserRole")
	public ResultObj saveUserRole(UserVo userVo) {
		try {
			this.userService.saveUserRole(userVo);
			return ResultObj.DISPATCH_SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();
			return ResultObj.DISPATCH_ERROR;
		}
	}

	/*
	 * 修改个人信息
	 */
	@RequestMapping("updateUserInfo")
	public ResultObj updateUserInfo(UserVo userVo) {
		try {
			String headimg = userVo.getHeadimg();
			if (headimg.endsWith(SysConstast.FILE_UPLOAD_TEMP)) {
				String filePath = AppFileUtils.updateFileName(headimg, SysConstast.FILE_UPLOAD_TEMP);
				userVo.setHeadimg(filePath);
				// 把原来的删除
				User user = this.userService.queryUserInfo(userVo.getUserid());
				AppFileUtils.removeFileByPath(user.getHeadimg());
			}
			this.userService.updateUserInfo(userVo);
			return ResultObj.UPDATE_SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();
			return ResultObj.UPDATE_ERROR;
		}
	}

	/*
	 * 查询个人信息
	 */
	@RequestMapping("queryUserInfo")
	public User queryUserInfo() {
		User user = (User) WebUtils.getHttpSession().getAttribute("user");
		user = this.userService.queryUserInfo(user.getUserid());
		return user;
	}

	/*
	 * 查询密码
	 */
	@RequestMapping("queryPwd")
	public ResultObj queryPwd(UserVo userVo) {
		User user = (User) WebUtils.getHttpSession().getAttribute("user");
		user = this.userService.queryUserInfo(user.getUserid());
		// 生成密文
		String pwd = DigestUtils.md5DigestAsHex(userVo.getPwd().getBytes());
		userVo.setPwd(pwd);
		if (userVo.getPwd().equals(user.getPwd())) {
			return ResultObj.PWD_SUCCESS;
		} else {
			return ResultObj.PWD_ERROR;
		}
	}

	/*
	 * 更改密码之查询密码
	 */
	@RequestMapping("updatePwd")
	public ResultObj updatePwd(UserVo userVo) {
		try {
			User user = (User) WebUtils.getHttpSession().getAttribute("user");
			// 生成密文
			String pwd = DigestUtils.md5DigestAsHex(userVo.getPwd().getBytes());
			userVo.setUserid(user.getUserid());
			userVo.setPwd(pwd);
			// 修改密码
			this.userService.updateUser(userVo);
			return ResultObj.UPDATE_SUCCESS;
		} catch (Exception e) {
			return ResultObj.UPDATE_ERROR;
		}
	}
}

车辆修理管理控制层:

@Controller
public class RepairController {
	@Autowired
	   @Qualifier("pmsService")
	private PmsService pmsService;
	
	 @RequestMapping(value= {"/repairMg"})
	  public String repairMg(@ModelAttribute("repair") Repair repair) {
	
		return "manager/repairMg";
	}
	 
	@RequestMapping(value="/manager/repair-list")
	 public void selectRepair(
			 HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException{
		request.setCharacterEncoding("UTF-8");
		String key = request.getParameter("key");
		String pageNoStr = request.getParameter("pageNo");
		String rowMaxStr = request.getParameter("rowMax");
		String repairState1 = request.getParameter("repairState");
		int pageNo = Integer.valueOf(pageNoStr);
		int rowMax = Integer.valueOf(rowMaxStr);
		int repairState = Integer.valueOf(repairState1);
		
		Repair repair = new Repair();
		repair.setUserId(key);
		repair.setRepairState(repairState);
		
		
		PageVO  page = pmsService.listRepair(repair, pageNo, rowMax);

		response.reset();
		response.setContentType("text/plain;charset=UTF-8");
		response.getWriter().print(JSON.toJSONString(page));
		response.flushBuffer();
		
	}
	
	@RequestMapping(value="/manager/updateRepair")
	 public void updateRepair(@ModelAttribute("repair") Repair repair){
		repair.setRepairState(repair.getTypeId());
		pmsService.modifyRepair(repair);
		System.out.println("modify Repair :"+ repair.getRepairId());
	}
  
  
  @RequestMapping(value="/manager/deleteRepair")
	 public void deleteRepair(@RequestBody Repair repair, HttpServletResponse response){  	    	   	 
	   int repairId = repair.getRepairId();
 	
 	
		pmsService.removeRepair(repairId);
		
		
		System.out.println("delete Repair :"+ repairId);	
		
	}
  
  @RequestMapping(value="/manager/loadEditRepair")
  @ResponseBody
	 public  Object loadEditRepair(@RequestParam(value="repairId",required=false) String repairId){
  		int repairId1 = Integer.valueOf(repairId);
  		Repair repair = new Repair();
  		repair = pmsService.findRepair(repairId1);
		System.out.println("load Repair :"+ repairId);
		return repair;
	}
  
  @RequestMapping(value="repair")
	public String repair(Model model) {
		return "user/repair";
	}
	
	@RequestMapping(value="user/repair-list")
	public void selectAdvice(HttpServletRequest request, HttpServletResponse response, HttpSession session)
			throws ServletException, IOException {
		request.setCharacterEncoding("UTF-8");
		User user = (User) session.getAttribute("user");
		String pageNoStr = request.getParameter("pageNo");
		String rowMaxStr = request.getParameter("rowMax");
		String repairState = request.getParameter("repairState");
		String beginDate = request.getParameter("beginDate");
		String endDate = request.getParameter("endDate");
		System.out.println(beginDate);
		System.out.println(endDate);
		int pageNo = Integer.valueOf(pageNoStr);
		int rowMax = Integer.valueOf(rowMaxStr);
		int reState = Integer.valueOf(repairState);
		Repair repair =new Repair();
		repair.setUserId(user.getUserId());
		repair.setRepairState(reState);
		
		PageVO  page = pmsService.listRepair(repair, pageNo, rowMax);
		
		response.reset();
		response.setContentType("text/plain;charset=UTF-8");
		response.getWriter().print(JSON.toJSONString(page));
		response.flushBuffer();
	}
	
	 @RequestMapping(value="/user/addRepair")
	 public void addRepair(HttpServletRequest request, HttpServletResponse response, HttpSession session, 
			 @ModelAttribute("repair") Repair repair) throws ServletException, IOException{
		request.setCharacterEncoding("UTF-8");
		String buildingNum = request.getParameter("buildingNum");
		String roomNum = request.getParameter("roomNum");
		Date date = (Date) new Timestamp(System.currentTimeMillis());
		User user = (User) session.getAttribute("user");
		String userId = user.getUserId();
		int bdNum = Integer.valueOf(buildingNum);
		int rmNum = Integer.valueOf(roomNum);

		repair.setUserId(userId);
		repair.setRepairDate(date);
		repair.setBuildingNum(bdNum);
		repair.setRoomNum(rmNum);
		repair.setRepairState(0);
		pmsService.addRepair(repair);
		
	}
	 
	 @RequestMapping(value="/user/loadRepair")
   @ResponseBody
	 public Object loadAdvice(@RequestParam(value="repairId",required=false) String repairId){
		 int id = Integer.valueOf(repairId);
  	 Repair repair = new Repair();
		 repair = pmsService.selectRepairByIdUser(id);
		 return repair;
	}
}

源码获取:博客首页 "资源" 里下载! 

你可能感兴趣的