Beispiel #1
0
 /**
  * 更具订单id和用户id查询订单的详细信息 包括实名认证信息和发票信息<br>
  *
  * @author 冯鑫 <br>
  *     2014-4-22
  * @update 侯杨
  * @param orderId 订单id 必须不为空 userId 当前登录用户id 必须不为空
  * @return OrderData
  */
 public OrderData findAllOrderDatebyOrderId(String orderId) {
   OrderData orderData = orderPersistence.retrieve(orderId); // 订单的信息
   BusinessUserData bUserData = getBuserByOrderId(orderId); // 根据订单id查询认证信息
   List<OrderProductData> orderProductDatas = getOPsByOrderId(orderId); // 根据订单id查询订单服务中间表信息
   // 不是官方发布权限
   if (orderProductDatas.get(0).getPageId() != null
       && !"".equals(orderProductDatas.get(0).getPageId())) {
     // 查询page表
     PageData pageData = pagePersistence.retrieve(orderProductDatas.get(0).getPageId());
     // 查询page域名信息
     PageInfoExtraData pageInfoExtraData = new PageInfoExtraData();
     pageInfoExtraData.setType("2");
     pageInfoExtraData.setPageId(pageData.getId());
     pageInfoExtraData = pageInfoExtraPersistence.searchByPageInfoExtraData(pageInfoExtraData);
     pageData.setPageInfoExtra(pageInfoExtraData);
     orderData.setPageData(pageData);
   }
   orderData.setBusinessUserData(bUserData);
   orderData.setOrderProductDatas(orderProductDatas);
   if (null != orderData
       && orderData.getInvoiceId() != null
       && !"".equals(orderData.getInvoiceId())) {
     InvoiceData invoiceData = invoicePersistence.retrieve(orderData.getInvoiceId());
     orderData.setInvoiceData(invoiceData);
   }
   return orderData;
 }
  /**
   * 根据订单商品信息中间表Id查询的商品订单信息(后台)
   *
   * @author 左香勇 2014-9-15
   * @update
   * @param consumerOrderGoodsinfoDataId 订单商品信息中间表id
   * @return ConsumerOrderGoodsinfoData 订单商品信息中间实体
   * @since vmaque 1.5
   */
  public ConsumerOrderGoodsinfoData getConSumerOrderGoodsInfoDataById(
      String consumerOrderGoodsinfoDataId) {
    // 定义查询语句
    StringBuffer querySql = new StringBuffer("SELECT ");
    querySql.append("MCG.ID AS ID,MCG.GOODSNUM AS GOODSNUM,");
    querySql.append("MCO.ID AS CONSUMERORDERID,MCO.PRICE AS PRICE,MCO.STATE AS STATE,");
    querySql.append("MCO.CREATETIME AS CREATETIME,MCO.LOGISTICSCOMPANY AS LOGISTICSCOMPANY,");
    querySql.append("MCO.LOGISTICSNUMBER AS LOGISTICSNUMBER,MCO.DELIVERTIME AS DELIVERTIME,");
    querySql.append("MCC.CONFIGNAME AS CONFIGNAME,");
    querySql.append("MGI.GOODSNAME AS GOODSNAME,");
    querySql.append(
        "MCU.USERNAME AS USERNAME,MCU.USERADDRESS AS USERADDRESS,MCU.USERMOBILE AS USERMOBILE,");
    querySql.append("MPE.DOMAIN AS DOMAIN,MPG.NAME AS PAGENAME,");
    querySql.append("CSU.RECEIVABLEACCOUNT AS RECEIVABLEACCOUNT,CSU.ACCOUNTTYPE AS ACCOUNTTYPE,");
    querySql.append("CSU.LOGINMAIL AS LOGINMAIL,CSU.LOGINMOBLE AS LOGINMOBLE ");
    querySql.append("FROM MINI_CONSUMERORDER_GOODSINFO MCG ");
    querySql.append("JOIN MINI_CONSUMERORDER MCO ON MCG.CONSUMERORDERID = MCO.ID ");
    querySql.append("JOIN MINI_COMMODITYCONFIG MCC ON MCG.COMMODITYCONFIGID = MCC.ID ");
    querySql.append("JOIN MINI_GOODSINFO MGI ON MCG.GOODSINFID = MGI.ID ");
    querySql.append("JOIN MINI_CONSUMERUSER MCU ON MCO.CONSUMERUSERID = MCU.ID ");
    querySql.append("JOIN MINI_PAGE MPG ON MCO.PAGEID=MPG.ID ");
    querySql.append("JOIN CTN_SYSUSER CSU ON MPG.USER_ID=CSU.ID ");
    querySql.append("RIGHT JOIN MINI_PAGE_INFO_EXTRA MPE ON MPG.ID=MPE.PAGE_ID ");
    querySql.append("WHERE MCG.ISDELETE = 1 AND MCO.ISDELETE = 1 ");
    querySql.append("AND MCC.ISDELETE = 1 AND MGI.ISDELETE = 1 AND MCU.ISDELETE = 1 ");
    querySql.append("AND MCG.ID = ?");

    JdbcDao jdbcDao = (JdbcDao) SpringContextHelper.getBean("jdbc"); // 获取jdbc
    List<ETIPResultSet> rsList =
        jdbcDao.queryForList(querySql.toString(), new Object[] {consumerOrderGoodsinfoDataId});

    if (rsList.size() > 0) {
      ConsumerOrderGoodsinfoData consumerOrderGoodsinfoData = new ConsumerOrderGoodsinfoData();
      ConSumerOrderData sumerOrderData = new ConSumerOrderData();
      GoodsInfoData goodsInfoData = new GoodsInfoData();
      CommodityConfigData commodityConfigData = new CommodityConfigData();
      ConSumerUserData conSumerUserData = new ConSumerUserData();
      PageData pageData = new PageData();
      PageInfoExtraData pageInfoExtraData = new PageInfoExtraData();
      UserData userData = new UserData();

      // 给登录用户表添加数据
      userData.setAccountType(rsList.get(0).getInt("ACCOUNTTYPE"));
      userData.setReceivableAccount(rsList.get(0).getString("RECEIVABLEACCOUNT"));
      userData.setLoginMail(rsList.get(0).getString("LOGINMAIL"));
      userData.setLoginMoble(rsList.get(0).getString("LOGINMOBLE"));

      // 给Page信息表添加数据
      pageInfoExtraData.setDomain(rsList.get(0).getString("DOMAIN"));

      // 给page表添加数据
      pageData.setName(rsList.get(0).getString("PAGENAME"));
      pageData.setUserData(userData);
      pageData.setPageInfoExtra(pageInfoExtraData);

      // 给订单用户信息表添加数据
      conSumerUserData.setUserName(rsList.get(0).getString("USERNAME"));
      conSumerUserData.setUserAddress(rsList.get(0).getString("USERADDRESS"));
      conSumerUserData.setUserMobile(rsList.get(0).getString("USERMOBILE"));

      // 给订单表添加数据
      sumerOrderData.setConSumerUserData(conSumerUserData);
      sumerOrderData.setPageData(pageData);
      sumerOrderData.setId(rsList.get(0).getString("CONSUMERORDERID"));
      sumerOrderData.setCreateTime(rsList.get(0).getDate("CREATETIME"));
      sumerOrderData.setPrice(rsList.get(0).getDouble("PRICE"));
      sumerOrderData.setState(rsList.get(0).getInt("STATE"));
      sumerOrderData.setLogisticsCompany(rsList.get(0).getString("LOGISTICSCOMPANY"));
      sumerOrderData.setLogisticsNumber(rsList.get(0).getString("LOGISTICSNUMBER"));
      sumerOrderData.setDeliverTime(rsList.get(0).getDate("DELIVERTIME"));

      // 给规格表添加数据
      commodityConfigData.setConfigName(rsList.get(0).getString("CONFIGNAME"));

      // 给商品表添加数据
      goodsInfoData.setGoodsName(rsList.get(0).getString("GOODSNAME"));

      // 给订单商品中间表添加数据
      consumerOrderGoodsinfoData.setCommodityConfigData(commodityConfigData);
      consumerOrderGoodsinfoData.setGoodsInfoData(goodsInfoData);
      consumerOrderGoodsinfoData.setConSumerOrderData(sumerOrderData);
      consumerOrderGoodsinfoData.setGoodsNum(rsList.get(0).getInt("GOODSNUM"));
      consumerOrderGoodsinfoData.setId(rsList.get(0).getString("ID"));

      return consumerOrderGoodsinfoData;
    }

    return null;
  }