加线程
This commit is contained in:
+15
-8
@@ -44,12 +44,17 @@ class DistrictHouseBatch extends BaseBatch {
|
|||||||
public void process(Object args) {
|
public void process(Object args) {
|
||||||
|
|
||||||
// DBObject q = new BasicDBObject();
|
// DBObject q = new BasicDBObject();
|
||||||
// q.put("_id", new ObjectId("6501174f6f5638447b264189"));
|
// q.put("cat", "sell");
|
||||||
// def obj = CommonDatautils.getHouseDataStoreConnection().findOne(q)
|
// q.put("city","常州")
|
||||||
// obj.put("c_date", new Date())
|
// q.put("district_name","清河苑一区")
|
||||||
// CommonDatautils.getHouseDataStoreConnection().save(obj)
|
// def dbcursor = CommonDatautils.getHouseDataStoreConnection().find(q)
|
||||||
|
// for(def obj : dbcursor){
|
||||||
|
// obj.put("c_date", new Date())
|
||||||
|
// CommonDatautils.getHouseDataStoreConnection().save(obj)
|
||||||
|
// }
|
||||||
|
|
||||||
// CommonDatautils.getHouseDataStoreConnection().find(new BasicDBObject("districtname_key","新城帝景南区_武进_常州")).each{
|
|
||||||
|
// CommonDatautils.getHouseDataStoreConnection().find(new BasicDBObject("districtname_key","清河苑一区_溧阳_常州")).each{
|
||||||
// println(it)
|
// println(it)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@@ -62,14 +67,15 @@ class DistrictHouseBatch extends BaseBatch {
|
|||||||
c++
|
c++
|
||||||
try {
|
try {
|
||||||
long sn = Long.parseLong("${new Date().format('yyyyMMddHHmmssSSS')}")
|
long sn = Long.parseLong("${new Date().format('yyyyMMddHHmmssSSS')}")
|
||||||
List<DBObject> districts = findDistrictByCity(city)
|
// List<DBObject> districts = findDistrictByCity(city)
|
||||||
|
def districts = CommonDatautils.findAllDistrictByCity(city, "district", ["city","region","name","alias"])
|
||||||
Map<String, Long> sellCountMap = facetDistrictInHouse("sell", city);
|
Map<String, Long> sellCountMap = facetDistrictInHouse("sell", city);
|
||||||
Map<String, Long> rentCountMap = facetDistrictInHouse("rent", city);
|
Map<String, Long> rentCountMap = facetDistrictInHouse("rent", city);
|
||||||
println c + "\t" + city + "\t" + "\tsn:" + sn + "\t" + districts.size() + "\t" + DateUtil.formatToTightYYYYMMDDhhmmss(new Date())
|
println c + "\t" + city + "\t" + "\tsn:" + sn + "\t" + districts.size() + "\t" + DateUtil.formatToTightYYYYMMDDhhmmss(new Date())
|
||||||
for(DBObject district : districts) {
|
for(DBObject district : districts) {
|
||||||
def names = []
|
def names = []
|
||||||
names << district.name
|
names << district.name
|
||||||
if(district.alias && districts.size()>0){
|
if(district.alias && districts.alias.size()>0){
|
||||||
for(def name : district.alias){
|
for(def name : district.alias){
|
||||||
if(!names.contains(name)){
|
if(!names.contains(name)){
|
||||||
names << name
|
names << name
|
||||||
@@ -93,6 +99,7 @@ class DistrictHouseBatch extends BaseBatch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
HOUSE_COLL.remove(new BasicDBObject("city", city).append('sn', new BasicDBObject('$ne', sn)))
|
HOUSE_COLL.remove(new BasicDBObject("city", city).append('sn', new BasicDBObject('$ne', sn)))
|
||||||
|
println c + " " + city
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -151,7 +158,7 @@ class DistrictHouseBatch extends BaseBatch {
|
|||||||
q.put('city', city)
|
q.put('city', city)
|
||||||
q.put('cat', 'district')
|
q.put('cat', 'district')
|
||||||
q.put('visible', 0)
|
q.put('visible', 0)
|
||||||
// q.put("name","新城帝景")
|
q.put("name","清河苑")
|
||||||
DSCursor cur = SEAWEED.find(q, fields).batchSize(2000)
|
DSCursor cur = SEAWEED.find(q, fields).batchSize(2000)
|
||||||
Iterator<DBObject> iter = cur.iterator()
|
Iterator<DBObject> iter = cur.iterator()
|
||||||
|
|
||||||
|
|||||||
+44
-6
@@ -1,5 +1,7 @@
|
|||||||
package com.fangjia.script.gj
|
package com.fangjia.script.gj
|
||||||
|
|
||||||
|
import com.fangjia.script.commData.CommonDatautils
|
||||||
|
import com.fangjia.script.temp.shenjian.poi.entity.Community
|
||||||
import com.fangjia.script.util.ExcelUtils
|
import com.fangjia.script.util.ExcelUtils
|
||||||
import com.fangjia.script.util.MongoUtils
|
import com.fangjia.script.util.MongoUtils
|
||||||
import com.mongodb.BasicDBObject
|
import com.mongodb.BasicDBObject
|
||||||
@@ -12,7 +14,41 @@ class CitySellStatTest {
|
|||||||
|
|
||||||
static main(args) {
|
static main(args) {
|
||||||
def task = new CitySellStatTest();
|
def task = new CitySellStatTest();
|
||||||
task.run()
|
// task.run()
|
||||||
|
task.cityPriceRun()
|
||||||
|
}
|
||||||
|
|
||||||
|
def cityPriceRun(){
|
||||||
|
def cityObjs = CommonDatautils.findCitys();
|
||||||
|
def rets = []
|
||||||
|
rets << ["序号","城市","城市级别","城市均价起始月","起始均价","城市均价最新月","最新均价"]
|
||||||
|
def index = 1
|
||||||
|
for(def o : cityObjs){
|
||||||
|
def ret = []
|
||||||
|
ret << index
|
||||||
|
ret << o.display
|
||||||
|
ret << o.new_city_grade
|
||||||
|
def row1 = findCityMonthPrice(o.display, 1)
|
||||||
|
if(row1){
|
||||||
|
ret << row1.date
|
||||||
|
ret << row1.avg_price
|
||||||
|
}else{
|
||||||
|
ret << ""
|
||||||
|
ret << ""
|
||||||
|
}
|
||||||
|
def row2 = findCityMonthPrice(o.display, -1)
|
||||||
|
if(row2){
|
||||||
|
ret << row2.date
|
||||||
|
ret << row2.avg_price
|
||||||
|
}else{
|
||||||
|
ret << ""
|
||||||
|
ret << ""
|
||||||
|
}
|
||||||
|
rets << ret
|
||||||
|
index++
|
||||||
|
}
|
||||||
|
|
||||||
|
ExcelUtils.write("D:\\数据\\其它\\全国城市均价.xlsx", rets, "城市均价")
|
||||||
}
|
}
|
||||||
|
|
||||||
def run(){
|
def run(){
|
||||||
@@ -25,18 +61,20 @@ class CitySellStatTest {
|
|||||||
},0)
|
},0)
|
||||||
}
|
}
|
||||||
|
|
||||||
def findFirstMonth(def city){
|
def findCityMonthPrice(def city, def asc){
|
||||||
def q = new BasicDBObject();
|
def q = new BasicDBObject();
|
||||||
q.put("city", city)
|
q.put("city", city)
|
||||||
def dbcursor = CITY_STAT_COLL.find(q).sort(new BasicDBObject("_id",1)).limit(1)
|
def dbcursor = CITY_STAT_COLL.find(q).sort(new BasicDBObject("date", asc)).limit(1)
|
||||||
def month;
|
def obj = null
|
||||||
for(def o : dbcursor){
|
for(def o : dbcursor){
|
||||||
month = o.date
|
obj = o
|
||||||
}
|
}
|
||||||
return month
|
return obj
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def findTotalMonth(def city, def month){
|
def findTotalMonth(def city, def month){
|
||||||
def q = new BasicDBObject();
|
def q = new BasicDBObject();
|
||||||
q.put("city", city)
|
q.put("city", city)
|
||||||
|
|||||||
+5
@@ -200,4 +200,9 @@ public class SignatureUtils {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args){
|
||||||
|
def a = getAliAddressStrc("上海市长宁区新泾三村")
|
||||||
|
println a
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -21,7 +21,7 @@ import java.util.concurrent.atomic.AtomicLong
|
|||||||
class SuggestionDataSynch extends BaseBatch{
|
class SuggestionDataSynch extends BaseBatch{
|
||||||
|
|
||||||
static def targetUrl = "http://192.168.0.12:9200/seaweed/"
|
static def targetUrl = "http://192.168.0.12:9200/seaweed/"
|
||||||
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(50)
|
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(100)
|
||||||
|
|
||||||
def MONGO100_URL = "mongodb://admin:G00MONGOADMIN@192.168.0.100:30009";
|
def MONGO100_URL = "mongodb://admin:G00MONGOADMIN@192.168.0.100:30009";
|
||||||
DBCollection SEAWEED_CONN = MongoUtils.getCollectionByName2("fangjia", "seaweed", MONGO100_URL)
|
DBCollection SEAWEED_CONN = MongoUtils.getCollectionByName2("fangjia", "seaweed", MONGO100_URL)
|
||||||
|
|||||||
Reference in New Issue
Block a user