From 9194dfa8d9cc002102ddbeb97a4b169c2fabec0f Mon Sep 17 00:00:00 2001 From: Jian Shen Date: Fri, 2 Sep 2022 16:58:22 +0800 Subject: [PATCH] =?UTF-8?q?poi=E6=9F=A5=E8=AF=A2=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../temp/shenjian/poi/SeaweedAroundPoi.groovy | 18 ++++++++++-------- .../temp/shenjian/util/GaoDeUtils.groovy | 2 +- .../script/statistics/poi/AmapPoiDetail.java | 17 ++++++++++++++++- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/SeaweedAroundPoi.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/SeaweedAroundPoi.groovy index f3c36ebd8..23b734e2e 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/SeaweedAroundPoi.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/SeaweedAroundPoi.groovy @@ -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 KEYWORDS_MAP = new HashMap() { { - 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") diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/GaoDeUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/GaoDeUtils.groovy index f08b96c89..1ab50a6ec 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/GaoDeUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/GaoDeUtils.groovy @@ -258,7 +258,7 @@ class GaoDeUtils { } if (json && json.info && json.info == "OK") { try { - List ret = JSONObject.parseArray(json.pois.toString(), AmapPoi.class) + List ret = JSONObject.parseArray(json.pois.toString(), AmapPoiDetail.class) return ret } catch(Exception ex) { ex.printStackTrace() diff --git a/projects/fangjia-script/src/main/java/com/fangjia/script/statistics/poi/AmapPoiDetail.java b/projects/fangjia-script/src/main/java/com/fangjia/script/statistics/poi/AmapPoiDetail.java index 8192b359c..14922257d 100644 --- a/projects/fangjia-script/src/main/java/com/fangjia/script/statistics/poi/AmapPoiDetail.java +++ b/projects/fangjia-script/src/main/java/com/fangjia/script/statistics/poi/AmapPoiDetail.java @@ -50,6 +50,21 @@ public class AmapPoiDetail { private BizExtDTO bizExt; @com.alibaba.fastjson.annotation.JSONField(name = "photos") private List 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; }