This commit is contained in:
2024-04-09 13:25:49 +08:00
parent 9d985e920d
commit fd69a283d4
5 changed files with 134 additions and 94 deletions
@@ -52,7 +52,7 @@ class GuiDingPriceBatch extends BaseBatch{
def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city)
//添加自己库中的人工指导价
def prices = CcbCommonUtils.findPersonPrice(city, "2024-01-10", "2024-01-28")
def prices = CcbCommonUtils.findPersonPrice(city, "2024-03-27", "2024-04-10")
// def prices = CcbCommonUtils.findPersonPrice(city, "2022-01-01", "2022-11-22")
if(prices){
def distMap = getDistrictMap(city)
@@ -7,6 +7,7 @@ import com.fangjia.script.commData.CommonDatautils
import com.fangjia.script.common.DataHandleUtils
import com.fangjia.script.gj.ccb.CcbCodeUtils
import com.fangjia.script.gj.ccb.FileUtils
import com.fangjia.script.gj.district.FangjiaClientUtils
import com.fangjia.script.linxsh.util.AddressUtil
import com.fangjia.script.looplineinfo.InsidePolygon
import com.fangjia.script.looplineinfo.Point
@@ -1288,34 +1289,70 @@ def findAvgPrice(def commid, def pgsqlInstance, def cityid){
def fileName = "D:\\数据\\建行\\房产估值\\指导价\\20240127.xlsx"
ExcelUtils.multiThreadingModify(fileName, {d->
if(d['A']){
// def region = RegionData.formatRegion(d['B'], d['C'])
// if(region){
// def dist = CommonDatautils.findDistrict(d['B'], region, d['E'], "district")
//def fileName = "D:\\数据\\建行\\房产估值\\指导价\\20240127.xlsx"
//
//ExcelUtils.multiThreadingModify(fileName, {d->
// if(d['A']){
//// def region = RegionData.formatRegion(d['B'], d['C'])
//// if(region){
//// def dist = CommonDatautils.findDistrict(d['B'], region, d['E'], "district")
//// if(dist){
//// d['G'] = dist.region
//// d['H'] = dist._id.toString()
//// }
//// }
// if(!d['I']){
// def dist = CommonDatautils.findDistrictById(d['C'])
// if(dist){
// d['G'] = dist.region
// d['H'] = dist._id.toString()
// d['F'] = dist.region
//// d['H'] = dist.name
// d['G'] = dist.status
//// if(d['A']=="天门" || d['A']=="迪庆"){
//// def val = d['E'].toString().toDouble().toInteger() + RandomUtil.random(-200,200)
//// d['K'] = val.toInteger()
//// }
// }
// }
if(!d['I']){
def dist = CommonDatautils.findDistrictById(d['C'])
if(dist){
d['F'] = dist.region
// d['H'] = dist.name
d['G'] = dist.status
// if(d['A']=="天门" || d['A']=="迪庆"){
// def val = d['E'].toString().toDouble().toInteger() + RandomUtil.random(-200,200)
// d['K'] = val.toInteger()
// }
// }
//},0)
def fileName = "D:\\数据\\建行\\房产估值\\指导价\\2024-04-08修改人工指导价.xlsx"
ExcelUtils.multiThreadingModify(fileName, { d ->
if(d['B'] && !d['D']){
def jsonObject = FangjiaClientUtils.newMatch(d['A'], d['B'], "property", "district")
if(jsonObject != null && jsonObject.credit>0) {
d['D'] = jsonObject.get("city")
d['E'] = jsonObject.get("district")
d['F'] = jsonObject.get("name")
def dbo = CommonDatautils.findDistrictById(jsonObject.get("id"))
if(dbo){
d['G'] = dbo.status
d['H'] = dbo.name_cat
d['I'] = dbo.estate_type2
d['J'] = "接口匹配"
}
}
// def objs = CommonDatautils.findDistrictList(d['A'],null, d['B'], "district")
// if(!objs){
// objs = CommonDatautils.findDistrictByAlias(d['A'], null, d['B'], "district")
// }
// if(objs && objs.size()==1){
// def o = objs[0]
// if(o){
// d['D'] = o.city
// d['E'] = o.region
// d['F'] = o.name
// d['G'] = o.status
// d['H'] = o.name_cat
// d['I'] = o.estate_type2
// d['J'] = "别名"
// }
// }
}
},0)
})
//def fileName = "D:\\数据\\建行\\建行成交\\咸阳成交.xlsx"
//ExcelUtils.multiThreadingModify(fileName, { d ->
@@ -283,7 +283,12 @@ class DistrictSellStatBatch extends BaseBatch {
def dbcursor = DISTRICT_SELL_STAT.find(q)
def priceMap = [:]
for(def d : dbcursor){
priceMap.put(d.region +"##"+d.district_name, d)
if(d.estate_type=="别墅"){
priceMap.put(d.region +"##"+d.district_name+"##别墅", d)
}else{
priceMap.put(d.region +"##"+d.district_name+"##小区", d)
}
}
return priceMap
}
@@ -18,77 +18,75 @@ DBCollection COMMUNITY_CONN = MongoUtils.getCollectionByName2("fangjia", "commun
//def s = getTownshipInfo("118.702988,39.740979")
def filePath = "D:\\数据\\涉农\\县政府(最终).xlsx"
//ExcelUtils.multiThreadingModify(filePath, { row ->
//// if(!row['I']){
//// def rets = EsSearchUtils.findPois(row['B'], row['C'], row['C']+"人民政府")
//// if(rets){
//// def obj = findOneByName(rets, row['C']+"人民政府")
//// if(obj){
//// row['I'] = obj.lng
//// row['J'] = obj.lat
//// println row['C'] + " "+obj
//// }
//// }
//// }
//
//// if(row['D'] && !row['F']){
//// def townMap = findTownRange(row['B'], TOWN_POLYLINECOLL)
//// def map = ["lon":row['D'], "lat":row['E']]
//// def township = InsidePolygon.isInArea2(map.lon, map.lat, townMap)
//// row['F'] = township
//// }
//
//// if(row['F'] && !row['J']){
//// def q = new BasicDBObject()
//// q.put("city_name", row['B'])
//// q.put("area_name", row['C'])
//// def streetName = row['F']
//// q.put("street_name", streetName)
//// def count = COMMUNITY_CONN.count(q);
//// row['J'] = count
////// row['H'] = streetName
//// }
//// if(!row['H']){
//// def gaodeMap = getTownshipInfo(row['D']+","+row['E'])
//// if(gaodeMap && gaodeMap.township){
//// row['H'] = gaodeMap.township
//// }
//// }
//
//// if(row['J'] && row['J'].toString().toDouble()>0){
//// def up_query = new BasicDBObject()
//// up_query.put("city_name", row['B'])
//// up_query.put("area_name", row['C'])
//// up_query.put("street_name", row['F'])
//// def udata = new BasicDBObject()
//// udata.put("has_gov", "是")
//// COMMUNITY_CONN.update(up_query, new BasicDBObject('$set', udata), false, true)
//// }
//
//
//})
ExcelUtils.modify(filePath, { row ->
// if(!row['I']){
// def rets = EsSearchUtils.findPois(row['B'], row['C'], row['C']+"人民政府")
// if(rets){
// def obj = findOneByName(rets, row['C']+"人民政府")
// if(obj){
// row['I'] = obj.lng
// row['J'] = obj.lat
// println row['C'] + " "+obj
// }
// }
// }
if(row['D'] && !row['F']){
def townMap = findTownRange(row['B'], TOWN_POLYLINECOLL)
def map = ["lon":row['D'], "lat":row['E']]
def township = InsidePolygon.isInArea2(map.lon, map.lat, townMap)
row['F'] = township
}
// if(row['F'] && !row['J']){
// def q = new BasicDBObject()
// q.put("city_name", row['B'])
// q.put("area_name", row['C'])
// def streetName = row['F']
// q.put("street_name", streetName)
// def count = COMMUNITY_CONN.count(q);
// row['J'] = count
//// row['H'] = streetName
// }
// if(!row['H']){
// def gaodeMap = getTownshipInfo(row['D']+","+row['E'])
// if(gaodeMap && gaodeMap.township){
// row['H'] = gaodeMap.township
// }
// }
// if(row['J'] && row['J'].toString().toDouble()>0){
// def up_query = new BasicDBObject()
// up_query.put("city_name", row['B'])
// up_query.put("area_name", row['C'])
// up_query.put("street_name", row['F'])
// def udata = new BasicDBObject()
// udata.put("has_gov", "是")
// COMMUNITY_CONN.update(up_query, new BasicDBObject('$set', udata), false, true)
// }
})
def objs = COMMUNITY_CONN.find(new BasicDBObject()).setOptions(Bytes.QUERYOPTION_NOTIMEOUT);
for(def d : objs){
if(!d.name_pinyin){
if(d.name){
println d._id
def py1 = com.fangjia.core.util.DataUtil.hanyuQuanpin(d.name, " ")
def udata = new BasicDBObject()
udata.put("name_pinyin", py1)
if(d.location){
def lon = DataHandleUtils.getDoubleRound(6, d.location.lon)
def lat = DataHandleUtils.getDoubleRound(6, d.location.lat)
udata.put("location", ["lat":lat, "lon":lon])
}
def q = new BasicDBObject()
q.put("_id", d._id)
COMMUNITY_CONN.update(q, new BasicDBObject('$set', udata), false, true)
}
}
}
//def objs = COMMUNITY_CONN.find(new BasicDBObject()).setOptions(Bytes.QUERYOPTION_NOTIMEOUT);
//for(def d : objs){
// if(!d.name_pinyin){
// if(d.name){
// println d._id
// def py1 = com.fangjia.core.util.DataUtil.hanyuQuanpin(d.name, " ")
// def udata = new BasicDBObject()
// udata.put("name_pinyin", py1)
// if(d.location){
// def lon = DataHandleUtils.getDoubleRound(6, d.location.lon)
// def lat = DataHandleUtils.getDoubleRound(6, d.location.lat)
// udata.put("location", ["lat":lat, "lon":lon])
// }
//
// def q = new BasicDBObject()
// q.put("_id", d._id)
// COMMUNITY_CONN.update(q, new BasicDBObject('$set', udata), false, true)
// }
// }
//}
def getTownshipInfo(def glocation){
@@ -284,7 +284,7 @@ class InsidePolygon {
if(flag){
def arrs = key.split("##")
name = arrs[1];
break;
// break;
}
}
if(flag){