From 37580693794fb056fae5ea093e94bcd537ae5def Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E5=81=A5?= Date: Sun, 16 May 2021 16:06:51 +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 --- .../cqrcb/AroundExportByNewWay.groovy | 22 +++++++++++++++---- .../shenjian/cqrcb/MarkUnNeedExport.groovy | 11 ++++++++-- .../temp/shenjian/util/GaoDeUtils.groovy | 16 ++++++++++++++ 3 files changed, 43 insertions(+), 6 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/AroundExportByNewWay.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/AroundExportByNewWay.groovy index 7053f1db6..94e4b9342 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/AroundExportByNewWay.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/AroundExportByNewWay.groovy @@ -1,13 +1,16 @@ package com.fangjia.script.temp.shenjian.cqrcb +import com.alibaba.excel.EasyExcel import com.fangjia.script.commData.CommonDatautils import com.fangjia.script.district.Distance +import com.fangjia.script.gj.ccb.FileUtils import com.fangjia.script.util.ExcelUtils import com.fangjia.script.util.MongoUtils import com.mongodb.BasicDBObject import com.mongodb.DBCollection import com.mongodb.DBObject import com.mongodb.QueryOperators +import org.apache.commons.collections.map.HashedMap import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.CountDownLatch @@ -27,6 +30,12 @@ class AroundExportByNewWay { static def resultMap = new ConcurrentHashMap() static ExecutorService executorService = Executors.newFixedThreadPool(30) + static Map map = new HashedMap() + + static { + map.put("") + } + static void main(String[] args) { List> data = ExcelUtils.read("F:\\数据\\重庆农商行\\测试数据汇总_2021.xlsx", 9) AtomicInteger count = new AtomicInteger(0) @@ -51,11 +60,11 @@ class AroundExportByNewWay { // 周围半径为3千米 def mapLatLng = CommonDatautils.findMaxLatLngMinLatLng(lat, lng, 3000) DBObject q = new BasicDBObject() - q.put('status', 1) + q.put('status', 0) q.put('lat', new BasicDBObject(QueryOperators.LTE, mapLatLng.maxLat).append(QueryOperators.GTE, mapLatLng.minLat)); q.put('lng', new BasicDBObject(QueryOperators.LTE, mapLatLng.maxLng).append(QueryOperators.GTE, mapLatLng.minLng)); Map map = new ConcurrentHashMap<>(); - poiConn.find(q, new BasicDBObject("name": 1, "distance": 1, "type": 1, "lat": 1, "lng": 1)).batchSize(500).each {obj -> + poiConn.find(q, new BasicDBObject("name": 1, "distance": 1, "type": 1, "typecode": 1, "lat": 1, "lng": 1)).batchSize(500).each {obj -> double distance = Distance.GetDistance(lng, lat, obj.lng, obj.lat) if (distance <= 3000) { dealSpecial(obj, map, id, distance, result) @@ -84,8 +93,8 @@ class AroundExportByNewWay { }) }; latch.await() + def headArr = ['IDB', '名称','类型', '距离'] def ret = [] - ret << ['IDB', '名称','类型', '距离'] for (List district : data) { def district_code = district.get(2) def name = district.get(3) @@ -94,7 +103,9 @@ class AroundExportByNewWay { } } println(ret.size()) - com.fangjia.script.util.ExcelUtils.write("F:\\数据\\重庆农商行\\周边配套.xlsx", ret, "周边配套"); + //com.fangjia.script.util.ExcelUtils.write("F:\\数据\\重庆农商行\\周边配套.xlsx", ret, "周边配套"); + FileUtils.batchCreateFile(ret, "F:\\数据\\重庆农商行\\周边配套.dat", headArr, "utf-8") +// EasyExcel.write("F:\\数据\\重庆农商行\\周边配套.xlsx").head(head).sheet("成交信息").doWrite(ret); executorService.shutdown() } @@ -143,6 +154,9 @@ class AroundExportByNewWay { return false } } + if (name.indexOf("(出入口)") != -1) { + return false + } } // 中梁山地铁站1A口 if (obj.name.indexOf("地铁站") != -1 && obj.name.indexOf("口") != -1) { diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/MarkUnNeedExport.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/MarkUnNeedExport.groovy index 76226f770..c9eb96812 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/MarkUnNeedExport.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/MarkUnNeedExport.groovy @@ -4,7 +4,9 @@ import com.fangjia.script.util.ExcelUtils import com.fangjia.script.util.MongoUtils import com.mongodb.BasicDBObject import com.mongodb.DBCollection +import com.mongodb.DBObject import com.mongodb.QueryOperators +import sun.swing.BakedArrayList /** * 标记不需要导出的数据 @@ -23,8 +25,13 @@ class MarkUnNeedExport { if (district.size() > 1) { def type = district.get(0) def status = district.get(1) - if (status == 1) { - poiConn.update(new BasicDBObject("type", type), new BasicDBObject('$set', new BasicDBObject("status", 1))) + if (type == '交通设施服务;公交车站;公交车站相关') { + println(type) + } + if (status == 1.0) { + poiConn.update(new BasicDBObject("type", type), new BasicDBObject('$set', new BasicDBObject("status", 0)), false, true) + } else { + poiConn.update(new BasicDBObject("type", type), new BasicDBObject('$set', new BasicDBObject("status", 1)), false, true) } } } 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 eef249210..721ab6958 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 @@ -4,6 +4,8 @@ import com.fangjia.core.util.DataUtil import com.fangjia.script.util.HttpRequestUtil import net.sf.json.JSONObject +import java.util.concurrent.ConcurrentHashMap + /** * 高德工具类 * @@ -14,6 +16,20 @@ class GaoDeUtils { def static GAO_DE_AK = "2a1fb75990f2b39f6221e50892dd3988" + def static codeNameMap = new HashMap(){{ + put("150500", "地铁"); + put("1507", "公交"); + put("医院", "090100|090101|090200|090202|090203|090204|090205|090206|090207|090208|090209|090210|090211"); + put("141200", "学校") + put("141201", "学校") + put("141202", "学校") + put("141203", "学校") + put("141204", "学校") + put("1601", "银行") + put("1603", "银行") + put("0601", "商场") + }}; + /** * * @param city