Exemplo n.º 1
0
 public OrderBO queryClientOrderById(String cliOrdMasterId) throws Exception {
   OrderBO orderBo = new OrderBO();
   String queryMasterSql =
       "select * from clientorder c, user u where c.user_id=u.user_id and c.del_state = 0 and c.cliOrdMaster_id='"
           + cliOrdMasterId
           + "'";
   String queryDetailSql =
       "select * from clientorderdetail d where d.cliOrdMaster_id='" + cliOrdMasterId + "'";
   List<ClientOrderBO> cordlist =
       super.genericDAO.findBySqlToObj(queryMasterSql, ClientOrderBO.class);
   List<ClientOrderDetailBO> corddlist =
       super.genericDAO.findBySqlToObj(queryDetailSql, ClientOrderDetailBO.class);
   if (cordlist.size() > 0 && cordlist.size() == 1 && corddlist.size() > 0) {
     ClientOrderBO clientOrderBo = cordlist.get(0);
     String queryAgentFormulaSql =
         "select * from formula where user_id in (select parent_agent_id from user where user_id="
             + clientOrderBo.getUserId()
             + ")";
     List<FormulaBO> formulalist =
         super.genericDAO.findBySqlToObj(queryAgentFormulaSql, FormulaBO.class);
     if (formulalist.size() > 0 && formulalist.size() == 1) {
       FormulaBO formulaBo = formulalist.get(0);
       clientOrderBo.setCostTotal(
           StringUtil.doubleFmt(clientOrderBo.getMidTotal() / formulaBo.getRate()));
     } else {
       clientOrderBo.setCostTotal(StringUtil.doubleFmt(clientOrderBo.getMidTotal()));
     }
     clientOrderBo.setMidTotal(StringUtil.doubleFmt(clientOrderBo.getMidTotal()));
     clientOrderBo.setTotal(StringUtil.doubleFmt(clientOrderBo.getTotal()));
     orderBo.setClientOrderBo(clientOrderBo);
     orderBo.setClientOrderDetaillist(corddlist);
   }
   return orderBo;
 }
Exemplo n.º 2
0
  public ReturnBO<ClientOrderBO> queryClientOrder(QueryOrderBO queryOrderBo) throws Exception {
    ReturnBO<ClientOrderBO> returnBo = new ReturnBO<ClientOrderBO>();
    StringBuilder querySql =
        new StringBuilder(
            "select distinct * from clientorder c, user u  where c.user_id=u.user_id and c.del_state = 0");
    StringBuilder totalSql =
        new StringBuilder(
            "select distinct * from clientorder c, user u  where c.user_id=u.user_id and c.del_state = 0");
    if (!"".equals(queryOrderBo.getClientName()) && null != queryOrderBo.getClientName()) {
      querySql.append(" and u.user_name like '%").append(queryOrderBo.getClientName()).append("%'");
      totalSql.append(" and u.user_name like '%").append(queryOrderBo.getClientName()).append("%'");
    }
    if (!"".equals(queryOrderBo.getOrderDateFrom())
        && null != queryOrderBo.getOrderDateFrom()
        && !"".equals(queryOrderBo.getOrderDateTo())
        && null != queryOrderBo.getOrderDateTo()) {
      querySql
          .append(" and (c.order_date BETWEEN '")
          .append(queryOrderBo.getOrderDateFrom())
          .append("' and '")
          .append(queryOrderBo.getOrderDateTo())
          .append("')");
      totalSql
          .append(" and (c.order_date BETWEEN '")
          .append(queryOrderBo.getOrderDateFrom())
          .append("' and '")
          .append(queryOrderBo.getOrderDateTo())
          .append("')");
    }
    if (!"".equals(queryOrderBo.getOrderNo()) && null != queryOrderBo.getOrderNo()) {
      querySql.append(" and c.order_no like '").append(queryOrderBo.getOrderNo()).append("%'");
      totalSql.append(" and c.order_no like '").append(queryOrderBo.getOrderNo()).append("%'");
    }
    querySql
        .append(" order by c.order_date desc")
        .append(" limit ")
        .append(queryOrderBo.getStart())
        .append(", ")
        .append(queryOrderBo.getPageSize());

    List<ClientOrderBO> list =
        super.genericDAO.findBySqlToObj(querySql.toString(), ClientOrderBO.class);
    for (ClientOrderBO clientOrderBo : list) {
      clientOrderBo.setMidTotal(StringUtil.doubleFmt(clientOrderBo.getMidTotal()));
      clientOrderBo.setTotal(StringUtil.doubleFmt(clientOrderBo.getTotal()));
    }
    List totallist = super.genericDAO.findBySqlToObj(totalSql.toString(), null);
    returnBo.setPageSize(queryOrderBo.getPageSize());
    returnBo.setStart(queryOrderBo.getStart());
    returnBo.setReturnBolist(list);
    returnBo.setType(2);
    returnBo.setTotalSize(totallist.size());
    return returnBo;
  }
Exemplo n.º 3
0
  @Override
  public List findCentOrderList(
      Long userId,
      ClientOrderBO clientOrderBo,
      ClientorderFacade clientOrderFacade,
      Integer pageSize)
      throws Exception {
    StringBuilder HQL =
        new StringBuilder("from Clientorder where userId=")
            .append(userId)
            .append(" and delState ='0'");

    if (!StringUtil.isEmpty(clientOrderBo.getOrderNo())) {
      HQL.append(" and orderNo like '%").append(clientOrderBo.getOrderNo()).append("%' ");
    }
    if (!StringUtil.isEmpty(clientOrderBo.getBuyerName())) {
      HQL.append(" and buyerName like '%").append(clientOrderBo.getBuyerName()).append("%' ");
    }
    if (!"-1".equals(clientOrderBo.getOrderStatus())) {
      HQL.append(" and orderStatus='").append(clientOrderBo.getOrderStatus()).append("' ");
    }
    if (!StringUtil.isEmpty(clientOrderBo.getOrderDateFr())
        && !StringUtil.isEmpty(clientOrderBo.getOrderDateTo())) {
      HQL.append(" and (orderDate between '")
          .append(clientOrderBo.getOrderDateFr())
          .append("' and '")
          .append(clientOrderBo.getOrderDateTo())
          .append("') ");
    }
    if (!StringUtil.isEmpty(clientOrderBo.getOrderPriceFr())
        && !StringUtil.isEmpty(clientOrderBo.getOrderPriceTo())) {
      HQL.append(" and (midTotal >= ")
          .append(clientOrderBo.getOrderPriceFr())
          .append(" and midTotal <= ")
          .append(clientOrderBo.getOrderPriceTo())
          .append(") ");
    }

    HQL.append(" order by orderDate desc");
    String url = "findCentOrderList.action?a=1";
    List list =
        Page.util(
            ServletActionContext.getRequest(), url, clientOrderFacade, HQL.toString(), pageSize);
    return list;
  }