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"; def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017";
DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName2("fangjia", "deal_price", lineUrl) 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){ for(def d : datas){
def map = new BasicDBObject() def map = new BasicDBObject()
map.city = "深圳" map.city = "深圳"
@@ -20,17 +51,15 @@ for(def d : datas){
map.region = d['B'] map.region = d['B']
def roomStr = d['E'] def roomStr = d['E']
if(roomStr){ if(roomStr){
def arrs = roomStr.split("-") map.room = roomStr.toString().toDouble().toInteger()
map.room = arrs[0].toString().toInteger()
map.hall = arrs[1].toString().toInteger()
map.toilet = arrs[3].toString().toInteger()
} }
map.area = d['F'].toString().toDouble() map.area = d['F'].toString().toDouble()
map.total_price = (int)(d['G'].toString().toDouble().toInteger()*10000) map.total_price = (int)(d['G'].toString().toDouble().toInteger()*10000)
map.avg_price = (int)(d['H'].toString().toDouble()*10000) map.avg_price = (int)(d['H'].toString().toDouble())
def trade_date = DateUtils.getRandomDate("2023-04-01", "2023-04-30") map.sell_price = (int)(d['I'].toString().toDouble()*10000)
map.trade_date = DateUtils.parseFromTightByPattern(trade_date, "yyyy-MM-dd") def trade_date = d['J']
map.trade_date = trade_date
map.source = "深房家族" map.source = "深房家族"
map.create_date = new Date() map.create_date = new Date()
map.m_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) { } catch (Exception e) {
e.printStackTrace() e.printStackTrace()
@@ -431,7 +431,7 @@ class CcbCommonUtils {
q.put("cat", cat); q.put("cat", cat);
q.put("city", city); q.put("city", city);
// q.put("c_date", new BasicDBObject('$lt', DateUtils.parseFromTightYYYYMMDD("2023-05-01")))//因5月1日新增过多,所以暂且先去掉 此批数据改为name_cat=13 // 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("name_cat", 0);
// q.put("estate_type2", new BasicDBObject('$in', ["普通住宅","商住"])) // q.put("estate_type2", new BasicDBObject('$in', ["普通住宅","商住"]))