diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ronghe/BigdataCitypriceBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ronghe/BigdataCitypriceBatch.groovy index 479813af4..cbb308586 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ronghe/BigdataCitypriceBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ronghe/BigdataCitypriceBatch.groovy @@ -133,26 +133,27 @@ class BigdataCitypriceBatch extends BaseBatch{ def size = regionDatas.size() final CountDownLatch latch = new CountDownLatch(size) def totalCount = new AtomicLong() + for(def i = 0;i3){ - sell_avg_price = avgValue(sellMap.avg_price) + if(sellMap){ sell_avg_area = avgValue(sellMap.area) - sell_avg_total = avgValue(sellMap.total_price) - }else{ - sell_count = 0 - sellDataType = null + sell_avg_total = sell_avg_area*sell_avg_price//avgValue(sellMap.total_price) +// if(sell_count>3){ +// if(allCcbPriceMap.containsKey(dist._id.toString())){ +// sell_avg_price = allCcbPriceMap.get(dist._id.toString())//avgValue(sellMap.avg_price) +// sell_avg_area = avgValue(sellMap.area) +// sell_avg_total = sell_avg_area*sell_avg_price//avgValue(sellMap.total_price) +// sell_count = allCcbPriceCaseCountMap.get(dist._id.toString()) +// }else{ +// sell_count = 0 +// sellDataType = null +// } +// }else{ +// sell_count = 0 +// sellDataType = null +// } } } + def rent_avg_price = null def rent_avg_area = null def rent_avg_total = null @@ -381,6 +412,8 @@ class BigdataCitypriceBatch extends BaseBatch{ rentDataType = null } } + + //三个月,半年都没有数据时,用房价网价格,这块是否改为 建行价格 if(!sell_avg_price){ sell_avg_price = allPriceMap.get(dist.city +"##"+ dist.region +"##"+ dist.name) } @@ -620,6 +653,15 @@ class BigdataCitypriceBatch extends BaseBatch{ def sell_avg_area = null def sell_avg_total = null def sellStartDate = null + + def avgPrice = null + if(region){ + avgPrice = findCcbRegionPriceByRegion(cityCodeDataMap.get(city), regionCodeDataMap.district_code,startDate.toString().substring(0,6)) + }else{ + avgPrice = findCcbCityPrice(cityCodeDataMap.get(city), startDate.toString().substring(0,6)) + } + + if (sell_count < 10) { sellDataType = 3 sellStartDate = DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(new Date(), -3), "yyyyMMdd").toInteger(); @@ -633,7 +675,7 @@ class BigdataCitypriceBatch extends BaseBatch{ sellStartDate = startDate } if (sell_count) { - sell_avg_price = findHouseAvgByType(city, region, "sell", sellStartDate, endDate,"avg_price") + sell_avg_price = avgPrice//findHouseAvgByType(city, region, "sell", sellStartDate, endDate,"avg_price") sell_avg_area = findHouseAvgByType(city, region, "sell", sellStartDate, endDate,"area") sell_avg_total = findHouseAvgByType(city, region, "sell", sellStartDate, endDate, "total_price") } @@ -1001,6 +1043,26 @@ class BigdataCitypriceBatch extends BaseBatch{ return datas; } + def findCommunityPriceByCityMap(cityCode, month){ + def sql = "select gujia_admndiv_nm,gujia_bds_id,gujia_bds_clc_avprc from t_app_p9pha_plda.avm_community_base_price_gj_h where urbn_id='${cityCode}' and gujiabds_clc_yrmo_val=${month}"; + def dataMap = [:] + pgsqlInstance.eachRow(sql, { r -> + dataMap.put(r.gujia_bds_id, r.gujia_bds_clc_avprc) + }) + return dataMap; + } + + def findCommunityPriceCountByCityMap(cityCode, month){ + def sql = "SELECT gujia_comm_id,gujiabdsrt3mlgcasenum from t_app_p9pha_plda.avm_community_p_describe_gj_h WHERE urbn_id='${cityCode}' and gujia_bds_mo_val=${month}"; + def dataMap = [:] + pgsqlInstance.eachRow(sql, { r -> + if(r.gujiabdsrt3mlgcasenum){ + dataMap.put(r.gujia_comm_id, r.gujiabdsrt3mlgcasenum) + } + }) + return dataMap; + } + def findCcbCityPrice(cityCode, month){ def sql = "SELECT gujia_bds_clc_avprc from t_app_p9pha_plda.avm_city_price_gj_h where urbn_id='${cityCode}' and gujiabds_clc_yrmo_val=${month}"; def avgPrice = null @@ -1021,6 +1083,15 @@ class BigdataCitypriceBatch extends BaseBatch{ return regionPriceMap; } + def findCcbRegionPriceByRegion(cityCode, regionCode, month){ + def sql = "SELECT gujia_bds_clc_avprc from t_app_p9pha_plda.avm_district_price_gj_h where gujiabds_clc_yrmo_val=${month} and gujia_admndiv_id='${regionCode}' and urbn_id='${cityCode}'"; + def price = null + pgsqlInstance.eachRow(sql, { r -> + price = r.gujia_bds_clc_avprc + }) + return price; + } + def districtCityPrictRate(cityPrice, datas){ def distCityRateMap = [:]