diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/GaoDePoiDataProcess.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/GaoDePoiDataProcess.groovy index af4c68175..dad7ca2d2 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/GaoDePoiDataProcess.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/GaoDePoiDataProcess.groovy @@ -46,7 +46,7 @@ class GaoDePoiDataProcess extends BaseBatch{ public static def TAGS = ["加油站","其它能源站","加气站","洗车场","充电站","餐饮相关场所","休闲餐饮场所","购物相关场所","商场","超级市场","家电电子卖场","花鸟鱼虫市场","家居建材市场","综合市场","特色商业街","生活服务场所","邮局","事务所","人才市场","洗浴推拿场所","体育休闲服务场所","运动场馆","娱乐场所","度假疗养场所","休闲场所","医疗保健服务场所","综合医院","专科医院","诊所","急救中心","疾病预防机构","住宿服务相关","宾馆酒店","旅馆招待所","风景名胜相关","公园广场","风景名胜","产业园区","政府及社会团体相关","政府机关","外国机构","社会团体","公检法机构","交通车辆管理","工商税务机构","科教文化场所","博物馆","展览馆","会展中心","美术馆","图书馆","科技馆","天文馆","文化宫","档案馆","文艺团体","传媒机构","学校","科研机构","培训机构","驾校","机场相关","银行","银行相关","保险公司","证券公司","财务公司","公司企业","知名企业","公司","工厂","农林牧渔基地","收费站","服务区","标志性建筑物","地名地址信息","热点地名","紧急避难场所"] - public final static DBCollection COMPANY_206_COLL = MongoUtils.getCollectionByName("business", "company", "192.168.0.206",27020) + public final static DBCollection COMPANY_206_COLL = MongoUtils.getCollectionByName("business", "company_huzhou", "192.168.0.206",27020) def MAP_POI_URL = "mongodb://admin:G00MONGOADMIN@192.168.0.100:30009"; @@ -66,8 +66,8 @@ class GaoDePoiDataProcess extends BaseBatch{ @Override void process(Object args) { // println ProvinceData.getProvince("成都") - synchMapPoi(); -// synchCompany() +// synchMapPoi(); + synchCompany() // poiCatProcess() // addressAndCatProcess() // synchNetwork() @@ -97,15 +97,21 @@ class GaoDePoiDataProcess extends BaseBatch{ } def synchCompany(){ - + fullCityMap = CommonDatautils.queryFullNameCity() //"三明市","宁德市","泉州市","厦门市","福州市","漳州市","南平市","龙岩市","莆田市", - def citys = ["重庆市"] - for(def c : citys){ - def townMap = findTownRange(c) - def companyDatas = findCompanyDatas(c) - println c+ " 加载公司数据:"+companyDatas.size() - def rows = running(companyDatas, "company", townMap) - save(c, rows) + def citys = ["湖州市"] + for(def sampleCity : citys){ + + def cityObj = fullCityMap.get("湖州"); + def city = null + if(cityObj){ + city = cityObj.city + } + def townMap = findTownRange(city) + def companyDatas = findCompanyDatas(city) + println city+ " 加载公司数据:"+companyDatas.size() + def rows = running(city, companyDatas, "company", townMap) + save(city, rows) println "完成" } } @@ -114,7 +120,7 @@ class GaoDePoiDataProcess extends BaseBatch{ def q = new BasicDBObject() q.put("done", 1) q.put("geo_city", city) - q.put("geo_level", new BasicDBObject('$in', ['门牌号','兴趣点'])) +// q.put("geo_level", new BasicDBObject('$in', ['门牌号','兴趣点'])) return COMPANY_206_COLL.find(q).toList() } @@ -180,11 +186,16 @@ class GaoDePoiDataProcess extends BaseBatch{ retMap.fjw_province = map.province_name retMap.fjw_city = map.city_name - def fjw_region = RegionData.formatRegion(map.city_name, map.geo_district) - if(fjw_region){ - retMap.fjw_district = fjw_region + try{ + def fjw_region = RegionData.formatRegion(map.city_name, map.geo_district) + if(fjw_region){ + retMap.fjw_district = fjw_region + } + }catch(Exception e){ + println map.geo_district } + if(!retMap.fjw_district ){ retMap.fjw_district = RegionData.formatRegion(map.city_name, map.region_name) } @@ -249,6 +260,7 @@ class GaoDePoiDataProcess extends BaseBatch{ retMap.spell_name = com.fangjia.core.util.DataUtil.hanyuQuanpin(map.ent_name, " ") retMap.version = version retMap.status = 1 + retMap.credit_code = map.unified_code return retMap } @@ -331,7 +343,7 @@ class GaoDePoiDataProcess extends BaseBatch{ BulkRequest request = new BulkRequest(); int batchSize = 1000; int processedCount = 0; - def client = ElasticUtils.getClient("192.168.0.12") + def client = ElasticUtils.getClient("192.168.0.89") for (int i = 0; i < rows.size(); i++) { def map = rows[i] request.add(new IndexRequest("map_poi", "_doc", map.id).source(map, XContentType.JSON)); diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/ElasticUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/ElasticUtils.groovy index 242e1b8a1..07790bf91 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/ElasticUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/ElasticUtils.groovy @@ -89,7 +89,7 @@ class ElasticUtils { HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpAsyncClientBuilder) { httpAsyncClientBuilder.disableAuthCaching(); CredentialsProvider credentialsProvider = new BasicCredentialsProvider(); - credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("elastic", "goojia123456")); + credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("elastic", "elasticsearch"));//goojia123456 httpAsyncClientBuilder.setDefaultCredentialsProvider(credentialsProvider); return httpAsyncClientBuilder; }