Merge branch 'script_gj' into 'master'
Script gj See merge request !857
This commit is contained in:
+74
-1
@@ -18,6 +18,7 @@ import groovy.json.JsonSlurper
|
|||||||
import net.sf.json.JSONArray
|
import net.sf.json.JSONArray
|
||||||
import net.sf.json.JSONObject
|
import net.sf.json.JSONObject
|
||||||
import org.apache.commons.lang.StringUtils
|
import org.apache.commons.lang.StringUtils
|
||||||
|
import org.apache.poi.ss.util.RegionUtil
|
||||||
import org.bson.Document
|
import org.bson.Document
|
||||||
import org.bson.types.ObjectId
|
import org.bson.types.ObjectId
|
||||||
|
|
||||||
@@ -117,6 +118,7 @@ class CommonDatautils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static final DBCollection COMMUNITY_CONN = MongoUtils.getCollectionByName2("fangjia", "community", "mongodb://admin:G00MONGOADMIN@192.168.0.100:30009")
|
public static final DBCollection COMMUNITY_CONN = MongoUtils.getCollectionByName2("fangjia", "community", "mongodb://admin:G00MONGOADMIN@192.168.0.100:30009")
|
||||||
|
public static final DBCollection ADMINISTRATIVE_MAPPING_COLL = MongoUtils.getCollectionByName("business", "administrative_mapping", "mongo.db.fangjia.com")
|
||||||
|
|
||||||
public static DSCollection getHouseDataStoreConnection(){
|
public static DSCollection getHouseDataStoreConnection(){
|
||||||
if(house_dataStoreConnection != null) {
|
if(house_dataStoreConnection != null) {
|
||||||
@@ -274,7 +276,7 @@ class CommonDatautils {
|
|||||||
q.put("status", 0);
|
q.put("status", 0);
|
||||||
q.put("cat", cat);
|
q.put("cat", cat);
|
||||||
q.put("city", city);
|
q.put("city", city);
|
||||||
// q.put("name","泰瑞家园")
|
q.put("name","上唐山水")
|
||||||
|
|
||||||
DBObject keys = new BasicDBObject();
|
DBObject keys = new BasicDBObject();
|
||||||
if(fields){
|
if(fields){
|
||||||
@@ -4605,6 +4607,77 @@ class CommonDatautils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static def queryFullNameByCity(){
|
||||||
|
def q = new BasicDBObject()
|
||||||
|
q.put("type","城市")
|
||||||
|
def dbcursor = ADMINISTRATIVE_MAPPING_COLL.find(q)
|
||||||
|
def cityMap = [:]
|
||||||
|
for(def d : dbcursor){
|
||||||
|
def city = RegionData.formatCity(d.city)
|
||||||
|
if(city){
|
||||||
|
cityMap.put(city, d)
|
||||||
|
}else{
|
||||||
|
//println d.city +" 格式化不出"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return cityMap
|
||||||
|
}
|
||||||
|
|
||||||
|
static def queryDistNameByCity(){
|
||||||
|
|
||||||
|
def q = new BasicDBObject()
|
||||||
|
q.put("type","区域")
|
||||||
|
def keys = new BasicDBObject()
|
||||||
|
keys.put("province",1)
|
||||||
|
keys.put("city",1)
|
||||||
|
keys.put("district",1)
|
||||||
|
keys.put("street",1)
|
||||||
|
keys.put("mzb_district_name", 1)
|
||||||
|
def dbcursor = ADMINISTRATIVE_MAPPING_COLL.find(q, keys).batchSize(2000)
|
||||||
|
def regionMap = [:]
|
||||||
|
for(def d : dbcursor){
|
||||||
|
if(d.mzb_district_name){
|
||||||
|
def regions = regionMap.get(d.city)
|
||||||
|
if(!regions){
|
||||||
|
regions = []
|
||||||
|
}
|
||||||
|
regions << d
|
||||||
|
regionMap.put(d.city, regions)
|
||||||
|
}else{
|
||||||
|
println d.province+" "+d.district +" 格式化不出民政部区域"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return regionMap
|
||||||
|
}
|
||||||
|
|
||||||
|
static def queryCommunityByCity(){
|
||||||
|
|
||||||
|
def q = new BasicDBObject()
|
||||||
|
q.put("type","乡镇街道")
|
||||||
|
|
||||||
|
def keys = new BasicDBObject()
|
||||||
|
keys.put("province",1)
|
||||||
|
keys.put("city",1)
|
||||||
|
keys.put("district",1)
|
||||||
|
keys.put("street",1)
|
||||||
|
keys.put("shape",1)
|
||||||
|
def dbcursor = ADMINISTRATIVE_MAPPING_COLL.find(q, keys).batchSize(5000)
|
||||||
|
def townMap = [:]
|
||||||
|
for(def d : dbcursor){
|
||||||
|
def key = d.city+"#"+d.district
|
||||||
|
def list = townMap.get(key)
|
||||||
|
if(!list){
|
||||||
|
list = []
|
||||||
|
}
|
||||||
|
list << d
|
||||||
|
townMap.put(key, list)
|
||||||
|
}
|
||||||
|
return townMap
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static def queryDistNameCity(){
|
static def queryDistNameCity(){
|
||||||
def q = new BasicDBObject()
|
def q = new BasicDBObject()
|
||||||
|
|||||||
+40
-1
@@ -52,6 +52,7 @@ class DevProcess {
|
|||||||
|
|
||||||
// task.addAlias()
|
// task.addAlias()
|
||||||
// task.addDevShape()//添加开发区围栏
|
// task.addDevShape()//添加开发区围栏
|
||||||
|
// task.matchDevTownship()//添加乡镇街道
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -172,7 +173,7 @@ class DevProcess {
|
|||||||
def devSplitRoad(){
|
def devSplitRoad(){
|
||||||
def i = 0;
|
def i = 0;
|
||||||
while(i<1){
|
while(i<1){
|
||||||
def fileName = "/home/goojia/gj/hebei-${i}.xlsx"
|
def fileName = "/home/goojia/gj/qzd-${i}.xlsx"
|
||||||
if(CommonDatautils.isWindow()){
|
if(CommonDatautils.isWindow()){
|
||||||
fileName = "D:\\数据\\数据建设\\开发区\\江苏-无锡.xlsx"
|
fileName = "D:\\数据\\数据建设\\开发区\\江苏-无锡.xlsx"
|
||||||
}
|
}
|
||||||
@@ -660,6 +661,44 @@ class DevProcess {
|
|||||||
},0);
|
},0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def matchDevTownship(){
|
||||||
|
ExcelUtils.modify("D:\\数据\\数据建设\\开发区\\区域匹配开发区.xlsx",{d->
|
||||||
|
if(d['C']){
|
||||||
|
def q = new BasicDBObject()
|
||||||
|
q.put("name", d['C'])
|
||||||
|
def obj = development_zone_CONN.findOne(q)
|
||||||
|
if(obj){
|
||||||
|
d['E'] = obj._id.toString()
|
||||||
|
def street = d['D']
|
||||||
|
q.put("township", street)
|
||||||
|
def sameObj = DEV_MAPPING_CONN.findOne(q)
|
||||||
|
if(!sameObj){
|
||||||
|
def udata = new BasicDBObject()
|
||||||
|
udata.put("province", obj.province)
|
||||||
|
if(obj.city){
|
||||||
|
udata.put("city", obj.city)
|
||||||
|
}
|
||||||
|
if(obj.district){
|
||||||
|
udata.put("district", obj.district)
|
||||||
|
}
|
||||||
|
|
||||||
|
udata.put("name",obj.name)
|
||||||
|
// udata.put("type", "乡镇街道")
|
||||||
|
// udata.put("township", street)
|
||||||
|
|
||||||
|
udata.put("type", "区域")
|
||||||
|
udata.put("dev_district", street)
|
||||||
|
udata.put("c_date",new Date())
|
||||||
|
DEV_MAPPING_CONN.save(udata)
|
||||||
|
println obj.name +" "+street
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},1);
|
||||||
|
}
|
||||||
|
|
||||||
def addAlias(){
|
def addAlias(){
|
||||||
ExcelUtils.modify("D:\\数据\\数据建设\\开发区\\开发区别名.xlsx",{d->
|
ExcelUtils.modify("D:\\数据\\数据建设\\开发区\\开发区别名.xlsx",{d->
|
||||||
def q = new BasicDBObject()
|
def q = new BasicDBObject()
|
||||||
|
|||||||
+1
-1
@@ -354,7 +354,7 @@ class FangjiaClientUtils {
|
|||||||
def content = null
|
def content = null
|
||||||
try {
|
try {
|
||||||
address = address.replace("{","")
|
address = address.replace("{","")
|
||||||
def url = "http://192.168.0.19:31080/FangJiaNlpService/formatNinelevel?address="+URLEncoder.encode(address,"UTF-8")+"&complete=false&useMap=false&addressAssessment=true"
|
def url = "http://192.168.0.93:8080/FangJiaNlpService/formatNinelevel?address="+URLEncoder.encode(address,"UTF-8")+"&complete=false&useMap=false&addressAssessment=true"
|
||||||
if(city){
|
if(city){
|
||||||
url = url +"&city="+URLEncoder.encode(city,"UTF-8")
|
url = url +"&city="+URLEncoder.encode(city,"UTF-8")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user