doum
19 小时以前 9b849587816ec31c960d066302d580fb8eb0adcc
server/visits/dmvisit_service/src/main/java/com/doumee/core/tsp/DistanceCalculator.java
@@ -157,4 +157,16 @@
        return  (long) (EARTH_RADIUS * c * 1000);
    }
    public static long calculateDistanceDecinal (BigDecimal lat1, BigDecimal lon1, BigDecimal lat2, BigDecimal lon2) {
        double dLat = Math.toRadians(Constants.formatBigdecimal(lat2).doubleValue() - Constants.formatBigdecimal(lat1).doubleValue());
        double dLon = Math.toRadians(Constants.formatBigdecimal(lon2).doubleValue()  - Constants.formatBigdecimal(lon1).doubleValue() );
        double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
                Math.cos(Math.toRadians(Constants.formatBigdecimal(lat1).doubleValue()))
                        * Math.cos(Math.toRadians(Constants.formatBigdecimal(lat2).doubleValue())) *
                        Math.sin(dLon / 2) * Math.sin(dLon / 2);
        double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
        return  (long) (EARTH_RADIUS * c * 1000);
    }
}