添加样本同步脚本
This commit is contained in:
+51
@@ -0,0 +1,51 @@
|
||||
package com.fangjia.script.sync
|
||||
|
||||
import com.fangjia.core.util.DateUtil
|
||||
import com.fangjia.script.BaseBatch
|
||||
import com.fangjia.script.BatchOwner
|
||||
import com.fangjia.script.Watcher
|
||||
import com.fangjia.script.util.CommonUtils
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.fangjia.script.util.ElasticUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
|
||||
/**
|
||||
* ¹¦ÄÜ˵Ã÷:
|
||||
*/
|
||||
@BatchOwner(Watcher.WangWenYan)
|
||||
class Seawater2SeabirdSyncBatchBatch extends BaseBatch {
|
||||
|
||||
|
||||
static void main(String[] args) {
|
||||
runBatch(new Seawater2SeabirdSyncBatchBatch(), args)
|
||||
}
|
||||
|
||||
@Override
|
||||
void process(Object args) {
|
||||
|
||||
CommonUtils.findAllCity().each { city ->
|
||||
ElasticUtils.executeSqlQuery("select * from latest_seawater where city = '${city}' and cat = 'sell' and p_date > 20250601",{Map house->
|
||||
def seabird = new BasicDBObject()
|
||||
seabird.put("city", city)
|
||||
seabird.put("cat", house.cat)
|
||||
seabird.put("region", house.region)
|
||||
seabird.put("name", house.name)
|
||||
seabird.put("address", house.address)
|
||||
seabird.put("district_name", house.district_name)
|
||||
seabird.put("total_price", house.total_price)
|
||||
seabird.put("area", house.area)
|
||||
seabird.put("height", house.height)
|
||||
seabird.put("fitment", house.fitment)
|
||||
seabird.put("hall", house.hall)
|
||||
seabird.put("room", house.room)
|
||||
seabird.put("toilet", house.toilet)
|
||||
seabird.put("floor", house.floor)
|
||||
seabird.put("url", house.url)
|
||||
seabird.put("direction", house.direction)
|
||||
seabird.put("status", 0)
|
||||
seabird.put("publish_date", DateUtil.parseDate(house.p_date.toString(), "yyyyMMdd"))
|
||||
DbUtils.seabird.save(seabird)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user