poi查询改造

This commit is contained in:
Jian Shen
2022-09-02 16:58:22 +08:00
parent 36c932625b
commit 9194dfa8d9
3 changed files with 27 additions and 10 deletions
@@ -29,13 +29,13 @@ class SeaweedAroundPoi extends BaseBatch {
static DBCollection conn136 = MongoUtils.getCollectionByName("fangjia", "seaweed_poi_sync", "192.168.0.136", 27017)
static final def URL = "http://192.168.0.100:38080/FangJiaDataService/saveAmapPoi"
static ExecutorService executorService = Executors.newFixedThreadPool(30)
//static ExecutorService executorService = Executors.newFixedThreadPool(2)
static void main(String[] args) {
def types = listAllType()
//dealSpecialSeaweedAround(types)
dealPoi(new BasicDBObject(), types)
executorService.shutdown()
//executorService.shutdown()
}
/**
@@ -67,9 +67,9 @@ class SeaweedAroundPoi extends BaseBatch {
query.put("status", 1)
conn136.find(query).batchSize(5000).each {objTemp ->
final def obj = objTemp
executorService.submit(new Runnable() {
@Override
void run() {
// executorService.submit(new Runnable() {
// @Override
// void run() {
def city = obj.city
def lng = obj.lng
def lat = obj.lat
@@ -81,10 +81,11 @@ class SeaweedAroundPoi extends BaseBatch {
} else {
conn136.update(new BasicDBObject("_id", obj._id), new BasicDBObject('$set', new BasicDBObject("status", 2).append("flag", "周边POI为空")))
}
Thread.sleep(500)
println("已处理小区:" + obj)
}
})
}
// })
// }
}
static getNewSeaweed() {
@@ -163,7 +164,7 @@ class SeaweedAroundPoi extends BaseBatch {
public static final Map<String, String> KEYWORDS_MAP = new HashMap<String, String>() {
{
put("餐饮", "05");
//put("餐饮", "05");
// put("地铁", "150500");
// put("公交", "1507");
// put("医院", "090100|090101|090200|090202|090203|090204|090205|090206|090207|090208|090209|090210|090211");
@@ -174,6 +175,7 @@ class SeaweedAroundPoi extends BaseBatch {
// put("商场", "0601");
// put("餐饮", "0501|0502|0503|0504");
// put("旅游景点", "110000");
put("公园广场", "110100|110101|110102|110103|110104|110105")
// put("图书馆", "140500");
// put("政府机关", "130100|130101|130102|130103|130104|130105|130106|130107");
// put("丧葬设施", "071900|071901|071902|071903")
@@ -258,7 +258,7 @@ class GaoDeUtils {
}
if (json && json.info && json.info == "OK") {
try {
List<AmapPoiDetail> ret = JSONObject.parseArray(json.pois.toString(), AmapPoi.class)
List<AmapPoiDetail> ret = JSONObject.parseArray(json.pois.toString(), AmapPoiDetail.class)
return ret
} catch(Exception ex) {
ex.printStackTrace()
@@ -50,6 +50,21 @@ public class AmapPoiDetail {
private BizExtDTO bizExt;
@com.alibaba.fastjson.annotation.JSONField(name = "photos")
private List<PhotosDTO> photos;
@com.alibaba.fastjson.annotation.JSONField(name = "business")
private BusinessDTO business;
@lombok.NoArgsConstructor
@lombok.Data
public static class BusinessDTO {
@com.alibaba.fastjson.annotation.JSONField(name = "business_area")
private String businessArea;
@com.alibaba.fastjson.annotation.JSONField(name = "keytag")
private String keytag;
@com.alibaba.fastjson.annotation.JSONField(name = "opentime_today")
private String opentimeToday;
@com.alibaba.fastjson.annotation.JSONField(name = "opentime_week")
private String opentimeWeek;
}
@lombok.NoArgsConstructor
@lombok.Data
@@ -64,7 +79,7 @@ public class AmapPoiDetail {
@lombok.Data
public static class PhotosDTO {
@com.alibaba.fastjson.annotation.JSONField(name = "title")
private List<?> title;
private String title;
@com.alibaba.fastjson.annotation.JSONField(name = "url")
private String url;
}