Java 实战项目之CRM客户管理系统的实现流程

作者:qq_1334611189 时间:2022-12-01 22:50:54 

一、项目简述

功能包括: 用户管理,系统管理,客户管理,客户服务,客户关怀, 销售机会,统计管理等等。

二、项目运行

环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)

项目技术: JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等。

Java 实战项目之CRM客户管理系统的实现流程

Java 实战项目之CRM客户管理系统的实现流程

Java 实战项目之CRM客户管理系统的实现流程

Java 实战项目之CRM客户管理系统的实现流程

Java 实战项目之CRM客户管理系统的实现流程

员工操作:


/**
* @author 员工操作
*/
@RestController
@RequestMapping("/employee")
@CrossOrigin
@Slf4j
public class EmployeeController {
   @Autowired
   private EmployeeService employeeService;
   @Autowired
   private DepartmentService departmentService;
   @Autowired
   private JobService jobService;
   @Autowired
   private EduLevelMapper eduLevelMapper;
   @Autowired
   private EmployeeMapper employeeMapper;
   /**
    * 搜索接口
    */
   @GetMapping("/search")
   public Result search(@RequestParam(name = "name", required = false,defaultValue = "") String name,
                        @RequestParam(name = "current", required = false, defaultValue = "1") Integer current,
                        @RequestParam(name = "size", required = false, defaultValue = "10") Integer size) {
       return employeeService.list(current, size, name);
   }

/**
    * 分页查询接口
    *
    * @param current
    * @param size
    * @return
    */
   @GetMapping("/list")
   public Result list(@RequestParam(name = "current", required = false, defaultValue = "1") Integer current,
                      @RequestParam(name = "size", required = false, defaultValue = "10") Integer size) {
       return employeeService.list(current, size, null);
   }

/**
    * 根据id获取员工具体信息
    * @param id
    * @return
    */
   @GetMapping("/getUserById")
   public EmployeeDTO getUserAllInfoById(@RequestParam(name = "id") Integer id) {
       return employeeService.getUserById(id);
   }

/**
    * 根据员工获取信息
    * @param id
    * @return
    */
   @GetMapping("/getEmployeeById")
   public Employee getUserById(@RequestParam(name = "id") Integer id) {
       return employeeMapper.selectById(id);
   }
   /**
    * 增加员工接口
    *
    * @param employee
    * @return
    */
   @PostMapping("/add")
   public Map<String, Object> addUser(@RequestBody Employee employee) {
       log.info(employee.toString());
       return employeeService.add(employee);
   }

/**
    * 更新用户
    * @param employee
    * @return
    */
   @PostMapping("/update")
   public Map<String, Object> updateUser(@RequestBody Employee employee) {
       log.info(employee.toString());
       return employeeService.update(employee);
   }

/**
    * 删除用户
    * @param id
    * @return
    */
   @GetMapping("/delete")
   public Result deleteEmployeeById(@RequestParam(name = "id") Integer id) {
       return employeeService.deleteEmployeeById(id);
   }

/**
    * 辞退员工
    *
    * @param id
    * @return
    */
   @GetMapping("/dismiss")
   public Map<String, Object> dismissEmployeeById(@RequestParam(name = "id") Integer id) {
       return employeeService.dismissEmployeeById(id);
   }

/**
    * 得到所以工作,部门,学历信息
    *
    * @return
    */
   @GetMapping("/otherInfo")
   public Result getAllOtherInfo() {
       Map<String, Object> info = new HashMap<>();
       info.put("departments", departmentService.selectAll());
       info.put("jobs", jobService.selectAll());
       info.put("eduLevels", eduLevelMapper.selectList(null));
       return Result.success(info);
   }

@GetMapping("/map")
   public Result getMap() {
       return employeeService.getMap();
   }
}

人事管理相关接口:


/**
* 人事管理相关接口
*/
@RestController
@CrossOrigin
@RequestMapping("/personnel")
public class PersonnelController {
   @Autowired
   private PersonnelService personnelService;

/**
    * 所以人事记录接口
    * @param current
    * @param size
    * @return
    */
   @GetMapping("/list")
   public Result list(@RequestParam(name = "current", required = false, defaultValue = "1") Integer current,
                      @RequestParam(name = "size", required = false, defaultValue = "10") Integer size) {
       return personnelService.list(current, size);
   }

}

服务端:


/**
* websocket 服务端
* 注意: websocket 不能被代理,还有下面几个注解修饰的方法必须是public的
*/

@Component
@ServerEndpoint("/websocket/login")
@Slf4j
public class WebSocketServer {
//    static Log log = LogFactory.get(WebSocketServer.class);
   /**
    * 记录连接数量
    */
   private static int onlineCount = 0;
   /**
    * juc中的线程安全容器
    */
   private static CopyOnWriteArraySet<WebSocketServer> webSocketSet = new CopyOnWriteArraySet<>();
   /**
    * 存放websocket 中的会话
    */
   private Session session;

/**
    * 连接建立成功调用的方法
    */
   @OnOpen
   public void onOpen(Session session) {
       this.session = session;
       webSocketSet.add(this);
       addOnlineCount();
       log.info("新增一个websocket连接,现在连接数" + getOnlineCount());
   }

/**
    * websocket 连接断开调用的方法
    */
   @OnClose
   public void onClose() {
       webSocketSet.remove(this);
       subOnlineCount();
       log.info("断开websocket一个连接,现在连接数:" + getOnlineCount());
   }

/**
    * 收到消息调用此方法
    *
    * @param message
    * @param session
    */
   @OnMessage
   public void onMessage(String message, Session session) {
       log.info("websocket 收到消息了: " + message);
       try {
           sendInfo("hello, too!!!", "text");
       } catch (IOException e) {
           e.printStackTrace();
       }
   }

/**
    * 发生错误调用的方法
    *
    * @param session
    * @param throwable
    */
   @OnError
   public void onError(Session session, Throwable throwable) {
       log.error("发送错误,  ");
       throwable.printStackTrace();
   }

/**
    * 实现主动推送消息到客户端
    */
   public void sendMessage(String message) throws IOException {
       if (session != null) {
           this.session.getBasicRemote().sendText(message);
       } else {
           log.info("session为空");
       }
   }

public static void sendInfo(Object message, String type) throws IOException {
       log.info("推送消息到窗口,推送内容:" + message);
       Map<String, Object> resultMap = new HashMap<>();
       resultMap.put("type", type);
       resultMap.put("message", message);
       JSONObject jsonObject = JSONUtil.parseObj(resultMap);
       for (WebSocketServer item : webSocketSet) {
           try {
               //这里可以设定只推送给这个sid的,为null则全部推送
               item.sendMessage(jsonObject.toString());
           } catch (IOException e) {
               continue;
           }
       }
   }

public static synchronized int getOnlineCount() {
       return onlineCount;
   }

public static synchronized void addOnlineCount() {
       WebSocketServer.onlineCount++;
   }

public static synchronized void subOnlineCount() {
       WebSocketServer.onlineCount--;
   }
}

来源:https://blog.csdn.net/m0_59687645/article/details/121300190

标签:Java,CRM客户管理系统,实战项目
0
投稿

猜你喜欢

  • Springboot实现高吞吐量异步处理详解(适用于高并发场景)

    2023-08-20 23:40:35
  • java hasNextInt判断是否为数字的方法

    2023-05-17 01:51:12
  • Java中ArrayList和LinkedList之间的区别_动力节点Java学院整理

    2023-03-30 18:16:29
  • 带你详细了解Java值传递和引用传递

    2023-02-19 08:42:26
  • FeignClient中name和url属性的作用说明

    2023-06-04 13:21:55
  • java 2d画图示例分享(用java画图)

    2023-07-25 22:03:52
  • 一文详解Android无需权限调用系统相机拍照

    2022-06-22 03:08:26
  • Java泛型的类型擦除示例详解

    2023-07-02 13:38:17
  • Java输入输出流实例详解

    2023-05-28 15:54:35
  • 基于android中读取assets目录下a.txt文件并进行解析的深入分析

    2023-06-13 17:32:34
  • Java设计模式中代理模式应用详解

    2021-10-06 10:50:56
  • 利用Java8 Optional类优雅如何地解决空指针问题

    2023-07-30 04:58:13
  • SpringBoot雪花算法主键ID传到前端后精度丢失问题的解决

    2022-07-18 02:30:47
  • C#/VB.NET实现HTML转为XML的示例代码

    2021-08-13 20:46:48
  • 适配Android 8.0版本更新安装与通知栏的一些坑

    2022-05-01 13:23:25
  • springboot使用单元测试实战

    2023-05-17 11:55:29
  • SpringBoot中定时任务@Scheduled注解的使用解读

    2022-11-24 17:20:11
  • C#中按引用传递与按值传递的区别,以及ref与out关键字的用法详解

    2023-01-26 00:27:17
  • Java Web程序实现返回JSON字符串的方法总结

    2023-07-28 22:46:48
  • C#实现将DataTable内容输出到Excel表格的方法

    2023-05-01 15:20:38
  • asp之家 软件编程 m.aspxhome.com