基于javaweb的SpringBoot客户关系管理系统(java+springboot+layui+html+maven+mysql)

运行环境

Java≥8、MySQL≥5.7

开发工具

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

适用

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

功能说明

300023252402

310023252402

320023252402

330023252402

340023252402

350023252402

基于javaweb的SpringBoot客户关系管理系统(java+springboot+layui+html+maven+mysql)

项目介绍

CRM客户关系管理系统。本系统共分为三种角色:超级管理员、经理、销售人员; 超级管理员的功能主要有: 公司资料:部门结构、销售目录; 人员资料:销售人员、账号权限; 客户资料:客户列表; 销售跟踪:订单列表、报表统计;

图表分析:销售与客户分析、销售失败分析;

环境需要

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

技术栈

  1. 后端:SpringBoot; 2. 前端:layui+html

使用说明
运行项目,输入localhost:8080 登录 5. 管理员账户:superAdmin  密码123456 经理账户:user 密码:123456

6.销售人员账户:laji_ma  密码: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


@RestController
@RequestMapping("/copDepartment")
public class CopDepartmentController {

@Autowired
private CopDepartmentService copDepartmentService;

@PostMapping
@ApiOperation(value = "插入")
public ResultDTO insertOne(CopDepartment copDepartment) throws Exception {
copDepartmentService.save(copDepartment);
return ResultUtil.Success(copDepartment);
}

@PutMapping
@ApiOperation(value = "按ID修改")
public ResultDTO updateById(@RequestBody CopDepartment copDepartment) throws Exception {
copDepartmentService.updateById(copDepartment);
return ResultUtil.Success();
}

@DeleteMapping("/{id:\\d+}")
@ApiOperation("按iD删除")
public ResultDTO deleteById(@PathVariable Long id) throws Exception {
copDepartmentService.removeById((long) id);
return ResultUtil.Success();
}


@GetMapping("/list")
@ApiOperation("条件查询、分页返回")
public ResultDTO selectEntityPage(@RequestParam(value = "page", defaultValue = "0") int pageNum,
@RequestParam(value = "limit", defaultValue = "8") int pageSize)throws Exception{
IPage<CopDepartment> page = copDepartmentService.page(new Page<CopDepartment>(pageNum, pageSize));
List<CopDepartment> departments = page.getRecords();
for (CopDepartment department : departments) {
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


/**
**/
@Component
@Slf4j
public class AuthenticationSuccessHandler extends SavedRequestAwareAuthenticationSuccessHandler {

@Autowired
private ObjectMapper objectMapper;
@Autowired
private AuthUserService authUserService;
@Autowired
private AuthUserMapper authUserMapper;

@Override
public void onAuthenticationSuccess(HttpServletRequest request,
HttpServletResponse response,
Authentication authentication) throws IOException, ServletException {

log.info("登录成功!");
response.setStatus(HttpStatus.OK.value());
response.setContentType("application/json;charset=UTF-8");
AuthUser user = new AuthUser();
try {
user = authUserService.getUserDetails(authentication);
} catch (Exception e) {
e.printStackTrace();
}
UserDTO userDTO = authUserMapper.findAuthorityInfo(user.getUserName()).get(0);
userDTO.setUserPassword(null);
response.getWriter().write(objectMapper.writeValueAsString(userDTO));

}
}
package sch.guo.crmsys.auth.rbac;

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


@RestController
@RequestMapping("/authUser")
public class AuthUserController {

@Autowired
private AuthUserService authUserService;
@Autowired
private AuthTableService tableService;
@Autowired
private static PasswordEncoder passwordEncoder;

@GetMapping("/info")
@ApiOperation(value = "查询登录后用户信息")
public ResultDTO getUserDetail(Authentication authentication) throws Exception {
if (authentication == null) {
throw new RuntimeException("未登录!");
}
return ResultUtil.Success(authUserService.getUserDetails(authentication));
}

@PostMapping("/admin/{roleId}")
@ApiOperation(value = "用户注册(2.高级负责人 3.销售人员)")
public ResultDTO insertAdmin(@RequestBody @Valid AuthUser authUser
,@PathVariable Long roleId,Authentication authentication,
BindingResult bindingResult) throws Exception {
if (roleId == 1) {
throw new RuntimeException("非法角色");
}
if (bindingResult.hasErrors()) {
return ResultUtil.Error(AccountEnum.Error.getCode().toString(),
bindingResult.getFieldError().getDefaultMessage());
}
/*
设置所属
*/
AuthUser controlUser = authUserService.getUserDetails(authentication);
if (controlUser == null) {
throw new RuntimeException("未登录");
}
if (controlUser.getUserGroup().equals(0L)) {
authUser.setUserGroup(1L);
}else {
authUser.setUserGroup(controlUser.getUserId());
}
/*
设置部门
*/
if (controlUser.getUserDepartment().equals(0L)) {
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

/**
*
*/
@RestController
@RequestMapping("/authPower")
public class AuthPowerController {

@Autowired
private AuthPowerService authPowerService;



@GetMapping("/page")
@ApiOperation("分页返回")
public IPage<AuthPower> selectEntityPage(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
@RequestParam(value = "pageSize", defaultValue = "8") int pageSize)throws Exception{
return authPowerService.page(new Page<AuthPower>(pageNum, pageSize));
}

@GetMapping("/list")
@ApiOperation("不分页返回")
public ResultDTO selectEntityPage()throws Exception{
return ResultUtil.Success(authPowerService.list());
}


}
package sch.guo.crmsys.auth;

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
        return ResultUtil.Success(authRoleService.list());
}

/*
{"children": [{"id": 5},{"id": 4}],"id": 3}
*/
@ApiOperation(value="更改角色权限关系")
@PutMapping("/rolePowerTable")
public ResultDTO updateTable(@RequestBody RoleDTO roleDto) throws Exception {
String type = StringUtils.substringBefore(roleDto.getClass().getSimpleName().toLowerCase() ,"dto");
tableService.updateTable(roleDto,type);
return ResultUtil.Success();
}

}
package sch.guo.crmsys.controller.cop;




@RestController
@RequestMapping("/copDepartment")
public class CopDepartmentController {

@Autowired
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
         */
if (principal instanceof UserDetails) {
userName = ((UserDetails) principal).getUsername();
}else if (principal instanceof String) {
userName = (String) principal;
}else{
return false;
}

if (StringUtils.equals("anonymousUser", userName)) {
return false;
}

//读取用户所拥有的权限
Set<String> urls = userService.findAuthority(userName);

for (String url : urls) {
if (pathMatcher.match(url, request.getServletPath())) {
hasPermission = true;
break;
}
}
return hasPermission;

}
}
package sch.guo.crmsys.base.exception;






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