基于SSM的园区停车管理系统的设计与实现

末尾获取源码
开发语言:Java
Java开发工具:JDK1.8
后端框架:SSM
前端:采用JSP技术开发
数据库:MySQL5.7和Navicat管理工具结合
服务器:Tomcat8.5
开发软件:IDEA / Eclipse
是否Maven项目:是


目录

一、项目简介

二、Abstract

三、系统项目截图

管理员功能实现

员工功能实现 

四、核心代码

登录相关

文件上传

封装

五、论文展示

六、结论 


一、项目简介

网络技术和计算机技术发展至今,已经拥有了深厚的理论基础,并在现实中进行了充分运用,尤其是基于计算机运行的软件更是受到各界的关注。加上现在人们已经步入信息时代,所以对于信息的宣传和管理就很关键。因此园区停车信息的管理计算机化,系统化是必要的。设计开发园区停车管理系统不仅会节约人力和管理成本,还会安全保存庞大的数据量,对于园区停车信息的维护和检索也不需要花费很多时间,非常的便利。

园区停车管理系统是在MySQL中建立数据表保存信息,运用SSM框架和Java语言编写。并按照软件设计开发流程进行设计实现。系统具备友好性且功能完善。管理员登录进入本人后台之后,管理员工和车主,管理车位,根据车牌号进行泊车或取车,查看停车数据的年份报表或月份报表信息。员工查询车辆记录和车主,管理车位,对车辆进行泊车或取车。

园区停车管理系统在让园区停车信息规范化的同时,也能及时通过数据输入的有效性规则检测出错误数据,让数据的录入达到准确性的目的,进而提升园区停车管理系统提供的数据的可靠性,让系统数据的错误率降至最低。


二、Abstract

Network technology and computer technology have developed so far, they already have a solid theoretical foundation and have been fully used in reality, especially the software based on computer operation has attracted the attention of all walks of life. In addition, now that people have entered the information age, the promotion and management of information is very important. Therefore, it is necessary to computerize and systemize the management of parking information in the park. The design and development of the park parking management system will not only save manpower and management costs, but also securely store a huge amount of data. It does not take a lot of time to maintain and retrieve park parking information, which is very convenient.

The park parking management system is to establish a data table to save information in MySQL, and use SSM framework and Java language to write. And in accordance with the software design and development process for design and implementation. The system is friendly and fully functional. After the administrator logs in and enters his backstage, he manages employees and car owners, manages parking spaces, parks or picks up cars according to the license plate number, and checks the annual report or monthly report information of the parking data. Employees check vehicle records and owners, manage parking spaces, and park or pick up vehicles.

While the park parking management system standardizes park parking information, it can also detect incorrect data in a timely manner through the validity rules of data input, so that data entry can achieve the purpose of accuracy, thereby improving the reliability of the data provided by the park parking management system , To minimize the error rate of system data.



三、系统项目截图

管理员功能实现

管理员权限中的员工管理,其运行效果见下图。管理员维护员工资料,能修改与删除。也能登记本页面没有的员工资料。

管理员权限中的车主管理,其运行效果见下图。管理员查询车主,可以根据车主姓名,也能根据车主的身份证号,手机号或者车牌号查询车主,同时,管理员能够修改,删除本页面显示的车主资料。

 

管理员权限中的车位管理,其运行效果见下图。管理员增删改查车位,根据车牌号对车辆进行泊车或取车操作。

 

管理员权限中的车辆记录管理,其运行效果见下图。管理员查看车辆停车信息,查看车辆停车的月份报表或年份报表。

 

员工功能实现 

员工权限中的车位管理,其运行效果见下图。员工在本页面可以操作的功能比较多,可以添加车位,修改或查询车位,对车辆进行泊车或取车操作。

 

员工权限中的车辆记录,其运行效果见下图。员工根据车位名字,车牌号或者停车的时间区间筛选车辆停车记录。

 

员工权限中的车主信息,其运行效果见下图。员工只能查询或查看车主信息。

 


四、核心代码

登录相关


package com.controller;


import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.TokenEntity;
import com.entity.UserEntity;
import com.service.TokenService;
import com.service.UserService;
import com.utils.CommonUtil;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.ValidatorUtils;

/**
 * 登录相关
 */
@RequestMapping("users")
@RestController
public class UserController{
	
	@Autowired
	private UserService userService;
	
	@Autowired
	private TokenService tokenService;

	/**
	 * 登录
	 */
	@IgnoreAuth
	@PostMapping(value = "/login")
	public R login(String username, String password, String captcha, HttpServletRequest request) {
		UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
		if(user==null || !user.getPassword().equals(password)) {
			return R.error("账号或密码不正确");
		}
		String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());
		return R.ok().put("token", token);
	}
	
	/**
	 * 注册
	 */
	@IgnoreAuth
	@PostMapping(value = "/register")
	public R register(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);
    	if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
    		return R.error("用户已存在");
    	}
        userService.insert(user);
        return R.ok();
    }

	/**
	 * 退出
	 */
	@GetMapping(value = "logout")
	public R logout(HttpServletRequest request) {
		request.getSession().invalidate();
		return R.ok("退出成功");
	}
	
	/**
     * 密码重置
     */
    @IgnoreAuth
	@RequestMapping(value = "/resetPass")
    public R resetPass(String username, HttpServletRequest request){
    	UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
    	if(user==null) {
    		return R.error("账号不存在");
    	}
    	user.setPassword("123456");
        userService.update(user,null);
        return R.ok("密码已重置为:123456");
    }
	
	/**
     * 列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,UserEntity user){
        EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
    	PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params));
        return R.ok().put("data", page);
    }

	/**
     * 列表
     */
    @RequestMapping("/list")
    public R list( UserEntity user){
       	EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
      	ew.allEq(MPUtil.allEQMapPre( user, "user")); 
        return R.ok().put("data", userService.selectListView(ew));
    }

    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") String id){
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }
    
    /**
     * 获取用户的session用户信息
     */
    @RequestMapping("/session")
    public R getCurrUser(HttpServletRequest request){
    	Long id = (Long)request.getSession().getAttribute("userId");
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    public R save(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);
    	if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
    		return R.error("用户已存在");
    	}
        userService.insert(user);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody UserEntity user){
//        ValidatorUtils.validateEntity(user);
        userService.updateById(user);//全部更新
        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        userService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }
}

文件上传

package com.controller;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.UUID;

import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.ConfigEntity;
import com.entity.EIException;
import com.service.ConfigService;
import com.utils.R;

/**
 * 上传文件映射表
 */
@RestController
@RequestMapping("file")
@SuppressWarnings({"unchecked","rawtypes"})
public class FileController{
	@Autowired
    private ConfigService configService;
	/**
	 * 上传文件
	 */
	@RequestMapping("/upload")
	public R upload(@RequestParam("file") MultipartFile file,String type) throws Exception {
		if (file.isEmpty()) {
			throw new EIException("上传文件不能为空");
		}
		String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1);
		File path = new File(ResourceUtils.getURL("classpath:static").getPath());
		if(!path.exists()) {
		    path = new File("");
		}
		File upload = new File(path.getAbsolutePath(),"/upload/");
		if(!upload.exists()) {
		    upload.mkdirs();
		}
		String fileName = new Date().getTime()+"."+fileExt;
		File dest = new File(upload.getAbsolutePath()+"/"+fileName);
		file.transferTo(dest);
		FileUtils.copyFile(dest, new File("C:\\Users\\Desktop\\jiadian\\springbootl7own\\src\\main\\resources\\static\\upload"+"/"+fileName));
		if(StringUtils.isNotBlank(type) && type.equals("1")) {
			ConfigEntity configEntity = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile"));
			if(configEntity==null) {
				configEntity = new ConfigEntity();
				configEntity.setName("faceFile");
				configEntity.setValue(fileName);
			} else {
				configEntity.setValue(fileName);
			}
			configService.insertOrUpdate(configEntity);
		}
		return R.ok().put("file", fileName);
	}
	
	/**
	 * 下载文件
	 */
	@IgnoreAuth
	@RequestMapping("/download")
	public ResponseEntity<byte[]> download(@RequestParam String fileName) {
		try {
			File path = new File(ResourceUtils.getURL("classpath:static").getPath());
			if(!path.exists()) {
			    path = new File("");
			}
			File upload = new File(path.getAbsolutePath(),"/upload/");
			if(!upload.exists()) {
			    upload.mkdirs();
			}
			File file = new File(upload.getAbsolutePath()+"/"+fileName);
			if(file.exists()){
				/*if(!fileService.canRead(file, SessionManager.getSessionUser())){
					getResponse().sendError(403);
				}*/
				HttpHeaders headers = new HttpHeaders();
			    headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);    
			    headers.setContentDispositionFormData("attachment", fileName);    
			    return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return new ResponseEntity<byte[]>(HttpStatus.INTERNAL_SERVER_ERROR);
	}
	
}

封装

package com.utils;

import java.util.HashMap;
import java.util.Map;

/**
 * 返回数据
 */
public class R extends HashMap<String, Object> {
	private static final long serialVersionUID = 1L;
	
	public R() {
		put("code", 0);
	}
	
	public static R error() {
		return error(500, "未知异常,请联系管理员");
	}
	
	public static R error(String msg) {
		return error(500, msg);
	}
	
	public static R error(int code, String msg) {
		R r = new R();
		r.put("code", code);
		r.put("msg", msg);
		return r;
	}

	public static R ok(String msg) {
		R r = new R();
		r.put("msg", msg);
		return r;
	}
	
	public static R ok(Map<String, Object> map) {
		R r = new R();
		r.putAll(map);
		return r;
	}
	
	public static R ok() {
		return new R();
	}

	public R put(String key, Object value) {
		super.put(key, value);
		return this;
	}
}

五、论文展示

六、结论 

园区停车管理系统的开发设计并不是一件轻松事,因为毕设制作都是依照一定流程进行的。最开始是选择题目,然后通过各种方式查阅资料,以及对使用用户的需求进行调研,确定本系统的功能,为了降低系统编码的出错率,在设计阶段也需要下功夫,认真设计功能模块,使用大学所学的数据库知识,设计数据库。这样一来,对系统编码时,就会根据设计方案进行。编码完成,进行测试就能对合格的系统进行验收了。

借助身边同学还有导师提供的帮助,本人也顺利完成本系统的制作工作。对园区停车管理系统的分析与总结,发现园区停车管理系统具有如下特点:

(1)园区停车管理系统有着详细的功能设计,所以编码时,基本依照设计的功能进行开发,因此具备较完善的功能;

(2)园区停车管理系统在界面设计与布局时,参考了很多系统的界面设计风格,也从图书馆查阅了关于系统界面设计方面的资料,并把对本系统有用的知识做好笔记,有了这些知识积累,所以我在开发系统时,注重页面文字的排版,以及精确定位各页面元素,合理使用颜色搭配技巧,让本系统在不影响浏览效果的同时,让访问者产生一种简洁干净的视觉效果;

(3)园区停车管理系统为了让用户易于使用,在能够直观表达系统内容的同时,也把页面的导航放在了页面中最关键的位置,这个位置也是充分考虑了用户的浏览习惯。所以用户操作系统,可以在短时间内找到需要的内容。

由于本人并不是专门从事开发工作的技术人员,目前在校学习的开发类知识处于初级阶段,只是对开发类技术有着简单了解和使用,加上日常完成的作业,也只是局限在某个系统的某个功能模块上,因此,完成一个功能完善的整个系统,对于我来说,还是有一定的压力。所以这也确定了我开发的系统具有缺陷。

(1)对于园区停车管理系统的编码并没有完全依照编码规范,整个系统存在代码冗余的缺陷;

(2)园区停车管理系统在数据输入上,对数据有效性检测还不够严格;

(3)对园区停车管理系统的误操作提示,只是对部分功能进行了设计,还有很多功能都没有设计报错提示。

综上所述,本人仍需花费时间去学习编程知识,在后期,我将会学习代码模块化,将一些通用的函数,变量等进行单独设置,然后直接在需要的页面上进行调用,这样可以降低代码冗余率,同时也会多学习针对程序易出错地方的解决方案等知识。学习这些知识除了完善本系统之外,也是弥补自身编程能力不足的缺陷。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值