From 0aa41d570a5b31f0450ae3a0f45c776f3ae1a3d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E5=81=A5?= Date: Tue, 25 May 2021 18:15:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B0=8F=E5=8C=BAgeohash?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shenjian/seaweed/SeaweedGeoHashExport.groovy | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/seaweed/SeaweedGeoHashExport.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/seaweed/SeaweedGeoHashExport.groovy index dad81abe4..154efe43e 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/seaweed/SeaweedGeoHashExport.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/seaweed/SeaweedGeoHashExport.groovy @@ -5,10 +5,6 @@ import com.fangjia.script.util.DbUtils import com.mongodb.BasicDBObject import com.mongodb.DBObject -import java.util.concurrent.CountDownLatch -import java.util.concurrent.ExecutorService -import java.util.concurrent.Executors - /** * 小区geohash导出 * @@ -18,10 +14,10 @@ import java.util.concurrent.Executors class SeaweedGeoHashExport { static void main(String[] args) { - Set set = new HashSet<>() + List list = new ArrayList<>() DBObject query = new BasicDBObject() - query.append("cat", "district").append("visible", 0) + query.append("cat", "district").append("visible", 0).append("city", "上海").append("region", "长宁") DBObject filter = new BasicDBObject() filter.put("lng", 1) @@ -31,12 +27,12 @@ class SeaweedGeoHashExport { if (obj.lng && obj.lat) { def lon = obj.lng def lat = obj.lat - set.add(SeaweedUtils.encodeByGeoHash(SeaweedUtils.formatLatLng(lon), SeaweedUtils.formatLatLng(lat),7)) + list.add(SeaweedUtils.encodeByGeoHash(SeaweedUtils.formatLatLng(lon), SeaweedUtils.formatLatLng(lat),7)) } } def ret = [] ret << ['小区geohash'] - for (String val : set) { + for (String val : list) { ret << [val] } com.fangjia.script.util.ExcelUtils.write("F:\\数据\\基础建设\\geohash.xlsx", ret, "geohash");