| | |
| | | import com.stylefeng.guns.modular.system.model.ServerCarModel; |
| | | import com.stylefeng.guns.modular.system.service.ICompanyCityService; |
| | | import com.stylefeng.guns.modular.system.service.IServerCarModelService; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.util.GDMapElectricFenceUtil; |
| | | import com.stylefeng.guns.modular.system.util.GDMapGeocodingUtil; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.AddressComponentsVo; |
| | |
| | | @Autowired |
| | | private ICompanyCityService companyCityService; |
| | | |
| | | @Autowired |
| | | private IUserInfoService userInfoService; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil<List<ServerCarModelWarpper>> queryServerCarModel(String startLonLat, String endLonLat, Integer type) throws Exception { |
| | | public ResultUtil<List<ServerCarModelWarpper>> queryServerCarModel(String startLonLat, String endLonLat, Integer type, Integer language) throws Exception { |
| | | //查找与起点匹配的企业(经营范围) |
| | | ReverseGeocodeVo reverseGeocode = GoogleMapUtil.getReverseGeocode(Double.valueOf(startLonLat.split(",")[1]), Double.valueOf(startLonLat.split(",")[0])); |
| | | if(null == language){ |
| | | language = 2; |
| | | } |
| | | if(null == reverseGeocode){ |
| | | return ResultUtil.error("获取地址信息失败"); |
| | | return ResultUtil.error(language == 1 ? "获取地址信息失败" : language == 2 ? "Failed to get address information" : "Impossible d'obtenir les informations d'adresse"); |
| | | } |
| | | AddressComponentsVo[] addressComponentsVos = reverseGeocode.getAddressComponentsVos(); |
| | | String[] city = new String[addressComponentsVos.length]; |
| | |
| | | } |
| | | Company query = companyCityService.query(city); |
| | | if(null == query){ |
| | | return ResultUtil.error("起点暂无企业提供服务", new ArrayList<>()); |
| | | return ResultUtil.error(language == 1 ? "起点暂无企业提供服务" : language == 2 ? "The starting point has no enterprises to provide services" : "Le point de départ n'a pas d'entreprises pour fournir des services", new ArrayList<>()); |
| | | } |
| | | Double slnt = Double.valueOf(startLonLat.split(",")[0]); |
| | | Double slat = Double.valueOf(startLonLat.split(",")[1]); |
| | |
| | | Double elat = Double.valueOf(startLonLat.split(",")[1]); |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(slat, slnt, elat, elnt); |
| | | if(null == distancematrix){ |
| | | return ResultUtil.error("获取预估距离出错", new ArrayList<>()); |
| | | return ResultUtil.error(language == 1 ? "获取预估距离出错" : language == 2 ? "Error getting estimated distance" : "Erreur lors de l'obtention de la distance estimée", new ArrayList<>()); |
| | | } |
| | | long distance1 = distancematrix.getDistance();//距离(米) |
| | | double distance1_ = Double.valueOf(distance1).doubleValue(); |
| | |
| | | |
| | | List<ServerCarModelWarpper> price = this.getPrice(query.getId(), distance1_, duration_, 0, 1); |
| | | if(price.size() == 0){ |
| | | return ResultUtil.error("未获取到可服务的车型", new ArrayList<>()); |
| | | return ResultUtil.error(language == 1 ? "未获取到可服务的车型" : language == 2 ? "No serviceable model available" : "Aucun modèle réparable disponible", new ArrayList<>()); |
| | | } |
| | | return ResultUtil.success(price); |
| | | } |