作者主页:源码空间站2022
简介:Java领域优质创作者、Java项目、学习资料、技术互助
文末获取源码
客户关系管理系统主要功能包括:
系统管理:
用户管理
日志管理
权限管理
角色管理
系统信息
客户管理
我的客户
联系跟进
客户流失
销售机会
客户服务
我的服务
服务统计
客户关怀
统计
个人中心
由于本程序规模不大,可供课程设计,毕业设计学习演示之用
更多项目源码,请到“源码空间站”,地址:http://www.shuyue.fun/
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版本;
spring框架
springmvc框架
mybatis框架
Logback日志框架
安全验证框架
maven框架
layui前端框架
shiro安全框架
基于角色的权限访问控制RBCA(Role-Based Access Control)
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项目,导入成功后请执行maven clean;maven install命令,配置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.在发布出来前,由于隐私关系删除了部分登录帐号(客户经理),如果出现此客户找不到对应的客户经理,删掉此客户即可







- /**
- *
- */
- package com.neuedu.crm.controller;
-
-
- import java.time.LocalDate;
- import java.time.LocalDateTime;
- import java.time.temporal.ChronoUnit;
- import java.util.HashMap;
- import java.util.Iterator;
- import java.util.List;
- import java.util.Map;
-
- import javax.servlet.http.HttpServletRequest;
-
- import org.apache.shiro.authz.annotation.RequiresPermissions;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.ResponseBody;
-
- import com.neuedu.crm.pojo.CustomerCare;
- import com.neuedu.crm.pojo.CustomerCareExample;
-
- import com.neuedu.crm.pojo.Linkman;
- import com.neuedu.crm.pojo.User;
- import com.neuedu.crm.service.ICustomerCareService;
- import com.neuedu.crm.service.ICustomerService;
- import com.neuedu.crm.service.ILinkmanService;
- import com.neuedu.crm.utils.Operation;
-
- /**
- * @author wanghaoyu
- *
- */
- @Controller
- @RequestMapping("/customerCare")
- public class CustomerCareController {
-
- Logger logger = LoggerFactory.getLogger(CustomerCareController.class);
-
- @Autowired
- ICustomerService customerService;
-
- @Autowired
- ILinkmanService linkmanService;
-
- @Autowired
- ICustomerCareService customerCareService;
-
- @Operation(name="查找客户关怀")
- @RequiresPermissions("19001")
- @RequestMapping("/findCustomerCare")
- @ResponseBody
- public Map
findCustomerCare(HttpServletRequest request, Integer day){ - Map
map = new HashMap(26); - //从session域中获取当前用户
- User user = (User) request.getSession().getAttribute("user");
- List
customerCares = null; - //根据当前客户经理的编号查找联系人
- if(user.getRoleId() == 1) {
- customerCares = customerCareService.selectCustomerCareByManagerId(user.getId());
- }else {
- customerCares = customerCareService.selectCustomerCareByManagerId(null);
- }
-
-
- LocalDate now = LocalDate.now();
- Iterator
it = customerCares.iterator(); - //再根据天数内来筛选要显示的数据
- while(it.hasNext()){
- LocalDate dateOfBirthday = it.next().getBirthday();
- //把生日的年份换成今年,以方便计算天数
- LocalDate birthday = LocalDate.of(now.getYear(), dateOfBirthday.getMonth(), dateOfBirthday.getDayOfMonth());
- //计算生日离今天还有多少天
- long betweenDays = now.until(birthday, ChronoUnit.DAYS);
- //判断是不是在天数以内
- if( !(betweenDays >= 0 && betweenDays <= day)){
- //移除掉不符合的联系人
- it.remove();
- }
- }
- map.put("data", customerCares);
- map.put("msg", "success");
- map.put("code", 0);
- return map;
- }
-
- /**
- *
- * 描述:根据联系人id查找联系生日等信息
- * @author wanghaoyu
- * @version 1.0
- * @param id
- * @return Map
- * @exception Nothing
- * @since 1.8
- *
- */
- @Operation(name="根据联系人id查找联系生日等信息")
- @RequestMapping("/findLinkmanBirthdayInfoById")
- @ResponseBody
- public Map
findLinkmanBirthdayInfoById(Integer id){ -
- Map
map = new HashMap(16); - boolean success = false;
- Linkman linkman = null;
-
- try {
- linkman = linkmanService.selectLinkmanByPrimaryKey(id);
- //计算年龄差
- long age = linkman.getBirthday().until(LocalDate.now()).getYears();
- linkman.setAge((int)age);
- success = true;
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- map.put("linkman", linkman);
- map.put("success", success);
- map.put("code", 0);
-
- return map;
- }
-
- /**
- *
- * 描述:添加客户关怀信息
- * @author wanghaoyu
- * @version 1.0
- * @param request
- * @param customerCare
- * @return Map
- * @exception Nothing
- * @since 1.8
- *
- */
- @Operation(name="添加客户关怀")
- @RequestMapping("/addCustomerCare")
- @ResponseBody
- public Map
addCustomerCare(HttpServletRequest request , CustomerCare customerCare){ -
- Map
map = new HashMap(16); - boolean success = false;
-
- try {
- User user = (User) request.getSession().getAttribute("user");
- //对数据进行二次封装
- customerCare.setManagerId(user.getId());
- if(customerCareService.insertCustomerCare(customerCare)) {
- success = true;
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- map.put("success", success);
- map.put("code", 0);
- return map;
- }
-
-
- /**
- *
- * 描述:根据编号查找客户关怀记录
- * @author wanghaoyu
- * @version 1.0
- * @param id
- * @return
- * @exception Nothing
- * @since 1.8
- *
- */
- @Operation(name="根据编号查找客户关怀记录")
- @RequestMapping("/findCustomerCareById")
- @ResponseBody
- public Map
findCustomerCareById(Integer id){ - Map
map = new HashMap(16); - boolean success = false;
- CustomerCare customerCare = null;
- try {
- customerCare = customerCareService.selectCustomerCareByPrimaryKey(id);
- //封装联系人对象
- Linkman linkman = linkmanService.selectLinkmanByPrimaryKey(customerCare.getLinkmanId());
- customerCare.setLinkman(linkman);
- success = true;
- } catch (Exception e) {
- e.printStackTrace();
- }
- map.put("customerCare", customerCare);
- map.put("code", 0);
- map.put("success", success);
- return map;
- }
-
- /**
- *
- * 描述:处理客户关怀
- * @author wanghaoyu
- * @version 1.0
- * @param customerCare
- * @return Map
- * @exception Nothing
- * @since 1.8
- *
- */
- @Operation(name="处理客户关怀")
- @RequestMapping("/handleCustomerCare")
- @RequiresPermissions("19002")
- @ResponseBody
- public Map
handleCustomerCare(CustomerCare customerCare){ - Map
map = new HashMap(16); - boolean success = false;
- logger.info("客户关怀" + customerCare.toString());
- try {
- customerCare.setStatus("已处理");
- //更新客户关怀记录
- if(customerCareService.updateCustomerCareByPrimaryKey(customerCare)) {
- success = true;
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- map.put("success", success);
- map.put("code", 0);
- return map;
- }
-
- /**
- *
- * 描述:忽略客户的生日处理
- * @author wanghaoyu
- * @version 1.0
- * @param id
- * @return
- * @exception Nothing
- * @since 1.8
- *
- */
- @Operation(name="忽略客户关怀")
- @RequiresPermissions("19006")
- @RequestMapping("/skipCustomerCare")
- @ResponseBody
- public Map
skipCustomerCare(Integer id){ - Map
map = new HashMap(16); - boolean success = false;
- try {
- CustomerCare customerCare = new CustomerCare();
- customerCare.setId(id);
- customerCare.setStatus("已忽略");
- if(customerCareService.updateCustomerCareByPrimaryKeySelective(customerCare)) {
- success = true;
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- map.put("success", success);
- map.put("code", 0);
- return map;
- }
-
- }
如果也想学习本系统,下面领取。关注并回复:048ssm