新增农商行小区周围建筑信息导出

This commit is contained in:
沈健
2021-05-16 16:06:51 +08:00
parent 6a679dc5fc
commit 3758069379
3 changed files with 43 additions and 6 deletions
@@ -1,13 +1,16 @@
package com.fangjia.script.temp.shenjian.cqrcb package com.fangjia.script.temp.shenjian.cqrcb
import com.alibaba.excel.EasyExcel
import com.fangjia.script.commData.CommonDatautils import com.fangjia.script.commData.CommonDatautils
import com.fangjia.script.district.Distance import com.fangjia.script.district.Distance
import com.fangjia.script.gj.ccb.FileUtils
import com.fangjia.script.util.ExcelUtils import com.fangjia.script.util.ExcelUtils
import com.fangjia.script.util.MongoUtils import com.fangjia.script.util.MongoUtils
import com.mongodb.BasicDBObject import com.mongodb.BasicDBObject
import com.mongodb.DBCollection import com.mongodb.DBCollection
import com.mongodb.DBObject import com.mongodb.DBObject
import com.mongodb.QueryOperators import com.mongodb.QueryOperators
import org.apache.commons.collections.map.HashedMap
import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.CountDownLatch import java.util.concurrent.CountDownLatch
@@ -27,6 +30,12 @@ class AroundExportByNewWay {
static def resultMap = new ConcurrentHashMap() static def resultMap = new ConcurrentHashMap()
static ExecutorService executorService = Executors.newFixedThreadPool(30) static ExecutorService executorService = Executors.newFixedThreadPool(30)
static Map<String, String> map = new HashedMap()
static {
map.put("")
}
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:\\数据\\重庆农商行\\测试数据汇总_2021.xlsx", 9)
AtomicInteger count = new AtomicInteger(0) AtomicInteger count = new AtomicInteger(0)
@@ -51,11 +60,11 @@ class AroundExportByNewWay {
// 周围半径为3千米 // 周围半径为3千米
def mapLatLng = CommonDatautils.findMaxLatLngMinLatLng(lat, lng, 3000) def mapLatLng = CommonDatautils.findMaxLatLngMinLatLng(lat, lng, 3000)
DBObject q = new BasicDBObject() DBObject q = new BasicDBObject()
q.put('status', 1) q.put('status', 0)
q.put('lat', new BasicDBObject(QueryOperators.LTE, mapLatLng.maxLat).append(QueryOperators.GTE, mapLatLng.minLat)); 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)); q.put('lng', new BasicDBObject(QueryOperators.LTE, mapLatLng.maxLng).append(QueryOperators.GTE, mapLatLng.minLng));
Map<String, Map> map = new ConcurrentHashMap<>(); 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 -> poiConn.find(q, new BasicDBObject("name": 1, "distance": 1, "type": 1, "typecode": 1, "lat": 1, "lng": 1)).batchSize(500).each {obj ->
double distance = Distance.GetDistance(lng, lat, obj.lng, obj.lat) double distance = Distance.GetDistance(lng, lat, obj.lng, obj.lat)
if (distance <= 3000) { if (distance <= 3000) {
dealSpecial(obj, map, id, distance, result) dealSpecial(obj, map, id, distance, result)
@@ -84,8 +93,8 @@ class AroundExportByNewWay {
}) })
}; };
latch.await() latch.await()
def headArr = ['IDB', '名称','类型', '距离']
def ret = [] def ret = []
ret << ['IDB', '名称','类型', '距离']
for (List<Object> district : data) { for (List<Object> district : data) {
def district_code = district.get(2) def district_code = district.get(2)
def name = district.get(3) def name = district.get(3)
@@ -94,7 +103,9 @@ class AroundExportByNewWay {
} }
} }
println(ret.size()) println(ret.size())
com.fangjia.script.util.ExcelUtils.write("F:\\数据\\重庆农商行\\周边配套.xlsx", ret, "周边配套"); //com.fangjia.script.util.ExcelUtils.write("F:\\数据\\重庆农商行\\周边配套.xlsx", ret, "周边配套");
FileUtils.batchCreateFile(ret, "F:\\数据\\重庆农商行\\周边配套.dat", headArr, "utf-8")
// EasyExcel.write("F:\\数据\\重庆农商行\\周边配套.xlsx").head(head).sheet("成交信息").doWrite(ret);
executorService.shutdown() executorService.shutdown()
} }
@@ -143,6 +154,9 @@ class AroundExportByNewWay {
return false return false
} }
} }
if (name.indexOf("(出入口)") != -1) {
return false
}
} }
// 中梁山地铁站1A口 // 中梁山地铁站1A口
if (obj.name.indexOf("地铁站") != -1 && obj.name.indexOf("口") != -1) { if (obj.name.indexOf("地铁站") != -1 && obj.name.indexOf("口") != -1) {
@@ -4,7 +4,9 @@ import com.fangjia.script.util.ExcelUtils
import com.fangjia.script.util.MongoUtils import com.fangjia.script.util.MongoUtils
import com.mongodb.BasicDBObject import com.mongodb.BasicDBObject
import com.mongodb.DBCollection import com.mongodb.DBCollection
import com.mongodb.DBObject
import com.mongodb.QueryOperators import com.mongodb.QueryOperators
import sun.swing.BakedArrayList
/** /**
* 标记不需要导出的数据 * 标记不需要导出的数据
@@ -23,8 +25,13 @@ class MarkUnNeedExport {
if (district.size() > 1) { if (district.size() > 1) {
def type = district.get(0) def type = district.get(0)
def status = district.get(1) def status = district.get(1)
if (status == 1) { if (type == '交通设施服务;公交车站;公交车站相关') {
poiConn.update(new BasicDBObject("type", type), new BasicDBObject('$set', new BasicDBObject("status", 1))) println(type)
}
if (status == 1.0) {
poiConn.update(new BasicDBObject("type", type), new BasicDBObject('$set', new BasicDBObject("status", 0)), false, true)
} else {
poiConn.update(new BasicDBObject("type", type), new BasicDBObject('$set', new BasicDBObject("status", 1)), false, true)
} }
} }
} }
@@ -4,6 +4,8 @@ import com.fangjia.core.util.DataUtil
import com.fangjia.script.util.HttpRequestUtil import com.fangjia.script.util.HttpRequestUtil
import net.sf.json.JSONObject import net.sf.json.JSONObject
import java.util.concurrent.ConcurrentHashMap
/** /**
* 高德工具类 * 高德工具类
* *
@@ -14,6 +16,20 @@ class GaoDeUtils {
def static GAO_DE_AK = "2a1fb75990f2b39f6221e50892dd3988" def static GAO_DE_AK = "2a1fb75990f2b39f6221e50892dd3988"
def static codeNameMap = new HashMap<String, String>(){{
put("150500", "地铁");
put("1507", "公交");
put("医院", "090100|090101|090200|090202|090203|090204|090205|090206|090207|090208|090209|090210|090211");
put("141200", "学校")
put("141201", "学校")
put("141202", "学校")
put("141203", "学校")
put("141204", "学校")
put("1601", "银行")
put("1603", "银行")
put("0601", "商场")
}};
/** /**
* *
* @param city * @param city