From d0744e2df5258c380241f9a0a15797f74dd6fb1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E5=81=A5?= Date: Sun, 16 May 2021 19:29:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cqrcb/AroundExportByNewWay.groovy | 9 +-- .../shenjian/cqrcb/MarkUnNeedExport.groovy | 3 - .../script/temp/shenjian/cqrcb/POIRule.groovy | 61 +++++++++++++++++++ .../temp/shenjian/cqrcb/SeaweedExport.groovy | 5 +- .../temp/shenjian/util/GaoDeUtils.groovy | 14 ++++- 5 files changed, 81 insertions(+), 11 deletions(-) create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/POIRule.groovy diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/AroundExportByNewWay.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/AroundExportByNewWay.groovy index 94e4b9342..564da168d 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/AroundExportByNewWay.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/AroundExportByNewWay.groovy @@ -30,12 +30,6 @@ class AroundExportByNewWay { static def resultMap = new ConcurrentHashMap() static ExecutorService executorService = Executors.newFixedThreadPool(30) - static Map map = new HashedMap() - - static { - map.put("") - } - static void main(String[] args) { List> data = ExcelUtils.read("F:\\数据\\重庆农商行\\测试数据汇总_2021.xlsx", 9) AtomicInteger count = new AtomicInteger(0) @@ -119,6 +113,9 @@ class AroundExportByNewWay { return false } if (name.indexOf("地铁口") == -1 && name.indexOf("公交站") == -1 && name.indexOf("支行") == -1) { + if (name.indexOf("栋") != -1) { + return false + } if (name.indexOf("医院") != -1 && !name.endsWith("医院")) { if (name.indexOf("分院") == -1) { return false diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/MarkUnNeedExport.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/MarkUnNeedExport.groovy index c9eb96812..9ce164947 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/MarkUnNeedExport.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/MarkUnNeedExport.groovy @@ -25,9 +25,6 @@ class MarkUnNeedExport { if (district.size() > 1) { def type = district.get(0) def status = district.get(1) - if (type == '交通设施服务;公交车站;公交车站相关') { - println(type) - } if (status == 1.0) { poiConn.update(new BasicDBObject("type", type), new BasicDBObject('$set', new BasicDBObject("status", 0)), false, true) } else { diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/POIRule.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/POIRule.groovy new file mode 100644 index 000000000..ca637b48e --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/POIRule.groovy @@ -0,0 +1,61 @@ +package com.fangjia.script.temp.shenjian.cqrcb + +import com.fangjia.script.util.MongoUtils +import com.mongodb.BasicDBObject +import com.mongodb.DBCollection +import com.mongodb.DBObject + +import java.util.regex.Pattern + +/** + * POI清理规则 + * + * @author shenjian + * @since 2021/5/16 + */ +class POIRule { + + static DBCollection poiConn = MongoUtils.getCollectionByName("address_analytics", "gaode_address_poi", "192.168.0.43", 28017) + + static void main(String[] args) { + // 小学校转为学校 + poiConn.find(new BasicDBObject("typecode", "141203").append("status", 0)).batchSize(1000).each {obj -> + if (obj.name.indexOf('小学校') != -1 ) { + def id = obj._id + def region = obj.region + def name = obj.name.replace("小学校", '小学') + if (poiConn.count(new BasicDBObject("region": region, "name": name)) > 0) { + poiConn.update(new BasicDBObject("_id", id), new BasicDBObject('$set', new BasicDBObject("status", 1)), false, true) + } else { + poiConn.update(new BasicDBObject("_id", id), new BasicDBObject('$set', new BasicDBObject("status", 0).append("name", name)), false, true) + } + } + } + } + + static BasicDBObject getLikeStr(String findStr){ + Pattern pattern = Pattern.compile('^.*' + findStr + '.*$', Pattern.CASE_INSENSITIVE); + return new BasicDBObject('$regex', pattern); + } + +// 更新规则 +// db.getCollection('gaode_address_poi').update({'name': /栋/, 'status': 0}, {$set: {'status': NumberInt(1), 'flag': '包含栋'}}, {multi:true,upsert:false}); +//db.getCollection('gaode_address_poi').update({'name': /幢/, 'status': 0}, {$set: {'status': NumberInt(1), 'flag': '包含幢'}}, {multi:true,upsert:false}); +//db.getCollection('gaode_address_poi').update({'name': /[ABCD]+馆/, 'typecode': {$in: ['060102', '060101']}, 'status': 0}, {$set: {'status': NumberInt(1), 'flag': '包含馆'}}, {multi:true,upsert:false}); +//db.getCollection('gaode_address_poi').update({'name': /[ABCDE1234567890]+区/, 'typecode': {$nin: ['150700']}, 'status': 0}, {$set: {'status': NumberInt(1), 'flag': '包含区'}}, {multi:true,upsert:false}); +//db.getCollection('gaode_address_poi').update({'name': /入口/, 'typecode': {$nin: ['150700']}, 'status': 0}, {$set: {'status': NumberInt(1), 'flag': '包含入口'}}, {multi:true,upsert:false}); +//db.getCollection('gaode_address_poi').update({'type': /医疗保健服务;专科医院;整形美容/}, {$set: {'status': NumberInt(1)}}, {multi:true,upsert:false}); +//db.getCollection('gaode_address_poi').update({'type': /科教文化服务;学校;职业技术学校/}, {$set: {'status': NumberInt(1)}}, {multi:true,upsert:false}); +//db.getCollection('gaode_address_poi').update({'type': /购物服务;商场;免税品店/}, {$set: {'status': NumberInt(1)}}, {multi:true,upsert:false}); +//db.getCollection('gaode_address_poi').update({'type': /医疗保健服务;专科医院;口腔医院/}, {$set: {'status': NumberInt(1)}}, {multi:true,upsert:false}); +//db.getCollection('gaode_address_poi').update({'type': /医疗保健服务;综合医院;卫生院/}, {$set: {'status': NumberInt(1)}}, {multi:true,upsert:false}); +//db.getCollection('gaode_address_poi').update({'name': /[学]+楼/, 'status': 0}, {$set: {'status': NumberInt(1)}}, {multi:true,upsert:false}); +//db.getCollection('gaode_address_poi').update({'name': /[教医光]+学中心/, 'status': 0}, {$set: {'status': NumberInt(1)}}, {multi:true,upsert:false}); +//db.getCollection('gaode_address_poi').update({'type': /科教文化服务;学校;学校/, 'status': 0}, {$set: {'status': NumberInt(1)}}, {multi:true,upsert:false}); +//db.getCollection('gaode_address_poi').update({'name': /[1234]期/, 'status': 0}, {$set: {'status': NumberInt(1)}}, {multi:true,upsert:false}); +//db.getCollection('gaode_address_poi').update({'name': /住院部/, 'status': 0}, {$set: {'status': NumberInt(1)}}, {multi:true,upsert:false}); +//db.getCollection('gaode_address_poi').update({'name': /\//, 'status': 0}, {$set: {'status': NumberInt(1)}}, {multi:true,upsert:false}); +//db.getCollection('gaode_address_poi').update({'name': /智能柜/, 'status': 0}, {$set: {'status': NumberInt(1)}}, {multi:true,upsert:false}); +//db.getCollection('gaode_address_poi').update({'name': /摄影/, 'status': 0}, {$set: {'status': NumberInt(1)}}, {multi:true,upsert:false}); +//db.getCollection('gaode_address_poi').update({'typecode': '141204', 'status': 0}, {$set: {'status': NumberInt(1)}}, {multi:true,upsert:false}); +} diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/SeaweedExport.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/SeaweedExport.groovy index feb17ea7f..69638ec6f 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/SeaweedExport.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/cqrcb/SeaweedExport.groovy @@ -85,6 +85,9 @@ class SeaweedExport { ret[0] = obj.developer ret[1] = obj.estate_company ret[2] = obj.cubage_percent + if (obj.developer == '重庆汇凯置业有限公司') { + println('重庆汇凯置业有限公司') + } ret[3] = virescencePercentValidator(obj.virescence_percent) if (obj.alias) { @@ -145,7 +148,7 @@ class SeaweedExport { if(value>=10 && value<=100){ return value; } else if (value > 0 && value < 1) { - return value * 100 + return com.fangjia.script.common.DataHandleUtils.getDoubleRound(2, Double.valueOf(value) * 100) } else{ return ""; } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/GaoDeUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/GaoDeUtils.groovy index 721ab6958..1ccbf1713 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/GaoDeUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/util/GaoDeUtils.groovy @@ -19,7 +19,19 @@ class GaoDeUtils { def static codeNameMap = new HashMap(){{ put("150500", "地铁"); put("1507", "公交"); - put("医院", "090100|090101|090200|090202|090203|090204|090205|090206|090207|090208|090209|090210|090211"); + put("090100", "医院") + put("090101", "医院") + put("090200", "医院") + put("090202", "医院") + put("090202", "医院") + put("090204", "医院") + put("090205", "医院") + put("090206", "医院") + put("090206", "医院") + put("090208", "医院") + put("090209", "医院") + put("090210", "医院") + put("090211", "医院") put("141200", "学校") put("141201", "学校") put("141202", "学校")