|
@@ -11,6 +11,7 @@ import com.skyversation.poiaddr.service.AreaService;
|
|
|
import com.skyversation.poiaddr.util.net.AddressNetTools;
|
|
|
import com.skyversation.poiaddr.util.status.AddressLevel;
|
|
|
import com.skyversation.poiaddr.util.status.AddressResultEnum;
|
|
|
+import com.skyversation.poiaddr.util.tasks.ScheduledTasks;
|
|
|
import org.springframework.http.HttpMethod;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -307,7 +308,7 @@ public class AddressQueryEngine {
|
|
|
* @return
|
|
|
*/
|
|
|
public AddressResult gdSearchByName(String address) {
|
|
|
- String geoUrl = Constant.AMAP_GEO_URL + "?key=" + Constant.AMAP_KEY[ThreadLocalRandom.current().nextInt(0, 4)] + "&address=" + address + "&city=" + Constant.getAMAP_CITY_CODE() + "&output=JSON";
|
|
|
+ String geoUrl = Constant.AMAP_GEO_URL + "?key=" + Constant.AMAP_KEY[ThreadLocalRandom.current().nextInt(0, 3)] + "&address=" + address + "&city=" + Constant.getAMAP_CITY_CODE() + "&output=JSON";
|
|
|
ResponseEntity response = AddressNetTools.getInstance().requestGetOrPost(HttpMethod.GET, geoUrl, null, null, 0);
|
|
|
if (response != null && response.getBody() != null) {
|
|
|
String body = response.getBody() + "";
|
|
@@ -335,8 +336,9 @@ public class AddressQueryEngine {
|
|
|
address = address.replace("中山", "中山街道");
|
|
|
}
|
|
|
JSONArray pois = new JSONArray();
|
|
|
+ ScheduledTasks.gdRequestSize++;
|
|
|
String geoUrl =
|
|
|
- Constant.AMAP_SEARCH_NAME_V3 + "?key=" + Constant.AMAP_KEY[ThreadLocalRandom.current().nextInt(0, 4)] + "&types=" + Constant.AMAP_SEARCH_TYPES +
|
|
|
+ Constant.AMAP_SEARCH_NAME_V3 + "?key=" + Constant.AMAP_KEY[ThreadLocalRandom.current().nextInt(0, 3)] + "&types=" + Constant.AMAP_SEARCH_TYPES +
|
|
|
"&keywords=" + address + "&city=" + Constant.getAMAP_CITY_CODE() + "&offset=20";
|
|
|
ResponseEntity responseEntity = AddressNetTools.getInstance().requestGetOrPost(HttpMethod.GET, geoUrl, null, null, 0);
|
|
|
if (responseEntity.hasBody()) {
|