艾金辉
2023-07-21 3c075575f95f2e10a66d38e1b28c284e938f2e52
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
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();
        }         
    }
}