当前位置:   article > 正文

hutool工具进行https接口调用(忽略ssl认证)_hutool ssl

hutool ssl

1.设置忽略SSl工具类

package com.ruoyi.config.zhuanliju;

/**
 * @author cf
 * @date 2023/7/3下午 1:06
 */
import javax.net.ssl.*;
import java.security.SecureRandom;
import java.security.cert.X509Certificate;

public class SSLUtils {
    /**
     * 忽略https证书验证
     * @return
     */
    public static SSLSocketFactory getSSLSocketFactory() {
        try {
            SSLContext sslContext = SSLContext.getInstance("SSL");
            sslContext.init(null, getTrustManager(), new SecureRandom());
            return sslContext.getSocketFactory();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    private static TrustManager[] getTrustManager() {
        TrustManager[] trustAllCerts = new TrustManager[]{
            new X509TrustManager() {
                //检查客户端证书,若不信任该证书抛出异常,咱们自己就是客户端不用检查
                @Override
                public void checkClientTrusted(X509Certificate[] chain, String authType) {
                }
                //检查服务器的证书,若不信任该证书抛出异常,可以不检查默认都信任
                @Override
                public void checkServerTrusted(X509Certificate[] chain, String authType) {
                }
                //返回受信任的X509证书数组
                @Override
                public X509Certificate[] getAcceptedIssuers() {
                    return new X509Certificate[]{};
                }
            }
        };
        return trustAllCerts;
    }
}



  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49

2.工具类设置

package com.ruoyi.config.zhuanliju;

import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile;

import javax.net.ssl.*;
import javax.servlet.http.HttpServletRequest;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.time.LocalDateTime;
import java.util.Iterator;
import java.util.Map;
import java.util.UUID;

public class ZljHttpsUtil implements TrustManager, X509TrustManager {

    private final static String BOUNDARY = "----WebKitFormBoundarygrBcuHVTeNQcBtqn";

    public X509Certificate[] getAcceptedIssuers()
    {
        return null;
    }


    public boolean isServerTrusted(X509Certificate[] certs)
    {
        return true;
    }

    public boolean isClientTrusted(X509Certificate[] certs)
    {
        return true;
    }


    public void checkServerTrusted(X509Certificate[] certs, String authType) throws CertificateException
    {
        return;
    }


    public void checkClientTrusted(X509Certificate[] certs, String authType) throws CertificateException
    {
        return;
    }


    public static class TrustAnyTrustManager implements X509TrustManager {
        /**
         * 该方法检查客户端的证书,若不信任该证书则抛出异常。由于我们不需要对客户端进行认证,因此我们只需要执行默认的信任管理器的这
         * 个方法。
         * JSSE中,默认的信任管理器类为TrustManager。
         */
        @Override
        public void checkClientTrusted(X509Certificate[] chain, String authType)
            throws CertificateException {
        }

        /**
         * 该方法检查服务器的证书,若不信任该证书同样抛出异常。通过自己实现该方法,可以使之信任我们指定的任何证书。
         * 在实现该方法时,也可以简单的不做任何处理, 即一个空的函数体,由于不会抛出异常,它就会信任任何证书。(non-Javadoc)
         */
        @Override
        public void checkServerTrusted(X509Certificate[] chain, String authType)
            throws CertificateException {
        }

        /**
         * @return 返回受信任的X509证书数组。
         */
        @Override
        public X509Certificate[] getAcceptedIssuers() {
            return new X509Certificate[]{};
        }
    }

    public static class TrustAnyHostnameVerifier implements HostnameVerifier {
        @Override
        public boolean verify(String hostname, SSLSession session) {
            return true;
        }
    }

    private static String getUUID() {
        UUID uuid = UUID.randomUUID();
        String str = uuid.toString();
        return str.replace("-", "");
    }

    /**
     * Description:sendJsonAndFileToHttpsPost 保存文件和文本参数接口  todo:可以访问,但显示服务器内部错误
     * @date  2023/11/14 15:06
     * @auther zhuenci
     * @param url
     * @param fileBytes
     * @param map
     * @param token
     * @return
     **/

    public static String sendJsonAndFileToHttpsPost(String url, Map<String,Object> map, byte[] fileBytes, String fileName, String token){
        System.out.println("【"+LocalDateTime.now()+"】==================================调用专利业务办理系统接口请求开始===================================");
        if (StringUtils.isNotBlank(fileName)) {
            try {
                SSLContext sc = SSLContext.getInstance("SSL");
                sc.init(null, new TrustManager[]{new TrustAnyTrustManager()},
                    new java.security.SecureRandom());
                System.out.println("url路径为:"+url);
                URL urlObj = new URL(url);
                HttpsURLConnection con = (HttpsURLConnection) urlObj.openConnection();
                con.setSSLSocketFactory(sc.getSocketFactory());
                //conn.setRequestMethod(requestMethod);
                con.setHostnameVerifier(new TrustAnyHostnameVerifier());
                con.setRequestMethod("POST");
                con.setDoInput(true);
                con.setDoOutput(true);
                con.setUseCaches(false);         //不使用缓存
                con.setInstanceFollowRedirects(true);
                //con.setFixedLengthStreamingMode(filee.length());
                String boundary = "----WebKitFormBoundaryH7JEPCAd6W4ylusd";
                con.setRequestProperty("Accept", "application/json, text/plain, */*");
                con.setRequestProperty("Accept-Encoding", "gzip, deflate, br");
                con.setRequestProperty("Accept-Language", "zh-CN,zh;q=0.9");
                con.setRequestProperty("Connection", "keep-alive");
                //con.setRequestProperty("Content-Length", "198");
                con.setRequestProperty("Host", "api.cponline.cnipa.gov.cn");
                con.setRequestProperty("Origin", "https://interactive.cponline.cnipa.gov.cn");
                con.setRequestProperty("Referer", "https://interactive.cponline.cnipa.gov.cn/");
                con.setRequestProperty("Sec-Fetch-Des", "empty");
                con.setRequestProperty("Sec-Fetch-Mode", "cors");
                con.setRequestProperty("Sec-Fetch-Site", "same-site");
                con.setRequestProperty("User-Agen", "Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.0.35 Safari/537.36 JiSu/100.0.0.35");
                con.setRequestProperty("Authorization", token);
                con.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary);
                //写入输出流
                OutputStream output = new DataOutputStream(con.getOutputStream());
                // text
                if (!CollectionUtils.isEmpty(map)) {
                    StringBuffer strBuf = new StringBuffer();
                    Iterator iter = map.entrySet().iterator();
                    while (iter.hasNext()) {
                        Map.Entry entry = (Map.Entry) iter.next();
                        String inputName = (String) entry.getKey();
                        Object inputValue = entry.getValue();
                        if (inputValue == null) {
                            continue;
                        }
                        strBuf.append("\r\n").append("--").append(boundary).append("\r\n");
                        strBuf.append("Content-Disposition: form-data; name=\"" + inputName + "\"\r\n\r\n");
                        strBuf.append(inputValue).append("\r\n");
                    }
                    output.write(strBuf.toString().getBytes("utf-8"));
                }
                byte[] endData = ("\r\n--" + boundary + "--\r\n").getBytes("utf-8");
                output.write(endData);
                // 刷新
                //output.flush();
                if(null != fileBytes && fileBytes.length>0){
                    output.write(("--" + boundary + "\r\n").getBytes("utf-8"));
                    output.write(("Content-Disposition: form-data; name=\"file\"; filename=\"" + fileName + "\"\r\n").getBytes("utf-8"));
                    output.write("Content-Type: application/octet-stream\r\n\r\n".getBytes("utf-8"));
                    output.write(fileBytes);
                    output.write("\r\n".getBytes("utf-8"));
                    output.write(("--" + boundary + "--\r\n").getBytes("utf-8"));
                    output.flush();
                }
                int responseCode = con.getResponseCode();
                System.out.println("Response Code: " + responseCode);
                //读取输入流
                InputStream is;
                if(responseCode == 200){
                    is = con.getInputStream();
                }else{
                    is = con.getErrorStream();
                }
                if(null != is){
                    ByteArrayOutputStream outStream = new ByteArrayOutputStream();
                    byte[] buffer2 = new byte[1024];
                    int len = 0;
                    while ((len = is.read(buffer2)) != -1) {
                        outStream.write(buffer2, 0, len);
                    }
                    is.close();
                    String s = outStream.toString(Constants.UTF8);
                    System.out.println("专利业务办理系统上传文件返回结果为:"+s);
                    System.out.println("【"+LocalDateTime.now()+"】==================================调用专利业务办理系统接口请求结束===================================");
                    return s;
                }

            } catch (Exception e){
                System.out.println("JSON数据发送失败,异常:"+ e.getMessage());
                e.printStackTrace();
            }
        }
        return null;
    }



    /**
     * Description:sendJsonAndFileToHttpsPost 保存文件和文本参数接口
     * @date  2023/11/14 15:06
     * @auther zhuenci
     * @param strUrl
     * @param fileParams
     * @param params
     * @param token
     * @return
     **/
    public static String sendJsonAndFileToHttpsPost(String strUrl, Map<String, Object> params, Map<String, byte[]> fileParams, String fileName, String token) {
        System.out.println("【sendJsonAndFileToHttpsPost"+ LocalDateTime.now()+"】==================================调用专利业务办理系统接口请求开始===================================");
        System.out.println("*******sendJsonAndFileToHttpsPost参数为:\n strUrl:"+strUrl +"\n params:"+params +" \n fileParams:"+fileParams+" \n");
        URL url;
        InputStream in;
        String TWO_HYPHENS = "--";
        String LINE_END = "\r\n";
        try {
            url = new URL(strUrl);
            SSLContext sc = SSLContext.getInstance("SSL");
            sc.init(null, new TrustManager[]{new ZljHttpsUtil.TrustAnyTrustManager()},
                new java.security.SecureRandom());
            System.out.println("url路径为:"+url);
            //得到connection对象
            HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
            connection.setSSLSocketFactory(sc.getSocketFactory());
            //conn.setRequestMethod(requestMethod);
            connection.setHostnameVerifier(new ZljHttpsUtil.TrustAnyHostnameVerifier());
            /************************************设置请求头*************************************************/
            //设置请求方式为POST
            connection.setRequestMethod("POST");
            //允许写出
            connection.setDoOutput(true);
            //允许读入
            connection.setDoInput(true);
            //不使用缓存
            connection.setUseCaches(false);
            //本次连接是否自动处理重定向(true:系统自动处理重定向;false:则需要自己从http reply中分析新的url)(置所有的http连接是否自动处理重定向:public static void HttpURLConnection.setFollowRedirects(boolean followRedirects))
            connection.setInstanceFollowRedirects(true);
            //编码格式
            connection.setRequestProperty("Charset", "utf-8");
            // 设置发送数据的格式(form-data格式)   //boundary为头部分隔符,头部拼接时需要分隔符。例如下面的有多个"Content-Disposition"拼接时需要用到此分隔符
            connection.setRequestProperty("Content-Type", "multipart/form-data ; boundary=" + BOUNDARY);
            // 设置接收数据的格式(json格式)
            connection.setRequestProperty("Accept", "application/json, text/plain, */*");
            connection.setRequestProperty("Host", "api.cponline.cnipa.gov.cn");
            connection.setRequestProperty("Origin", "https://interactive.cponline.cnipa.gov.cn");
            connection.setRequestProperty("Referer", "https://interactive.cponline.cnipa.gov.cn/");
            connection.setRequestProperty("Authorization", token);
            connection.connect(); //连接
            /************************************输出流,写数据,start*************************************************/
            //获得输出流对象,此种默认post
            DataOutputStream out = new DataOutputStream(connection.getOutputStream());
            StringBuffer strBufparam = new StringBuffer();
            Iterator it = params.entrySet().iterator();
            while (it.hasNext()) {
                //封装键值对数据
                Map.Entry<String, Object> entry = (Map.Entry) it.next();
                String key = entry.getKey();
                Object value = entry.getValue();

                strBufparam.append(TWO_HYPHENS);
                strBufparam.append(BOUNDARY);
                //"--" + BOUNDARY + "\r\n"
                strBufparam.append(LINE_END);
                strBufparam.append("Content-Disposition: form-data; name=\"" + key + "\"");
                strBufparam.append(LINE_END);
                strBufparam.append(LINE_END);
                strBufparam.append(value);
                strBufparam.append(LINE_END);
            }
            out.write(strBufparam.toString().getBytes("utf-8"));
            strBufparam.toString().getBytes();
            //写入图片参数
            if (fileParams != null && fileParams.size() > 0) {
                Iterator fileIt = fileParams.entrySet().iterator();
                while (fileIt.hasNext()) {
                    Map.Entry<String, byte[]> fileEntry = (Map.Entry<String, byte []>) fileIt.next();
                    //拼接文件的参数
                    StringBuffer strBufFile = new StringBuffer();
                    strBufFile.append(TWO_HYPHENS);
                    strBufFile.append(BOUNDARY);
                    strBufFile.append(LINE_END);
                    //strBufFile.append("Content-Disposition: form-data; name=\"" + "image" + "\"; filename=\"" + file.getName() + "\"");
                    // fileEntry.getKey():文件全路径。fileName:文件名称
                    strBufFile.append("Content-Disposition: form-data; name=\"" + fileEntry.getKey() + "\"; filename=\"" + fileName + "\"");
                    strBufFile.append(LINE_END);
                    //此处很关键----文件格式
                    strBufFile.append("Content-Type: application/octet-stream");
                    strBufFile.append(LINE_END);
                    strBufFile.append(LINE_END);
                    out.write(strBufFile.toString().getBytes());
                    //文件 (此参数之前调用了本页面的重写方法getBytes(File f),将文件转换为字节数组了 )
                    out.write(fileEntry.getValue());
                    out.write((LINE_END).getBytes());
                }
            }

            //写入标记结束位
            byte[] endData = ( TWO_HYPHENS + BOUNDARY + TWO_HYPHENS + LINE_END).getBytes();
            out.write(endData);
            out.flush();
            out.close();
            /************************************输出流,写数据完成end*************************************************/
            int code = connection.getResponseCode(); //获得响应码(200为成功返回)
            try {
                if (code == HttpURLConnection.HTTP_OK) {
                    in = connection.getInputStream(); //获取响应流
                } else {
                    in = connection.getErrorStream(); //获取错误响应流
                }
            } catch (SSLException e) {
                e.printStackTrace();
                return "";
            }
            /**********读取返回的输入流信息**************/
            ByteArrayOutputStream baout = new ByteArrayOutputStream();
            byte[] buff = new byte[1024];
            int len;
            while ((len = in.read(buff)) != -1) {
                baout.write(buff, 0, len);
            }
            byte[]  bytes = baout.toByteArray();
            in.close();
            String ret = new String(bytes, "utf-8") ;
            System.out.println("专利业务办理系统上传文件返回结果为:"+ret);
            System.out.println("【sendJsonAndFileToHttpsPost"+LocalDateTime.now()+"】==================================调用专利业务办理系统接口请求结束===================================");
            return ret;
        }catch(Exception e){
            System.out.println("sendJsonAndFileToHttpsPost方法JSON数据发送失败,异常:"+e.getMessage());
            e.printStackTrace();
        }
        return null;
    }


    /**
     * Description:单层get方法参数设置
     * @date  2023/11/13 17:00
     * @auther zhuenci
     * @param url
     * @return URL
     **/

    public static URL getUrl(String url, String content,String requestMethod) throws MalformedURLException {
        String returnUrl;
        if("GET".equals(requestMethod) && StringUtils.isNotBlank(content)){
            String[] paramsInfo = content.split(",");
            String newContent = "";
            for(int i =0;i<paramsInfo.length;i++){
                String[] param = paramsInfo[i].split(":");
                if(i == 0){
                    newContent = newContent + param[0].replace("{","").replace("\"","")+"=";
                }else{
                    newContent = newContent + param[0].replace("\"","")+"=";
                }
                if(StringUtils.isNotBlank(param[1])){
                    if (i == paramsInfo.length - 1) {
                        newContent = newContent + param[1].replace("}","").replace("\"","");
                    }else{
                        newContent = newContent + param[1].replace("\"","");
                    }
                }else{
                    newContent = newContent + "";
                }
                if(i  < paramsInfo.length-1){
                    newContent = newContent + "&";
                }
            }
            returnUrl = url + "?" +newContent;
        }else{
            returnUrl = url;
        }
        System.out.println("目前地址信息为"+returnUrl);
        URL console = new URL(returnUrl);
        return console;
    }

    public static void main(String[] args) throws MalformedURLException {
        System.out.println(JSONObject.toJSONString(getUrl("https://interactive.cponline.cnipa.gov.cn",
                "{\"dianzisqajbh\":\"10000515094528\",\"rule_groupcode\":\"10\",\"xxxx\":10,\"weww\":\"wwwww\"}",
                "GET")));
    }

    public static String sendDataToHttpsPost(HttpServletRequest request,String url,String token){
        System.out.println("【sendDataToHttpsPost"+LocalDateTime.now()+"】==================================调用专利业务办理系统接口请求开始===================================");
        System.out.println("url路径为:"+url);
        String body = null;
        try (StringWriter writer = new StringWriter()) {
            BufferedReader reader = request.getReader();
            int read;
            char[] buf = new char[1024 * 8];
            while ((read = reader.read(buf)) != -1) {
                writer.write(buf, 0, read);
            }
            body = writer.getBuffer().toString();
            System.out.println("=========================================================");
            System.out.println("请求体参数为:"+body);
            System.out.println("=========================================================");
        }catch (Exception e){
            e.printStackTrace();
        }
        HttpResponse execute = HttpRequest.post(url)
            .header("Authorization", token)
            .header("Content-Type", "application/json;charset=UTF-8")
            .header("Host", "api.cponline.cnipa.gov.cn")
            .header("Origin", "https://interactive.cponline.cnipa.gov.cn")
            .header("Referer", "https://interactive.cponline.cnipa.gov.cn/")
            .setSSLSocketFactory(SSLUtils.getSSLSocketFactory())
            .body(body).execute();
        if (execute.isOk()){
            String post = execute.body();
            System.out.println("=========================================================");
            System.out.println("返回结果为:"+post);
            System.out.println("=========================================================");
            return post;
        }else{
            //错误状态码
            int status = execute.getStatus();
            System.out.println("=========================================================");
            System.out.println("错误状态码为:"+status);
            System.out.println("=========================================================");
        }
        System.out.println("【sendDataToHttpsPost"+LocalDateTime.now()+"】==================================调用专利业务办理系统接口请求结束===================================");
        return null;
    }
    public static String sendDataToHttpsGet(HttpServletRequest request,String url,String token){
        System.out.println("【sendDataToHttpsGet"+LocalDateTime.now()+"】==================================调用专利业务办理系统接口请求开始===================================");
        System.out.println("url路径为:"+url);
        String body = null;
        try (StringWriter writer = new StringWriter()) {
            BufferedReader reader = request.getReader();
            int read;
            char[] buf = new char[1024 * 8];
            while ((read = reader.read(buf)) != -1) {
                writer.write(buf, 0, read);
            }
            body = writer.getBuffer().toString();
            System.out.println("=========================================================");
            System.out.println("请求体参数为:"+body);
            System.out.println("=========================================================");
        }catch (Exception e){
            e.printStackTrace();
        }
        HttpResponse execute = HttpRequest.get(url)
            .header("Authorization", token)
            .header("Content-Type", "application/json;charset=UTF-8")
            .header("Host", "api.cponline.cnipa.gov.cn")
            .header("Origin", "https://interactive.cponline.cnipa.gov.cn")
            .header("Referer", "https://interactive.cponline.cnipa.gov.cn/")
            .setSSLSocketFactory(SSLUtils.getSSLSocketFactory())
            .body(body).execute();
        if (execute.isOk()){
            String post = execute.body();
            System.out.println("=========================================================");
            System.out.println("返回结果为:"+post);
            System.out.println("=========================================================");
            return post;
        }else{
            //错误状态码
            int status = execute.getStatus();
            System.out.println("=========================================================");
            System.out.println("错误状态码为:"+status);
            System.out.println("=========================================================");
        }
        System.out.println("【sendDataToHttpsGet"+LocalDateTime.now()+"】==================================调用专利业务办理系统接口请求结束===================================");
        return null;
    }

    /**
     * post方式请求服务器(https协议)
     *
     * @param url     求地址
     * @param content 参数
     * @param requestMethod 请求类型(POST,GET)
     * @param token
     * @return
     */
    public static String sendJsonToHttpsPost(String url, String content,String requestMethod,String token) {
        System.out.println("【sendJsonToHttpsPost"+LocalDateTime.now()+"】==================================调用专利业务办理系统接口请求开始===================================");
        try {
            /*
             * 类HttpsURLConnection似乎并没有提供方法设置信任管理器。其实,
             * HttpsURLConnection通过SSLSocket来建立与HTTPS的安全连接
             * ,SSLSocket对象是由SSLSocketFactory生成的。
             * HttpsURLConnection提供了方法setSSLSocketFactory
             * (SSLSocketFactory)设置它使用的SSLSocketFactory对象。
             * SSLSocketFactory通过SSLContext对象来获得,在初始化SSLContext对象时,可指定信任管理器对象。
             */
            SSLContext sc = SSLContext.getInstance("SSL");
            sc.init(null, new TrustManager[]{new TrustAnyTrustManager()},
                new java.security.SecureRandom());
            URL console = getUrl(url,content,requestMethod);
            HttpsURLConnection conn = (HttpsURLConnection) console.openConnection();
            conn.setSSLSocketFactory(sc.getSocketFactory());
            conn.setRequestMethod(requestMethod);
            conn.setHostnameVerifier(new TrustAnyHostnameVerifier());
            conn.setDoOutput(true);
            conn.setUseCaches(false);         //不使用缓存
            conn.setInstanceFollowRedirects(true);
            // 设置请求头
            conn.setRequestProperty("Accept", "application/json, text/plain, */*");
            conn.setRequestProperty("Accept-Encoding", "gzip, deflate, br");
            conn.setRequestProperty("Accept-Language", "zh-CN,zh;q=0.9");
            conn.setRequestProperty("Connection", "keep-alive");
            conn.setRequestProperty("Content-Type", "application/json;charset=utf-8");
            conn.setRequestProperty("Host", "api.cponline.cnipa.gov.cn");
            conn.setRequestProperty("Origin", "https://interactive.cponline.cnipa.gov.cn");
            conn.setRequestProperty("Referer", "https://interactive.cponline.cnipa.gov.cn/");
            conn.setRequestProperty("Authorization",token);
            conn.connect();
            if(StringUtils.isNotBlank(content) && "POST".equals(requestMethod)){
                //该方法会默认为POST方法
                DataOutputStream out = new DataOutputStream(conn.getOutputStream());
                out.write(content.getBytes(Constants.UTF8));
                // 刷新、关闭
                out.flush();
                out.close();
            }
            int responseCode = conn.getResponseCode();
            System.out.println("Response Code: " + responseCode);
            InputStream is;
            if(responseCode == 200){
                is = conn.getInputStream();
            }else{
                is = conn.getErrorStream();
            }
            if(null != is){
                ByteArrayOutputStream outStream = new ByteArrayOutputStream();
                byte[] buffer2 = new byte[1024];
                int len = 0;
                while ((len = is.read(buffer2)) != -1) {
                    outStream.write(buffer2, 0, len);
                }
                is.close();
                String s = outStream.toString(Constants.UTF8);
                System.out.println("专利业务办理系统返回结果为:"+s);
                System.out.println("【sendJsonToHttpsPost"+LocalDateTime.now()+"】==================================调用专利业务办理系统接口请求结束===================================");
                return s;
            }
        } catch (Exception e) {
            System.out.println("JSON数据发送失败,异常:"+ e.getMessage());
            e.printStackTrace();
        }
        return null;
    }

}

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • 206
  • 207
  • 208
  • 209
  • 210
  • 211
  • 212
  • 213
  • 214
  • 215
  • 216
  • 217
  • 218
  • 219
  • 220
  • 221
  • 222
  • 223
  • 224
  • 225
  • 226
  • 227
  • 228
  • 229
  • 230
  • 231
  • 232
  • 233
  • 234
  • 235
  • 236
  • 237
  • 238
  • 239
  • 240
  • 241
  • 242
  • 243
  • 244
  • 245
  • 246
  • 247
  • 248
  • 249
  • 250
  • 251
  • 252
  • 253
  • 254
  • 255
  • 256
  • 257
  • 258
  • 259
  • 260
  • 261
  • 262
  • 263
  • 264
  • 265
  • 266
  • 267
  • 268
  • 269
  • 270
  • 271
  • 272
  • 273
  • 274
  • 275
  • 276
  • 277
  • 278
  • 279
  • 280
  • 281
  • 282
  • 283
  • 284
  • 285
  • 286
  • 287
  • 288
  • 289
  • 290
  • 291
  • 292
  • 293
  • 294
  • 295
  • 296
  • 297
  • 298
  • 299
  • 300
  • 301
  • 302
  • 303
  • 304
  • 305
  • 306
  • 307
  • 308
  • 309
  • 310
  • 311
  • 312
  • 313
  • 314
  • 315
  • 316
  • 317
  • 318
  • 319
  • 320
  • 321
  • 322
  • 323
  • 324
  • 325
  • 326
  • 327
  • 328
  • 329
  • 330
  • 331
  • 332
  • 333
  • 334
  • 335
  • 336
  • 337
  • 338
  • 339
  • 340
  • 341
  • 342
  • 343
  • 344
  • 345
  • 346
  • 347
  • 348
  • 349
  • 350
  • 351
  • 352
  • 353
  • 354
  • 355
  • 356
  • 357
  • 358
  • 359
  • 360
  • 361
  • 362
  • 363
  • 364
  • 365
  • 366
  • 367
  • 368
  • 369
  • 370
  • 371
  • 372
  • 373
  • 374
  • 375
  • 376
  • 377
  • 378
  • 379
  • 380
  • 381
  • 382
  • 383
  • 384
  • 385
  • 386
  • 387
  • 388
  • 389
  • 390
  • 391
  • 392
  • 393
  • 394
  • 395
  • 396
  • 397
  • 398
  • 399
  • 400
  • 401
  • 402
  • 403
  • 404
  • 405
  • 406
  • 407
  • 408
  • 409
  • 410
  • 411
  • 412
  • 413
  • 414
  • 415
  • 416
  • 417
  • 418
  • 419
  • 420
  • 421
  • 422
  • 423
  • 424
  • 425
  • 426
  • 427
  • 428
  • 429
  • 430
  • 431
  • 432
  • 433
  • 434
  • 435
  • 436
  • 437
  • 438
  • 439
  • 440
  • 441
  • 442
  • 443
  • 444
  • 445
  • 446
  • 447
  • 448
  • 449
  • 450
  • 451
  • 452
  • 453
  • 454
  • 455
  • 456
  • 457
  • 458
  • 459
  • 460
  • 461
  • 462
  • 463
  • 464
  • 465
  • 466
  • 467
  • 468
  • 469
  • 470
  • 471
  • 472
  • 473
  • 474
  • 475
  • 476
  • 477
  • 478
  • 479
  • 480
  • 481
  • 482
  • 483
  • 484
  • 485
  • 486
  • 487
  • 488
  • 489
  • 490
  • 491
  • 492
  • 493
  • 494
  • 495
  • 496
  • 497
  • 498
  • 499
  • 500
  • 501
  • 502
  • 503
  • 504
  • 505
  • 506
  • 507
  • 508
  • 509
  • 510
  • 511
  • 512
  • 513
  • 514
  • 515
  • 516
  • 517
  • 518
  • 519
  • 520
  • 521
  • 522
  • 523
  • 524
  • 525
  • 526
  • 527
  • 528
  • 529
  • 530
  • 531
  • 532
  • 533
  • 534
  • 535
  • 536
  • 537
  • 538
  • 539
  • 540
  • 541
  • 542
  • 543
  • 544
  • 545
  • 546
  • 547
  • 548
  • 549
  • 550
  • 551
  • 552
  • 553
  • 554
  • 555
  • 556
  • 557
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小小林熬夜学编程/article/detail/648095
推荐阅读
相关标签
  

闽ICP备14008679号