|
|
@ -1368,6 +1368,97 @@ public class DcTrafficStatisticsServiceImpl implements IDcTrafficStatisticsServi |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public JSONArray eventtrafficflowcnt(String eventId) throws HttpException { |
|
|
|
|
|
|
|
OkHttp okHttp = new OkHttp(); |
|
|
|
|
|
|
|
RequestParams requestParams = new RequestParams(); |
|
|
|
|
|
|
|
requestParams.put("sysid", sysid); |
|
|
|
|
|
|
|
JSONObject parameters = new JSONObject() { |
|
|
|
{ |
|
|
|
put("event_id", eventId); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
requestParams.put("parameters", parameters.toJSONString()); |
|
|
|
|
|
|
|
Map<String, String> headers = new HashMap<>(); |
|
|
|
headers.put("Authorization", getAccessToken()); |
|
|
|
try { |
|
|
|
Response response // 请求响应
|
|
|
|
= okHttp |
|
|
|
.headers(headers) |
|
|
|
.url(baseUrl + UniversalEnum.QUERY_TRAFFIC_OF_ABNORMAL_TRAFFIC_EVENTS.getValue()) // 请求地址
|
|
|
|
.data(requestParams) // 请求参数
|
|
|
|
.post(); // 请求方法
|
|
|
|
|
|
|
|
ResponseBody body = response.body(); |
|
|
|
if (body != null) { |
|
|
|
String jsonString = body.string(); |
|
|
|
if (JSON.isValidArray(jsonString)) { |
|
|
|
return JSON.parseArray(jsonString); |
|
|
|
} else { |
|
|
|
return new JSONArray(); |
|
|
|
} |
|
|
|
} |
|
|
|
return new JSONArray(); |
|
|
|
} catch (IOException e) { |
|
|
|
// 处理异常
|
|
|
|
e.printStackTrace(); |
|
|
|
return new JSONArray(); |
|
|
|
} |
|
|
|
} |
|
|
|
/** |
|
|
|
* 交通流统计分析重点数据查询交通流异常信息 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public JSONArray exampleQueryTrafficFlowAnomalies(String startTime, String endTime) throws HttpException { |
|
|
|
OkHttp okHttp = new OkHttp(); |
|
|
|
|
|
|
|
RequestParams requestParams = new RequestParams(); |
|
|
|
|
|
|
|
requestParams.put("sysid", sysid); |
|
|
|
|
|
|
|
JSONObject parameters = new JSONObject() { |
|
|
|
{ |
|
|
|
put("start_time", startTime); |
|
|
|
put("end_time", endTime); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
requestParams.put("parameters", parameters.toJSONString()); |
|
|
|
|
|
|
|
Map<String, String> headers = new HashMap<>(); |
|
|
|
headers.put("Authorization", getAccessToken()); |
|
|
|
try { |
|
|
|
Response response // 请求响应
|
|
|
|
= okHttp |
|
|
|
.headers(headers) |
|
|
|
.url(baseUrl + UniversalEnum.TRAFFIC_FLOW_STATISTICAL_KEY_DATA_QUERY.getValue()) // 请求地址
|
|
|
|
.data(requestParams) // 请求参数
|
|
|
|
.post(); // 请求方法
|
|
|
|
|
|
|
|
ResponseBody body = response.body(); |
|
|
|
if (body != null) { |
|
|
|
String jsonString = body.string(); |
|
|
|
if (JSON.isValidArray(jsonString)) { |
|
|
|
return JSON.parseArray(jsonString); |
|
|
|
} else { |
|
|
|
return new JSONArray(); |
|
|
|
} |
|
|
|
} |
|
|
|
return new JSONArray(); |
|
|
|
} catch (IOException e) { |
|
|
|
// 处理异常
|
|
|
|
e.printStackTrace(); |
|
|
|
return new JSONArray(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private Response getResponseTrafficFlowAtToll(String startDate, String stationType) throws HttpException, IOException { |
|
|
|
// 创建OkHttpClient.Builder实例
|
|
|
|
OkHttpClient.Builder httpClientBuilder = new OkHttpClient.Builder(); |
|
|
|