Exemple #1
0
  /**
   * 方法描述:修改求购表信息
   *
   * @return
   * @throws Exception
   */
  public String update() throws Exception {
    String id = buy.getBuy_id();
    // 判断实体ID是否存在,若不存在该实体,返回到列表页,不进行任何操作
    if (ValidateUtil.isDigital(id)) {
      return list();
    }
    // 用于所属分类的回选开始
    loadCategory();
    // 用于所属地区的回选开始
    loadArea();
    // 验证分类是选择
    validateCategoryIfSelect();
    // 验证地区是选择
    validateAreaIfSelect();
    // 将处理后的所属分类串注入到buy对象中
    this.buy.setCat_attr(cat_attr);
    this.buy.setArea_attr(area_attr);
    // 获取会员的cust_id
    String cust_id = "";
    if (this.buy.getBuy_id() != null && !"".equals(this.buy.getBuy_id())) {
      Buy buy_class = this.buyService.get(this.buy.getBuy_id());
      if (buy_class != null && buy_class.getCust_id() != null) {
        cust_id = buy_class.getCust_id();
      }
    }
    // 获取客户标识
    this.buy.setCust_id(cust_id);
    this.buy.setUser_id(this.session_user_id);
    // 数据库原有的分类串
    supply_infoattr_id = buy.getInfoattr_id();
    // 判断是否为支持分类属性,如果是的话则处理属性信息
    sysmodule = this.sysmoduleService.get("buy");
    if (sysmodule != null && "0".equals(sysmodule.getIs_catattr())) {
      String infoattr_id = RandomStrUtil.getNumberRand();
      this.buy.setInfoattr_id(infoattr_id);
      // 信息属性的处理
      super.checkMust(infoattr_id);
    } else {
      supply_infoattr_id = null;
    }

    // 字段验证
    super.commonValidateField(buy);
    if (super.ifvalidatepass) {
      return view();
    }
    this.buyService.update(buy, objList, supply_infoattr_id);
    // 当审核通过时更新页面
    if ("1".equals(this.buy.getInfo_state())) {
      // 对插入成功的信息生成HTML静态页面
      DoHtml doHtml = new DoHtml();
      doHtml.doArticleHtml(modType, this.buy.getBuy_id());
    }
    this.addActionMessage("修改求购信息成功");
    return list();
  }
Exemple #2
0
  /**
   * 方法描述:新增求购表
   *
   * @return
   * @throws Exception
   */
  public String insert() throws Exception {
    // 用于所属分类的回选开始
    loadCategory();
    // 用于所属地区的回选开始
    loadArea();
    // 验证分类是选择
    validateCategoryIfSelect();
    // 验证地区是选择
    // validateAreaIfSelect();
    // 将处理后的所属分类串注入到buy对象中
    this.buy.setCat_attr(cat_attr);
    this.buy.setArea_attr(area_attr);
    // 用于所属地区的回选结束
    // 获取客户标识
    this.buy.setCust_id(this.session_cust_id);
    this.buy.setUser_id(this.session_user_id);

    // 判断是否为支持分类属性,如果是的话则处理属性信息
    sysmodule = this.sysmoduleService.get("buy");
    if (sysmodule != null && "0".equals(sysmodule.getIs_catattr())) {
      // 信息属性的处理
      String infoattr_id = RandomStrUtil.getNumberRand();
      this.buy.setInfoattr_id(infoattr_id);
      super.checkMust(infoattr_id);
    }
    if (this.session_cust_type.equals(Constants.MEMBER_TYPE)) {
      // 发布信息数量控制
      if (controlInfoNum()) {
        return cate();
      }
    }
    // 字段验证
    super.commonValidateField(buy);
    if (super.ifvalidatepass) {
      return cate();
    }
    // 获取刚刚插入成功的记录的ID
    String buy_id = this.buyService.insertGetPk(buy, objList);
    // 对插入成功的信息生成HTML静态页面
    DoHtml doHtml = new DoHtml();
    doHtml.doArticleHtml(modType, buy_id);
    this.addActionMessage("新增求购信息成功");
    this.buy = null;
    is_crotorl = true;
    return cate();
  }