基于javaweb的SSM二手汽车商城管理系统(java+jsp+bootstrap+ssm+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

280023502402

290023502402

300023502402

310023502402

320023502402

基于javaweb的SSM二手汽车商城管理系统(java+jsp+bootstrap+ssm+mysql)

项目介绍

本项目共分为管理员、用户、店员三种角色: 管理员角色包含以下功能: 管理员登录,在售车辆管理,品牌管理,品牌分类管理,推荐车辆,订单管理,销量统计等功能。

用户角色包含以下功能: 用户登录,用户角色首页,购物商城,查看购物车,订单管理,个人信息修改,关于我们等功能。

店员角色包含以下功能: 添加删除修改二手车,订单管理,销量统计,个人信息修改等功能。

环境需要

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

技术栈

  1. 后端:Spring+SpringMVC+Mybatis 2. 前端:JSP+JavaScript+jQuery+BootStrap

使用说明

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
			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";
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
	Login queryLogin = loginService.queryLoginById(login.getLogin_id());
if(queryLogin == null){ //账号不存在
map.put("loginError", "账号或密码输入错误");
return "login";
}else if(! queryLogin.getLogin_password().equals(login.getLogin_password()) ){ //密码错误
System.out.println("---------error-------");
map.put("permission", queryLogin.getLogin_permission());
map.put("loginError1", "账号或密码输入错误");
return "login";
}else if(queryLogin.getLogin_permission().equals("admin")){ //管理员
System.out.println("---------admin-------");
session.setAttribute("adminloginSession", queryLogin);
return "admin/index";
}else if(queryLogin.getLogin_permission().equals("shop")){ //商家
System.out.println("---------shop-------");
session.setAttribute("shoploginSession", queryLogin);
session.setAttribute("shoploginSession_name", personService.queryPersonById(queryLogin.getLogin_id()).getPerson_name());
return "shop/index";
}else{ //用户
System.out.println("---------user--------");
session.setAttribute("loginSession", queryLogin);
session.setAttribute("loginSession_name", personService.queryPersonById(queryLogin.getLogin_id()).getPerson_name());
return "redirect:/indexInitAction";
}
}

//跳转到(用户或商家)主页。
@RequestMapping("/indexInitAction")
public String indexInit(HttpSession session, Map<String, Object> map){
Login login = (Login)session.getAttribute("loginSession");
if(login != null && login.getLogin_permission().equals("user") ){
Person person = personService.queryPersonById(login.getLogin_id());
session.setAttribute("loginSession_name", person.getPerson_name());
System.out.println("==========index=========" + login.getLogin_permission() + "===========");
}
return "/user/index";
}


//利用ajax确定修改后的电话号码没有被注册
@RequestMapping("/ajaxTextIdAndTel")
public void ajaxTextIdAndTel(HttpServletRequest request, HttpServletResponse response, String person_tel, String login_id) throws UnsupportedEncodingException{
response.setCharacterEncoding("UTF-8");
request.setCharacterEncoding("UTF-8");

boolean boolReturn = true;

Login login = loginService.queryLoginById(login_id);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
@Controller
@RequestMapping("/shopSaleCountManage")
public class ShopSaleCountManageAction {

@Autowired
private BrandService brandService;

@Autowired
private OrderService orderService;

//根据品牌统计销量
@RequestMapping("/brandSaleList")
public String brandSaleList(Map<String, Object> map, HttpSession session){
Login login = (Login) session.getAttribute("shoploginSession");
if(login == null || !login.getLogin_permission().equals("shop")){
return "redirect:/loginInitAction";
}

List<Brand> brandList = brandService.queryAllBrand();
List<Order> orderList = orderService.shopSaleOrderByBrand(login.getLogin_id());
int saleNum[] = new int[brandList.size()];
int salePrice[] = new int[brandList.size()];

for(int i=0; i<orderList.size(); i++){
//该订单品牌在品牌列表中的位置
int temp =0;
for(int j=0; j<brandList.size(); j++){
if(brandList.get(j).getBrand_id().equals( orderList.get(i).getCar_brand_id() )){
temp = j;break;
}
}
saleNum[temp]++;
salePrice[temp] += orderList.get(i).getCar_price_new();
}

map.put("saleNum", saleNum);
map.put("salePrice", salePrice);
map.put("brandList", brandList);
return "shop/saleCountManage/countByBrand";
}

//某个品牌销售详情
@RequestMapping("/saleOrderByBrand")
public String saleOrderByBrand(String brand_id,String shop_id, Map<String, Object> map){
List<Order> orderList = orderService.shopSaleOrderByBrandId(brand_id, shop_id);
map.put("brand_name", brandService.queryBrandById(brand_id).getBrand_name() );
map.put("brandOrderList", orderList);
return "shop/saleCountManage/brandOrderDetails";
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
public class AdminOrderManageAction {


@Autowired
private OrderService orderService;

@Autowired
private PageService pageService;

//未发货订单列表
@RequestMapping("/orderNotSendList")
public String orderNotSendList(Map<String, Object> map, String currentpage){
List<Order> orderList = orderService.queryAllPayOrder();

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 "admin/orderManage/order_notSend";
}

//将订单发货,然后返回未发货订单列表
@RequestMapping("/sendOrderById")
public String sendOrderById(String order_id){
orderService.sendOrderById(order_id);
return "redirect:/adminOrderManage/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 "admin/orderManage/order_details";
}

//根据id查询未发货订单
@RequestMapping("/queryNotSendById")
public String queryNotSendById(Map<String, Object> map, String order_id, String currentpage){
List<Order> orderList = orderService.queryPayOrderById(order_id);

Page page = pageService.pageToOrder(orderList.size(), currentpage);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
	









}
package com.carSystem.action.admin;





@Controller
@RequestMapping("/admin")
public class CarManageAction {

@Autowired
private CarService carService;

@Autowired
private BrandService brandService;

@Autowired
private PageService pageService;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
		
int[] monthArray = new int[]{0,1,2,3,4,5,6,7,8,9,10,11,12};
List<Order> orderTimeList = new ArrayList<Order>();

if(year == null || year.equals("")){
year = "2017";
}
if( !year.equals("2017")){
map.put("year", year);
map.put("month", monthArray);
return "shop/saleCountManage/countByTime";
}

orderTimeList = orderService.shopSaleOrderTime(login.getLogin_id());
int numSumMonth[] = new int[13];
int priceSumMonth[] = new int[13];
// List<ArrayList<Order>> orderMonthList = new ArrayList<ArrayList<Order>>(13);
// for(int i=0; i<13; i++){
// ArrayList<Order> list = new ArrayList<Order>(1);
// orderMonthList.add(list);
// }
for(int i=0; i<orderTimeList.size(); i++){
String month = orderTimeList.get(i).getOrder_time_receive().substring(5, 7); //订单完成时间的月份
int monthInt = Integer.parseInt(month);
numSumMonth[monthInt]++; //时间加进去
priceSumMonth[monthInt]+=orderTimeList.get(i).getCar_price_new(); //销量加进去
// orderMonthList.get(monthInt).add( orderTimeList.get(i) ); //订单列表
}
map.put("month", monthArray);
map.put("year", year);
map.put("numSum", numSumMonth);
map.put("priceSum", priceSumMonth);
// map.put("orderList", orderMonthList);
return "shop/saleCountManage/countByTime";
}



//(商家)月份订单详情
@RequestMapping("/saleOrderByMonth")
public String saleOrderByMonth(String month, Map<String, Object> map, String shop_id, String year){
List<Order> orderList = orderService.shopSaleOrderByMonth(year, month, shop_id);
map.put("month", month);
map.put("monthOrderList", orderList);
return "shop/saleCountManage/monthOrderDetails";
}




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