diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/commData/CommonDatautils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/commData/CommonDatautils.groovy index 60c80de5a..43251bcc5 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/commData/CommonDatautils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/commData/CommonDatautils.groovy @@ -4147,6 +4147,96 @@ class CommonDatautils { } + static def findHousePriceByDate(def city, def region, def name, def alias, def cat, def startDate){ + + QueryBuilder date_range = QueryBuilders.rangeQuery("p_date").from(startDate).includeLower(true) + + QueryBuilder queryBuilder = QueryBuilders.boolQuery().must(QueryBuilders.termQuery("city", city)) + .must(QueryBuilders.termQuery("region", region)) + .must(QueryBuilders.termQuery("cat", cat)).must(date_range) + + if(name || alias){ + if(!alias){ + alias = [] + } + if(!alias.contains(name)){ + alias.add(name) + } + + if(name.contains("弄小区")){ + def newName = name.replace("弄小区","弄") + if(!alias.contains(newName)){ + alias << newName + } + } + + if(alias && alias.size()>0){ + BoolQueryBuilder inBuilder = QueryBuilders.boolQuery(); + for(def s : alias){ + inBuilder.should(QueryBuilders.matchQuery("district_name", s)); + } + queryBuilder.must(inBuilder) + } + } + + def hosts = ["192.168.0.206","192.168.0.211","192.168.0.212","192.168.0.213","192.168.0.214","192.168.0.215"] + def index = new Random().nextInt(5); + def houses = ElasticUtils.executeSimpleQuery(hosts[index], "seawater-20*", queryBuilder); + def prices = [] + if(houses){ + for (int k=0;k + index++ + println index + rets << [map.cityname, map.adname, map.name, map.address, map.location.x, map.location.y] + }) + return rets; + } + + + static def findOneThirdNetWorkOffice(city, region, name){ + String sql = "select location from office where city='${city}' and region='${region}' and name='${name}'" + def map = [:] + + ElasticUtils.executeSqlQuery(sql, { m-> + if(m.location && !map){ + map = ["lng":m.location.x, "lat":m.location.y] + } + }) + return map + } + + + static def findThirdNetWorkOffice(){ + String sql = "select city,region,name,address,location from office where city='烟台' or city='北京'" + def rets = [] + def index= 0 + ElasticUtils.executeSqlQuery(sql, { map-> + index++ + println index + if(map.location){ + rets << [map.city, map.region, map.name, map.address, map.location.lon, map.location.lat] + }else{ + rets << [map.city, map.region, map.name, map.address, "", ""] + } + + }) + return rets; + } /** * 是否是别墅 * @return @@ -5350,4 +5440,22 @@ class CommonDatautils { return retMap; } + static getSeaweedArroundByCat(city, lng, lat, cat) { + try { + def query = new BasicDBObject() + query.append("cat", cat) + query.append("city", city) + query.append("visible", 0) + DBObject sdq = new BasicDBObject(); + sdq.put("sd.point", lat + "," + lng); + sdq.put("sd.sfield", "lat_lng"); + sdq.put("sd.distance", String.valueOf((double) 1000 / 1000.0)); + query.append('$sd', sdq) + return DbUtils.seaweed.find(query).toList() + } catch (Exception e) { + e.printStackTrace() + } + return 0 + } + } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/AutoAddDistrictBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/AutoAddDistrictBatch.groovy index 80a9e2bdc..ae2703c0a 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/AutoAddDistrictBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/AutoAddDistrictBatch.groovy @@ -73,8 +73,8 @@ class AutoAddDistrictBatch extends BaseBatch{ def totalCount = new AtomicLong() for(def i=0;i