Merge branch 'script_gj' of http://gitlab.fangjia.com/dev0/main into script_gj
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
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.fangjia.script.temp.shenjian.address
|
||||
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
|
||||
Map<String, List<String>> map = new HashMap<>()
|
||||
List<List<String>> readList = ExcelUtils.read("D:\\Users\\Domi\\Documents\\知识库\\重庆农商行\\(曹合1 )重庆农商行测试地址V8-1(街道、社区、街道代码补充)处理--新-芝.xlsx")
|
||||
for (List<String> result : readList) {
|
||||
map.put(result.get(0), result)
|
||||
}
|
||||
ExcelUtils.multiThreadingModify("D:\\Users\\Domi\\Documents\\知识库\\重庆农商行\\重庆农商行测试地址V11(优化详细地址) .xlsx", {
|
||||
List item ->
|
||||
def id = item['A']
|
||||
def township = item['G']
|
||||
def community = item['H']
|
||||
if (org.apache.commons.lang.StringUtils.isBlank(township)) {
|
||||
item['G'] = map[id]['F']
|
||||
item['Y'] = '人工乡镇'
|
||||
}
|
||||
if (org.apache.commons.lang.StringUtils.isBlank(community)) {
|
||||
item['H'] = map[id]['G']
|
||||
item['Z'] = '人工社区'
|
||||
}
|
||||
})
|
||||
+27
-9
@@ -13,27 +13,45 @@ ExcelUtils.multiThreadingModify("D:\\Users\\Domi\\Documents\\֪ʶ
|
||||
def community = item['H']
|
||||
String detailAddr = item['I']
|
||||
|
||||
|
||||
if (detailAddr == '重庆市云阳县双江街道恒生场2-02') {
|
||||
print("test")
|
||||
}
|
||||
// 不包含街道与居委
|
||||
if (StringUtils.isNotBlank(township) && StringUtils.isNotBlank(community) &&
|
||||
!detailAddr.contains(township) && !detailAddr.contains(community) ) {
|
||||
if (StringUtils.isNotBlank(area)) {
|
||||
int index = detailAddr.indexOf(area + "区") + area.length() + 2
|
||||
item['K'] = detailAddr.substring(0, index) + township + community +
|
||||
detailAddr.substring(index)
|
||||
if (detailAddr.indexOf(area + "区") > 0) {
|
||||
int index = detailAddr.indexOf(area + "区") + area.length() + 1
|
||||
item['K'] = detailAddr.substring(0, index) + township + community +
|
||||
detailAddr.substring(index)
|
||||
} else if (detailAddr.indexOf(area + "县") > 0) {
|
||||
int index = detailAddr.indexOf(area + "县") + area.length() + 1
|
||||
item['K'] = detailAddr.substring(0, index) + township + community +
|
||||
detailAddr.substring(index)
|
||||
}
|
||||
}
|
||||
// 不包含社区
|
||||
} else if (StringUtils.isNotBlank(township) && StringUtils.isNotBlank(community) &&
|
||||
detailAddr.contains(township) && !detailAddr.contains(community)) {
|
||||
int index = detailAddr.indexOf(township) + township.length() + 1
|
||||
item['K'] = detailAddr.substring(0, index) + community +
|
||||
detailAddr.substring(index)
|
||||
if (detailAddr.indexOf(township) > 0) {
|
||||
int index = detailAddr.indexOf(township) + township.length()
|
||||
item['K'] = detailAddr.substring(0, index) + community +
|
||||
detailAddr.substring(index)
|
||||
}
|
||||
} // 只不包含街道
|
||||
else if (StringUtils.isNotBlank(township) && StringUtils.isNotBlank(community) &&
|
||||
!detailAddr.contains(township) && detailAddr.contains(community)) {
|
||||
if (StringUtils.isNotBlank(area)) {
|
||||
int index = detailAddr.indexOf(area + "区") + area.length() + 2
|
||||
item['K'] = detailAddr.substring(0, index) + township +
|
||||
detailAddr.substring(index)
|
||||
if (detailAddr.indexOf(area + "区") > 0) {
|
||||
int index = detailAddr.indexOf(area + "区") + area.length() + 1
|
||||
item['K'] = detailAddr.substring(0, index) + township +
|
||||
detailAddr.substring(index)
|
||||
} else if (detailAddr.indexOf(area + "县") > 0) {
|
||||
int index = detailAddr.indexOf(area + "县") + area.length() + 1
|
||||
item['K'] = detailAddr.substring(0, index) + township +
|
||||
detailAddr.substring(index)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
+2
-3
@@ -12,9 +12,8 @@ ners = ["houseno", "cellno", "floorno", "roomno"]
|
||||
Pattern GROUP_PATTERN = Pattern.compile("[一二三四五六七八九十甲乙丙丁\\d]+组")
|
||||
ExcelUtils.multiThreadingModify("D:\\Users\\Domi\\Documents\\知识库\\重庆农商行\\重庆农商行测试地址V11(优化详细地址) .xlsx",{List item->
|
||||
|
||||
if (StringUtils.isNotBlank(item["J"])) {
|
||||
//item["I"] = item["J"]
|
||||
//item["W"] = "详细地址替换"
|
||||
if (StringUtils.isNotBlank(item["K"])) {
|
||||
item["I"] = item["K"]
|
||||
}
|
||||
// def addr = item["B"].toString()
|
||||
// def detailAddr = item["I"]?.toString()
|
||||
|
||||
Reference in New Issue
Block a user