KKSU
2024-01-18 5cac1da67768c3dbbcd74e50ad59cb80fb82def0
fapiao
4 files modified
326 ■■■■■ changed files
src/main/java/cc/mrbird/febs/pay/controller/XcxPayController.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/pay/service/WxFaPiaoService.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/pay/service/impl/WxFaPiaoServiceImpl.java 213 ●●●●● patch | view | raw | blame | history
src/test/java/cc/mrbird/febs/ProfitTest.java 108 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/pay/controller/XcxPayController.java
@@ -305,6 +305,8 @@
                        resXml = WechatConfigure.RESULT_XML_SUCCESS;
                        // 支付费用
                        Double total_fee = Double.parseDouble(data.getTotal_fee());
                        //微信支付订单号
                        String transaction_id = data.getTransaction_id();
                        // 商户订单号
                        String payNum = data.getOut_trade_no();
@@ -320,6 +322,7 @@
                            order.setPayResult("1");
                            order.setPayTime(new Date());
                            order.setDeliveryState(OrderDeliveryStateEnum.DELIVERY_WAIT.getValue());
                            order.setPayOrderNo(transaction_id);
                            mallOrderInfoMapper.updateById(order);
                            agentProducer.sendOrderCoupon(order.getId());
src/main/java/cc/mrbird/febs/pay/service/WxFaPiaoService.java
@@ -23,5 +23,7 @@
    String sendPost(String url, String params, String token);
    String sendGet(String url, Map<String, Object> params, String token);
    Map<String, Object> fapiaoCallBack(HttpServletRequest request, @RequestBody Map<String, Object> requestBody) throws IOException, NoSuchAlgorithmException, InvalidKeyException, SignatureException, ParseException;
}
src/main/java/cc/mrbird/febs/pay/service/impl/WxFaPiaoServiceImpl.java
@@ -8,26 +8,14 @@
import cc.mrbird.febs.pay.model.FPCertificateVo;
import cc.mrbird.febs.pay.model.FPCertificates;
import cc.mrbird.febs.pay.model.FPEncryptCertificate;
import cc.mrbird.febs.pay.model.HeaderDto;
import cc.mrbird.febs.pay.service.WxFaPiaoService;
import cc.mrbird.febs.pay.util.JCEUtil;
import cc.mrbird.febs.pay.util.RandomStringGenerator;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.aliyun.oss.internal.SignUtils;
import com.wechat.pay.contrib.apache.httpclient.auth.AutoUpdateCertificatesVerifier;
import com.wechat.pay.contrib.apache.httpclient.auth.PrivateKeySigner;
import com.wechat.pay.contrib.apache.httpclient.auth.WechatPay2Credentials;
import com.wechat.pay.contrib.apache.httpclient.auth.WechatPay2Validator;
import com.wechat.pay.contrib.apache.httpclient.notification.Notification;
import com.wechat.pay.contrib.apache.httpclient.notification.NotificationHandler;
import com.wechat.pay.contrib.apache.httpclient.notification.NotificationRequest;
import com.wechat.pay.contrib.apache.httpclient.util.AesUtil;
import com.wechat.pay.java.core.notification.Resource;
import io.undertow.util.Certificates;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import okhttp3.HttpUrl;
import org.apache.commons.httpclient.HttpClient;
@@ -38,9 +26,11 @@
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPatch;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Service;
@@ -48,7 +38,6 @@
import org.springframework.web.bind.annotation.RequestBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.security.*;
@@ -58,13 +47,8 @@
import java.security.spec.PKCS8EncodedKeySpec;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Base64;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@Slf4j
@Service
@@ -238,6 +222,60 @@
    }
    @Override
    public String sendGet(String url, Map<String, Object> params, String token) {
        String result = "";
        int err = 0;
        while (true) {
            CloseableHttpClient httpClient = HttpClients.createDefault();
            CloseableHttpResponse response = null;
            try {
                List<BasicNameValuePair> parameters = new ArrayList<>();
                for (Map.Entry<String, Object> entry : params.entrySet()) {
                    parameters.add(new BasicNameValuePair(entry.getKey(), entry.getValue().toString()));
                }
                StringBuilder dataparm = new StringBuilder();
                params.forEach((k, v) -> dataparm.append("&" + k + "=" + v));
                String urlparm = "";
                String string = dataparm.toString();
                if (!"".equals(string)) {
                    urlparm = dataparm.toString().substring(1);
                }
                HttpGet httpget = new HttpGet(url + "?" + urlparm);
                httpget.addHeader("Accept", "application/json");
                httpget.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36");
                httpget.addHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
                httpget.addHeader("Authorization", token);
                response = httpClient.execute(httpget, HttpClientContext.create());
                HttpEntity resEntity = response.getEntity();
                result = EntityUtils.toString(resEntity);
                return result;
            } catch (IOException e) {
                result = "{\"status\":\"1\",\"errors\":\"" + e.getMessage() + "\"}";
                if (err++ > 2) {
                    break;
                }
                try {
                    Thread.sleep((err + 2) * 1000);
                } catch (InterruptedException e1) {
                    result = "{\"status\":\"1\",\"errors\":\"" + e1.getMessage() + "\"}";
                }
            }finally {
                try {
                    httpClient.close();
                    if (response != null) {
                        response.close();
                    }
                } catch (IOException var22) {
                    var22.printStackTrace();
                }
            }
        }
        return result;
    }
    @Override
    public Map<String, Object> fapiaoCallBack(HttpServletRequest request, @RequestBody Map<String, Object> requestBody) throws IOException, NoSuchAlgorithmException, InvalidKeyException, SignatureException, ParseException {
        Map<String,Object> map = new HashMap<>();
        String signature = request.getHeader("Wechatpay-Signature");
@@ -257,27 +295,40 @@
        if (signCheck) {
            try {
                //解析请求体
//            Resource resource = com.alibaba.fastjson.JSONObject.parseObject(com.alibaba.fastjson.JSONObject.toJSONString(requestBody.get("resource")), Resource.class);
                Notification notification = com.alibaba.fastjson.JSONObject.parseObject(String.valueOf(body),Notification.class);
                log.info("微信电子发票回调接口....解析请求体:"+notification.toString());
                String decryptData = notification.getDecryptData();//可能是支付业务的回调数据
                log.info("微信电子发票回调接口....decryptData:"+notification.toString());
                Notification.Resource resource = notification.getResource();//电子发票的回调加密数据
                log.info("微信电子发票回调接口....resource:"+notification.toString());
                JSONObject jsonObject = JSONUtil.parseObj(body);
                log.info("微信电子发票回调接口....解析请求体:"+jsonObject);
                if ("FAPIAO.USER_APPLIED".equals(notification.getEventType())//用户发票抬头填写完成类型:FAPIAO.USER_APPLIED
                        && !"encryptresource".equals(notification.getResourceType())) {//通知的资源数据类型,确认成功通知为encryptresource。
                String id = jsonObject.getStr("id");//可能是支付业务的回调数据
                String create_time = jsonObject.getStr("create_time");//可能是支付业务的回调数据
                String resource_type = jsonObject.getStr("resource_type");//可能是支付业务的回调数据
                String event_type = jsonObject.getStr("event_type");//可能是支付业务的回调数据
                String resource = jsonObject.getStr("resource");//可能是支付业务的回调数据
                log.info("微信电子发票回调接口....id:"+ id);
                log.info("微信电子发票回调接口....create_time:"+ create_time);
                log.info("微信电子发票回调接口....resource_type:"+ resource_type);
                log.info("微信电子发票回调接口....event_type:"+ event_type);
                log.info("微信电子发票回调接口....resource:"+ resource);
                if ("FAPIAO.USER_APPLIED".equals(event_type)//用户发票抬头填写完成类型:FAPIAO.USER_APPLIED
                        && "encrypt-resource".equals(resource_type)) {//通知的资源数据类型,确认成功通知为encryptresource。
                    JCEUtil.removeCryptographyRestrictions();
                    //解密
                    AesUtil aesUtil = new AesUtil(xcxProperties.getWecharpaySecretV3().getBytes("utf-8"));
                    JSONObject jsonObjectResource = JSONUtil.parseObj(resource);
                    String original_type = jsonObjectResource.getStr("original_type");//可能是支付业务的回调数据
                    String algorithm = jsonObjectResource.getStr("algorithm");//可能是支付业务的回调数据
                    String ciphertext = jsonObjectResource.getStr("ciphertext");//可能是支付业务的回调数据
                    String associated_data = jsonObjectResource.getStr("associated_data");//可能是支付业务的回调数据
                    String nonceStr = jsonObjectResource.getStr("nonce");//可能是支付业务的回调数据
                    String decryptToString = aesUtil.decryptToString(
                            resource.getAssociatedData().getBytes("utf-8"),
                            resource.getNonce().getBytes("utf-8"),
                            resource.getCiphertext());
                            associated_data.getBytes("utf-8"),
                            nonceStr.getBytes("utf-8"),
                            ciphertext);
                    log.info("微信电子发票回调接口....resource解密:"+decryptToString);
                    JSONObject parseObj = JSONUtil.parseObj(decryptToString);
                    log.info("微信电子发票回调接口....resource解密-JSONObject:"+parseObj);
                    String fapiao_apply_id = String.valueOf(parseObj.get("fapiao_apply_id"));
                    String fapiao_apply_id = parseObj.getStr("fapiao_apply_id");
                    log.info("微信电子发票回调接口....resource解密-fapiao_apply_id:"+fapiao_apply_id);
                    MallOrderInfo mallOrderInfo = mallOrderInfoMapper.selectByOrderNo(fapiao_apply_id);
                    if(ObjectUtil.isNotEmpty(mallOrderInfo)){
                        //省略查询订单
@@ -350,61 +401,75 @@
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
        HttpClient httpClient = new HttpClient();
        //请求URL
        GetMethod method = new GetMethod(baseUrl+canonicalUrl);
        method.setRequestHeader("Accept", "application/json");
        method.setRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36");
        method.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
//            method.setRequestHeader("Connection", "keep-alive");
        method.setRequestHeader("Authorization", "WECHATPAY2-SHA256-RSA2048 "+postStr);
        int statusCode = httpClient.executeMethod(method);
        //完成签名并执行请求
        X509Certificate x509Certificate = null;
        try {
            if (statusCode == 200) { //处理成功
//                System.out.println("success,return body = " + EntityUtils.toString(response.getEntity()));
            String responseBodyAsString = this.sendGet(baseUrl + canonicalUrl, new HashMap<>(), "WECHATPAY2-SHA256-RSA2048 "+postStr);
            FPCertificateVo certificateVo = com.alibaba.fastjson.JSONObject.parseObject(responseBodyAsString, FPCertificateVo.class);
            for (FPCertificates certificates : certificateVo.getData()) {
                if (format.parse(certificates.getEffective_time()).before(new Date())
                        && format.parse(certificates.getExpire_time()).after(new Date())) {
                    FPEncryptCertificate encrypt_certificate = certificates.getEncrypt_certificate();
                    //解密
                    AesUtil aesUtil = new AesUtil(xcxProperties.getWecharpaySecretV3().getBytes("utf-8"));
                    String pulicKey = aesUtil.decryptToString(
                            encrypt_certificate.getAssociated_data().getBytes("utf-8"),
                            encrypt_certificate.getNonce().getBytes("utf-8"),
                            encrypt_certificate.getCiphertext());
                    //获取平台证书
                    final CertificateFactory cf = CertificateFactory.getInstance("X509");
                String responseBodyAsString = method.getResponseBodyAsString();
                FPCertificateVo certificateVo = com.alibaba.fastjson.JSONObject.parseObject(responseBodyAsString, FPCertificateVo.class);
                for (FPCertificates certificates : certificateVo.getData()) {
                    if (format.parse(certificates.getEffective_time()).before(new Date())
                            && format.parse(certificates.getExpire_time()).after(new Date())) {
                        FPEncryptCertificate encrypt_certificate = certificates.getEncrypt_certificate();
                        //解密
                        AesUtil aesUtil = new AesUtil(xcxProperties.getWecharpaySecretV3().getBytes("utf-8"));
                        String pulicKey = aesUtil.decryptToString(
                                encrypt_certificate.getAssociated_data().getBytes("utf-8"),
                                encrypt_certificate.getNonce().getBytes("utf-8"),
                                encrypt_certificate.getCiphertext());
                        //获取平台证书
                        final CertificateFactory cf = CertificateFactory.getInstance("X509");
                    ByteArrayInputStream inputStream = new ByteArrayInputStream(pulicKey.getBytes(StandardCharsets.UTF_8));
                        ByteArrayInputStream inputStream = new ByteArrayInputStream(pulicKey.getBytes(StandardCharsets.UTF_8));
                        x509Certificate = (X509Certificate) cf.generateCertificate(inputStream);
                    }
                    x509Certificate = (X509Certificate) cf.generateCertificate(inputStream);
                }
                return x509Certificate;
            } else if (statusCode == 204) { //处理成功,无返回Body
                return x509Certificate;
            } else {
                return x509Certificate;
            }
            return x509Certificate;
        } catch (GeneralSecurityException | ParseException e) {
            e.printStackTrace();
            return null;
        }
        return null;
    }
    public static void main(String[] args) {
        byte[] bytes = new byte[0];
        try {
            bytes = "DVREEVEREBERykpbgqcfsdsfggsdg".getBytes("utf-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
    public static void main(String[] args) throws UnsupportedEncodingException, GeneralSecurityException {
        JCEUtil.removeCryptographyRestrictions();
        String body = "{\"id\":\"5fb7f522-466f-5c99-a325-0eb4001f1ec3\",\"create_time\":\"2024-01-17T15:38:33+08:00\",\"resource_type\":\"encrypt-resource\",\"event_type\":\"FAPIAO.USER_APPLIED\",\"summary\":\"用户已申请开票\",\"resource\":{\"original_type\":\"fapiao\",\"algorithm\":\"AEAD_AES_256_GCM\",\"ciphertext\":\"bBOs5WTUV1AhwiYSIUugaw9z4EHXxC28ZVsGHOppCNP4qpxYgnR+W+l983UyETmD/Wgu8ukJhe/xYkSsF947pgDP1ElTXC8MJA3lCc8NlsXQ1csPfWTS6A0XrxBoNMgwGEsYFo/7tPW/zDrEpzRZL/GgEwEtK6X1Y4Ci9IofzeI=\",\"associated_data\":\"fapiao\",\"nonce\":\"7a5dzuYqStef\"}}";
        JSONObject jsonObject = JSONUtil.parseObj(body);
        log.info("微信电子发票回调接口....解析请求体:"+jsonObject);
        String id = jsonObject.getStr("id");//可能是支付业务的回调数据
        String create_time = jsonObject.getStr("create_time");//可能是支付业务的回调数据
        String resource_type = jsonObject.getStr("resource_type");//可能是支付业务的回调数据
        String event_type = jsonObject.getStr("event_type");//可能是支付业务的回调数据
        String resource = jsonObject.getStr("resource");//可能是支付业务的回调数据
        log.info("微信电子发票回调接口....id:"+ id);
        log.info("微信电子发票回调接口....create_time:"+ create_time);
        log.info("微信电子发票回调接口....resource_type:"+ resource_type);
        log.info("微信电子发票回调接口....event_type:"+ event_type);
        log.info("微信电子发票回调接口....resource:"+ resource);
        if ("FAPIAO.USER_APPLIED".equals(event_type)//用户发票抬头填写完成类型:FAPIAO.USER_APPLIED
                && !"encryptresource".equals(resource_type)) {//通知的资源数据类型,确认成功通知为encryptresource。
            //解密
            AesUtil aesUtil = new AesUtil("daL341aN5orDt13puXadsAf2rpuX12v3".getBytes("utf-8"));
            JSONObject jsonObjectResource = JSONUtil.parseObj(resource);
//            String original_type = jsonObjectResource.getStr("original_type");//可能是支付业务的回调数据
//            String algorithm = jsonObjectResource.getStr("algorithm");//可能是支付业务的回调数据
            String ciphertext = jsonObjectResource.getStr("ciphertext");//可能是支付业务的回调数据
            String associated_data = jsonObjectResource.getStr("associated_data");//可能是支付业务的回调数据
            String nonce = jsonObjectResource.getStr("nonce");//可能是支付业务的回调数据
            String decryptToString = aesUtil.decryptToString(
                    associated_data.getBytes("utf-8"),
                    nonce.getBytes("utf-8"),
                    ciphertext);
            log.info("微信电子发票回调接口....resource解密:"+decryptToString);
            JSONObject parseObj = JSONUtil.parseObj(decryptToString);
            log.info("微信电子发票回调接口....resource解密-JSONObject:"+parseObj);
            String fapiao_apply_id = parseObj.getStr("fapiao_apply_id");
            log.info("微信电子发票回调接口....resource解密-fapiao_apply_id:"+fapiao_apply_id);
        }
        System.out.println(bytes.length);
    }
}
src/test/java/cc/mrbird/febs/ProfitTest.java
@@ -46,6 +46,7 @@
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
@@ -196,54 +197,44 @@
    @Test
    public void rankProfit04() throws IOException {//获取用户填写的抬头
        FPUserTitleDto fpUserTitleDto = new FPUserTitleDto();
        fpUserTitleDto.setScene("WITH_WECHATPAY");
        fpUserTitleDto.setFapiao_apply_id("");
        String parseObj = JSONUtil.parseObj(fpUserTitleDto).toString();
        //初始化请求参数
        Map<String, Object> params = new HashMap<>();
        params.put("scene","WITH_WECHATPAY");
        params.put("fapiao_apply_id","4200002070202401175245187105");
        String parseObj = JSONUtil.parseObj(params).toString();
        System.out.println(parseObj);
        String baseUrl = "https://api.mch.weixin.qq.com";
        String canonicalUrl = "/v3/new-tax-control-fapiao/user-title";
        String urlparm = baseUrl+canonicalUrl;//有参数的get请求,加密是需要把参数加载进去URL
        List<BasicNameValuePair> parameters = new ArrayList<>();
        for (Map.Entry<String, Object> entry : params.entrySet()) {
            parameters.add(new BasicNameValuePair(entry.getKey(), entry.getValue().toString()));
        }
        StringBuilder dataparm = new StringBuilder();
        params.forEach((k, v) -> dataparm.append("&" + k + "=" + v));
        String string = dataparm.toString();
        if (!"".equals(string)) {
            urlparm = baseUrl+canonicalUrl + "?" + dataparm.substring(1);
        }
        System.out.println(urlparm);
        PrivateKey privateKey = wxFaPiaoService.getPrivateKeyV3();
        String postStr = null;
        try {
            postStr = wxFaPiaoService.createAuthorization(
                    "POST",
                    baseUrl+canonicalUrl,
                    parseObj,
                    "GET",
                    urlparm,
                    "",
                    privateKey
            );
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
        String token = AppContants.FP_TOKEN_HEADER_TYPE+postStr;
        System.out.println("WECHATPAY2-SHA256-RSA2048 "+postStr);
        String s = wxFaPiaoService.sendPost(baseUrl + canonicalUrl, parseObj, "WECHATPAY2-SHA256-RSA2048 "+postStr);
        String s = wxFaPiaoService.sendGet(baseUrl+canonicalUrl, params, "WECHATPAY2-SHA256-RSA2048 "+postStr);
        System.out.println(s);
        cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(s);
        System.out.println(jsonObject);
    }
    @Test
    public void rankProfit05() throws IOException {//获取用户填写的抬头
        byte[] bytes = "daL341aN5orDt13puXadsAf2rpuX12v3".getBytes("utf-8");
        try {
            //传入证书
            PrivateKey privateKey = wxFaPiaoService.getPrivateKeyV3();
            //刷新
            PrivateKeySigner signer = new PrivateKeySigner(AppContants.WX_CARD_NUM, privateKey);
            WechatPay2Credentials credentials = new WechatPay2Credentials("1658958205", signer);
            AutoUpdateCertificatesVerifier autoUpdateCertificatesVerifier = new AutoUpdateCertificatesVerifier(credentials
                    , bytes);
            NotificationHandler handler = new NotificationHandler(autoUpdateCertificatesVerifier,bytes);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
                                }
    @Test
    public void rankProfit2() throws IOException {//查询配置开发选项
@@ -263,22 +254,25 @@
            e.printStackTrace();
        }
        System.out.println("WECHATPAY2-SHA256-RSA2048"+postStr);
        try {
            HttpClient httpClient = new HttpClient();
            GetMethod method = new GetMethod(baseUrl+canonicalUrl);
            method.setRequestHeader("Accept", "application/json");
            method.setRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36");
            method.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
            method.setRequestHeader("Connection", "keep-alive");
            method.setRequestHeader("Authorization", "WECHATPAY2-SHA256-RSA2048 "+postStr);
            httpClient.executeMethod(method);
            System.out.println(method);
            String responseBodyAsString = method.getResponseBodyAsString();
            cn.hutool.json.JSONObject maps = JSONUtil.parseObj(responseBodyAsString);
            System.out.println(maps);
        } catch (IOException e) {
            e.printStackTrace();
        }
        String s = wxFaPiaoService.sendGet(baseUrl + canonicalUrl, new HashMap<>(), "WECHATPAY2-SHA256-RSA2048 "+postStr);
        System.out.println(s);
//        try {
//            HttpClient httpClient = new HttpClient();
//            GetMethod method = new GetMethod(baseUrl+canonicalUrl);
//            method.setRequestHeader("Accept", "application/json");
//            method.setRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36");
//            method.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
//            method.setRequestHeader("Connection", "keep-alive");
//            method.setRequestHeader("Authorization", "WECHATPAY2-SHA256-RSA2048 "+postStr);
//            httpClient.executeMethod(method);
//            System.out.println(method);
//            String responseBodyAsString = method.getResponseBodyAsString();
//            cn.hutool.json.JSONObject maps = JSONUtil.parseObj(responseBodyAsString);
//            System.out.println(maps);
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
    }
@@ -301,18 +295,8 @@
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
        HttpClient httpClient = new HttpClient();
        String responseBodyAsString = wxFaPiaoService.sendGet(baseUrl + canonicalUrl, new HashMap<>(), "WECHATPAY2-SHA256-RSA2048 "+postStr);
        try {
            GetMethod method = new GetMethod(baseUrl+canonicalUrl);
            method.setRequestHeader("Accept", "application/json");
            method.setRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36");
            method.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
//            method.setRequestHeader("Connection", "keep-alive");
            method.setRequestHeader("Authorization", "WECHATPAY2-SHA256-RSA2048 "+postStr);
            int i = httpClient.executeMethod(method);
            System.out.println(i);
            System.out.println(method);
            String responseBodyAsString = method.getResponseBodyAsString();
            cn.hutool.json.JSONObject maps = JSONUtil.parseObj(responseBodyAsString);
            System.out.println(maps);