基于javaweb的客户关系管理系统(java+ssm+layui+shiro+redis+mysql)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+SSM的客户关系管理系统(java+SSM+Layui+Shiro+Redis+mysql)
项目介绍
客户关系管理系统主要功能包括:
系统管理: 用户管理 日志管理 权限管理 角色管理 系统信息 客户管理 我的客户 联系跟进 客户流失 销售机会 客户服务 我的服务 服务统计 客户关怀 统计 个人中心
环境需要
1.运行环境:最好是javajdk1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat7.x,8.x,9.x版本均可 4.硬件环境:windows7/8/101G内存以上;或者MacOS; 5.是否Maven项目:是;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目 6.数据库:MySql5.7版本;
系统框架
spring框架 springmvc框架 mybatis框架 Logback日志框架 安全验证框架 maven框架 layui前端框架 shiro安全框架 系统关键性技术 基于角色的权限访问控制RBCA(Role-BasedAccessControl) Spring+Springmvc+Mybatis三大框架 Ajax技术 springmvc文件上传 shiro安全框架 Redis缓存 JavaMail邮件 基于aop切面的日志管理 Layui前端框架 登录验证码 富文本输入框 md5加密加盐
使用说明
1.使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件,sql文件命名为crm2.sql,其中‘user’表为账户表; 2.部署项目前,需要配置好MqSQL数据库,Redis数据库、mail邮箱,这三个配置文件都在crm/src/main/resources/properties 3.使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行mavenclean;maveninstall命令,配置tomcat,然后运行; 4.项目登录帐号:malizhi(管理员级别),密码123456,部署项目后,可以到测试类中(test包下的TestUserService)进行添加账户,密码经过md5加密加盐 5.登录页:如果是本地部署http://localhost:8080/crm2/pages/login.jsp,端口号以及项目名要与部署的环境一致 6.订单可以在客户流失(客户是否流失由Spring定时器定时检测)模块中,点击客户详情,可以查看到此客户的历史订单,关于订单的数据问题,因为在企业模式中,订单数据是从销售系统中获取的,但由于没有外接销售系统,所以订单数据以及产品定价的数据是自个插入数据库的。
部署过程异常错误解决方法
1.权限,菜单都会缓存到redis中,如果redis无法连接,将会报空指针错误或登陆后首页会显示404,请确保能连接上redis数据库 2.如果有报此异常org/hyperic/sigar/SigarException,可以将WEB-INF/lib下的文件(根据你的系统以及位数选择)放在你的JDK/bin目录下 3.在发布出来前,由于隐私关系删除了部分登录帐号(客户经理),如果出现此客户找不到对应的客户经理,删掉此客户即可
客户管理控制层:
@Controller
@RequestMapping(“/customer”)
public class CustomerController extends AuthorizedController {
@Autowired
private CustomerService customerService;
@RequestMapping(value = “”, method = RequestMethod.GET)
public String customer() {
return “crm/customer”;
@RequestMapping(value = “/find”, method = RequestMethod.POST)
@ResponseBody
public PageInfo find(@RequestBody QueryCustomerVo vo) {
return customerService.find(vo);
@RequestMapping(value = “/findAllCustomerCategory”, method = RequestMethod.POST)
@ResponseBody
public List findAllCustomerCategory() {
return customerService.findAllCustomerCategory();
@RequestMapping(value = “/findAllIndustry”, method = RequestMethod.POST)
@ResponseBody
public List findAllIndustry() {
return customerService.findAllIndustry();
@RequestMapping(value = “/findAllSource”, method = RequestMethod.POST)
@ResponseBody
public List findAllSource() {
return customerService.findAllSource();
@RequestMapping(value = “/add”, method = RequestMethod.POST)
@ResponseBody
public Result add(@RequestBody Customer customer) {
customer.setCreateBy(getUser().getUserId());
return customerService.insert(customer);
@RequestMapping(value = “/checkCustomerName”, method = RequestMethod.POST)
@ResponseBody
public Result checkCustomerName(@RequestBody Customer customer) {
return customerService.checkCustomerName(customer);
@RequestMapping(value = “/findById”, method = RequestMethod.POST)
@ResponseBody
public Customer findById(@RequestBody Customer customer) {
return customerService.findById(customer.getCustomerId());
@RequestMapping(value = “/update”, method = RequestMethod.POST)
@ResponseBody
public Result update(@RequestBody Customer customer) {
return customerService.update(customer);
@RequestMapping(value = “/dashboard/{customerId}”, method = RequestMethod.GET)
public ModelAndView dashboard(@PathVariable int customerId) {
ModelAndView vm = new ModelAndView(“crm/customerDashboard”);
vm.addObject(“customerId”, customerId);
return vm;
@RequestMapping(value = “/updateStar”, method = RequestMethod.POST)
@ResponseBody
public Result updateStar(@RequestBody Customer customer) {
return customerService.updateStar(customer);
@RequestMapping(value = “/updateLocation”, method = RequestMethod.POST)
@ResponseBody
public Result updateLocation(@RequestBody Customer customer) {
return customerService.updateLocation(customer);
用户管理控制层:
@Controller
@RequestMapping(“/user”)
public class UserController extends AuthorizedController {
@Autowired
private UserService userService;
@Autowired
private HttpSession session;
@RequestMapping(value = “”, method = RequestMethod.GET)
public String index() {
return “sys/user”;
@RequestMapping(value = “/find”, method = RequestMethod.POST)
@ResponseBody
public PageInfo find(@RequestBody QueryUserVo vo) {
return userService.find(vo);
@RequestMapping(value = “/add”, method = RequestMethod.POST)
@ResponseBody
public Result add(@RequestBody User user) {
return userService.insert(user);
@RequestMapping(value = “/remove”, method = RequestMethod.POST)
@ResponseBody
public Result delete(@RequestBody List ids) {
return userService.deleteByIds(ids);
@RequestMapping(value = “/findById”, method = RequestMethod.POST)
@ResponseBody
public User findById(@RequestBody User user) {
return userService.findById(user.getUserId());
@RequestMapping(value = “/update”, method = RequestMethod.POST)
@ResponseBody
public Result update(@RequestBody User user) {
Result result = userService.update(user);
if (result.isSuccess() && user.getUserId() == getUser().getUserId()) {
session.setAttribute(“User”, userService.findById(getUser().getUserId()));
return result;
@RequestMapping(value = “/updateStatus”, method = RequestMethod.POST)
@ResponseBody
public Result updateStatus(@RequestBody User user) {
return userService.updateStatus(user);
@RequestMapping(value = “/checkUserName”, method = RequestMethod.POST)
@ResponseBody
public Result checkUserName(@RequestBody User user) {
return userService.checkUserName(user);
@RequestMapping(value = “/resetPassword”, method = RequestMethod.POST)
@ResponseBody
public Result resetPassword(@RequestBody User user) {
return userService.resetPassword(user);
@RequestMapping(value = “/profile”, method = RequestMethod.GET)
public String profile() {
return “sys/profile”;
@RequestMapping(value = “/updatePassword”, method = RequestMethod.POST)
@ResponseBody
public Result updatePassword(@RequestBody UpdatePasswordVo vo) {
return userService.updatePassword(vo);
角色管理控制层:
@Controller
@RequestMapping(“/role”)
public class RoleController extends AuthorizedController {
@Autowired
private RoleService roleService;
@RequestMapping(value = “”, method = RequestMethod.GET)
public String index() {
return “sys/role”;
@RequestMapping(value = “/findAll”, method = RequestMethod.POST)
@ResponseBody
public List findAll() {
return roleService.findAll();
@RequestMapping(value = “/checkRoleName”, method = RequestMethod.POST)
@ResponseBody
public Result existRoleName(@RequestBody Role role) {
return roleService.checkRoleName(role);
@RequestMapping(value = “/add”, method = RequestMethod.POST)
@ResponseBody
public Result add(@RequestBody Role role) {
return roleService.insert(role);
@RequestMapping(value = “/remove”, method = RequestMethod.POST)
@ResponseBody
public Result delete(@RequestBody List ids) {
return roleService.deleteByIds(ids);
@RequestMapping(value = “/findById”, method = RequestMethod.POST)
@ResponseBody
public Role findById(@RequestBody Role role) {
return roleService.findById(role.getRoleId());
@RequestMapping(value = “/update”, method = RequestMethod.POST)
@ResponseBody
public Result update(@RequestBody Role role) {
return roleService.update(role);
@RequestMapping(value = “/user/{roleId}”, method = RequestMethod.GET)
public ModelAndView roleUser(@PathVariable int roleId) {
ModelAndView vm = new ModelAndView(“sys/roleUser”);
vm.addObject(“roleId”, roleId);
return vm;
@RequestMapping(value = “/user/findUserInRole”, method = RequestMethod.POST)
@ResponseBody
public PageInfo findUserInRole(@RequestBody QueryRoleUserVo vo) {
return roleService.findUserInRole(vo);
@RequestMapping(value = “/user/remove”, method = RequestMethod.POST)
@ResponseBody
public Result deleteRoleUser(@RequestBody RoleUser roleUser) {
return roleService.deleteRoleUser(roleUser);
@RequestMapping(value = “/user/findUserNotInRole”, method = RequestMethod.POST)
@ResponseBody
public PageInfo findUserNotInRole(@RequestBody QueryRoleUserVo vo) {
return roleService.findUserNotInRole(vo);
@RequestMapping(value = “/user/add”, method = RequestMethod.POST)
@ResponseBody
public Result addRoleUser(@RequestBody RoleUser roleUser) {
return roleService.insertRoleUser(roleUser);
@RequestMapping(value = “/menu/{roleId}”, method = RequestMethod.GET)
public ModelAndView roleMenu(@PathVariable Integer roleId) {
ModelAndView mv = new ModelAndView(“sys/roleMenu”);
mv.addObject(“roleId”, roleId);
return mv;
@RequestMapping(value = “/menu/saveMenu”, method = RequestMethod.POST)
@ResponseBody
public Result saveMenu(@RequestBody Map map) {
return roleService.saveRoleMenu((Integer) map.get(“roleId”), (List) map.get(“menuIdList”));
@RequestMapping(value = “/fun/{roleId}”, method = RequestMethod.GET)
public ModelAndView roleFun(@PathVariable int roleId) {
ModelAndView vm = new ModelAndView(“sys/roleFun”);
vm.addObject(“roleId”, roleId);
return vm;