行情小区价格填补

This commit is contained in:
2022-11-15 15:21:50 +08:00
parent 7b879c11df
commit 383395581e
@@ -25,7 +25,7 @@ class BigdataCitypriceBatch extends BaseBatch{
public static final String[] TAGS = ["独栋", "联排", "叠加", "双拼", "花园面积", "泳池", "别墅", "带花园", "洋房", "叠拼", "独院", "联体", "微墅", "大平墅"];
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(80)
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(1)
static main(args) {
runBatch(new BigdataCitypriceBatch(), args)
@@ -33,7 +33,6 @@ class BigdataCitypriceBatch extends BaseBatch{
@Override
void process(Object args) {
//
def citys = ["杭州","宁波","温州","嘉兴","湖州","绍兴","金华","台州"]//CcbCommonUtils.getRunningCitys(args)
def startDate = DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(new Date(),-1), "yyyyMMdd").toInteger();
def endDate = DateUtils.formatDateByPattern(DateUtils.getLastDayOfMonth(new Date(),-1), "yyyyMMdd").toInteger();
@@ -114,12 +113,21 @@ class BigdataCitypriceBatch extends BaseBatch{
def districtRun(citys, startDate, endDate, cityCodeDataMap){
def rets = []
def allDistricts = []
def allPriceMap = [:]
def allRentMap = [:]
for(def city : citys) {
def districts = CcbCommonUtils.findAllDistrictByCity(city, "district", ["city", "region", "name", "lng","estate_type2","name_cat","address", "alias"]);
allDistricts.addAll(districts)
def priceMap = CommonDatautils.queryDistrictStatByDate(city, startDate, endDate)
allPriceMap = allPriceMap + priceMap
def rentMap = CommonDatautils.findSqmetreRentByCityAndDate(city, endDate)
allRentMap = allRentMap + rentMap
}
def cityLists = districtRunningByCity(allDistricts, startDate, endDate, cityCodeDataMap)
def cityLists = districtRunningByCity(allDistricts, startDate, endDate, cityCodeDataMap, allPriceMap, allRentMap)
if(cityLists){
rets.addAll(cityLists)
}
@@ -133,7 +141,7 @@ class BigdataCitypriceBatch extends BaseBatch{
println "BIGDATA_COMMPRICE 数据文件输出完成......"
}
def districtRunningByCity(districts, startDate, endDate, cityCodeDataMap){
def districtRunningByCity(districts, startDate, endDate, cityCodeDataMap, allPriceMap, allRentMap){
def totalCount = new AtomicLong()
def distCount = districts.size()
final CountDownLatch latch = new CountDownLatch(distCount)
@@ -145,7 +153,7 @@ class BigdataCitypriceBatch extends BaseBatch{
void run() {
try {
totalCount.addAndGet(1)
def row = createDistDate(dist, startDate, endDate, cityCodeDataMap)
def row = createDistDate(dist, startDate, endDate, cityCodeDataMap, allPriceMap, allRentMap)
if(row){
rets << row
println totalCount.get() +"/"+distCount + dist.city+" "+dist.region+" "+dist.name+" "+row[4]+" "+row[6]
@@ -163,7 +171,7 @@ class BigdataCitypriceBatch extends BaseBatch{
}
def createDistDate(dist, startDate, endDate, cityCodeDataMap){
def createDistDate(dist, startDate, endDate, cityCodeDataMap, allPriceMap, allRentMap){
def sellDataType = 1
def rentDataType = 1
def sellMap = findHouses(dist.city, dist.region, "sell", startDate, endDate, dist.name, dist.alias, dist.estate_type2)
@@ -221,6 +229,12 @@ class BigdataCitypriceBatch extends BaseBatch{
rentDataType = null
}
}
if(!sell_avg_price){
sell_avg_price = allPriceMap.get(dist.city +"##"+ dist.region +"##"+ dist.name)
}
if(!rent_avg_price){
rent_avg_price = allRentMap.get(dist.city +"##"+ dist.region +"##"+ dist.name)
}
if (sell_avg_price || rent_avg_price) {
def row = []
row << cityCodeDataMap.get(dist.city)