潜力指数修改
This commit is contained in:
+14
@@ -3153,4 +3153,18 @@ class CommonDatautils {
|
|||||||
return dbo;
|
return dbo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static def findNewSqmetreRent(def city, def region, def name){
|
||||||
|
def q = new BasicDBObject()
|
||||||
|
q.put("city", city)
|
||||||
|
q.put("region", region)
|
||||||
|
q.put("district_name", name)
|
||||||
|
|
||||||
|
def dbcursor = SQMETRE_RENT_COLL.find(q).sort(new BasicDBObject().append("weekend", -1)).limit(1)
|
||||||
|
def avg_price = null
|
||||||
|
for(def d : dbcursor){
|
||||||
|
avg_price = d.avg_price;
|
||||||
|
}
|
||||||
|
return avg_price;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-4
@@ -70,7 +70,6 @@ class DistrictIndexBatch extends BaseBatch{
|
|||||||
def run(){
|
def run(){
|
||||||
def cityCodeDatas = CcbCommonUtils.findCityCodeValue()
|
def cityCodeDatas = CcbCommonUtils.findCityCodeValue()
|
||||||
def citys = CommonDatautils.findAllCity();
|
def citys = CommonDatautils.findAllCity();
|
||||||
citys.remove("上海")
|
|
||||||
for(def city : citys){
|
for(def city : citys){
|
||||||
def dists = CommonDatautils.findAllDistrictByCity(city, "district", ["city","alias","region","name", "finish_building_date","estate_charge","lat","lng","lng2","lat2"])
|
def dists = CommonDatautils.findAllDistrictByCity(city, "district", ["city","alias","region","name", "finish_building_date","estate_charge","lat","lng","lng2","lat2"])
|
||||||
def code = cityCodeDatas.get(city)
|
def code = cityCodeDatas.get(city)
|
||||||
@@ -85,7 +84,7 @@ class DistrictIndexBatch extends BaseBatch{
|
|||||||
city_avg_total_price = 531.2615913
|
city_avg_total_price = 531.2615913
|
||||||
}
|
}
|
||||||
if(city_avg_total_price){
|
if(city_avg_total_price){
|
||||||
calcute(city, dists, code, city_avg_total_price)
|
// calcute(city, dists, code, city_avg_total_price)
|
||||||
calcuteIndex(city, dists, code, city_avg_total_price)
|
calcuteIndex(city, dists, code, city_avg_total_price)
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -119,7 +118,7 @@ class DistrictIndexBatch extends BaseBatch{
|
|||||||
def total_price = getHousePrice(d, dists, priceMap, citycode);
|
def total_price = getHousePrice(d, dists, priceMap, citycode);
|
||||||
def avg_cost = getAvgCost(d, costDatas)
|
def avg_cost = getAvgCost(d, costDatas)
|
||||||
|
|
||||||
|
def avg_price = priceMap.get(d.city+"##"+d.region+"##"+d.name)
|
||||||
def map = [:]
|
def map = [:]
|
||||||
map.id = d._id.toString()
|
map.id = d._id.toString()
|
||||||
map.city = d.city
|
map.city = d.city
|
||||||
@@ -137,9 +136,10 @@ class DistrictIndexBatch extends BaseBatch{
|
|||||||
|
|
||||||
//datas << [d.city, d.region, d.name, total_price_index, avg_charge_index, rank_index, avg_cost_index,potentiality]
|
//datas << [d.city, d.region, d.name, total_price_index, avg_charge_index, rank_index, avg_cost_index,potentiality]
|
||||||
|
|
||||||
|
map.sell_avg_price = avg_price
|
||||||
def newUrl = targetUrl +"_doc/"+map.id
|
def newUrl = targetUrl +"_doc/"+map.id
|
||||||
httpSaveData(newUrl, map)
|
httpSaveData(newUrl, map)
|
||||||
println "[${totalCount.get()}] " + d.name + " avg_cost: " + avg_cost + " avg_charge:" + avg_charge + " rank:" + rank + " total_price:" + total_price
|
println "[${totalCount.get()}] " + d.name + " avg_cost: " + avg_cost + " avg_charge:" + avg_charge + " rank:" + rank + " total_price:" + total_price+""
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
} finally {
|
} finally {
|
||||||
@@ -213,6 +213,9 @@ class DistrictIndexBatch extends BaseBatch{
|
|||||||
def potentiality = total_price_index + avg_charge_index + rank_index + avg_cost_index + 4099.978248
|
def potentiality = total_price_index + avg_charge_index + rank_index + avg_cost_index + 4099.978248
|
||||||
potentiality = DataHandleUtils.getDoubleRound(6, potentiality)
|
potentiality = DataHandleUtils.getDoubleRound(6, potentiality)
|
||||||
|
|
||||||
|
|
||||||
|
def year = CommonUtils.getBuildYear(d.finish_building_date)
|
||||||
|
def sqmetre_rent = CommonDatautils.findNewSqmetreRent(d.city,d.region,d.name)
|
||||||
def map = [:]
|
def map = [:]
|
||||||
map.id = d._id.toString()
|
map.id = d._id.toString()
|
||||||
map.city = d.city
|
map.city = d.city
|
||||||
@@ -228,6 +231,15 @@ class DistrictIndexBatch extends BaseBatch{
|
|||||||
map.avg_total_price = total_price_index
|
map.avg_total_price = total_price_index
|
||||||
map.month = "2022-03"
|
map.month = "2022-03"
|
||||||
map.m_date = DateUtil.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss").replace(" ","T")
|
map.m_date = DateUtil.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss").replace(" ","T")
|
||||||
|
|
||||||
|
map.finish_date = year
|
||||||
|
map.sell_avg_price = rMap.sell_avg_price
|
||||||
|
if(sqmetre_rent){
|
||||||
|
map.sqmetre_rent = sqmetre_rent
|
||||||
|
}
|
||||||
|
if(rMap.sell_avg_price && sqmetre_rent){
|
||||||
|
map.price_to_rent = (rMap.sell_avg_price/sqmetre_rent).toInteger()
|
||||||
|
}
|
||||||
def newUrl = targetUrl +"_doc/"+map.id
|
def newUrl = targetUrl +"_doc/"+map.id
|
||||||
httpSaveData(newUrl, map)
|
httpSaveData(newUrl, map)
|
||||||
|
|
||||||
@@ -268,6 +280,7 @@ class DistrictIndexBatch extends BaseBatch{
|
|||||||
rMap.put("price_rank", rs.price_rank)
|
rMap.put("price_rank", rs.price_rank)
|
||||||
rMap.put("avg_cost", rs.avg_cost)
|
rMap.put("avg_cost", rs.avg_cost)
|
||||||
rMap.put("avg_estate_charge", rs.avg_estate_charge)
|
rMap.put("avg_estate_charge", rs.avg_estate_charge)
|
||||||
|
rMap.put("sell_avg_price", rs.sell_avg_price)
|
||||||
}
|
}
|
||||||
return detailMap;
|
return detailMap;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user