名录集跑5级匹配
This commit is contained in:
+27
@@ -1892,6 +1892,33 @@ class CommonDatautils {
|
||||
}
|
||||
|
||||
|
||||
public static def queryFirstOrLastDistrictPrice(city, region, name, sort){
|
||||
DBObject queryCondition = new BasicDBObject()
|
||||
queryCondition.put("city", city);
|
||||
queryCondition.put("region", region);
|
||||
queryCondition.put("district_name", name);
|
||||
|
||||
DBCursor cur = DIST_STAT_COLL.find(queryCondition).sort(new BasicDBObject("weekend", sort)).limit(1)
|
||||
cur.setOptions(Bytes.QUERYOPTION_NOTIMEOUT)
|
||||
def dbo = null;
|
||||
while(cur.hasNext()) {
|
||||
dbo = cur.next()
|
||||
}
|
||||
return dbo;
|
||||
}
|
||||
|
||||
|
||||
public static def queryDistrictPriceByWeekend(city, region, name, weekend){
|
||||
DBObject queryCondition = new BasicDBObject()
|
||||
queryCondition.put("city", city);
|
||||
queryCondition.put("region", region);
|
||||
queryCondition.put("district_name", name);
|
||||
queryCondition.put("weekend", weekend);
|
||||
|
||||
return DIST_STAT_COLL.findOne(queryCondition)
|
||||
}
|
||||
|
||||
|
||||
public static def queryDistrictPrice(city, region, name, weekend, cat){
|
||||
DBObject queryCondition = new BasicDBObject()
|
||||
queryCondition.put("city", city);
|
||||
|
||||
+58
-2
@@ -8,10 +8,12 @@ import com.fangjia.script.util.CommonUtils
|
||||
class AddCityRegionPrice {
|
||||
static main(args) {
|
||||
def task = new AddCityRegionPrice()
|
||||
task.run()
|
||||
// task.addRegionPrice()
|
||||
// task.addCityprice()
|
||||
task.addDistrictprice()
|
||||
}
|
||||
|
||||
def run(){
|
||||
def addRegionPrice(){
|
||||
InsertMonitorCalcCommandBatch insertBatch = new InsertMonitorCalcCommandBatch()
|
||||
def citys = CommonDatautils.findAllCity()
|
||||
def add = 0
|
||||
@@ -38,4 +40,58 @@ class AddCityRegionPrice {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
def addCityprice(){
|
||||
InsertMonitorCalcCommandBatch insertBatch = new InsertMonitorCalcCommandBatch()
|
||||
def citys = CommonDatautils.findAllCity().reverse()
|
||||
def add = 0
|
||||
for(def c : citys){
|
||||
def startObj = CommonDatautils.queryCityOrRegionPrice(c, null, 1)
|
||||
def endObj = CommonDatautils.queryCityOrRegionPrice(c, null, -1)
|
||||
if(startObj && endObj){
|
||||
def betweenDates = DateUtil.getWeekendBetweenDates(startObj.weekend, endObj.weekend);
|
||||
for(def weekend : betweenDates ){
|
||||
def price = CommonDatautils.findCityOrRegionPrice(c, null, weekend)
|
||||
if(!price){
|
||||
add++
|
||||
insertBatch.saveCityCalcCommand(c,null,null, weekend, "fangjia-priceanalysis-0")
|
||||
println "[add] ${add} "+c+" "+DateUtil.formatByPattern(weekend, "yyyy-MM-dd")
|
||||
}
|
||||
}
|
||||
println c +" 校验完成"
|
||||
}else{
|
||||
println c+" 有空值"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def addDistrictprice(){
|
||||
InsertMonitorCalcCommandBatch insertBatch = new InsertMonitorCalcCommandBatch()
|
||||
def citys = CommonDatautils.findAllCity().reverse()
|
||||
def add = 0
|
||||
for(def c : citys){
|
||||
def districts = CommonDatautils.findAllDistricts(c, "district", ["city", "region", "name", "estate_type2"])
|
||||
for(def d : districts){
|
||||
def startObj = CommonDatautils.queryFirstOrLastDistrictPrice(c, d.region, d.name, 1)
|
||||
def endObj = CommonDatautils.queryFirstOrLastDistrictPrice(c, d.region, d.name, -1)
|
||||
if(startObj && endObj){
|
||||
def betweenDates = DateUtil.getWeekendBetweenDates(startObj.weekend, endObj.weekend);
|
||||
for(def weekend : betweenDates ){
|
||||
def price = CommonDatautils.queryDistrictPriceByWeekend(c, d.region, d.name, weekend)
|
||||
if(!price){
|
||||
add++
|
||||
insertBatch.saveDistrictCalcCommand(c, d.region, d.name, d.estate_type2, weekend, "fangjia-priceanalysis-0")
|
||||
println "[add] ${add} "+c+" "+d.region+" "+d.name+" "+DateUtil.formatByPattern(weekend, "yyyy-MM-dd")
|
||||
}
|
||||
}
|
||||
println c +" 校验完成"
|
||||
}else{
|
||||
println c+ " "+d.region+" "+d.name+" 无价格"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -36,8 +36,8 @@ class MinglujiData {
|
||||
// exportDatas(city)
|
||||
// matchDev(prov, city)
|
||||
// matchCommunity(city)
|
||||
// fiveLevelSplit(city)
|
||||
nineLevelSplit(city)
|
||||
fiveLevelSplit(city)
|
||||
// nineLevelSplit(city)
|
||||
// tempMatchDev(prov)
|
||||
|
||||
// checkDev()
|
||||
|
||||
Reference in New Issue
Block a user