基于javaweb的SSM汽车维修预约平台(java+ssm+jsp+javascript+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

040023332402

050023332402

060023332402

070023332402

080023332402

090023332402

基于javaweb的SSM汽车维修预约平台(java+ssm+jsp+javascript+mysql)

项目介绍

本项目分为前后台,前台为普通用户登录,后台为管理员登录;

管理员角色:

管理员登录,新增管理员信息,查看管理员信息,查询管理员信息,查看用户信息列表,查询用户信息,新增新闻公告,查看新闻公告,查询新闻公告,新增配件类型,查看配件类型,查询配件类型,新增城市信息,查看城市信息,查询城市信息,新增维修站信息,查看维修站信息,查询维修站信息,新增配件商品,查看配件商品,查询配件商品,查看订单信息,查询订单信息,查看评价信息,查询评价信息等功能。

用户角色包含以下功能:

用户登录,查看首页,查看商品详情,提交预约,下订单,查看我的订单,查看公告,查看维修站,修改个人信息等功能。

环境需要

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

技术栈

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

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中springmvc-servlet.xml配置文件中的数据库配置改为自己的配置; 4. 运行项目,在浏览器中输入http://localhost:8080/ 登录 用户账号/密码: user/123456 管理员账号/密码:admin/admin

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
		List<Jiancai> flimList = this.jiancaiService.getJiancaiByLike(goods);
this.getRequest().setAttribute("flimList", flimList);
return "users/list";
}

// 配件商品详情
@RequestMapping("detail.action")
public String detail(String id) {
this.front();
Jiancai goods = this.jiancaiService.getJiancaiById(id);
goods.setHits("" + (Integer.parseInt(goods.getHits()) + 1));
this.jiancaiService.updateJiancai(goods);
this.getRequest().setAttribute("goods", goods);
if (this.getSession().getAttribute("userid") == null) {
return "redirect:/index/preLogin.action";
}
String userid = (String) this.getSession().getAttribute("userid");
Topic topic = new Topic();
topic.setJiancaiid(id);
List<Topic> topicList = this.topicService.getTopicByCond(topic);
this.getRequest().setAttribute("topicList", topicList);
this.getRequest().setAttribute("tnum", topicList.size());
return "users/detail";
}

@RequestMapping("addTopic.action")
public String addTopic(Topic topic) {
this.front();
if (this.getSession().getAttribute("userid") == null) {
return "redirect:/index/preLogin.action";
}
String userid = (String) this.getSession().getAttribute("userid");
topic.setAddtime(VeDate.getStringDateShort());
topic.setContents(this.getRequest().getParameter("contents"));
topic.setJiancaiid(this.getRequest().getParameter("goodsid"));
topic.setNum(this.getRequest().getParameter("num"));
topic.setUsersid(userid);
this.topicService.insertTopic(topic);
return "redirect:/index/detail.action?id=" + topic.getJiancaiid();
}

}
package com.action;


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
	}
String html = "";
StringBuffer buffer = new StringBuffer();
buffer.append("&nbsp;&nbsp;共为");
buffer.append(maxPage);
buffer.append("页&nbsp; 共有");
buffer.append(pageNumber);
buffer.append("条&nbsp; 当前为第");
buffer.append((Integer.parseInt(number) + 1));
buffer.append("页 &nbsp;");
if ((Integer.parseInt(number) + 1) == 1) {
buffer.append("首页");
} else {
buffer.append("<a href=\"index/recommend.action?number=0\">首页</a>");
}
buffer.append("&nbsp;&nbsp;");
if ((Integer.parseInt(number) + 1) == 1) {
buffer.append("上一页");
} else {
buffer.append("<a href=\"index/recommend.action?number=" + (Integer.parseInt(number) - 1) + "\">上一页</a>");
}
buffer.append("&nbsp;&nbsp;");
if (maxPage <= (Integer.parseInt(number) + 1)) {
buffer.append("下一页");
} else {
buffer.append("<a href=\"index/recommend.action?number=" + (Integer.parseInt(number) + 1) + "\">下一页</a>");
}
buffer.append("&nbsp;&nbsp;");
if (maxPage <= (Integer.parseInt(number) + 1)) {
buffer.append("尾页");
} else {
buffer.append("<a href=\"index/recommend.action?number=" + (maxPage - 1) + "\">尾页</a>");
}
html = buffer.toString();
this.getRequest().setAttribute("html", html);
this.getRequest().setAttribute("flimList", flimList);
return "users/list";
}

// 推荐产品
@RequestMapping("hot.action")
public String getHost(String number) {
this.front();
Jiancai goods = new Jiancai();
goods.setRecommend("是");
List<Jiancai> flimList = new ArrayList<Jiancai>();
List<Jiancai> tempList = this.jiancaiService.getJiancaiByHot();
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


@Controller
@RequestMapping("/upload")
public class UploadAction {

@RequestMapping(value = "/image.action")
public String upload(@RequestParam(value = "image", required = false) MultipartFile file,
HttpServletRequest request, ModelMap model) {
String path = request.getSession().getServletContext().getRealPath("/") + "upfiles/";
String fileName = file.getOriginalFilename();
int i = fileName.lastIndexOf(".");
String name = String.valueOf(VeDate.getStringDatex());
String type = fileName.substring(i + 1);
fileName = name + "." + type;
File targetFile = new File(path, fileName);
if (!targetFile.exists()) {
targetFile.mkdirs();
}

// 保存
try {
file.transferTo(targetFile);
} catch (Exception e) {
e.printStackTrace();
}
model.addAttribute("imageFileName", fileName);
return "saveimage";
}

@RequestMapping(value = "/files.action")
public String files(@RequestParam(value = "image", required = false) MultipartFile file, HttpServletRequest request,
ModelMap model) {
String path = request.getSession().getServletContext().getRealPath("/") + "upfiles/";
String fileName = file.getOriginalFilename();
int i = fileName.lastIndexOf(".");
String name = String.valueOf(VeDate.getStringDatex());
String type = fileName.substring(i + 1);
fileName = name + "." + type;
File targetFile = new File(path, fileName);
if (!targetFile.exists()) {
targetFile.mkdirs();
}

// 保存
try {
file.transferTo(targetFile);
} catch (Exception e) {
e.printStackTrace();
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
	}

}
package com.action;

//定义为控制器
@Controller
// 设置路径
@RequestMapping(value = "/users" , produces = "text/plain;charset=utf-8")
public class UsersAction extends BaseAction {
// 注入Service 由于标签的存在 所以不需要getter setter
@Autowired
@Resource
private UsersService usersService;

// 准备添加数据
@RequestMapping("createUsers.action")
public String createUsers() {
return "admin/addusers";
}
// 添加数据
@RequestMapping("addUsers.action")
public String addUsers(Users users) {
users.setRegdate(VeDate.getStringDateShort());
this.usersService.insertUsers(users);
return "redirect:/users/createUsers.action";
}

// 通过主键删除数据
@RequestMapping("deleteUsers.action")
public String deleteUsers(String id) {
this.usersService.deleteUsers(id);
return "redirect:/users/getAllUsers.action";
}

// 批量删除数据
@RequestMapping("deleteUsersByIds.action")
public String deleteUsersByIds() {
String[] ids = this.getRequest().getParameterValues("usersid");
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
	} else {
buffer.append("<a href=\"index/cate.action?number=" + (maxPage - 1) + "&id=\" + id+ \"\">尾页</a>");
}
html = buffer.toString();
this.getRequest().setAttribute("html", html);
this.getRequest().setAttribute("flimList", flimList);
return "users/list";
}

// 推荐产品
@RequestMapping("recommend.action")
public String recommend(String number) {
this.front();
Jiancai goods = new Jiancai();
goods.setRecommend("是");
List<Jiancai> flimList = new ArrayList<Jiancai>();
List<Jiancai> tempList = this.jiancaiService.getJiancaiByCond(goods);
int pageNumber = tempList.size();
int maxPage = pageNumber;
if (maxPage % 12 == 0) {
maxPage = maxPage / 12;
} else {
maxPage = maxPage / 12 + 1;
}
if (number == null) {
number = "0";
}
int start = Integer.parseInt(number) * 12;
int over = (Integer.parseInt(number) + 1) * 12;
int count = pageNumber - over;
if (count <= 0) {
over = pageNumber;
}
for (int i = start; i < over; i++) {
Jiancai x = tempList.get(i);
flimList.add(x);
}
String html = "";
StringBuffer buffer = new StringBuffer();
buffer.append("&nbsp;&nbsp;共为");
buffer.append(maxPage);
buffer.append("页&nbsp; 共有");
buffer.append(pageNumber);
buffer.append("条&nbsp; 当前为第");
buffer.append((Integer.parseInt(number) + 1));
buffer.append("页 &nbsp;");
if ((Integer.parseInt(number) + 1) == 1) {
buffer.append("首页");
} else {
buffer.append("<a href=\"index/recommend.action?number=0\">首页</a>");


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