基于javaweb的JSP+Servlet租车服务系统(java+servlet+jsp+jdbc+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

480923531103

490923531103

500923531103

520923531103

530923531103

540923531103

基于javaweb的JSP+Servlet租车服务系统(java+servlet+jsp+jdbc+mysql)

项目介绍

系统基于租车业务场景而搭建的O2O服务平台,可为用户提供商务租车、接送机、旅游租车、企业租车、自驾租车、婚庆用车等自助租车服务。

系统根据相关版本提供相关内容服务。包含车辆库管理、司机管理、订单管理、活动管理、评价管理等。

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.数据库:MySql 5.7版本; 6.是否Maven项目: 否;

技术栈

Servlet、JSP、JDBC、MySQL5.7、Tomcat8

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,然后运行; 3. 将项目中src/com/dao/DB.java配置文件中的数据库配置改为自己的配置; 4. 运行项目,在浏览器中输入地址; 前台访问地址:http://localhost:8080/opencar/ 后台访问地址:http://localhost:8080/opencar/admin/login 管理员账号/密码:admin/zft3285497

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
	super();
}

/**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}

/**
* The doGet method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
ShopService ss=new ShopService();
UserService us=new UserService();
String jsp="";
Template tpl=null;
String pageNoTem=request.getParameter("page") ;
Integer pageNo=0;
if(pageNoTem!=null){
pageNo=Integer.parseInt(pageNoTem);
}else{
pageNo=1;
}
String pageSizeTem=CommonUrl.getValue("user_page");
Integer pageSize=Integer.parseInt(pageSizeTem);
List<Aunt> auntList=null;
List<Comment> commetnList=null;
Aunt aunt=null;
Integer sum=0;
String tem_aunt_id=request.getParameter("aunt_id");
Integer aunt_id=0;
if(tem_aunt_id!=null && !tem_aunt_id.equals("")){
aunt_id=Integer.parseInt(tem_aunt_id);
}
try {
tpl =us.getTemplate();
auntList=ss.getAuntList(pageNo, pageSize, null);
sum=ss.getAuntCount(null);
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
HttpSession session = request.getSession(true);
String order_id=request.getParameter("order_id");
Object ordinary_user=session.getAttribute("ordinary_user");
String json="";

if(ordinary_user==null){//非登陆用户
out.print("{\"tip\":\"请先登录\"}");
}else{//登陆用户
String flag="";
User user=(User)ordinary_user;
GoodsOrder go=null;
try {
go = ss.getGoodsOrderById(Integer.parseInt(order_id));
} catch (NumberFormatException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(go.getUser_id().equals(user.getId())){//自己才能取消订单
flag=ss.updateOrderFlag(Integer.parseInt(order_id),4);
List<OrderMoneyRecord> moneyList=null;
try {
moneyList = ss.getOrderMoneyRecordByOrderId(Integer.parseInt(order_id));
} catch (NumberFormatException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Double money=0.0;
for(int i=0;i<moneyList.size();i++){
OrderMoneyRecord record=moneyList.get(i);
if(record.getFlag().equals(1) && !record.getSource().equals(6) && !record.getSource().equals(7)){
money+=Double.parseDouble(record.getMoney());
ss.updateuserCardFlag(record.getId(),2);
}
}
String timeStr=StringUtil.getTimeStr();
String nowStr[]=timeStr.split("-");
ss.updateUserMoney(user.getId(),money);
ss.addRechargeRecord(user.getId(),3, 1, user.getCard(), money.toString(), Integer.parseInt(nowStr[0]), Integer.parseInt(nowStr[1]), Integer.parseInt(nowStr[2]),2,null,null,0,1);
if(flag.equals("ok")){
json="{\"tip\":\"订单取消成功\"}";
}else{
json="{\"tip\":\"订单取消失败\"}";
}
}else{
json="{\"tip\":\"此单并非您的单,您不能做次操作\"}";
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
		
}

/**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet( request, response);
}

/**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occurs
*/
public void init() throws ServletException {
// Put your code here
}

}


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
	}

/**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

}

/**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occurs
*/
public void init() throws ServletException {
// Put your code here
}

}



@WebServlet(displayName="用户订单",name="PcUserOrder",urlPatterns="/pc/pcUserOrder")
public class PcUserOrder extends HttpServlet {

private static final long serialVersionUID = 1L;

/**
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
@WebServlet(displayName="用户账户余额",name="PcUserMoney",urlPatterns="/pc/pcUserMoney")
public class PcUserMoney extends HttpServlet {

/**
* Constructor of the object.
*/
public PcUserMoney() {
super();
}

/**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}

/**
* The doGet method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=UTF-8");
ShopService ss=new ShopService();
StatisticsService statis=new StatisticsService();

HttpSession session = request.getSession(true);
Object ordinary_user=session.getAttribute("ordinary_user");
User user=null;
if(ordinary_user==null){//非登陆用户
RequestDispatcher rd = request.getRequestDispatcher("/template/default/page/user_login.jsp");
rd.forward(request,response);
}else{//登陆用户
user=(User)ordinary_user;
List<OrderMoneyRecord> recordList=null;
Integer sum=0;
String pageNoTem=request.getParameter("page") ;
Integer pageNo=0;


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