| | |
| | | import com.stylefeng.guns.modular.system.service.IDriverService; |
| | | import com.stylefeng.guns.modular.system.util.GDMapElectricFenceUtil; |
| | | import com.stylefeng.guns.modular.system.util.GDMapGeocodingUtil; |
| | | import com.stylefeng.guns.modular.system.util.GeodesyUtil; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.DistancematrixVo; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.GoogleMapUtil; |
| | | import com.stylefeng.guns.modular.system.util.RedisUtil; |
| | |
| | | for(Driver driver : drivers){ |
| | | String value = redisUtil.getValue("DRIVER" + String.valueOf(driver.getId())); |
| | | if(null != value){ |
| | | /*Map<String, String> distance1 = gdMapElectricFenceUtil.getDistance(lon + "," + lat, value, 0);//计算距离 |
| | | double d = Double.valueOf(distance1.get("distance")).doubleValue();*/ |
| | | // double d = GDMapGeocodingUtil.getDistance(lat,lon,Double.parseDouble(value.split(",")[1]),Double.parseDouble(value.split(",")[0])); |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(lat, lon, Double.parseDouble(value.split(",")[1]), Double.parseDouble(value.split(",")[0])); |
| | | if(distancematrix.getDistance() < (distance * 1000)){ |
| | | Map<String, Double> distance1 = GeodesyUtil.getDistance(lon + "," + lat, value); |
| | | Double wgs84 = distance1.get("WGS84"); |
| | | if(wgs84.compareTo(distance * 1000) < 0){ |
| | | list.add(driver); |
| | | } |
| | | } |
| | |
| | | for(Driver driver : drivers){ |
| | | String value = redisUtil.getValue("DRIVER" + String.valueOf(driver.getId())); |
| | | if(null != value){ |
| | | /*Map<String, String> distance1 = gdMapElectricFenceUtil.getDistance(lon + "," + lat, value, 0);//计算距离 |
| | | double d = Double.valueOf(distance1.get("distance")).doubleValue();*/ |
| | | double d = GDMapGeocodingUtil.getDistance(lat,lon,Double.parseDouble(value.split(",")[1]),Double.parseDouble(value.split(",")[0])); |
| | | if(d < (distance * 1000)){ |
| | | list.add(driver); |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(lat, lon, Double.parseDouble(value.split(",")[1]), Double.parseDouble(value.split(",")[0])); |
| | | if(null != distancematrix){ |
| | | if(distancematrix.getDistance() < (distance * 1000)){ |
| | | list.add(driver); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | return list; |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<BaseWarpper> queryBusiness(Integer uid) throws Exception { |
| | | public List<BaseWarpper> queryBusiness(Integer uid, Integer language) throws Exception { |
| | | List<DriverService> list = driverServiceMapper.queryBusiness(uid, null); |
| | | List<BaseWarpper> maps = new ArrayList<>(); |
| | | for (DriverService d : list){ |
| | |
| | | baseWarpper.setId(d.getType()); |
| | | switch (d.getType()){ |
| | | case 1: |
| | | baseWarpper.setName("专车"); |
| | | baseWarpper.setName(language == 1 ? "打车" : language == 2 ? "Ride" : "Course"); |
| | | break; |
| | | case 2: |
| | | baseWarpper.setName("出租车"); |
| | |
| | | baseWarpper.setName("跨城出行"); |
| | | break; |
| | | case 4: |
| | | baseWarpper.setName("同城小件物流"); |
| | | baseWarpper.setName(language == 1 ? "包裹" : language == 2 ? "Delivery" : "Livraison"); |
| | | break; |
| | | case 5: |
| | | baseWarpper.setName("跨城小件物流"); |