新增poi统计
This commit is contained in:
+77
-2
@@ -50,6 +50,7 @@ class CityInfoAnaBatch extends BaseBatch {
|
||||
final static DBCollection HOUSE_LOUDONG_CONN = MongoUtils.getCollectionByName("fangjia", "house_loudong", MongoUtils.MongoDB_Domain_mongo);
|
||||
final static DBCollection LOUDONG_CONN = MongoUtils.getCollectionByName("fangjia_base", "loudong", MongoUtils.MongoDB_Domain_mongo);
|
||||
final static DBCollection fsDB = MongoUtils.getCollectionByName("fangjia_fs", "files", MongoUtils.MongoDB_Domain_fs_mongo, 27000);
|
||||
final static DBCollection FACILITY_CONN = MongoUtils.getCollectionByName("fangjia", "district_facilitys", MongoUtils.MongoDB_Domain_mongo)
|
||||
static Jms jms = Jms.create('tcp://jms.db.fangjia.com:61616')
|
||||
final static DSCollection SEAWEED = DbUtils.seaweed
|
||||
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(20)
|
||||
@@ -62,7 +63,7 @@ class CityInfoAnaBatch extends BaseBatch {
|
||||
car_site :'carSite',estate_charge :'estateCharge',floorplan_pics :'floorplanPics',out_pics :'outPics',finish_building_date :'finishBuildingDate',business_quarter :'businessQuarter',
|
||||
start_building_date :'startBuildingDate',loop_line_info :'loopLineInfo',property_life :'propertyLife',house_property :'houseProperty',licence :'licence',build_structure :'buildStructure',
|
||||
lat : 'lat',lng : 'lng',lat2 : 'lat2',lng2 : 'lng2', out_pics : 'outPics', pics : 'pics',street_community:'streetCommunity',committee:'committee',schools:'schools',house_structure:'houseStructure',
|
||||
alias:'alias',addr_alias:'addrAlias'
|
||||
alias:'alias',addr_alias:'addrAlias','main_type_area':'mainTypeArea'
|
||||
]
|
||||
public static final def OFFICE_FIELDS_MAP = [
|
||||
name :'name',region :'region',block :'block',address :'address',estate_type2 :'estateType2',household_count :'householdCount',open_date :'openDate',live_date :'liveDate',
|
||||
@@ -85,6 +86,7 @@ class CityInfoAnaBatch extends BaseBatch {
|
||||
|
||||
final static def COUNT_CITYS = ["滁州","黄山","马鞍山","芜湖","宿州","宣城","北京","白银","定西","甘南","金昌","兰州","临夏","陇南","平凉","庆阳","天水","武威","张掖","东莞","佛山","广州","惠州","江门","梅州","清远","深圳","玉林","安顺","贵阳","铜仁","三亚","海口","承德","邯郸","衡水","廊坊","秦皇岛","石家庄","开封","洛阳","大庆","鄂州","黄冈","十堰","武汉","宜昌","常德","长沙","常州","淮安","连云港","南京","南通","苏州","泰州","无锡","宿迁","徐州","盐城","扬州","镇江","景德镇","九江","上饶","鹰潭","抚顺","辽阳","盘锦","沈阳","铁岭","营口","呼和浩特","石嘴山","银川","海东","西宁","滨州","德州","济南","济宁","青岛","潍坊","淄博","太原","宝鸡","渭南","西安","咸阳","上海","成都","达州","德阳","乐山","凉山州","泸州","眉山","绵阳","南充","内江","遂宁","雅安","宜宾","资阳","自贡","天津","丽江","昭通","杭州","湖州","嘉兴","金华","丽水","宁波","衢州","绍兴","台州","温州","舟山","重庆"];
|
||||
|
||||
final static def DIST_FACILITY_LIST = ["bank", "hospital", "bus", "shop", "university", "middle_school", "primary_school", "kindergarten", "food_shop", "supermarket","atm","school","subway"]
|
||||
/**
|
||||
* 统计结果接收邮箱列表
|
||||
*/
|
||||
@@ -116,7 +118,9 @@ class CityInfoAnaBatch extends BaseBatch {
|
||||
SERVER_AREA_CONN.find(cityQuery).each { allCitys.put(it.display, it); }
|
||||
|
||||
allCitys.each {k,v ->
|
||||
CITYS << k.toString();
|
||||
if(k.toString()=="上海"){
|
||||
CITYS << k.toString();
|
||||
}
|
||||
}
|
||||
|
||||
// 所有城市的人口信息
|
||||
@@ -565,6 +569,8 @@ class CityInfoAnaBatch extends BaseBatch {
|
||||
entity.put("price_credit_gte_00_coverage", DataUtil.roundDouble(creditGte00Count/count, 4))
|
||||
}
|
||||
entity.put('district_detail', districtDetail(disCount, cityName));
|
||||
|
||||
entity.put('district_facilitys_detail', districtFacilitysDetail(disCount, cityName));
|
||||
} else {
|
||||
entity.put('district_detail', [:]);
|
||||
}
|
||||
@@ -1079,6 +1085,75 @@ class CityInfoAnaBatch extends BaseBatch {
|
||||
districtDetail.put('rentPrice', roundDouble(pc, disCount));
|
||||
return districtDetail;
|
||||
}
|
||||
|
||||
def districtFacilitysDetail(def disCount, def cityName){
|
||||
DBObject query = new BasicDBObject();
|
||||
query.put('city', cityName);
|
||||
query.put('cat', 'district');
|
||||
query.put('visible', 0);
|
||||
|
||||
DBObject fields = new BasicDBObject()
|
||||
fields.put("city", 1)
|
||||
fields.put("region", 1)
|
||||
fields.put("name", 1)
|
||||
|
||||
def facilityMap = findFacilityByCity(cityName)
|
||||
DSCursor cur = SEAWEED.find(query, fields).batchSize(2000)
|
||||
Iterator<DBObject> iter = cur.iterator()
|
||||
def countMap = [:]
|
||||
|
||||
while(iter.hasNext()) {
|
||||
def dbo = iter.next()
|
||||
def facilityCountMap = facilityMap.get(dbo.city+"##"+dbo.region+"##"+dbo.name)
|
||||
if(facilityCountMap){
|
||||
DIST_FACILITY_LIST.each() {
|
||||
def count = facilityCountMap.get(it)
|
||||
if (count) {
|
||||
if(countMap.containsKey(it)) {
|
||||
def tempCount = countMap.get(it) + 1
|
||||
countMap.put(it, tempCount)
|
||||
}else {
|
||||
countMap.put(it, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def facilityDetail = [:];
|
||||
DIST_FACILITY_LIST.each() {it->
|
||||
if(countMap.containsKey(it)) {
|
||||
facilityDetail.put(it, roundDouble(countMap.get(it), disCount))
|
||||
}else {
|
||||
facilityDetail.put(it, 0)
|
||||
}
|
||||
}
|
||||
return facilityDetail;
|
||||
}
|
||||
|
||||
def findFacilityByCity(city){
|
||||
DBObject query = new BasicDBObject();
|
||||
query.put('city', city);
|
||||
DBCursor cur = FACILITY_CONN.find(query).batchSize(2000)
|
||||
Iterator<DBObject> iter = cur.iterator()
|
||||
def distMap = [:]
|
||||
while(iter.hasNext()) {
|
||||
def dbo = iter.next()
|
||||
def countMap = [:]
|
||||
DIST_FACILITY_LIST.each {
|
||||
def values = dbo.get(it)
|
||||
def count = 0
|
||||
if(values){
|
||||
count = values.size()
|
||||
countMap.put(it, count)
|
||||
}
|
||||
}
|
||||
if(countMap){
|
||||
distMap.put(dbo.city+"##"+dbo.region+"##"+dbo.district_name, countMap)
|
||||
}
|
||||
}
|
||||
return distMap;
|
||||
}
|
||||
|
||||
double roundDouble(int a, int base) {
|
||||
if(a == 0 || base == 0) {
|
||||
|
||||
Reference in New Issue
Block a user