Administrator
2021-08-14 73b403d969d248f30b160c82ea9edeb9d94d815e
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
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 <T> Consumer<T> consumerWithIndex(BiConsumer<T, Integer> consumer) {
        class Obj {
            int i;
        }
        Obj obj = new Obj();
        return t -> {
            int index = obj.i++;
            consumer.accept(t, index);
        };
    }
}