From 322f7ab0413c9adfb28674251e3d7bc326b983bd Mon Sep 17 00:00:00 2001 From: Jian Shen Date: Thu, 10 Mar 2022 17:59:48 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=A1=AB=E5=85=85=E5=9F=8E=E4=B9=A1?= =?UTF-8?q?=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shenjian/address/FillAgriculture.groovy | 86 +++++++++++-------- 1 file changed, 52 insertions(+), 34 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/address/FillAgriculture.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/address/FillAgriculture.groovy index 99acbc19c..7993a0b8f 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/address/FillAgriculture.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/address/FillAgriculture.groovy @@ -15,42 +15,60 @@ ExcelUtils.multiThreadingModify("D:\\Users\\Domi\\Documents\\知识 def province = item['D'] def city = item['E'] def area = item['F'] - def township = item['G'] - def community = item['H'] + String township = item['G'] + String community = item['H'] if (StringUtils.isBlank(city)) { return ; } - if (ProvinceData.isGovernmentCity(city)) { - townConn.find(new BasicDBObject("province", "重庆市") - .append("region", area + "区") - .append("street", township) - .append("juweihui", community), new BasicDBObject()).limit(1).each { - obj -> - item['T'] = obj.juweihui_type - } - if (item['T'] == null) { - townConn.find(new BasicDBObject("province", "重庆市") - .append("region", area + "区") - .append("juweihui", community), new BasicDBObject()).limit(1).each { - obj -> - item['T'] = obj.juweihui_type - } - } - } else { - townConn.find(new BasicDBObject("city", city + "市") - .append("region", area + "区") - .append("street", township) - .append("juweihui", community), new BasicDBObject()).limit(1).each { - obj -> - item['T'] = obj.juweihui_type - } - if (item['T'] == null) { - townConn.find(new BasicDBObject("city", city + "市") - .append("region", area + "区") - .append("juweihui", community), new BasicDBObject()).limit(1).each { - obj -> - item['T'] = obj.juweihui_type - } - } + if (item['T'] != null) { + return ; } +// if (community == null) { +// return ; +// } + if (township) { + if (township.endsWith("镇") || township.endsWith("乡")) { + item['T'] = 2 + } else if (township.endsWith("街道")) { + item['T'] = 1 + } + } +// community = community.replaceAll("居委会", "") +// community = community.replaceAll("居民委员会", "") +// community = community.replaceAll("村民委员会", "") +// community = community.replaceAll("村委会", "") +// +// if (ProvinceData.isGovernmentCity(city)) { +// townConn.find(new BasicDBObject("province", "重庆市") +// .append("region", area + "区") +// .append("street", township) +// .append("juweihui", new BasicDBObject('$regex', "^" + community)), new BasicDBObject()).limit(1).each { +// obj -> +// item['T'] = obj.juweihui_type +// } +// if (item['T'] == null) { +// townConn.find(new BasicDBObject("province", "重庆市") +// .append("region", area + "区") +// .append("juweihui", new BasicDBObject('$regex', "^" + community)), new BasicDBObject()).limit(1).each { +// obj -> +// item['T'] = obj.juweihui_type +// } +// } +// } else { +// townConn.find(new BasicDBObject("city", city + "市") +// .append("region", area + "区") +// .append("street", township) +// .append("juweihui", new BasicDBObject('$regex', "^" + community)), new BasicDBObject()).limit(1).each { +// obj -> +// item['T'] = obj.juweihui_type +// } +// if (item['T'] == null) { +// townConn.find(new BasicDBObject("city", city + "市") +// .append("region", area + "区") +// .append("juweihui", new BasicDBObject('$regex', "^" + community)), new BasicDBObject()).limit(1).each { +// obj -> +// item['T'] = obj.juweihui_type +// } +// } +// } }) From 677292c7361e6b70b09b21eb3ab03ef32da5e3e5 Mon Sep 17 00:00:00 2001 From: Jian Shen Date: Sun, 13 Mar 2022 12:05:01 +0800 Subject: [PATCH 2/2] =?UTF-8?q?year=E6=94=B9=E4=B8=BA2021?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fangjia/script/temp/shenjian/poi/CommitteeLatLng.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/CommitteeLatLng.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/CommitteeLatLng.groovy index c7a92ae8e..c1a7d36eb 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/CommitteeLatLng.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/CommitteeLatLng.groovy @@ -21,10 +21,10 @@ import java.util.concurrent.Executors class CommitteeLatLng { static DBCollection villagesConn = MongoUtils.getCollectionByName("fangjia", "villages", "192.168.0.43", 28017) - static ExecutorService executorService = Executors.newFixedThreadPool(20) + static ExecutorService executorService = Executors.newFixedThreadPool(10) static void main(String[] args) { - dealPoi(new BasicDBObject("status_location", new BasicDBObject('$ne', 0)).append("name", "席庄二村委会")) + dealPoi(new BasicDBObject("status_location", new BasicDBObject('$ne', 0)).append("year", 2021)) //dealLocation() executorService.shutdown() }