Ejemplo n.º 1
0
  /**
   * 添加
   *
   * @param info 信息值
   * @return ? > 0 : success; ? < 0 : fail
   */
  public void create(ErrorInfo error) {
    error.clear();

    t_products product = new t_products();
    product.is_use = Constants.ENABLE;
    product.is_agency = Constants.NOT_IS_AGENCY;
    // product.fee_description = this.feeDescription; // 手续费描述(常量值读取拼接,无需编辑)

    /* 添加基本信息 */
    error.code = this.addOrEdit(product);

    if (error.code < 0) {
      error.code = -1;
      error.msg = error.FRIEND_INFO + "添加基本信息失败!";

      return;
    }

    /* 添加对应的审核资料 */
    error.code = this.addProductAudit(product.id, product.mark);

    if (error.code < 0) {
      error.code = -2;
      error.msg = error.FRIEND_INFO + "添加审核资料失败!";

      return;
    }

    /* 添加标签和字段 */
    error.code = this.addProductLableAndFiled(product.id, error);

    if (error.code < 0) {
      error.code = -3;
      error.msg = error.FRIEND_INFO + "添加产品标签/字段失败!";

      return;
    }

    /* 添加事件 */
    DealDetail.supervisorEvent(
        Supervisor.currSupervisor().id, SupervisorEvent.CREATE_PRODUCT, "添加产品", error);

    if (error.code < 0) {
      JPA.setRollbackOnly();
      error.msg = "保存失败!";

      return;
    }
  }
Ejemplo n.º 2
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;
  }