From 0793de69327edd760ff6bd5d8b95c7fca18d3c0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E5=81=A5?= Date: Sat, 15 May 2021 11:52:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=86=9C=E5=95=86=E8=A1=8C?= =?UTF-8?q?=E5=B0=8F=E5=8C=BA=E5=91=A8=E5=9B=B4=E5=BB=BA=E7=AD=91=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../temp/shenjian/cqrcb/AroundExport.groovy | 50 ++++++++++++++++++- .../temp/shenjian/cqrcb/SeaweedExport.groovy | 1 - 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/AroundExport.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/AroundExport.groovy index 40851320a..9c53f103f 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/AroundExport.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/AroundExport.groovy @@ -1,6 +1,18 @@ package com.fangjia.script.temp.shenjian.cqrcb +import cn.emay.mina.util.ConcurrentHashSet +import com.fangjia.script.coredata.util.CollectionUtils import com.fangjia.script.temp.shenjian.util.GaoDeUtils +import com.fangjia.script.util.ExcelUtils +import com.fangjia.script.util.GeoUtils +import com.fangjia.script.util.MongoUtils +import com.mongodb.BasicDBObject +import com.mongodb.DBCollection +import com.mongodb.DBObject + +import java.util.concurrent.ExecutorService +import java.util.concurrent.Executors +import java.util.concurrent.atomic.AtomicInteger /** * 小区周围信息导出 @@ -10,9 +22,43 @@ import com.fangjia.script.temp.shenjian.util.GaoDeUtils */ class AroundExport { - def static types = "" + static DBCollection conn = MongoUtils.getCollectionByName("seeddb_dev", "arround_temp", "192.168.0.235", 27018) + + //3km范围内地铁站、公交站、银行、医院、商场、学校等名称及距离信息 + static def types = "150500|1507|090100|090101|090200|090202|090203|090204|090205|090206|090207|090208|090209|090210|090211|1601|0601|141200|141201|141202|141203|141204" + static def radius = "3000" + static ExecutorService executorService = Executors.newFixedThreadPool(30) static void main(String[] args) { - GaoDeUtils.searchNearByPoi() + List> data = ExcelUtils.read("F:\\数据\\重庆农商行\\测试数据汇总_2021.xlsx", 9) + AtomicInteger count = new AtomicInteger(0) + for (List districtT : data) { + final List district = districtT + executorService.execute(new Runnable() { + @Override + void run() { + def city = district.get(1) + def name = district.get(3) + if (district.get(20) != null && district.get(21) != null) { + boolean exist = conn.count(new BasicDBObject("district_name", name)) > 0 ? true : false + if (!exist) { + def lng = com.fangjia.script.common.DataHandleUtils.getDoubleRound(6, district.get(20) / 10000000000d) + def lat = com.fangjia.script.common.DataHandleUtils.getDoubleRound(6, district.get(21) / 10000000000d) + List arounds = GaoDeUtils.searchNearByPoi(city, types, lng, lat, radius, "") + if (CollectionUtils.isNotEmpty(arounds)) { + for (BasicDBObject obj : arounds) { + obj.put("district_name", name) + obj.put("lng", lng) + obj.put("lat", lat) + } + conn.insert(arounds) + } + } + } + println("当前处理小区" + name + " " + count.incrementAndGet()) + } + }) + } + executorService.shutdown() } } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/SeaweedExport.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/SeaweedExport.groovy index 445b953f6..8d48e0319 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/SeaweedExport.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/SeaweedExport.groovy @@ -8,7 +8,6 @@ import com.mongodb.DBCollection import com.mongodb.DBObject import java.util.concurrent.ConcurrentHashMap -import java.util.concurrent.ConcurrentLinkedQueue import java.util.concurrent.CountDownLatch import java.util.concurrent.ExecutorService import java.util.concurrent.Executors