From b5857b4fa654ac45f80e6c485a6c3ce12ca3870a Mon Sep 17 00:00:00 2001
From: jyy <935090232@qq.com>
Date: Sat, 09 Jan 2021 18:41:15 +0800
Subject: [PATCH] 微信支付从数据库查询配置

---
 zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/weixinUtil/WeixinServiceUtil.java                 |   62 ++++++++++--
 zq-erp/src/main/resources/config/test/system.properties                                                              |    2 
 zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/common/HttpsRequest2.java                         |   53 +++++++---
 zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/common/Signature.java                             |   20 +--
 zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxCommonAction.java                                        |   13 ++
 zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WXShopOrderAction.java                                     |    1 
 zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/payProtocol/JsApiPayReqData.java         |   23 ++--
 zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopRefundRecordAction.java                                    |    8 -
 zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/payComProtocol/JsApiPayComReqData.java   |    6 
 zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/queryProtocol/ScanPayQueryReqData.java   |    6 
 zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/refundProtocol/RefundReqData.java        |    8 
 /dev/null                                                                                                            |   19 ---
 zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/common/WechatConfigure.java                       |   19 ---
 zq-erp/src/main/java/com/matrix/system/common/constance/AppConstance.java                                            |   24 ++++
 zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/service/BaseService.java                          |    4 
 zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopRefundRecordServiceImpl.java                   |    5 
 zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/paramProtocol/BrandWCPayRequestData.java |    6 
 17 files changed, 171 insertions(+), 108 deletions(-)

diff --git a/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/common/HttpsRequest2.java b/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/common/HttpsRequest2.java
index 12856ec..6f05de1 100644
--- a/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/common/HttpsRequest2.java
+++ b/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/common/HttpsRequest2.java
@@ -41,7 +41,7 @@
     }
 
     Logger log=Logger.getLogger(HttpRequest.class);
-    		
+
     //表示请求器是否已经做了初始化工作
     private boolean hasInit = false;
 
@@ -56,6 +56,10 @@
 
     //HTTP请求器
     private CloseableHttpClient httpClient;
+    //证书地址
+    private String  certLocalPath;
+    //商户号
+    private String mchId;
 
     public HttpsRequest2() throws UnrecoverableKeyException, KeyManagementException, NoSuchAlgorithmException, KeyStoreException, IOException {
         init();
@@ -63,10 +67,10 @@
 
     private void init() throws IOException, KeyStoreException, UnrecoverableKeyException, NoSuchAlgorithmException, KeyManagementException {
 
-       KeyStore keyStore = KeyStore.getInstance("PKCS12");
-       FileInputStream instream = new FileInputStream(new File(WechatConfigure.certLocalPath));//加载本地的证书进行https加密传输
+        KeyStore keyStore = KeyStore.getInstance("PKCS12");
+        FileInputStream instream = new FileInputStream(new File(certLocalPath));//加载本地的证书进行https加密传输
         try {
-            keyStore.load(instream,WechatConfigure.certPassword.toCharArray());//设置证书密码
+            keyStore.load(instream, mchId.toCharArray());//设置证书密码
         } catch (CertificateException e) {
             e.printStackTrace();
         } catch (NoSuchAlgorithmException e) {
@@ -76,7 +80,7 @@
         }
         // Trust own CA and all self-signed certs
         SSLContext sslcontext = SSLContexts.custom()
-                .loadKeyMaterial(keyStore, WechatConfigure.certPassword.toCharArray())
+                .loadKeyMaterial(keyStore, mchId.toCharArray())
                 .build();
         // Allow TLSv1 protocol only
         SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(
@@ -85,11 +89,11 @@
                 null,
                 SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
 
-        
-         httpClient = HttpClients.custom()
+
+        httpClient = HttpClients.custom()
                 .setSSLSocketFactory(sslsf)
                 .build();
-    	// httpClient = HttpClients.custom().build();
+        // httpClient = HttpClients.custom().build();
         //根据默认超时限制初始化requestConfig
         requestConfig = RequestConfig.custom().setSocketTimeout(socketTimeout).setConnectTimeout(connectTimeout).build();
         hasInit = true;
@@ -135,17 +139,17 @@
         httpPost.setConfig(requestConfig);
 
         log.info("executing request" + httpPost.getRequestLine());
-         
+
         try {
             HttpResponse response = httpClient.execute(httpPost);
 
             HttpEntity entity = response.getEntity();
 
             result = EntityUtils.toString(entity, "UTF-8");
-            
+
             log.info("POST back date:" + httpPost.getRequestLine());
-            
-            
+
+
 
         } catch (ConnectionPoolTimeoutException e) {
 //            log.e("http get throw ConnectionPoolTimeoutException(wait time out)");
@@ -157,7 +161,7 @@
 //            log.e("http get throw SocketTimeoutException");
 
         } catch (Exception e) {
-        	e.printStackTrace();
+            e.printStackTrace();
 //            log.e("http get throw Exception");
 
         } finally {
@@ -173,7 +177,7 @@
      * @param socketTimeout 连接时长,默认10秒
      */
     public void setSocketTimeout(int socketTimeout) {
-    	this.socketTimeout = socketTimeout;
+        this.socketTimeout = socketTimeout;
         resetRequestConfig();
     }
 
@@ -183,7 +187,7 @@
      * @param connectTimeout 传输时长,默认30秒
      */
     public void setConnectTimeout(int connectTimeout) {
-    	this.connectTimeout = connectTimeout;
+        this.connectTimeout = connectTimeout;
         resetRequestConfig();
     }
 
@@ -197,6 +201,23 @@
      * @param requestConfig 设置HttpsRequest的请求器配置
      */
     public void setRequestConfig(RequestConfig requestConfig) {
-    	this.requestConfig = requestConfig;
+        this.requestConfig = requestConfig;
+    }
+
+
+    public String getMchId() {
+        return mchId;
+    }
+
+    public void setMchId(String mchId) {
+        this.mchId = mchId;
+    }
+
+    public String getCertLocalPath() {
+        return certLocalPath;
+    }
+
+    public void setCertLocalPath(String certLocalPath) {
+        this.certLocalPath = certLocalPath;
     }
 }
diff --git a/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/common/Signature.java b/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/common/Signature.java
index 40300d5..c764cff 100644
--- a/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/common/Signature.java
+++ b/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/common/Signature.java
@@ -22,7 +22,7 @@
 	 * @return 签名
 	 * @throws IllegalAccessException
 	 */
-	public static String getSign(Object o) throws IllegalAccessException {
+	public static String getSign(Object o,String paySecret) throws IllegalAccessException {
 		ArrayList<String> list = new ArrayList<String>();
 		Class<? extends Object> cls = o.getClass();
 		Field[] fields = cls.getDeclaredFields();
@@ -40,14 +40,14 @@
 			sb.append(arrayToSort[i]);
 		}
 		String result = sb.toString();
-		result += "key=" + WechatConfigure.key;
+		result += "key=" +paySecret;
 		Util.log("Sign Before MD5:" + result);
 		result = MD5.MD5Encode(result).toUpperCase();
 		Util.log("Sign Result:" + result);
 		return result;
 	}
 
-	public static String getSign(Map<String, Object> map) {
+	public static String getSign(Map<String, Object> map,String paySecret) {
 		ArrayList<String> list = new ArrayList<String>();
 		for (Map.Entry<String, Object> entry : map.entrySet()) {
 			if (entry.getValue() != "") {
@@ -62,7 +62,7 @@
 			sb.append(arrayToSort[i]);
 		}
 		String result = sb.toString();
-		result += "key=" + WechatConfigure.key;
+		result += "key=" + paySecret;
 		Util.log("Sign Before MD5:" + result);
 		result = MD5.MD5Encode(result).toUpperCase();
 		Util.log("Sign Result:" + result);
@@ -79,13 +79,13 @@
 	 * @throws IOException
 	 * @throws SAXException
 	 */
-	public static String getSignFromResponseString(String responseString)
+	public static String getSignFromResponseString(String responseString,String paySecret)
 			throws IOException, SAXException, ParserConfigurationException {
 		Map<String, Object> map = XMLParser.getMapFromXML(responseString);
 		// 清掉返回数据对象里面的Sign数据(不能把这个数据也加进去进行签名),然后用签名算法进行签名
 		map.put("sign", "");
 		// 将API返回的数据根据用签名算法进行计算新的签名,用来跟API返回的签名进行比较
-		return Signature.getSign(map);
+		return Signature.getSign(map,paySecret);
 	}
 
 	/**
@@ -98,7 +98,7 @@
 	 * @throws IOException
 	 * @throws SAXException
 	 */
-	public static boolean checkIsSignValidFromResponseString(String responseString)
+	public static boolean checkIsSignValidFromResponseString(String responseString,String paySecret)
 			throws ParserConfigurationException, IOException, SAXException {
 
 		Map<String, Object> map = XMLParser.getMapFromXML(responseString);
@@ -113,7 +113,7 @@
 		// 清掉返回数据对象里面的Sign数据(不能把这个数据也加进去进行签名),然后用签名算法进行签名
 		map.put("sign", "");
 		// 将API返回的数据根据用签名算法进行计算新的签名,用来跟API返回的签名进行比较
-		String signForAPIResponse = Signature.getSign(map);
+		String signForAPIResponse = Signature.getSign(map,paySecret);
 
 		if (!signForAPIResponse.equals(signFromAPIResponse)) {
 			// 签名验不过,表示这个API返回的数据有可能已经被篡改了
@@ -124,9 +124,7 @@
 		return true;
 	}
 	
-	public static void main(String[] args) throws ParserConfigurationException, IOException, SAXException {
-		System.out.println(checkIsSignValidFromResponseString("<xml><appid><![CDATA[wx13515a9204ea669d]]></appid><attach><![CDATA[35f7170585ad4f09b5109cc985b1eec0]]></attach><bank_type><![CDATA[CFT]]></bank_type><cash_fee><![CDATA[1]]></cash_fee><fee_type><![CDATA[CNY]]></fee_type><is_subscribe><![CDATA[N]]></is_subscribe><mch_id><![CDATA[1486409192]]></mch_id><nonce_str><![CDATA[elqhnr10vzaq0wgalf9njjyqwyd7gyr7]]></nonce_str><openid><![CDATA[o8x8E5lqmD9c5rdsjTQ9KWN4-H40]]></openid><out_trade_no><![CDATA[2018090610284198419]]></out_trade_no><result_code><![CDATA[SUCCESS]]></result_code><return_code><![CDATA[SUCCESS]]></return_code><sign><![CDATA[DD04172CDAA60F834163AF3F5B63BE3F]]></sign><time_end><![CDATA[20180906102853]]></time_end><total_fee>1</total_fee><trade_type><![CDATA[JSAPI]]></trade_type><transaction_id><![CDATA[4200000169201809067369627940]]></transaction_id></xml>"));
-	}
+
 
 	/**
 	 * 
diff --git a/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/common/WechatConfigure.java b/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/common/WechatConfigure.java
index 30d2a22..0a37ebc 100644
--- a/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/common/WechatConfigure.java
+++ b/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/common/WechatConfigure.java
@@ -9,7 +9,7 @@
 	// 这个就是自己要保管好的私有Key了(切记只能放在自己的后台代码里,不能放在任何可能被看到源代码的客户端程序中)
 	// 每次自己Post数据给API的时候都要用这个key来对所有字段进行签名,生成的签名会放在Sign这个字段,API收到Post数据的时候也会用同样的签名算法对Post过来的数据进行签名和验证
 	// 收到API的返回的时候也要用这个key来对返回的数据算下签名,跟API的Sign数据进行比较,如果值不一致,有可能数据被第三方给篡改
-	public static final String PAY_NOTIFY_URL="https://xcxhive2.jyymatrix.cc/wxCommon/wxpayCallback";
+
 	// 交易类型
 	public static final String TRADE_TYPE_JSAPI = "JSAPI";
 	public static final String TRADE_TYPE_NATIVE = "NATIVE";
@@ -17,28 +17,15 @@
 	public static final String SIGN_MD5 = "MD5";
 	//域名
 
-	
-	// 微信支付秘钥
-	public static String key = "3hbNHPOSXx85rC0QEqvGgIHu1wduT4Qc";
-	
-	// 微信分配的公众号ID(开通公众号之后可以获取到)
-	public static String appID = "wx3836ab3c1490ff29";
-	
-	
 
-	// 微信支付分配的商户号ID(开通公众号的微信支付功能之后可以获取到)
-	public static String mchID = "1573208361";
-	
-	
-	public static String  web_appID = "1486409192";
+
 	// 受理模式下给子商户分配的子商户号
 	public static String subMchID = "";
 
 	// HTTPS证书的本地路径
 	public static String certLocalPath = "/home/cert/apiclient_cert.p12";
 
-	// HTTPS证书密码,默认密码等于商户号MCHID
-	public static String certPassword = "1573208361";
+
 
 	// 是否使用异步线程的方式来上报API测速,默认为异步模式
 	public static boolean useThreadToDoReport = true;
diff --git a/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/paramProtocol/BrandWCPayRequestData.java b/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/paramProtocol/BrandWCPayRequestData.java
index c367bf3..b0c8126 100644
--- a/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/paramProtocol/BrandWCPayRequestData.java
+++ b/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/paramProtocol/BrandWCPayRequestData.java
@@ -25,16 +25,16 @@
     private String signType = "";
     private String paySign = "";
     
-    public BrandWCPayRequestData(String prepay_id){
+    public BrandWCPayRequestData(String prepay_id,String appID,String paySecret){
     	//默认必须设置
-        setAppId(WechatConfigure.appID);
+        setAppId(appID);
         //随机字符串,不长于32 位
         setNonceStr(RandomStringGenerator.getRandomStringByLength(32));
         setTimeStamp(Long.toString(System.currentTimeMillis() / 1000L));
         setPrepay_id("prepay_id="+prepay_id);
         //根据API给的签名规则进行签名 【 必须要放在本方法的最后】
         setSignType(WechatConfigure.SIGN_MD5);
-        String sign = Signature.getSign(toMap());
+        String sign = Signature.getSign(toMap(),paySecret);
         setPaySign(sign);//把签名数据设置到Sign这个属性中
     }
     
diff --git a/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/payComProtocol/JsApiPayComReqData.java b/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/payComProtocol/JsApiPayComReqData.java
index 7313595..d38b928 100644
--- a/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/payComProtocol/JsApiPayComReqData.java
+++ b/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/payComProtocol/JsApiPayComReqData.java
@@ -70,16 +70,16 @@
      * @param bankTrueName 收款号姓名
      * @param bankCode     收款号开户行
      */
-    public JsApiPayComReqData(String desc, String outTradeNo, int totalFee, String bankNo, String bankTrueName, String bankCode) {
+    public JsApiPayComReqData(String mchID,String paySecret ,String desc, String outTradeNo, int totalFee, String bankNo, String bankTrueName, String bankCode) {
         //默认必须设置
-        setMch_id(WechatConfigure.mchID);
+        setMch_id(mchID);
         setDesc(desc);
         setPartner_trade_no(outTradeNo);
         setAmount(totalFee);
         //随机字符串,不长于32 位
         setNonce_str(RandomStringGenerator.getRandomStringByLength(32));
         //根据API给的签名规则进行签名 【 必须要放在本方法的最后】
-        String sign = Signature.getSign(toMap());
+        String sign = Signature.getSign(toMap(),paySecret);
         setSign(sign);//把签名数据设置到Sign这个属性中
 //        setEnc_bank_no();
 //        setEnc_true_name();
diff --git a/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/payProtocol/JsApiPayReqData.java b/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/payProtocol/JsApiPayReqData.java
index 2dc5f1e..819f58a 100644
--- a/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/payProtocol/JsApiPayReqData.java
+++ b/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/payProtocol/JsApiPayReqData.java
@@ -32,8 +32,8 @@
     /**
      * 接收微信支付异步通知回调地址
      */
-    private String notify_url = WechatConfigure.PAY_NOTIFY_URL;
     private String trade_type = WechatConfigure.TRADE_TYPE_JSAPI;
+    private String notify_url ;
     private String openid = "";
     private String limit_pay = "";
     private String spbill_create_ip = "";
@@ -47,7 +47,8 @@
     public JsApiPayReqData() {
 	}
     
-    /**
+    /**appID 收款应用id
+     * mchID 商户号
      * @param authCode 这个是扫码终端设备从用户手机上扫取到的支付授权号,这个号是跟用户用来支付的银行卡绑定的,有效期是1分钟
      * @param body 要支付的商品的描述信息,用户会在支付成功页面里看到这个信息
      * @param attach 支付订单里面可以填的附加数据,API会将提交的这个附加数据原样返回
@@ -59,10 +60,11 @@
      * @param timeExpire 订单失效时间,格式同上
      * @param goodsTag 商品标记,微信平台配置的商品标记,用于优惠券或者满减使用
      */
-    public JsApiPayReqData(String body,String outTradeNo,int totalFee,String spBillCreateIP,String openid,String attach){
+    public JsApiPayReqData(String appID, String mchID,String paySecret,String notify_url, String body,String outTradeNo,int totalFee,String spBillCreateIP,String openid,String attach){
     	//默认必须设置
-        setAppid(WechatConfigure.appID);
-        setMch_id(WechatConfigure.mchID);
+        setAppid(appID);
+        setMch_id(mchID);
+        setNotify_url(notify_url);
         setBody(body);
         setOut_trade_no(outTradeNo);
         setTotal_fee(totalFee);
@@ -72,16 +74,17 @@
         setNonce_str(RandomStringGenerator.getRandomStringByLength(32));
         setOpenid(openid);
         //根据API给的签名规则进行签名 【 必须要放在本方法的最后】
-        String sign = Signature.getSign(toMap());
+        String sign = Signature.getSign(toMap(),paySecret);
         setSign(sign);//把签名数据设置到Sign这个属性中
       
     }
 
-    public JsApiPayReqData(String body,String outTradeNo,int totalFee,String spBillCreateIP,String attach){
+    public JsApiPayReqData(String appID, String mchID,String paySecret,String notify_url,String body,String outTradeNo,int totalFee,String spBillCreateIP,String attach){
     	//默认必须设置
-        setAppid(WechatConfigure.web_appID);
-        setMch_id(WechatConfigure.mchID);
+        setAppid(appID);
+        setMch_id(mchID);
         setBody(body);
+        setNotify_url(notify_url);
         setOut_trade_no(outTradeNo);
         setTotal_fee(totalFee);
         setSpbill_create_ip(spBillCreateIP);
@@ -89,7 +92,7 @@
         //随机字符串,不长于32 位
         setNonce_str(RandomStringGenerator.getRandomStringByLength(32));
         //根据API给的签名规则进行签名 【 必须要放在本方法的最后】
-        String sign = Signature.getSign(toMap());
+        String sign = Signature.getSign(toMap(),paySecret);
         setSign(sign);//把签名数据设置到Sign这个属性中
     }
     
diff --git a/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/queryProtocol/JsApiPayReqData.java b/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/queryProtocol/JsApiPayReqData.java
deleted file mode 100644
index 8784f20..0000000
--- a/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/queryProtocol/JsApiPayReqData.java
+++ /dev/null
@@ -1,295 +0,0 @@
-package com.matrix.component.wechat.externalInterface.protocol.queryProtocol;
-
-
-import com.matrix.component.wechat.externalInterface.common.RandomStringGenerator;
-import com.matrix.component.wechat.externalInterface.common.Signature;
-import com.matrix.component.wechat.externalInterface.common.WechatConfigure;
-
-import java.lang.reflect.Field;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * 
-*  预付订单请求参数
-* @author:姜友瑶 
-* @date 2016年10月14日
- */
-public class JsApiPayReqData {
-
-    //每个字段具体的意思请查看API文档
-    private String appid = "";
-    private String mch_id = "";
-    private String device_info = "";
-    private String nonce_str = "";
-    private String sign = "";
-    private String body = "";
-    private String detail = "";
-    private String attach = "";
-    private String out_trade_no = "";
-    private String fee_type = "";
-    private int total_fee = 0;
-    /**
-     * 接收微信支付异步通知回调地址
-     */
-    private String notify_url = WechatConfigure.PAY_NOTIFY_URL;
-    private String trade_type = WechatConfigure.TRADE_TYPE_JSAPI;
-    private String openid = "";
-    private String limit_pay = "";
-    private String spbill_create_ip = "";
-    private String product_id = "";
-    private String time_start = "";
-    private String time_expire = "";
-    private String goods_tag = "";
-    private String auth_code = "";
-
-    
-    public JsApiPayReqData() {
-	}
-    
-    /**
-     * @param authCode 这个是扫码终端设备从用户手机上扫取到的支付授权号,这个号是跟用户用来支付的银行卡绑定的,有效期是1分钟
-     * @param body 要支付的商品的描述信息,用户会在支付成功页面里看到这个信息
-     * @param attach 支付订单里面可以填的附加数据,API会将提交的这个附加数据原样返回
-     * @param outTradeNo 商户系统内部的订单号,32个字符内可包含字母, 确保在商户系统唯一
-     * @param totalFee 订单总金额,单位为“分”,只能整数
-     * @param deviceInfo 商户自己定义的扫码支付终端设备号,方便追溯这笔交易发生在哪台终端设备上
-     * @param spBillCreateIP 订单生成的机器IP
-     * @param timeStart 订单生成时间, 格式为yyyyMMddHHmmss,如2009年12 月25 日9 点10 分10 秒表示为20091225091010。时区为GMT+8 beijing。该时间取自商户服务器
-     * @param timeExpire 订单失效时间,格式同上
-     * @param goodsTag 商品标记,微信平台配置的商品标记,用于优惠券或者满减使用
-     */
-    public JsApiPayReqData(String body,String outTradeNo,int totalFee,String spBillCreateIP,String openid,String attach){
-    	//默认必须设置
-        setAppid(WechatConfigure.appID);
-        setMch_id(WechatConfigure.mchID);
-        setBody(body);
-        setOut_trade_no(outTradeNo);
-        setTotal_fee(totalFee);
-        setSpbill_create_ip(spBillCreateIP);
-        setAttach(attach);
-        //随机字符串,不长于32 位
-        setNonce_str(RandomStringGenerator.getRandomStringByLength(32));
-        setOpenid(openid);
-        //根据API给的签名规则进行签名 【 必须要放在本方法的最后】
-        String sign = Signature.getSign(toMap());
-        setSign(sign);//把签名数据设置到Sign这个属性中
-      
-    }
-
-    public JsApiPayReqData(String body,String outTradeNo,int totalFee,String spBillCreateIP,String attach){
-    	//默认必须设置
-        setAppid(WechatConfigure.web_appID);
-        setMch_id(WechatConfigure.mchID);
-        setBody(body);
-        setOut_trade_no(outTradeNo);
-        setTotal_fee(totalFee);
-        setSpbill_create_ip(spBillCreateIP);
-        setAttach(attach);
-        //随机字符串,不长于32 位
-        setNonce_str(RandomStringGenerator.getRandomStringByLength(32));
-        //根据API给的签名规则进行签名 【 必须要放在本方法的最后】
-        String sign = Signature.getSign(toMap());
-        setSign(sign);//把签名数据设置到Sign这个属性中
-    }
-    
-    public String getDetail() {
-		return detail;
-	}
-
-	public void setDetail(String detail) {
-		this.detail = detail;
-	}
-
-	public String getFee_type() {
-		return fee_type;
-	}
-
-	public void setFee_type(String fee_type) {
-		this.fee_type = fee_type;
-	}
-
-	public String getNotify_url() {
-		return notify_url;
-	}
-
-	public void setNotify_url(String notify_url) {
-		this.notify_url = notify_url;
-	}
-
-	public String getTrade_type() {
-		return trade_type;
-	}
-
-	public void setTrade_type(String trade_type) {
-		this.trade_type = trade_type;
-	}
-
-	public String getOpenid() {
-		return openid;
-	}
-
-	public void setOpenid(String openid) {
-		this.openid = openid;
-	}
-
-	public String getLimit_pay() {
-		return limit_pay;
-	}
-
-	public void setLimit_pay(String limit_pay) {
-		this.limit_pay = limit_pay;
-	}
-
-	public String getProduct_id() {
-		return product_id;
-	}
-
-	public void setProduct_id(String product_id) {
-		this.product_id = product_id;
-	}
-
-	public String getAppid() {
-        return appid;
-    }
-
-    public void setAppid(String appid) {
-        this.appid = appid;
-    }
-
-    public String getMch_id() {
-        return mch_id;
-    }
-
-    public void setMch_id(String mch_id) {
-        this.mch_id = mch_id;
-    }
-
-    public String getDevice_info() {
-        return device_info;
-    }
-
-    public void setDevice_info(String device_info) {
-        this.device_info = device_info;
-    }
-
-    public String getNonce_str() {
-        return nonce_str;
-    }
-
-    public void setNonce_str(String nonce_str) {
-        this.nonce_str = nonce_str;
-    }
-
-    public String getSign() {
-        return sign;
-    }
-
-    public void setSign(String sign) {
-        this.sign = sign;
-    }
-
-    public String getBody() {
-        return body;
-    }
-
-    /**
-     * 
-    * body最大长度128
-    * @author:姜友瑶
-    * @param body    
-    * 返回类型  void    
-    * @date 2016年10月13日
-     */
-    public void setBody(String body) {
-    
-    	if(body.length()>128){
-    		body=body.substring(0, 128);
-    	}
-        this.body = body;
-    }
-
-    public String getAttach() {
-        return attach;
-    }
-
-    public void setAttach(String attach) {
-        this.attach = attach;
-    }
-
-    public String getOut_trade_no() {
-        return out_trade_no;
-    }
-
-    public void setOut_trade_no(String out_trade_no) {
-        this.out_trade_no = out_trade_no;
-    }
-
-    public int getTotal_fee() {
-        return total_fee;
-    }
-
-    public void setTotal_fee(int total_fee) {
-        this.total_fee = total_fee;
-    }
-
-    public String getSpbill_create_ip() {
-        return spbill_create_ip;
-    }
-
-    public void setSpbill_create_ip(String spbill_create_ip) {
-        this.spbill_create_ip = spbill_create_ip;
-    }
-
-    public String getTime_start() {
-        return time_start;
-    }
-
-    public void setTime_start(String time_start) {
-        this.time_start = time_start;
-    }
-
-    public String getTime_expire() {
-        return time_expire;
-    }
-
-    public void setTime_expire(String time_expire) {
-        this.time_expire = time_expire;
-    }
-
-    public String getGoods_tag() {
-        return goods_tag;
-    }
-
-    public void setGoods_tag(String goods_tag) {
-        this.goods_tag = goods_tag;
-    }
-
-    public String getAuth_code() {
-        return auth_code;
-    }
-
-    public void setAuth_code(String auth_code) {
-        this.auth_code = auth_code;
-    }
-
-    public Map<String,Object> toMap(){
-        Map<String,Object> map = new HashMap<String, Object>();
-        Field[] fields = this.getClass().getDeclaredFields();
-        for (Field field : fields) {
-            Object obj;
-            try {
-                obj = field.get(this);
-                if(obj!=null){
-                    map.put(field.getName(), obj);
-                }
-            } catch (IllegalArgumentException e) {
-                e.printStackTrace();
-            } catch (IllegalAccessException e) {
-                e.printStackTrace();
-            }
-        }
-        return map;
-    }
-
-}
diff --git a/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/queryProtocol/ScanPayQueryReqData.java b/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/queryProtocol/ScanPayQueryReqData.java
index 42cc0c9..37855ba 100644
--- a/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/queryProtocol/ScanPayQueryReqData.java
+++ b/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/queryProtocol/ScanPayQueryReqData.java
@@ -37,10 +37,10 @@
         //--------------------------------------------------------------------
 
         //微信分配的公众号ID(开通公众号之后可以获取到)
-        setAppid(WechatConfigure.appID);
+        //setAppid(WechatConfigure.appID);
 
         //微信支付分配的商户号ID(开通公众号的微信支付功能之后可以获取到)
-        setMch_id(WechatConfigure.mchID);
+        // setMch_id(WechatConfigure.mchID);
 
         //transaction_id是微信系统为每一笔支付交易分配的订单号,通过这个订单号可以标识这笔交易,它由支付订单API支付成功时返回的数据里面获取到。
         setTransaction_id(transactionID);
@@ -52,7 +52,7 @@
         setNonce_str(RandomStringGenerator.getRandomStringByLength(32));
 
         //根据API给的签名规则进行签名
-        String sign = Signature.getSign(toMap());
+        //String sign = Signature.getSign(toMap());
         setSign(sign);//把签名数据设置到Sign这个属性中
 
 
diff --git a/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/refundProtocol/RefundReqData.java b/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/refundProtocol/RefundReqData.java
index 6aa739c..adff5d8 100644
--- a/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/refundProtocol/RefundReqData.java
+++ b/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/refundProtocol/RefundReqData.java
@@ -40,13 +40,13 @@
      * @param opUserID 操作员帐号, 默认为商户号
      * @param refundFeeType 货币类型,符合ISO 4217标准的三位字母代码,默认为CNY(人民币)
      */
-    public RefundReqData(String outTradeNo,String outRefundNo,int totalFee,int refundFee,String opUserID){
+    public RefundReqData(String mchID,String appID,String paySecret ,String outTradeNo,String outRefundNo,int totalFee,int refundFee,String opUserID){
 
     	 //微信分配的公众号ID(开通公众号之后可以获取到)
-        setAppid(WechatConfigure.appID);
+        setAppid(mchID);
 
         //微信支付分配的商户号ID(开通公众号的微信支付功能之后可以获取到)
-        setMch_id(WechatConfigure.mchID);
+        setMch_id(appID);
 
         //transaction_id是微信系统为每一笔支付交易分配的订单号,通过这个订单号可以标识这笔交易,它由支付订单API支付成功时返回的数据里面获取到。
         //setTransaction_id(transactionID);
@@ -69,7 +69,7 @@
         setNonce_str(RandomStringGenerator.getRandomStringByLength(32));
 
         //根据API给的签名规则进行签名
-        String sign = Signature.getSign(toMap());
+        String sign = Signature.getSign(toMap(),paySecret);
         setSign(sign);//把签名数据设置到Sign这个属性中
 
     }
diff --git a/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/rsaProtocal/JsApiRSAReqData.java b/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/rsaProtocal/JsApiRSAReqData.java
deleted file mode 100644
index e694b90..0000000
--- a/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/rsaProtocal/JsApiRSAReqData.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package com.matrix.component.wechat.externalInterface.protocol.rsaProtocal;
-
-
-import com.matrix.component.wechat.externalInterface.common.RandomStringGenerator;
-import com.matrix.component.wechat.externalInterface.common.Signature;
-import com.matrix.component.wechat.externalInterface.common.WechatConfigure;
-
-import java.lang.reflect.Field;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * 公钥请求类
- *
- * @author  wzy
- */
-public class JsApiRSAReqData {
-
-    private String mch_id;
-    private String nonce_str;
-    private String sign;
-    private String sign_type;
-
-
-    public JsApiRSAReqData() {
-        this.mch_id = WechatConfigure.mchID;
-        this.nonce_str = RandomStringGenerator.getRandomStringByLength(32);
-        this.sign = Signature.getSign(toMap());
-        this.sign_type = "MD5";
-    }
-
-    public Map<String, Object> toMap() {
-        Map<String, Object> map = new HashMap<String, Object>();
-        Field[] fields = this.getClass().getDeclaredFields();
-        for (Field field : fields) {
-            Object obj;
-            try {
-                obj = field.get(this);
-                if (obj != null) {
-                    map.put(field.getName(), obj);
-                }
-            } catch (IllegalArgumentException e) {
-                e.printStackTrace();
-            } catch (IllegalAccessException e) {
-                e.printStackTrace();
-            }
-        }
-        return map;
-    }
-}
diff --git a/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/service/BaseService.java b/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/service/BaseService.java
index 1b9620d..8f9a680 100644
--- a/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/service/BaseService.java
+++ b/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/service/BaseService.java
@@ -38,4 +38,8 @@
     public void setServiceRequest(IServiceRequest request){
         serviceRequest = request;
     }
+
+    public IServiceRequest getServiceRequest() {
+        return serviceRequest;
+    }
 }
diff --git a/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/service/JsApiGetPublicKeyService.java b/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/service/JsApiGetPublicKeyService.java
deleted file mode 100644
index 173f31f..0000000
--- a/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/service/JsApiGetPublicKeyService.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.matrix.component.wechat.externalInterface.service;
-
-import com.matrix.component.wechat.externalInterface.common.WechatConfigure;
-import com.matrix.component.wechat.externalInterface.protocol.payComProtocol.JsApiPayComReqData;
-import com.matrix.component.wechat.externalInterface.protocol.rsaProtocal.JsApiRSAReqData;
-
-public class JsApiGetPublicKeyService extends BaseService {
-
-    public JsApiGetPublicKeyService() throws ClassNotFoundException, IllegalAccessException, InstantiationException {
-        super(WechatConfigure.PUBLIC_KEY_GET_API, WechatConfigure.HttpsRequestClassName2);
-    }
-
-    public String request(JsApiRSAReqData jsApiRSAReqData) throws Exception {
-
-        String responseString = sendPost(jsApiRSAReqData);
-
-        return responseString;
-    }
-}
diff --git a/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/weixinUtil/WeixinServiceUtil.java b/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/weixinUtil/WeixinServiceUtil.java
index 771333f..7a00022 100644
--- a/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/weixinUtil/WeixinServiceUtil.java
+++ b/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/weixinUtil/WeixinServiceUtil.java
@@ -1,5 +1,6 @@
 package com.matrix.component.wechat.externalInterface.weixinUtil;
 
+import com.matrix.component.wechat.externalInterface.common.HttpsRequest2;
 import com.matrix.core.exception.GlobleException;
 import com.matrix.core.tools.LogUtil;
 import com.matrix.core.tools.StringUtils;
@@ -18,7 +19,10 @@
 import com.matrix.component.wechat.externalInterface.service.JsApiPayComService;
 import com.matrix.component.wechat.externalInterface.service.RefundService;
 import com.matrix.component.wechat.externalInterface.service.ScanPayQueryService;
+import com.matrix.system.common.bean.BusParameterSettings;
 import com.matrix.system.common.constance.AppConstance;
+import com.matrix.system.common.dao.BusParameterSettingsDao;
+import com.matrix.system.common.interceptor.HostInterceptor;
 import com.matrix.system.shopXcx.api.tools.WxShopOrderUtil;
 import org.apache.log4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -43,6 +47,13 @@
 
 	@Autowired
 	private WxShopOrderUtil wxShopOrderUtil;
+
+	@Autowired
+	BusParameterSettingsDao busParameterSettingsDao;
+
+
+
+
 	
 	/**
 	 * 支付"175.9.82.254"
@@ -62,7 +73,20 @@
 		// 创建微信支付预付接口
 		JsApiPayBusiness jsApiPayBusiness = new JsApiPayBusiness();
 		String idAddr = getIpAddr(WebUtil.getRequest());
-		JsApiPayReqData jsApiPayReqData = new JsApiPayReqData(desc, outTradeNo, price, idAddr, openId, attach);
+
+		Long companyId=HostInterceptor.getCompanyId();
+
+		BusParameterSettings mchID = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.WECHARPAY_APPID, companyId);
+		BusParameterSettings paySecret = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.WECHARPAY_SECRET, companyId);
+		BusParameterSettings notifyUrl = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.WECHARPAY_NOTIFYURL, companyId);
+
+		BusParameterSettings appId = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.MINIPROGRAM_APPID, companyId);
+
+		JsApiPayReqData jsApiPayReqData = new JsApiPayReqData(appId.getParamValue(),mchID.getParamValue(),
+				paySecret.getParamValue(),
+				notifyUrl.getParamValue(),
+				desc, outTradeNo, price, idAddr, openId, attach);
+
 		// 创建预付订单并返回请求结果
 		JsApiPayResData result = jsApiPayBusiness.createPrapareOrder(jsApiPayReqData);
 		// 把预付订单的信息存放在request域中
@@ -71,7 +95,7 @@
 		LogUtil.info("#---签名信息:return_msg = {}" , result.getReturn_msg());
 		if (result.getReturn_code().equals("SUCCESS")) {
 			// 请求成功, 构建BrandWCPayRequest发起支付需要的参数
-			BrandWCPayRequestData payData = new BrandWCPayRequestData(result.getPrepay_id());
+			BrandWCPayRequestData payData = new BrandWCPayRequestData(result.getPrepay_id(),appId.getParamValue(),paySecret.getParamValue());
 			WebUtil.getRequest().setAttribute("payData", payData);
 			return payData;
 		}else{
@@ -115,7 +139,6 @@
 	 * @param desc 描述
 	 * @param outTradeNo  提现申请编号
 	 * @param totalFee 提现金额(分)
-	 * @param spBillCreateIP 调用接口的IP
 	 * @param openid
 	 * @return
 	 */
@@ -125,7 +148,12 @@
 		try {
 			JsApiPayBusiness jsApiPayBusiness = new JsApiPayBusiness();
 			// TODO 企业付款
-			JsApiPayComReqData jsApiPayComReqData=new JsApiPayComReqData("","",0,"","","");
+			Long companyId=HostInterceptor.getCompanyId();
+			BusParameterSettings mchID = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.WECHARPAY_APPID, companyId);
+			BusParameterSettings paySecret = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.WECHARPAY_SECRET, companyId);
+
+
+			JsApiPayComReqData jsApiPayComReqData=new JsApiPayComReqData(mchID.getParamValue(),paySecret.getParamValue(),"","",0,"","","");
 			JsApiPayComService jsApiPayComService=new JsApiPayComService();
 			result = jsApiPayBusiness.payComOrder(jsApiPayComService, jsApiPayComReqData);
 			LogUtil.info("#提现,企业付款到个人---result:{}",result);
@@ -155,15 +183,25 @@
 			int refundFee, String opUserID){
 		LogUtil.info("#---outTradeNo:{}#---outRefundNo:{}#---totalFee:{}#---refundFee:{}",
 				outTradeNo,outRefundNo,totalFee,refundFee);
+		BusParameterSettings mchID = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.WECHARPAY_APPID, HostInterceptor.getCompanyId());
 		if(opUserID==null){
-			opUserID=WechatConfigure.mchID;
+			opUserID=mchID.getParamValue();
 		}
 		RefundResData result=null;
 		boolean flag=false;
 		try {
 			JsApiPayBusiness jsApiPayBusiness = new JsApiPayBusiness();
-			RefundReqData refundReqData=new RefundReqData(outTradeNo, outRefundNo, totalFee, refundFee,opUserID);
+			Long companyId=HostInterceptor.getCompanyId();
+			BusParameterSettings paySecret = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.WECHARPAY_SECRET, companyId);
+			BusParameterSettings appId = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.WECHARPAY_APPID, companyId);
+			BusParameterSettings certLocalPath = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.WECHARPAY_CERTLOCAL_PATH, companyId);
+
+			RefundReqData refundReqData=new RefundReqData(mchID.getParamValue(),appId.getParamValue(),paySecret.getParamValue(), outTradeNo, outRefundNo, totalFee, refundFee,opUserID);
 			RefundService refundService=new RefundService();
+			HttpsRequest2 request2= (HttpsRequest2) refundService.getServiceRequest();
+			request2.setCertLocalPath(certLocalPath.getParamValue());
+			request2.setMchId(mchID.getParamValue());
+
 			result = jsApiPayBusiness.refundComOrder(refundService, refundReqData);
 			LogUtil.info("#退款,企业付款到个人---result:{}",result);
 			//如果返回余额不足时
@@ -191,12 +229,12 @@
 	 * @return
 	 */
 	public String getIpAddr(HttpServletRequest request) { 
-	       String ip = request.getHeader("x-forwarded-for"); 
-	      /* if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { 
-	           ip = request.getHeader("Proxy-Client-IP"); 
-	       } 
-	       if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { 
-	           ip = request.getHeader("WL-Proxy-Client-IP"); 
+	       String ip = request.getHeader("x-forwarded-for");
+	      /* if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+	           ip = request.getHeader("Proxy-Client-IP");
+	       }
+	       if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+	           ip = request.getHeader("WL-Proxy-Client-IP");
 	       } */
 	       if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { 
 	           ip = request.getRemoteAddr(); 
diff --git a/zq-erp/src/main/java/com/matrix/system/common/constance/AppConstance.java b/zq-erp/src/main/java/com/matrix/system/common/constance/AppConstance.java
index 0c0ac3c..56216fc 100644
--- a/zq-erp/src/main/java/com/matrix/system/common/constance/AppConstance.java
+++ b/zq-erp/src/main/java/com/matrix/system/common/constance/AppConstance.java
@@ -602,6 +602,30 @@
      */
     public static final String GZH_APPID = "gzhAppId";
 
+    /**
+     * 微信商户号
+     */
+    public static final String WECHARPAY_APPID = "wecharPayAppid";
+    /**
+     * 支付秘钥
+     */
+    public static final String WECHARPAY_SECRET = "wecharPaySecret";
+
+    /**
+     * 支付通知地址
+     */
+    public static final String WECHARPAY_NOTIFYURL = "wecharPaynotifyUrl";
+    /**
+     * 支付证书地址
+     */
+    public static final String WECHARPAY_CERTLOCAL_PATH = "certLocalPath";
+
+
+
+
+
+
+
 
 
 
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopRefundRecordAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopRefundRecordAction.java
index 4b25528..c790239 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopRefundRecordAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopRefundRecordAction.java
@@ -464,16 +464,14 @@
 		int reMoney = b1.multiply(bb).intValue();
 		LogUtil.info("退款退款金额{}", reMoney);
 
-		//Double refundMoney = 0.1 * 100;
-		//用户ID
-		String userId = WechatConfigure.mchID;
+
 
 		if (isDebug) {
-			boolean b = weixinServiceUtil.comRefund(orderNo, refundNo, 1, 1, userId);
+			boolean b = weixinServiceUtil.comRefund(orderNo, refundNo, 1, 1, null);
 			flag = b;
 		} else {
 			LogUtil.info("开始调用退款接口。。。退款编号为{}", refundNo);
-			boolean b = weixinServiceUtil.comRefund(orderNo, refundNo, orMoney, reMoney, userId);
+			boolean b = weixinServiceUtil.comRefund(orderNo, refundNo, orMoney, reMoney, null);
 			flag = b;
 		}
 
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WXShopOrderAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WXShopOrderAction.java
index d940ea1..54ca9f5 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WXShopOrderAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WXShopOrderAction.java
@@ -10,6 +10,7 @@
 import com.matrix.core.pojo.AjaxResult;
 import com.matrix.core.tools.StringUtils;
 import com.matrix.system.common.constance.AppConstance;
+import com.matrix.system.common.interceptor.HostInterceptor;
 import com.matrix.system.constance.Dictionary;
 import com.matrix.system.hive.bean.ShoppingGoods;
 import com.matrix.system.hive.dao.ShoppingGoodsDao;
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxCommonAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxCommonAction.java
index 568c875..cb91885 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxCommonAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxCommonAction.java
@@ -7,7 +7,10 @@
 import com.matrix.component.wechat.externalInterface.common.Signature;
 import com.matrix.component.wechat.externalInterface.common.Util;
 import com.matrix.component.wechat.externalInterface.protocol.queryProtocol.NotifyData;
+import com.matrix.system.common.bean.BusParameterSettings;
 import com.matrix.system.common.constance.AppConstance;
+import com.matrix.system.common.dao.BusParameterSettingsDao;
+import com.matrix.system.common.interceptor.HostInterceptor;
 import com.matrix.system.hive.bean.SysVipInfo;
 import com.matrix.system.hive.dao.SysVipInfoDao;
 import com.matrix.system.shopXcx.bean.ShopActivitiesGroupJoin;
@@ -75,6 +78,11 @@
     @Autowired
     private SysVipInfoDao sysVipInfoDao;
 
+    @Autowired
+    BusParameterSettingsDao busParameterSettingsDao;
+
+
+
     @Value("${evn}")
     private String evn;
     /**
@@ -86,7 +94,7 @@
      * @throws Exception
      */
     @Transactional(rollbackFor = Exception.class)
-    @RequestMapping(value = "/wxpayCallback")
+    @RequestMapping(value = "/wxapi/wxpayCallback")
     public void payCallBack(HttpServletResponse response, HttpServletRequest request) throws IOException {
         LogUtil.info("微信支付回调start....");
 
@@ -111,7 +119,8 @@
             // 返回状态码 SUCCESS/FAIL
             if (AppConstance.CODE_SUCCESS.equals(data.getReturn_code())) {
                 // 校验签名
-                if (Signature.checkIsSignValidFromResponseString(notityXml.toString())) {
+                BusParameterSettings paySecret = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.WECHARPAY_SECRET, HostInterceptor.getCompanyId());
+                if (Signature.checkIsSignValidFromResponseString(notityXml.toString(),paySecret.getParamValue())) {
                     // 校验业务结果
                     if (AppConstance.CODE_SUCCESS.equals(data.getResult_code())) {
                         // 返回SUCCESS报文
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopRefundRecordServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopRefundRecordServiceImpl.java
index 807ab9d..6030d3e 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopRefundRecordServiceImpl.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopRefundRecordServiceImpl.java
@@ -78,14 +78,13 @@
 
         //Double refundMoney = 0.1 * 100;
         //用户ID
-        String userId = WechatConfigure.mchID;
 
         if (isDebug) {
-            boolean b = weixinServiceUtil.comRefund(orderNo, refundNo, 1, 1, userId);
+            boolean b = weixinServiceUtil.comRefund(orderNo, refundNo, 1, 1, null);
             flag = b;
         } else {
             LogUtil.info("开始调用退款接口。。。退款编号为", refundNo);
-            boolean b = weixinServiceUtil.comRefund(orderNo, refundNo, orMoney, reMoney, userId);
+            boolean b = weixinServiceUtil.comRefund(orderNo, refundNo, orMoney, reMoney, null);
             flag = b;
         }
 
diff --git a/zq-erp/src/main/resources/config/test/system.properties b/zq-erp/src/main/resources/config/test/system.properties
index a6ae4c0..26d5253 100644
--- a/zq-erp/src/main/resources/config/test/system.properties
+++ b/zq-erp/src/main/resources/config/test/system.properties
@@ -1,5 +1,5 @@
 #是否启用debug模式
-debug=true
+debug=false
 # 日志文件保存地址
 log_path=/mnt/hive/log-test
 

--
Gitblit v1.9.1