update
This commit is contained in:
+91
-59
@@ -29,7 +29,7 @@ class PaimaiDataSend {
|
|||||||
def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017";
|
def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017";
|
||||||
DBCollection paimai43_COLL = MongoUtils.getCollectionByName2("fangjia_crawl", "pai_mai", lineUrl)
|
DBCollection paimai43_COLL = MongoUtils.getCollectionByName2("fangjia_crawl", "pai_mai", lineUrl)
|
||||||
|
|
||||||
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(30)
|
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(20)
|
||||||
|
|
||||||
static main(args) {
|
static main(args) {
|
||||||
def task = new PaimaiDataSend()
|
def task = new PaimaiDataSend()
|
||||||
@@ -198,9 +198,10 @@ class PaimaiDataSend {
|
|||||||
def index = 0
|
def index = 0
|
||||||
def q = new BasicDBObject()
|
def q = new BasicDBObject()
|
||||||
// q.put("city","宿迁")
|
// q.put("city","宿迁")
|
||||||
q.put("url","https://sf-item.taobao.com/sf_item/649014193736.htm")
|
q.put("url","https://sf-item.taobao.com/sf_item/665877683620.htm")
|
||||||
//https://sf-item.taobao.com/sf_item/657131607486.htm
|
//https://sf-item.taobao.com/sf_item/657131607486.htm
|
||||||
// q.put("parser_status", new BasicDBObject('$exists',false))
|
// q.put("parser_status", new BasicDBObject('$exists',false))
|
||||||
|
// q.put("finishDate", new BasicDBObject('$gte', DateUtils.parseFromTightYYYYMMDD("2022-09-01")))
|
||||||
def dbcursor = ali_fp_coll.find(q).batchSize(2000)
|
def dbcursor = ali_fp_coll.find(q).batchSize(2000)
|
||||||
|
|
||||||
def rets = []
|
def rets = []
|
||||||
@@ -263,10 +264,11 @@ class PaimaiDataSend {
|
|||||||
def aliZcRun2(){
|
def aliZcRun2(){
|
||||||
def index = 0
|
def index = 0
|
||||||
def q = new BasicDBObject()
|
def q = new BasicDBObject()
|
||||||
// q.put("city","宿迁")
|
q.put("city","苏州")
|
||||||
// q.put("region","姑苏")
|
// q.put("region","姑苏")
|
||||||
q.put("url","https://zc-item.taobao.com/auction/672615219601.htm")
|
// q.put("url","https://zc-item.taobao.com/auction/636884262340.htm")
|
||||||
def dbcursor = ali_zc_coll.find(q).batchSize(1000)
|
def dbcursor = ali_zc_coll.find(q).batchSize(1000)
|
||||||
|
def rets = []
|
||||||
for(def d : dbcursor){
|
for(def d : dbcursor){
|
||||||
index++
|
index++
|
||||||
println "ali-zc: "+index
|
println "ali-zc: "+index
|
||||||
@@ -290,19 +292,40 @@ class PaimaiDataSend {
|
|||||||
result.put("region", d.region)
|
result.put("region", d.region)
|
||||||
json.put("result", result)
|
json.put("result", result)
|
||||||
|
|
||||||
byte[] packedMsg = MessageUtils.pack(json)
|
rets << result
|
||||||
CommonUtils.sendMessage("result2parse2dev", packedMsg)
|
|
||||||
|
|
||||||
|
|
||||||
def udata = new BasicDBObject()
|
|
||||||
udata.put("parser_status", 4)
|
|
||||||
udata.put("m_date", new Date())
|
|
||||||
ali_zc_coll.update(new BasicDBObject("_id", d.get("_id")), new BasicDBObject('$set', udata))
|
|
||||||
}
|
}
|
||||||
|
println "共:"+rets.size()
|
||||||
|
|
||||||
|
def totalCount = new AtomicLong()
|
||||||
|
final CountDownLatch latch = new CountDownLatch(rets.size())
|
||||||
|
for(def i=0;i<rets.size();i++){
|
||||||
|
final def json = rets[i]
|
||||||
|
fixedThreadPool.execute(new Runnable() {
|
||||||
|
void run() {
|
||||||
|
try{
|
||||||
|
totalCount.addAndGet(1)
|
||||||
|
byte[] packedMsg = MessageUtils.pack(json)
|
||||||
|
CommonUtils.sendMessage("result2parse2dev", packedMsg)//result2parse2dev
|
||||||
|
|
||||||
|
def udata = new BasicDBObject()
|
||||||
|
udata.put("parser_status", 4)
|
||||||
|
udata.put("m_date", new Date())
|
||||||
|
ali_zc_coll.update(new BasicDBObject("_id", json.get("_id")), new BasicDBObject('$set', udata))
|
||||||
|
println "send: "+totalCount.get()
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace()
|
||||||
|
} finally {
|
||||||
|
latch.countDown()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
latch.await()
|
||||||
}
|
}
|
||||||
|
|
||||||
def paimaiSendToEs(){
|
def paimaiSendToEs(){
|
||||||
def rets = getPaimaiDatas()
|
def rets = getPaimaiDatas()
|
||||||
|
println "共:"+rets.size()
|
||||||
def totalCount = new AtomicLong()
|
def totalCount = new AtomicLong()
|
||||||
final CountDownLatch latch = new CountDownLatch(rets.size())
|
final CountDownLatch latch = new CountDownLatch(rets.size())
|
||||||
for(def i=0;i<rets.size();i++){
|
for(def i=0;i<rets.size();i++){
|
||||||
@@ -312,7 +335,7 @@ class PaimaiDataSend {
|
|||||||
try{
|
try{
|
||||||
totalCount.addAndGet(1)
|
totalCount.addAndGet(1)
|
||||||
def flag = FangjiaClientUtils.saveToEsPaimai(m)
|
def flag = FangjiaClientUtils.saveToEsPaimai(m)
|
||||||
println totalCount.get()+" "+m.city +" "+m.name +" "+flag
|
println totalCount.get()+" "+m.city +" "+m.title +" "+flag
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
} finally {
|
} finally {
|
||||||
@@ -326,56 +349,65 @@ class PaimaiDataSend {
|
|||||||
|
|
||||||
def getPaimaiDatas(){
|
def getPaimaiDatas(){
|
||||||
def q = new BasicDBObject()
|
def q = new BasicDBObject()
|
||||||
q.put("mDate", new BasicDBObject('$gte', DateUtils.parseFromTightYYYYMMDD("2022-08-01")))
|
q.put("mDate", new BasicDBObject('$gte', DateUtils.parseFromTightYYYYMMDD("2022-07-01")))
|
||||||
def dbcursor = paimai43_COLL.find(q).batchSize(1000)
|
def dbcursor = paimai43_COLL.find(q).batchSize(1000)
|
||||||
def rets = []
|
def rets = []
|
||||||
for(def d : dbcursor){
|
for(def d : dbcursor){
|
||||||
def o = [:]
|
if(d.city){
|
||||||
o.addPrice = d.addPrice
|
def o = [:]
|
||||||
o.agencyName = d.agencyName
|
o.addPrice = d.addPrice
|
||||||
o.area = d.area
|
o.agencyName = d.agencyName
|
||||||
o.buildYear = d.buildYear
|
o.area = d.area
|
||||||
o.callCount = d.callCount
|
o.buildYear = d.buildYear
|
||||||
o.city = d.city
|
o.callCount = d.callCount
|
||||||
o.court = d.court
|
o.city = d.city
|
||||||
o.delayCount = d.delayCount
|
o.court = d.court
|
||||||
o.delayWeekly = d.delayWeekly
|
o.delayCount = d.delayCount
|
||||||
o.depositPrice = d.depositPrice
|
o.delayWeekly = d.delayWeekly
|
||||||
o.enrollCount = d.enrollCount
|
o.depositPrice = d.depositPrice
|
||||||
o.estateType = d.estateType
|
o.enrollCount = d.enrollCount
|
||||||
o.evaluatePrice = d.evaluatePrice
|
o.estateType = d.estateType
|
||||||
o.finishDate = d.finishDate
|
o.evaluatePrice = d.evaluatePrice
|
||||||
o.height = d.height
|
o.finishDate = d.finishDate
|
||||||
o.houseNum = d.houseNum
|
o.height = d.height
|
||||||
o.id = d.id
|
o.houseNum = d.houseNum
|
||||||
o.introduce = d.introduce
|
o.id = d.id
|
||||||
|
o.introduce = d.introduce
|
||||||
// o.location = d.location
|
// o.location = d.location
|
||||||
o.lookCount = d.lookCount
|
o.lookCount = d.lookCount
|
||||||
o.marketPrice = d.marketPrice
|
o.marketPrice = d.marketPrice
|
||||||
o.matchAddress = d.matchAddress
|
o.matchAddress = d.matchAddress
|
||||||
o.matchCity = d.matchCity
|
o.matchCity = d.matchCity
|
||||||
o.matchName = d.matchName
|
o.matchName = d.matchName
|
||||||
o.matchRegion = d.matchRegion
|
o.matchRegion = d.matchRegion
|
||||||
o.person = d.person
|
o.person = d.person
|
||||||
o.preemptivePerson = d.preemptivePerson
|
o.preemptivePerson = d.preemptivePerson
|
||||||
o.pricePkWeekly = d.pricePkWeekly
|
o.pricePkWeekly = d.pricePkWeekly
|
||||||
o.province = d.province
|
o.province = d.province
|
||||||
o.rateDiscount = d.rateDiscount
|
o.rateDiscount = d.rateDiscount
|
||||||
o.region = d.region
|
o.region = d.region
|
||||||
o.roomNum = d.roomNum
|
o.roomNum = d.roomNum
|
||||||
o.sellOffAdvancePay = d.sellOffAdvancePay
|
o.sellOffAdvancePay = d.sellOffAdvancePay
|
||||||
o.source = d.source
|
o.source = d.source
|
||||||
o.stage = d.stage
|
o.stage = d.stage
|
||||||
o.startDate = d.startDate
|
o.startDate = d.startDate
|
||||||
o.startPrice = d.startPrice
|
o.startPrice = d.startPrice
|
||||||
o.status = d.status
|
o.status = d.status
|
||||||
o.tel = d.tel
|
o.tel = d.tel
|
||||||
o.title = d.title
|
o.title = d.title
|
||||||
o.tradePrice = d.tradePrice
|
o.tradePrice = d.tradePrice
|
||||||
o.type = d.type
|
o.type = d.type
|
||||||
o.unitNum = d.unitNum
|
o.unitNum = d.unitNum
|
||||||
o.url = d.url
|
o.url = d.url
|
||||||
rets << o
|
if(d.url.contains("taobao.com")){
|
||||||
|
o.source = "淘宝"
|
||||||
|
}else if(d.url.contains("jd.com")){
|
||||||
|
o.source = "京东"
|
||||||
|
}else if(d.url.contains("rmfysszc.gov.cn")){
|
||||||
|
o.source = "人民法院讼诉网"
|
||||||
|
}
|
||||||
|
rets << o
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return rets;
|
return rets;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user