/** * 生成订单,跳转到支付宝支付页面<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"; }
/** * 对订单进行付款或者取消订单操作<br> * * @author 侯杨 <br> * 2014年12月08日 * @update * @throws IOException * @see OrderManagerAction#payOrclosed_weixin() * @since vmaque2.0 */ public String payOrclosed_weixin() throws IOException { // 操作码 1为付款 2 为取消订单 String alipayForm; String op = request.getParameter("op"); // 微信id String openid = request.getParameter("openid"); // 订单编号 String code = request.getParameter("code"); String callback = request.getParameter("jsoncallback"); if (op == null || "".equals(op) || code == null || "".equals(code)) { String returnJsonStr = callback + "({\"SUCCESS\": false, \"MESSAGE\": \"获取数据失败\"})"; request.setAttribute("result", returnJsonStr); return "closedOrder"; } conSumerOrderData.setOrderCode(code); if (op.equals("1")) { ConsumerOrderGoodsinfoData orderGoodsinfoData = orderManagerFacade.findConSumerOrderGoodsInfoByOrderId(conSumerOrderData); GoodsInfoData goodsInfoData = new GoodsInfoData(); goodsInfoData.setId(orderGoodsinfoData.getGoodsInfId()); // 查询商品信息 GoodsInfoData infoData = goodsInfoFacade.getGoodsInfoData(goodsInfoData); conSumerOrderData.setPrice(orderGoodsinfoData.getConSumerOrderData().getPrice()); alipayForm = this.getAlipayForm_PhoneWeixin(conSumerOrderData, infoData); } else { // 取消订单 alipayForm = orderManagerFacade.closedConSumerOrderDataWeixin(conSumerOrderData); } if ("success".equals(alipayForm)) { String returnJsonStr = callback + "({\"SUCCESS\": true})"; request.setAttribute("result", returnJsonStr); return "closedOrder"; } else if ("erro".equals(alipayForm)) { String returnJsonStr = callback + "({\"SUCCESS\": false})"; request.setAttribute("result", returnJsonStr); return "closedOrder"; } else { request.setAttribute("alipayForm", alipayForm); return "toPayJsp"; } }
/** * 生成订单,跳转到微信支付<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"); } }