示例#1
0
  /** 添加/编辑 */
  private int addOrEdit(t_products product) {
    product.time = new Date(); // 时间
    product.name = this.name; // 名称
    product.fit_crowd = this.fitCrowd; // 适合人群
    product.characteristic = this.characteristic; // 特点、亮点
    product.min_amount = this.minAmount; // 借款金额下限
    product.max_amount = this.maxAmount; // 借款金额上限
    product.min_invest_amount = this.minInvestAmount; // 最低投标金额
    product.min_interest_rate = this.minInterestRate; // 利率下限
    product.max_interest_rate = this.maxInterestRate; // 利率上限
    product.credit_id = this.creditId; // 信用积分Id
    product.max_copies = this.maxCopies; // 最高拆分份数
    product.period_year = this.periodYear; // 年期限单位
    product.period_month = this.periodMonth; // 月期限单位
    product.period_day = this.periodDay; // 日期限单位
    product.audit_cycle = this.auditCycle; // 审核周期
    product.applicant_condition = this.applicantCondition; // 申请条件
    product.loan_type = this.loanType; // 1 秒还 2 净值 3 普通
    product.bail_scale = this.bailScale; // 保证金百分比
    product.is_deal_password = Constants.IPS_ENABLE ? false : this.isDealPassword; // 是否需要交易密码
    product._order = this.order; // 排序
    product.show_type = this.showType; // 显示方式
    product.small_image_filename = this.smallImageFilename; // 借款小图标
    product.name_image_filename = this.nameImageFilename; // 借款标题图片
    product.mark = UUID.randomUUID().toString();
    product.invest_period = this.investPeriod; // 投标期限
    product.repayment_type_id = this.splitRepaymentType(this.repaymentTypeId); // 还款方式
    // product.is_use = this.isUse; // 默认为上架
    // product.is_agency = this.isAgency; // 产品模式(非合作机构标)

    int _loanImageType = this.loanImageType;
    product.loan_image_type = _loanImageType; // 借款图片上传方式

    if (_loanImageType == Constants.PLATFORM_UPLOAD) {
      product.loan_image_filename = this.loanImageFilename; // 平台上传图片
    } else {
      product.loan_image_filename = ""; // 用户自己上传图片
    }

    try {
      product.save();
    } catch (Exception e) {
      e.printStackTrace();
      Logger.error("产品->添加产品基本资料:" + e.getMessage());

      return -1;
    }

    return 1;
  }