Пример #1
0
  /** 保存数据 */
  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;
    }
  }