智慧保安后台管理-外网项目备份
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
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 {
 
    /**
     * 人员审查
     *
     * @param idCardNo 人员身份证号
     * @return
     */
    public static String httpGet(String idCardNo, Integer pageNum, Integer pageSize) {
        OkHttpClient client = new OkHttpClient();
        Request request = new Request.Builder()
            .url("http://47.49.27.44:8000/dbapi/dmc_bjhc?page_num=" + pageNum + "&page_size=" + pageSize + "&sfzh=" + idCardNo)
            .get()
            .addHeader("Authorization", "Bearer eyJ0eXAiOiJqd3QiLCJhbGciOiJIUzI1NiIsInVjIjoiMzYwNjAyMTk4OTA3MDgxMDE4IiwidG9rZW5fdHlwZSI6MX0.eyJpc3MiOiJITGdGVGYwZWwwNTRDYlNWNUptMUY1eXA3UjRWNnpuMyIsImlhdCI6MTYyOTc5NDk4MH0.KOyEdkXDc5FP98KFLYOBnDgthJZF6VDOxJvlYFrXmrA")
            .build();
        try {
            Response response = client.newCall(request).execute();
            return response.body().string();
        } catch (Exception e) {
 
        }
        return null;
    }
 
    /**
     * 人员审查
     *
     * @param idCardNo 人员身份证号
     * @return
     */
    public static String httpGetOne(String idCardNo) {
        OkHttpClient client = new OkHttpClient();
        Request request = new Request.Builder()
            .url("http://47.49.27.44:8000/dbapi/dmc_bjhc?page_num=1&page_size=1000&sfzh=" + idCardNo)
            .get()
            .addHeader("Authorization", "Bearer eyJ0eXAiOiJqd3QiLCJhbGciOiJIUzI1NiIsInVjIjoiMzYwNjAyMTk4OTA3MDgxMDE4IiwidG9rZW5fdHlwZSI6MX0.eyJpc3MiOiJITGdGVGYwZWwwNTRDYlNWNUptMUY1eXA3UjRWNnpuMyIsImlhdCI6MTYyOTc5NDk4MH0.KOyEdkXDc5FP98KFLYOBnDgthJZF6VDOxJvlYFrXmrA")
            .build();
        try {
            Response response = client.newCall(request).execute();
            return response.body().string();
        } catch (Exception e) {
 
        }
        return null;
    }
 
    /**
     * 枪支定位
     *
     * @param idCardNo  护卫员身份证号
     * @param deptName  所在单位名称
     * @param startTime 定位开始时间
     * @param endTime   定位结束时间
     */
    public static String httpGetGunPosition(String idCardNo, String deptName, String startTime, String endTime, Integer pageNum, Integer pageSize) {
        OkHttpClient client = new OkHttpClient();
        String hwysfzh = "";
        String szdw = "";
        String kssj = "";
        String jssj = "";
        String page_size = "&page_size=" + pageSize;
        String page_num = "&page_num=" + pageNum;
        if (idCardNo != null && !idCardNo.equals("")) {
            hwysfzh = "&hwysfzh=" + idCardNo;
        }
        if (deptName != null && !deptName.equals("")) {
            szdw = "&szdw=" + deptName;
        }
        if (startTime != null && !startTime.equals("")) {
            kssj = "&kssj=" + startTime;
        }
        if (endTime != null && !endTime.equals("")) {
            jssj = "&jssj=" + endTime;
        }
 
        Request request = new Request.Builder()
            .url("http://47.49.27.44:8000/dbapi/dmc_qzdw?" + hwysfzh + szdw + kssj + jssj)
            .get()
            .addHeader("Authorization", "Bearer eyJ0eXAiOiJqd3QiLCJhbGciOiJIUzI1NiIsInVjIjoiMzYwNjAyMTk4OTA3MDgxMDE4IiwidG9rZW5fdHlwZSI6MX0.eyJpc3MiOiI3aWN5MXplc3N2eVBPVlJKUVk2aHpPRTJhc0JMdkw1MyIsImlhdCI6MTYyOTI1MTMzOX0.DLasFawQHexpRBFORQU64tbSR_n76bpway42GfIwPf4")
            .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);
        };
    }
}