基于javaweb+mysqlssm汽车出租管理系统(java+ssm+jsp+jquery+mysql)

私信源码获取调试交流

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

基于javaweb+mysql的SSM汽车出租管理系统(java+ssm+jsp+jquery+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.数据库:MySql 5.7版本; 6.是否Maven项目:否;

技术栈

  1. 后端:Spring+SpringMVC+Mybatis 2. 前端:JSP+CSS+JavaScript+jquery

使用说明

  1. 使用Navicat或者其它工具,在mysql创建对应名称数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令然后运行; 3. 将项目中jdbc.properties配置文件中的数据库配置改为自己配置; 4. 运行项目,输入localhost:8080/ 登录
		
		PrintWriter writer = this.getPrintWriter(response);
		
		
		
		HttpSession session = request.getSession();
		User user = (User) session.getAttribute("qiantai");
		
		user = userService.selectBeanById(user.getId());
		
		bean.setKehuid(user.getId());
		bean.setName(user.getName());
		bean.setShijian1(Util.getTime());
		bean.setZhuangtai("未回复");
		
		
		liuyanService.insertBean(bean);
		
	
		
		
	
	}
	
	
	//我的留言
	@RequestMapping("/liuyanlist.do")
	public String liuyanlist(HttpServletRequest request,String pagenum,String ltitle){

		//查询条件返回页面
		if (ltitle != null && !"".equals(ltitle)) {

			request.setAttribute("ltitle", ltitle);
		}
		
		HttpSession session = request.getSession();
		User user = (User) session.getAttribute("qiantai");
		
		//分页功能默认一页
		int currentpage = 1;
		//获取当前
		if (pagenum != null) {
			currentpage = Integer.parseInt(pagenum);
		}

		//查询列表
		List<Liuyan> list = liuyanService.selectBeanList((currentpage - 1)
		if(kehu==null){
			kehu = new User();
			kehu.setCreatetime(Util.getTime());
			kehu.setName(bean.getXingming());
			kehu.setPassword("111111");
			kehu.setRole(4);
			kehu.setSfz(sfz);
			kehu.setTej(bean.getDianhua());
			kehu.setUsername(sfz);
			
			userService.insertBean(kehu);
		}
		
		bean.setKehuid(kehu.getId());
		
		HttpSession session = request.getSession();
		
		User user = (User)session.getAttribute("manage");
		
		bean.setWorkid(user.getId());
		

		String sfz2 =  Util.uploadFile(request, prodFile1);
		String jsz =  Util.uploadFile(request, prodFile2);

		bean.setSfz2(sfz2);
		bean.setJsz(jsz);
		
		bean.setShijian1(Util.getTime());
		bean.setZhuangtai("出租中");

		jiluService.insertBean(bean);
		
		car.setStatus("租赁中");
		
		carService.updateBean(car);

		this.getPrintWriter(response).print("<script language=javascript>alert('操作成功');" +
		"window.location.href='jilulist.do';</script>");
	}
	
	
	//租车记录列表
	@RequestMapping("/jilulist.do")
	public String jilulist(HttpServletRequest request,String pagenum,String chepai,String xingming,String sfz){
		
		HttpSession session = request.getSession();
		
		User user = (User)session.getAttribute("manage");


		//查询条件返回页面
		if (username != null &amp;&amp; !"".equals(username)) {

			request.setAttribute("username", username);
		}

		//分页功能默认一页
		int currentpage = 1;
		//获取当前
		if (pagenum != null) {
			currentpage = Integer.parseInt(pagenum);
		}

		//查询列表
		List<User> list = userService.selectBeanList((currentpage - 1)
				* pageSize, pageSize, username);

		//列表返回页面
		request.setAttribute("list", list);

		//获取总数量
		int total = userService.selectBeanCount(username);

		//分页信息返回页面
		request.setAttribute("pagerinfo", Pager.getPagerNormal(total, pageSize,
				currentpage, "userlist.do", "共有" + total + "条记录"));

		//查询按钮
		request.setAttribute("url", "userlist.do");

		//添加更新删除等按钮
		request.setAttribute("url2", "user");

		request.setAttribute("title", "人员管理");

		return "user/userlist.jsp";

	}

	//跳转添加人员页面
	@RequestMapping("/useradd.do")
$(function(){
    $("#banner").KinSlideshow({
            moveStyle:"right",
            titleBar:{titleBar_height:32,titleBar_bgColor:"#000",titleBar_alpha:0.7},
            titleFont:{TitleFont_size:12,TitleFont_color:"#FFFFFF",TitleFont_weight:"normal"},
            btn:{btn_bgColor:"#2d2d2d",btn_bgHoverColor:"#1072aa",btn_fontColor:"#FFF",btn_fontHoverColor:"#FFF",btn_borderColor:"#4a4a4a",btn_borderHoverColor:"#1188c0",btn_borderWidth:1}
    });
})
</script>

  
  <div id="MainMenu" class="ddsmoothmenu" >
    <ul>

     

    </ul>
  </div>
  

<!-- js图片图片文字说明 -->
  <div id="banner" style="margin-top: -40px;margin-left: 1px;"  align="center" >
 
    <c:forEach items="${piclist}" var="pic">
    <a href="${pic.href }" ><img src="<%=basePath %>${pic.path }" alt="${pic.info }" width="284" height="251"/></a>
	</c:forEach>

  </div>

</TD>
    <TD vAlign=bottom width=8>&nbsp;</TD>
    <TD width="514" vAlign=top>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR>
          <TD vAlign=top><TABLE height=24 cellSpacing=0 cellPadding=0 width="100%" 
              border=0><TBODY>
              <TR 
              style="BACKGROUND: url(qtimages/zjgdj_sy_15.gif) repeat-x 50% top">
                <TD width=13></TD>
                <TD style="FONT-SIZE: 14px; COLOR: #fff; BACKGROUND-REPEAT: no-repeat" align=middle width=89  background=qtimages/zjgdj_sy_16.gif>
                <STRONG><a href="gonggaolist.do" ><font class="STYLE1">最新公告</font></a></STRONG>
                </TD>
                <TD width=27></TD>

@Service("userService")
public class UserServiceImpl implements UserService {
	
	@Resource
	private UserDao userDao;
	
	public void insertBean(User bean) {
		userDao.insertBean(bean);
		
	}
	
	public void deleteBean(int id) {
		userDao.deleteBean(id);
		
	}
	
	public void updateBean(User bean){
		
		userDao.updateBean(bean);
		
	}
	

	//用户登录
	public User userlogin(String username,String password,int role){
		
		return userDao.userlogin(username, password,role);
		
	}
	
	
	
	//验证用户名是否存在
	public User useryz(String username){
		
		
		return userDao.useryz(username);
	}
	
	
	//验证身份证是否存在
	public User sfzyz(String sfz){
		
		
					</TR>
				</TABLE>
</BODY>
</HTML>

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.util.Util"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<html>
<head>
<title>汽车租赁网站</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<LINK href="qtimages/style.css" type=text/css rel=stylesheet>

<style type="text/css">
<!--
.STYLE2 {	color: #0066CC;
	font-weight: bold;
}
-->
</style>
<style type="text/css">
<!--
.STYLE1 {color: #FFFFFF}
.STYLE5 {color: #CCFFCC;
	font-size: 26pt;
}
.STYLE6 {color: #288848}
-->
</style>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<%@ include file="qttop.jsp"%>
	private String chepai;//车牌

	private int carid;//关联的车辆信息外键
	
	private Car car;//车辆实体
	
	private int kehuid;//租车的客户ID,外键
	
	private User kehu;//租车的客户
	
	private int workid;//经办的工作人员ID,外键

	private User work;//经办的工作人员
	
	private int jishuid;//技术人员ID,外键
	
	private User jishu;//技术人员
	
	private String sfz;//身份证号码
	
	private String dianhua;//联系电话
	
	private String xingming;//客户姓名
	
	//private String username;//客户昵称
	
	private String sfz2;//身份证复印件
	
	private String jsz;//驾驶证复印件
	
	private String shijian1;//出租时间
	
	private String shijian2;//还车时间
	
	private Double tzujin;//总租金  
	
	//流程:工作人员出租车--》客户还车--》技术确认车辆完好--》工作人员完成结算
	private String zhuangtai;//状态  出租中,还车中,等待技术人员确认,技术人员已确认,完成结算

	private int tianshu;//已租天数

	private String beizhu;//备注
	
	private int weixiu;//维护费

	public int getId() {
		return id;
	}

			
			String enddate=bean.getEnddate().split(" ")[0];
			//会员过期
			if(enddate.compareTo(now)>0){
				Date ed=sdf.parse(enddate);
				rightNow.setTime(ed);
				rightNow.add(Calendar.MONTH,month);//日期加*个月
				String newEndDate=sdf.format(rightNow.getTime());
				bean.setEnddate(newEndDate);

			}else{//已过期
				Calendar nowCal = Calendar.getInstance();
				nowCal.add(Calendar.MONTH,month);//日期加*个月
				String newEndDate=sdf.format(nowCal.getTime());
				//System.out.print(newEndDate+"newEndDate"+"p:"+points+"l:"+level);
				bean.setEnddate(newEndDate);
			}
			vipService.updateBean(bean);	
			
			
		}else{//新vip客户
			Vip bean1=new Vip();
			bean1.setUsername(username);
			bean1.setKehuid(kehuid);
			bean1.setPoints(points);
			bean1.setConsumed(consumed);
			int level=1+(int)Math.round(consumed)/1000;//等级根据消费金额确定,消费1000为1级
			bean1.setLevel(level);
			Calendar nowCal = Calendar.getInstance();
			nowCal.add(Calendar.MONTH,month);//日期加*个月
			String newEndDate=sdf.format(nowCal.getTime());

			bean1.setEnddate(newEndDate);
			vipService.insertBean(bean1);
		}
		

		
		
		
		
		
									src="images/menu_icon.gif" width=9></TD>
								<TD><A class=menuChild href="carlist4.do" target=main>车辆收入统计</A>
								</TD>
							</TR>

							<TR height=4>
								<TD colSpan=2></TD>
							</TR>

						</TABLE>

					</c:if>

					<!-- 工作1 -->
					<c:if test="${manage.role==2}">

						<TABLE cellSpacing=0 cellPadding=0 width=150 border=0>
							<TR height=22>
								<TD style="PADDING-LEFT: 30px" background=images/menu_bt.jpg>
									<A class=menuParent onclick=expand(1)
									href="javascript:void(0);">车辆租赁</A>
								</TD>
							</TR>
							<TR height=4>
								<TD></TD>
							</TR>
						</TABLE>
						<TABLE id=child1 style="DISPLAY: none" cellSpacing=0 cellPadding=0
							width=150 border=0>

							<TR height=20>
								<TD align=middle width=30><IMG height=9
									src="images/menu_icon.gif" width=9></TD>
								<TD><A class=menuChild href="carlist3.do" target=main>车辆租赁管理</A>
								</TD>
							</TR>

							<TR height=20>
								<TD align=middle width=30><IMG height=9
									src="images/menu_icon.gif" width=9></TD>
								<TD><A class=menuChild href="jilulist.do" target=main>还车管理</A>
								</TD>
							</TR>

							<TR height=20>
								<TD align=middle width=30><IMG height=9
									src="images/menu_icon.gif" width=9></TD>
		
		User user = (User)session.getAttribute("manage");
		
		Yuding bean = yudingService.selectBeanById(Integer.parseInt(id));
		
		if("预定成功".equals(zhuangtai)){
			bean.setZhuangtai("预定成功");
			bean.setShijian2(Util.getTime());
			bean.setWorkid(user.getId());
			
			yudingService.updateBean(bean);
			
			Car car = carService.selectBeanById(bean.getCarid());
			
			car.setStatus("租赁中");
			
			carService.updateBean(car);
			
			Jilu jilu = new Jilu();
			jilu.setBeizhu(bean.getBeizhu());
			jilu.setCarid(bean.getCarid());
			jilu.setChepai(bean.getChepai());
			jilu.setDianhua(bean.getDianhua());
			jilu.setJsz(bean.getJsz());
			jilu.setKehuid(bean.getKehuid());
			jilu.setSfz(bean.getSfz());
			jilu.setSfz2(bean.getSfz2());
			jilu.setShijian1(Util.getTime());
			jilu.setWorkid(user.getId());
			jilu.setXingming(bean.getXingming());
			jilu.setZhuangtai("出租中");
			
			jiluService.insertBean(jilu);
			
		}else{
			bean.setZhuangtai("预定失败");
			bean.setShijian2(Util.getTime());
			bean.setWorkid(user.getId());
			
			yudingService.updateBean(bean);
			
			Car car = carService.selectBeanById(bean.getCarid());
			
			car.setStatus("待租赁");
			
			carService.updateBean(car);
		}
		
		
			where username=#{username} and password=#{password} and role=#{role}
	</select>
	
	
	<!-- 验证用户名是否存在 -->
	<select id="useryz" resultMap="userResultMap" >
		select 
			id ,
			username ,
			password ,
			createtime ,
			role ,
			name ,
			tej 
		from 
			t_user  
			where username=#{username} 
	</select>
	
	<!-- 验证身份证号是否存在 -->
	<select id="sfzyz" resultMap="userResultMap" >
		select 
			id ,
			username ,
			password ,
			createtime ,
			role ,
			name ,
			sfz ,
			tej 
		from 
			t_user  
			where sfz=#{sfz} 
	</select>
	
	
	
	
	<select id="selectBeanById" parameterType="com.entity.User"
		resultMap="userResultMap" >
		select 
			id ,
			username ,
			password ,
			createtime ,
			role ,

		request.setAttribute("title", "客户还车");
		
		long t1 = new Date().getTime();//当前时间毫秒数
		
		long t2 = Util.parseTime(bean.getShijian1()).getTime();//出租时间毫秒数
		
		long t3 = 24*60*60*1000;//一天的毫秒数
		
		long tianshu = ((t1-t2)/t3 )+1;//已租天数
		

		long tzujin = tianshu*car.getZujin();  //总租金
		
		
		Vip vip = vipService.selectBeanByKehuid(bean.getKehuid());
		double tzujin2 =0.0d;
		if(vip!=null) {
			tzujin2 = tianshu*car.getZujin()*vip.getDiscount() ;  //会员折后总租金	
		}else {
			tzujin2=tzujin;
		}

		request.setAttribute("tzujinbefore", tzujin);//未折扣前
		
		request.setAttribute("tianshu", tianshu);
		
		request.setAttribute("tzujin", tzujin2);
		
		
		request.setAttribute("shijian2", Util.getTime());
		
		

		return "jilu/jiluupdate.jsp";

	}

	//客户还车操作
	@RequestMapping("/jiluupdate2.do")
	public void jiluupdate2(HttpServletResponse response,HttpServletRequest request){

		String id = request.getParameter("id");
		String shijian2 = request.getParameter("shijian2");
		String tianshu = request.getParameter("tianshu");
		String tzujin = request.getParameter("tzujin");
		
		Jilu jilu = jiluService.selectBeanById(Integer.parseInt(id));
		
		
		jilu.setShijian2(shijian2);
		jilu.setTianshu(Integer.parseInt(tianshu));
		if (pagenum != null) {
			currentpage = Integer.parseInt(pagenum);
		}

		HttpSession session = request.getSession();
		
		User user = (User)session.getAttribute("manage");
		
		//查询列表
		List<Jilu> list = jiluService.selectBeanList((currentpage - 1)
				* pageSize, pageSize, chepai,sfz,xingming,null,0,user.getId(),0);
		
		for(Jilu jilu:list){
			jilu.setCar(carService.selectBeanById(jilu.getCarid()));
		}

		//列表返回页面
		request.setAttribute("list", list);

		//获取总数量
		int total = jiluService.selectBeanCount(chepai,sfz,xingming,null,0,user.getId(),0);

		//分页信息返回页面
		request.setAttribute("pagerinfo", Pager.getPagerNormal(total, pageSize,
				currentpage, "jilulist4.do", "共有" + total + "条记录"));

		//查询按钮
		request.setAttribute("url", "jilulist4.do");

		//添加更新,删除等按钮
		request.setAttribute("url2", "jilu");

		request.setAttribute("title", "我的确认车辆");

		return "jilu/jilulist4.jsp";

	}
	
	
	
	//确认管理
	@RequestMapping("/jilulist5.do")
	public String jilulist5(HttpServletRequest request,String pagenum,String chepai,String xingming,String sfz){
		
		
		//查询条件返回页面
		if (chepai != null && !"".equals(chepai)) {

			request.setAttribute("chepai", chepai);
		}
		if (xingming != null && !"".equals(xingming)) {

			bean1.setConsumed(consumed);
			int level=1+(int)Math.round(consumed)/1000;//等级根据消费金额确定,消费1000为1级
			bean1.setLevel(level);
			Calendar nowCal = Calendar.getInstance();
			nowCal.add(Calendar.MONTH,month);//日期加*个月
			String newEndDate=sdf.format(nowCal.getTime());

			bean1.setEnddate(newEndDate);
			vipService.insertBean(bean1);
		}
		

		
		
		
		
		
		request.setAttribute("bean", bean);
		request.setAttribute("title", "会员充值/续费页");
		
		//return "vip/vipcharge.jsp";

	}
	
}

	
	@Resource
	private YudingService yudingService;
	
	@Resource
	private JiluService jiluService;
	
	@Resource
	private LiuyanService liuyanService;
	
	@Resource
	private VipService vipService;
	
	
	@Value("#{jdbc.pageSize}")
	private int pageSize;

	// 获取输出对象
	public PrintWriter getPrintWriter(HttpServletResponse response) {
		response.setCharacterEncoding("utf-8");
		response.setContentType("text/html; charset=utf-8");
		PrintWriter writer = null;
		try {
			writer = response.getWriter();
		} catch (IOException e) {
			e.printStackTrace();
		}

		return writer;
	}

	
	//网站首页
	@RequestMapping("/index.do")
	public String index(HttpServletRequest request,HttpServletResponse response){
		//网站公告
		request.setAttribute("gonggaolist", gonggaoService.selectBeanList(0, 8, null));
		//最新车辆
		request.setAttribute("carlist", carService.selectBeanList(0, 4, null,null,null,null));
							</TR>

							<TR height=20>
								<TD align=middle width=30><IMG height=9
									src="images/menu_icon.gif" width=9></TD>
								<TD><A class=menuChild href="liuyanlist2.do" target=main>处理留言</A>
								</TD>
							</TR>

							<TR height=4>
								<TD colSpan=2></TD>
							</TR>

						</TABLE>

						<TABLE cellSpacing=0 cellPadding=0 width=150 border=0>
							<TR height=22>
								<TD style="PADDING-LEFT: 30px" background=images/menu_bt.jpg>
									<A class=menuParent onclick=expand(4)
									href="javascript:void(0);">客户信息</A>
								</TD>
							</TR>
							<TR height=4>
								<TD></TD>
							</TR>
						</TABLE>
						<TABLE id=child4 style="DISPLAY: none" cellSpacing=0 cellPadding=0
							width=150 border=0>

							<TR height=20>
								<TD align=middle width=30><IMG height=9
									src="images/menu_icon.gif" width=9></TD>
								<TD><A class=menuChild href="userlist2.do" target=main>客户信息查询</A>
								</TD>
							</TR>

							<TR height=4>
								<TD colSpan=2></TD>
                            <input type="submit" name="Submit5" value="注册"  style="width:80px; height:30px; border:solid 1px #000000; color:#666666"/>
                              &nbsp; &nbsp; &nbsp; &nbsp;
							<input type="reset" name="Submit22" value="重置"  style="width:80px; height:30px; border:solid 1px #000000; color:#666666" /></td>
                          </tr>
                        </table>
                      </form>
                        <p align="center">&nbsp;</p>
                        <p align="center"></p>
                        <p align="center">&nbsp;</p></TD>
                    </TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
            </TD></TR></TBODY></TABLE>
      <TABLE height=8 cellSpacing=0 cellPadding=0 width="100%" align=center 
      border=0>
        <TBODY>
        <TR>
          <TD></TD></TR></TBODY></TABLE>
      </TD>
    <TD width=8></TD>
    <TD vAlign=top width=220><%@ include file="qtleft.jsp"%></TD></TR></TBODY></TABLE>
<TABLE height=8 cellSpacing=0 cellPadding=0 width=1002 align=center 
bgColor=#ffffff border=0>
  <TBODY>
  <TR>
    <TD></TD></TR></TBODY></TABLE>
<TABLE height=8 cellSpacing=0 cellPadding=0 width=1002 align=center 
bgColor=#ffffff border=0>
  <TBODY>
  <TR>
    <TD></TD></TR></TBODY></TABLE>
<TABLE style="BORDER-RIGHT: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid" 
cellSpacing=0 cellPadding=0 width=1002 align=center bgColor=#ffffff border=0>
  <TBODY>
  <TR>
    <TD 
    style="PADDING-RIGHT: 8px; PADDING-LEFT: 20px; PADDING-BOTTOM: 8px; PADDING-TOP: 8px" 
    vAlign=top>
      
      </TD></TR></TBODY></TABLE>
<TABLE height=4 cellSpacing=0 cellPadding=0 width=1002 align=center 
bgColor=#ffffff border=0>
  <TBODY>
  <TR>
    <TD width=5><IMG height=3 src="qtimages/zjgdj_64.gif" width=5></TD>
    <TD background=qtimages/zjgdj_65.gif><IMG height=3 
      src="qtimages/zjgdj_65.gif" width=1></TD>
    <TD width=4><IMG height=3 src="qtimages/zjgdj_67.gif" 

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

原文地址:https://blog.csdn.net/2301_81060432/article/details/134586349

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任

如若转载,请注明出处:http://www.7code.cn/show_26162.html

如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱:suwngjj01@126.com进行投诉反馈,一经查实,立即删除!

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注