Merge remote-tracking branch 'origin/script_develop' into script_develop
This commit is contained in:
+39
@@ -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<AmapPoi> pois = GaoDeUtils.searchNearDtoByPoi("无锡","190301",120.411465,31.864912, 1000, "江苏省江阴市周庄镇兴隆北路");
|
||||
if (CollectionUtils.isNotEmpty(pois)) {
|
||||
String jsonStr = JSONObject.toJSONString(pois)
|
||||
HttpUtils.postForJson(URL, jsonStr)
|
||||
}
|
||||
}
|
||||
}
|
||||
+32
-21
@@ -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<String> list = new ArrayList<>()
|
||||
print(SeaweedUtils.encodeByGeoHash(30.8006287800, 108.3835777247, 8))
|
||||
//List<List<String>> data = com.fangjia.script.util.ExcelUtils.read("D:\\Users\\Domi\\Desktop\\房价网\\项目\\银联\\长宁区融合数据结果20210625.xlsx")
|
||||
/* for (List<String> 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");
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user