• 首页
  • 栏目
  • CRM
  • Java项目:CRM客户管理系统(java+SSM+jsp+mysql+maven)

Java项目:CRM客户管理系统(java+SSM+jsp+mysql+maven)

  • 2021-11-13
  • Admin

一、项目简述

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

二、项目运行

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

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

 

员工操作:

  1. /**
  2. * @author 员工操作
  3. */
  4. @RestController
  5. @RequestMapping("/employee")
  6. @CrossOrigin
  7. @Slf4j
  8. public class EmployeeController {
  9. @Autowired
  10. private EmployeeService employeeService;
  11. @Autowired
  12. private DepartmentService departmentService;
  13. @Autowired
  14. private JobService jobService;
  15. @Autowired
  16. private EduLevelMapper eduLevelMapper;
  17. @Autowired
  18. private EmployeeMapper employeeMapper;
  19. /**
  20. * 搜索接口
  21. */
  22. @GetMapping("/search")
  23. public Result search(@RequestParam(name = "name", required = false,defaultValue = "") String name,
  24. @RequestParam(name = "current", required = false, defaultValue = "1") Integer current,
  25. @RequestParam(name = "size", required = false, defaultValue = "10") Integer size) {
  26. return employeeService.list(current, size, name);
  27. }
  28. /**
  29. * 分页查询接口
  30. *
  31. * @param current
  32. * @param size
  33. * @return
  34. */
  35. @GetMapping("/list")
  36. public Result list(@RequestParam(name = "current", required = false, defaultValue = "1") Integer current,
  37. @RequestParam(name = "size", required = false, defaultValue = "10") Integer size) {
  38. return employeeService.list(current, size, null);
  39. }
  40. /**
  41. * 根据id获取员工具体信息
  42. * @param id
  43. * @return
  44. */
  45. @GetMapping("/getUserById")
  46. public EmployeeDTO getUserAllInfoById(@RequestParam(name = "id") Integer id) {
  47. return employeeService.getUserById(id);
  48. }
  49. /**
  50. * 根据员工获取信息
  51. * @param id
  52. * @return
  53. */
  54. @GetMapping("/getEmployeeById")
  55. public Employee getUserById(@RequestParam(name = "id") Integer id) {
  56. return employeeMapper.selectById(id);
  57. }
  58. /**
  59. * 增加员工接口
  60. *
  61. * @param employee
  62. * @return
  63. */
  64. @PostMapping("/add")
  65. public Map<String, Object> addUser(@RequestBody Employee employee) {
  66. log.info(employee.toString());
  67. return employeeService.add(employee);
  68. }
  69. /**
  70. * 更新用户
  71. * @param employee
  72. * @return
  73. */
  74. @PostMapping("/update")
  75. public Map<String, Object> updateUser(@RequestBody Employee employee) {
  76. log.info(employee.toString());
  77. return employeeService.update(employee);
  78. }
  79. /**
  80. * 删除用户
  81. * @param id
  82. * @return
  83. */
  84. @GetMapping("/delete")
  85. public Result deleteEmployeeById(@RequestParam(name = "id") Integer id) {
  86. return employeeService.deleteEmployeeById(id);
  87. }
  88. /**
  89. * 辞退员工
  90. *
  91. * @param id
  92. * @return
  93. */
  94. @GetMapping("/dismiss")
  95. public Map<String, Object> dismissEmployeeById(@RequestParam(name = "id") Integer id) {
  96. return employeeService.dismissEmployeeById(id);
  97. }
  98. /**
  99. * 得到所以工作,部门,学历信息
  100. *
  101. * @return
  102. */
  103. @GetMapping("/otherInfo")
  104. public Result getAllOtherInfo() {
  105. Map<String, Object> info = new HashMap<>();
  106. info.put("departments", departmentService.selectAll());
  107. info.put("jobs", jobService.selectAll());
  108. info.put("eduLevels", eduLevelMapper.selectList(null));
  109. return Result.success(info);
  110. }
  111. @GetMapping("/map")
  112. public Result getMap() {
  113. return employeeService.getMap();
  114. }
  115. }

 

人事管理相关接口:

  1. /**
  2. * 人事管理相关接口
  3. */
  4. @RestController
  5. @CrossOrigin
  6. @RequestMapping("/personnel")
  7. public class PersonnelController {
  8. @Autowired
  9. private PersonnelService personnelService;
  10. /**
  11. * 所以人事记录接口
  12. * @param current
  13. * @param size
  14. * @return
  15. */
  16. @GetMapping("/list")
  17. public Result list(@RequestParam(name = "current", required = false, defaultValue = "1") Integer current,
  18. @RequestParam(name = "size", required = false, defaultValue = "10") Integer size) {
  19. return personnelService.list(current, size);
  20. }
  21. }

服务端:

  1. /**
  2. * websocket 服务端
  3. * 注意: websocket 不能被代理,还有下面几个注解修饰的方法必须是public的
  4. */
  5. @Component
  6. @ServerEndpoint("/websocket/login")
  7. @Slf4j
  8. public class WebSocketServer {
  9. // static Log log = LogFactory.get(WebSocketServer.class);
  10. /**
  11. * 记录连接数量
  12. */
  13. private static int onlineCount = 0;
  14. /**
  15. * juc中的线程安全容器
  16. */
  17. private static CopyOnWriteArraySet<WebSocketServer> webSocketSet = new CopyOnWriteArraySet<>();
  18. /**
  19. * 存放websocket 中的会话
  20. */
  21. private Session session;
  22. /**
  23. * 连接建立成功调用的方法
  24. */
  25. @OnOpen
  26. public void onOpen(Session session) {
  27. this.session = session;
  28. webSocketSet.add(this);
  29. addOnlineCount();
  30. log.info("新增一个websocket连接,现在连接数" + getOnlineCount());
  31. }
  32. /**
  33. * websocket 连接断开调用的方法
  34. */
  35. @OnClose
  36. public void onClose() {
  37. webSocketSet.remove(this);
  38. subOnlineCount();
  39. log.info("断开websocket一个连接,现在连接数:" + getOnlineCount());
  40. }
  41. /**
  42. * 收到消息调用此方法
  43. *
  44. * @param message
  45. * @param session
  46. */
  47. @OnMessage
  48. public void onMessage(String message, Session session) {
  49. log.info("websocket 收到消息了: " + message);
  50. try {
  51. sendInfo("hello, too!!!", "text");
  52. } catch (IOException e) {
  53. e.printStackTrace();
  54. }
  55. }
  56. /**
  57. * 发生错误调用的方法
  58. *
  59. * @param session
  60. * @param throwable
  61. */
  62. @OnError
  63. public void onError(Session session, Throwable throwable) {
  64. log.error("发送错误, ");
  65. throwable.printStackTrace();
  66. }
  67. /**
  68. * 实现主动推送消息到客户端
  69. */
  70. public void sendMessage(String message) throws IOException {
  71. if (session != null) {
  72. this.session.getBasicRemote().sendText(message);
  73. } else {
  74. log.info("session为空");
  75. }
  76. }
  77. public static void sendInfo(Object message, String type) throws IOException {
  78. log.info("推送消息到窗口,推送内容:" + message);
  79. Map<String, Object> resultMap = new HashMap<>();
  80. resultMap.put("type", type);
  81. resultMap.put("message", message);
  82. JSONObject jsonObject = JSONUtil.parseObj(resultMap);
  83. for (WebSocketServer item : webSocketSet) {
  84. try {
    <

原文:https://blog.csdn.net/m0_59687645/article/details/121300190

联系站长

QQ:769220720

Copyright © SibooSoft All right reserved 津ICP备19011444号