This commit is contained in:
2023-05-19 15:52:57 +08:00
parent b762564565
commit eefd91aa7c
3 changed files with 39 additions and 10 deletions
@@ -9,10 +9,41 @@ import com.mongodb.DBCollection
/**
* 深圳公众号成交数据录入
*/
def datas = ExcelUtils.read("D:\\数据\\建行\\房产估值\\成交\\3月坪山龙华盐田罗湖龙岗成交数据.xls", 0, 1)
def datas = ExcelUtils.read("D:\\数据\\建行\\房产估值\\成交\\深圳4月份二手房成交数据汇总.xls", 0, 1)
def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017";
DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName2("fangjia", "deal_price", lineUrl)
//没有成交时间,随机生成
//for(def d : datas){
// def map = new BasicDBObject()
// map.city = "深圳"
// map.district_name = d['D']
// map.region = d['B']
// def roomStr = d['E']
// if(roomStr){
// def arrs = roomStr.split("-")
// try{
// map.room = arrs[0].toString().toInteger()
// }catch(Exception e){
// println "room error"
// }
// map.hall = arrs[1].toString().toInteger()
// map.toilet = arrs[3].toString().toInteger()
// }
//
// map.area = d['F'].toString().toDouble()
// map.total_price = (int)(d['G'].toString().toDouble().toInteger()*10000)
// map.avg_price = (int)(d['H'].toString().toDouble()*10000)
// def trade_date = DateUtils.getRandomDate("2023-04-01", "2023-04-30")
// map.trade_date = DateUtils.parseFromTightByPattern(trade_date, "yyyy-MM-dd")
// map.source = "深房家族"
// map.create_date = new Date()
// map.m_date = new Date()
// DEAL_PRICE_COLL.save(map)
//}
for(def d : datas){
def map = new BasicDBObject()
map.city = "深圳"
@@ -20,17 +51,15 @@ for(def d : datas){
map.region = d['B']
def roomStr = d['E']
if(roomStr){
def arrs = roomStr.split("-")
map.room = arrs[0].toString().toInteger()
map.hall = arrs[1].toString().toInteger()
map.toilet = arrs[3].toString().toInteger()
map.room = roomStr.toString().toDouble().toInteger()
}
map.area = d['F'].toString().toDouble()
map.total_price = (int)(d['G'].toString().toDouble().toInteger()*10000)
map.avg_price = (int)(d['H'].toString().toDouble()*10000)
def trade_date = DateUtils.getRandomDate("2023-04-01", "2023-04-30")
map.trade_date = DateUtils.parseFromTightByPattern(trade_date, "yyyy-MM-dd")
map.avg_price = (int)(d['H'].toString().toDouble())
map.sell_price = (int)(d['I'].toString().toDouble()*10000)
def trade_date = d['J']
map.trade_date = trade_date
map.source = "深房家族"
map.create_date = new Date()
map.m_date = new Date()
@@ -203,7 +203,7 @@ class BigdataForsaleBatch extends BaseBatch{
}
}
println totalCount.get() +" "+city+" "+rMap.region+" "+rMap.name+" size:"+ret.size()+" "+new Date().toLocaleString()
println totalCount.get() +" "+city+" "+rMap.region+" "+rMap.name+" 原始:"+ret.size()+" 过滤后:"+retMap.size()
} catch (Exception e) {
e.printStackTrace()
@@ -431,7 +431,7 @@ class CcbCommonUtils {
q.put("cat", cat);
q.put("city", city);
// q.put("c_date", new BasicDBObject('$lt', DateUtils.parseFromTightYYYYMMDD("2023-05-01")))//因5月1日新增过多,所以暂且先去掉 此批数据改为name_cat=13
// q.put("name","锦南浦三小区")
// q.put("name","金地玺湾")
// q.put("name_cat", 0);
// q.put("estate_type2", new BasicDBObject('$in', ["普通住宅","商住"]))