|
@ -907,7 +907,7 @@ public class DcTrafficStatisticsServiceImpl implements IDcTrafficStatisticsServi |
|
|
* @throws IOException |
|
|
* @throws IOException |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public JSONObject getTheCurrentCongestedSection() throws HttpException, IOException { |
|
|
public JSONArray getTheCurrentCongestedSection() throws HttpException, IOException { |
|
|
OkHttp okHttp = new OkHttp(); |
|
|
OkHttp okHttp = new OkHttp(); |
|
|
|
|
|
|
|
|
RequestParams requestParams = new RequestParams(); |
|
|
RequestParams requestParams = new RequestParams(); |
|
@ -927,10 +927,12 @@ public class DcTrafficStatisticsServiceImpl implements IDcTrafficStatisticsServi |
|
|
ResponseBody body = response.body(); |
|
|
ResponseBody body = response.body(); |
|
|
if (body != null) { |
|
|
if (body != null) { |
|
|
JSONArray jsonArray = JSON.parseArray(body.string()); |
|
|
JSONArray jsonArray = JSON.parseArray(body.string()); |
|
|
JSONObject jsonObject = (JSONObject) jsonArray.get(0); |
|
|
for (Object object : jsonArray) { |
|
|
|
|
|
JSONObject jsonObject = (JSONObject) object; |
|
|
Integer asOneRoad = jsonObject.getInteger("as_one_road"); |
|
|
Integer asOneRoad = jsonObject.getInteger("as_one_road"); |
|
|
|
|
|
//as_one_road
|
|
|
if (asOneRoad == UniversalEnum.ONE.getNumber()){ |
|
|
//是否为同一条路,1-是,0-否
|
|
|
|
|
|
if (asOneRoad == UniversalEnum.ZERO.getNumber()){ |
|
|
|
|
|
|
|
|
String string = jsonObject.getString("list_link_info"); |
|
|
String string = jsonObject.getString("list_link_info"); |
|
|
JSONArray jsonlist = JSON.parseArray(string); |
|
|
JSONArray jsonlist = JSON.parseArray(string); |
|
@ -962,14 +964,14 @@ public class DcTrafficStatisticsServiceImpl implements IDcTrafficStatisticsServi |
|
|
//System.out.printf("两点之间的距离为: %.2f 米%n", distanceMeters);
|
|
|
//System.out.printf("两点之间的距离为: %.2f 米%n", distanceMeters);
|
|
|
jsonObject.put("jam_dist",distanceMeters);//当前拥堵距离
|
|
|
jsonObject.put("jam_dist",distanceMeters);//当前拥堵距离
|
|
|
|
|
|
|
|
|
return jsonObject; |
|
|
} |
|
|
}else { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
return jsonArray; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return new JSONObject(); |
|
|
return new JSONArray(); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -1019,6 +1021,8 @@ public class DcTrafficStatisticsServiceImpl implements IDcTrafficStatisticsServi |
|
|
|
|
|
|
|
|
// 计算两点间的距离
|
|
|
// 计算两点间的距离
|
|
|
double distance = EARTH_RADIUS * c; |
|
|
double distance = EARTH_RADIUS * c; |
|
|
|
|
|
// 保留两位小数,四舍五入
|
|
|
|
|
|
distance= Double.parseDouble(String.format("%.5f", distance)); |
|
|
|
|
|
|
|
|
return distance; |
|
|
return distance; |
|
|
} |
|
|
} |
|
|