diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/FillLngLat.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/FillLngLat.groovy new file mode 100644 index 000000000..cf23c1fec --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/FillLngLat.groovy @@ -0,0 +1,27 @@ +package com.fangjia.script.temp.shenjian.poi + +import com.alibaba.fastjson.JSONObject +import com.fangjia.script.temp.shenjian.util.EsUtils +import com.fangjia.script.temp.shenjian.util.GaoDeUtils +import com.fangjia.script.util.ElasticUtils + +/** + * 补充学校经纬度 + * @author shenjian + * @since 2022/9/8 + */ +class FillLngLat { + + static void main(String[] args) { + ElasticUtils.executeSqlQuery("select * from dws_poi where location is null", { data -> + println(data) + def lngLat = GaoDeUtils.parserByGaode(data.city, data.region + data.name + data.address) + if (lngLat.size() == 2 ) { + JSONObject jsonObject = new JSONObject() + jsonObject.put("lon", Double.valueOf(lngLat['lng'])) + jsonObject.put("lat", Double.valueOf(lngLat['lat'])) + EsUtils.bulkUpdateFieldByIds("dws_poi", "location", jsonObject, Arrays.asList(data.source_id)) + } + }) + } +} 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 4020ce8af..147d08336 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 @@ -65,23 +65,26 @@ class SeaweedAroundPoi extends BaseBatch { } static dealPoi(DBObject query, def types) { - query.put("status", 1) - conn136.find(query).batchSize(5000).limit(20000).each {objTemp -> + query.put("canyin_status", 0) + conn136.find(query).batchSize(5000).limit(20000).noCursorTimeout(true).each {objTemp -> final def obj = objTemp // executorService.submit(new Runnable() { // @Override // void run() { def city = obj.city if (obj.lng) { - def lng = SeaweedUtils.formatLatLng(obj.lng) - def lat = SeaweedUtils.formatLatLng(obj.lat) + //def lng = SeaweedUtils.formatLatLng(obj.lng) + //def lat = SeaweedUtils.formatLatLng(obj.lat) + // {'lon': 121.810877, 'lat': 31.737642} + def lng = 121.810877 + def lat = 31.737642 List 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", 0).append("flag", "已获取周边POI"))) + conn136.update(new BasicDBObject("_id", obj._id), new BasicDBObject('$set', new BasicDBObject("canyin_status", 0).append("flag", "已获取周边POI"))) } else { - conn136.update(new BasicDBObject("_id", obj._id), new BasicDBObject('$set', new BasicDBObject("status", 2).append("flag", "周边POI为空"))) + conn136.update(new BasicDBObject("_id", obj._id), new BasicDBObject('$set', new BasicDBObject("canyin_status", 2).append("flag", "周边POI为空"))) } println("已处理小区:" + obj) } @@ -168,18 +171,18 @@ class SeaweedAroundPoi extends BaseBatch { public static final Map KEYWORDS_MAP = new HashMap() { { - //put("餐饮", "05"); - put("地铁", "150500"); - put("公交", "1507"); - put("医院", "090100|090101|090200|090202|090203|090204|090205|090206|090207|090208|090209|090210|090211"); +// put("餐饮", "05"); +// put("地铁", "150500"); +// put("公交", "1507"); +// put("医院", "090100|090101|090200|090202|090203|090204|090205|090206|090207|090208|090209|090210|090211"); // put("写字楼", "120201"); - put("学校", "141200|141201|141202|141203|141204"); +// put("学校", "141200|141201|141202|141203|141204"); // put("银行", "1601|1603"); - put("大型超市", "0604"); - put("商场", "0601"); - //put("餐饮", "0501|0502|0503|0504"); +// put("大型超市", "0604"); +// put("商场", "0601"); + put("餐饮", "0501|0502|0503|0504"); // put("旅游景点", "110000"); - put("公园广场", "110100|110101|110102|110103|110104|110105") +// put("公园广场", "110100|110101|110102|110103|110104|110105") // put("图书馆", "140500"); // put("政府机关", "130100|130101|130102|130103|130104|130105|130106|130107"); // put("丧葬设施", "071900|071901|071902|071903")