|  |  | 
 |  |  |         System.out.println(calculateDistance(39.326638d,116.363312d,31.326606,118.363272)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static DistanceCustomerModel calculateDistanceGaode(String urlStr, JkCustomer c1, JkCustomer c2) { | 
 |  |  |         DistanceCustomerModel r =new DistanceCustomerModel(); | 
 |  |  |         r.setStart(c1); | 
 |  |  |         r.setEnd(c2); | 
 |  |  |         r.setDistance(0); | 
 |  |  |         r.setCode(0); | 
 |  |  |         r.setLocations( new ArrayList<>()); | 
 |  |  |         try { | 
 |  |  |             String url  =urlStr.replace("${lat1}", Constants.formatBigdecimalScale(c1.getLatitude(),6)+"") | 
 |  |  |                     .replace("${lat2}",Constants.formatBigdecimalScale(c2.getLatitude(),6)+"") | 
 |  |  |                     .replace("${long1}",Constants.formatBigdecimalScale(c1.getLongitude(),6)+"") | 
 |  |  |                     .replace("${long2}",Constants.formatBigdecimalScale(c2.getLongitude(),6)+""); | 
 |  |  |             String result = HttpsUtil.get(url ,true); | 
 |  |  |             JSONObject json = JSONObject.parseObject(result); | 
 |  |  |             if(json!=null | 
 |  |  |                     && json.getInteger("status")!=null | 
 |  |  |                     && json.getInteger("status") ==1 | 
 |  |  |                     && json.getJSONObject("route")!=null | 
 |  |  |                     && json.getJSONObject("route").getJSONArray("paths") !=null | 
 |  |  |                     && json.getJSONObject("route").getJSONArray("paths") .size()>0 ){ | 
 |  |  |                 JSONArray array = json.getJSONObject("route").getJSONArray("paths"); | 
 |  |  |                 JSONObject model = array.getJSONObject(0);//取第一个 | 
 |  |  |                Long distance = Long.parseLong(model.getString("distance")); | 
 |  |  |                r.setDistance(distance); | 
 |  |  |                JSONArray steps = model.getJSONArray("steps"); | 
 |  |  |                String tl = ""; | 
 |  |  |                if(steps!=null && steps.size()>0){ | 
 |  |  |                    for (int i = 0; i < steps.size(); i++) { | 
 |  |  |                        if(StringUtils.isBlank(steps.getJSONObject(i).getString("polyline" ))){ | 
 |  |  |                            continue; | 
 |  |  |                        } | 
 |  |  |                        if(!tl.equals("") &&!tl.endsWith(";")){ | 
 |  |  |                            tl += ";"; | 
 |  |  |                        } | 
 |  |  |                        tl+= steps.getJSONObject(i).getString("polyline" ); | 
 |  |  |                    } | 
 |  |  |                } | 
 |  |  |                r.setPolyline(tl); | 
 |  |  |                r.setLocations(Arrays.asList(tl.split(";"))); | 
 |  |  |                r.setCode(1); | 
 |  |  |                log.error("获取交通规划线路信息成功=============="); | 
 |  |  |             }else{ | 
 |  |  |                 log.error("获取交通规划线路信息成功=====失败!!========="); | 
 |  |  |             } | 
 |  |  |         }catch (Exception e){ | 
 |  |  |             log.error("获取交通规划线路信息成功=====失败=========="); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         return r ; | 
 |  |  |     } | 
 |  |  |     public static DistanceModel calculateDistanceGaode(String urlStr, JkSketchCustomer c1, JkSketchCustomer c2) { | 
 |  |  |         DistanceModel r =new DistanceModel(); | 
 |  |  |         r.setStart(c1); |