基于javaweb的JSP+Servletcrm客户关系管理系统(java+layui+echarts+jsp+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

090023402402

100023402402

110023402402

120023402402

130023402402

140023402402

基于javaweb的JSP+Servletcrm客户关系管理系统(java+layui+echarts+jsp+mysql)

功能介绍

该项目未使用spring框架,实现了用户登录,权限控制,数据统计,以及市场活动、线索、客户、联系人、交易管理的CRUD, 使用Proxy实现Service层的动态代理,实现DAO层事务控制,有助于深入理解web项目。管理员还包含系统设置:用户管理、角色管理、 权限管理;其中角色管理可以设置总经理、副总经理、销售经理、综合事务等角色的权限菜单。

环境需要

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

技术栈

  1. 后端:Servlet+Mybatis 2. 前端:Layui+jquery+echarts+JSP

使用说明

  1. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,下载所需jar包; 2. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 3. 将项目中db.properties配置文件中的数据库配置改为自己的配置 4. 配置tomcat,然后运行项目,输入localhost:8080/xxx 登录 5. 管理员账户: admin 密码:123456 普通员工账户:zs 密码:123

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


public class CustomerController extends HttpServlet {
private CustomerService customerService = null;
@Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String path = request.getServletPath();
if("/controller/getCustomer".equals(path)){
getCustomer(request,response);
}else if("/controller/addCustomer".equals(path)){
addCustomer(request,response);
}else if("/controller/detailCustomer".equals(path)){
detailCustomer(request,response);
}else if("/controller/updateCustomer".equals(path)){
updateCustomer(request,response);
}else if("/controller/deleteCustomer".equals(path)){
deleteCustomer(request,response);
}else if("/controller/deleteCustomers".equals(path)){
deleteCustomers(request,response);
}else if("/controller/getCustomerName".equals(path)){
getCustomerName(request,response);
}else if("/controller/getCustomerByName".equals(path)){
getCustomerByName(request,response);
}
}

private void getCustomerByName(HttpServletRequest request, HttpServletResponse response) throws IOException {
System.out.println("进入获取客户名称getCustomerByName");
String name = request.getParameter("keywords");
List<Customer> customerList = null;
if(name!=null&&!"".equals(name)){
customerService = (CustomerService) ServiceFactory.getService(new CustomerServiceImpl());
customerList = customerService.getCustomerByName(name);
}
Map<String,Object> map = new HashMap<>();
map.put("code",0);
map.put("content",customerList);
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
       } else if("/controller/detailClue".equals(path)){
clueDetail(request,response);
} else if("/controller/removeClueActivity".equals(path)){
removeClueActivity(request,response);
} else if("/controller/addClueActivity".equals(path)){
addClueActivity(request,response);
} else if("/controller/getClueByIdAndUser".equals(path)){
getClueByIdAndUser(request,response);
} else if("/controller/updateClue".equals(path)){
updateClue(request,response);
} else if("/controller/deleteClue".equals(path)){
deleteClue(request,response);
} else if("/controller/deleteClues".equals(path)){
deleteClues(request,response);
} else if("/controller/convert".equals(path)){
convert(request,response);
}
}

private void convert(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("进入线索转换convert...");
clueService = (ClueService) ServiceFactory.getService(new ClueServiceImpl());
String clueId = request.getParameter("clueId");
String isCreateTran = request.getParameter("isCreateTran");
String createBy = ((User)request.getSession().getAttribute("user")).getName();
Tran tran = null;
if("yes".equals(isCreateTran)){
String id = IdUtil.simpleUUID();
String name = request.getParameter("name");
String money = request.getParameter("money");
String expectedDate = request.getParameter("expectedDate");
String stage = request.getParameter("stage");
String activityId = request.getParameter("activityId");
String createTime = DateUtil.now();
tran = new Tran();
tran.setId(id);
tran.setName(name);
tran.setMoney(money);
tran.setExpectedDate(expectedDate);
tran.setStage(stage);
tran.setActivityId(activityId);
tran.setCreateBy(createBy);
tran.setCreateTime(createTime);
}
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
        activityService = (ActivityService) ServiceFactory.getService(new ActivityServiceImpl());
String owner = request.getParameter("owner");
String name = request.getParameter("name");
String startDate = request.getParameter("startDate");
String endDate = request.getParameter("endDate");
int page = Integer.parseInt(request.getParameter("page"));
int limit = Integer.parseInt(request.getParameter("limit"));
int pageNumber = (page-1)*limit;
int pageSize = limit;
Map<String,Object> data = new HashMap<>();
data.put("owner",owner);
data.put("name",name);
data.put("startDate",startDate);
data.put("endDate",endDate);
data.put("pageNumber",pageNumber);
data.put("pageSize",pageSize);
PageVO<Activity> vo = activityService.getActivity(data);
Map<String,Object> map = new HashMap<>();
map.put("code",0);
map.put("message","请求成功");
map.put("count",vo.getTotal());
map.put("data",vo.getDatas());

JSONUtil.getJSON(response,map);
}

}
package com.crsbg.controller;


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
        contacts.setCreateBy(createBy);
contacts.setCreateTime(createTime);
contactsService = (ContactsService)ServiceFactory.getService(new ContactsServiceImpl());
boolean flag = contactsService.addContacts(contacts);
response.getWriter().print(flag);
}

private void getContacts(HttpServletRequest request, HttpServletResponse response) throws IOException {
System.out.println("进入查询联系人getContacts...");
String fullname = request.getParameter("fullname");
String company = request.getParameter("company");
int page = Integer.parseInt(request.getParameter("page"));
int limit = Integer.parseInt(request.getParameter("limit"));
int pageNumber = (page-1)*limit;
int pageSize = limit;
Map<String,Object> param = new HashMap<>();
param.put("fullname",fullname);
param.put("company",company);
param.put("pageNumber",pageNumber);
param.put("pageSize",pageSize);
contactsService = (ContactsService)ServiceFactory.getService(new ContactsServiceImpl());
PageVO<Contacts> vo = contactsService.getContacts(param);
Map<String,Object> map = new HashMap<>();
map.put("code",0);
map.put("message","请求成功");
map.put("count",vo.getTotal());
map.put("data",vo.getDatas());

JSONUtil.getJSON(response,map);
}

}
package com.crsbg.controller;


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
51
52
53
54
    clue.setCompany(company);
clue.setJob(job);
clue.setEmail(email);
clue.setTel(tel);
clue.setWebsite(website);
clue.setPhone(phone);
clue.setState(state);
clue.setSource(source);
clue.setEditBy(editBy);
clue.setEditTime(editTime);
clue.setDescription(description);
clue.setContactSummary(contactSummary);
clue.setNextContactDate(nextContactDate);
clue.setAddress(address);
boolean flag = clueService.updateClue(clue);
response.getWriter().print(flag);
}

private void getClueByIdAndUser(HttpServletRequest request, HttpServletResponse response) throws IOException {
System.out.println("进入查询线索和用户getClueByIdAndUser...");
String id = request.getParameter("id");
clueService = (ClueService) ServiceFactory.getService(new ClueServiceImpl());
Map map = clueService.getClueByIdAndUser(id);
JSONUtil.getJSON(response, map);
}

private void removeClueActivity(HttpServletRequest request, HttpServletResponse response) throws IOException {
System.out.println("进入解除线索和市场活动关系removeClueActivity...");
String id = request.getParameter("id");
clueService = (ClueService) ServiceFactory.getService(new ClueServiceImpl());
boolean flag = clueService.removeClueActivity(id);
response.getWriter().print(flag);
}

private void addClueActivity(HttpServletRequest request, HttpServletResponse response) throws IOException {
System.out.println("进入添加线索和市场活动关系addClueActivity...");
String clueId = request.getParameter("cid");
String[] activityIds = request.getParameterValues("aid");
clueService = (ClueService) ServiceFactory.getService(new ClueServiceImpl());
boolean flag = clueService.addClueActivity(clueId,activityIds);
response.getWriter().print(flag);
}

private void clueDetail(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
System.out.println("进入查询线索详细信息detailClue...");
clueService = (ClueService) ServiceFactory.getService(new ClueServiceImpl());
String id = request.getParameter("id");
Clue clue = clueService.detailClue(id);
request.setAttribute("clue",clue);
request.getRequestDispatcher("/pages/clue-detail.jsp").forward(request,response);
}

private void addClue(HttpServletRequest request, HttpServletResponse response) throws IOException {
System.out.println("进入addClue...");


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