填充城乡分类
This commit is contained in:
+56
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user