jyy
2021-01-09 b5857b4fa654ac45f80e6c485a6c3ce12ca3870a
微信支付从数据库查询配置
3 files deleted
16 files modified
624 ■■■■ changed files
zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/common/HttpsRequest2.java 53 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/common/Signature.java 20 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/common/WechatConfigure.java 19 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/paramProtocol/BrandWCPayRequestData.java 6 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/payComProtocol/JsApiPayComReqData.java 6 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/payProtocol/JsApiPayReqData.java 23 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/queryProtocol/JsApiPayReqData.java 295 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/queryProtocol/ScanPayQueryReqData.java 6 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/refundProtocol/RefundReqData.java 8 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/rsaProtocal/JsApiRSAReqData.java 50 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/service/BaseService.java 4 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/service/JsApiGetPublicKeyService.java 19 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/weixinUtil/WeixinServiceUtil.java 62 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/common/constance/AppConstance.java 24 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopRefundRecordAction.java 8 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WXShopOrderAction.java 1 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxCommonAction.java 13 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopRefundRecordServiceImpl.java 5 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/config/test/system.properties 2 ●●● patch | view | raw | blame | history
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;
    }
}
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>"));
    }
    /**
     * 
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;
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这个属性中
    }
    
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();
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这个属性中
    }
    
zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/queryProtocol/JsApiPayReqData.java
File was deleted
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这个属性中
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这个属性中
    }
zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/protocol/rsaProtocal/JsApiRSAReqData.java
File was deleted
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;
    }
}
zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/service/JsApiGetPublicKeyService.java
File was deleted
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(); 
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";
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;
        }
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;
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报文
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;
        }
zq-erp/src/main/resources/config/test/system.properties
@@ -1,5 +1,5 @@
#是否启用debug模式
debug=true
debug=false
# 日志文件保存地址
log_path=/mnt/hive/log-test