Java项目:汽车租赁管理系统(java+SpringBoot+SSM+JSP+JS+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/8.0等版本均可;


技术栈
后端:SpringBoot+SSM(Spring+SpringMVC+Mybatis)+JSP


使用说明
1. 使用Navicat或者其它工具,在mysql中创建对应sql文件名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,修改配置,运行项目;

 

 

 

 

 

 

统计分析控制层:

/*
 * 统计分析
 */
@RequestMapping("stat")
@Controller
public class StatController {
	
	@Autowired
	private StatService statService;
	
	@Autowired
	private CustomerService customerService;
	
	@Autowired
	private RentService rentService;
	
	/*
	 * 跳转到客户地区统计页面
	 */
	@RequestMapping("toCustomerAreaStat")
	public String toCustomerAreaStat() {
		return "stat/customerAreaStat";
	}
	/*
	 * 跳转到业务员年度销售额
	 */
	@RequestMapping("toOpernameYearGradeStat")
	public String toOpernameYearGradeStat() {
		return "stat/opernameYearGradeStat";
	}
	/*
	 * 跳转到公司年度统计
	 */
	@RequestMapping("toCompanyYearGradeStat")
	public String toLadcompanyYearGradeStat() {
		return "stat/componyYearGradeStat";
	}
	
	/*
	 * 加载客户地区统计
	 */
	@RequestMapping("loadCustomerAreaStatJson")
	@ResponseBody
	public List<BaseEntity> loadCustomerAreaStatJson(){
		return this.statService.loadCustomerAreaStatList();
	}
	/*
	 * 加载客户地区统计
	 */
	@RequestMapping("loadOpernameYearGradeStat")
	@ResponseBody
	public Map<String, Object> loadOpernameYearGradeStat(String year){
		List<BaseEntity> entities = this.statService.loadOpernameYearGradeList(year);
		Map<String, Object> map = new HashMap<>();
		List<String> names = new ArrayList<>();
		List<Double> values = new ArrayList<>();
		for (BaseEntity baseEntity : entities) {
			names.add(baseEntity.getName());
			values.add(baseEntity.getValue());
		}
		map.put("name", names);
		map.put("value", values);
		return map;
	}
	/*
	 * 加载公司年度月份销售额
	 */
	@RequestMapping("loadCompanyYearGradeStat")
	@ResponseBody
	public List<Double> toLoadCompanyYearGradeStat(String year){
		List<Double> entities = this.statService.loadCompanyYearGradeStatList(year);
		for (int i = 0; i < entities.size(); i++) {
			if (null==entities.get(i)) {
				entities.set(i, 0.0);
			}
		}
		return entities;
	}
	
	/*
	 * 导出客户数据
	 */
	@RequestMapping("exportCustomer")
	public ResponseEntity<Object> exportCustomer(CustomerVo customerVo,HttpServletResponse response) {
		List<Customer> customers =  customerService.queryAllCustomerForList(customerVo);
		String filename  = "客户数据.xls";
		String sheetname  = "客户数据";
		ByteArrayOutputStream bos = ExportCustomerUtils.exportCustomer(customers,sheetname);
		
		try {
			filename=URLEncoder.encode(filename,"UTF-8");
			//创建封装响应头信息的对象
			HttpHeaders header = new HttpHeaders();
			//封装响应内容类型(APPLICATION_OCTET_STREAM 响应的内容不限定)
			header.setContentType(MediaType.APPLICATION_OCTET_STREAM);
			//设置下载的文件名称
			header.setContentDispositionFormData("attachment", filename);
			return new ResponseEntity<Object>(bos.toByteArray(),header,HttpStatus.CREATED);
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
		
		return null;
	}
	/*
	 * 导出出租单
	 */
	@RequestMapping("exportRent")
	public ResponseEntity<Object> exportRent(String rentid) {
		//根据出租单号查询出租单信息
		Rent rent = rentService.queryRentByRentId(rentid);
		//根据身份证号查询客户信息
		Customer customer = customerService.queryCustomerByIdentity(rent.getIdentity());
		
		String filename  =customer.getCustname() +"的出租单.xls";
		String sheetname  = customer.getCustname()+"的出租单";
		ByteArrayOutputStream bos = ExportRentUtils.exportCustomer(rent,customer, sheetname);
		
		try {
			filename=URLEncoder.encode(filename,"UTF-8");
			//创建封装响应头信息的对象
			HttpHeaders header = new HttpHeaders();
			//封装响应内容类型(APPLICATION_OCTET_STREAM 响应的内容不限定)
			header.setContentType(MediaType.APPLICATION_OCTET_STREAM);
			//设置下载的文件名称
			header.setContentDispositionFormData("attachment", filename);
			return new ResponseEntity<Object>(bos.toByteArray(),header,HttpStatus.CREATED);
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
		
		return null;
	}
	
	
}

车辆管理控制层:

/**
 * 车辆管理控制器
 *
 */
@RestController
@RequestMapping("car")
public class CarController {

	@Autowired
	private CarService carService;
	
	/*
	 * 加载车辆列表返回DataGridView
	 */
	@RequestMapping("loadAllCar")
	public DataGridView loadAllmeenu(CarVo carVo) {
		return this.carService.queryAllCar(carVo);
	}
	
	/*
	 * 添加车辆
	 */
	@RequestMapping("addCar")
	public ResultObj addCar(CarVo carVo) {
		try {
			carVo.setCreatetime(new Date());
			//在添加车辆之前要把设置的图片格式_temp给去掉
			//如果不是默认图片就去掉后缀
			if (!carVo.getCarimg().equals(SysConstast.DEFAULT_CAR_IMG)) {
				String filePath = AppFileUtils.updateFileName(carVo.getCarimg(),SysConstast.FILE_UPLOAD_TEMP);
				carVo.setCarimg(filePath);
			}
			this.carService.addCar(carVo);
			return ResultObj.ADD_SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();
			return ResultObj.ADD_ERROR;
		}
	}

	/*
	 * 删除车辆
	 */
	@RequestMapping("deleteCar")
	public ResultObj deleteCar(CarVo carVo) {
		try {
			this.carService.deleteCar(carVo.getCarnumber());
			return ResultObj.DELETE_SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();
			return ResultObj.DELETE_ERROR;
		}
	}
	/*
	 * 修改车辆
	 */
	@RequestMapping("updateCar")
	public ResultObj updateCar(CarVo carVo) {
		try {
			String carimg =  carVo.getCarimg();
			if (carimg.endsWith(SysConstast.FILE_UPLOAD_TEMP)) {
				String filePath = AppFileUtils.updateFileName(carVo.getCarimg(),SysConstast.FILE_UPLOAD_TEMP);
				carVo.setCarimg(filePath);
				
				//把原来的删除
				Car car = this.carService.queryCarByCarNumber(carVo.getCarnumber());
				AppFileUtils.removeFileByPath(car.getCarimg());
			}
			this.carService.updateCar(carVo);
			return ResultObj.UPDATE_SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();
			return ResultObj.UPDATE_ERROR;
		}
	}
	/*
	 * 批量删除车辆
	 */
	@RequestMapping("deleteBatchCar")
	public ResultObj deleteBatchCar(CarVo carVo) {
		try {
			this.carService.deleteBatchCar(carVo.getIds());
			return ResultObj.DELETE_SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();
			return ResultObj.DELETE_ERROR;
		}
	}
	
	
	
	
}

汽车出租管理的控制层:

/**
 * 汽车出租管理的控制器
 *
 */
@RestController
@RequestMapping("rent")
public class RentController {
	@Autowired
	private RentService rentService;
	
	@Autowired
	private CustomerService customerService;
	
	/**
	 * 检查身份证号码是否存在
	 */
	@RequestMapping("checkCustomerExist")
	public ResultObj checkCustomerExist(RentVo rentVo) {
		Customer customer = customerService.queryCustomerByIdentity(rentVo.getIdentity());
		if (null!=customer) {
			return ResultObj.STATUS_TRUE;
		}else {
			return ResultObj.STATUS_FALSE;
		}
	}
	
	/**
	 * 初始化添加出租单的表单数据
	 */
	@RequestMapping("initRentFrom")
	public RentVo initRentFrom(RentVo rentVo) {
		//生成出租单号
		rentVo.setRentid(RandomUtils.createRandomStringUseTime(SysConstast.CAR_ORDER_CZ));
		//设置起租时间
		rentVo.setBegindate(new Date());
		//设置操作员
		User user = (User)WebUtils.getHttpSession().getAttribute("user");
		rentVo.setOpername(user.getRealname());
		
		return rentVo;
	}
	
	/**
	 * 保存出租单信息
	 */
	@RequestMapping("saveRent")
	public ResultObj saveRent(RentVo rentVo) {
		try {
			//设置创建时间
			rentVo.setCreatetime(new Date());
			//设置归还状态
			rentVo.setRentflag(SysConstast.RENT_BACK_FALSE);
			
			//保存
			this.rentService.addRent(rentVo);
			return ResultObj.ADD_SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();
			return ResultObj.ADD_ERROR;
		}
		
	}
	
	/***********出租单管理******************/
	/**
	 * 查询
	 */
	@RequestMapping("loadAllRent")
	public DataGridView loadAllRent(RentVo rentVo) {
		return this.rentService.queryAllRent(rentVo);
	}
	
	/**
	 * 删除出租单信息
	 */
	@RequestMapping("deleteRent")
	public ResultObj deleteRent(RentVo rentVo) {
		try {
			//保存
			this.rentService.deleteRent(rentVo.getRentid());
			return ResultObj.DELETE_SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();
			return ResultObj.DELETE_ERROR;
		}
		
	}
	/**
	 * 更改出租单信息
	 */
	@RequestMapping("updateRent")
	public ResultObj updateRent(RentVo rentVo) {
		try {
			//保存
			this.rentService.updateRent(rentVo);
			return ResultObj.UPDATE_SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();
			return ResultObj.UPDATE_ERROR;
		}
		
	}
}

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

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

qq1334611189

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值