update
This commit is contained in:
+39
-1
@@ -103,6 +103,13 @@ class CcbCommonUtils {
|
||||
alias << dist.name
|
||||
}
|
||||
|
||||
if(dist.name.endsWith("弄小区")){
|
||||
def name = dist.name.replace("弄小区","弄")
|
||||
if(!alias.contains(name)){
|
||||
alias << name
|
||||
}
|
||||
}
|
||||
|
||||
if(alias){
|
||||
q.put("district_name", new BasicDBObject('$in', alias))
|
||||
}
|
||||
@@ -131,6 +138,37 @@ class CcbCommonUtils {
|
||||
return lists
|
||||
}
|
||||
|
||||
public static def findTradesDetailByAddress(dist, startDate, endDate, startPrice, endPrice){
|
||||
def q = new BasicDBObject()
|
||||
q.put("city", dist.city)
|
||||
q.put("region", dist.region)
|
||||
q.put("area", new BasicDBObject('$gte', 20))
|
||||
q.put("district_name", dist.address)
|
||||
q.put("trade_date", new BasicDBObject('$gte', startDate).append('$lt',endDate))
|
||||
def dbcursor = DEAL_PRICE_COLL.find(q)
|
||||
def total = dbcursor.count()
|
||||
def rets = new HashSet()
|
||||
def lists = []
|
||||
for(def d : dbcursor){
|
||||
if(startPrice && d.avg_price>=startPrice && d.avg_price<=endPrice){
|
||||
def key=d.city+"##"+d.region+"##"+d.district_name+"##"+d.area+"##"+d.avg_price+"##"+DateUtils.formatDateByPattern(d.trade_date,"yyyy-MM-dd")
|
||||
if(!rets.contains(key)){
|
||||
rets << key
|
||||
d.dist_id = dist._id.toString()
|
||||
d.address = dist.address
|
||||
d.master_name = dist.name
|
||||
d.build_type = dist.build_type
|
||||
d.build_structure = dist.build_structure
|
||||
d.house_roperty = dist.house_roperty
|
||||
d.property_life = dist.property_life
|
||||
d.estate_type2 = dist.estate_type2
|
||||
lists << d
|
||||
}
|
||||
}
|
||||
}
|
||||
return lists
|
||||
}
|
||||
|
||||
|
||||
public static def findTrades(dist, startDate, endDate){
|
||||
def q = new BasicDBObject()
|
||||
@@ -187,7 +225,7 @@ class CcbCommonUtils {
|
||||
q.put("visible",0)
|
||||
q.put("cat", cat);
|
||||
q.put("city", city);
|
||||
// q.put("name", "莱兴公寓")
|
||||
// q.put("name", "周家湾")
|
||||
// q.put("name_cat", 0);
|
||||
// q.put("estate_type2", new BasicDBObject('$in', ["普通住宅","商住"]))
|
||||
|
||||
|
||||
+22
@@ -1233,6 +1233,28 @@ class CommonDatautils {
|
||||
}
|
||||
|
||||
|
||||
public static def findDistrictByAddress2(def city, def region, def address, def cat){
|
||||
DBObject q = new BasicDBObject();
|
||||
if(region){
|
||||
q.put('region', region)
|
||||
}
|
||||
|
||||
q.put('city',city)
|
||||
q.put('cat', cat)
|
||||
q.put('visible',0)
|
||||
q.put("address", address);
|
||||
|
||||
|
||||
def dsCursor = getDataStoreConnection().find(q);
|
||||
def ret = [];
|
||||
for(def obj : dsCursor){
|
||||
ret << obj;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
public static def getCityRegions(city){
|
||||
DBObject queryCondition = new BasicDBObject()
|
||||
queryCondition.put("city", city);
|
||||
|
||||
@@ -123,6 +123,7 @@ class GaoDeMapCrawl extends BaseBatch{
|
||||
def allcitys = CommonUtils.findAllCity()
|
||||
def totalCount = 0;
|
||||
for(def city : allcitys){
|
||||
|
||||
if(!citys.contains(city)){
|
||||
def stop = false
|
||||
while(stop == false){
|
||||
@@ -135,6 +136,7 @@ class GaoDeMapCrawl extends BaseBatch{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,7 +148,11 @@ class GaoDeMapCrawl extends BaseBatch{
|
||||
q.put(prefix+"status", new BasicDBObject(QueryOperators.EXISTS, false))
|
||||
// q.put("status", "失败")
|
||||
// q.put("traffic_status", new BasicDBObject(QueryOperators.EXISTS, false))
|
||||
def results = BOUNDS_COLL.find(q).limit(2000).addOption(Bytes.QUERYOPTION_NOTIMEOUT)
|
||||
def dbcursor = BOUNDS_COLL.find(q).batchSize(3000).addOption(Bytes.QUERYOPTION_NOTIMEOUT)
|
||||
def results = []
|
||||
for(def d : dbcursor){
|
||||
results << d
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
@@ -192,8 +198,9 @@ class GaoDeMapCrawl extends BaseBatch{
|
||||
// def lngs = [bound_gd[0], bound_gd[2]]
|
||||
// lats.sort()
|
||||
// lngs.sort()
|
||||
// println index
|
||||
// if(lngs[0]<=121.418153 && lngs[1]>=121.418153 && lats[0]<=31.218824 && lats[1]>=31.218824){
|
||||
println i+" "+ location
|
||||
// 120.019556,30.313701
|
||||
//if(lngs[0]<=120.019556 && lngs[1]>=120.019556 && lats[0]<=30.313701 && lats[1]>=30.313701){
|
||||
search(i, location)
|
||||
// }
|
||||
|
||||
|
||||
+5
-2
@@ -45,8 +45,10 @@ class Esf58Crawl extends BaseBatch{
|
||||
void process(Object args) {
|
||||
//addContent("福州","https://fz.58.com/xiaoqu/", 70);
|
||||
|
||||
for(def i=0;i<5;i++){
|
||||
def city = "福州"
|
||||
def citys = CommonDatautils.findCitys()
|
||||
for(def city : citys){
|
||||
for(def i=0;i<1;i++){
|
||||
// def city = "福州"
|
||||
def districts = CommonDatautils.findAllDistricts(city, "district", ["city", "region", "name"]);
|
||||
distMap.put(city, districts)
|
||||
|
||||
@@ -55,6 +57,7 @@ class Esf58Crawl extends BaseBatch{
|
||||
|
||||
Thread.sleep(1000*60*10)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
def addCrawlKeys(city){
|
||||
|
||||
+4
-1
@@ -17,7 +17,7 @@ class SynchDistrictPrice {
|
||||
def districtDetailColl = CrawalDBUtil.getDistrictDetailColl();
|
||||
def sourceMap = ["jiwu.com":"吉屋","58.com":"58同城","lianjia.com":"链家","ke.com":"贝壳找房","fang.com":"搜房","fangdd.com":"房多多","house365.com":"365淘房",
|
||||
"anjuke.com":"安居客","cityhouse.cn":"城市房产"]
|
||||
// def sourceMap = ["cityhouse.cn":"城市房产"]
|
||||
// def sourceMap = ["lianjia.com":"链家"]
|
||||
static main(args) {
|
||||
def task = new SynchDistrictPrice()
|
||||
task.run()
|
||||
@@ -43,6 +43,7 @@ class SynchDistrictPrice {
|
||||
def q = new BasicDBObject()
|
||||
q.put("city", city)
|
||||
q.put("root", root)
|
||||
// q.put("name","兰州万达城")
|
||||
q.put('m_date', new BasicDBObject('$gte', curMonthFirstDay));
|
||||
def keys = new BasicDBObject()
|
||||
keys.put("city", 1)
|
||||
@@ -95,6 +96,8 @@ class SynchDistrictPrice {
|
||||
thirdPartyColl.remove(new BasicDBObject('_id',obj._id))
|
||||
addIndex++
|
||||
thirdPartyColl.save(r)
|
||||
}else{
|
||||
thirdPartyColl.save(r)
|
||||
}
|
||||
// if(!obj){
|
||||
// addIndex++
|
||||
|
||||
Reference in New Issue
Block a user