diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/GetPoi.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/GetPoi.groovy new file mode 100644 index 000000000..7ff7cb903 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/poi/GetPoi.groovy @@ -0,0 +1,39 @@ +package com.fangjia.script.temp.shenjian.poi + + +import com.alibaba.fastjson.JSONObject +import com.fangjia.script.lixue.util.DBUtils +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.MongoUtils +import com.fangjia.script.wenyan.auto.KeywordSearchUtils +import com.mongodb.BasicDBObject +import com.mongodb.DBCollection +import com.mongodb.DBObject +import org.apache.commons.collections.CollectionUtils +import org.bson.types.ObjectId + +import java.util.concurrent.ExecutorService +import java.util.concurrent.Executors + +/** + * 获取具体点poi + * + * @author shenjian + * @since 2021/7/26 + */ +class GetPoi { + + static final def URL = "http://192.168.0.19:38080/FangJiaDataService/saveAmapPoi" + + static void main(String[] args) { + List pois = GaoDeUtils.searchNearDtoByPoi("无锡","190301",120.411465,31.864912, 1000, "江苏省江阴市周庄镇兴隆北路"); + if (CollectionUtils.isNotEmpty(pois)) { + String jsonStr = JSONObject.toJSONString(pois) + HttpUtils.postForJson(URL, jsonStr) + } + } +} \ No newline at end of file diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/seaweed/SeaweedGeoHashExport.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/seaweed/SeaweedGeoHashExport.groovy index 154efe43e..a0cede622 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/seaweed/SeaweedGeoHashExport.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/seaweed/SeaweedGeoHashExport.groovy @@ -1,6 +1,9 @@ package com.fangjia.script.temp.shenjian.seaweed +import com.fangjia.script.common.DataHandleUtils +import com.fangjia.script.temp.shenjian.util.ExcelUtils import com.fangjia.script.temp.shenjian.util.SeaweedUtils +import com.fangjia.script.util.DataUtil import com.fangjia.script.util.DbUtils import com.mongodb.BasicDBObject import com.mongodb.DBObject @@ -14,27 +17,35 @@ import com.mongodb.DBObject class SeaweedGeoHashExport { static void main(String[] args) { - List list = new ArrayList<>() + print(SeaweedUtils.encodeByGeoHash(30.8006287800, 108.3835777247, 8)) + //List> data = com.fangjia.script.util.ExcelUtils.read("D:\\Users\\Domi\\Desktop\\房价网\\项目\\银联\\长宁区融合数据结果20210625.xlsx") +/* for (List str : data) { + String geohash = str.get(0) + str.add(SeaweedUtils.decodeByGeoHash(geohash)) + }*/ - DBObject query = new BasicDBObject() - query.append("cat", "district").append("visible", 0).append("city", "上海").append("region", "长宁") - - DBObject filter = new BasicDBObject() - filter.put("lng", 1) - filter.put("lat", 1) - DbUtils.seaweed.find(query, filter).batchSize(20000).each {objTemp -> - final def obj = objTemp - if (obj.lng && obj.lat) { - def lon = obj.lng - def lat = obj.lat - list.add(SeaweedUtils.encodeByGeoHash(SeaweedUtils.formatLatLng(lon), SeaweedUtils.formatLatLng(lat),7)) - } - } - def ret = [] - ret << ['小区geohash'] - for (String val : list) { - ret << [val] - } - com.fangjia.script.util.ExcelUtils.write("F:\\数据\\基础建设\\geohash.xlsx", ret, "geohash"); + //com.fangjia.script.util.ExcelUtils.write("D:\\Users\\Domi\\Desktop\\房价网\\项目\\银联\\长宁区融合数据结果20210625.xlsx", data, "geohash"); +// DBObject query = new BasicDBObject() +// query.append("cat", "district").append("visible", 0).append("city", "上海").append("region", "长宁") +// +// DBObject filter = new BasicDBObject() +// filter.put("lng", 1) +// filter.put("lat", 1) +// filter.put("name", 1) +// +// def rows = [] +// DbUtils.seaweed.find(query, filter).batchSize(20000).each {objTemp -> +// final def obj = objTemp +// if (obj.lng && obj.lat) { +// def lon = obj.lng +// def lat = obj.lat +// def geohash = SeaweedUtils.encodeByGeoHash(SeaweedUtils.formatLatLng(lon), SeaweedUtils.formatLatLng(lat),7) +// rows << [lon, lat, obj.name, geohash] +// } +// } +// def ret = [] +// ret << ["经度", "纬度", "小区名", "小区geohash"] +// ret.addAll(rows) +// com.fangjia.script.util.ExcelUtils.write("D:\\数据\\基础建设\\geohash.xlsx", ret, "geohash"); } } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/SeaweedUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/SeaweedUtils.groovy index 9fa4739f8..f21ff7ae7 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/SeaweedUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/SeaweedUtils.groovy @@ -198,7 +198,8 @@ class SeaweedUtils { * @param args */ static def decodeByGeoHash(String geohash) { - return Geohash.decodeLongitude(geohash) + "," + Geohash.decodeLatitude(geohash) + return DataHandleUtils.getDoubleRound(6, Geohash.decodeLatitude(geohash)) + "," + + DataHandleUtils.getDoubleRound(6, Geohash.decodeLongitude(geohash)) } static void main(String[] args) {