Java项目:二手车管理系统(java+SSM+JSP+JS+JQUERY+Layui+Mysql)

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

项目介绍

基于ssm二手车交易管理系统(带文档)

本系统主要分为用户和管理员两个角色

其中用户的功能有用户注册和登陆系统,用户查网站新闻,查看二手车,在线预定,提交自己的二手车信息进行预估,查看预估报价结果。

管理员可以登陆系统,对二手车分类,二手车信息,用户预约定金,评估报价等信息进行管理。


环境需要

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


技术栈

后端:SSM(Spring+SpringMVC+Mybatis)
前端:JSP+CSS+JS+JQUERY+Layui


使用说明

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

 

 

 

 

 

 用户信息管理控制层:

@Controller
@RequestMapping("/shop")
public class ShopUserInfoAction {

	@Autowired
	private PersonService personService;
	
	@Autowired
	private LoginService loginSevice;
	
	
	//初始化用户更新页面
	@RequestMapping("/updateInfoInit")
	public String updateInfoInit(HttpSession session, Map<String, Object> map){
		Login login = (Login) session.getAttribute("shoploginSession");
		if(login == null){
			return "redirect:/loginInitAction";
		}else if( !login.getLogin_permission().equals("shop")){
			return "redirect:/loginInitAction";
		}
		Person person = personService.queryPersonById(login.getLogin_id());
		map.put("updatePersonInfo", person);
		return "shop/userInfo/updateInfo";
	}
	
	//保存用户修改后的个人信息
	@RequestMapping("/saveUpdatePersonInfo")
	public String saveUpdatePersonInfo(Person person, Map<String, Object> map){
		personService.saveUpdatePersonInfo(person);
		return "redirect:/shop/updateInfoInit";
	}
	
	//利用ajax确定修改后的电话号码没有被注册
	@RequestMapping("/ajaxTextTelExist")
	public void ajaxGetStu_name(HttpServletRequest request, HttpServletResponse response, String person_tel) throws UnsupportedEncodingException{
		response.setCharacterEncoding("UTF-8");
		request.setCharacterEncoding("UTF-8");
		
		boolean boolTel = personService.textTelExist(person_tel);
		String json = new Gson().toJson(boolTel);
		try {
			response.getWriter().print(json);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	//修改用户的密码
	@RequestMapping("/changePassword")
	public String changePassword(String oldPwd, String newPwd, Map<String, Object> map, HttpSession session){
		Login login = (Login) session.getAttribute("shoploginSession");
		if(login == null){
			return "redirect:/loginInitAction";
		}else if( !login.getLogin_permission().equals("shop")){
			return "redirect:/loginInitAction";
		}
		
		if( ! login.getLogin_password().equals(oldPwd)){	//输入密码错误
			map.put("changePwdError", "您输入的原密码错误");
			return "shop/userInfo/changePassword";
		}
		
		login.setLogin_password(newPwd);
		loginSevice.saveLogin(login);
		map.put("changePwdSuccess", "恭喜您,修改密码成功");
		return "shop/userInfo/changePassword";
	}
}

购物车管理控制层:

@Controller
@RequestMapping("/shop")
public class ShopCarManageAction {

	@Autowired
	private CarService carService;
	
	@Autowired
	private BrandService brandService;
	
	@Autowired
	private PageService pageService;
	
	//导航栏的搜索框
	@RequestMapping("/navQueryIdOrName")
	public String navQueryIdOrName(Map<String, Object> map, String car_name, HttpSession session){
		Login login = (Login) session.getAttribute("shoploginSession");
		if(login == null || !login.getLogin_permission().equals("shop")){
			return "redirect:/loginInitAction";
		}
		map.put("carOnlineList", carService.shopQueryOnlineCarByIdOrName(car_name, login.getLogin_id()));
		return "shop/carManage/car_online_list";
	}
	
	//商家查询全部在售车辆
	@RequestMapping("/queryAllOnlineCar")
	public String queryAllOnlineCar(Map<String, Object> map, HttpSession session, String currentpage){
		Login login = (Login) session.getAttribute("shoploginSession");
		if(login == null || !login.getLogin_permission().equals("shop")){
			return "redirect:/loginInitAction";
		}
		
		List<Car> onlineCarList = carService.shopQueryAllOnlineCar(login.getLogin_id());
		
		Page page = pageService.pageToCar(onlineCarList.size(), currentpage);
		int subEnd = (page.getCurrentpage()-1)*page.getSize() + page.getSize() > onlineCarList.size() ? onlineCarList.size() : (page.getCurrentpage()-1)*page.getSize() + page.getSize();
		onlineCarList = onlineCarList.subList( (page.getCurrentpage()-1)*page.getSize() , subEnd);
		
		map.put("page", page);
		map.put("queryKind", "all");
		map.put("carOnlineList", onlineCarList);
		return "shop/carManage/car_online_list";
	}
	
	//根据id查询在售车辆
	@RequestMapping("/queryOnlineCarById")
	public String queryOnlineCarById(Map<String, Object> map, String car_id, String shop_id, String currentpage){
		List<Car> onlineCarList = null;
		if(car_id == null || car_id.equals("")){
			onlineCarList = carService.shopQueryAllOnlineCar(shop_id);
		}else{
			onlineCarList = carService.shopQueryOnlineCarByIdOrName(car_id, shop_id);
		}
		
		Page page = pageService.pageToCar(onlineCarList.size(), currentpage);
		int subEnd = (page.getCurrentpage()-1)*page.getSize() + page.getSize() > onlineCarList.size() ? onlineCarList.size() : (page.getCurrentpage()-1)*page.getSize() + page.getSize();
		onlineCarList = onlineCarList.subList( (page.getCurrentpage()-1)*page.getSize() , subEnd);
		
		map.put("page", page);
		map.put("queryKind", "idOrName");
		map.put("carOnlineList", onlineCarList);
		map.put("queryString", car_id);
		return "shop/carManage/car_online_list";
	}
	
	//添加车辆初始化界面
	@RequestMapping("/addCarInit")
	public String addCarInit(Map<String, Object> map){
		map.put("BrandList", brandService.queryAllBrand());
		return "shop/carManage/car_add";
	}
	
	//添加车辆
	@RequestMapping(value="/addCar", method=RequestMethod.POST)
	public String addCar(@RequestParam("imgSrc")MultipartFile mf, Car car) throws IOException{
		
		if(mf.getSize() != 0){	//上传的图片不为空
			
			InputStream is = mf.getInputStream();
			File target = new File(Constants.IMAGEPATH + mf.getOriginalFilename());
			OutputStream os = null;
			try{
				os = new FileOutputStream(target, true);
				int templeng = 0;
				byte[] tempbyte = new byte[4096];
				while((templeng = is.read(tempbyte)) != -1){
					os.write(tempbyte, 0, templeng);
					os.flush();
				}
			}catch(Exception e){
				e.printStackTrace();
			}finally{
				try{
					is.close();
					os.close();
				}catch (IOException e) {
					e.printStackTrace();
				}
			}
			car.setCar_img(mf.getOriginalFilename());
			
		}else{	//用户上传图片为空
			car.setCar_img("demo.jpg");
		}
		
		carService.addCar(car);
		return "redirect:/shop/queryAllOnlineCar";
	}
	
	//查看单个车辆详情
	@RequestMapping("/carDetail")
	public String carDetails(Map<String, Object> map, String car_id){
		List<Car> list = carService.queryOnlineCarById(car_id);
		map.put("carDetail", list.get(0));
		return "shop/carManage/car_details";
	}
	
	//在线车辆信息更新初始化页面
	@RequestMapping("/carUpdateInit")
	public String carUpdateInit(Map<String, Object> map, String car_id){
		map.put("carUpdate", carService.queryOnlineCarById(car_id).get(0));
		map.put("brandList",brandService.queryAllBrand());
		return "shop/carManage/car_update";
	}
	
	//保存修改后的在售汽车
	@RequestMapping(value="/saveCar", method=RequestMethod.POST)
	public String saveOnlineCar(@RequestParam("imgSrc")MultipartFile mf, Map<String, Object> map, Car car) throws IOException{
		if(mf.getSize() != 0){
			InputStream is = mf.getInputStream();
			File target = new File(Constants.IMAGEPATH + mf.getOriginalFilename());
			OutputStream os = null;
			try{
				os = new FileOutputStream(target, true);
				int templeng = 0;
				byte[] tempbyte = new byte[4096];
				while((templeng = is.read(tempbyte)) != -1){
					os.write(tempbyte, 0, templeng);
					os.flush();
				}
			}catch(Exception e){
				e.printStackTrace();
			}finally{
				try{
					is.close();
					os.close();
				}catch (IOException e) {
					e.printStackTrace();
				}
			}
			File deleteFile = new File(Constants.IMAGEPATH + car.getCar_img());
	        if (deleteFile.exists() && !car.getCar_img().equals("demo.jpg")){
	        	deleteFile.delete();
	        }
	        
	        car.setCar_img(mf.getOriginalFilename());
		}
		
		carService.saveCar(car);
		return "redirect:/shop/queryAllOnlineCar";
	}
	
	//根据车辆将汽车下架
	@RequestMapping("/carDownShelf")
	public String carDownShelf(String car_id){
		String operaDeleteId = carService.queryOnlineCarByIdOrName(car_id).get(0).getCar_shop_id();
		carService.carDownShelf(car_id, operaDeleteId);
		return "redirect:/shop/queryAllOnlineCar";
	}
	
	//下架车辆列表
	@RequestMapping("/queryAllDownShelfCar")
	public String queryAllDownShelfCar(Map<String, Object> map, HttpSession session, String currentpage){
		Login login = (Login) session.getAttribute("shoploginSession");
		if(login == null || !login.getLogin_permission().equals("shop")){
			return "redirect:/loginInitAction";
		}
		
		List<Car> downCarList = carService.shopQueryAllDownShelfCar(login.getLogin_id());
		Page page = pageService.pageToCar(downCarList.size(), currentpage);
		int subEnd = (page.getCurrentpage()-1)*page.getSize() + page.getSize() > downCarList.size() ? downCarList.size() : (page.getCurrentpage()-1)*page.getSize() + page.getSize();
		downCarList = downCarList.subList( (page.getCurrentpage()-1)*page.getSize() , subEnd);
		
		map.put("queryKind", "all");
		map.put("carDownShelfList", downCarList);
		map.put("page", page);
		return "shop/carManage/car_downShelf_list";
	}
	
	//下架车辆信息修改
	@RequestMapping("/carUpdateDownShelf")
	public String carUpdateDownShelf( Map<String, Object> map, String car_id){
		
		map.put("carUpdateDownShelf", carService.queryDownShelfCarById(car_id).get(0));
		map.put("brandList",brandService.queryAllBrand());
		return "shop/carManage/car_update_downShelf";
	}
	
	//保存修改后的下架汽车
	@RequestMapping(value="/saveDownShelfCar", method=RequestMethod.POST)
	public String saveDownShelfCar(@RequestParam("imgSrc")MultipartFile mf, Map<String, Object> map, Car car) throws IOException{
		
		if(mf.getSize() != 0){
			InputStream is = mf.getInputStream();
			File target = new File(Constants.IMAGEPATH + mf.getOriginalFilename());
			OutputStream os = null;
			try{
				os = new FileOutputStream(target, true);
				int templeng = 0;
				byte[] tempbyte = new byte[4096];
				while((templeng = is.read(tempbyte)) != -1){
					os.write(tempbyte, 0, templeng);
					os.flush();
				}
			}catch(Exception e){
				e.printStackTrace();
			}finally{
				try{
					is.close();
					os.close();
				}catch (IOException e) {
					e.printStackTrace();
				}
			}
			File deleteFile = new File(Constants.IMAGEPATH + car.getCar_img());
	        if (deleteFile.exists() && !car.getCar_img().equals("demo.jpg")){
	        	deleteFile.delete();
	        }
	        
	        car.setCar_img(mf.getOriginalFilename());
		}
		
		carService.saveCar(car);
		return "redirect:/shop/queryAllDownShelfCar";
	}
	
	//根据编号查询下架车辆信息
	@RequestMapping("/queryDownShelfCarById")
	public String queryDownShelfCarById(Map<String, Object> map, String car_id, String shop_id, String currentpage){
		List<Car> list = null;
		if(car_id == null || car_id.equals("")){
			list = carService.shopQueryAllDownShelfCar(shop_id);
		}else{
			list = carService.shopQueryDownShelfCarByIdOrName(car_id, shop_id);
		}
		
		Page page = pageService.pageToCar(list.size(), currentpage);
		int subEnd = (page.getCurrentpage()-1)*page.getSize() + page.getSize() > list.size() ? list.size() : (page.getCurrentpage()-1)*page.getSize() + page.getSize();
		list = list.subList( (page.getCurrentpage()-1)*page.getSize() , subEnd);
		
		map.put("queryKind", "idOrName");
		map.put("page", page);
		map.put("carDownShelfList", list);
		map.put("queryString", car_id);
		return "shop/carManage/car_downShelf_list";
	}
	
	//根据id将车辆上架
	@RequestMapping("/carUpShelfById")
	public String carUpShelfById(String car_id, Map<String, Object> map){
		carService.carUpShelfById(car_id);
		return "redirect:/shop/queryAllDownShelfCar";
	}
	
	//根据id彻底删除车辆信息
	@RequestMapping("/carDelete")
	public String carDelete(String car_id, Map<String, Object> map){
		carService.carDelete(car_id);
		return "redirect:/shop/queryAllDownShelfCar";
	}
	
}

订单管理控制层: 

@Controller
@RequestMapping("/shopOrderManage")
public class ShopOrderManageAction {

	
	@Autowired
	private OrderService orderService;
	
	@Autowired
	private PageService pageService;
	
	
	//未发货订单列表
	@RequestMapping("/orderNotSendList")
	public String orderNotSendList(Map<String, Object> map, HttpSession session,String currentpage){
		Login login = (Login) session.getAttribute("shoploginSession");
		if(login == null || !login.getLogin_permission().equals("shop")){
			return "redirect:/loginInitAction";
		}
		List<Order> orderList = orderService.shopQueryAllPayOrder(login.getLogin_id());
		
		Page page = pageService.pageToOrder(orderList.size(), currentpage);
		int subEnd = (page.getCurrentpage()-1)*page.getSize() + page.getSize() > orderList.size() ? orderList.size() : (page.getCurrentpage()-1)*page.getSize() + page.getSize();
		orderList = orderList.subList( (page.getCurrentpage()-1)*page.getSize() , subEnd);
		
		map.put("page", page);
		map.put("queryKind", "all");
		map.put("notSendOrder", orderList);
		return "shop/orderManage/order_notSend";
	}
	
	//将订单发货,然后返回未发货订单列表
	@RequestMapping("/sendOrderById")
	public String sendOrderById(String order_id){
		orderService.sendOrderById(order_id);
		return "redirect:/shopOrderManage/orderNotSendList";
	}
	
	//订单信息详情
	@RequestMapping("/orderDetails")
	public String orderDetails(Map<String, Object> map, String order_id){
		Order order = orderService.queryOrderById(order_id).get(0);
		map.put("detailsOrder", order);
		return "shop/orderManage/order_details";
	}
	
	//根据id查询未发货订单
	@RequestMapping("/queryNotSendById")
	public String queryNotSendById(Map<String, Object> map, String order_id, String order_shop_id, String currentpage){
		List<Order> orderList = orderService.shopQueryPayOrderById(order_id, order_shop_id);

		Page page = pageService.pageToOrder(orderList.size(), currentpage);
		int subEnd = (page.getCurrentpage()-1)*page.getSize() + page.getSize() > orderList.size() ? orderList.size() : (page.getCurrentpage()-1)*page.getSize() + page.getSize();
		orderList = orderList.subList( (page.getCurrentpage()-1)*page.getSize() , subEnd);
		
		map.put("page", page);
		map.put("queryKind", "idOrName");
		map.put("notSendOrder", orderList);
		map.put("queryString", order_id);
		return "shop/orderManage/order_notSend";
	}
	
	//已经发货未收货订单
	@RequestMapping("/orderNotReceiveList")
	public String orderNotReceiveList(Map<String, Object> map, String order_shop_id, String currentpage){
		List<Order> orderList = orderService.shopQueryAllSendOrder(order_shop_id);
		
		Page page = pageService.pageToOrder(orderList.size(), currentpage);
		int subEnd = (page.getCurrentpage()-1)*page.getSize() + page.getSize() > orderList.size() ? orderList.size() : (page.getCurrentpage()-1)*page.getSize() + page.getSize();
		orderList = orderList.subList( (page.getCurrentpage()-1)*page.getSize() , subEnd);
		
		map.put("page", page);
		map.put("queryKind", "all");
		map.put("notReceiveOrder", orderList);
		return "shop/orderManage/order_notReceive";
	}
	
	//根据id查询未收货订单
	@RequestMapping("/queryNotReceiveById")
	public String queryNotReceiveById(Map<String, Object> map, String order_id, String order_shop_id, String currentpage){
		List<Order> orderList = orderService.shopQuerySendOrderById(order_id, order_shop_id);
		
		Page page = pageService.pageToOrder(orderList.size(), currentpage);
		int subEnd = (page.getCurrentpage()-1)*page.getSize() + page.getSize() > orderList.size() ? orderList.size() : (page.getCurrentpage()-1)*page.getSize() + page.getSize();
		orderList = orderList.subList( (page.getCurrentpage()-1)*page.getSize() , subEnd);
		
		map.put("page", page);
		map.put("queryKind", "idOrName");
		map.put("notReceiveOrder", orderList);
		map.put("queryString", order_id);
		return "shop/orderManage/order_notReceive";
	}
	
	//历史订单列表
	@RequestMapping("/orderHistoryList")
	public String orderHistoryList(Map<String, Object> map, String order_shop_id, String currentpage){
		List<Order> orderList = orderService.shopQueryAllReceiveOrder(order_shop_id);

		Page page = pageService.pageToOrder(orderList.size(), currentpage);
		int subEnd = (page.getCurrentpage()-1)*page.getSize() + page.getSize() > orderList.size() ? orderList.size() : (page.getCurrentpage()-1)*page.getSize() + page.getSize();
		orderList = orderList.subList( (page.getCurrentpage()-1)*page.getSize() , subEnd);
		
		map.put("page", page);
		map.put("queryKind", "all");
		map.put("HistoryOrder", orderList);
		return "shop/orderManage/order_history";
	}
	
	//根据id查询历史订单
	@RequestMapping("/queryHistoryById")
	public String queryHistoryById(Map<String, Object> map, String order_id, String order_shop_id, String currentpage){
		List<Order> orderList = orderService.shopQueryReceiveOrderById(order_id, order_shop_id);

		Page page = pageService.pageToOrder(orderList.size(), currentpage);
		int subEnd = (page.getCurrentpage()-1)*page.getSize() + page.getSize() > orderList.size() ? orderList.size() : (page.getCurrentpage()-1)*page.getSize() + page.getSize();
		orderList = orderList.subList( (page.getCurrentpage()-1)*page.getSize() , subEnd);
		
		map.put("page", page);
		map.put("queryKind", "idOrName");
		map.put("HistoryOrder", orderList);
		map.put("queryString", order_id);
		return "shop/orderManage/order_history";
	}
	
	//用户已经删除订单(回收站订单)
	@RequestMapping("/orderDeleteList")
	public String orderDeleteList(Map<String, Object> map, String order_shop_id, String currentpage, HttpSession session){
		List<Order> orderList = orderService.shopQueryAllDeleteOrder(order_shop_id);

		Page page = pageService.pageToOrder(orderList.size(), currentpage);
		int subEnd = (page.getCurrentpage()-1)*page.getSize() + page.getSize() > orderList.size() ? orderList.size() : (page.getCurrentpage()-1)*page.getSize() + page.getSize();
		orderList = orderList.subList( (page.getCurrentpage()-1)*page.getSize() , subEnd);
		
		map.put("page", page);
		map.put("queryKind", "all");
		map.put("DeleteOrderList", orderList);
		return "shop/orderManage/order_delete";
	}
	
	//根据id查询回收站的订单
	@RequestMapping("/queryDeleteById")
	public String queryDeleteById(Map<String, Object> map, String order_id, String order_shop_id, String currentpage){
		List<Order> orderList = orderService.shopQueryDeleteOrderById(order_id, order_shop_id);

		Page page = pageService.pageToOrder(orderList.size(), currentpage);
		int subEnd = (page.getCurrentpage()-1)*page.getSize() + page.getSize() > orderList.size() ? orderList.size() : (page.getCurrentpage()-1)*page.getSize() + page.getSize();
		orderList = orderList.subList( (page.getCurrentpage()-1)*page.getSize() , subEnd);
		
		map.put("page", page);
		map.put("queryKind", "idOrName");
		map.put("DeleteOrderList", orderList);
		map.put("queryString", order_id);
		return "shop/orderManage/order_delete";
	}
	
	//根据id彻底删除回收站的订单
	@RequestMapping("/orderDeleteById")
	public String orderDeleteById(String order_id, String order_shop_id, Map<String, Object> map, String currentpage){
		orderService.orderDeleteById(order_id);
		
		List<Order> orderList = orderService.shopQueryAllDeleteOrder(order_shop_id);

		Page page = pageService.pageToOrder(orderList.size(), currentpage);
		int subEnd = (page.getCurrentpage()-1)*page.getSize() + page.getSize() > orderList.size() ? orderList.size() : (page.getCurrentpage()-1)*page.getSize() + page.getSize();
		orderList = orderList.subList( (page.getCurrentpage()-1)*page.getSize() , subEnd);
		
		map.put("page", page);
		map.put("queryKind", "all");
		map.put("DeleteOrderList", orderList);
		return "shop/orderManage/order_delete";
	}
	
}

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

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

OldWinePot

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

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

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

打赏作者

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

抵扣说明:

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

余额充值