update
This commit is contained in:
+38
-21
@@ -63,7 +63,7 @@ class BigdataDealBatch extends BaseBatch{
|
|||||||
curDate = args[1].toString().toInteger()
|
curDate = args[1].toString().toInteger()
|
||||||
}
|
}
|
||||||
|
|
||||||
println "curDate:"+curDate
|
// println "curDate:"+curDate
|
||||||
// for(def city : citys){
|
// for(def city : citys){
|
||||||
//// if(!ccbCitys.contains(city)){
|
//// if(!ccbCitys.contains(city)){
|
||||||
// addDealPriceMatch(city);
|
// addDealPriceMatch(city);
|
||||||
@@ -87,16 +87,16 @@ class BigdataDealBatch extends BaseBatch{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def trades = getCityData(city, statMap, ppeDists)
|
// def trades = getCityData(city, statMap, ppeDists)
|
||||||
if(trades){
|
// if(trades){
|
||||||
def rets = createData(trades, cityCodeDataMap, distCodeMap, "other")
|
// def rets = createData(trades, cityCodeDataMap, distCodeMap, "other")
|
||||||
rows.addAll(rets)
|
// rows.addAll(rets)
|
||||||
println "【${index}】"+city +" 成交共:"+rets.size()
|
// println "【${index}】"+city +" 成交共:"+rets.size()
|
||||||
|
//
|
||||||
def cityDatas = []
|
// def cityDatas = []
|
||||||
cityDatas << headers
|
// cityDatas << headers
|
||||||
cityDatas.addAll(rows)
|
// cityDatas.addAll(rows)
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ class BigdataDealBatch extends BaseBatch{
|
|||||||
fileName = "d:\\数据\\建行\\房产估值\\数据文件\\txt\\BIGDATA_DEAL_GJ.dat"
|
fileName = "d:\\数据\\建行\\房产估值\\数据文件\\txt\\BIGDATA_DEAL_GJ.dat"
|
||||||
}
|
}
|
||||||
|
|
||||||
FileUtils.batchCreateFile(rows, fileName,headers, "utf-8", true);
|
FileUtils.batchCreateFile(rows, fileName,headers, "utf-8", false);
|
||||||
println "txt 生成 " + rows.size()
|
println "txt 生成 " + rows.size()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,9 +114,11 @@ class BigdataDealBatch extends BaseBatch{
|
|||||||
def totalCount = new AtomicLong()
|
def totalCount = new AtomicLong()
|
||||||
final CountDownLatch latch = new CountDownLatch(rets.size())
|
final CountDownLatch latch = new CountDownLatch(rets.size())
|
||||||
|
|
||||||
def lianjiaPriceMap = findThirdPartyPrice("上海")
|
// def lianjiaPriceMap = findThirdPartyPrice("上海")
|
||||||
def startDate = DateUtils.parseFromTightByPattern(DateUtils.addMonth(new Date(),-2),'yyyy-MM-dd')
|
// def startDate = DateUtils.parseFromTightByPattern(DateUtils.addMonth(new Date(),-2),'yyyy-MM-dd')
|
||||||
// def lianjiaPriceMap = getDistrictStatByCity("上海", startDate)
|
// def lianjiaPriceMap = getDistrictStatByCity("上海", startDate)
|
||||||
|
|
||||||
|
def ccbPriceMap = getCommunityPrices("上海")
|
||||||
for(def i=0;i<rets.size();i++){
|
for(def i=0;i<rets.size();i++){
|
||||||
final def trade = rets[i]
|
final def trade = rets[i]
|
||||||
fixedThreadPool.execute(new Runnable() {
|
fixedThreadPool.execute(new Runnable() {
|
||||||
@@ -125,7 +127,7 @@ class BigdataDealBatch extends BaseBatch{
|
|||||||
totalCount.addAndGet(1)
|
totalCount.addAndGet(1)
|
||||||
if(source == "youda"){
|
if(source == "youda"){
|
||||||
|
|
||||||
def ret = converYouDaData(trade, cityCodeDatas, distCodeMap, lianjiaPriceMap)
|
def ret = converYouDaData(trade, cityCodeDatas, distCodeMap, ccbPriceMap)
|
||||||
if(ret){
|
if(ret){
|
||||||
result << ret
|
result << ret
|
||||||
println totalCount.get() +" "+trade.city+" "+trade.region+" "+trade.fjName+" "+new Date().toLocaleString()
|
println totalCount.get() +" "+trade.city+" "+trade.region+" "+trade.fjName+" "+new Date().toLocaleString()
|
||||||
@@ -151,6 +153,21 @@ class BigdataDealBatch extends BaseBatch{
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def getCommunityPrices(def city){
|
||||||
|
def sql = "select commid, avg_price from community_base_price_gj where year_month=${endDate} and cityname='${city}'";
|
||||||
|
def map = [:]
|
||||||
|
try{
|
||||||
|
sqlInstance.eachRow(sql,{
|
||||||
|
map.put(it.commid, it.avg_price)
|
||||||
|
});
|
||||||
|
}catch(Exception e){
|
||||||
|
getPpeGTE15Datas(city)
|
||||||
|
}
|
||||||
|
|
||||||
|
return map
|
||||||
|
}
|
||||||
|
|
||||||
def findThirdPartyPrice(def city) {
|
def findThirdPartyPrice(def city) {
|
||||||
def q = new BasicDBObject()
|
def q = new BasicDBObject()
|
||||||
q.put("city", city)
|
q.put("city", city)
|
||||||
@@ -174,13 +191,13 @@ class BigdataDealBatch extends BaseBatch{
|
|||||||
return map
|
return map
|
||||||
}
|
}
|
||||||
|
|
||||||
def converYouDaData(def trade, def cityCodeDatas, def distCodeMap, def lianjiaPriceMap){
|
def converYouDaData(def trade, def cityCodeDatas, def distCodeMap, def ccbPriceMap){
|
||||||
def ret = []
|
def ret = []
|
||||||
def obj = CcbCommonUtils.findDistrict(trade.fjCity, trade.fjRegion, trade.fjName, "district")
|
def obj = CcbCommonUtils.findDistrict(trade.fjCity, trade.fjRegion, trade.fjName, "district")
|
||||||
if(!obj){
|
if(!obj){
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
def price = lianjiaPriceMap.get(obj.region+"##"+obj.name)
|
def price = ccbPriceMap.get(obj._id.toString())
|
||||||
if(price){
|
if(price){
|
||||||
def mod = java.lang.Math.abs((trade.price-price)*100/price)
|
def mod = java.lang.Math.abs((trade.price-price)*100/price)
|
||||||
if(mod<=10){
|
if(mod<=10){
|
||||||
@@ -617,10 +634,10 @@ class BigdataDealBatch extends BaseBatch{
|
|||||||
|
|
||||||
|
|
||||||
def addDealPriceMatch(city){
|
def addDealPriceMatch(city){
|
||||||
// def startDate = DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightByPattern(curDate.toString(), "yyyyMMdd"))
|
def startDate = DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightByPattern(curDate.toString(), "yyyyMMdd"))
|
||||||
// def endDate = DateUtils.getLastDayOfMonth(DateUtils.parseFromTightByPattern(curDate.toString(), "yyyyMMdd"))
|
def endDate = DateUtils.getLastDayOfMonth(DateUtils.parseFromTightByPattern(curDate.toString(), "yyyyMMdd"))
|
||||||
def startDate = DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightByPattern("20210101", "yyyyMMdd"))
|
// def startDate = DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightByPattern("20210101", "yyyyMMdd"))
|
||||||
def endDate = DateUtils.getLastDayOfMonth(DateUtils.parseFromTightByPattern("20221001", "yyyyMMdd"))
|
// def endDate = DateUtils.getLastDayOfMonth(DateUtils.parseFromTightByPattern("20221001", "yyyyMMdd"))
|
||||||
def trades = CcbCommonUtils.findTradesByMonth(city, startDate, endDate)
|
def trades = CcbCommonUtils.findTradesByMonth(city, startDate, endDate)
|
||||||
|
|
||||||
final CountDownLatch latch = new CountDownLatch(trades.size())
|
final CountDownLatch latch = new CountDownLatch(trades.size())
|
||||||
|
|||||||
Reference in New Issue
Block a user