|
|
@ -734,6 +734,7 @@ public class DcTrafficStatisticsServiceImpl implements IDcTrafficStatisticsServi |
|
|
|
|
|
|
|
return map; |
|
|
|
} |
|
|
|
|
|
|
|
//处理 接口响应数据
|
|
|
|
private List<Map<String, Object>> getMaps(String direction, JSONArray jsonArray) throws IOException { |
|
|
|
|
|
|
@ -792,6 +793,7 @@ public class DcTrafficStatisticsServiceImpl implements IDcTrafficStatisticsServi |
|
|
|
} |
|
|
|
return mapList; |
|
|
|
} |
|
|
|
|
|
|
|
// 获取车流量接口 返回 jsonArray
|
|
|
|
private JSONArray getResponseBody(String startDate, RequestParams requestParams, OkHttp okHttp) throws HttpException, IOException { |
|
|
|
JSONObject parameters = new JSONObject() { |
|
|
@ -902,6 +904,7 @@ public class DcTrafficStatisticsServiceImpl implements IDcTrafficStatisticsServi |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取路况信息 |
|
|
|
* |
|
|
|
* @return |
|
|
|
* @throws HttpException |
|
|
|
* @throws IOException |
|
|
@ -930,6 +933,13 @@ public class DcTrafficStatisticsServiceImpl implements IDcTrafficStatisticsServi |
|
|
|
for (Object object : jsonArray) { |
|
|
|
JSONObject jsonObject = (JSONObject) object; |
|
|
|
Integer asOneRoad = jsonObject.getInteger("as_one_road"); |
|
|
|
double endPileNo = jsonObject.getDouble("end_pile_no"); |
|
|
|
double startPileNo = jsonObject.getDouble("start_pile_no"); |
|
|
|
String stakeMark = formatNumber(startPileNo); |
|
|
|
String endMark = formatNumber(endPileNo); |
|
|
|
jsonObject.put("stakeMark", stakeMark);//当前拥堵距离
|
|
|
|
jsonObject.put("endMark", endMark);//当前拥堵距离
|
|
|
|
|
|
|
|
//as_one_road
|
|
|
|
//是否为同一条路,1-是,0-否
|
|
|
|
if (asOneRoad == UniversalEnum.ZERO.getNumber()) { |
|
|
@ -999,6 +1009,17 @@ public class DcTrafficStatisticsServiceImpl implements IDcTrafficStatisticsServi |
|
|
|
|
|
|
|
return nearestFacility; // 返回最近的桩号信息
|
|
|
|
} |
|
|
|
|
|
|
|
//桩号转换
|
|
|
|
public static String formatNumber(double number) { |
|
|
|
//将数字分成整数和四舍五入的小数部分
|
|
|
|
int integerPart = (int) number; |
|
|
|
int decimalPart = (int) Math.round((number - integerPart) * 1000); // 四舍五入到最接近的整数
|
|
|
|
|
|
|
|
// 将数字格式化为 "K 000+000"
|
|
|
|
String formattedString = String.format("K%03d+%03d", integerPart, decimalPart); |
|
|
|
return formattedString; |
|
|
|
} |
|
|
|
//经纬度计算距离
|
|
|
|
|
|
|
|
public static double calculateDistance(double startLat, double startLon, double endLat, double endLon) { |
|
|
|