Java 实战项目之CRM客户管理系统的实现流程
作者:qq_1334611189 发布时间:2022-12-01 22:50:54
标签:Java,CRM客户管理系统,实战项目
一、项目简述
功能包括: 用户管理,系统管理,客户管理,客户服务,客户关怀, 销售机会,统计管理等等。
二、项目运行
环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)
项目技术: JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等。
员工操作:
/**
* @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


猜你喜欢
- 作为.net程序员,我们每天都要和BCL(Base Class Linbrary)打交道。无疑,BCL做为一个年轻的框架类库,她是成功的,但
- 过滤器、 * 、 * 概念概念1、servlet:servlet是一种运行服务器端的java应用程序,具有独立于平台和协议的特性,可以动态生
- 本文介绍了Spring @Async异步线程池用法总结,分享给大家,希望对大家有帮助1. TaskExecutorspring异步线程池的接
- springboot启动是通过一个main方法启动的,代码如下@SpringBootApplicationpublic class Appl
- CLR要求每一个类型都最终从object类型派生,如下: class Typer {} === class Typer :object {}
- 本文实例为大家分享了Android半圆环型进度效果的具体代码,供大家参考,具体内容如下package com.newair.ondrawte
- 在线程间通信方式中,我们了解到可以使用Semaphore信号量来实现线程间通信,Semaphore支持公平锁和非公平锁,Semaphore底
- 本篇分享的是springboot多数据源配置,在从springboot v1.5版本升级到v2.0.3时,发现之前写的多数据源的方式不可用了
- 最近根据项目需要,整理了一个相对比较全面的 WheelView 使用控件,借用之前看到的一句话来说,就是站在巨人肩膀上,进行了一些小调整。
- 1、首先说一下用法,BigDecimal中的divide主要就是用来做除法的运算。其中有这么一个方法.public BigDecimal d
- 通过shift+shift可以调出搜索窗口或者ctrl+n但是,如果想搜索jdk中的类,只是在搜索栏中是无法搜出来的需要勾选 红框内的选项没
- 本文实例讲述了C#实现百分比转小数的方法。分享给大家供大家参考。具体分析如下:近日需要用到百分比转小数功能,而且百分比是字符串格式(可以带或
- 本文实例讲述了java实现Xml与json之间的相互转换操作。分享给大家供大家参考,具体如下:旁白:最近关于xml与json之间的转换都搞蒙
- 不少朋友自己下载了一个Android SDK,怎样在Android studio中默认的Android SDK路径呢?打开Android s
- 引言:SpringBoot web项目开发中往往会涉及到一些静态资源的使用,比如说图片,css样式,js等等,今天我们来讲讲这些常见的静态资
- /// <summary> /// 汉字转拼音缩写 /// </summary> /// <param nam
- 上一篇文章讲了如何获取所有联系人,这篇文章就讲下怎么保存联系人数据到本机通讯录。这里我就假设你已经拿到了要保存的联系人数据。 因为
- 一、基本介绍(Nexus(maven * ))1,如果没有搭建 * 会有什么问题?如果没有 * ,我们所需的所有构件都需要通过 Mave
- 前言在计算机操作系统中,进程是进行资源分配和调度的基本单位。这对于基于Linux内核的Android系统也不例外。在Android的设计中,
- class ColorComboBox : ComboBox {&