• Java项目:jsp房地产客户关系管理系统


    作者主页:夜未央5788

     简介:Java领域优质创作者、Java项目、学习资料、技术互助

    文末获取源码

    项目介绍

    本项目分为管理员与员工两种角色;
    管理员功能主要包括:
    客户相关:客户信息、客户分配、客户关怀、客户类型、客户状态、客户来源、联系记录、联系人;
    员工相关:员工信息、房屋信息、房屋类型、部门信息、公告;
    邮件相关:写邮件、发件箱、草稿箱;
    管理员:添加员工、添加部门、添加角色;

    员工功能主要包括:
    客户相关:客户信息、客户关怀、客户类型、客户状态、客户来源、联系记录、联系人;
    员工相关:员工信息、房屋信息、房屋类型、部门信息、公告;

    邮件相关:写邮件、发件箱、草稿箱;

    环境需要

    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.数据库:MySql 5.7版本;

    6.是否Maven项目:否;

    技术栈

    1. 后端:Servlet

    2. 前端:JSP+CSS+JavaScript

    使用说明

    1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
    2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
    若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
    3. 将项目中util/DBCon.java配置文件中的数据库配置改为自己的配置;
    4. 运行项目,在浏览器中输入http://localhost:8080/crm 登录
    管理员账号/密码: admin/123456

    员工账号/密码:123/123

    运行截图

     

     

     

     

     

     

     

     

    相关代码 

    CustomerAddServlet

    1. package com.sxxy.servlet.customer;
    2. import java.io.IOException;
    3. import java.util.List;
    4. import javax.servlet.ServletException;
    5. import javax.servlet.http.HttpServlet;
    6. import javax.servlet.http.HttpServletRequest;
    7. import javax.servlet.http.HttpServletResponse;
    8. import com.sxxy.po.CustomerConditionInfo;
    9. import com.sxxy.po.CustomerInfo;
    10. import com.sxxy.po.CustomerSourceInfo;
    11. import com.sxxy.po.CustomerTypeInfo;
    12. import com.sxxy.po.UserInfo;
    13. import com.sxxy.service.CustomerConditionService;
    14. import com.sxxy.service.CustomerService;
    15. import com.sxxy.service.CustomerSourceService;
    16. import com.sxxy.service.CustomerTypeService;
    17. import com.sxxy.service.UserService;
    18. import com.sxxy.service.impl.CustomerConditionServiceImpl;
    19. import com.sxxy.service.impl.CustomerServiceImpl;
    20. import com.sxxy.service.impl.CustomerSourceServiceImpl;
    21. import com.sxxy.service.impl.CustomerTypeServiceImpl;
    22. import com.sxxy.service.impl.UserServiceImpl;
    23. public class CustomerAddServlet extends HttpServlet {
    24. /**
    25. * Constructor of the object.
    26. */
    27. public CustomerAddServlet() {
    28. super();
    29. }
    30. /**
    31. * Destruction of the servlet.
    32. */
    33. public void destroy() {
    34. super.destroy(); // Just puts "destroy" string in log
    35. // Put your code here
    36. }
    37. /**
    38. * The doGet method of the servlet.
    39. *
    40. * This method is called when a form has its tag value method equals to get.
    41. *
    42. * @param request the request send by the client to the server
    43. * @param response the response send by the server to the client
    44. * @throws ServletException if an error occurred
    45. * @throws IOException if an error occurred
    46. */
    47. public void doGet(HttpServletRequest request, HttpServletResponse response)
    48. throws ServletException, IOException {
    49. //获取客户状态名
    50. CustomerConditionService conditionService = new CustomerConditionServiceImpl();
    51. List conditionInfo = conditionService.query(null);
    52. request.setAttribute("conditionInfo", conditionInfo);
    53. //获取客户来源名
    54. CustomerSourceService sourceService = new CustomerSourceServiceImpl();
    55. List sourceInfo = sourceService.query(null);
    56. request.setAttribute("sourceInfo", sourceInfo);
    57. //获取客户来源名
    58. CustomerTypeService typeService = new CustomerTypeServiceImpl();
    59. List typeInfo = typeService.query(null);
    60. request.setAttribute("typeInfo", typeInfo);
    61. //获取客户所属员工名
    62. UserService userService = new UserServiceImpl();
    63. List userInfo = userService.getList(null, null);
    64. request.setAttribute("userInfo", userInfo);
    65. request.getRequestDispatcher("/view/customer/customer_add.jsp").forward(request, response);
    66. }
    67. /**
    68. * The doPost method of the servlet.
    69. *
    70. * This method is called when a form has its tag value method equals to post.
    71. *
    72. * @param request the request send by the client to the server
    73. * @param response the response send by the server to the client
    74. * @throws ServletException if an error occurred
    75. * @throws IOException if an error occurred
    76. */
    77. public void doPost(HttpServletRequest request, HttpServletResponse response)
    78. throws ServletException, IOException {
    79. request.setCharacterEncoding("utf-8");
    80. String customerForUser = request.getParameter("customerForUser");
    81. String customerName = request.getParameter("customerName");
    82. String customerSex = request.getParameter("customerSex");
    83. String customerSource = request.getParameter("customerSource");
    84. String customerCondition = request.getParameter("customerCondition");
    85. System.out.println(customerCondition);
    86. String customerType = request.getParameter("customerType");
    87. String customerBirthday = request.getParameter("customerBirthday");
    88. String customerMobile = request.getParameter("customerMobile");
    89. String customerQq = request.getParameter("customerQq");
    90. String customerAddress = request.getParameter("customerAddress");
    91. String customerEmail = request.getParameter("customerEmail");
    92. String customerJob = request.getParameter("customerJob");
    93. String customerBlog = request.getParameter("customerBlog");
    94. String customerTel = request.getParameter("customerTel");
    95. String customerMsn = request.getParameter("customerMsn");
    96. String customerCompany = request.getParameter("customerCompany");
    97. String customerAddTime = request.getParameter("customerAddTime");
    98. String customerAddMan = request.getParameter("customerAddMan");
    99. String customerChangeTime = request.getParameter("customerChangeTime");
    100. String customerChangeMan = request.getParameter("customerChangeMan");
    101. String customerRemark = request.getParameter("customerRemark");
    102. CustomerInfo customerInfo = new CustomerInfo();
    103. try {
    104. //customerInfo.setUserId(Integer.parseInt(customerForUser));
    105. customerInfo.setSourceId(Integer.parseInt(customerSource));
    106. customerInfo.setConditionId(Integer.parseInt(customerCondition));
    107. customerInfo.setTypeId(Integer.parseInt(customerType));
    108. } catch (Exception e) {
    109. e.printStackTrace();
    110. }
    111. customerInfo.setCustomerName(customerName);
    112. customerInfo.setCustomerSex(customerSex);
    113. customerInfo.setCustomerMobile(customerMobile);
    114. customerInfo.setCustomerQq(customerQq);
    115. customerInfo.setCustomerAddress(customerAddress);
    116. customerInfo.setCustomerEmail(customerEmail);
    117. customerInfo.setCustomerRemark(customerRemark);
    118. customerInfo.setCustomerJob(customerJob);
    119. customerInfo.setCustomerBlog(customerBlog);
    120. customerInfo.setCustomerTel(customerTel);
    121. customerInfo.setCustomerMsn(customerMsn);
    122. customerInfo.setCustomerChangeTime(customerChangeTime);
    123. customerInfo.setCustomerChangeMan(customerChangeMan);
    124. customerInfo.setCustomerAddTime(customerAddTime);
    125. customerInfo.setCustomerAddMan(customerAddMan);
    126. customerInfo.setCustomerCompany(customerCompany);
    127. customerInfo.setCustomerBirthday(customerBirthday);
    128. CustomerService service = new CustomerServiceImpl();
    129. boolean mark = service.add(customerInfo);
    130. if (mark) {
    131. request.setAttribute("info", "客户添加成功");
    132. }else{
    133. request.setAttribute("info", "客户添加失败");
    134. }
    135. request.getRequestDispatcher("/view/customer/customer_save.jsp").forward(
    136. request, response);
    137. }
    138. /**
    139. * Initialization of the servlet.
    140. *
    141. * @throws ServletException if an error occurs
    142. */
    143. public void init() throws ServletException {
    144. // Put your code here
    145. }
    146. }

    CustomerQueryMoreServlet

    1. package com.sxxy.servlet.customer;
    2. import java.io.IOException;
    3. import java.io.PrintWriter;
    4. import javax.servlet.ServletException;
    5. import javax.servlet.http.HttpServlet;
    6. import javax.servlet.http.HttpServletRequest;
    7. import javax.servlet.http.HttpServletResponse;
    8. import com.sxxy.po.CustomerInfo;
    9. import com.sxxy.service.CustomerService;
    10. import com.sxxy.service.impl.CustomerServiceImpl;
    11. public class CustomerQueryMoreServlet extends HttpServlet {
    12. /**
    13. * Constructor of the object.
    14. */
    15. public CustomerQueryMoreServlet() {
    16. super();
    17. }
    18. /**
    19. * Destruction of the servlet.
    20. */
    21. public void destroy() {
    22. super.destroy(); // Just puts "destroy" string in log
    23. // Put your code here
    24. }
    25. /**
    26. * The doGet method of the servlet.
    27. *
    28. * This method is called when a form has its tag value method equals to get.
    29. *
    30. * @param request the request send by the client to the server
    31. * @param response the response send by the server to the client
    32. * @throws ServletException if an error occurred
    33. * @throws IOException if an error occurred
    34. */
    35. public void doGet(HttpServletRequest request, HttpServletResponse response)
    36. throws ServletException, IOException {
    37. //获取客户信息
    38. int customerId = Integer.parseInt(request.getParameter("customerId"));
    39. CustomerService service = new CustomerServiceImpl();
    40. CustomerInfo customerInfo = service.getAllList(customerId);
    41. request.setAttribute("customerInfo", customerInfo);
    42. request.getRequestDispatcher("/view/customer/customer_more.jsp").forward(
    43. request, response);
    44. }
    45. /**
    46. * The doPost method of the servlet.
    47. *
    48. * This method is called when a form has its tag value method equals to post.
    49. *
    50. * @param request the request send by the client to the server
    51. * @param response the response send by the server to the client
    52. * @throws ServletException if an error occurred
    53. * @throws IOException if an error occurred
    54. */
    55. public void doPost(HttpServletRequest request, HttpServletResponse response)
    56. throws ServletException, IOException {
    57. response.setContentType("text/html");
    58. PrintWriter out = response.getWriter();
    59. out
    60. .println("");
    61. out.println("");
    62. out.println(" A Servlet");
    63. out.println(" ");
    64. out.print(" This is ");
    65. out.print(this.getClass());
    66. out.println(", using the POST method");
    67. out.println(" ");
    68. out.println("");
    69. out.flush();
    70. out.close();
    71. }
    72. /**
    73. * Initialization of the servlet.
    74. *
    75. * @throws ServletException if an error occurs
    76. */
    77. public void init() throws ServletException {
    78. // Put your code here
    79. }
    80. }

    CustomerQueryServlet

    1. package com.sxxy.servlet.customer;
    2. import java.io.IOException;
    3. import java.util.List;
    4. import javax.servlet.ServletException;
    5. import javax.servlet.http.HttpServlet;
    6. import javax.servlet.http.HttpServletRequest;
    7. import javax.servlet.http.HttpServletResponse;
    8. import com.sxxy.po.CustomerInfo;
    9. import com.sxxy.service.CustomerService;
    10. import com.sxxy.service.impl.CustomerServiceImpl;
    11. public class CustomerQueryServlet extends HttpServlet {
    12. /**
    13. * Constructor of the object.
    14. */
    15. public CustomerQueryServlet() {
    16. super();
    17. }
    18. /**
    19. * Destruction of the servlet.
    20. */
    21. public void destroy() {
    22. super.destroy(); // Just puts "destroy" string in log
    23. // Put your code here
    24. }
    25. /**
    26. * The doGet method of the servlet.
    27. *
    28. * This method is called when a form has its tag value method equals to get.
    29. *
    30. * @param request the request send by the client to the server
    31. * @param response the response send by the server to the client
    32. * @throws ServletException if an error occurred
    33. * @throws IOException if an error occurred
    34. */
    35. public void doGet(HttpServletRequest request, HttpServletResponse response)
    36. throws ServletException, IOException {
    37. doPost(request, response);
    38. }
    39. /**
    40. * The doPost method of the servlet.
    41. *
    42. * This method is called when a form has its tag value method equals to post.
    43. *
    44. * @param request the request send by the client to the server
    45. * @param response the response send by the server to the client
    46. * @throws ServletException if an error occurred
    47. * @throws IOException if an error occurred
    48. */
    49. public void doPost(HttpServletRequest request, HttpServletResponse response)
    50. throws ServletException, IOException {
    51. try {
    52. request.setCharacterEncoding("utf-8");
    53. String customerInput = request.getParameter("customerInput");
    54. String queryType = request.getParameter("queryType");
    55. String UserId = request.getParameter("userId");
    56. if (UserId != null) {
    57. int userId = Integer.parseInt(request.getParameter("userId"));
    58. System.out.println(userId);
    59. CustomerService service =new CustomerServiceImpl();
    60. List list= service.query(customerInput,queryType ,userId) ;
    61. request.setAttribute("list", list);
    62. }else {
    63. CustomerService service =new CustomerServiceImpl();
    64. List list= service.query(customerInput,queryType ,0) ;
    65. request.setAttribute("list", list);
    66. }
    67. request.getRequestDispatcher("/view/customer/customer_list.jsp").forward(request, response);
    68. } catch (Exception e) {
    69. e.printStackTrace();
    70. }
    71. }
    72. /**
    73. * Initialization of the servlet.
    74. *
    75. * @throws ServletException if an error occurs
    76. */
    77. public void init() throws ServletException {
    78. // Put your code here
    79. }
    80. }

    如果也想学习本系统,下面领取。关注并回复:124jsp

  • 相关阅读:
    七层负载均衡-nginx
    零零信安-D&D数据泄露报警日报【第30期】
    HTML5+CSS3+JS小实例:涟漪特效按钮
    Vim C++ – 大有可为!(C++ Vim 使用技巧)
    C++11智能指针 unique_ptr、shared_ptr/weak_ptr、make_shared、循环引用、定制删除器
    ruby语言怎么写个通用爬虫程序?
    图论+博弈论上dp:CF536D
    记一次渗透测试事件
    C++语法——stack堆栈
    ECharts的基本使用
  • 原文地址:https://blog.csdn.net/hanyunlong1989/article/details/126845025