/**
  * 检查手机号码是否存在
  *
  * @throws Exception
  */
 public void checkedMobileExist() throws Exception {
   Map<String, Object> queryParameter = new HashMap<String, Object>();
   queryParameter.put("isShipan", Customer.ISSHIPAN_1);
   queryParameter.put("mobile", getRequest().getParameter("param"));
   boolean result = customerService.checkedMobileForOnline(queryParameter);
   if (result) {
     map.put("info", "该号已有记录,请拨打4006706202");
     map.put("status", "n");
   } else {
     map.put("status", "y");
   }
   printJson(Object2Json(map));
 }
  /**
   * 手机号注册验证
   *
   * @throws Exception
   */
  public void checkedCardExist() throws Exception {

    Map<String, Object> queryParameter = new HashMap<String, Object>();
    queryParameter.put("isShipan", Customer.ISMONI_1);
    queryParameter.put("papersNum", getRequest().getParameter("param"));
    boolean result = customerService.checkedMobileForOnline(queryParameter);
    if (result) {
      map.put("info", "该身份证已经注册过!");
      map.put("status", "n");
    } else {
      map.put("status", "y");
    }
    printJson(Object2Json(map));
  }
  /**
   * 保存开户基本信息 (姓名手机号码) 把member放入request中 并对customer状态进行保存
   *
   * @return
   * @throws Exception
   */
  public String saveAccountBase() throws Exception {

    // 用于判断重复提交
    if (UserSession.getInstance(this.getRequest()).getTokinId() == null) {
      return "index";
    }

    Customer newCustomer = new Customer();
    newCustomer.setSubmitChannel(DataConfig.OPEN_ACCOUNT_TYPE_SHIPAN);
    newCustomer.setFromPage(DataConfig.OPEN_ACCOUNT_FROMPAGE_WEIZHAN);
    Member member = (Member) getRequest().getSession().getAttribute("session_member");

    String memberName = this.getRequest().getParameter("memberName");
    String memberMobile = this.getRequest().getParameter("mobile");

    if (checkMobileScript(memberMobile)) {
      // 为true验证不通过
      return "index";
    }

    if (member == null) {
      if (this.getRequest().getParameter("kaihu") == null) {
        return "onlineOne";
      }
      member = new Member();
    }

    member.setMemberName(memberName);
    member.setMobile(memberMobile);
    member.setMemberStatus(Member.MEMBERSTATUS_2);
    member.setIsDelete(Member.ISDELETE_1);

    getRequest().setAttribute("memberName", member.getMemberName());

    newCustomer.setMobile(memberMobile);
    newCustomer.setCustomerName(member.getMemberName());
    // 放入session session过期从第一步提交
    getRequest().getSession().setAttribute("session_member", member);

    this.setAdvId(newCustomer);

    newCustomer.setIp(DataConfig.getIpAddr(this.getRequest()));
    Integer id = customerService.setCustomerFromWeiZhan(newCustomer, null, member);
    getRequest().setAttribute("id", id);
    return "onlineTwo";
  }
  /**
   * 在线开户 -- 实盘开户 银行卡号 身份证号 开户银行
   *
   * @return
   * @throws Exception
   */
  public String saveOpenAccount() throws Exception {

    // 用于判断重复提交
    if (UserSession.getInstance(this.getRequest()).getTokinId() == null) {
      return "index";
    }
    // 获取session内member的值
    Member member = (Member) getRequest().getSession().getAttribute("session_member");
    customer.setSubmitChannel(DataConfig.OPEN_ACCOUNT_TYPE_SHIPAN);
    customer.setFromPage(DataConfig.OPEN_ACCOUNT_FROMPAGE_WEIZHAN_2);

    customer.setSourceChannel(Customer.CHANNEL_1); // 来源通道--在线开户
    customer.setSourceChannelName("在线开户");
    customer.setMobile(member.getMobile());
    member.setMemberStatus(Member.MEMBERSTATUS_1);
    customer.setIp(DataConfig.getIpAddr(this.getRequest()));

    Map<String, Object> resultMap = customerService.openAccount(customer, member);
    String result = resultMap.get("result").toString();
    if (!Boolean.valueOf(result)) {
      getRequest().setAttribute("result", "fail");
      getRequest().setAttribute("name", customer.getCustomerName());
      getRequest().setAttribute("msg", resultMap.get("msg"));
      getRequest().setAttribute("errorMsg", resultMap.get("errorResult"));

    } else {
      getRequest().setAttribute("result", "success");
      Member memberModel = (Member) resultMap.get("member");
      // 保存member
      memberService.insert(memberModel);
      getRequest().setAttribute("member", memberModel);
    }
    // 取消重复提交标志
    UserSession.getInstance(this.getRequest()).setTokinId(null);

    return "onlineFinish";
  }