入参为map ,调用的时候不知道map里面的key到底是什么
public LocationInfo getProvinceCity(Map<String,String> params ) { String url = "http://restapi.amap.com/v3/geocode/regeo?location={longitude},{latitude}&key={key}"; ResultAddressInfo resultAddressInfo = httpClient.get(url, params, ResultAddressInfo.class); ... } public LocationInfo getProvinceCity( BigDecimal longitude, BigDecimal latitude) { if (Objects.isNull(longitude) || Objects.isNull(latitude)) { return new LocationInfo(null, null); } String url = "http://restapi.amap.com/v3/geocode/regeo?location={longitude},{latitude}&key={key}"; Map<String, Object> params = new HashMap<>(3); params.put("longitude", longitude); params.put("latitude", latitude); params.put("key", amapConfig.randomKey()); ResultAddressInfo resultAddressInfo = httpClient.get(url, params, ResultAddressInfo.class); }