Merge branch 'script_gj' of http://gitlab.fangjia.com/dev0/main into script_gj

This commit is contained in:
2023-07-06 18:06:27 +08:00
14 changed files with 856 additions and 11 deletions
@@ -24,7 +24,7 @@ class CommitteeLatLng {
static ExecutorService executorService = Executors.newFixedThreadPool(10)
static void main(String[] args) {
dealPoi(new BasicDBObject("status_location", new BasicDBObject('$ne', 0)).append("year", 2021))
dealPoi(new BasicDBObject("location", "").append("year", 2022))
//dealLocation()
executorService.shutdown()
}
@@ -71,7 +71,7 @@ class CommitteeLatLng {
if (amapPoi && amapPoi.size() > 0) {
def poi = amapPoi[0]
double similarity = CosineSimilarAlgorithm.getSimilarity(poi.name, name)
if (similarity <= 0.8) {
if (similarity <= 0.8 && !String.valueOf(poi.name).contains(name)) {
amapPoi = GaoDeUtils.searchPoi(city, address, area, "")
}
poi = amapPoi[0]
@@ -55,13 +55,17 @@ class GaoDeUtils {
* @return
*/
static String getGaodeKey(String type) {
Map<String, String> params = new HashMap<>();
params.put("type", type)
JSONObject json = HttpRequestUtil.getJsonContent("http://192.168.0.100:38080/FangJiaDataService/getAmapKey", params)
if (json.status == 0 && json.result != null) {
return json.result
}
System.exit(1);
// Map<String, String> params = new HashMap<>();
// params.put("type", type)
// JSONObject json = HttpRequestUtil.getJsonContent("http://192.168.0.100:38080/FangJiaDataService/getAmapKey", params)
// if (json.status == 0 && json.result != null) {
// return json.result
// }
// System.exit(1);
return "8796b9dfb3889b57c38e2fff1b7e51bd";
// 'eb69e4ad2a9cdd31f163a0ed32effe6e', '60f764d228d64addf390e28d68a01a35', '66e6771767ab293ace441553c36621c1',
// 'a63254b4a1b2e6f4bb11058e0b5d9fa2', '743ad872ad39f0a10665b28fa968af0b', '3b7c1d201c403bb416b63535ed3d0e98',
// 'a34894d151fffff94f9a33bae3d5565c', '389e0a3a155e8d28728c3faede4ebd4f'
}
/**
@@ -330,10 +334,10 @@ class GaoDeUtils {
params.page = "${page}".toString()
page++
params.key = this.getGaodeKey("v5/place/text")
JSONObject json = HttpRequestUtil.getJsonContent("http://restapi.amap.com/v5/place/text", params);
JSONObject json = HttpRequestUtil.getJsonContent("http://restapi.amap.com/v3/place/text", params);
if (json == null) {
params.key = this.getGaodeKey("v5/place/text")
json = HttpRequestUtil.getJsonContent("http://restapi.amap.com/v5/place/text", params);
json = HttpRequestUtil.getJsonContent("http://restapi.amap.com/v3/place/text", params);
}
if (json && json.info && json.info == "OK") {
count = json.getString("count").toInteger()