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 +// } +// } +// } })