Ejemplo n.º 1
0
  /** 坏账借款标列表 */
  public static void badList() {
    ErrorInfo error = new ErrorInfo();
    PageBean<v_bid_bad> pageBean = new PageBean<v_bid_bad>();
    pageBean.page = Bid.queryBidBad(pageBean, 0, error, getParameter(pageBean, null));

    render(pageBean);
  }
Ejemplo n.º 2
0
  /** 审核中的借款标列表 */
  public static void auditingList() {
    ErrorInfo error = new ErrorInfo();
    PageBean<v_bid_auditing> pageBean = new PageBean<v_bid_auditing>();
    pageBean.page = Bid.queryBidAuditing(pageBean, error, getParameter(pageBean, null));

    render(pageBean);
  }
Ejemplo n.º 3
0
  /** 未通过的借标列表款 */
  public static void notThroughList() {
    ErrorInfo error = new ErrorInfo();
    PageBean<v_bid_not_through> pageBean = new PageBean<v_bid_not_through>();
    pageBean.page = Bid.queryBidNotThrough(pageBean, error, getParameter(pageBean, null));

    render(pageBean);
  }
Ejemplo n.º 4
0
  /** 已完成的借款标列表的搜索 */
  public static void repaymentList() {
    ErrorInfo error = new ErrorInfo();
    PageBean<v_bid_repayment> pageBean = new PageBean<v_bid_repayment>();
    pageBean.page = Bid.queryBidRepayment(pageBean, 0, error, getParameter(pageBean, null));

    render(pageBean);
  }
Ejemplo n.º 5
0
  /** 逾期的借款标 */
  public static void overdueList() {
    ErrorInfo error = new ErrorInfo();
    PageBean<v_bid_overdue> pageBean = new PageBean<v_bid_overdue>();
    pageBean.page = Bid.queryBidOverdue(pageBean, error, getParameter(pageBean, null));

    render(pageBean);
  }
Ejemplo n.º 6
0
  /** 满标待放款 */
  public static void fullList() {
    ErrorInfo error = new ErrorInfo();
    PageBean<v_bid_fundraiseing> pageBean = new PageBean<v_bid_fundraiseing>();
    pageBean.page =
        Bid.queryBidFundraiseing(pageBean, Constants.V_FULL, error, getParameter(pageBean, null));

    render(pageBean);
  }
Ejemplo n.º 7
0
  /** 还款情况 */
  public static void repaymentSituation(int currPage, long bidId) {

    if (0 == bidId) render();

    ErrorInfo error = new ErrorInfo();
    PageBean<v_bill_loan> pageBean = new PageBean<v_bill_loan>();
    pageBean.currPage = currPage;
    pageBean.page = Bill.queryMyLoanBills(pageBean, -1, bidId, error);

    render(pageBean);
  }
Ejemplo n.º 8
0
  /** 投标记录 */
  public static void bidRecord(int currPage, long bidId) {

    if (0 == bidId) render();

    ErrorInfo error = new ErrorInfo();
    PageBean<v_invest_records> pageBean = new PageBean<v_invest_records>();
    pageBean.currPage = currPage;
    pageBean.page = Invest.bidInvestRecord(pageBean, bidId, error);

    render(pageBean);
  }
Ejemplo n.º 9
0
  /** 举报记录 */
  public static void reportRecord(int currPage, String signUserId) {
    ErrorInfo error = new ErrorInfo();
    long userId =
        Security.checkSign(signUserId, Constants.USER_ID_SIGN, Constants.VALID_TIME, error);

    if (userId < 1) renderText(error.msg);

    PageBean<t_user_report_users> pageBean = new PageBean<t_user_report_users>();
    pageBean.currPage = currPage;
    pageBean.page = User.queryBidRecordByUser(pageBean, userId, error);

    render(pageBean);
  }
Ejemplo n.º 10
0
  /**
   * 获取 参数值
   *
   * @param pageBean 当前模板PageBean
   * @return String [] 参数值
   */
  public static String[] getParameter(PageBean pageBean, String userId) {
    String currPage = params.get("currPage"); // 当前页
    String pageSize = params.get("pageSize"); // 分页行数
    String condition = params.get("condition"); // 条件
    String keyword = params.get("keyword"); // 关键词
    String startDate = params.get("startDate"); // 开始时间
    String endDate = params.get("endDate"); // 结束时间
    String orderIndex = params.get("orderIndex"); // 排序索引
    String orderStatus = params.get("orderStatus"); // 升降标示

    pageBean.currPage = NumberUtil.isNumericInt(currPage) ? Integer.parseInt(currPage) : 1;
    pageBean.pageSize = NumberUtil.isNumericInt(pageSize) ? Integer.parseInt(pageSize) : 10;

    /* ""/null:标示非用户ID查询  */
    return new String[] {userId, condition, keyword, startDate, endDate, orderIndex, orderStatus};
  }
Ejemplo n.º 11
0
  /**
   * 查询数据库操作记录
   *
   * @param error
   * @return
   */
  public static PageBean<v_db_operations> queryOperations(
      int currPage, int pageSize, ErrorInfo error) {
    error.clear();

    if (currPage < 1) {
      currPage = 1;
    }

    if (pageSize < 1) {
      pageSize = 10;
    }

    StringBuffer sql = new StringBuffer("");
    sql.append(SQLTempletes.PAGE_SELECT);
    sql.append(SQLTempletes.V_DB_OPERATIONS);

    List<v_db_operations> page = null;
    int count = 0;

    try {
      EntityManager em = JPA.em();
      Query query = em.createNativeQuery(sql.toString(), v_db_operations.class);
      query.setFirstResult((currPage - 1) * pageSize);
      query.setMaxResults(pageSize);
      page = query.getResultList();
      count = QueryUtil.getQueryCount(em);
    } catch (Exception e) {
      Logger.error(e.getMessage());
      error.code = -1;
      error.msg = "数据库异常";

      return null;
    }

    PageBean<v_db_operations> bean = new PageBean<v_db_operations>();
    bean.pageSize = pageSize;
    bean.currPage = currPage;
    bean.page = page;
    bean.totalCount = count;

    error.code = 0;

    return bean;
  }
Ejemplo n.º 12
0
  /**
   * 产品管理,产品列表
   *
   * @param error 产品名称
   * @param error 信息值
   * @return List<Product>
   */
  public static List<Product> queryProduct(
      PageBean<Product> pageBean, String name, ErrorInfo error) {
    error.clear();

    int count = 0;
    String condition = "1=1";

    if (StringUtils.isNotBlank(name)) {
      condition += name == null ? "" : " AND name LIKE '%" + name + "%'";

      pageBean.conditions = new HashMap<String, Object>();
      pageBean.conditions.put("name", name);
    }

    try {
      /* 得到总记录数 */
      count = (int) t_products.count(condition);
    } catch (Exception e) {
      e.printStackTrace();
      Logger.error("标->产品管理,产品列表,查询总记录数:" + e.getMessage());
      error.msg = error.FRIEND_INFO + "产品列表加载失败!";

      return null;
    }

    List<Product> products = new ArrayList<Product>();

    if (count < 0) return products;

    pageBean.totalCount = count;
    List<t_products> tproducts = null;
    String hql =
        "select new t_products"
            + "(id, name, time, credit_id, min_interest_rate, max_interest_rate, min_amount, max_amount, is_agency, is_use, _order)"
            + " from t_products where "
            + condition
            + " order by _order, time";

    try {
      tproducts = t_products.find(hql).fetch(pageBean.currPage, pageBean.pageSize);
    } catch (Exception e) {
      e.printStackTrace();
      Logger.error("产品->管理,产品列表部分字段查询:" + e.getMessage());
      error.msg = error.FRIEND_INFO + "产品列表加载失败!";

      return null;
    }

    if (null == tproducts) return products;

    Product product = null;
    String _creditImageFilename = null;
    long _creditId = -1;
    long _pid = -1;

    for (t_products pro : tproducts) {
      product = new Product();

      _creditId = pro.credit_id;
      /* 最低信用积分图标 */
      _creditImageFilename = CreditLevel.queryImageFilename(_creditId, error);

      _pid = pro.id;
      // 审核资料数量
      count = ProductAuditItem.queryAuditCount(_pid, error);

      product.name = pro.name;
      product.time = pro.time;
      product.minInterestRate = pro.min_interest_rate;
      product.maxInterestRate = pro.max_interest_rate;
      product.minAmount = pro.min_amount;
      product.maxAmount = pro.max_amount;
      product.isAgency = pro.is_agency;
      product.isUse = pro.is_use;
      product.order = pro._order;
      product._id = _pid;
      product.creditId = _creditId;
      product.auditCount = count;
      product.creditImageFilename = _creditImageFilename;

      products.add(product);
    }

    error.code = 0;

    return products;
  }
Ejemplo n.º 13
0
  /**
   * 合作结构列表
   *
   * @param pageBean 分页对象
   * @param error 信息值
   * @return List<v_agencies>
   */
  public static List<v_agencies> queryAgencies(
      PageBean<v_agencies> pageBean, ErrorInfo error, String condition, String keyword) {
    error.clear();

    int count = -1;
    StringBuffer conditions = new StringBuffer(" where 1 = 1");
    List<Object> values = new ArrayList<Object>();
    Map<String, Object> conditionmap = new HashMap<String, Object>();

    /* 组装条件 */
    if (NumberUtil.isNumericInt(condition)) {

      switch (Integer.parseInt(condition)) {
          /* 编号搜索 */
        case Constants.AGENCY_SEARCH_ID:
          conditions.append(" AND no LIKE ?");
          values.add("%" + keyword + "%");

          break;

          /* 名称搜索 */
        case Constants.AGENCY_SEARCH_NAME:
          conditions.append(" AND name LIKE ?");
          values.add("%" + keyword + "%");

          break;

          /* 全部搜索 */
        case Constants.SEARCH_ALL:
          if (StringUtils.isBlank(keyword)) break;

          conditions.append(" AND (no LIKE ? OR name LIKE ?)");
          values.add("%" + keyword + "%");
          values.add("%" + keyword + "%");

          break;
      }

      conditionmap.put("condition", condition);
      conditionmap.put("keyword", keyword);
    }

    pageBean.conditions = conditionmap;

    StringBuffer sql = new StringBuffer();
    sql.append("select count(t.id) from (");
    sql.append(SQLTempletes.V_AGENCIES);
    sql.append(")");
    sql.append(SQLTempletes.TABLE_NAME);
    sql.append(conditions);

    EntityManager em = JPA.em();
    Query query = em.createNativeQuery(sql.toString());

    for (int n = 1; n <= values.size(); n++) {
      query.setParameter(n, values.get(n - 1));
    }

    List<?> list = null;

    try {
      list = query.getResultList();
    } catch (Exception e) {
      Logger.error("合作机构->合作结构列表,查询总记录数:" + e.getMessage());
      error.msg = error.FRIEND_INFO + "加载合作结构列表失败!";
    }

    count = list == null ? 0 : Integer.parseInt(list.get(0).toString());

    if (count < 1) return new ArrayList<v_agencies>();

    pageBean.totalCount = count;

    sql = new StringBuffer();
    sql.append("select t.* from (");
    sql.append(SQLTempletes.V_AGENCIES);
    sql.append(")");
    sql.append(SQLTempletes.TABLE_NAME);
    sql.append(conditions);
    sql.append(" order by t.id desc");

    query = em.createNativeQuery(sql.toString(), v_agencies.class);

    for (int n = 1; n <= values.size(); n++) {
      query.setParameter(n, values.get(n - 1));
    }

    query.setFirstResult((pageBean.currPage - 1) * pageBean.pageSize);
    query.setMaxResults(pageBean.pageSize);

    try {
      return query.getResultList();
    } catch (Exception e) {
      e.printStackTrace();
      Logger.error("标->合作结构列表:" + e.getMessage());
      error.msg = error.FRIEND_INFO + "加载合作结构列表失败!";

      return null;
    }
  }