Пример #1
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";
  }
Пример #2
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");
    }
  }