From 469f9a22f9fd2ab552ebf77d023db03dd186573c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E5=81=A5?= Date: Thu, 22 Jul 2021 14:36:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=AB=98=E5=BE=B7=E8=B0=83?= =?UTF-8?q?=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../script/temp/shenjian/util/GaoDeUtils.groovy | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/GaoDeUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/GaoDeUtils.groovy index 9a3bc83d4..4d7cee9f2 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/GaoDeUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/GaoDeUtils.groovy @@ -3,6 +3,7 @@ package com.fangjia.script.temp.shenjian.util import com.alibaba.fastjson.JSONArray import com.alibaba.fastjson.JSONObject import com.fangjia.core.util.DataUtil +import com.fangjia.core.util.HttpRequest import com.fangjia.script.statistics.poi.AmapPoi import com.fangjia.script.util.GeoHelper import com.fangjia.script.util.HttpRequestUtil @@ -175,7 +176,17 @@ class GaoDeUtils { * 获取地址经纬度 */ static def parserByGaode(def city, def address) { - JSONObject json = GaoDeApiUtils.geo(city, address) + Map params = new HashMap() + params.put("key", GAO_DE_AK[keyUsed.intValue()]) + params.put("city", city) + params.put("address", address) + String content + try { + content = new HttpRequest().get("https://restapi.amap.com/v3/geocode/geo", params, "utf-8") + } catch (Exception e) { + content = new HttpRequest().get("https://restapi.amap.com/v3/geocode/geo", params, "utf-8") + } + net.sf.json.JSONObject json = net.sf.json.JSONObject.fromObject(content) if (json && json.info && json.info == "OK") { def ret = json.geocodes if (ret) {