Merge branch 'script_gj' into 'master'

无定基,无环比,无同比,不算不同面积指数

See merge request !967
This commit is contained in:
2024-09-29 16:47:07 +08:00
@@ -28,10 +28,11 @@ import java.util.concurrent.atomic.AtomicLong
@BatchOwner(Watcher.GaoJuan) @BatchOwner(Watcher.GaoJuan)
class ImportIndexStats extends BaseBatch{ class ImportIndexStats extends BaseBatch{
public static final def mongoDbUrl = "mongodb://developer:G00IDCDEV12385@mongo.db.fangjia.com:28017";
//public final static DBCollection under_line = new Mongo("192.168.0.136", 27017).getDB('fangjia').getCollection('stats_index'); //public final static DBCollection under_line = new Mongo("192.168.0.136", 27017).getDB('fangjia').getCollection('stats_index');
public static final DBCollection on_line = MongoUtils.getCollectionByName("fangjia", "stats_index", "mongo.db.fangjia.com") public static final DBCollection on_line = MongoUtils.getCollectionByName("fangjia", "stats_index", "mongo.db.fangjia.com")
public static final DBCollection STATS_INDEX_COLL = MongoUtils.getCollectionByName("fangjia_stat", "stats_index", "mongo.db.fangjia.com") public static final DBCollection STATS_INDEX_COLL = MongoUtils.getCollectionByName("fangjia_stat", "stats_index", "mongo.db.fangjia.com")
public static final DBCollection REGION_STAT_COLL = MongoUtils.getCollectionByName("fangjia", "region_stat", "mongo.db.fangjia.com") public static final DBCollection REGION_STAT_COLL = MongoUtils.getCollectionByName2("fangjia", "region_stat", mongoDbUrl)
final DBCollection indices_price_house_sellColl = MongoUtils.getCollectionByName("crawl", "indices_price_house_sell", "192.168.0.206", 27020) final DBCollection indices_price_house_sellColl = MongoUtils.getCollectionByName("crawl", "indices_price_house_sell", "192.168.0.206", 27020)
final DBCollection indices_price_house_sell_typeColl = MongoUtils.getCollectionByName("crawl", "indices_price_house_sell_type", "192.168.0.206", 27020) final DBCollection indices_price_house_sell_typeColl = MongoUtils.getCollectionByName("crawl", "indices_price_house_sell_type", "192.168.0.206", 27020)
@@ -39,7 +40,7 @@ class ImportIndexStats extends BaseBatch{
final DBCollection indices_price_house_newColl = MongoUtils.getCollectionByName("crawl", "indices_price_house_new", "192.168.0.206", 27020) final DBCollection indices_price_house_newColl = MongoUtils.getCollectionByName("crawl", "indices_price_house_new", "192.168.0.206", 27020)
final DBCollection indices_price_house_new_typeColl = MongoUtils.getCollectionByName("crawl", "indices_price_house_new_type", "192.168.0.206", 27020) final DBCollection indices_price_house_new_typeColl = MongoUtils.getCollectionByName("crawl", "indices_price_house_new_type", "192.168.0.206", 27020)
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(10) public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(50)
//DSCollection seawater = new DataStore("192.168.0.65", 27777).getCollection("fangjia.seawater") //DSCollection seawater = new DataStore("192.168.0.65", 27777).getCollection("fangjia.seawater")
private static def cityList=["北京", "天津", "石家庄", "太原", "呼和浩特", "沈阳", "大连", "长春", "哈尔滨", "上海", "南京", "杭州", "宁波", "合肥", "福州", "厦门", private static def cityList=["北京", "天津", "石家庄", "太原", "呼和浩特", "沈阳", "大连", "长春", "哈尔滨", "上海", "南京", "杭州", "宁波", "合肥", "福州", "厦门",
@@ -106,7 +107,7 @@ class ImportIndexStats extends BaseBatch{
//计算统计局没有发布的城市的价格指数 //计算统计局没有发布的城市的价格指数
def calculatePriceIndex(def year, def month, def date){ def calculatePriceIndex(def year, def month, def date){
def citys =CommonDatautils.findAllCity(); def citys = ["三沙"]//CommonDatautils.findAllCity();
// def date = createDateString(year, month, 0, ""); // def date = createDateString(year, month, 0, "");
def haveIndexCitys = findPriceIndexCitys(date.toInteger()); def haveIndexCitys = findPriceIndexCitys(date.toInteger());
@@ -144,26 +145,28 @@ class ImportIndexStats extends BaseBatch{
} }
}); });
} }
latch.await(5, TimeUnit.MINUTES); latch.await(2, TimeUnit.MINUTES);
} }
def calculating(city, year, month, date){ def calculating(city, year, month, date){
def result = [:]; def result = [:];
calculateAvgPriceIndex(city, year, month, result); calculateAvgPriceIndex(city, year, month, result);
calculateAreaPriceInfex(result, city, year, month, 90);//0-90
calculateAreaPriceInfex(result, city, year, month, 144);//90-144
calculateAreaPriceInfex(result, city, year, month, 1000);//144-1000
checkPriceIndex(result);//涨跌幅控制
if(result){ if(result){
result.city = city; calculateAreaPriceInfex(result, city, year, month, 90);//0-90
result.yearmonth = date.toInteger(); calculateAreaPriceInfex(result, city, year, month, 144);//90-144
result.source = 2; calculateAreaPriceInfex(result, city, year, month, 1000);//144-1000
result.remark = "均价计算";
result.cat = "district"; checkPriceIndex(result);//涨跌幅控制
result.type = "城市" if(result){
savePriceIndex(result); result.city = city;
result.yearmonth = date.toInteger();
result.source = 2;
result.remark = "均价计算";
result.cat = "district";
result.type = "城市"
savePriceIndex(result);
}
} }
return result return result
} }
@@ -526,8 +529,7 @@ class ImportIndexStats extends BaseBatch{
def findCityByDates(def city, def startDate, def endDate){ def findCityByDates(def city, def startDate, def endDate){
DBObject q = new BasicDBObject() DBObject q = new BasicDBObject()
q.put("city", city); q.put("city", city);
q.put("region", null); q.put("cat", "城市")
q.put("block", null);
if(startDate && endDate){ if(startDate && endDate){
q.put('weekend', new BasicDBObject('$gte', DateUtils.parseFromTightYYYYMMDD(startDate)).append('$lte', DateUtils.parseFromTightYYYYMMDD(endDate))); q.put('weekend', new BasicDBObject('$gte', DateUtils.parseFromTightYYYYMMDD(startDate)).append('$lte', DateUtils.parseFromTightYYYYMMDD(endDate)));
} }