/**
   * 编辑客户潜在项目
   *
   * @param request
   * @param response
   * @return
   * @throws Exception
   */
  public ModelAndView exitLatencyCustomer(HttpServletRequest request, HttpServletResponse response)
      throws Exception {

    ModelAndView modelAndView = new ModelAndView(_latencyCustomerEdit);

    LatencyCustomer latencyCustomer = new LatencyCustomer();

    // 要修改的客户潜在项目的autoid
    String autoid = request.getParameter("autoid");

    Connection conn = null;
    try {
      conn = new DBConnect().getConnect("");

      LatencyCustomerService latencyCustomerService = new LatencyCustomerService(conn);
      // 根据customerId获得客户潜在项目
      latencyCustomer = latencyCustomerService.getLatencyCustomer(autoid);

    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      DbUtil.close(conn);
    }

    modelAndView.addObject("autoid", autoid);
    modelAndView.addObject("LatencyCustomer", latencyCustomer);

    return modelAndView;
  }
  /**
   * 删除客户潜在项目
   *
   * @param request
   * @param response
   * @return
   * @throws Exception
   */
  public ModelAndView removeLatencyCustomer(
      HttpServletRequest request, HttpServletResponse response) throws Exception {

    Connection conn = null;

    String customerId = request.getParameter("customerid");
    try {
      conn = new DBConnect().getConnect("");
      // 要删除的客户潜在项目的autoid
      String autoid = request.getParameter("autoid");

      LatencyCustomerService latencyCustomerService = new LatencyCustomerService(conn);
      // 删除客户潜在项目
      latencyCustomerService.removeLatencyCustomer(autoid);

    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      DbUtil.close(conn);
    }

    if ("".equals(customerId) || customerId == null) {
      response.sendRedirect("latencyCustomer.do");
    } else {
      response.sendRedirect("latencyCustomer.do?customerid=" + customerId);
    }

    return null;
  }
  /**
   * 增加客户潜在项目
   *
   * @param request
   * @param response
   * @return
   * @throws Exception
   */
  public ModelAndView addLatencyCustomer(
      HttpServletRequest request, HttpServletResponse response, LatencyCustomer latencyCustomer)
      throws Exception {

    Connection conn = null;

    // 客户编号
    String customerId = "";
    boolean flag = false;

    String CustomerID = request.getParameter("CustomerID");

    if ("".equals(CustomerID) || CustomerID == null) {
      customerId = request.getParameter("customerid");
    } else {
      customerId = CustomerID;
      flag = true;
    }

    try {
      conn = new DBConnect().getConnect("");

      LatencyCustomerService latencyCustomerService = new LatencyCustomerService(conn);
      // 增加客户潜在项目
      latencyCustomerService.addLatencyCustomer(latencyCustomer, customerId);

    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      DbUtil.close(conn);
    }

    if (flag) {
      response.sendRedirect("latencyCustomer.do");
    } else {
      response.sendRedirect("latencyCustomer.do?customerid=" + customerId);
    }

    return null;
  }