作者主页:夜未央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

- package com.sxxy.servlet.customer;
-
- import java.io.IOException;
- import java.util.List;
-
- import javax.servlet.ServletException;
- import javax.servlet.http.HttpServlet;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
-
- import com.sxxy.po.CustomerConditionInfo;
- import com.sxxy.po.CustomerInfo;
- import com.sxxy.po.CustomerSourceInfo;
- import com.sxxy.po.CustomerTypeInfo;
- import com.sxxy.po.UserInfo;
- import com.sxxy.service.CustomerConditionService;
- import com.sxxy.service.CustomerService;
- import com.sxxy.service.CustomerSourceService;
- import com.sxxy.service.CustomerTypeService;
- import com.sxxy.service.UserService;
- import com.sxxy.service.impl.CustomerConditionServiceImpl;
- import com.sxxy.service.impl.CustomerServiceImpl;
- import com.sxxy.service.impl.CustomerSourceServiceImpl;
- import com.sxxy.service.impl.CustomerTypeServiceImpl;
- import com.sxxy.service.impl.UserServiceImpl;
-
- public class CustomerAddServlet extends HttpServlet {
-
- /**
- * Constructor of the object.
- */
- public CustomerAddServlet() {
- super();
- }
-
- /**
- * Destruction of the servlet.
- */
- public void destroy() {
- super.destroy(); // Just puts "destroy" string in log
- // Put your code here
- }
-
- /**
- * The doGet method of the servlet.
- *
- * This method is called when a form has its tag value method equals to get.
- *
- * @param request the request send by the client to the server
- * @param response the response send by the server to the client
- * @throws ServletException if an error occurred
- * @throws IOException if an error occurred
- */
- public void doGet(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
-
- //获取客户状态名
- CustomerConditionService conditionService = new CustomerConditionServiceImpl();
- List
conditionInfo = conditionService.query(null); - request.setAttribute("conditionInfo", conditionInfo);
- //获取客户来源名
- CustomerSourceService sourceService = new CustomerSourceServiceImpl();
- List
sourceInfo = sourceService.query(null); - request.setAttribute("sourceInfo", sourceInfo);
- //获取客户来源名
- CustomerTypeService typeService = new CustomerTypeServiceImpl();
- List
typeInfo = typeService.query(null); - request.setAttribute("typeInfo", typeInfo);
- //获取客户所属员工名
- UserService userService = new UserServiceImpl();
- List
userInfo = userService.getList(null, null); - request.setAttribute("userInfo", userInfo);
-
- request.getRequestDispatcher("/view/customer/customer_add.jsp").forward(request, response);
- }
-
- /**
- * The doPost method of the servlet.
- *
- * This method is called when a form has its tag value method equals to post.
- *
- * @param request the request send by the client to the server
- * @param response the response send by the server to the client
- * @throws ServletException if an error occurred
- * @throws IOException if an error occurred
- */
- public void doPost(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
-
- request.setCharacterEncoding("utf-8");
-
- String customerForUser = request.getParameter("customerForUser");
- String customerName = request.getParameter("customerName");
- String customerSex = request.getParameter("customerSex");
- String customerSource = request.getParameter("customerSource");
- String customerCondition = request.getParameter("customerCondition");
-
- System.out.println(customerCondition);
-
- String customerType = request.getParameter("customerType");
- String customerBirthday = request.getParameter("customerBirthday");
- String customerMobile = request.getParameter("customerMobile");
- String customerQq = request.getParameter("customerQq");
- String customerAddress = request.getParameter("customerAddress");
- String customerEmail = request.getParameter("customerEmail");
- String customerJob = request.getParameter("customerJob");
- String customerBlog = request.getParameter("customerBlog");
- String customerTel = request.getParameter("customerTel");
- String customerMsn = request.getParameter("customerMsn");
- String customerCompany = request.getParameter("customerCompany");
- String customerAddTime = request.getParameter("customerAddTime");
- String customerAddMan = request.getParameter("customerAddMan");
- String customerChangeTime = request.getParameter("customerChangeTime");
- String customerChangeMan = request.getParameter("customerChangeMan");
- String customerRemark = request.getParameter("customerRemark");
-
- CustomerInfo customerInfo = new CustomerInfo();
- try {
- //customerInfo.setUserId(Integer.parseInt(customerForUser));
- customerInfo.setSourceId(Integer.parseInt(customerSource));
- customerInfo.setConditionId(Integer.parseInt(customerCondition));
- customerInfo.setTypeId(Integer.parseInt(customerType));
- } catch (Exception e) {
- e.printStackTrace();
- }
-
-
- customerInfo.setCustomerName(customerName);
- customerInfo.setCustomerSex(customerSex);
- customerInfo.setCustomerMobile(customerMobile);
- customerInfo.setCustomerQq(customerQq);
- customerInfo.setCustomerAddress(customerAddress);
- customerInfo.setCustomerEmail(customerEmail);
- customerInfo.setCustomerRemark(customerRemark);
- customerInfo.setCustomerJob(customerJob);
- customerInfo.setCustomerBlog(customerBlog);
- customerInfo.setCustomerTel(customerTel);
- customerInfo.setCustomerMsn(customerMsn);
- customerInfo.setCustomerChangeTime(customerChangeTime);
- customerInfo.setCustomerChangeMan(customerChangeMan);
- customerInfo.setCustomerAddTime(customerAddTime);
- customerInfo.setCustomerAddMan(customerAddMan);
- customerInfo.setCustomerCompany(customerCompany);
- customerInfo.setCustomerBirthday(customerBirthday);
-
- CustomerService service = new CustomerServiceImpl();
- boolean mark = service.add(customerInfo);
- if (mark) {
- request.setAttribute("info", "客户添加成功");
- }else{
- request.setAttribute("info", "客户添加失败");
- }
-
- request.getRequestDispatcher("/view/customer/customer_save.jsp").forward(
- request, response);
- }
-
- /**
- * Initialization of the servlet.
- *
- * @throws ServletException if an error occurs
- */
- public void init() throws ServletException {
- // Put your code here
- }
-
- }
- package com.sxxy.servlet.customer;
-
- import java.io.IOException;
- import java.io.PrintWriter;
-
- import javax.servlet.ServletException;
- import javax.servlet.http.HttpServlet;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
-
- import com.sxxy.po.CustomerInfo;
- import com.sxxy.service.CustomerService;
- import com.sxxy.service.impl.CustomerServiceImpl;
-
- public class CustomerQueryMoreServlet extends HttpServlet {
-
- /**
- * Constructor of the object.
- */
- public CustomerQueryMoreServlet() {
- super();
- }
-
- /**
- * Destruction of the servlet.
- */
- public void destroy() {
- super.destroy(); // Just puts "destroy" string in log
- // Put your code here
- }
-
- /**
- * The doGet method of the servlet.
- *
- * This method is called when a form has its tag value method equals to get.
- *
- * @param request the request send by the client to the server
- * @param response the response send by the server to the client
- * @throws ServletException if an error occurred
- * @throws IOException if an error occurred
- */
- public void doGet(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
-
- //获取客户信息
- int customerId = Integer.parseInt(request.getParameter("customerId"));
- CustomerService service = new CustomerServiceImpl();
- CustomerInfo customerInfo = service.getAllList(customerId);
- request.setAttribute("customerInfo", customerInfo);
-
- request.getRequestDispatcher("/view/customer/customer_more.jsp").forward(
- request, response);
- }
-
- /**
- * The doPost method of the servlet.
- *
- * This method is called when a form has its tag value method equals to post.
- *
- * @param request the request send by the client to the server
- * @param response the response send by the server to the client
- * @throws ServletException if an error occurred
- * @throws IOException if an error occurred
- */
- public void doPost(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
-
- response.setContentType("text/html");
- PrintWriter out = response.getWriter();
- out
- .println("");
- out.println("");
- out.println("
A Servlet "); - out.println(" ");
- out.print(" This is ");
- out.print(this.getClass());
- out.println(", using the POST method");
- out.println(" ");
- out.println("");
- out.flush();
- out.close();
- }
-
- /**
- * Initialization of the servlet.
- *
- * @throws ServletException if an error occurs
- */
- public void init() throws ServletException {
- // Put your code here
- }
-
- }
- package com.sxxy.servlet.customer;
-
- import java.io.IOException;
- import java.util.List;
-
- import javax.servlet.ServletException;
- import javax.servlet.http.HttpServlet;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
-
- import com.sxxy.po.CustomerInfo;
- import com.sxxy.service.CustomerService;
- import com.sxxy.service.impl.CustomerServiceImpl;
-
- public class CustomerQueryServlet extends HttpServlet {
-
- /**
- * Constructor of the object.
- */
- public CustomerQueryServlet() {
- super();
- }
-
- /**
- * Destruction of the servlet.
- */
- public void destroy() {
- super.destroy(); // Just puts "destroy" string in log
- // Put your code here
- }
-
- /**
- * The doGet method of the servlet.
- *
- * This method is called when a form has its tag value method equals to get.
- *
- * @param request the request send by the client to the server
- * @param response the response send by the server to the client
- * @throws ServletException if an error occurred
- * @throws IOException if an error occurred
- */
- public void doGet(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
-
- doPost(request, response);
-
- }
-
- /**
- * The doPost method of the servlet.
- *
- * This method is called when a form has its tag value method equals to post.
- *
- * @param request the request send by the client to the server
- * @param response the response send by the server to the client
- * @throws ServletException if an error occurred
- * @throws IOException if an error occurred
- */
- public void doPost(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
-
- try {
-
- request.setCharacterEncoding("utf-8");
- String customerInput = request.getParameter("customerInput");
- String queryType = request.getParameter("queryType");
- String UserId = request.getParameter("userId");
- if (UserId != null) {
-
- int userId = Integer.parseInt(request.getParameter("userId"));
- System.out.println(userId);
-
- CustomerService service =new CustomerServiceImpl();
-
- List
list= service.query(customerInput,queryType ,userId) ; -
- request.setAttribute("list", list);
- }else {
-
- CustomerService service =new CustomerServiceImpl();
-
- List
list= service.query(customerInput,queryType ,0) ; -
- request.setAttribute("list", list);
-
- }
-
-
- request.getRequestDispatcher("/view/customer/customer_list.jsp").forward(request, response);
-
-
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
-
- /**
- * Initialization of the servlet.
- *
- * @throws ServletException if an error occurs
- */
- public void init() throws ServletException {
- // Put your code here
- }
-
- }
如果也想学习本系统,下面领取。关注并回复:124jsp