添加街道字段
This commit is contained in:
@@ -4,6 +4,7 @@ import com.fangjia.core.ProvinceData
|
||||
import com.fangjia.script.util.CommonUtils
|
||||
import com.fangjia.script.util.DataUtil
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.fangjia.script.util.ElasticUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
import com.fangjia.script.yinjihaun.amap.GaoDeApiUtils
|
||||
@@ -11,45 +12,71 @@ import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import net.sf.json.JSONObject
|
||||
import org.apache.commons.lang.StringUtils
|
||||
DBCollection SEAWEED_TOWNSHIP = MongoUtils.getCollectionByName("fangjia_base", "seaweed_township", "192.168.0.235", 27018)
|
||||
def count = 0
|
||||
List<List<String>> data = Collections.synchronizedList([])
|
||||
data << ["ID","城市","区域","小区名","经度","纬度","街道"]
|
||||
|
||||
CommonUtils.findAllCity().each {def city->
|
||||
DbUtils.multiThreadingExecuteQueryOnSeaweed(DbUtils.buildSeaweedQuery(city),{BasicDBObject item->
|
||||
if(StringUtils.isBlank(item.township) && item.lng){
|
||||
count++
|
||||
def lng = item.lng/10000000000d
|
||||
def lat = item.lat/10000000000d
|
||||
def location = "${lng},${lat}"
|
||||
JSONObject resp = GaoDeApiUtils.geocode(location)
|
||||
def row = []
|
||||
row << item._id.toString()
|
||||
row << item.city
|
||||
row << item.region
|
||||
row << item.name
|
||||
row << lng
|
||||
row << lat
|
||||
BasicDBObject dbo = new BasicDBObject()
|
||||
dbo.id = item._id.toString()
|
||||
dbo.city = item.city
|
||||
dbo.region = item.region
|
||||
dbo.name = item.name
|
||||
dbo.lng = lng
|
||||
dbo.lat = lat
|
||||
if(resp.regeocode && resp.regeocode.addressComponent && resp.regeocode.addressComponent.township){
|
||||
row << resp.regeocode.addressComponent.township
|
||||
dbo.township = resp.regeocode.addressComponent.township
|
||||
}
|
||||
println(row)
|
||||
data << row
|
||||
SEAWEED_TOWNSHIP.insert(dbo)
|
||||
}
|
||||
})
|
||||
}
|
||||
ExcelUtils.write("D:\\街道补充数据.xlsx", data, "补充数据")
|
||||
//DBCollection SEAWEED_TOWNSHIP = MongoUtils.getCollectionByName("fangjia_base", "seaweed_township", "192.168.0.235", 27018)
|
||||
//def count = 0
|
||||
//List<List<String>> data = Collections.synchronizedList([])
|
||||
//data << ["ID","城市","区域","小区名","经度","纬度","街道"]
|
||||
//
|
||||
//CommonUtils.findAllCity().each {def city->
|
||||
// DbUtils.multiThreadingExecuteQueryOnSeaweed(DbUtils.buildSeaweedQuery(city),{BasicDBObject item->
|
||||
// if(StringUtils.isBlank(item.township) && item.lng){
|
||||
// count++
|
||||
// def lng = item.lng/10000000000d
|
||||
// def lat = item.lat/10000000000d
|
||||
// def location = "${lng},${lat}"
|
||||
// JSONObject resp = GaoDeApiUtils.geocode(location)
|
||||
// def row = []
|
||||
// row << item._id.toString()
|
||||
// row << item.city
|
||||
// row << item.region
|
||||
// row << item.name
|
||||
// row << lng
|
||||
// row << lat
|
||||
// BasicDBObject dbo = new BasicDBObject()
|
||||
// dbo.id = item._id.toString()
|
||||
// dbo.city = item.city
|
||||
// dbo.region = item.region
|
||||
// dbo.name = item.name
|
||||
// dbo.lng = lng
|
||||
// dbo.lat = lat
|
||||
// if(resp.regeocode && resp.regeocode.addressComponent && resp.regeocode.addressComponent.township){
|
||||
// row << resp.regeocode.addressComponent.township
|
||||
// dbo.township = resp.regeocode.addressComponent.township
|
||||
// }
|
||||
// println(row)
|
||||
// data << row
|
||||
// SEAWEED_TOWNSHIP.insert(dbo)
|
||||
// }
|
||||
// })
|
||||
//}
|
||||
//ExcelUtils.write("D:\\街道补充数据.xlsx", data, "补充数据")
|
||||
|
||||
//ExcelUtils.modify("D:\\街道补充数据.xlsx",{List item ->
|
||||
// if(item["G"] && item["H"] == null){
|
||||
// DbUtils.seaweed.update(new BasicDBObject("_id", item["A"]), new BasicDBObject('$set', new BasicDBObject('township', item["G"])))
|
||||
// }
|
||||
// println(item)
|
||||
//})
|
||||
|
||||
//ExcelUtils.multiThreadingModify("D:\\Users\\wenyan\\Downloads\\错误经纬度.xlsx",{List item->
|
||||
// def location = "${item["A"]},${item["B"]}"
|
||||
// JSONObject resp = GaoDeApiUtils.geocode(location)
|
||||
// if(resp.regeocode && resp.regeocode.formatted_address){
|
||||
// item['G'] = resp.regeocode.formatted_address
|
||||
// println(item)
|
||||
// }
|
||||
//})
|
||||
|
||||
//def count = 0
|
||||
//CommonUtils.findAllCity().each {def city->
|
||||
// DbUtils.executeQueryOnSeaweed(DbUtils.buildSeaweedQuery(city),{BasicDBObject item->
|
||||
// if(item.township){
|
||||
// count++
|
||||
// }
|
||||
// }, new BasicDBObject("township", 1))
|
||||
//}
|
||||
//println(count)
|
||||
|
||||
ElasticUtils.executeSqlQuery("select count(*), p_date from seawater where p_date > 20210501 group by p_date",{
|
||||
println(it)
|
||||
})
|
||||
@@ -9,6 +9,11 @@ import com.fangjia.core.util.HttpRequest
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import net.sf.json.JSONObject
|
||||
|
||||
def strt(String addr){
|
||||
|
||||
}
|
||||
|
||||
|
||||
ExcelUtils.modify("D:\\nextcloud\\数据\\地址类服务测试\\建行地址相似度评级测试.xlsx",{List item->
|
||||
def city = item["A"]
|
||||
def address1 = item["B"]
|
||||
|
||||
Reference in New Issue
Block a user