‘liusuyi’
2023-07-22 2c04f9f1d5e7379ae41f8b3281a15d56aefc4e1c
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
package com.ruoyi.client;
 
import com.alibaba.fastjson2.JSON;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.ResponseBody;
 
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
 
public class ARDCarSYGPSClient {
    
    /*private static String syURL; 
    
    public static String getSyURL() {
        return syURL;
    }
 
    public static void setSyURL(String syURL) {
        syURL = syURL;
    }*/
    
    //查询权限内全部车队  --车队列表
    public static Map<String,Object> getCarGPSTeamList(String syURL,String userId,String sessionId){
        OkHttpClient okHttpClient = new OkHttpClient();
        
        /*Request request = new Request.Builder()
                .url("http://106.14.186.44:9999/gps-web/api/get_team_list.jsp?teamId=&userId="+userId+"&loginType=user&loginWay=interface&loginLang=zh_CN&appDevId=&appId=android&sessionId="+sessionId)
                .build();*/
        /*Request request = new Request.Builder()
                .url("http://116.182.15.14:9999/gps-web/api/get_team_list.jsp?teamId=&userId="+userId+"&loginType=user&loginWay=interface&loginLang=zh_CN&appDevId=&appId=android&sessionId="+sessionId)
                .build();*/
        Request request = new Request.Builder()
                .url(syURL + "/gps-web/api/get_team_list.jsp?teamId=&userId="+userId+"&loginType=user&loginWay=interface&loginLang=zh_CN&appDevId=&appId=android&sessionId="+sessionId)
                .build();
        
        Response response = null;
        try {
            response = okHttpClient.newCall(request).execute();
        } catch (IOException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
        
        response.headers(); //响应头
 
        ResponseBody responseBody = response.body();
        
        try {
            String message = responseBody.string();// 响应体
            Map<String,Object> map = (Map<String, Object>) JSON.parse(message);
            //System.out.println(message);
            return map;
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            return new HashMap();
        }         
    }
 
    //根据车队id查询车辆  --车队车辆树逐级查询
    public static Map<String,Object> getCarListByTeamId(String syURL,String teamId,String sessionId){
        OkHttpClient okHttpClient = new OkHttpClient();
        
        /*Request request = new Request.Builder()
                .url("http://116.182.15.14:9999/gps-web/api/get_team_car_list.jsp?teamId="+teamId+"&video=false&sessionId="+sessionId)
                .build();*/
        Request request = new Request.Builder()
                .url(syURL + "/gps-web/api/get_team_car_list.jsp?teamId="+teamId+"&video=false&sessionId="+sessionId)
                .build();
        
        Response response = null;
        try {
            response = okHttpClient.newCall(request).execute();
        } catch (IOException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
        
        response.headers(); //响应头
 
        ResponseBody responseBody = response.body();
        
        try {
            String message = responseBody.string();// 响应体
            Map<String,Object> map = (Map<String, Object>) JSON.parse(message);
            return map;
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            return new HashMap();
        }         
    }
 
    //根据车队id获得下属全部车辆  --车辆列表
    public static Map<String,Object> getCarListByTeamId(String syURL,String teamId,String userId,String sessionId){
        OkHttpClient okHttpClient = new OkHttpClient();
 
        /*Request request = new Request.Builder()
                .url("http://106.14.186.44:9999/gps-web/api/get_car_list.jsp?teamId="+teamId+"&detail=true&userId="+userId+"&loginType=user&loginWay=interface&loginLang=zh_CN&appDevId=&appId=android&sessionId="+sessionId)
                .build();*/
        /*Request request = new Request.Builder()
                .url("http://116.182.15.14:9999/gps-web/api/get_car_list.jsp?teamId="+teamId+"&detail=true&userId="+userId+"&loginType=user&loginWay=interface&loginLang=zh_CN&appDevId=&appId=android&sessionId="+sessionId)
                .build();*/
        Request request = new Request.Builder()
                .url(syURL + "/gps-web/api/get_car_list.jsp?teamId="+teamId+"&detail=true&userId="+userId+"&loginType=user&loginWay=interface&loginLang=zh_CN&appDevId=&appId=android&sessionId="+sessionId)
                .build();
 
        Response response = null;
        try {
            response = okHttpClient.newCall(request).execute();
        } catch (IOException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
 
        response.headers(); //响应头
 
        ResponseBody responseBody = response.body();
 
        try {
            String message = responseBody.string();// 响应体
            Map<String,Object> map = (Map<String, Object>) JSON.parse(message);
            //System.out.println(message);
            return map;
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            return new HashMap();
        }
    }
 
    //根据车队id获得下属全部车辆  --车辆列表(车队下所有层级车辆)
    public static Map<String,Object> getCarListSubByTeamId(String syURL,String teamId,String userId,String sessionId){
        OkHttpClient okHttpClient = new OkHttpClient();
 
        /*Request request = new Request.Builder()
                .url("http://106.14.186.44:9999/gps-web/api/get_car_list_recur.jsp?teamId="+teamId+"&userId="+userId+"&loginType=user&loginWay=android&loginLang=zh_CN&appDevId=&sessionId="+sessionId)
                .build();*/
        /*Request request = new Request.Builder()
                .url("http://116.182.15.14:9999/gps-web/api/get_car_list_recur.jsp?teamId="+teamId+"&userId="+userId+"&loginType=user&loginWay=android&loginLang=zh_CN&appDevId=&sessionId="+sessionId)
                .build();*/
        Request request = new Request.Builder()
                .url(syURL + "/gps-web/api/get_car_list_recur.jsp?teamId="+teamId+"&userId="+userId+"&loginType=user&loginWay=android&loginLang=zh_CN&appDevId=&sessionId="+sessionId)
                .build();
 
        Response response = null;
        try {
            response = okHttpClient.newCall(request).execute();
        } catch (IOException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
 
        response.headers(); //响应头
 
        ResponseBody responseBody = response.body();
 
        try {
            String message = responseBody.string();// 响应体
            Map<String,Object> map = (Map<String, Object>) JSON.parse(message);
            //System.out.println(message);
            return map;
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            return new HashMap();
        }
    }
}