新增poi excel定点获取

This commit is contained in:
Jian Shen
2022-09-19 18:11:08 +08:00
parent 40ec48673f
commit ef319f7e83
4 changed files with 92 additions and 6 deletions
@@ -17,7 +17,7 @@ class FillLngLat {
static ExecutorService executorService = Executors.newFixedThreadPool(4)
static void main(String[] args) {
ElasticUtils.executeSqlQuery("select * from dws_poi where location is null", { dataT ->
ElasticUtils.executeSqlQuery("select * from dws_poi where location is not null", { dataT ->
final def data = dataT
executorService.submit(new Runnable() {
@Override
@@ -178,11 +178,11 @@ class SeaweedAroundPoi extends BaseBatch {
// put("写字楼", "120201");
// put("学校", "141200|141201|141202|141203|141204");
// put("银行", "1601|1603");
// put("大型超市", "0604");
put("大型超市", "0604");
// put("商场", "0601");
put("餐饮", "0501|0502|0503|0504");
// 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")
@@ -0,0 +1,84 @@
package com.fangjia.script.temp.shenjian.poi
import com.alibaba.fastjson.JSONObject
import com.fangjia.script.BaseBatch
import com.fangjia.script.BatchOwner
import com.fangjia.script.Watcher
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.temp.shenjian.util.SeaweedUtils
import com.fangjia.script.util.DbUtils
import com.fangjia.script.util.ExcelUtils
import com.fangjia.script.util.MongoUtils
import com.mongodb.BasicDBList
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
/**
* 小区周边POI数据获取
*
* @author shenjian
* @since 2021/5/24
*/
class SeaweedAroundPoiFromExcel {
static void main(String[] args) {
def types = listAllType()
dealPoi(new BasicDBObject(), types)
}
static dealPoi(DBObject query, def types) {
com.fangjia.script.util.ExcelUtils.multiThreadingModify("D:\\Users\\Domi\\Documents\\知识库\\建行\\审核小区\\东莞银行房价数据测试20220916-v3.xlsx", { List item ->
def city = item['H']
def lng = item['AQ']
def lat = item['AR']
if (lng) {
List<AmapPoi> pois = GaoDeUtils.searchNearDtoByPoi(city, types, lng, lat, 1000, "")
if (CollectionUtils.isNotEmpty(pois)) {
String jsonStr = JSONObject.toJSONString(pois)
HttpUtils.postForJson("http://192.168.0.100:38080/FangJiaDataService/saveAmapPoi", jsonStr)
}
Thread.sleep(1000)
print(lng + " " + lat)
}
});
};
public static def listAllType() {
StringBuilder ret = new StringBuilder()
for (def val : KEYWORDS_MAP.values()) {
ret.append(val).append("|")
}
String result = ret.toString()
return result.substring(0, result.length() - 1)
};
public static final Map<String, String> KEYWORDS_MAP = new HashMap<String, String>() {
{
// 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("银行", "1601|1603");
put("大型超市", "0604");
// 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")
}
}
}
@@ -146,11 +146,13 @@ class GaoDeUtils {
while (result.size() < count) {
params.page = "${page}".toString()
page++
params.key = this.getGaodeKey("v3/place/around")
//params.key = this.getGaodeKey("v3/place/around")
params.key = "25b2d459fd133e22f8abcebeac972692"
params.offset = "100"
JSONObject json = HttpRequestUtil.getJsonContent("http://restapi.amap.com/v3/place/around", params);
if (json == null) {
params.key = this.getGaodeKey("v3/place/around")
//params.key = this.getGaodeKey("v3/place/around")
params.key = "25b2d459fd133e22f8abcebeac972692"
params.offset = "100"
json = HttpRequestUtil.getJsonContent("http://restapi.amap.com/v3/place/around", params);
}