新增农商行小区周围建筑信息导出
This commit is contained in:
+74
@@ -0,0 +1,74 @@
|
|||||||
|
package com.fangjia.script.temp.shenjian.cqrcb
|
||||||
|
|
||||||
|
import com.fangjia.script.coredata.util.CollectionUtils
|
||||||
|
import com.fangjia.script.lixue.util.DBUtils
|
||||||
|
import com.fangjia.script.temp.shenjian.util.GaoDeUtils
|
||||||
|
import com.fangjia.script.util.DbUtils
|
||||||
|
import com.fangjia.script.util.ExcelUtils
|
||||||
|
import com.fangjia.script.util.MongoUtils
|
||||||
|
import com.mongodb.BasicDBObject
|
||||||
|
import com.mongodb.DBCollection
|
||||||
|
import com.mongodb.DBObject
|
||||||
|
|
||||||
|
import java.util.concurrent.ConcurrentHashMap
|
||||||
|
import java.util.concurrent.ExecutorService
|
||||||
|
import java.util.concurrent.Executors
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重庆所有小区周边导出
|
||||||
|
*
|
||||||
|
* @author shenjian
|
||||||
|
* @since 2021/5/15
|
||||||
|
*/
|
||||||
|
class AllExport {
|
||||||
|
|
||||||
|
static DBCollection conn = MongoUtils.getCollectionByName("seeddb_dev", "arround_temp", "192.168.0.235", 27018)
|
||||||
|
|
||||||
|
//3km范围内地铁站、公交站、银行、医院、商场、学校等名称及距离信息
|
||||||
|
static def types = "150500|1507|090100|090101|090200|090202|090203|090204|090205|090206|090207|090208|090209|090210|090211|1601|0601|141200|141201|141202|141203|141204"
|
||||||
|
static def radius = "3000"
|
||||||
|
static ExecutorService executorService = Executors.newFixedThreadPool(30)
|
||||||
|
|
||||||
|
static void main(String[] args) {
|
||||||
|
DBObject query = new BasicDBObject()
|
||||||
|
query.put("city", "重庆")
|
||||||
|
query.put("cat", "district")
|
||||||
|
query.put("visible", 0)
|
||||||
|
|
||||||
|
DBObject filter = new BasicDBObject()
|
||||||
|
filter.put("region", 1)
|
||||||
|
filter.put("name", 1)
|
||||||
|
filter.put("lng", 1)
|
||||||
|
filter.put("lat", 1)
|
||||||
|
AtomicInteger count = new AtomicInteger(0)
|
||||||
|
DBUtils.seaweed.find(query, filter).batchSize(10000).each {district ->
|
||||||
|
executorService.execute(new Runnable() {
|
||||||
|
@Override
|
||||||
|
void run() {
|
||||||
|
def city = "重庆"
|
||||||
|
def name = district.name
|
||||||
|
def region = district.region
|
||||||
|
boolean exist = conn.count(new BasicDBObject("matched_city": city, "matched_region": region,"matched_name": name)) > 0 ? true : false
|
||||||
|
if (!exist) {
|
||||||
|
def lng = com.fangjia.script.common.DataHandleUtils.getDoubleRound(6, district.lng / 10000000000d)
|
||||||
|
def lat = com.fangjia.script.common.DataHandleUtils.getDoubleRound(6, district.lat / 10000000000d)
|
||||||
|
List arounds = GaoDeUtils.searchNearByPoi(city, types, lng, lat, radius, "")
|
||||||
|
if (CollectionUtils.isNotEmpty(arounds)) {
|
||||||
|
for (BasicDBObject obj : arounds) {
|
||||||
|
obj.put("matched_city", city)
|
||||||
|
obj.put("matched_region", district.region)
|
||||||
|
obj.put("matched_name", district.name)
|
||||||
|
}
|
||||||
|
conn.insert(arounds)
|
||||||
|
}
|
||||||
|
println("当前处理小区" + name + " " + count.incrementAndGet())
|
||||||
|
} else {
|
||||||
|
println("小区已存在")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
executorService.shutdown()
|
||||||
|
}
|
||||||
|
}
|
||||||
+36
-19
@@ -2,6 +2,7 @@ package com.fangjia.script.temp.shenjian.cqrcb
|
|||||||
|
|
||||||
import cn.emay.mina.util.ConcurrentHashSet
|
import cn.emay.mina.util.ConcurrentHashSet
|
||||||
import com.fangjia.script.coredata.util.CollectionUtils
|
import com.fangjia.script.coredata.util.CollectionUtils
|
||||||
|
import com.fangjia.script.lixue.util.DBUtils
|
||||||
import com.fangjia.script.temp.shenjian.util.GaoDeUtils
|
import com.fangjia.script.temp.shenjian.util.GaoDeUtils
|
||||||
import com.fangjia.script.util.ExcelUtils
|
import com.fangjia.script.util.ExcelUtils
|
||||||
import com.fangjia.script.util.GeoUtils
|
import com.fangjia.script.util.GeoUtils
|
||||||
@@ -27,38 +28,54 @@ class AroundExport {
|
|||||||
//3km范围内地铁站、公交站、银行、医院、商场、学校等名称及距离信息
|
//3km范围内地铁站、公交站、银行、医院、商场、学校等名称及距离信息
|
||||||
static def types = "150500|1507|090100|090101|090200|090202|090203|090204|090205|090206|090207|090208|090209|090210|090211|1601|0601|141200|141201|141202|141203|141204"
|
static def types = "150500|1507|090100|090101|090200|090202|090203|090204|090205|090206|090207|090208|090209|090210|090211|1601|0601|141200|141201|141202|141203|141204"
|
||||||
static def radius = "3000"
|
static def radius = "3000"
|
||||||
static ExecutorService executorService = Executors.newFixedThreadPool(30)
|
//static ExecutorService executorService = Executors.newFixedThreadPool(30)
|
||||||
|
|
||||||
|
// 高德地图中不存在周边的数据
|
||||||
|
// 重庆 江北 阳光丽苑
|
||||||
|
//重庆 江北 金田花苑
|
||||||
|
//重庆 巴南 巴滨一号璀璨滨江
|
||||||
|
//重庆 丰都 茅林沟移民新村
|
||||||
|
//重庆 江津 福城北苑
|
||||||
|
//重庆 巫山 摩天岭壹号
|
||||||
static void main(String[] args) {
|
static void main(String[] args) {
|
||||||
List<List<Object>> data = ExcelUtils.read("F:\\数据\\重庆农商行\\测试数据汇总_2021.xlsx", 9)
|
List<List<Object>> data = ExcelUtils.read("F:\\数据\\重庆农商行\\周边补充.xlsx", 0)
|
||||||
AtomicInteger count = new AtomicInteger(0)
|
AtomicInteger count = new AtomicInteger(0)
|
||||||
for (List<Object> districtT : data) {
|
for (List<Object> districtT : data) {
|
||||||
final List<Object> district = districtT
|
final List<Object> district = districtT
|
||||||
executorService.execute(new Runnable() {
|
// executorService.execute(new Runnable() {
|
||||||
@Override
|
// @Override
|
||||||
void run() {
|
// void run() {
|
||||||
def city = district.get(1)
|
def city = district.get(0)
|
||||||
def name = district.get(3)
|
def region = district.get(1)
|
||||||
if (district.get(20) != null && district.get(21) != null) {
|
def name = district.get(2)
|
||||||
boolean exist = conn.count(new BasicDBObject("district_name", name)) > 0 ? true : false
|
boolean exist = conn.count(new BasicDBObject("matched_city": city, "matched_region": region,"matched_name": name)) > 0 ? true : false
|
||||||
if (!exist) {
|
if (!exist) {
|
||||||
def lng = com.fangjia.script.common.DataHandleUtils.getDoubleRound(6, district.get(20) / 10000000000d)
|
DBObject query = new BasicDBObject()
|
||||||
def lat = com.fangjia.script.common.DataHandleUtils.getDoubleRound(6, district.get(21) / 10000000000d)
|
query.put("city", city)
|
||||||
|
query.put("region", region)
|
||||||
|
query.put("cat", "district")
|
||||||
|
query.put("visible", 0)
|
||||||
|
query.put("name", name)
|
||||||
|
DBUtils.seaweed.find(query, new BasicDBObject("lat", 1).append("lng", 1)).limit(1).each {objT ->
|
||||||
|
def lng = com.fangjia.script.common.DataHandleUtils.getDoubleRound(6, objT.lng / 10000000000d)
|
||||||
|
def lat = com.fangjia.script.common.DataHandleUtils.getDoubleRound(6, objT.lat / 10000000000d)
|
||||||
List arounds = GaoDeUtils.searchNearByPoi(city, types, lng, lat, radius, "")
|
List arounds = GaoDeUtils.searchNearByPoi(city, types, lng, lat, radius, "")
|
||||||
if (CollectionUtils.isNotEmpty(arounds)) {
|
if (CollectionUtils.isNotEmpty(arounds)) {
|
||||||
for (BasicDBObject obj : arounds) {
|
for (BasicDBObject obj : arounds) {
|
||||||
obj.put("district_name", name)
|
obj.put("matched_city", city)
|
||||||
obj.put("lng", lng)
|
obj.put("matched_region", region)
|
||||||
obj.put("lat", lat)
|
obj.put("matched_name", name)
|
||||||
}
|
}
|
||||||
conn.insert(arounds)
|
conn.insert(arounds)
|
||||||
}
|
}
|
||||||
|
println("当前处理小区" + name + " " + count.incrementAndGet())
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
println("小区已存在")
|
||||||
}
|
}
|
||||||
println("当前处理小区" + name + " " + count.incrementAndGet())
|
// }
|
||||||
}
|
// })
|
||||||
})
|
|
||||||
}
|
}
|
||||||
executorService.shutdown()
|
//executorService.shutdown()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+174
@@ -0,0 +1,174 @@
|
|||||||
|
package com.fangjia.script.temp.shenjian.cqrcb
|
||||||
|
|
||||||
|
import com.fangjia.script.commData.CommonDatautils
|
||||||
|
import com.fangjia.script.district.Distance
|
||||||
|
import com.fangjia.script.util.ExcelUtils
|
||||||
|
import com.fangjia.script.util.MongoUtils
|
||||||
|
import com.mongodb.BasicDBObject
|
||||||
|
import com.mongodb.DBCollection
|
||||||
|
import com.mongodb.DBObject
|
||||||
|
import com.mongodb.QueryOperators
|
||||||
|
|
||||||
|
import java.util.concurrent.ConcurrentHashMap
|
||||||
|
import java.util.concurrent.CountDownLatch
|
||||||
|
import java.util.concurrent.ExecutorService
|
||||||
|
import java.util.concurrent.Executors
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 周边数据导出新方式
|
||||||
|
*
|
||||||
|
* @author shenjian
|
||||||
|
* @since 2021/5/16
|
||||||
|
*/
|
||||||
|
class AroundExportByNewWay {
|
||||||
|
|
||||||
|
static DBCollection poiConn = MongoUtils.getCollectionByName("address_analytics", "gaode_address_poi", "192.168.0.43", 28017)
|
||||||
|
static def resultMap = new ConcurrentHashMap()
|
||||||
|
static ExecutorService executorService = Executors.newFixedThreadPool(30)
|
||||||
|
|
||||||
|
static void main(String[] args) {
|
||||||
|
List<List<Object>> data = ExcelUtils.read("F:\\数据\\重庆农商行\\测试数据汇总_2021.xlsx", 9)
|
||||||
|
AtomicInteger count = new AtomicInteger(0)
|
||||||
|
CountDownLatch latch = new CountDownLatch(data.size())
|
||||||
|
for (List<Object> districtT : data) {
|
||||||
|
final List<Object> district = districtT
|
||||||
|
executorService.execute(new Runnable() {
|
||||||
|
@Override
|
||||||
|
void run() {
|
||||||
|
try {
|
||||||
|
def id = district.get(0)
|
||||||
|
def district_code = district.get(2)
|
||||||
|
if (district_code == 'B100203') {
|
||||||
|
println(district_code)
|
||||||
|
}
|
||||||
|
def name = district.get(3)
|
||||||
|
List result = []
|
||||||
|
if (district.get(20) != null && district.get(21) != null) {
|
||||||
|
def lng = com.fangjia.script.common.DataHandleUtils.getDoubleRound(6, district.get(20) / 10000000000d)
|
||||||
|
def lat = com.fangjia.script.common.DataHandleUtils.getDoubleRound(6, district.get(21) / 10000000000d)
|
||||||
|
|
||||||
|
// 周围半径为3千米
|
||||||
|
def mapLatLng = CommonDatautils.findMaxLatLngMinLatLng(lat, lng, 3000)
|
||||||
|
DBObject q = new BasicDBObject()
|
||||||
|
q.put('status', 1)
|
||||||
|
q.put('lat', new BasicDBObject(QueryOperators.LTE, mapLatLng.maxLat).append(QueryOperators.GTE, mapLatLng.minLat));
|
||||||
|
q.put('lng', new BasicDBObject(QueryOperators.LTE, mapLatLng.maxLng).append(QueryOperators.GTE, mapLatLng.minLng));
|
||||||
|
Map<String, Map> map = new ConcurrentHashMap<>();
|
||||||
|
poiConn.find(q, new BasicDBObject("name": 1, "distance": 1, "type": 1, "lat": 1, "lng": 1)).batchSize(500).each {obj ->
|
||||||
|
double distance = Distance.GetDistance(lng, lat, obj.lng, obj.lat)
|
||||||
|
if (distance <= 3000) {
|
||||||
|
dealSpecial(obj, map, id, distance, result)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (String key : map.keySet()) {
|
||||||
|
int distance = map.get(key).get("distance")
|
||||||
|
int count1 = map.get(key).get("count")
|
||||||
|
def type = map.get(key).get("type")
|
||||||
|
def ret = []
|
||||||
|
ret[0] = id
|
||||||
|
ret[1] = key
|
||||||
|
ret[2] = type
|
||||||
|
ret[3] = (distance / count1).toInteger()
|
||||||
|
result << ret
|
||||||
|
}
|
||||||
|
}
|
||||||
|
resultMap.put(district_code + name, result)
|
||||||
|
println("当前处理" + count.incrementAndGet() )
|
||||||
|
} catch (Exception ex) {
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
latch.countDown()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
};
|
||||||
|
latch.await()
|
||||||
|
def ret = []
|
||||||
|
ret << ['IDB', '名称','类型', '距离']
|
||||||
|
for (List<Object> district : data) {
|
||||||
|
def district_code = district.get(2)
|
||||||
|
def name = district.get(3)
|
||||||
|
if (com.fangjia.script.coredata.util.CollectionUtils.isNotEmpty(resultMap.get(district_code + name))) {
|
||||||
|
ret.addAll(resultMap.get(district_code + name))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
println(ret.size())
|
||||||
|
com.fangjia.script.util.ExcelUtils.write("F:\\数据\\重庆农商行\\周边配套.xlsx", ret, "周边配套");
|
||||||
|
executorService.shutdown()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static dealSpecial(DBObject obj, def map, def id, double distance, def result) {
|
||||||
|
def name = obj.name
|
||||||
|
if (name.indexOf("/") != -1) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (name == "1号楼") {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (name.indexOf("地铁口") == -1 && name.indexOf("公交站") == -1 && name.indexOf("支行") == -1) {
|
||||||
|
if (name.indexOf("医院") != -1 && !name.endsWith("医院")) {
|
||||||
|
if (name.indexOf("分院") == -1) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (name.indexOf("卫生中心") != -1 && !name.endsWith("卫生中心")) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (name.indexOf("大学") != -1 && !name.endsWith("大学")) {
|
||||||
|
if (name.indexOf("校区") == -1 && name.indexOf("幼儿园") == -1 && name.indexOf("小学") == -1 && name.indexOf("中学") == -1
|
||||||
|
&& !name.endsWith("医院")) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (name.indexOf("学院") != -1 && !name.endsWith("学院")) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (name.indexOf("分院") != -1 && !name.endsWith("分院")) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (name.indexOf("学校") != -1 && !name.endsWith("学校")) {
|
||||||
|
if (name.indexOf("校区") == -1 && name.indexOf("分校") == -1) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (name.indexOf("中学") != -1 && !name.endsWith("中学")) {
|
||||||
|
if (name.indexOf("校区") == -1) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (name.indexOf("小学") != -1 && !name.endsWith("小学")) {
|
||||||
|
if (name.indexOf("校区") == -1) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 中梁山地铁站1A口
|
||||||
|
if (obj.name.indexOf("地铁站") != -1 && obj.name.indexOf("口") != -1) {
|
||||||
|
def nameTemp = obj.name.substring(0, obj.name.indexOf("地铁站") + 3)
|
||||||
|
def key = nameTemp
|
||||||
|
Map<String, Integer> child = new HashMap()
|
||||||
|
if (map.get(key) != null) {
|
||||||
|
distance + map.get(key).get("distance")
|
||||||
|
int count1 = map.get(key).get("count")
|
||||||
|
child.put("distance", distance)
|
||||||
|
child.put("count", count1)
|
||||||
|
child.put("type", obj.type)
|
||||||
|
map.put(key, child)
|
||||||
|
} else {
|
||||||
|
child.put("distance", distance)
|
||||||
|
child.put("type", obj.type)
|
||||||
|
child.put("count", 1)
|
||||||
|
map.put(key, child)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
def ret = []
|
||||||
|
ret[0] = id
|
||||||
|
ret[1] = obj.name
|
||||||
|
ret[2] = obj.type
|
||||||
|
ret[3] = distance.toInteger()
|
||||||
|
result << ret
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+161
@@ -0,0 +1,161 @@
|
|||||||
|
package com.fangjia.script.temp.shenjian.cqrcb
|
||||||
|
|
||||||
|
import cn.emay.mina.util.ConcurrentHashSet
|
||||||
|
import com.fangjia.script.coredata.util.CollectionUtils
|
||||||
|
import com.fangjia.script.temp.shenjian.util.GaoDeUtils
|
||||||
|
import com.fangjia.script.util.ExcelUtils
|
||||||
|
import com.fangjia.script.util.MongoUtils
|
||||||
|
import com.mongodb.BasicDBObject
|
||||||
|
import com.mongodb.DBCollection
|
||||||
|
import com.mongodb.DBObject
|
||||||
|
|
||||||
|
import java.util.concurrent.ConcurrentHashMap
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue
|
||||||
|
import java.util.concurrent.CountDownLatch
|
||||||
|
import java.util.concurrent.ExecutorService
|
||||||
|
import java.util.concurrent.Executors
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小区周围信息格式化输出
|
||||||
|
*
|
||||||
|
* @author shenjian
|
||||||
|
* @since 2021/5/15
|
||||||
|
*/
|
||||||
|
class AroundFormatExport {
|
||||||
|
|
||||||
|
static DBCollection conn = MongoUtils.getCollectionByName("seeddb_dev", "arround_temp", "192.168.0.235", 27018)
|
||||||
|
static def resultMap = new ConcurrentHashMap()
|
||||||
|
static ExecutorService executorService = Executors.newFixedThreadPool(30)
|
||||||
|
|
||||||
|
static void main(String[] args) {
|
||||||
|
List<List<Object>> data = ExcelUtils.read("F:\\数据\\重庆农商行\\测试数据汇总_2021.xlsx", 9)
|
||||||
|
AtomicInteger count = new AtomicInteger(0)
|
||||||
|
CountDownLatch latch = new CountDownLatch(data.size())
|
||||||
|
for (List<Object> districtT : data) {
|
||||||
|
final List<Object> district = districtT
|
||||||
|
executorService.execute(new Runnable() {
|
||||||
|
@Override
|
||||||
|
void run() {
|
||||||
|
try {
|
||||||
|
def district_code = district.get(2)
|
||||||
|
def name = district.get(3)
|
||||||
|
def temp = []
|
||||||
|
if (district.get(20) != null && district.get(21) != null) {
|
||||||
|
def matched_city = district.get(22)
|
||||||
|
def matched_region = district.get(23)
|
||||||
|
def matched_name = district.get(24)
|
||||||
|
|
||||||
|
DBObject query = new BasicDBObject()
|
||||||
|
query.put("matched_city", matched_city)
|
||||||
|
query.put("matched_region", matched_region)
|
||||||
|
query.put("matched_name", matched_name)
|
||||||
|
List ret = new ArrayList()
|
||||||
|
Map<String, Map> map = new ConcurrentHashMap<>();
|
||||||
|
conn.find(query, new BasicDBObject("name": 1, "distance": 1, "matched_region": 1)).batchSize(1000).each { obj ->
|
||||||
|
dealSpecial(obj, map, ret)
|
||||||
|
}
|
||||||
|
for (String key : map.keySet()) {
|
||||||
|
int distance = map.get(key).get("distance")
|
||||||
|
int count1 = map.get(key).get("count")
|
||||||
|
ret.add(key + ":" + (distance / count1) + "米")
|
||||||
|
}
|
||||||
|
|
||||||
|
temp[7] = matched_city
|
||||||
|
temp[8] = matched_region
|
||||||
|
temp[9] = matched_name
|
||||||
|
if (ret.size() > 0) {
|
||||||
|
def str = ret.join(",")
|
||||||
|
temp[5] = str
|
||||||
|
println(str)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
resultMap.put(district_code + name, temp)
|
||||||
|
println("当前处理" + count.incrementAndGet() )
|
||||||
|
} catch (Exception ex) {
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
latch.countDown()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
latch.await()
|
||||||
|
def ret = []
|
||||||
|
ret << ['IDB','城市名称','区域编码','小区名称','楼栋号','3km范围内地铁站、公交站、银行、医院、商场、学校等名称及距离信息','1km范围内地铁站、公交站、银行、医院、商场、学校等数量']
|
||||||
|
for (List<Object> district : data) {
|
||||||
|
def district_code = district.get(2)
|
||||||
|
def name = district.get(3)
|
||||||
|
ret << resultMap.get(district_code + name)
|
||||||
|
}
|
||||||
|
com.fangjia.script.util.ExcelUtils.write("F:\\数据\\重庆农商行\\周边配套.xlsx", ret, "周边配套");
|
||||||
|
executorService.shutdown()
|
||||||
|
}
|
||||||
|
|
||||||
|
static dealSpecial(DBObject obj, def map, def ret) {
|
||||||
|
def name = obj.name
|
||||||
|
if (name.indexOf("/") != -1) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (name == "1号楼") {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (name.indexOf("地铁口") == -1 && name.indexOf("公交站") == -1 && name.indexOf("支行") == -1) {
|
||||||
|
if (name.indexOf("医院") != -1 && !name.endsWith("医院")) {
|
||||||
|
if (name.indexOf("分院") == -1) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (name.indexOf("卫生中心") != -1 && !name.endsWith("卫生中心")) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (name.indexOf("大学") != -1 && !name.endsWith("大学")) {
|
||||||
|
if (name.indexOf("校区") == -1 && name.indexOf("幼儿园") == -1 && name.indexOf("小学") == -1 && name.indexOf("中学") == -1
|
||||||
|
&& !name.endsWith("医院")) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (name.indexOf("学院") != -1 && !name.endsWith("学院")) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (name.indexOf("分院") != -1 && !name.endsWith("分院")) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (name.indexOf("学校") != -1 && !name.endsWith("学校")) {
|
||||||
|
if (name.indexOf("校区") == -1 && name.indexOf("分校") == -1) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (name.indexOf("中学") != -1 && !name.endsWith("中学")) {
|
||||||
|
if (name.indexOf("校区") == -1) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (name.indexOf("小学") != -1 && !name.endsWith("小学")) {
|
||||||
|
if (name.indexOf("校区") == -1) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 中梁山地铁站1A口
|
||||||
|
if (obj.name.indexOf("地铁站") != -1 && obj.name.indexOf("口") != -1) {
|
||||||
|
def nameTemp = obj.name.substring(0, obj.name.indexOf("地铁站") + 3)
|
||||||
|
def key = nameTemp
|
||||||
|
Map<String, Integer> child = new HashMap()
|
||||||
|
if (map.get(key) != null) {
|
||||||
|
int distance = Double.valueOf(obj.distance) + map.get(key).get("distance")
|
||||||
|
int count1 = map.get(key).get("count")
|
||||||
|
child.put("distance", distance)
|
||||||
|
child.put("count", count1)
|
||||||
|
map.put(key, child)
|
||||||
|
} else {
|
||||||
|
child.put("distance", Double.valueOf(obj.distance))
|
||||||
|
child.put("count", 1)
|
||||||
|
map.put(key, child)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ret.add(obj.name + ":" + obj.distance + "米")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+32
@@ -0,0 +1,32 @@
|
|||||||
|
package com.fangjia.script.temp.shenjian.cqrcb
|
||||||
|
|
||||||
|
import com.fangjia.script.util.ExcelUtils
|
||||||
|
import com.fangjia.script.util.MongoUtils
|
||||||
|
import com.mongodb.BasicDBObject
|
||||||
|
import com.mongodb.DBCollection
|
||||||
|
import com.mongodb.QueryOperators
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标记不需要导出的数据
|
||||||
|
*
|
||||||
|
* @author shenjian
|
||||||
|
* @since 2021/5/16
|
||||||
|
*/
|
||||||
|
class MarkUnNeedExport {
|
||||||
|
|
||||||
|
static DBCollection poiConn = MongoUtils.getCollectionByName("address_analytics", "gaode_address_poi", "192.168.0.43", 28017)
|
||||||
|
|
||||||
|
static void main(String[] args) {
|
||||||
|
List<List<Object>> data = ExcelUtils.read("F:\\数据\\重庆农商行\\周边补充.xlsx", 1)
|
||||||
|
for (List<Object> districtT : data) {
|
||||||
|
final List<Object> district = districtT
|
||||||
|
if (district.size() > 1) {
|
||||||
|
def type = district.get(0)
|
||||||
|
def status = district.get(1)
|
||||||
|
if (status == 1) {
|
||||||
|
poiConn.update(new BasicDBObject("type", type), new BasicDBObject('$set', new BasicDBObject("status", 1)))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+64
@@ -0,0 +1,64 @@
|
|||||||
|
package com.fangjia.script.temp.shenjian.cqrcb
|
||||||
|
|
||||||
|
import com.fangjia.script.util.MongoUtils
|
||||||
|
import com.mongodb.BasicDBObject
|
||||||
|
import com.mongodb.DBCollection
|
||||||
|
import com.mongodb.DBObject
|
||||||
|
|
||||||
|
import java.util.concurrent.CountDownLatch
|
||||||
|
import java.util.concurrent.ExecutorService
|
||||||
|
import java.util.concurrent.Executors
|
||||||
|
|
||||||
|
/**
|
||||||
|
* POI迁移
|
||||||
|
*
|
||||||
|
* @author shenjian
|
||||||
|
* @since 2021/5/16
|
||||||
|
*/
|
||||||
|
class MoveArroundTemp {
|
||||||
|
|
||||||
|
static DBCollection conn = MongoUtils.getCollectionByName("seeddb_dev", "arround_temp", "192.168.0.235", 27018)
|
||||||
|
static DBCollection conn43 = MongoUtils.getCollectionByName("address_analytics", "gaode_address_poi", "192.168.0.43", 28017)
|
||||||
|
static ExecutorService executorService = Executors.newFixedThreadPool(30)
|
||||||
|
|
||||||
|
static void main(String[] args) {
|
||||||
|
List<DBObject> list = Collections.synchronizedList(new ArrayList<DBObject>())
|
||||||
|
List<String> ids = conn.distinct("id")
|
||||||
|
CountDownLatch latch = new CountDownLatch(ids.size())
|
||||||
|
for (String idT : ids) {
|
||||||
|
final String id = idT
|
||||||
|
executorService.submit(new Runnable() {
|
||||||
|
@Override
|
||||||
|
void run() {
|
||||||
|
try {
|
||||||
|
DBObject dbObject = new BasicDBObject()
|
||||||
|
conn.find(new BasicDBObject("id", id)).limit(1).each { obj ->
|
||||||
|
dbObject.put("_id", id)
|
||||||
|
dbObject.put("name", obj.name)
|
||||||
|
dbObject.put("type", obj.type)
|
||||||
|
dbObject.put("typecode", obj.typecode)
|
||||||
|
dbObject.put("address", obj.address)
|
||||||
|
dbObject.put("lng", Double.valueOf(obj.location.split(",")[0]))
|
||||||
|
dbObject.put("lat", Double.valueOf(obj.location.split(",")[1]))
|
||||||
|
dbObject.put("tel", obj.tel)
|
||||||
|
dbObject.put("province", obj.pname)
|
||||||
|
dbObject.put("city", obj.cityname)
|
||||||
|
dbObject.put("region", obj.adname)
|
||||||
|
}
|
||||||
|
list.add(dbObject)
|
||||||
|
} catch(Exception ex) {
|
||||||
|
ex.printStackTrace()
|
||||||
|
} finally {
|
||||||
|
latch.countDown()
|
||||||
|
println("当前记录数" + list.size())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
};
|
||||||
|
latch.await();
|
||||||
|
conn43.insert(list);
|
||||||
|
list.clear();
|
||||||
|
println("同步清理完成");
|
||||||
|
executorService.shutdown()
|
||||||
|
}
|
||||||
|
}
|
||||||
+39
-8
@@ -1,5 +1,6 @@
|
|||||||
package com.fangjia.script.temp.shenjian.cqrcb
|
package com.fangjia.script.temp.shenjian.cqrcb
|
||||||
|
|
||||||
|
import com.fangjia.core.util.DateUtil
|
||||||
import com.fangjia.script.util.DbUtils
|
import com.fangjia.script.util.DbUtils
|
||||||
import com.fangjia.script.util.ExcelUtils
|
import com.fangjia.script.util.ExcelUtils
|
||||||
import com.fangjia.script.util.MongoUtils
|
import com.fangjia.script.util.MongoUtils
|
||||||
@@ -38,7 +39,11 @@ class SeaweedExport {
|
|||||||
def city = district.get(1)
|
def city = district.get(1)
|
||||||
def district_code = district.get(2)
|
def district_code = district.get(2)
|
||||||
def name = district.get(3)
|
def name = district.get(3)
|
||||||
|
def matchedCity = district.get(22)
|
||||||
|
def matchedRegion = district.get(23)
|
||||||
|
def matchedName = district.get(24)
|
||||||
def region;
|
def region;
|
||||||
|
|
||||||
if (map.get("district_code") != null) {
|
if (map.get("district_code") != null) {
|
||||||
region = map.get("district_code")
|
region = map.get("district_code")
|
||||||
} else {
|
} else {
|
||||||
@@ -47,12 +52,17 @@ class SeaweedExport {
|
|||||||
map.put("district_code", region)
|
map.put("district_code", region)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (matchedRegion == null) {
|
||||||
|
matchedRegion = region
|
||||||
|
matchedName = name
|
||||||
|
}
|
||||||
|
def ret = []
|
||||||
DBObject query = new BasicDBObject()
|
DBObject query = new BasicDBObject()
|
||||||
query.put("city", city)
|
query.put("city", city)
|
||||||
|
query.put("region", matchedRegion)
|
||||||
query.put("cat", "district")
|
query.put("cat", "district")
|
||||||
query.put("visible", 0)
|
query.put("visible", 0)
|
||||||
query.put("name", name)
|
query.put("name", matchedName)
|
||||||
|
|
||||||
DBObject filter = new BasicDBObject()
|
DBObject filter = new BasicDBObject()
|
||||||
filter.put("_id", 1)
|
filter.put("_id", 1)
|
||||||
@@ -71,12 +81,11 @@ class SeaweedExport {
|
|||||||
filter.put("lng", 1)
|
filter.put("lng", 1)
|
||||||
filter.put("lat", 1)
|
filter.put("lat", 1)
|
||||||
|
|
||||||
def ret = []
|
|
||||||
DbUtils.seaweed.find(query).limit(1).each { obj ->
|
DbUtils.seaweed.find(query).limit(1).each { obj ->
|
||||||
ret[0] = obj.developer
|
ret[0] = obj.developer
|
||||||
ret[1] = obj.estate_company
|
ret[1] = obj.estate_company
|
||||||
ret[2] = obj.cubage_percent
|
ret[2] = obj.cubage_percent
|
||||||
ret[3] = obj.virescence_percent
|
ret[3] = virescencePercentValidator(obj.virescence_percent)
|
||||||
|
|
||||||
if (obj.alias) {
|
if (obj.alias) {
|
||||||
// 小区可能存在多个别名
|
// 小区可能存在多个别名
|
||||||
@@ -94,7 +103,7 @@ class SeaweedExport {
|
|||||||
ret[10] = obj.household_count
|
ret[10] = obj.household_count
|
||||||
ret[11] = ""
|
ret[11] = ""
|
||||||
ret[12] = obj.estate_charge
|
ret[12] = obj.estate_charge
|
||||||
ret[13] = obj.open_date
|
ret[13] = DateUtil.formatToYYYYMMDD(obj.open_date)
|
||||||
ret[14] = obj.live_date
|
ret[14] = obj.live_date
|
||||||
ret[15] = obj.lng
|
ret[15] = obj.lng
|
||||||
ret[16] = obj.lat
|
ret[16] = obj.lat
|
||||||
@@ -108,9 +117,9 @@ class SeaweedExport {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
};
|
||||||
latch.await()
|
latch.await();
|
||||||
def ret = []
|
def ret = [];
|
||||||
ret << ["物业公司名称","开发商名称","容积率","绿化率","楼盘别名","停车位数量","车位配比率","车位价","总占地面积","总楼栋数","总户数","非住宅总户数","物业费","开盘日期","交付时间", "经度", "纬度", "小区名称"]
|
ret << ["物业公司名称","开发商名称","容积率","绿化率","楼盘别名","停车位数量","车位配比率","车位价","总占地面积","总楼栋数","总户数","非住宅总户数","物业费","开盘日期","交付时间", "经度", "纬度", "小区名称"]
|
||||||
for (List<Object> district : data) {
|
for (List<Object> district : data) {
|
||||||
def district_code = district.get(2)
|
def district_code = district.get(2)
|
||||||
@@ -121,5 +130,27 @@ class SeaweedExport {
|
|||||||
executorService.shutdown()
|
executorService.shutdown()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* string
|
||||||
|
* 绿化率 仅限数字,包括(小数)数字范围:10-100
|
||||||
|
* @param virescence_percent
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private static def virescencePercentValidator(def virescence_percent){
|
||||||
|
if(virescence_percent=="null"){
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
def value = com.fangjia.script.datastore.DistrictFieldNumberic.checkValue(virescence_percent);
|
||||||
|
if(value){
|
||||||
|
if(value>=10 && value<=100){
|
||||||
|
return value;
|
||||||
|
} else if (value > 0 && value < 1) {
|
||||||
|
return value * 100
|
||||||
|
} else{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -33,8 +33,8 @@ class DistanceDeal {
|
|||||||
// updateField.put("school_lat", "31.330963")
|
// updateField.put("school_lat", "31.330963")
|
||||||
// collection.update(new BasicDBObject("school_url", "https://hf.esf.fang.com/school/10483.htm"), new BasicDBObject('$set', updateField), false, true)
|
// collection.update(new BasicDBObject("school_url", "https://hf.esf.fang.com/school/10483.htm"), new BasicDBObject('$set', updateField), false, true)
|
||||||
|
|
||||||
// double length = Distance.GetDistance();
|
double length = Distance.GetDistance();
|
||||||
// print(length)
|
print(length)
|
||||||
|
|
||||||
// DBObject updateField = new BasicDBObject()
|
// DBObject updateField = new BasicDBObject()
|
||||||
// updateField.put("school_lng", 120.68764)
|
// updateField.put("school_lng", 120.68764)
|
||||||
|
|||||||
+1
-2
@@ -1,7 +1,6 @@
|
|||||||
package com.fangjia.script.temp.shenjian.util
|
package com.fangjia.script.temp.shenjian.util
|
||||||
|
|
||||||
import com.fangjia.core.util.DataUtil
|
import com.fangjia.core.util.DataUtil
|
||||||
import com.fangjia.script.util.GeoUtils
|
|
||||||
import com.fangjia.script.util.HttpRequestUtil
|
import com.fangjia.script.util.HttpRequestUtil
|
||||||
import net.sf.json.JSONObject
|
import net.sf.json.JSONObject
|
||||||
|
|
||||||
@@ -13,7 +12,7 @@ import net.sf.json.JSONObject
|
|||||||
*/
|
*/
|
||||||
class GaoDeUtils {
|
class GaoDeUtils {
|
||||||
|
|
||||||
def static GAO_DE_AK = "4ccfe3c898a9489884bd2bcb1ef6dcde"
|
def static GAO_DE_AK = "2a1fb75990f2b39f6221e50892dd3988"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user