基于javaweb的SSM+Maven汽车出租租赁系统(java+jsp+ssm+maven+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

020023272402

030023272402

040023272402

050023272402

060023272402

基于javaweb的SSM+Maven汽车出租租赁系统(java+jsp+ssm+maven+mysql)

一、项目简述

功能包括: 车辆管理,出租管理,汽车入库,汽车出租,汽车归还, 客户管理,出租单管理,统计分析等等功能,功能多多一 起来看看吧。

二、项目运行

环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)

项目技术: JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
}

/**
* 添加角色
* @param roleVo
* @return
*/
@RequestMapping("addRole")
public ResultObj addRole(RoleVo roleVo){
try{
this.roleService.addRole(roleVo);
return ResultObj.ADD_SUCCESS;
}catch (Exception e){
e.printStackTrace();
return ResultObj.ADD_ERROR;
}
}

/**
* 修改角色
* @param roleVo
* @return
*/
@RequestMapping("updateRole")
public ResultObj updateRole(RoleVo roleVo){
try {
this.roleService.updateRole(roleVo);
return ResultObj.UPDATE_SUCCESS;
}catch (Exception e){
e.printStackTrace();
return ResultObj.UPDATE_ERROR;
}
}

/**
* 删除角色
* @param roleVo
* @return
*/
@RequestMapping("deleteRole")
public ResultObj deleteRole(RoleVo roleVo){
try {
this.roleService.deleteRole(roleVo.getRoleid());
return ResultObj.DELETE_SUCCESS;
}catch (Exception e){
e.printStackTrace();
return ResultObj.DELETE_ERROR;
}
}

/**
* 批量删除角色
* @param roleVo
* @return
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
    return this.customerService.queryAllCustomer(customerVo);
}

/**
* 添加一个客户
* @param customerVo
* @return
*/
@RequestMapping("addCustomer")
public ResultObj addCustomer(CustomerVo customerVo){
try{
customerVo.setCreatetime(new Date());
this.customerService.addCustomer(customerVo);
return ResultObj.ADD_SUCCESS;
}catch (Exception e){
e.printStackTrace();
return ResultObj.ADD_ERROR;
}
}

/**
* 修改一个客户
* @param customerVo
* @return
*/
@RequestMapping("updateCustomer")
public ResultObj updateCustomer(CustomerVo customerVo){
try{
this.customerService.updateCustomer(customerVo);
return ResultObj.UPDATE_SUCCESS;
}catch (Exception e){
e.printStackTrace();
return ResultObj.UPDATE_ERROR;
}
}

/**
* 删除一个客户
* @param customerVo
* @return
*/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
        if (null==entities.get(i)){
entities.set(i,0.0);
}
}
return entities;
}

/**
* 导出客户数据
* @param customerVo
* @param response
*/
@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 headers = new HttpHeaders();
//封装响应内容类型(APPLICATION_OCTET_STREAM 响应的内容不限定)
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
//设置下载的文件的名称
headers.setContentDispositionFormData("attachment",fileName);
return new ResponseEntity<Object>(bos.toByteArray(),headers, HttpStatus.CREATED);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return null;
}

/**
* 导出出租单数据
* @param rentid
*/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

/**
* 业务管理的路由控制器
*/
@Controller
@RequestMapping("bus")
public class BusController {

/**
* 跳转到客户管理
* @return
*/
@RequestMapping("toCustomerManager")
public String toCustomerManager(){
return "business/customer/customerManager";
}

/**
* 跳转到车辆管理
* @return
*/
@RequestMapping("toCarManager")
public String toCarManager(){
return "business/car/carManager";
}

/**
* 跳转到汽车出租
* @return
*/
@RequestMapping("toRentCarManager")
public String toRentCarManager(){
return "business/rent/rentCarManager";
}

/**
* 跳转到出租单管理的页面
* @return
*/
@RequestMapping("toRentManager")
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
    @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;
}
}

}
package com.yeqifu.bus.controller;



/**
* 检查单管理的控制器
*/
@RestController
@RequestMapping("check")
public class CheckController {

@Autowired
private IRentService rentService;

@Autowired
private ICheckService checkService;

/**
* 根据出租单号查询出租单信息
* @param rentid
* @return
*/
@RequestMapping("checkRentExist")
public Rent checkRentExist(String rentid){
//出租单号不存在,返回一个null,出租单号存在,返回一个rent对象
Rent rent = rentService.queryRentByRentId(rentid);
return rent;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
		e.printStackTrace();
}
}

/**
* 文件下载
* @param response
* @param path
* @param oldName
* @return
*/
public static ResponseEntity<Object> downloadFile(HttpServletResponse response, String path, String oldName) {
//4.使用绝对路径+相对路径去找到文件对象
File file=new File(AppFileUtils.PATH,path);
//5.判断文件是否存在
if(file.exists()) {
try {
try {
//如果名字有中文 要处理编码
oldName=URLEncoder.encode(oldName,"UTF-8");
} catch (Exception e) {
e.printStackTrace();
}
//把file转成一个bytes
byte[] bytes=FileUtils.readFileToByteArray(file);
HttpHeaders header=new HttpHeaders();
//封装响应内容类型(APPLICATION_OCTET_STREAM 响应的内容不限定)
header.setContentType(MediaType.APPLICATION_OCTET_STREAM);
//设置下载的文件的名称
header.setContentDispositionFormData("attachment",oldName);
//创建ResponseEntity对象
ResponseEntity<Object> entity = new ResponseEntity<Object>(bytes,header,HttpStatus.CREATED);
return entity;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}else {
PrintWriter out;
try {
out = response.getWriter();
out.write("文件不存在");
out.flush();
out.close();
} catch (IOException e) {
e.printStackTrace();


项目链接:
https://javayms.github.io?id=081422322105200jq
https://javayms.pages.dev?id=081422322105200jq