From 91560b90c13da880c226b410c8b1dd289caf5592 Mon Sep 17 00:00:00 2001 From: Jian Shen Date: Thu, 10 Mar 2022 16:32:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A1=AB=E5=85=85=E5=9F=8E=E4=B9=A1=E5=88=86?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shenjian/address/FillAgriculture.groovy | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/address/FillAgriculture.groovy 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 new file mode 100644 index 000000000..99acbc19c --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/address/FillAgriculture.groovy @@ -0,0 +1,56 @@ +package com.fangjia.script.temp.shenjian.address + +import com.fangjia.script.util.ExcelUtils +import com.fangjia.script.util.MongoUtils +import com.fangjia.script.util.ProvinceData +import com.mongodb.BasicDBObject +import com.mongodb.DBCollection +import org.apache.commons.lang3.StringUtils + +final DBCollection townConn = MongoUtils.getCollectionByName("fangjia_crawl", "regionalism_code", "192.168.0.235", 27018) + +ExcelUtils.multiThreadingModify("D:\\Users\\Domi\\Documents\\知识库\\重庆农商行\\重庆农商行测试地址(估家科技)V2.xlsx", { + List item -> + def id = item['A'] + def province = item['D'] + def city = item['E'] + def area = item['F'] + def township = item['G'] + def 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 + } + } + } +})