移除腾讯经纬度
This commit is contained in:
@@ -1,188 +1 @@
|
||||
package com.fangjia.script.wenyan
|
||||
|
||||
//ExcelUtils.multiThreadingModify("D:\\Users\\wenyan\\Downloads\\国信达级联价格-上海.xlsx",{List item->
|
||||
// if(item["AB"]){
|
||||
// return
|
||||
// }
|
||||
// String region = null
|
||||
// String name = item["F"]
|
||||
// if(name.endsWith("小区")){
|
||||
// name = name.replaceAll("小区\$", "")
|
||||
// }
|
||||
// region = RegionData.formatRegion(item["B"], item["D"])
|
||||
// def results = []
|
||||
// DbUtils.seaweed.find(DbUtils.buildSeaweedQuery(item["B"], region, name)).each {
|
||||
// if(!results.contains(it)){
|
||||
// results.add(it)
|
||||
// }
|
||||
// }
|
||||
// DbUtils.seaweed.find(DbUtils.buildSeaweedQuery(item["B"], region).append("alias", name)).each {
|
||||
// if(!results.contains(it)){
|
||||
// results.add(it)
|
||||
// }
|
||||
// }
|
||||
// if(results.size() == 1){
|
||||
// item["Z"] = results[0]._id.toString()
|
||||
// item["AA"] = results[0].region
|
||||
// item["AB"] = results[0].name
|
||||
// println(item)
|
||||
// }
|
||||
//})
|
||||
|
||||
|
||||
|
||||
|
||||
import com.fangjia.core.ProvinceData
|
||||
import com.fangjia.core.RegionData
|
||||
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
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import net.sf.json.JSONObject
|
||||
import org.apache.commons.lang.StringUtils
|
||||
import org.elasticsearch.index.query.BoolQueryBuilder
|
||||
import org.elasticsearch.index.query.QueryBuilders
|
||||
|
||||
//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)
|
||||
//def GXD_CCB = [:]
|
||||
//def CCB_FJW = [:]
|
||||
//ExcelUtils.read("D:\\Users\\wenyan\\Downloads\\4月级联待优化小区_3个城市.xlsx",sheetIndex = 1).each {List item->
|
||||
// if(item["V"] == "级联"){
|
||||
// if(item["Y"] == "国信达"){
|
||||
// GXD_CCB[item['J']] = item["E"]
|
||||
// }else if(item["Y"] == "房价网"){
|
||||
// CCB_FJW[item['E']] = item["J"]
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//ExcelUtils.multiThreadingModify("D:\\Users\\wenyan\\Downloads\\4月级联待优化小区_3个城市.xlsx",{List item->
|
||||
// if(item["V"] == "级联" && item["Y"] == "国信达"){
|
||||
// def ccbId = GXD_CCB.get(item['J'], null)
|
||||
// def fjwId = CCB_FJW.get(ccbId, null)
|
||||
// if(fjwId != null){
|
||||
// item["AB"] = fjwId
|
||||
//// BasicDBObject seaweed = DbUtils.seaweed.findById(fjwId)
|
||||
//// List results = DbUtils.findAroundDistrict(seaweed)
|
||||
//// long total = 0
|
||||
//// long count = 0
|
||||
//// for(BasicDBObject s : results){
|
||||
//// def avg = DbUtils.findDistrictAveragePrice(seaweed.city, seaweed.region, seaweed.name, Date.parse('yyyyMMdd', '20220619'), seaweed.estate_type2)
|
||||
//// if(avg){
|
||||
//// total += avg.avg_price
|
||||
//// count += 1
|
||||
//// }
|
||||
//// }
|
||||
//// if(count > 0){
|
||||
//// item['Z'] = (int)(total/count)
|
||||
//// println(item)
|
||||
//// }
|
||||
// }
|
||||
// }
|
||||
//},sheetIndex = 1)
|
||||
|
||||
ExcelUtils.multiThreadingModify("D:\\Users\\wenyan\\Desktop\\小区字段补充.xlsx",{List item->
|
||||
BasicDBObject seaweed = DbUtils.seaweed.findById(item["A"])
|
||||
if(StringUtils.isBlank(seaweed.create_year)){
|
||||
def names = []
|
||||
names.add(seaweed.name)
|
||||
if(seaweed.alias){
|
||||
for(def it in seaweed.alias){
|
||||
if(StringUtils.isNotBlank(it) && !names.contains(it)){
|
||||
names.add(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery()
|
||||
boolQueryBuilder.must(QueryBuilders.termQuery("city", seaweed.city))
|
||||
boolQueryBuilder.must(QueryBuilders.termQuery("region", seaweed.region))
|
||||
boolQueryBuilder.must(QueryBuilders.termsQuery("name", names));
|
||||
item["B"] = seaweed.city
|
||||
item["C"] = seaweed.region
|
||||
item["D"] = seaweed.name
|
||||
List result = ElasticUtils.executeSimpleQuery("192.168.0.206", "community", boolQueryBuilder)
|
||||
def buildYears = []
|
||||
result.each {
|
||||
if(StringUtils.isNotBlank(it.build_year) && !StringUtils.containsAny(it.build_year,"无")){
|
||||
String build_year = it.build_year
|
||||
build_year = build_year.replaceAll("((|\\().*()|\\))", "")
|
||||
build_year = build_year.replaceAll("[年建]", "")
|
||||
// property_fee = property_fee.replace("元/㎡·月", "元/平米/月")
|
||||
buildYears.add(build_year)
|
||||
}
|
||||
}
|
||||
buildYears = buildYears.unique()
|
||||
if(buildYears.size() > 0){
|
||||
DbUtils.seaweed.update(new BasicDBObject("_id", seaweed._id), new BasicDBObject('$set', new BasicDBObject('create_year', buildYears[0])))
|
||||
println(item)
|
||||
println(buildYears)
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user