|
|
@ -269,7 +269,6 @@ public class DcTrafficStatisticsServiceImpl implements IDcTrafficStatisticsServi |
|
|
|
if (body != null) { |
|
|
|
return JSON.parseArray(body.string()); |
|
|
|
} |
|
|
|
|
|
|
|
return new JSONArray(); |
|
|
|
} |
|
|
|
|
|
|
@ -813,7 +812,7 @@ public class DcTrafficStatisticsServiceImpl implements IDcTrafficStatisticsServi |
|
|
|
return jsonArray; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//格式化桩号
|
|
|
|
private static String extract(String input) { |
|
|
|
Pattern pattern = Pattern.compile("K(\\d{3})\\+(\\d{3})"); |
|
|
|
Matcher matcher = pattern.matcher(input); |
|
|
@ -897,6 +896,51 @@ public class DcTrafficStatisticsServiceImpl implements IDcTrafficStatisticsServi |
|
|
|
|
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取路况信息 |
|
|
|
* @return |
|
|
|
* @throws HttpException |
|
|
|
* @throws IOException |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public JSONObject getTheCurrentCongestedSection() throws HttpException, IOException { |
|
|
|
OkHttp okHttp = new OkHttp(); |
|
|
|
|
|
|
|
RequestParams requestParams = new RequestParams(); |
|
|
|
|
|
|
|
requestParams.put("sysid", sysid); |
|
|
|
|
|
|
|
Map<String, String> headers = new HashMap<>(); |
|
|
|
headers.put("Authorization", getAccessToken()); |
|
|
|
|
|
|
|
Response response // 请求响应
|
|
|
|
= okHttp |
|
|
|
.headers(headers) |
|
|
|
.url(baseUrl + "/api/dc/query/rd_tr_congestion_jh") // 请求地址
|
|
|
|
.data(requestParams) // 请求参数
|
|
|
|
.post(); // 请求方法
|
|
|
|
|
|
|
|
ResponseBody body = response.body(); |
|
|
|
if (body != null) { |
|
|
|
JSONArray jsonArray = JSON.parseArray(body.string()); |
|
|
|
JSONObject jsonObject = (JSONObject) jsonArray.get(0); |
|
|
|
Integer asOneRoad = jsonObject.getInteger("as_one_road"); |
|
|
|
|
|
|
|
if (asOneRoad == UniversalEnum.ONE.getNumber()){ |
|
|
|
String string = jsonObject.getString("road_name"); |
|
|
|
System.out.println(string); |
|
|
|
return jsonObject; |
|
|
|
}else { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return new JSONObject(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public DcFacility findNearestFacility(List<DcFacility> dcFacilityList, String stakeMarkCode) { |
|
|
|
// 将目标桩号转换为整数,以便比较
|
|
|
|
int targetCodeAsInt = Integer.parseInt(extract(stakeMarkCode)); |
|
|
|