diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/govLocation.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/govLocation.groovy deleted file mode 100644 index f4d476f66..000000000 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/govLocation.groovy +++ /dev/null @@ -1,113 +0,0 @@ -package com.fangjia.script.gj.village - -import com.fangjia.script.gj.EsSearchUtils -import com.fangjia.script.looplineinfo.InsidePolygon -import com.fangjia.script.util.ExcelUtils -import com.fangjia.script.util.MongoUtils -import com.fangjia.script.yinjihaun.amap.GaoDeApiUtils -import com.mongodb.BasicDBObject -import com.mongodb.DBCollection - -/** - * 乡镇街道对比 - */ -DBCollection TOWN_POLYLINECOLL = MongoUtils.getCollectionByAuth20190102("fangjia_crawl", "town_polyline") - -def MONGO100_URL = "mongodb://admin:G00MONGOADMIN@192.168.0.100:30009"; -DBCollection COMMUNITY_CONN = MongoUtils.getCollectionByName2("fangjia", "community", MONGO100_URL) - -def filePath = "D:\\数据\\涉农\\县.xlsx" -ExcelUtils.multiThreadingModify(filePath, { row -> -// if(!row['D']){ -// def rets = EsSearchUtils.findPois(row['B'], row['C'], row['C']+"人民政府") -// if(rets){ -// def obj = findOneByName(rets, row['C']+"人民政府") -// if(obj){ -// row['D'] = obj.lng -// row['E'] = obj.lat -// println row['C'] + " "+obj -// } -// } -// } - -// if(row['D'] && !row['F']){ -// def townMap = findTownRange(row['B'], TOWN_POLYLINECOLL) -// def map = ["lon":row['D'], "lat":row['E']] -// def township = InsidePolygon.isInArea2(map.lon, map.lat, townMap) -// row['F'] = township -// } - - if(row['F'] && !row['K']){ - def q = new BasicDBObject() - q.put("city_name", row['B']) - q.put("area_name", row['C']) - def streetName = row['I'] - q.put("street_name", streetName) - def count = COMMUNITY_CONN.count(q); - row['K'] = count -// row['H'] = streetName - } -// def gaodeMap = getTownshipInfo(row['D']+","+row['E']) -// if(gaodeMap && gaodeMap.township){ -// row['I'] = gaodeMap.township -// } - -}) - - -def getTownshipInfo(def glocation){ - def township = null - def district = null - def jsonObject = null - def stop = false - def count = 0 - while(!stop){ - if(glocation){ - jsonObject = GaoDeApiUtils.geocode(glocation) - if(jsonObject && jsonObject.regeocode) { - def addressComponent = jsonObject.regeocode.addressComponent - if(addressComponent){ - township = addressComponent.township - district = addressComponent.district - } - } - } - if(district || count>10){ - stop = true - }else{ - count ++ - Thread.sleep(3000) - print "." - } - } - - def map = [:] - map.district = district - map.township = township - return map; -} - - -def findOneByName(def rets, name){ - def obj = null - for(def r : rets){ - if(r.name == name){ - obj = r - break; - } - } - return obj -} - - -def findTownRange(city, TOWN_POLYLINECOLL){ - def q = new BasicDBObject() - q.put("city",city) - def dbcursor = TOWN_POLYLINECOLL.find(q) - def townMap = [:] - for(def d : dbcursor){ - def pointList = InsidePolygon.createPoint3(d.polyline); - townMap.put(d.fjw_region +"##"+ d.town, pointList) - } - return townMap -}