Java项目:SSM出租车管理系统

news2024/11/14 14:40:30

作者主页:源码空间站2022

 简介:Java领域优质创作者、Java项目、学习资料、技术互助

文末获取源码

项目介绍

超级管理员角色包含以下功能:
超级管理员管理,公告管理,系统管理员管理,司机管理,车辆管理,维修保养管理,运营里程记录等功能。

普通管理员角色包含以下功能:
普通管理员登录,公告管理,司机管理,出租车信息管理,维修保养管理,运营里程管理等功能。

环境需要

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版本;

技术栈

1. 后端:Spring+SpringMVC+Mybatis

2. 前端:HTML+CSS+JavaScript+jsp

使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;

4. 运行项目,输入localhost:8080/ 登录

运行截图

超级管理员角色

 普通管理员角色

相关代码

首页相关

package com.controller;


import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;

import com.entity.Car;
import com.entity.Gonggao;
import com.entity.Jilu;
import com.entity.Liuyan;
import com.entity.User;
import com.entity.Vip;
import com.entity.Yuding;
import com.service.CarService;
import com.service.GonggaoService;
import com.service.JiluService;
import com.service.LiuyanService;
import com.service.PicService;
import com.service.UserService;
import com.service.VipService;
import com.service.YudingService;
import com.util.Pager;
import com.util.Util;



@Controller
@RequestMapping("/")
public class IndexController {

	
	@Resource
	private UserService userService;
	
	@Resource
	private GonggaoService gonggaoService;
	
	@Resource
	private CarService carService;
	
	@Resource
	private PicService picService;
	
	@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));
		//展示图片
		request.setAttribute("piclist", picService.selectBeanList(0, 99));
		return "index.jsp";
	}
	
	
	//网站公告列表
	@RequestMapping("/gonggaolist.do")
	public String gonggaolist(HttpServletRequest request,String pagenum,String gbiaoti){

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

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

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

		//查询列表
		List<Gonggao> list = gonggaoService.selectBeanList((currentpage - 1)* pageSize, pageSize, gbiaoti);

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

		//获取总数量
		int total = gonggaoService.selectBeanCount(gbiaoti);

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


		request.setAttribute("title", "网站公告");
		

		return "gonggaolist.jsp";

	}
	
	
	
	//网站公告详情页面
	@RequestMapping("/gonggaoview.do")
	public String gonggaoview(HttpServletRequest request,int id){

		Gonggao bean = gonggaoService.selectBeanById(id);

		request.setAttribute("bean", bean);

		request.setAttribute("title", "网站公告详情");
		

		return "gonggaoview.jsp";

	}
	
	//车辆列表
	@RequestMapping("/carlist.do")
	public String carlist(HttpServletRequest request,String pagenum,String pinpai,String xinghao,String yanse){

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

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

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

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

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

		//查询列表
		List<Car> list = carService.selectBeanList((currentpage - 1)* pageSize, pageSize, null,pinpai,xinghao,yanse);

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

		//获取总数量
		int total = carService.selectBeanCount(null,pinpai,xinghao,yanse);

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


		request.setAttribute("title", "车辆");
		

		return "carlist.jsp";

	}
	
	//车辆详情页面
	@RequestMapping("/carview.do")
	public String carview(HttpServletRequest request,int id){

		Car bean = carService.selectBeanById(id);

		request.setAttribute("bean", bean);

		request.setAttribute("title", "车辆详情");
		

		return "carview.jsp";

	}
	
	
	//跳转到用户注册页面
	@RequestMapping("/register.do")
	public String register(HttpServletRequest request){

		request.setAttribute("title", "用户注册");

		return "register.jsp";

	}
	
	
	//用户注册操作
	@RequestMapping("/register2.do")
	public void register2(HttpServletRequest request,HttpServletResponse response,User user){
		
		PrintWriter writer = this.getPrintWriter(response);

		User bean = userService.useryz(user.getUsername());
		
		if(bean!=null){
			
			writer.print("<script language=javascript>alert('该用户名已经存在,注册失败!');window.location.href='register.do';</script>");
		
			return;	
		}
		
		bean = userService.sfzyz(user.getSfz());
		
		if(bean!=null){
			
			writer.print("<script language=javascript>alert('该身份证已经存在,注册失败!');window.location.href='register.do';</script>");
		
			return;	
		}
		
		user.setCreatetime(Util.getTime());
		user.setRole(4);
		
		userService.insertBean(user);
		
		writer.print("<script language=javascript>alert('注册成功');window.location.href='login.do';</script>");
		

	}
	
	
	//跳转到用户登录页面
	@RequestMapping("/login.do")
	public String login(HttpServletRequest request){

		request.setAttribute("title", "用户登录");

		return "login.jsp";

	}
	
	
	//用户登录操作
	@RequestMapping("/login2.do")
	public void login2(HttpServletRequest request,HttpServletResponse response,String username,String password){
		
		PrintWriter writer = this.getPrintWriter(response);
		
		
		User bean = userService.userlogin(username, password, 4);

		
		if(bean==null){
			
			writer.print("<script language=javascript>alert('用户名或者密码错误,登录失败!');window.location.href='login.do';</script>");
		
			
		}else{
			
			HttpSession session = request.getSession();
			session.setAttribute("qiantai", bean);
			session.setAttribute("username", bean.getUsername());
			
			Vip vip=vipService.selectBeanByUsername(username);
			if(vip!=null) {
				session.setAttribute("vip", vip);
			}else {
				Vip vip2=new Vip();
				vip2.setUsername(username);
				vip2.setLevel(0);
				vip2.setPoints(0);
				session.setAttribute("vip", vip2);
			}
			writer.print("<script language=javascript>alert('登录成功');window.location.href='.';</script>");
			
		}

	}
	
	
	
	//安全退出操作
	@RequestMapping("/loginout.do")
	public void loginout(HttpServletRequest request,HttpServletResponse response){
		
		PrintWriter writer = this.getPrintWriter(response);
		
		HttpSession session = request.getSession();
		session.removeAttribute("qiantai");
		
		writer.print("<script language=javascript>alert('退出成功');window.location.href='.';</script>");
		

	}
	
	
	
	//跳转到修改密码页面
	@RequestMapping("/password.do")
	public String password(HttpServletRequest request){

		request.setAttribute("title", "修改密码");

		return "password.jsp";

	}
	
	
	//修改密码操作
	@RequestMapping("/password2.do")
	public void password2(HttpServletRequest request,HttpServletResponse response,String password1,String password2){
		
		PrintWriter writer = this.getPrintWriter(response);
		
		HttpSession session = request.getSession();
		User user = (User) session.getAttribute("qiantai");
		
		
		User bean = userService.userlogin(user.getUsername(), password1, 4);

		
		if(bean==null){
			
			writer.print("<script language=javascript>alert('原密码错误,修改失败!');window.location.href='password.do';</script>");
		
			
		}else{
			
			bean.setPassword(password2);
			
			userService.updateBean(bean);
			
			writer.print("<script language=javascript>alert('修改成功,请重新登录');window.location.href='loginout.do';</script>");
			
		}
		
		
	}
	
	
	//跳转到个人信息维护页面
	@RequestMapping("/userupdate.do")
	public String userupdate(HttpServletRequest request){

		request.setAttribute("title", "个人信息维护");
		
		HttpSession session = request.getSession();
		User user = (User) session.getAttribute("qiantai");
		
		
		User bean = userService.selectBeanById(user.getId());
		
		request.setAttribute("bean", bean);

		return "userupdate.jsp";

	}
	
	
	//个人信息维护操作
	@RequestMapping("/userupdate2.do")
	public void userupdate2(HttpServletRequest request,HttpServletResponse response,String name,String tej){
		
		PrintWriter writer = this.getPrintWriter(response);
		
		HttpSession session = request.getSession();
		User user = (User) session.getAttribute("qiantai");
		
		
		User bean = userService.selectBeanById(user.getId());

		
		bean.setTej(tej);
		bean.setName(name);
		
		userService.updateBean(bean);
		
		writer.print("<script language=javascript>alert('修改成功');window.location.href='userupdate.do';</script>");

		
		
	}
	
	
	
	
	//跳转预定租车页面
	@RequestMapping("/yudingadd.do")
	public String yudingadd(HttpServletRequest request,HttpServletResponse response,int carid) {
		
		PrintWriter writer = this.getPrintWriter(response);
		
		HttpSession session = request.getSession();
		User user = (User) session.getAttribute("qiantai");
		
		if (user == null) {
			writer.print("<script  language='javascript'>alert('请先登录');window.location.href='login.do';</script>");
			return  null;
		}
		
		Car car = carService.selectBeanById(carid);
		
		request.setAttribute("car", car);
		
		user = userService.selectBeanById(user.getId());
		
		request.setAttribute("user", user);
		
		
		request.setAttribute("url", "yudingadd2.do?carid="+carid);
		request.setAttribute("title", "预定租车");
	
		return "yudingadd.jsp";
		
	}
	
	
	//预定租车操作
	@RequestMapping("/yudingadd2.do")
	public void yudingadd2(HttpServletRequest request,HttpServletResponse response,Yuding bean,MultipartFile prodFile1,MultipartFile prodFile2) throws IOException{
		
		PrintWriter writer = this.getPrintWriter(response);
		
		Car car = carService.selectBeanById(bean.getCarid());
		
		int carid = car.getId();
	
		if(prodFile1==null || prodFile1.getSize()<=0 ){
			this.getPrintWriter(response).print("<script language=javascript>alert('身份证复印件不能为空');" +
			"window.location.href='yudingadd.do?carid="+carid+"';</script>");
			return;
		}
		
		if(prodFile2==null || prodFile2.getSize()<=0 ){
			this.getPrintWriter(response).print("<script language=javascript>alert('驾驶证复印件不能为空');" +
			"window.location.href='yudingadd.do?carid="+carid+"';</script>");
			return;
		}
		
		HttpSession session = request.getSession();
		User user = (User) session.getAttribute("qiantai");
		
		bean.setZhuangtai("处理中");
		bean.setShijian1(Util.getTime());

		bean.setChepai(car.getChepai());
		bean.setKehuid(user.getId());
		
		user = userService.selectBeanById(user.getId());
		
		bean.setSfz(user.getSfz());
		
		String sfz2 =  Util.uploadFile(request, prodFile1);
		String jsz =  Util.uploadFile(request, prodFile2);

		bean.setSfz2(sfz2);
		bean.setJsz(jsz);
		
		yudingService.insertBean(bean);
		
		car.setStatus("预定中");
		
		carService.updateBean(car);
		
		writer.print("<script  language='javascript'>alert('操作成功');window.location.href='yudinglist.do'; </script>");
		
	
	}
	
	
	//我的预定
	@RequestMapping("/yudinglist.do")
	public String yudinglist(HttpServletRequest request,String pagenum,String chepai){

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

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

		//查询列表
		List<Yuding> list = yudingService.selectBeanList((currentpage - 1)
				* pageSize, pageSize,chepai,null,user.getId(),0,null);

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

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

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


		request.setAttribute("title", "我的预定");
		

		return "yudinglist.jsp";

	}
	
	//查看预定详情页面
	@RequestMapping("/yudingview.do")
	public String yudingview(HttpServletRequest request,int id){

		Yuding bean = yudingService.selectBeanById(id);

		request.setAttribute("bean", bean);

		request.setAttribute("title", "预定详情");
		

		return "yudingview.jsp";

	}
	
	
	
	//取消预定租车操作
	@RequestMapping("/yudingupdate2.do")
	public void yudingupdate2(HttpServletRequest request,HttpServletResponse response,int id) throws IOException{
		
		PrintWriter writer = this.getPrintWriter(response);
		
		Yuding yuding = yudingService.selectBeanById(id);
		
		yuding.setZhuangtai("已取消");
		
		yudingService.updateBean(yuding);
		
		Car car = carService.selectBeanById(yuding.getCarid());
		
		car.setStatus("待租赁");
		
		carService.updateBean(car);
		
		writer.print("<script  language='javascript'>alert('操作成功');window.location.href='yudinglist.do'; </script>");
		
	
	}
	
	
	//删除预定租车操作
	@RequestMapping("/yudingdelete.do")
	public void yudingdelete(HttpServletRequest request,HttpServletResponse response,int id) throws IOException{
		
		PrintWriter writer = this.getPrintWriter(response);

		
		yudingService.deleteBean(id);
		
		
		writer.print("<script  language='javascript'>alert('操作成功');window.location.href='yudinglist.do'; </script>");
		
	
	}
	
	
	//我的租车
	@RequestMapping("/jilulist.do")
	public String jilulist(HttpServletRequest request,String pagenum,String chepai){

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

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

		//查询列表
		List<Jilu> list = jiluService.selectBeanList((currentpage - 1)
				* pageSize, pageSize,chepai,null,null,null,0,0,user.getId());

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

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

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


		request.setAttribute("title", "我的租车");
		

		return "jilulist.jsp";

	}
	
	
	//查看租车记录详情页面
	@RequestMapping("/jiluview.do")
	public String jiluview(HttpServletRequest request,int id){

		Jilu bean = jiluService.selectBeanById(id);
		
		Car car = carService.selectBeanById(bean.getCarid());

		bean.setCar(car);
		
		request.setAttribute("bean", bean);

		request.setAttribute("title", "租车记录详情");
		

		return "jiluview.jsp";

	}
	
	
	
	
	//跳转留言页面
	@RequestMapping("/liuyanadd.do")
	public String liuyanadd(HttpServletRequest request,HttpServletResponse response) {
		
		PrintWriter writer = this.getPrintWriter(response);
		
		HttpSession session = request.getSession();
		User user = (User) session.getAttribute("qiantai");
		
		if (user == null) {
			writer.print("<script  language='javascript'>alert('请先登录');window.location.href='login.do';</script>");
			return  null;
		}

		
		request.setAttribute("url", "liuyanadd2.do");
		request.setAttribute("title", "留言");
	
		return "liuyanadd.jsp";
		
	}
	
	
	//留言操作
	@RequestMapping("/liuyanadd2.do")
	public void liuyanadd2(HttpServletRequest request,HttpServletResponse response,Liuyan bean) throws IOException{
		
		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);
		
	
		
		writer.print("<script  language='javascript'>alert('操作成功');window.location.href='liuyanlist.do'; </script>");
		
	
	}
	
	
	//我的留言
	@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)
				* pageSize, pageSize,ltitle,null,user.getId(),0);

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

		//获取总数量
		int total = liuyanService.selectBeanCount(ltitle,null,user.getId(),0);

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


		request.setAttribute("title", "我的留言");
		

		return "liuyanlist.jsp";

	}
	
	//查看留言详情页面
	@RequestMapping("/liuyanview.do")
	public String liuyanview(HttpServletRequest request,int id){

		Liuyan bean = liuyanService.selectBeanById(id);

		request.setAttribute("bean", bean);

		request.setAttribute("title", "留言详情");
		

		return "liuyanview.jsp";

	}
	
	
	
	
	//删除留言操作
	@RequestMapping("/liuyandelete.do")
	public void liuyandelete(HttpServletRequest request,HttpServletResponse response,int id) throws IOException{
		
		PrintWriter writer = this.getPrintWriter(response);

		
		liuyanService.deleteBean(id);
		
		
		writer.print("<script  language='javascript'>alert('操作成功');window.location.href='liuyanlist.do'; </script>");
		
	
	}
	
	
	//会员页
	@RequestMapping("/vip.do")
	public String vip(HttpServletRequest request,String username){
		
		Vip bean=vipService.selectBeanByUsername(username);
		if(bean!=null) {
		bean.setEnddate(bean.getEnddate().split(" ")[0]);
		request.setAttribute("bean", bean);

		}else {
			Vip bean2=new Vip();
			bean2.setUsername(username);
			request.setAttribute("bean", bean2);
		}
		request.setAttribute("title", "会员详情");
		return "vip.jsp";
	}
	
}












ManageController

package com.controller;


import java.io.IOException;
import java.io.PrintWriter;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;

import com.entity.Car;
import com.entity.Gonggao;
import com.entity.Jilu;
import com.entity.Liuyan;
import com.entity.Pic;
import com.entity.Ri;
import com.entity.User;
import com.entity.Vip;
import com.entity.Yuding;
import com.entity.Yue;
import com.service.CarService;
import com.service.GonggaoService;
import com.service.JiluService;
import com.service.LiuyanService;
import com.service.PicService;
import com.service.RiService;
import com.service.UserService;
import com.service.VipService;
import com.service.YudingService;
import com.service.YueService;
import com.util.Pager;
import com.util.Util;


@Controller
@RequestMapping("/manage")
public class ManageController {

	@Resource
	private UserService userService;

	@Resource
	private CarService carService;
	
	@Resource
	private GonggaoService gonggaoService; 
	
	@Resource
	private PicService picService;
	
	@Resource
	private JiluService jiluService;
	
	@Resource
	private YudingService yudingService;
	
	@Resource
	private LiuyanService liuyanService;
	
	@Resource
	private RiService riService;
	
	@Resource
	private YueService yueService;
	
	@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("/login.do")
	public void login(HttpServletRequest request,HttpServletResponse response,String username,String password,String role){

		PrintWriter writer = this.getPrintWriter(response);

		User user = userService.userlogin(username, password,Integer.parseInt(role));

		if(user==null){

			writer.print("<script language=javascript>alert('用户名或者密码错误');window.location.href='login.jsp';</script>");

		}else{
			HttpSession session = request.getSession();
			session.setAttribute("manage", user);

			writer.print("<script language=javascript>alert('登录成功');window.location.href='index.jsp';</script>");

		}

	}


	//安全退出
	@RequestMapping("/loginout.do")
	public void loginout(HttpServletRequest request,HttpServletResponse response,String username,String password){

		
		PrintWriter writer = this.getPrintWriter(response);

		HttpSession session = request.getSession();
		session.removeAttribute("manage");
		writer.print("<script language=javascript>alert('退出成功');window.location.href='login.jsp';</script>");

	}


	//跳转到修改密码页面
	@RequestMapping("/password.do")
	public String password(HttpServletRequest request){

		request.setAttribute("url", "password2.do");

		request.setAttribute("title", "修改密码");

		return "password.jsp";

	}

	//修改密码操作
	@RequestMapping("/password2.do")
	public void password2(HttpServletRequest request,HttpServletResponse response,String password1,String password2){

		PrintWriter writer = this.getPrintWriter(response);

		HttpSession session = request.getSession();

		User user = (User)session.getAttribute("manage");

		User bean = userService.userlogin(user.getUsername(), password1, user.getRole());

		if(bean!=null){
			bean.setPassword(password2);
			userService.updateBean(bean);

			writer.print("<script language=javascript>alert('修改成功');window.location.href='password.do';</script>");


		}else{

			writer.print("<script language=javascript>alert('用户名或者密码错误');window.location.href='password.do';</script>");

		}
	}

	
	//人员列表
	@RequestMapping("/userlist.do")
	public String userlist(HttpServletRequest request,String pagenum,String username){

		//查询条件返回页面
		if (username != null && !"".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")
	public String useradd(HttpServletRequest request){

		request.setAttribute("url", "useradd2.do");

		request.setAttribute("title", "添加人员");

		return "user/useradd.jsp";

	}


	//添加人员操作
	@RequestMapping("/useradd2.do")
	public void useradd2(HttpServletResponse response,User bean){

		User user = userService.useryz(bean.getUsername());
		
		if(user!=null){
			this.getPrintWriter(response).print("<script language=javascript>alert('操作失败,该用户名已经存在');window.location.href='userlist.do';</script>");
			return;
		}

		bean.setPassword("111111");
		bean.setCreatetime(Util.getTime());
		userService.insertBean(bean);


		this.getPrintWriter(response).print("<script language=javascript>alert('操作成功');window.location.href='userlist.do';</script>");
	}


	//跳转到修改人员页面
	@RequestMapping("/userupdate.do")
	public String userupdate(HttpServletRequest request,int id){

		User bean = userService.selectBeanById(id);

		request.setAttribute("bean", bean);

		request.setAttribute("url", "userupdate2.do?id="+id);

		request.setAttribute("title", "修改人员");

		return "user/userupdate.jsp";

	}

	//修改人员操作
	@RequestMapping("/userupdate2.do")
	public void userupdate2(HttpServletResponse response,User bean){

		userService.updateBean(bean);


		this.getPrintWriter(response).print("<script language=javascript>alert('操作成功');window.location.href='userlist.do';</script>");
	}


	//删除操作
	@RequestMapping("/userdelete.do")
	public void userdelete(HttpServletResponse response,int id){

		userService.deleteBean(id);


		this.getPrintWriter(response).print("<script language=javascript>alert('操作成功');window.location.href='userlist.do';</script>");
	}



	//跳转到查看详情页面
	@RequestMapping("/userupdate3.do")
	public String userupdate3(HttpServletRequest request,int id){

		User bean = userService.selectBeanById(id);

		request.setAttribute("bean", bean);

		request.setAttribute("title", "查看详情");

		return "user/userupdate3.jsp";

	}
	
	
	
	//车辆列表
	@RequestMapping("/carlist.do")
	public String carlist(HttpServletRequest request,String pagenum,String chepai){

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

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

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

		//查询列表
		List<Car> list = carService.selectBeanList((currentpage - 1)
				* pageSize, pageSize, chepai,null,null,null);

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

		//获取总数量
		int total = carService.selectBeanCount(chepai,null,null,null);

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

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

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

		request.setAttribute("title", "车辆管理");

		return "car/carlist.jsp";

	}


	//跳转到添加车辆页面
	@RequestMapping("/caradd.do")
	public String caradd(HttpServletRequest request){

		request.setAttribute("url", "caradd2.do");

		request.setAttribute("title", "添加车辆");

		return "car/caradd.jsp";

	}




	//添加车辆操作
	@RequestMapping("/caradd2.do")
	public void caradd2(HttpServletResponse response,HttpServletRequest request,Car bean,MultipartFile prodFile){

		
		if(prodFile==null || prodFile.getSize()<=0 ){
			this.getPrintWriter(response).print("<script language=javascript>alert('车辆图片不能为空');" +
			"window.location.href='caradd.do';</script>");
			return;
		}

		String pic =  Util.uploadFile(request, prodFile);

		bean.setPic(pic);
		
		bean.setStatus("待租赁");
		bean.setCtime(Util.getTime());

		carService.insertBean(bean);


		this.getPrintWriter(response).print("<script language=javascript>alert('操作成功');" +
		"window.location.href='carlist.do';</script>");
	}


	//跳转到修改车辆页面
	@RequestMapping("/carupdate.do")
	public String carupdate(HttpServletRequest request,int id){

		Car bean = carService.selectBeanById(id);

		request.setAttribute("bean", bean);

		request.setAttribute("url", "carupdate2.do?id="+id);

		request.setAttribute("title", "修改车辆");

		return "car/carupdate.jsp";

	}

	//修改车辆操作
	@RequestMapping("/carupdate2.do")
	public void carupdate2(HttpServletResponse response,HttpServletRequest request,Car bean,MultipartFile prodFile){

		if(prodFile!=null && prodFile.getSize()>0){
			String pic =  Util.uploadFile(request, prodFile);

			bean.setPic(pic);
		}

		
		carService.updateBean(bean);


		this.getPrintWriter(response).print("<script language=javascript>alert('操作成功');window.location.href='carlist.do';</script>");
	}


	//删除操作
	@RequestMapping("/cardelete.do")
	public void cardelete(HttpServletResponse response,int id){

		carService.deleteBean(id);


		this.getPrintWriter(response).print("<script language=javascript>alert('操作成功');window.location.href='carlist.do';</script>");
	}
	
	
	
	//跳转到查看详情页面
	@RequestMapping("/carupdate3.do")
	public String carupdate3(HttpServletRequest request,int id){

		Car bean = carService.selectBeanById(id);

		request.setAttribute("bean", bean);

		request.setAttribute("title", "查看车辆详情");

		return "car/carupdate3.jsp";

	}
	
	
	
	//车辆维修列表
	@RequestMapping("/carlist2.do")
	public String carlist2(HttpServletRequest request,String pagenum,String chepai){

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

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

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

		//查询列表
		List<Car> list = carService.selectBeanList((currentpage - 1)
				* pageSize, pageSize, chepai,null,null,null);

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

		//获取总数量
		int total = carService.selectBeanCount(chepai,null,null,null);

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

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

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

		request.setAttribute("title", "车辆维修管理");

		return "car/carlist2.jsp";

	}
	
	
	
	//设置为维修状态操作
	@RequestMapping("/cardelete2.do")
	public void cardelete2(HttpServletResponse response,int id){
		
		Car bean = carService.selectBeanById(id);

		bean.setStatus("维修中");
		
		carService.updateBean(bean);


		this.getPrintWriter(response).print("<script language=javascript>alert('操作成功');window.location.href='carlist2.do';</script>");
	}
	
	
	//维修完成操作
	@RequestMapping("/cardelete3.do")
	public void cardelete3(HttpServletResponse response,int id){
		
		Car bean = carService.selectBeanById(id);

		bean.setStatus("待租赁");
		
		carService.updateBean(bean);


		this.getPrintWriter(response).print("<script language=javascript>alert('操作成功');window.location.href='carlist2.do';</script>");
	}
	

	
	
	//网站公告列表
	@RequestMapping("/gonggaolist.do")
	public String gonggaolist(HttpServletRequest request,String pagenum,String gbiaoti){

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

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


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

		//查询列表
		List<Gonggao> list = gonggaoService.selectBeanList((currentpage - 1)
				* pageSize, pageSize, gbiaoti);

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

		//获取总数量
		int total = gonggaoService.selectBeanCount(gbiaoti);

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

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

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

		request.setAttribute("title", "网站公告管理");

		return "gonggao/gonggaolist.jsp";

	}


	//跳转到添加网站公告页面
	@RequestMapping("/gonggaoadd.do")
	public String gonggaoadd(HttpServletRequest request){

		request.setAttribute("url", "gonggaoadd2.do");

		request.setAttribute("title", "添加网站公告");

		return "gonggao/gonggaoadd.jsp";

	}


	//添加网站公告操作
	@RequestMapping("/gonggaoadd2.do")
	public void gonggaoadd2(HttpServletResponse response,Gonggao bean){

		
		bean.setCtime(Util.getTime());
		
		gonggaoService.insertBean(bean);


		this.getPrintWriter(response).print("<script language=javascript>alert('操作成功');window.location.href='gonggaolist.do';</script>");
	}


	//跳转到修改网站公告页面
	@RequestMapping("/gonggaoupdate.do")
	public String gonggaoupdate(HttpServletRequest request,int id){

		Gonggao bean = gonggaoService.selectBeanById(id);

		request.setAttribute("bean", bean);

		request.setAttribute("url", "gonggaoupdate2.do?id="+id);

		request.setAttribute("title", "修改网站公告");

		return "gonggao/gonggaoupdate.jsp";

	}

	//修改网站公告操作
	@RequestMapping("/gonggaoupdate2.do")
	public void gonggaoupdate2(HttpServletResponse response,Gonggao bean){

		gonggaoService.updateBean(bean);


		this.getPrintWriter(response).print("<script language=javascript>alert('操作成功');window.location.href='gonggaolist.do';</script>");
	}


	//删除操作
	@RequestMapping("/gonggaodelete.do")
	public void gonggaodelete(HttpServletResponse response,int id){

		gonggaoService.deleteBean(id);


		this.getPrintWriter(response).print("<script language=javascript>alert('操作成功');window.location.href='gonggaolist.do';</script>");
	}



	//跳转到查看详情页面
	@RequestMapping("/gonggaoupdate3.do")
	public String gonggaoupdate3(HttpServletRequest request,int id){

		Gonggao bean = gonggaoService.selectBeanById(id);

		request.setAttribute("bean", bean);

		request.setAttribute("title", "查看详情");

		return "gonggao/gonggaoupdate3.jsp";

	}
	
	
	
	//展示图片列表
	@RequestMapping("/piclist.do")
	public String piclist(HttpServletRequest request,String pagenum){

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

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

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

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

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

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

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

		request.setAttribute("title", "展示图片管理");

		return "pic/piclist.jsp";

	}




	//跳转到修改展示图片页面
	@RequestMapping("/picupdate.do")
	public String picupdate(HttpServletRequest request,int id){

		Pic bean = picService.selectBeanById(id);

		request.setAttribute("bean", bean);

		request.setAttribute("url", "picupdate2.do?id="+id);

		request.setAttribute("title", "修改展示图片");

		return "pic/picupdate.jsp";

	}

	//修改展示图片操作
	@RequestMapping("/picupdate2.do")
	public void picupdate2(HttpServletResponse response,HttpServletRequest request,Pic bean,MultipartFile prodFile){

		if(prodFile!=null && prodFile.getSize()>0){
			String pic =  Util.uploadFile(request, prodFile);

			bean.setPath(pic);
		}

		
		picService.updateBean(bean);


		this.getPrintWriter(response).print("<script language=javascript>alert('操作成功');window.location.href='piclist.do';</script>");
	}
	
	//车辆租赁列表
	@RequestMapping("/carlist3.do")
	public String carlist3(HttpServletRequest request,String pagenum,String chepai,String pinpai,String xinghao,String yanse){

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

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

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

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

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

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

		//查询列表
		List<Car> list = carService.selectBeanList((currentpage - 1)
				* pageSize, pageSize, chepai,pinpai,xinghao,yanse);

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

		//获取总数量
		int total = carService.selectBeanCount(chepai,pinpai,xinghao,yanse);

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

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

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

		request.setAttribute("title", "车辆租赁管理");

		return "car/carlist3.jsp";

	}
	
	
	//跳转到租车页面
	@RequestMapping("/jiluadd.do")
	public String jiluadd(HttpServletRequest request,int carid){
		
		Car car = carService.selectBeanById(carid);
		
		request.setAttribute("car", car);
		
		request.setAttribute("url", "jiluadd2.do?carid="+carid);

		request.setAttribute("title", "租车");

		return "jilu/jiluadd.jsp";

	}



	//租车操作
	@RequestMapping("/jiluadd2.do")
	public void jiluadd2(HttpServletResponse response,HttpServletRequest request,Jilu bean,MultipartFile prodFile1,MultipartFile prodFile2){

		
		if(prodFile1==null || prodFile1.getSize()<=0 ){
			this.getPrintWriter(response).print("<script language=javascript>alert('身份证复印件不能为空');" +
			"window.location.href='jiluadd.do';</script>");
			return;
		}
		
		if(prodFile2==null || prodFile2.getSize()<=0 ){
			this.getPrintWriter(response).print("<script language=javascript>alert('驾驶证复印件不能为空');" +
			"window.location.href='jiluadd.do';</script>");
			return;
		}
		int carid = bean.getCarid();
		
		Car car = carService.selectBeanById(carid);
		
		bean.setChepai(car.getChepai());
		bean.setCarid(car.getId());
		
		
		String sfz  = bean.getSfz();
		
		User kehu = userService.sfzyz(sfz);
		
		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 (chepai != null && !"".equals(chepai)) {

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

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

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

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

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

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

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

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

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

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

		request.setAttribute("title", "还车管理");

		return "jilu/jilulist.jsp";

	}
	
	
	//跳转到客户还车页面
	@RequestMapping("/jiluupdate.do")
	public String jiluupdate(HttpServletRequest request,int id) throws ParseException{

		Jilu bean = jiluService.selectBeanById(id);
		
		Car car = carService.selectBeanById(bean.getCarid());
		bean.setCar(car);


		request.setAttribute("bean", bean);

		request.setAttribute("url", "jiluupdate2.do?id="+id);

		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));
		jilu.setTzujin(Double.parseDouble(tzujin));
		jilu.setZhuangtai("还车中,等待技术人员确认");
		
		jiluService.updateBean(jilu);


		this.getPrintWriter(response).print("<script language=javascript>alert('操作成功');window.location.href='jilulist.do';</script>");
	}
	
	//跳转到查看详情页面
	@RequestMapping("/jiluupdate3.do")
	public String jiluupdate3(HttpServletRequest request,int id){

		Jilu bean = jiluService.selectBeanById(id);
		
		bean.setCar(carService.selectBeanById(bean.getCarid()));
		bean.setWork(userService.selectBeanById(bean.getWorkid()));
		bean.setJishu(userService.selectBeanById(bean.getJishuid()));

		request.setAttribute("bean", bean);

		request.setAttribute("title", "查看租车记录详情");

		return "jilu/jiluupdate3.jsp";

	}
	
	
	//技术确认查询
	@RequestMapping("/jilulist2.do")
	public String jilulist2(HttpServletRequest request,String pagenum,String chepai,String xingming,String sfz){
		
		HttpSession session = request.getSession();
		
		User user = (User)session.getAttribute("manage");

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

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

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

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

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

		//查询列表
		List<Jilu> list = jiluService.selectBeanList((currentpage - 1)
				* pageSize, pageSize, chepai,sfz,xingming,"还车中,等待技术人员确认",user.getId(),0,0);
		
		for(Jilu jilu:list){
			jilu.setCar(carService.selectBeanById(jilu.getCarid()));
		}

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

		//获取总数量
		int total = jiluService.selectBeanCount(chepai,sfz,xingming,"还车中,等待技术人员确认",user.getId(),0,0);

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

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

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

		request.setAttribute("title", "技术确认查询");

		return "jilu/jilulist2.jsp";

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

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

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

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

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

		//查询列表
		List<Jilu> list = jiluService.selectBeanList((currentpage - 1)
				* pageSize, pageSize, chepai,sfz,xingming,"还车中,等待技术人员确认",0,0,0);
		
		for(Jilu jilu:list){
			jilu.setCar(carService.selectBeanById(jilu.getCarid()));
		}

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

		//获取总数量
		int total = jiluService.selectBeanCount(chepai,sfz,xingming,"还车中,等待技术人员确认",0,0,0);

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

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

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

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

		return "jilu/jilulist3.jsp";

	}
	
	
	
	//跳转到输入确认信息页面
	@RequestMapping("/jiluupdate5.do")
	public String jiluupdate5(HttpServletRequest request,int id) throws ParseException{

		Jilu bean = jiluService.selectBeanById(id);
		
		Car car = carService.selectBeanById(bean.getCarid());
		bean.setCar(car);

		request.setAttribute("bean", bean);

		request.setAttribute("url", "jiluupdate6.do?id="+id);

		request.setAttribute("title", "输入确认信息");


		return "jilu/jiluupdate5.jsp";

	}

	//输入确认信息操作
	@RequestMapping("/jiluupdate6.do")
	public void jiluupdate6(HttpServletResponse response,HttpServletRequest request,Jilu bean){

		Jilu jilu = jiluService.selectBeanById(bean.getId());
		
		HttpSession session = request.getSession();
		
		User user = (User)session.getAttribute("manage");
		
		jilu.setWeixiu(bean.getWeixiu());
		
		jilu.setJishuid(user.getId());
		
		jilu.setZhuangtai("技术人员已确认");
		
		
		jiluService.updateBean(jilu);


		this.getPrintWriter(response).print("<script language=javascript>alert('操作成功');window.location.href='jilulist3.do';</script>");
	}
	
	
	//我的确认车辆
	@RequestMapping("/jilulist4.do")
	public String jilulist4(HttpServletRequest request,String pagenum,String chepai,String xingming,String sfz){
		
		
		//查询条件返回页面
		if (chepai != null && !"".equals(chepai)) {

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

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

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

		//分页功能默认第一页
		int currentpage = 1;
		//获取当前页
		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)) {

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

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

		//分页功能默认第一页
		int currentpage = 1;
		//获取当前页
		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,"技术人员已确认",user.getId(),0,0);
		
		for(Jilu jilu:list){
			jilu.setCar(carService.selectBeanById(jilu.getCarid()));
		}

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

		//获取总数量
		int total = jiluService.selectBeanCount(chepai,sfz,xingming,"技术人员已确认",user.getId(),0,0);

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

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

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

		request.setAttribute("title", "确认管理");

		return "jilu/jilulist5.jsp";

	}
	
	
	//确认还车操作
	@RequestMapping("/jiluupdate7.do")
	public void jiluupdate7(HttpServletResponse response,HttpServletRequest request){

		String id = request.getParameter("id");
		
		Jilu jilu = jiluService.selectBeanById(Integer.parseInt(id));

		jilu.setZhuangtai("完成结算");
		
		jiluService.updateBean(jilu);
		
		Car car =  carService.selectBeanById(jilu.getCarid());
		
		car.setStatus("待租赁");

		car.setWeihu(car.getWeihu()+jilu.getWeixiu());
		if(car.getTzujin() == null) {
			car.setTzujin(0d);
		}
		car.setTzujin(car.getTzujin()+jilu.getTzujin());
		
		carService.updateBean(car);
		
		this.getPrintWriter(response).print("<script language=javascript>alert('操作成功');window.location.href='jilulist5.do';</script>");
	}
	
	
	
	
	//待处理预定列表
	@RequestMapping("/yudinglist.do")
	public String yudinglist(HttpServletRequest request,String pagenum,String chepai,String sfz){
		
		

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

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

		if (sfz != null && !"".equals(sfz)) {

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

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

		//查询列表
		List<Yuding> list = yudingService.selectBeanList((currentpage - 1)
				* pageSize, pageSize, chepai,sfz,0,0,"处理中");
		

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

		//获取总数量
		int total = yudingService.selectBeanCount(chepai,sfz,0,0,"处理中");

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

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

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

		request.setAttribute("title", "待处理预定");

		return "yuding/yudinglist.jsp";

	}
	
	
	
	//跳转到处理预定页面
	@RequestMapping("/yudingupdate.do")
	public String yudingupdate(HttpServletRequest request,int id) throws ParseException{

		Yuding bean = yudingService.selectBeanById(id);


		request.setAttribute("bean", bean);

		request.setAttribute("url", "yudingupdate2.do?id="+id);

		request.setAttribute("title", "处理客户预定");
		

		return "yuding/yudingupdate.jsp";

	}

	//处理预定操作
	@RequestMapping("/yudingupdate2.do")
	public void yudingupdate2(HttpServletResponse response,HttpServletRequest request ){

		String id = request.getParameter("id");
		String zhuangtai = request.getParameter("zhuangtai");
		
		HttpSession session = request.getSession();
		
		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);
		}
		
		


		this.getPrintWriter(response).print("<script language=javascript>alert('操作成功');window.location.href='yudinglist.do';</script>");
	}
	
	
	
	//我处理的预定
	@RequestMapping("/yudinglist2.do")
	public String yudinglist2(HttpServletRequest request,String pagenum,String chepai,String sfz){
		
		HttpSession session = request.getSession();
		
		User user = (User)session.getAttribute("manage");

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

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

		if (sfz != null && !"".equals(sfz)) {

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

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

		//查询列表
		List<Yuding> list = yudingService.selectBeanList((currentpage - 1)
				* pageSize, pageSize, chepai,sfz,0,user.getId(),null);
		

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

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

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

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

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

		request.setAttribute("title", "我处理的预定");

		return "yuding/yudinglist2.jsp";

	}
	
	
	//跳转到查看预定详情页面
	@RequestMapping("/yudingupdate3.do")
	public String yudingupdate3(HttpServletRequest request,int id) throws ParseException{

		Yuding bean = yudingService.selectBeanById(id);


		request.setAttribute("bean", bean);
		request.setAttribute("title", "查看预定详情");
		

		return "yuding/yudingupdate3.jsp";

	}
	
	
	
	
	//待回复留言列表
	@RequestMapping("/liuyanlist.do")
	public String liuyanlist(HttpServletRequest request,String pagenum,String ltitle){
		

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

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


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

		//查询列表
		List<Liuyan> list = liuyanService.selectBeanList((currentpage - 1)
				* pageSize, pageSize, ltitle,"未回复",0,0);
		

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

		//获取总数量
		int total = liuyanService.selectBeanCount(ltitle,"未回复",0,0);

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

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

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

		request.setAttribute("title", "待回复留言");

		return "liuyan/liuyanlist.jsp";

	}
	
	
	
	//跳转到回复留言页面
	@RequestMapping("/liuyanupdate.do")
	public String liuyanupdate(HttpServletRequest request,int id) throws ParseException{

		Liuyan bean = liuyanService.selectBeanById(id);


		request.setAttribute("bean", bean);

		request.setAttribute("url", "liuyanupdate2.do?id="+id);

		request.setAttribute("title", "回复留言");
		

		return "liuyan/liuyanupdate.jsp";

	}

	//回复留言操作
	@RequestMapping("/liuyanupdate2.do")
	public void liuyanupdate2(HttpServletResponse response,HttpServletRequest request ){

		String id = request.getParameter("id");
		String huifu = request.getParameter("huifu");
		
		HttpSession session = request.getSession();
		
		User user = (User)session.getAttribute("manage");
		
		Liuyan bean = liuyanService.selectBeanById(Integer.parseInt(id));
		
		bean.setHuifu(huifu);
		bean.setShijian2(Util.getTime());
		bean.setZhuangtai("已回复");
		bean.setWorkid(user.getId());
		
		liuyanService.updateBean(bean);

		this.getPrintWriter(response).print("<script language=javascript>alert('操作成功');window.location.href='liuyanlist.do';</script>");
	}
	
	
	
	//我处理的留言
	@RequestMapping("/liuyanlist2.do")
	public String liuyanlist2(HttpServletRequest request,String pagenum,String ltitle ){
		
		HttpSession session = request.getSession();
		
		User user = (User)session.getAttribute("manage");

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

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


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

		//查询列表
		List<Liuyan> list = liuyanService.selectBeanList((currentpage - 1)
				* pageSize, pageSize, ltitle,null,0,user.getId());
		

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

		//获取总数量
		int total = liuyanService.selectBeanCount(ltitle,null,0,user.getId());

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

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

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

		request.setAttribute("title", "我处理的留言");

		return "liuyan/liuyanlist2.jsp";

	}
	
	
	//跳转到查看留言详情页面
	@RequestMapping("/liuyanupdate3.do")
	public String liuyanupdate3(HttpServletRequest request,int id) throws ParseException{

		Liuyan bean = liuyanService.selectBeanById(id);


		request.setAttribute("bean", bean);
		request.setAttribute("title", "查看留言详情");
		

		return "liuyan/liuyanupdate3.jsp";

	}
	
	
	//客户信息查询
	@RequestMapping("/userlist2.do")
	public String userlist2(HttpServletRequest request,String pagenum,String username){
		

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

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


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

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

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

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

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

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

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

		request.setAttribute("title", "客户信息查询");

		return "user/userlist2.jsp";

	}
	
	
	//VIP客户信息查询
		@RequestMapping("/userlist3.do")
		public String userlist3(HttpServletRequest request,String pagenum,String username,String vipstatus){
			

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

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


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

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

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

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

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

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

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

			request.setAttribute("title", "VIP客户信息查询");

			return "user/userlist3.jsp";

		}
		//VIP客户信息查询
		@RequestMapping("/userlist4.do")
		public String userlist4(HttpServletRequest request,String pagenum,String username){
			

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

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


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

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

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

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

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

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

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

			request.setAttribute("title", "普通客户信息查询");

			return "user/userlist4.jsp";

		}
	
	
	
	//日收入统计
	@RequestMapping("/rilist.do")
	public String rilist(HttpServletRequest request,String pagenum,String ri){
		
		List<Ri> rilist = riService.selectBeanList(0, 9999, null);
		
		for(Ri bean:rilist){
			riService.deleteBean(bean.getId());
		}
		
		List<Jilu> jilulist = jiluService.selectBeanList(0, 9999, null, null, null, "完成结算", 0, 0, 0);
		
		for(Jilu jilu:jilulist){
			
			String riqi = jilu.getShijian1().substring(0, 11);
			
			List<Ri> rilist2 = riService.selectBeanList(0, 1, riqi);
			
			if(rilist2.size()<=0){
				Ri bean = new Ri();
				
				bean.setRi(riqi);
				
				bean.setJine(jilu.getTzujin());
				bean.setWeihu(jilu.getWeixiu());
				
				riService.insertBean(bean);
				
			}else{
				Ri bean = rilist2.get(0);
				
				bean.setJine(bean.getJine()+jilu.getTzujin());
				bean.setWeihu(bean.getWeihu()+jilu.getWeixiu());
				
				riService.updateBean(bean);
			}
			
			
			
		}
		
		
		

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

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


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

		//查询列表
		List<Ri> list = riService.selectBeanList((currentpage - 1)
				* pageSize, pageSize, ri);
		

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

		//获取总数量
		int total = riService.selectBeanCount(ri);

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

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

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

		request.setAttribute("title", "日收入统计");

		return "ri/rilist.jsp";

	}
	
	
	//月收入统计
	@RequestMapping("/yuelist.do")
	public String yuelist(HttpServletRequest request,String pagenum,String month){
		
		List<Yue> yuelist = yueService.selectBeanList(0, 9999, null);
		
		for(Yue bean:yuelist){
			yueService.deleteBean(bean.getId());
		}
		
		List<Jilu> jilulist = jiluService.selectBeanList(0, 9999, null, null, null, "完成结算", 0, 0, 0);
		
		for(Jilu jilu:jilulist){
			
			String mon = jilu.getShijian1().substring(0, 7);
			
			List<Yue> yuelist2 = yueService.selectBeanList(0, 1, mon);
			
			if(yuelist2.size()<=0){
				Yue bean = new Yue();
				
				bean.setMonth(mon);
				
				bean.setJine(jilu.getTzujin());
				bean.setWeihu(jilu.getWeixiu());
				
				yueService.insertBean(bean);
				
			}else{
				Yue bean = yuelist2.get(0);
				
				bean.setJine(bean.getJine()+jilu.getTzujin());
				bean.setWeihu(bean.getWeihu()+jilu.getWeixiu());
				
				yueService.updateBean(bean);
			}

		}
		


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

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


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

		//查询列表
		List<Yue> list = yueService.selectBeanList((currentpage - 1)
				* pageSize, pageSize, month);
		

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

		//获取总数量
		int total = yueService.selectBeanCount(month);

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

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

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

		request.setAttribute("title", "日收入统计");

		return "yue/yuelist.jsp";

	}
	
	
	//车辆收入统计
	@RequestMapping("/carlist4.do")
	public String carlist4(HttpServletRequest request,String pagenum,String chepai,String pinpai,String xinghao,String yanse){

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

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

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

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

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

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

		//查询列表
		List<Car> list = carService.selectBeanList((currentpage - 1)
				* pageSize, pageSize, chepai,pinpai,xinghao,yanse);

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

		//获取总数量
		int total = carService.selectBeanCount(chepai,pinpai,xinghao,yanse);

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

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

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

		request.setAttribute("title", "车辆收入统计");

		return "car/carlist4.jsp";

	}
	
	
	//跳转到购买/续费会员支付详情页面
	@RequestMapping("/vipcharge.do")
	public String vipcharge(HttpServletRequest request,String  username) throws ParseException{

		Vip bean = vipService.selectBeanByUsername(username);
		if(null==bean) {
			Vip bean1=new Vip();
			bean1.setUsername(username);
			User user=userService.selectBeanByUsername(username);
			if(null!=user) {
				bean1.setKehuid(user.getId());
			}
			bean1.setLevel(0);
			bean1.setPoints(0);
			request.setAttribute("bean", bean1);
			request.setAttribute("title", "会员充值/续费");
			return "vip/vipcharge.jsp";
		}else {			
			String enddate=bean.getEnddate().split(" ")[0];
			bean.setEnddate(enddate);
			request.setAttribute("bean", bean);
			request.setAttribute("title", "会员充值/续费");
			return "vip/vipcharge.jsp";
		}

	}
	
	
	//支付状态页面
	@RequestMapping("/vipcharge2.do")
	public void vipcharge2(HttpServletRequest request,HttpServletResponse response,String  username,int month,int points,int kehuid) throws ParseException{
		PrintWriter writer = this.getPrintWriter(response);
		SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd");// HH:mm:ss
		Calendar rightNow = Calendar.getInstance();
		String now=sdf.format(new Date());
		points += month*1000;
		Double consumed=0.0d;
		switch(month){
		case 12:
			consumed+=20*month*0.9;
			break;
		case 6:
			consumed+=20*month*0.95;
			break;
		default:
			consumed+=20*month;
			break;
		}
		

		Vip bean = vipService.selectBeanByUsername(username);
		
		if(bean!=null){//老vip客户
			bean.setPoints(points);
			consumed+=bean.getConsumed();
			int level=1+(int)Math.round(consumed)/1000;//等级根据消费金额确定,消费1000为1级
			bean.setConsumed(consumed);
			bean.setLevel(level);
			
			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);
		}
		

		
		
		
		
		
		request.setAttribute("bean", bean);
		request.setAttribute("title", "会员充值/续费页");
		
		writer.print("<script language=javascript>alert('充值成功');window.location.href='vipcharge.do?username="+username+"';</script>");
		//return "vip/vipcharge.jsp";

	}
	
}












如果也想学习本系统,下面领取。关注并回复:087ssm  

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/61734.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

12.4泛型 map set

目录 一,泛型 1 什么是泛型 2 引出泛型 2.1语法 3 泛型类的使用 3.1 语法 3.2 示例 3.3 类型推导(Type Inference) 4.裸类型(Raw Type) 5 泛型如何编译的 5.2 为什么不能实例化泛型类型数组 6 泛型的上界 6.1 语法 6.3 复杂示例 7 泛型方法 7.1 定义语法 二.通…

【数据结构】二分搜索树

集合java.util包下的常用子类&#xff0c;集合无非就是各种数据结构的应用。集合存在的目的就是为了将数据高校进行读写&#xff0c;无论哪种具体的集合无外乎CURD。 Collection->单个元素保存的父接口。 List->可以保存重复的单个元素。 Set->保存单个不重复元素。…

python在centos7.x下建立虚拟环境

(327条消息) python在centos下安装以及配置_雨师的博客-CSDN博客 https://blog.csdn.net/wtt234/article/details/128172281 python离线环境下安装第三方模块的方法&#xff1a; https://blog.csdn.net/wtt234/article/details/128162292 上篇已经把python在centos下的安装以及…

红蓝对抗--sliver 搭建

使用sliver的优点: 1 支持macos、win、linux上线 2 支持丰富的插件加载扩展,功能选择多,CS已经很普遍了,可以尝试sliver做C2 sliver相关构成: Implant:生成植入的木马 sliver-client :C2的控制端 Sliver Server:C2的控制端,客户端通过gRPC接口与server交互 架构: […

【 java 集合】Collection 接口中的常用方法

&#x1f4cb; 个人简介 &#x1f496; 作者简介&#xff1a;大家好&#xff0c;我是阿牛&#xff0c;全栈领域优质创作者。&#x1f61c;&#x1f4dd; 个人主页&#xff1a;馆主阿牛&#x1f525;&#x1f389; 支持我&#xff1a;点赞&#x1f44d;收藏⭐️留言&#x1f4d…

LeetCode刷题复盘笔记—一文搞懂纯完全背包问题(动态规划系列第十一篇)

今日主要总结一下动态规划背包问题的基础——纯完全背包问题 在Leetcode题库中主要都是0-1背包和完全背包的应用问题&#xff0c;所以主要掌握这两个背包问题 题目&#xff1a;纯完全背包问题 题目描述&#xff1a; 有N件物品和一个最多能背重量为W的背包。第i件物品的重量是w…

List——顺序表与链表(二)

文章目录前言一、链表概念及结构二、LinkedList与链表1.什么是LinkedList2.LinkedList的常用方法3.链表的遍历三.实现自己的LinkedList四.ArrayList和LinkedList的区别与优缺点总结前言 上一篇文章中&#xff0c;介绍了List接口以及ArrayList的使用&#xff0c;并且进行了简单…

ByteTrack多目标追踪论文阅读

paper:ByteTrack: Multi-Object Tracking by Associating Every Detection Box code:ByteTrack 一.摘要 多目标追踪的目的是识别视频中物体或对象的位置和身份&#xff0c;也就是说&#xff0c;不同于目标检测的是&#xff0c;追踪问题可以分为两个任务&#xff1a;1&#x…

(附源码)springboot平衡膳食小程序 毕业设计 250859

基于springboot平衡膳食小程序 摘 要 随着我国经济迅速发展&#xff0c;人们对手机的需求越来越大&#xff0c;各种手机软件也都在被广泛应用&#xff0c;但是对于手机进行数据信息管理&#xff0c;对于手机的各种软件也是备受用户的喜爱&#xff0c;平衡膳食小程序被用户普遍使…

物联网设备WIFI模块实现

问题 如何在设备上进行 Wifi 编程&#xff1f; LwIp (Light Weight IP) 简介 LwIp 是轻量化的 TCP/IP&#xff0c;是一个小型开源的 TCP/IP 协议栈 LwIp 的设计目标是用较少的资源实现较完整的 TCP/IP 协议栈 LwIp 能在操作系统中运行&#xff0c;也能在无操作系统的情况下…

Java—异常体系

文章目录异常和错误java异常的分类&#xff1a;非运行时异常运行时异常受检异常&#xff08;非运行时异常&#xff09;如何处理&#xff1f;1、try catch finally为什么要用try catch finally2、throwsThrow和Throws的区别JVM是如何处理异常的try-catch-finally中哪个部分可以省…

项目管理逻辑:项目经理如何掌控项目生命周期, 才能避免身心俱疲?

目录 1.项目生命周期 2.预测型项目周期 3.迭代型项目周期 3.1.初始阶段 3.2.精化阶段 3.3.构建阶段 3.4.交付阶段 4.增量型生命周期 5.敏捷开发 5.根据具体项目使用合理的开发方式 1.项目生命周期 2.预测型项目周期 预测型项目周期就是软件开发领域的瀑布流模型&…

【Python自然语言处理】概率上下文无关文法(PCFG)及神经网络句法分析讲解(图文解释 超详细)

觉得有帮助或有疑问麻烦点赞关注收藏后评论区私信留言~~~ 一、句法分析 句法分析&#xff08;syntactic parsing或者parsing&#xff09;是识别句子包含的句法成分要素以及成分之间的内在关系&#xff0c;一般以句法树来表示句法分析的结果。实现该过程的应用称作句法分析器&a…

三维模型的简化算法研究(任务书+lunwen+外文翻译+源码+查重报告)

目 录 第1章 绪论 1 1.1 研究背景 1 1.2 内存网格简化算法 1 1.2.1 顶点聚类 1 1.2.2 区域合并 2 1.2.3 迭代式消除 4 1.2.4 随机重采样 5 1.3 三维模型简化算法 6 1.3.1 分片简化 6 1.3.2 使用外部数据结构 7 1.3.3 网格批处理 9 1.3.4 流式简化 10 1.3.5 小结 11 1.4 自适应等…

【前沿技术RPA】 一文了解UiPath Orchestrator的触发器和监听器

&#x1f40b;作者简介&#xff1a;博主是一位.Net开发者&#xff0c;同时也是RPA和低代码平台的践行者。 &#x1f42c;个人主页&#xff1a;会敲键盘的肘子 &#x1f430;系列专栏&#xff1a;UiPath &#x1f980;专栏简介&#xff1a;UiPath在传统的RPA&#xff08;Robotic…

公众号接口免费调用

公众号接口免费调用 本平台优点&#xff1a; 多题库查题、独立后台、响应速度快、全网平台可查、功能最全&#xff01; 1.想要给自己的公众号获得查题接口&#xff0c;只需要两步&#xff01; 2.题库&#xff1a; 题库&#xff1a;题库后台&#xff08;点击跳转&#xff09;…

Express:CORS 跨域资源共享

CORS 跨域资源共享 Staticfile CDN 1. 接口的跨域问题 刚才编写的 GET 和 POST接口&#xff0c;存在一个很严重的问题&#xff1a;不支持跨域请求。 解决接口跨域问题的方案主要有两种&#xff1a; 1.CORS&#xff08;主流的解决方案&#xff0c;推荐使用&#xff09; 2.J…

Excel - 选择性粘贴和单元格引用规则

最基本的功能&#xff0c;才是最重要的功能&#xff0c;一定好好好理解。 最常用的复制、粘贴功能&#xff0c;在Excel里赋予了更多的选项&#xff0c;也变得更加强大。Excel里一般可复制的内容都是只单元格区域&#xff0c;其组成包括数据(文本或数值)、格式、公式、有效性验证…

FileZilla Server.xml 如何配置

要从xp.cn说起&#xff0c;因为它自带了一个ftp服务器。我点击配置后&#xff0c;就会直接用记事本打开FileZilla Server.xml让配置。我就很懵。不知道如何下手。 弹出的配置界面如下&#xff1a; 如何配置FileZilla Server.xml 我一开始想到去xp.cn找文档&#xff0c;可惜…

初探基因组组装——生信原理第四次实验报告

初探基因组组装——生信原理第四次实验报告 文章目录初探基因组组装——生信原理第四次实验报告实验目的实验内容实验题目第一题题目用SOAPdenovo 进行基因组组装评估组装质量第二题题目Canu组装Hifiasm组装基于nucmer的基因组比对过滤比对结果转换为可读性强的tab键分隔的文件…