按城市全量加载
This commit is contained in:
+19
-3
@@ -226,7 +226,7 @@ class SuggestionDataSynch extends BaseBatch{
|
||||
def data = fullCityMap.get(city)
|
||||
if(data){
|
||||
def results = CommonDatautils.findAmapDetailBySql(data.city)
|
||||
def rets = createPoi(results, data, townMap)
|
||||
def rets = createPoi(data.city, results, data, townMap)
|
||||
println city +" 完成!"
|
||||
return rets;
|
||||
}
|
||||
@@ -235,10 +235,11 @@ class SuggestionDataSynch extends BaseBatch{
|
||||
}
|
||||
|
||||
|
||||
def createPoi(results, data, townMap){
|
||||
def createPoi(fullCity, results, data, townMap){
|
||||
def rets = new CopyOnWriteArrayList()
|
||||
|
||||
def totalCount = new AtomicLong()
|
||||
def townshipMap = findMapPoiTownshipMap(fullCity)
|
||||
final CountDownLatch latch = new CountDownLatch(results.size())
|
||||
for(def i=0;i<results.size();i++){
|
||||
final def dist = results[i]
|
||||
@@ -265,7 +266,7 @@ class SuggestionDataSynch extends BaseBatch{
|
||||
|
||||
map.township = InsidePolygon.isInArea2(map.location.lon, map.location.lat, townMap)
|
||||
if(!map.township){
|
||||
def obj = findTownshipByBD(dist.id)
|
||||
def obj = townshipMap.get(dist.id)
|
||||
if(obj){
|
||||
map.township = obj.township
|
||||
}else{
|
||||
@@ -294,6 +295,21 @@ class SuggestionDataSynch extends BaseBatch{
|
||||
return rets;
|
||||
}
|
||||
|
||||
def findMapPoiTownshipMap(fullCity){
|
||||
def q = new BasicDBObject()
|
||||
q.put("city", fullCity)
|
||||
|
||||
def keys = new BasicDBObject()
|
||||
keys.put("id", 1)
|
||||
keys.put("township", 1)
|
||||
def dbcursor = MAPPOI_CONN.find(q, keys)
|
||||
def map = [:]
|
||||
for(def d : dbcursor){
|
||||
map.put(d.id, d.township)
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
def findTownshipByBD(id){
|
||||
def q = new BasicDBObject()
|
||||
|
||||
Reference in New Issue
Block a user