基于javaweb的SpringBootcrm客户关系管理系统(java+springboot+echarts+freemarker+layui+maven+mysql)

运行环境

Java≥8、MySQL≥5.7

开发工具

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

适用

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

功能说明

360023182402

370023182402

380023182402

390023182402

400023182402

420023182402

基于javaweb的SpringBootcrm客户关系管理系统(java+springboot+echarts+freemarker+layui+maven+mysql)

CRM智能办公

项目介绍

本应用是一个客户关系管理系统,主要包括五大模块,分别是营销管理,客户管理,服务管理,统计报表和系统管理,为客户关系管理提供简单的数据管理与分析

技术选型方面,该项目是一个SpringBoot的单体应用,项目使用SpringBoot2框架快速开发,数据访问层使用Mybatis框架,页面渲染引擎使用Freemarker,页面样式使用Layui,日志方面选用的是logback,统计报表部分使用的是ECharts,数据库使用的Mysql 8.0版本;  

安装教程

  1.  在mysql(默认为mysql8)中创建名为crm的数据库,并执行源码根目录的crm.sql脚本生成数据库表以及数据 2.  将项目源码导入idea中,指定项目的jdk版本为jdk8或以上,并标记为maven项目,下载所需依赖 3.  修改application.yml中针对于数据库的配置(主要是数据库名和数据库密码) 4.  修改logback.xml中,第4行,日志文件的存储地址,改为自己的路径;

  2. 启动项目测试是否正常,默认启动地址首页为http://localhost:1212/crm,默认数据库中的管理员为admin,密码为123456,可在登录系统之后自行修改用户密码

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

/**
* 跳转至销售机会首页
* @return
*/
@GetMapping("/index")
public String SaleChance() {
return "saleChance/saleChance";
}

/**
* 跳转到销售机会新增,更新页面
* @param id 为null表示跳转到新增页面,不为null表示跳转到更新页面
* @return
*/
@GetMapping("/toSaleChance")
public String toSaleChance(@Nullable Integer id, Model model) {
if (id != null) {
// 访问修改页面
SaleChance saleChance = saleChanceService.selectByPrimaryKey(id);
model.addAttribute("saleChance", saleChance);
}
return "saleChance/addAndUpdate";
}

@PostMapping("/addSaleChance")
@ResponseBody
public ResultInfo doAddSaleChance(HttpServletRequest request, SaleChance saleChance) {
String userName = CookieUtil.getCookieValue(request, "userName");
// 设置创建人
saleChance.setCreateMan(userName);
saleChanceService.addSaleChance(saleChance);
resultInfo.setAll(200,"新增销售机会记录成功",null);
return resultInfo;
}

@PostMapping("/updateSaleChance")
@ResponseBody
public ResultInfo doUpdateSaleChance(SaleChance saleChance) {
// 设置创建人
saleChanceService.updateSaleChance(saleChance);
resultInfo.setAll(200,"修改销售机会记录成功",null);
return resultInfo;
}

/**
* 获取指派人信息,id和userName
* @return
*/
@PostMapping("/getAssignMan")
@ResponseBody
public ResultInfo getAssignMan() {
List<Map<String, Object>> assignMans = saleChanceService.getAssignMan();
logger.info("assignMans={}",assignMans);
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
        return resultInfo;
}

@PostMapping("/updateDevResult")
@ResponseBody
public ResultInfo updateDevResult(@RequestParam("id") Integer id,@RequestParam("devResult") String devResult) {
saleChanceService.updateDevResult(id, devResult);
resultInfo.setAll(200, "修改开发状态成功", null);
return resultInfo;
}

/**
* 跳转到新增或修改页面
* @param id
* @return
*/
@GetMapping("/toAddAndUpdatePage")
public String toAddAndUpdatePage(@RequestParam("saleChanceId") Integer saleChanceId,@Nullable Integer id , Model model) {
// 封装销售机会id
model.addAttribute("saleChanceId", saleChanceId);
// 如果id不为空,则表示需要跳转到计划向修改页面
if (id != null) {
CusDevPlan cusDevPlan = cusDevPlanService.selectByPrimaryKey(id);
AssertUtil.isTrue(cusDevPlan == null, "查询的计划项数据不存在");
model.addAttribute("cusDevPlan", cusDevPlan);
}
return "cusDevPlan/addAndUpdate";
}

}
package com.wuhunyu;

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
    return userService.selectByParams(userQuery);
}

/**
* 跳转到用户管理首页
* @return
*/
@GetMapping("/index")
public String index() {
return "user/user";
}

/**
* 跳转到用户管理新增/修改页面
* @param id
* @return
*/
@GetMapping("/toAddUserPage")
public String toAddUserPage(@Nullable Integer id, Model model) {
// id不为null表示访问的是修改页面
if (id != null) {
model.addAttribute("userModel",userService.selectByPrimaryKey(id));
}
return "user/addAndUpdateUser";
}

/**
* 新增用户
* @param user
* @param roleIds
* @return
*/
@PostMapping("/addUser")
@ResponseBody
public ResultInfo addUser(User user, @RequestParam("roleIds") Integer[] roleIds) {
userService.addUser(user, roleIds);
resultInfo.setAll(200, "新增用户成功", null);
return resultInfo;
}

/**
* 修改用户信息
* @param user
* @param roleIds
* @return
*/
@PostMapping("/updateUser")
@ResponseBody
public ResultInfo updateUser(User user, @RequestParam("roleIds") Integer[] roleIds) {
userService.updateUser(user, roleIds);
resultInfo.setAll(200, "修改用户成功", null);
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

/**
* 跳转到客户订单详情页面
* @param customerId
* @return
*/
@GetMapping("/toCustomerOrderPage")
public String toCustomerOrderPage(@RequestParam("customerId") Integer customerId,Model model) {
// 校验参数
AssertUtil.isTrue(customerId == null, "客户id不能为空");
// 封装客户信息
Customer customer = customerService.selectByPrimaryKey(customerId);
AssertUtil.isTrue(customer == null, "查询客户信息失败");
model.addAttribute("customer", customer);
return "customerOrder/customerOrder";
}

}
package com.wuhunyu.controller;


/**
* 角色处理控制器层
*
* @version 1.0
*/
@Controller
@RequestMapping("/role")
public class RoleController extends BaseController {

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
		if (cookie != null) {
try {
return URLDecoder.decode(cookie.getValue(), "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
return null;
}

/**
* 清除cookie
* @param cookieName
* @param request
* @param response
*/
public static void deleteCookie(String cookieName, HttpServletRequest request,
HttpServletResponse response) {
Cookie[] arr_cookie = request.getCookies();
if (arr_cookie != null && arr_cookie.length > 0) {
for (Cookie cookie : arr_cookie) {
if (cookie.getName().equals(cookieName)) {
cookie.setValue("");
cookie.setMaxAge(0);
cookie.setPath("/");
response.addCookie(cookie);
}
}
}
}
}
package com.wuhunyu.controller;


/**
* 客户贡献统计控制器
*


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