新增小区周边居委会抓取
This commit is contained in:
+58
@@ -0,0 +1,58 @@
|
|||||||
|
package com.fangjia.script.temp.shenjian.poi
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject
|
||||||
|
import com.fangjia.script.statistics.poi.AmapPoi
|
||||||
|
import com.fangjia.script.temp.shenjian.util.GaoDeUtils
|
||||||
|
import com.fangjia.script.temp.shenjian.util.HttpUtils
|
||||||
|
import com.fangjia.script.util.MongoUtils
|
||||||
|
import com.mongodb.BasicDBObject
|
||||||
|
import com.mongodb.DBCollection
|
||||||
|
import com.mongodb.DBObject
|
||||||
|
import org.apache.commons.collections.CollectionUtils
|
||||||
|
|
||||||
|
import java.util.concurrent.ExecutorService
|
||||||
|
import java.util.concurrent.Executors
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小区周边居委会获取
|
||||||
|
*
|
||||||
|
* @author shenjian
|
||||||
|
* @since 2021/5/24
|
||||||
|
*/
|
||||||
|
class SeaweedAroundCommittee {
|
||||||
|
|
||||||
|
static DBCollection conn136 = MongoUtils.getCollectionByName("fangjia", "seaweed_poi_sync", "192.168.0.136", 27017)
|
||||||
|
static final def URL = "http://192.168.0.19:38080/FangJiaDataService/saveAmapPoi"
|
||||||
|
static ExecutorService executorService = Executors.newFixedThreadPool(30)
|
||||||
|
|
||||||
|
static void main(String[] args) {
|
||||||
|
// 乡镇以下级政府及事业单位(居委会)
|
||||||
|
def types = "130106"
|
||||||
|
dealPoi(new BasicDBObject(), types)
|
||||||
|
executorService.shutdown()
|
||||||
|
}
|
||||||
|
|
||||||
|
static dealPoi(DBObject query, def types) {
|
||||||
|
query.put("status_committee", 1)
|
||||||
|
conn136.find(query).batchSize(5000).each {objTemp ->
|
||||||
|
final def obj = objTemp
|
||||||
|
executorService.submit(new Runnable() {
|
||||||
|
@Override
|
||||||
|
void run() {
|
||||||
|
def city = obj.city
|
||||||
|
def lng = obj.lng
|
||||||
|
def lat = obj.lat
|
||||||
|
List<AmapPoi> pois = GaoDeUtils.searchNearDtoByPoi(city, types, lng, lat, 1000, "")
|
||||||
|
if (CollectionUtils.isNotEmpty(pois)) {
|
||||||
|
String jsonStr = JSONObject.toJSONString(pois)
|
||||||
|
HttpUtils.postForJson(URL, jsonStr)
|
||||||
|
conn136.update(new BasicDBObject("_id", obj._id), new BasicDBObject('$set', new BasicDBObject("status_committee", 0).append("flag_committee", "已获取居委会")))
|
||||||
|
} else {
|
||||||
|
conn136.update(new BasicDBObject("_id", obj._id), new BasicDBObject('$set', new BasicDBObject("status_committee", 2).append("flag_committee", "周边居委会为空")))
|
||||||
|
}
|
||||||
|
println("已处理小区:" + obj)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user