Merge branch 'script_gj' of http://gitlab.fangjia.com/dev0/main into script_gj
This commit is contained in:
+76
-2
@@ -758,7 +758,10 @@ class CommonDatautils {
|
||||
|
||||
DBObject q = new BasicDBObject();
|
||||
q.put("city", city);
|
||||
q.put("region", region);
|
||||
if(region){
|
||||
q.put("region", region);
|
||||
}
|
||||
|
||||
q.put("name", name);
|
||||
q.put("cat", cat)
|
||||
q.put("status", 0)
|
||||
@@ -789,7 +792,8 @@ class CommonDatautils {
|
||||
keys.put(field, 1);
|
||||
}
|
||||
}
|
||||
def dbsour = DbUtils.seaweed.find(q, keys).batchSize(2000)
|
||||
|
||||
def dbsour = SEAWEED_COLL.find(q, keys).batchSize(2000)
|
||||
// def dbsour = getDataStoreConnection().find(q, keys).batchSize(2000)
|
||||
def rets = []
|
||||
for(def d : dbsour){
|
||||
@@ -1134,6 +1138,26 @@ class CommonDatautils {
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static def findNormalDistrict(String city, String region, String name, String cat, List fields){
|
||||
|
||||
DBObject q = new BasicDBObject();
|
||||
q.put("city", city);
|
||||
q.put("cat", cat);
|
||||
q.put("name", name);
|
||||
if(region){
|
||||
q.put("region", region);
|
||||
}
|
||||
q.put("status",0)
|
||||
|
||||
DBObject keys = new BasicDBObject();
|
||||
if(fields){
|
||||
for(def field : fields){
|
||||
keys.put(field, 1);
|
||||
}
|
||||
}
|
||||
return SEAWEED_COLL.findOne(q, keys);
|
||||
}
|
||||
|
||||
public static def findDistrictsByCityAndName(String city, String name, String cat){
|
||||
DBObject q = new BasicDBObject();
|
||||
q.put("city", city);
|
||||
@@ -4239,6 +4263,16 @@ class CommonDatautils {
|
||||
return map
|
||||
}
|
||||
|
||||
static def findThirdNetWorkOffices(city, region, name){
|
||||
String sql = "select * from office where city='${city}' and region='${region}' and name='${name}'"
|
||||
def datas = []
|
||||
|
||||
ElasticUtils.executeSqlQuery(sql, { m->
|
||||
datas << m
|
||||
})
|
||||
return datas
|
||||
}
|
||||
|
||||
|
||||
static def findThirdNetWorkOffice(){
|
||||
String sql = "select city,region,name,address,location from office where city='烟台' or city='北京'"
|
||||
@@ -5174,6 +5208,46 @@ class CommonDatautils {
|
||||
}
|
||||
|
||||
|
||||
|
||||
static def queryAllTown(fields){
|
||||
|
||||
def q = new BasicDBObject()
|
||||
q.put("type","乡镇街道")
|
||||
|
||||
def keys = new BasicDBObject()
|
||||
for(def key : fields){
|
||||
keys.put(key,1)
|
||||
}
|
||||
def dbcursor = ADMINISTRATIVE_MAPPING_COLL.find(q, keys).batchSize(5000).addOption(Bytes.QUERYOPTION_NOTIMEOUT)
|
||||
def cityMap = [:]
|
||||
for(def d : dbcursor){
|
||||
def townMap = cityMap.get(d.city)
|
||||
if(!townMap){
|
||||
townMap = [:]
|
||||
cityMap.put(d.city, townMap)
|
||||
}
|
||||
|
||||
def distName = null
|
||||
if(d.mzb_district_name){
|
||||
distName = d.mzb_district_name
|
||||
}else{
|
||||
distName = d.district
|
||||
}
|
||||
if(distName){
|
||||
def list = townMap.get(distName)
|
||||
if(!list){
|
||||
list = []
|
||||
}
|
||||
list << d
|
||||
townMap.put(distName, list)
|
||||
}
|
||||
}
|
||||
// println "[${city}] 乡镇街道 加载完成 "+new Date().format("yyyy-MM-dd HH:mm:ss")
|
||||
return cityMap
|
||||
}
|
||||
|
||||
|
||||
|
||||
static def queryFullRegionTownByCity(city, fields){
|
||||
|
||||
def q = new BasicDBObject()
|
||||
|
||||
Reference in New Issue
Block a user