小区导出位置修改
This commit is contained in:
+6
-1
@@ -53,10 +53,15 @@ class BigdataCommunityBatch extends BaseBatch{
|
||||
// FileUtils.batchCreateFile(rets, "d:\\数据\\建行\\房产估值\\数据文件\\txt\\bigdata_community_${city}.txt",headers, "utf-8", false);
|
||||
}
|
||||
|
||||
def fileName = "/home/goojia/ccb/bigdata_community.txt"
|
||||
if(CommonDatautils.isWindow()){
|
||||
fileName = "d:\\数据\\建行\\房产估值\\数据文件\\txt\\bigdata_community.txt"
|
||||
}
|
||||
|
||||
def allDatas = []
|
||||
allDatas << headers
|
||||
allDatas.addAll(rows)
|
||||
FileUtils.batchCreateFile(rows, "d:\\数据\\建行\\房产估值\\数据文件\\txt\\bigdata_community.txt",headers, "utf-8", false);
|
||||
FileUtils.batchCreateFile(rows, fileName,headers, "utf-8", false);
|
||||
println "txt 生成"
|
||||
// ExcelUtils.write("d:\\数据\\建行\\房产估值\\数据文件\\excel\\bigdata_community.xlsx", allDatas, "数据")
|
||||
}
|
||||
|
||||
+1
@@ -76,6 +76,7 @@ class TradeStatLog {
|
||||
println ret
|
||||
}
|
||||
|
||||
|
||||
ExcelUtils.write("D:\\数据\\建行\\房产估值\\数据文件\\成交统计.xlsx", rets, "数据")
|
||||
println "表格生成完成"
|
||||
}
|
||||
|
||||
+105
-29
@@ -4,6 +4,7 @@ import com.fangjia.core.RegionData
|
||||
import com.fangjia.core.util.BaiDuApiUtils
|
||||
import com.fangjia.core.util.GeocodeUtils
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.common.DataHandleUtils
|
||||
import com.fangjia.script.gj.district.FangjiaClientUtils
|
||||
import com.fangjia.script.looplineinfo.InsidePolygon
|
||||
import com.fangjia.script.looplineinfo.Point
|
||||
@@ -14,7 +15,13 @@ import com.fangjia.script.util.GeoHelper
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import groovy.sql.Sql
|
||||
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.concurrent.CountDownLatch
|
||||
import java.util.concurrent.ExecutorService
|
||||
import java.util.concurrent.Executors
|
||||
import java.util.concurrent.atomic.AtomicLong
|
||||
import java.util.regex.Matcher
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@@ -22,7 +29,10 @@ import java.util.regex.Pattern;
|
||||
class LocationTest {
|
||||
|
||||
static DBCollection POLYLINECOLL = MongoUtils.getCollectionByAuth20190102("fangjia_crawl", "region_polyline")
|
||||
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(40)
|
||||
|
||||
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.100:31521:orcl",
|
||||
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
|
||||
static main(args) {
|
||||
// Date date=new Date(1622802609);
|
||||
// SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
@@ -34,6 +44,7 @@ class LocationTest {
|
||||
// task.run2()
|
||||
// task.run3()
|
||||
// task.run4()
|
||||
// task.run5()
|
||||
}
|
||||
|
||||
def run(){
|
||||
@@ -41,40 +52,57 @@ class LocationTest {
|
||||
def regionPointsMap = findRegionRange(city)
|
||||
def districts = CommonDatautils.findAllDistricts(city, "district", ["city", "region", "name", "address", "lat", "lng"]);
|
||||
def index = 0
|
||||
def rets = []
|
||||
for(def dist : districts){
|
||||
def flag = isInArea(dist.lng/10000000000.0, dist.lat/10000000000.0, regionPointsMap.get(dist.region))
|
||||
if(!flag){
|
||||
index++
|
||||
def rets = Collections.synchronizedList(new ArrayList());
|
||||
def totalCount = new AtomicLong()
|
||||
final CountDownLatch latch = new CountDownLatch(districts.size())
|
||||
|
||||
def ret = []
|
||||
ret << dist.city
|
||||
ret << dist.region
|
||||
ret << dist.name
|
||||
for(def i=0;i<districts.size();i++){
|
||||
final def dist = districts[i]
|
||||
|
||||
def loactionMap = matchMap(dist)
|
||||
if(loactionMap){
|
||||
ret << loactionMap.source
|
||||
ret << loactionMap.region
|
||||
ret << loactionMap.mapName
|
||||
ret << loactionMap.address
|
||||
def distance = GeoHelper.GetDistance(dist.lat/10000000000.0, dist.lng/10000000000.0, loactionMap.lat, loactionMap.lng)
|
||||
ret << distance
|
||||
ret << loactionMap.lng
|
||||
ret << loactionMap.lat
|
||||
if(dist.region==loactionMap.region){
|
||||
println index+" "+dist.region +" "+dist.name +" 不在区域范围内,与地图相同"
|
||||
}else{
|
||||
println index+" "+dist.region +" "+dist.name +" 不在区域范围内 地图:"+ loactionMap.region+" "+distance
|
||||
fixedThreadPool.execute(new Runnable() {
|
||||
void run() {
|
||||
try{
|
||||
totalCount.addAndGet(1)
|
||||
def flag = isInArea(dist.lng/10000000000.0, dist.lat/10000000000.0, regionPointsMap.get(dist.region))
|
||||
if(!flag) {
|
||||
index++
|
||||
def ret = []
|
||||
ret << dist.city
|
||||
ret << dist.region
|
||||
ret << dist.name
|
||||
|
||||
def loactionMap = matchMap(dist)
|
||||
if (loactionMap) {
|
||||
ret << loactionMap.source
|
||||
ret << loactionMap.region
|
||||
ret << loactionMap.mapName
|
||||
ret << loactionMap.address
|
||||
def distance = GeoHelper.GetDistance(dist.lat / 10000000000.0, dist.lng / 10000000000.0, loactionMap.lat, loactionMap.lng)
|
||||
ret << distance
|
||||
ret << loactionMap.lng
|
||||
ret << loactionMap.lat
|
||||
if (dist.region == loactionMap.region) {
|
||||
println totalCount.get() + " " + dist.region + " " + dist.name + " 不在区域范围内,与地图相同"
|
||||
} else {
|
||||
println totalCount.get() + " " + dist.region + " " + dist.name + " 不在区域范围内 地图:" + loactionMap.region + " " + distance
|
||||
}
|
||||
} else {
|
||||
ret << ""
|
||||
println totalCount.get() + " " + dist.region + " " + dist.name + " 不在区域范围内,地图没找到"
|
||||
}
|
||||
if (ret) {
|
||||
rets << ret
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace()
|
||||
} finally {
|
||||
latch.countDown()
|
||||
}
|
||||
}else{
|
||||
ret << ""
|
||||
println index+" "+dist.region +" "+dist.name +" 不在区域范围内,地图没找到"
|
||||
}
|
||||
rets << ret
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
latch.await()
|
||||
ExcelUtils.write("d:\\数据\\福州\\区域经纬度错误-${city}.xlsx", rets, "区域不在行政范围内")
|
||||
}
|
||||
|
||||
@@ -424,4 +452,52 @@ class LocationTest {
|
||||
}
|
||||
return regionMap
|
||||
}
|
||||
|
||||
def run5(){
|
||||
def results = getAllErrorDistricts()
|
||||
def rets = Collections.synchronizedList(new ArrayList());
|
||||
def totalCount = new AtomicLong()
|
||||
final CountDownLatch latch = new CountDownLatch(results.size())
|
||||
for(def i=0;i<results.size();i++){
|
||||
final def map = results[i]
|
||||
fixedThreadPool.execute(new Runnable() {
|
||||
void run() {
|
||||
try{
|
||||
totalCount.addAndGet(1)
|
||||
mapLocation(map)
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace()
|
||||
} finally {
|
||||
latch.countDown()
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
latch.await()
|
||||
return rets;
|
||||
}
|
||||
|
||||
def mapLocation(map){
|
||||
def dist = CommonDatautils.findDistrictById(map.commid)
|
||||
if(dist){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
def getAllErrorDistricts(){
|
||||
def sql = "select cityid,commid from bigdata_community_distcheck where distname<>checkdist or checkdist is null";
|
||||
|
||||
def rets = []
|
||||
|
||||
sqlInstance.eachRow(sql,{r->
|
||||
rets << [r.cityid, r.commid]
|
||||
});
|
||||
|
||||
def map = [:]
|
||||
|
||||
return map
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user