コード例 #1
0
 /**
  * 支付宝提交Form 手机端<br>
  *
  * @author 冯鑫<br>
  *     2014-9-21
  * @update
  * @param
  * @return
  * @exception/throws
  * @see OrderManagerAction#getAlipayForm
  * @since vmaque1.5
  */
 private String getAlipayForm_Phone(
     ConSumerOrderData conSumerOrderData, GoodsInfoData goodsInfoData) {
   HashMap<String, String> hm = new HashMap<String, String>();
   hm.put("body", goodsInfoData.getGoodsDes()); // 填写在跳到支付宝页面上显示的付款内容信息  
   hm.put("subject", goodsInfoData.getGoodsName()); // 填写在跳到支付宝页面上显示的付款标题信息  
   hm.put("out_trade_no", conSumerOrderData.getOrderCode()); // 外部交易号,最好具有唯一性,在获取支付宝发来的付款信息时使用. 
   hm.put("agent", AlipayConfig.partner); // partnerId(合作伙伴ID)
   hm.put("payment_type", "1"); // 支付类型 1=商品购买,2=服务购买,... 
   hm.put("price", String.valueOf(conSumerOrderData.getPrice())); // 订单金额信息   
   /* hm.put("price","0.01");//订单金额信息    */
   hm.put("quantity", "1"); // 订单商品数量,一般都是写1,它是按照整个订单包来计算 
   hm.put(
       "extra_common_param",
       conSumerUserData.getRedPackageId()
           + "_"
           + conSumerUserData.getcId()
           + "_"
           + conSumerUserData.getsId()); // 红包使用自定义参数
   return AlipayService.create_direct_token_by_user(hm); // securityCode(安全码)
 }
コード例 #2
0
  /**
   * 生成订单,跳转到支付宝支付页面<br>
   *
   * @author 冯鑫<br>
   *     2014-9-12
   * @throws IOException
   * @update 侯杨
   * @see OrderManagerAction#toPayOrder
   * @since vmaque1.5
   */
  public String toPayOrder() throws IOException {
    String price = request.getParameter("price");
    String paytype = request.getParameter("paytype"); // 支付方式
    // 商品总价赋值
    conSumerUserData.setPayType(Integer.parseInt(paytype));
    commodityConfigData.setConfigPrice(Double.parseDouble(price));
    conSumerOrderData =
        orderManagerFacade.createOrder(
            commodityConfigData, conSumerUserData, pageDomainName, goodsNum);
    GoodsInfoData goodsInfoData = new GoodsInfoData();
    goodsInfoData.setId(commodityConfigData.getGoodsInfoData().getId());
    goodsInfoData = goodsInfoFacade.getGoodsInfoData(goodsInfoData);
    String alipayForm;

    conSumerOrderData.setPrice(Double.parseDouble(price));
    if (price.equals("0")) {
      request.setAttribute("ordercode", conSumerOrderData.getOrderCode());
      if (conSumerUserData.getRedPackageId() != null
          && !"".equals(conSumerUserData.getRedPackageId())) {
        request.setAttribute("redpackageId", conSumerUserData.getRedPackageId());
        request.setAttribute("cId", conSumerUserData.getcId());
        request.setAttribute("sId", conSumerUserData.getsId());
      }
      return "payForSuccess_order";
    }
    // 如果为1 则是pc支付
    if ("1".equals(pcFlag)) {
      alipayForm = this.getAlipayForm(conSumerOrderData, goodsInfoData); // 支付的表单getAlipayForm_Phone
    } else {
      alipayForm = this.getAlipayForm_Phone(conSumerOrderData, goodsInfoData);
    }
    request.setAttribute("alipayForm", alipayForm);
    return "toPayJsp";
  }
コード例 #3
0
  /**
   * 生成订单,跳转到微信支付<br>
   *
   * @author 侯杨<br>
   *     2015-01-13
   * @throws IOException
   * @update
   * @see OrderManagerAction#toweixinPayOrder
   * @since vmaque2.0
   */
  public void toweixinPayOrder() throws IOException {
    String price = request.getParameter("price");
    String paytype = request.getParameter("paytype"); // 支付方式
    // 商品总价赋值
    conSumerUserData.setPayType(Integer.parseInt(paytype));
    commodityConfigData.setConfigPrice(Double.parseDouble(price));
    conSumerOrderData =
        orderManagerFacade.createOrder(
            commodityConfigData, conSumerUserData, pageDomainName, goodsNum);
    GoodsInfoData goodsInfoData = new GoodsInfoData();
    goodsInfoData.setId(commodityConfigData.getGoodsInfoData().getId());
    goodsInfoData = goodsInfoFacade.getGoodsInfoData(goodsInfoData);

    conSumerOrderData.setPrice(Double.parseDouble(price));
    conSumerOrderData.setGoodsName(goodsInfoData.getGoodsName());
    if (conSumerOrderData != null) {
      conSumerOrderData.setConSumerUserData(conSumerUserData);
      JSONObject object = JSONObject.fromObject(conSumerOrderData);
      response.getWriter().print(object);
    } else {
      response.getWriter().print("1");
    }
  }
コード例 #4
0
  /**
   * 根据查询条件分页查询出符合条件的商品订单信息
   *
   * @author 左香勇 2014-9-9
   * @update
   * @param conSumerOrderData 查询条件实体信息 pageRoll 分页查询对象
   * @return List<ConsumerOrderGoodsinfoData> 符合查询条件商品订单信息集合
   * @since vmaque 1.5
   */
  public List<ConsumerOrderGoodsinfoData> getConSumerOrderGoodsInfoDataList(
      PageRoll pageRoll, ConSumerOrderData conSumerOrderData) {
    // 定义查询语句
    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,MCO.CREATETIME AS CREATETIME,MCO.LOGISTICSCOMPANY AS LOGISTICSCOMPANY,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("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_GOODSINFO MPG ON MPG.PAGEID = MCO.PAGEID ");
    querySql.append(
        "WHERE MCG.ISDELETE = 1 AND MCO.ISDELETE = 1 AND MCC.ISDELETE = 1 AND MGI.ISDELETE = 1 AND MCU.ISDELETE = 1 AND MCO.STATE <> 4 ");

    // 定义查询条件
    StringBuffer where = new StringBuffer("");

    List<Object> objects = new ArrayList<Object>();

    // 添加查询条件
    if (conSumerOrderData != null) {

      if (conSumerOrderData.getState() != null) {
        where.append(" AND MCO.STATE=?");
        objects.add(conSumerOrderData.getState());
      }

      if (conSumerOrderData.getPageId() != null && !conSumerOrderData.getPageId().equals("")) {
        where.append("AND MCO.PAGEID=? ");
        objects.add(conSumerOrderData.getPageId());
      }
      querySql.append(where.toString());
    }

    if (conSumerOrderData.getState() != null) {
      querySql.append("ORDER BY MCO.CREATETIME,MCO.PAYTYPE DESC");
    } else {
      querySql.append("ORDER BY MCO.CREATETIME DESC");
    }

    // 分页查询
    pageRoll.setCountSQL("SELECT COUNT(1) FROM (" + querySql.toString() + ")");
    pageRoll.setSearchSQL(querySql.toString());

    JdbcDao jdbcDao = (JdbcDao) SpringContextHelper.getBean("jdbc"); // 获取jdbc
    List<ETIPResultSet> rsList = jdbcDao.search(pageRoll, objects);

    List<ConsumerOrderGoodsinfoData> consumerOrderGoodsinfoDatas =
        new ArrayList<ConsumerOrderGoodsinfoData>();

    for (int i = 0; i < rsList.size(); i++) {
      ConsumerOrderGoodsinfoData consumerOrderGoodsinfoData = new ConsumerOrderGoodsinfoData();
      ConSumerOrderData sumerOrderData = new ConSumerOrderData();
      GoodsInfoData goodsInfoData = new GoodsInfoData();
      CommodityConfigData commodityConfigData = new CommodityConfigData();
      ConSumerUserData conSumerUserData = new ConSumerUserData();

      conSumerUserData.setUserName(rsList.get(i).getString("USERNAME"));
      conSumerUserData.setUserAddress(rsList.get(i).getString("USERADDRESS"));
      conSumerUserData.setUserMobile(rsList.get(i).getString("USERMOBILE"));

      sumerOrderData.setConSumerUserData(conSumerUserData);
      sumerOrderData.setId(rsList.get(i).getString("CONSUMERORDERID"));
      sumerOrderData.setCreateTime(rsList.get(i).getDate("CREATETIME"));
      sumerOrderData.setPrice(rsList.get(i).getDouble("PRICE"));
      sumerOrderData.setState(rsList.get(i).getInt("STATE"));
      sumerOrderData.setLogisticsCompany(rsList.get(i).getString("LOGISTICSCOMPANY"));
      sumerOrderData.setLogisticsNumber(rsList.get(i).getString("LOGISTICSNUMBER"));
      sumerOrderData.setDeliverTime(rsList.get(i).getDate("DELIVERTIME"));

      commodityConfigData.setConfigName(rsList.get(i).getString("CONFIGNAME"));

      goodsInfoData.setGoodsName(rsList.get(i).getString("GOODSNAME"));

      consumerOrderGoodsinfoData.setCommodityConfigData(commodityConfigData);
      consumerOrderGoodsinfoData.setGoodsInfoData(goodsInfoData);
      consumerOrderGoodsinfoData.setConSumerOrderData(sumerOrderData);
      consumerOrderGoodsinfoData.setGoodsNum(rsList.get(i).getInt("GOODSNUM"));
      consumerOrderGoodsinfoData.setId(rsList.get(i).getString("ID"));

      consumerOrderGoodsinfoDatas.add(consumerOrderGoodsinfoData);
    }

    return consumerOrderGoodsinfoDatas;
  }
コード例 #5
0
  /**
   * 根据订单商品信息中间表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;
  }