分析地址

This commit is contained in:
2021-04-06 09:49:51 +08:00
parent d6ec9c053b
commit 1922c5a62c
@@ -204,52 +204,59 @@ import org.dom4j.io.SAXReader
//// }
//// }
//})
DBCollection COMMAND_COLL = MongoUtils.getCollectionByName("business", "open_uri_log", "192.168.0.206", 27020)
statMap = [:]
def s = new HashSet()
int count = 0
def data = [["城市", "地址"]]
def query = new BasicDBObject("user_id", "1007751").append("c_date", new BasicDBObject('$gte', Date.parse("yyyyMMdd", "20210119")))
println JSONObject.fromObject(query)
println COMMAND_COLL.count(query)
COMMAND_COLL.find(query).batchSize(10000).each { BasicDBObject log ->
count++
// def city = log.parameter_map.city
// def stat = statMap.get(city, [:])
// stat["调用次数"] = stat.get("调用次数", 0) + 1
if (log.res_map && log.res_map.result && log.res_map.result.totalPrice) {
// stat["估价成功次数"] = stat.get("估价成功次数", 0) + 1
// if(log.res_map.result.calcType == 1){
// stat["有样本"] = stat.get("有样本", 0) + 1
// }else{
// stat["无样本"] = stat.get("无样本", 0) + 1
//DBCollection COMMAND_COLL = MongoUtils.getCollectionByName("business", "open_uri_log", "192.168.0.206", 27020)
//statMap = [:]
//def s = new HashSet()
//int count = 0
//def data = [["城市", "地址"]]
//def query = new BasicDBObject("user_id", "1007751").append("c_date", new BasicDBObject('$gte', Date.parse("yyyyMMdd", "20210119")))
//println JSONObject.fromObject(query)
//println COMMAND_COLL.count(query)
//COMMAND_COLL.find(query).batchSize(10000).each { BasicDBObject log ->
// count++
//// def city = log.parameter_map.city
//// def stat = statMap.get(city, [:])
//// stat["调用次数"] = stat.get("调用次数", 0) + 1
// if (log.res_map && log.res_map.result && log.res_map.result.totalPrice) {
//// stat["估价成功次数"] = stat.get("估价成功次数", 0) + 1
//// if(log.res_map.result.calcType == 1){
//// stat["有样本"] = stat.get("有样本", 0) + 1
//// }else{
//// stat["无样本"] = stat.get("无样本", 0) + 1
//// }
//// stat["总价"] = stat.get("总价", 0l) + log.res_map.result.totalPrice
//// stat["总面积"] = stat.get("总面积", 0d) + log.parameter_map.size.toDouble()
//
// } else {
// if (log.res_map.msg.toString().contains("该小区不存在")) {
// println( [log.parameter_map.city, log.parameter_map.address])
// data << [log.parameter_map.city, log.parameter_map.address]
// }
// stat["总价"] = stat.get("总价", 0l) + log.res_map.result.totalPrice
// stat["总面积"] = stat.get("总面积", 0d) + log.parameter_map.size.toDouble()
} else {
if (log.res_map.msg.toString().contains("该小区不存在")) {
println( [log.parameter_map.city, log.parameter_map.address])
data << [log.parameter_map.city, log.parameter_map.address]
}
// stat["估价失败次数"] = stat.get("估价失败次数", 0) + 1
// stat["失败原因:" + log.res_map.msg] = stat.get("失败原因:" + log.res_map.msg, 0) + 1
// s << "失败原因:" + log.res_map.msg
}
if (count % 10000 == 0) {
println(count)
}
}
data = data.unique()
ExcelUtils.write("D:\\未匹配地址.xlsx", data, "结果")
//key = ["调用次数", "估价成功次数", "有样本", "无样本", "总价", "总面积", "估价失败次数"]
//key.addAll(s)
//print(key.join("\t"))
//[ "苏州", "广州", "杭州", "大连", "重庆", "成都", "深圳", "厦门", "上海", "北京" ].each {def city->
// stat = statMap.get(city)
// con = [city]
// for( def k : key){
// con << stat[k]
//// stat["估价失败次数"] = stat.get("估价失败次数", 0) + 1
//// stat["失败原因:" + log.res_map.msg] = stat.get("失败原因:" + log.res_map.msg, 0) + 1
//// s << "失败原因:" + log.res_map.msg
// }
// println con.join("\t")
//}
// if (count % 10000 == 0) {
// println(count)
// }
//}
//data = data.unique()
//ExcelUtils.write("D:\\未匹配地址.xlsx", data, "结果")
////key = ["调用次数", "估价成功次数", "有样本", "无样本", "总价", "总面积", "估价失败次数"]
////key.addAll(s)
////print(key.join("\t"))
////[ "苏州", "广州", "杭州", "大连", "重庆", "成都", "深圳", "厦门", "上海", "北京" ].each {def city->
//// stat = statMap.get(city)
//// con = [city]
//// for( def k : key){
//// con << stat[k]
//// }
//// println con.join("\t")
////}
DBCollection OPEN_URI_LOG_42 = MongoUtils.getCollectionByName("business", "open_uri_log", "log.mongo.db.fangjia.com", 52002)
def data = [["城市", "地址", "省", "市", "区", "开发区","乡镇", "路", "路号", "小区名", "楼栋号", "单元号", "室号", "标准化地址"]]
OPEN_URI_LOG_42.find(new BasicDBObject("user_id", "1007756")).each {BasicDBObject dbo->
data << [dbo.parameter_map.city, dbo.parameter_map.address, dbo.res_map.result.province, dbo.res_map.result.city, dbo.res_map.result.district, dbo.res_map.result.developmentZone, dbo.res_map.result.township, dbo.res_map.result.street,dbo.res_map.result.streetNumber,dbo.res_map.result.name,dbo.res_map.result.buildingNumber,dbo.res_map.result.unitNumber,dbo.res_map.result.roomNumber,dbo.res_map.result.formattedAddress]
}
ExcelUtils.write("D:\\建行测试地址.xlsx", data, "结果")