行情小区价格填补
This commit is contained in:
+20
-6
@@ -25,7 +25,7 @@ class BigdataCitypriceBatch extends BaseBatch{
|
|||||||
|
|
||||||
public static final String[] TAGS = ["独栋", "联排", "叠加", "双拼", "花园面积", "泳池", "别墅", "带花园", "洋房", "叠拼", "独院", "联体", "微墅", "大平墅"];
|
public static final String[] TAGS = ["独栋", "联排", "叠加", "双拼", "花园面积", "泳池", "别墅", "带花园", "洋房", "叠拼", "独院", "联体", "微墅", "大平墅"];
|
||||||
|
|
||||||
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(80)
|
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(1)
|
||||||
|
|
||||||
static main(args) {
|
static main(args) {
|
||||||
runBatch(new BigdataCitypriceBatch(), args)
|
runBatch(new BigdataCitypriceBatch(), args)
|
||||||
@@ -33,7 +33,6 @@ class BigdataCitypriceBatch extends BaseBatch{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
void process(Object args) {
|
void process(Object args) {
|
||||||
//
|
|
||||||
def citys = ["杭州","宁波","温州","嘉兴","湖州","绍兴","金华","台州"]//CcbCommonUtils.getRunningCitys(args)
|
def citys = ["杭州","宁波","温州","嘉兴","湖州","绍兴","金华","台州"]//CcbCommonUtils.getRunningCitys(args)
|
||||||
def startDate = DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(new Date(),-1), "yyyyMMdd").toInteger();
|
def startDate = DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(new Date(),-1), "yyyyMMdd").toInteger();
|
||||||
def endDate = DateUtils.formatDateByPattern(DateUtils.getLastDayOfMonth(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 districtRun(citys, startDate, endDate, cityCodeDataMap){
|
||||||
def rets = []
|
def rets = []
|
||||||
def allDistricts = []
|
def allDistricts = []
|
||||||
|
def allPriceMap = [:]
|
||||||
|
def allRentMap = [:]
|
||||||
for(def city : citys) {
|
for(def city : citys) {
|
||||||
def districts = CcbCommonUtils.findAllDistrictByCity(city, "district", ["city", "region", "name", "lng","estate_type2","name_cat","address", "alias"]);
|
def districts = CcbCommonUtils.findAllDistrictByCity(city, "district", ["city", "region", "name", "lng","estate_type2","name_cat","address", "alias"]);
|
||||||
allDistricts.addAll(districts)
|
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){
|
if(cityLists){
|
||||||
rets.addAll(cityLists)
|
rets.addAll(cityLists)
|
||||||
}
|
}
|
||||||
@@ -133,7 +141,7 @@ class BigdataCitypriceBatch extends BaseBatch{
|
|||||||
println "BIGDATA_COMMPRICE 数据文件输出完成......"
|
println "BIGDATA_COMMPRICE 数据文件输出完成......"
|
||||||
}
|
}
|
||||||
|
|
||||||
def districtRunningByCity(districts, startDate, endDate, cityCodeDataMap){
|
def districtRunningByCity(districts, startDate, endDate, cityCodeDataMap, allPriceMap, allRentMap){
|
||||||
def totalCount = new AtomicLong()
|
def totalCount = new AtomicLong()
|
||||||
def distCount = districts.size()
|
def distCount = districts.size()
|
||||||
final CountDownLatch latch = new CountDownLatch(distCount)
|
final CountDownLatch latch = new CountDownLatch(distCount)
|
||||||
@@ -145,7 +153,7 @@ class BigdataCitypriceBatch extends BaseBatch{
|
|||||||
void run() {
|
void run() {
|
||||||
try {
|
try {
|
||||||
totalCount.addAndGet(1)
|
totalCount.addAndGet(1)
|
||||||
def row = createDistDate(dist, startDate, endDate, cityCodeDataMap)
|
def row = createDistDate(dist, startDate, endDate, cityCodeDataMap, allPriceMap, allRentMap)
|
||||||
if(row){
|
if(row){
|
||||||
rets << row
|
rets << row
|
||||||
println totalCount.get() +"/"+distCount + dist.city+" "+dist.region+" "+dist.name+" "+row[4]+" "+row[6]
|
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 sellDataType = 1
|
||||||
def rentDataType = 1
|
def rentDataType = 1
|
||||||
def sellMap = findHouses(dist.city, dist.region, "sell", startDate, endDate, dist.name, dist.alias, dist.estate_type2)
|
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
|
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) {
|
if (sell_avg_price || rent_avg_price) {
|
||||||
def row = []
|
def row = []
|
||||||
row << cityCodeDataMap.get(dist.city)
|
row << cityCodeDataMap.get(dist.city)
|
||||||
|
|||||||
Reference in New Issue
Block a user