package org.springblade.common.utils; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; import java.util.function.BiConsumer; import java.util.function.Consumer; /** * @author zhongrj * @date 2021-08-12 */ public class InvestigateUtil { public static String httpGet(String idCardNo) { OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("http://47.49.27.44:8000/dbapi/dmc_zdrybjhc?page_num=1&page_size=1000&sfzh="+idCardNo) .get() .addHeader("Authorization","Bearer eyJ0eXAiOiJqd3QiLCJhbGciOiJIUzI1NiIsInVjIjoiMzYwNjAyMTk4OTA3MDgxMDE4IiwidG9rZW5fdHlwZSI6MX0.eyJpc3MiOiIybXhiRW1RUXZjc01JMFJ1OHFQamZBTWQ4TExib2p6aSIsImlhdCI6MTYyODU4NDk4Nn0.yy8cAdZLUkCMGdkChOGkTlPeGW3tga_RvQOau4ROGpM") .build(); try{ Response response = client.newCall(request).execute(); return response.body().string(); } catch(Exception e) { } return null; } // 工具方法 public static Consumer consumerWithIndex(BiConsumer consumer) { class Obj { int i; } Obj obj = new Obj(); return t -> { int index = obj.i++; consumer.accept(t, index); }; } }