private boolean initAppnt(
     LECAppntSchema appnt,
     com.sinosoft.ec.webservices.jd.pojo.hebaoRequest.Package rp,
     Err err,
     MMap map,
     HashMap<String, Object> hmap) {
   appnt.setContNo(u.getContNo(rp));
   appnt.setManageCom(u.getManageCom(rp));
   appnt.setAppntNo(PubFun1.CreateMaxNo("CustomerNo", "SN"));
   //		appnt.setAppntGrade("");//null
   appnt.setAppntName(rp.getRequest().getApplyinfo().getHolderinfo().getHolderName());
   appnt.setAppntSex(
       "1".equals(rp.getRequest().getApplyinfo().getHolderinfo().getHolderSex()) ? "M" : "F");
   appnt.setAppntBirthday(u.getHolderBirthdayFromIDNo(rp));
   appnt.setAppntType("1");
   appnt.setAddressNo("1");
   appnt.setAppntIDType(
       u.getiCareCardTypeWithJDCardType(
           rp.getRequest()
               .getApplyinfo()
               .getHolderinfo()
               .getHolderCardType())); // 需要确认证件类型是否由Metlife提供
   appnt.setAppntIDNo(rp.getRequest().getApplyinfo().getHolderinfo().getHolderCardNo());
   //		appnt.setNationality("");
   //		appnt.setRgtAddress("");
   //		appnt.setMarriage("");
   //		appnt.setHealth("");
   appnt.setStature(0);
   appnt.setAvoirdupois(0);
   //		appnt.setDegree("");
   //		appnt.setCreditGrade("");
   appnt.setBankCode(""); // 待确认
   LisIDEA tLisIDEA = new LisIDEA();
   appnt.setBankAccNo(tLisIDEA.encryptString(rp.getRequest().getOtherinfo().getBankCode()));
   appnt.setBankName(""); // 待确认
   appnt.setAccName(""); // 待确认
   //		appnt.setBankAccNo("");
   appnt.setOccupationType("1"); // 京东要求自默认一个职业   默认为银行、保险、信托、租赁行业的 一般内勤
   appnt.setOccupationCode("1601001"); // 京东要求自默认一个职业   默认为银行、保险、信托、租赁行业的 一般内勤
   appnt.setWorkType("106"); // 京东要求自默认一个职业   默认为银行、保险、信托、租赁行业的 一般内勤
   //		appnt.setPluralityType("");
   //		appnt.setSmokeFlag("");
   appnt.setOperator(rp.getRequest().getApplyinfo().getHolderinfo().getHolderEmail());
   appnt.setMakeDate(PubFun.getCurrentDate());
   appnt.setMakeTime(PubFun.getCurrentTime());
   appnt.setModifyDate(PubFun.getCurrentDate());
   appnt.setModifyTime(PubFun.getCurrentTime());
   map.put(appnt, "INSERT");
   return true;
 }
 private boolean initInsuredAddress(
     LECAddressSchema i,
     com.sinosoft.ec.webservices.jd.pojo.hebaoRequest.Package rp,
     Err err,
     MMap map,
     HashMap<String, Object> hmap) {
   i.setCustomerNo(((LECInsuredSchema) hmap.get("insured")).getInsuredNo());
   i.setAddressNo("1");
   i.setPostalAddress(
       rp.getRequest()
           .getApplyinfo()
           .getInsuredlist()
           .getInsuredList()
           .get(0)
           .getInsuredAddress());
   i.setZipCode(
       rp.getRequest().getApplyinfo().getInsuredlist().getInsuredList().get(0).getInsuredZip());
   //		i.setPhone("");
   //		i.setFax("");
   //		i.setHomeAddress("");
   //		i.setHomeZipCode("");
   //		i.setHomePhone("");
   //		i.setHomeFax("");
   LisIDEA tLisIDEA = new LisIDEA();
   i.setMobile(
       tLisIDEA.encryptString(
           rp.getRequest()
               .getApplyinfo()
               .getInsuredlist()
               .getInsuredList()
               .get(0)
               .getInsuredMobile()));
   tLisIDEA = null;
   //		i.setMobileChs("");
   i.setEMail(
       rp.getRequest().getApplyinfo().getInsuredlist().getInsuredList().get(0).getInsuredEmail());
   //		i.setNativePlace("");
   i.setProvince("");
   i.setCity(""); // 待确认
   i.setOperator(((LECAppntSchema) hmap.get("appnt")).getOperator());
   i.setMakeDate(PubFun.getCurrentDate());
   i.setMakeTime(PubFun.getCurrentTime());
   i.setModifyDate(PubFun.getCurrentDate());
   i.setModifyTime(PubFun.getCurrentTime());
   //		i.setAreaCode("");
   //		i.setPhoneExt("");
   map.put(i, "INSERT");
   return true;
 }
  public void setMobile(String mobile) {
    try {
      this.mobile = mobile;
      this.user.setMobile(tLisIdea.encryptDBString(this.mobile));
    } catch (Exception ex) {

    }
  }
 // Added by Zhubx 2009-06-03 加密解密手机号
 public String getMobile() {
   try {
     this.mobile = tLisIdea.decryptString_pre(this.user.getMobile());
     return mobile;
   } catch (Exception ex) {
     return "";
   }
 }
  public void queryOrderInfo() {
    orderInfoList = new ArrayList<String[]>();
    String orderInfoSQL =
        "select ord.orderNo, cont.AppntName, (case cont.AppntSex when 'M' then '男' when 'F' then '女' else '不详' end),"
            + " cont.AppntBirthday,(select a.codename from ledcode a where codetype='idtype' and a.code=cont.AppntIDType), cont.AppntIDNo,"
            + " cont.InsuredName, (case cont.InsuredSex when 'M' then '男' when 'F' then '女' else '不详' end), cont.InsuredBirthday,"
            + " (select b.name from ledcom b where b.comcode=ord.managecom),"
            + " (select c.ContPlanName from lepplan c where c.PlanType='00' and c.ContPlanCode=ord.ContPlanCode),cont.Amnt, cont.Prem,"
            + " (select a.codename from ledcode a where codetype='orderState' and a.code=ord.orderState),ord.ApplyDate,ord.AcceptDate,"
            + " ord.AcceptPolDate,(select sitename from ledadsource t where t.sitecode=cont.currency and t.productcode='readIndex'), "
            + " (select addr.mobile from lecaddress addr where addr.customerno = cont.appntno and addr.addressno = appnt.addressno)"
            + " from LECOrderInfo ord,LECCont cont,lecappnt appnt where ord.OrderNo=cont.OrderNo and cont.contno = appnt.contno and ord.ManageCom=cont.ManageCom";
    ArrayList<String[]> list = new ArrayList<String[]>();
    orderInfoSQL = orderInfoSQL + getWherePart(list);
    orderInfoSQL = orderInfoSQL + " order by cont.OrderNo, cont.ContNo";
    ExeSQL exeSQL = new ExeSQL();
    SSRS tSSRS = exeSQL.execSQL(orderInfoSQL, list);
    if (tSSRS == null) {
      ECPubFun.addErrorMessage(Constants.BUNDLE_PROGRAM, "query_fail");
    } else {
      for (int i = 1; i <= tSSRS.MaxRow; i++) {
        String[] tOrderInfo = new String[tSSRS.MaxCol];
        for (int j = 2; j <= tSSRS.MaxCol; j++) {
          tOrderInfo[j - 2] = tSSRS.GetText(i, j - 1);
        }
        String tmobile = tSSRS.GetText(i, tSSRS.MaxCol);
        LisIDEA md = new LisIDEA();
        try {
          tmobile = md.decryptString_pre(tmobile);
        } catch (Exception ex) {

        }
        tOrderInfo[tSSRS.MaxCol - 1] = tmobile;
        this.setOrderInfo(tOrderInfo);
        orderInfoList.add(tOrderInfo);
      }
    }
  }
  private String getWherePart(ArrayList<String[]> list) {
    // 得到系统用户来源,来确定该该用户来源于那个网站
    getSysUserSource();

    String[] arr = null;
    StringBuffer strBuff = new StringBuffer(" ");
    if (applyStDate != null && !"".equals(applyStDate)) {
      // String stDate = format.format(applyStDate);
      strBuff.append(" and ord.applyDate >= to_date(?,'yyyy-mm-dd')");

      arr = new String[2];
      arr[0] = "String";
      arr[1] = applyStDate;
      list.add(arr);
    }
    if (applyEdDate != null && !"".equals(applyEdDate)) {
      // String edDate = format.format(applyEdDate);
      strBuff.append(" and ord.applyDate <= to_date(?,'yyyy-mm-dd')");

      arr = new String[2];
      arr[0] = "String";
      arr[1] = applyEdDate;
      list.add(arr);
    }
    if (orderState != null && !"".equals(orderState.trim())) {
      strBuff.append(" and ord.orderState=? ");

      arr = new String[2];
      arr[0] = "String";
      arr[1] = orderState;
      list.add(arr);
    }
    if (mngComCity != null && !"".equals(mngComCity.trim())) {
      strBuff.append(" and ord.ManageCom=? ");

      arr = new String[2];
      arr[0] = "String";
      arr[1] = mngComCity;
      list.add(arr);
    }

    if (currency != null && !"".equals(currency.trim())) {
      if (this.getSysUserSourceT() != null && !"".equals(this.getSysUserSourceT())) {
        if (!this.getSysUserSourceT().equals("admin")) {
          strBuff.append(" and cont.currency=? ");

          arr = new String[2];
          arr[0] = "String";
          arr[1] = this.getSysUserSourceT().trim();
          list.add(arr);

        } else {
          strBuff.append(" and cont.currency=? ");

          arr = new String[2];
          arr[0] = "String";
          arr[1] = this.currency.trim();
          list.add(arr);
        }
      } else {
        strBuff.append(" and cont.currency=? ");

        arr = new String[2];
        arr[0] = "String";
        arr[1] = this.currency.trim();
        list.add(arr);
      }
    } else {
      if (this.getSysUserSourceT() != null && !"".equals(this.getSysUserSourceT())) {
        if (!this.getSysUserSourceT().equals("admin")) {
          strBuff.append(" and cont.currency=? ");

          arr = new String[2];
          arr[0] = "String";
          arr[1] = this.getSysUserSourceT().trim();
          list.add(arr);
        }
      }
    }

    if (productCode != null && !"".equals(productCode.trim())) {
      strBuff.append(" and ord.contplanCode=? ");

      arr = new String[2];
      arr[0] = "String";
      arr[1] = this.productCode.trim();
      list.add(arr);
    }

    if (name != null && !"".equals(name.trim())) {
      strBuff.append(" and cont.appntname=? ");

      arr = new String[2];
      arr[0] = "String";
      arr[1] = name.trim();
      list.add(arr);
    }
    if (orderNo != null && !"".equals(orderNo.trim())) {
      strBuff.append(" and ord.orderno=? ");

      arr = new String[2];
      arr[0] = "String";
      arr[1] = orderNo.trim();
      list.add(arr);
    }

    if (mobile != null && !"".equals(mobile.trim())) {
      System.out.println("000033333");
      LisIDEA tLisIdea = new LisIDEA();
      System.out.println("00003344" + mobile);
      String tmobile = "";
      try {
        tmobile = tLisIdea.encryptDBString(mobile);
        System.out.println("99999999" + tmobile);

      } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        System.out.println("订单查询手机号码编码错误");
      }
      //  String tmobile = tLisIdea.decryptString_pre(mobile.trim());
      // System.out.println("111111"+tmobile);
      strBuff.append(
          " and (select addr.mobile from lecaddress addr where addr.customerno = cont.appntno and addr.addressno = appnt.addressno)= ?");

      arr = new String[2];
      arr[0] = "String";
      arr[1] = tmobile;
      list.add(arr);
    }

    /*if(this.getSysUserSourceT()!=null && !"".equals(this.getSysUserSourceT())&& !this.getSysUserSourceT().equals("admin")){

        System.out.println("测试");
        strBuff.append(" and cont.currency='");
    	strBuff.append(this.getSysUserSourceT().trim());
    	strBuff.append("'");
    }*/

    return strBuff.toString();
  }
  /** 保存数据 */
  public void save() {
    if (this.getSiteName() == null || "".equals(this.getSiteName())) {
      operateResult = "Fail|" + "网站名称不能为空!";
      return;
    }

    if (this.getSiteCode() == null || "".equals(this.getSiteCode())) {
      operateResult = "Fail|" + "网站缩写不能为空!";
      return;
    }

    if (this.getProductCode() == null || "".equals(this.getProductCode())) {
      operateResult = "Fail|" + "产品不能为空!";
      return;
    }

    if (this.getSiteType() == null || "".equals(this.getSiteType())) {
      operateResult = "Fail|" + "网站类型不能为空!";
      return;
    }
    if (this.payModelList == null || this.payModelList.length < 1) {
      operateResult = "Fail|" + "支付方式不能为空!";
      return;
    }

    String type = "";
    String sql =
        "select siteCode,siteType from ledadsource where siteCode='" + this.getSiteCode() + "'";
    ExeSQL tExeSQL = new ExeSQL();
    SSRS tSSRS = new SSRS();
    tSSRS = tExeSQL.execSQL(sql);
    int row = tSSRS.getMaxRow();
    if (row > 0) {
      type = tSSRS.GetText(1, 2);
      if (!this.getSiteType().equals(type)) {
        operateResult = "Fail|网站编码在数据库中已存在,输入的网站类型与存在的不一致!";
        return;
      }
    }

    sql =
        "select siteCode from ledadsource where "
            + "siteCode='"
            + this.getSiteCode()
            + "' "
            + "and productcode='"
            + this.getProductCode()
            + "'";
    tExeSQL = new ExeSQL();
    tSSRS = new SSRS();
    tSSRS = tExeSQL.execSQL(sql);
    row = tSSRS.getMaxRow();
    if (row > 0) {
      operateResult = "Fail|" + "添加失败!该数据在数据库中已存在!";
      return;
    }
    if ("all".equals(this.getProductCode())) {
      this.setVisitedPage("首页面");
    } else if ("register".equals(this.getProductCode())) {
      this.setVisitedPage("注册页面");
    } else if ("actIndex".equals(this.getProductCode())) {
      this.setVisitedPage("宣传页面");
    } else if ("readIndex".equals(this.getProductCode())) {
      this.setVisitedPage("阅读投保须知页面");
    } else {
      sql =
          "select contplanname from lepplan where contplancode='"
              + this.getProductCode()
              + "' and plantype='00'";
      this.setVisitedPage(tExeSQL.getOneValue(sql));
    }

    String siteUrl = "http://icare.metlife.com.cn/visit.jsf?source=";
    LisIDEA tLisIDEA = new LisIDEA();
    siteUrl = siteUrl + tLisIDEA.encryptString(this.getSiteCode());
    siteUrl = siteUrl + "&product=" + tLisIDEA.encryptString(this.getProductCode());
    LEDAdSourceSchema tLEDAdSourceSchema = new LEDAdSourceSchema();
    tLEDAdSourceSchema.setContent(this.getContent());
    tLEDAdSourceSchema.setProductCode(this.getProductCode());
    tLEDAdSourceSchema.setSiteCode(this.getSiteCode());
    tLEDAdSourceSchema.setSiteName(this.getSiteName());
    tLEDAdSourceSchema.setSiteType(this.getSiteType());
    tLEDAdSourceSchema.setUrl(siteUrl);
    tLEDAdSourceSchema.setPayMode(this.getPayMode());
    tLEDAdSourceSchema.setVisitedPage(this.getVisitedPage());
    MMap map = new MMap();
    map.put(tLEDAdSourceSchema, "INSERT");

    PubSubmit tPubSubmit = new PubSubmit();
    VData cVData = new VData();
    cVData.add(map);
    if (!tPubSubmit.submitData(cVData, "")) {
      operateResult = "Fail|添加失败";
      return;
    } else {
      operateResult = "Succ|添加成功";
      initData();
      find();
      return;
    }
  }