puzhibing
2023-03-14 901c33cec8fa1e005bda02a32044799d681329b4
更新代码
2个文件已修改
29 ■■■■■ 已修改文件
DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/GoogleMap/GoogleMapUtil.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverServiceImpl.java
@@ -410,7 +410,7 @@
            driverMapper.updateById(driver1);
            LoginWarpper loginWarpper = new LoginWarpper();
            loginWarpper.setId(driver1.getId());
            return ResultUtil.error("电话号码已使用", loginWarpper);
            return ResultUtil.success(loginWarpper);
        }
@@ -418,7 +418,7 @@
        if(null != driver1){
            LoginWarpper loginWarpper = new LoginWarpper();
            loginWarpper.setId(driver1.getId());
            return ResultUtil.error("电话号码已使用", loginWarpper);
            return ResultUtil.success(loginWarpper);
        }
        Driver driver = new Driver();
        driver.setAccount(phone);
DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/GoogleMap/GoogleMapUtil.java
@@ -180,14 +180,23 @@
     * @throws Exception
     */
    public static DistancematrixVo getDistancematrix(Double sLat, Double sLnt, Double eLat, Double eLnt) throws Exception{
        ReverseGeocodeVo reverseGeocode = getReverseGeocode(sLat, sLnt);
        ReverseGeocodeVo reverseGeocode1 = getReverseGeocode(eLat, eLnt);
        if(null != reverseGeocode && null != reverseGeocode1){
            String origin = reverseGeocode.getAddress();
            String destination = reverseGeocode1.getAddress();
            return getDistancematrix(origin, destination);
        }
        return null;
        GeoApiContext context = new GeoApiContext.Builder()
                .apiKey(key)
                .build();
        DistanceMatrixApiRequest request = DistanceMatrixApi.newRequest(context);
        request.origins(new LatLng(sLat, sLnt));
        request.destinations(new LatLng(eLat, eLnt));
        request.mode(TravelMode.DRIVING);//出行方式(驾车)
        DistanceMatrix distanceMatrix = request.await();
        Gson gson = new GsonBuilder().setPrettyPrinting().create();
        System.out.println(gson.toJson(distanceMatrix));
        context.shutdown();
        DistanceMatrixElement elements = distanceMatrix.rows[0].elements[0];
        DistancematrixVo vo = new DistancematrixVo();
        vo.setDistance(elements.distance.inMeters);
        vo.setDuration(elements.duration.inSeconds);
        return vo;
    }