Commit 5420f6c9 authored by hezhen's avatar hezhen

123

parent 1f661d79
package com.xxfc.platform.universal.weixin.api; package com.xxfc.platform.universal.weixin.api;
import java.util.Map.Entry;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.Iterator; import java.util.Iterator;
...@@ -16,13 +16,12 @@ import com.github.wxiaoqi.security.common.util.OrderUtil; ...@@ -16,13 +16,12 @@ import com.github.wxiaoqi.security.common.util.OrderUtil;
import com.github.wxiaoqi.security.common.util.process.SystemConfig; import com.github.wxiaoqi.security.common.util.process.SystemConfig;
import com.xxfc.platform.universal.weixin.util.HTTPUtils; import com.xxfc.platform.universal.weixin.util.HTTPUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.dom4j.Document; import org.dom4j.Document;
import org.dom4j.DocumentException; import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper; import org.dom4j.DocumentHelper;
import org.dom4j.Element; import org.dom4j.Element;
import org.dom4j.Node; import org.dom4j.Node;
import org.dom4j.io.SAXReader;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
/** /**
...@@ -44,9 +43,12 @@ public class WXPay { ...@@ -44,9 +43,12 @@ public class WXPay {
* @return * @return
*/ */
public static String webPay(String total_fee,String body,String notify_url,String orderNo,String spbill_create_ip,String openid){ public static String webPay(String total_fee,String body,String notify_url,String orderNo,String spbill_create_ip,String openid,String wyAppid){
WXPrepay prePay = new WXPrepay(); WXPrepay prePay = new WXPrepay();
prePay.setAppid(SystemConfig.WINXIN_AppID);//pay.getAppId() if (StringUtils.isBlank(wyAppid)){
wyAppid=SystemConfig.WINXIN_AppID;
}
prePay.setAppid(wyAppid);//pay.getAppId()
prePay.setBody(body); prePay.setBody(body);
prePay.setPartnerKey(SystemConfig.WINXIN_PARTNER_KEY);//pay.getPartnerKey() prePay.setPartnerKey(SystemConfig.WINXIN_PARTNER_KEY);//pay.getPartnerKey()
prePay.setMch_id(SystemConfig.WINXIN_PARTNER);//pay.getPartnerId() prePay.setMch_id(SystemConfig.WINXIN_PARTNER);//pay.getPartnerId()
......
...@@ -63,6 +63,9 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> { ...@@ -63,6 +63,9 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> {
MQServiceBiZ mqServiceBiZ; MQServiceBiZ mqServiceBiZ;
@Value("${universal.url}") @Value("${universal.url}")
String weixinHost; String weixinHost;
@Value("${wx.appid}")
private String wy_appid;
public JSONObject preparepay(OrderPayVo orderPayVo) { public JSONObject preparepay(OrderPayVo orderPayVo) {
...@@ -102,13 +105,16 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> { ...@@ -102,13 +105,16 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> {
String sellerAccount = null; String sellerAccount = null;
if (type == 2 && payWay == 1) { if (type == 2 && payWay == 1) {
sellerAccount = SystemConfig.APP_PARTNER; sellerAccount = SystemConfig.APP_PARTNER;
jsParam = WXPay.webPay(amount + "", orderPayVo.getBody(), notify_url, trade_no, orderPayVo.getBuyerIp(), orderPayVo.getBuyerAccount()); jsParam = WXPay.webPay(amount + "", orderPayVo.getBody(), notify_url, trade_no, orderPayVo.getBuyerIp(), orderPayVo.getBuyerAccount(),null);
} else if (type == 1 && payWay == 1) { } else if (type == 1 && payWay == 1) {
sellerAccount = SystemConfig.APP_PARTNER; sellerAccount = SystemConfig.APP_PARTNER;
jsParam = WXPay.apppay(amount + "", orderPayVo.getBody(), notify_url, trade_no, orderPayVo.getBuyerIp(), 0); jsParam = WXPay.apppay(amount + "", orderPayVo.getBody(), notify_url, trade_no, orderPayVo.getBuyerIp(), 0);
} else if (type == 1 && payWay == 2) { } else if (type == 1 && payWay == 2) {
sellerAccount = SystemConfig.ALIPAY_PID; sellerAccount = SystemConfig.ALIPAY_PID;
jsParam = generateAliPayment(orderPayVo, notifyUrl); jsParam = generateAliPayment(orderPayVo, notifyUrl);
}else if (type == 3 && payWay == 1){
sellerAccount = SystemConfig.APP_PARTNER;
jsParam = WXPay.webPay(amount + "", orderPayVo.getBody(), notify_url, trade_no, orderPayVo.getBuyerIp(), orderPayVo.getBuyerAccount(),wy_appid);
} }
log.info("报名费回调路径jsParam:" + jsParam); log.info("报名费回调路径jsParam:" + jsParam);
if (!StringUtils.isBlank(jsParam)) { if (!StringUtils.isBlank(jsParam)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment