From ae5041e93f1f33e8e4ed8064bf8217a712d3051c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E5=81=A5?= Date: Tue, 18 May 2021 17:09:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=91=A8=E8=BE=B9=E9=85=8D?= =?UTF-8?q?=E5=A5=97=E6=8E=92=E5=BA=8F=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cqrcb/AroundExportByNewWay.groovy | 21 +++++++++------- .../script/temp/shenjian/cqrcb/POIRule.groovy | 4 --- .../script/temp/shenjian/dto/AroundDTO.groovy | 25 +++++++++++++++++++ 3 files changed, 37 insertions(+), 13 deletions(-) create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/dto/AroundDTO.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 4ec4dac97..36e9e588f 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 @@ -5,6 +5,7 @@ import com.fangjia.script.commData.CommonDatautils import com.fangjia.script.district.Distance import com.fangjia.script.gj.ccb.FileUtils import com.fangjia.script.lixue.util.DBUtils +import com.fangjia.script.temp.shenjian.dto.AroundDTO import com.fangjia.script.util.ExcelUtils import com.fangjia.script.util.MongoUtils import com.mongodb.BasicDBObject @@ -96,10 +97,13 @@ class AroundExportByNewWay { Integer key = 1; def ret = [] for (List district : data) { + def district_code = district.get(2) def name = district.get(3) if (com.fangjia.script.coredata.util.CollectionUtils.isNotEmpty(resultMap.get(district_code + name))) { - ret.addAll(resultMap.get(district_code + name)) + List currRet = resultMap.get(district_code + name) + Collections.sort(currRet) + ret.addAll(currRet) if (ret.size() > 600000) { map.put(key++, ret) ret = [] @@ -110,11 +114,10 @@ class AroundExportByNewWay { //com.fangjia.script.util.ExcelUtils.write("F:\\数据\\重庆农商行\\周边配套.xlsx", ret, "周边配套"); for (Integer k : map.keySet()) { //FileUtils.batchCreateFile(map.get(k), "F:\\数据\\重庆农商行\\周边配套"+ k + ".dat", headArr, "utf-8") - EasyExcel.write("F:\\数据\\重庆农商行\\周边配套"+ + k + ".xlsx").head(head).sheet("周边配套").doWrite(map.get(k)); + EasyExcel.write("F:\\数据\\重庆农商行\\周边配套(文件"+ k + ")V1.xlsx").head(head).sheet("周边配套").doWrite(map.get(k)); } printUnMatched(unMatchedMap) executorService.shutdown() - } static calcAroundInfo(def lat, def lng, def result, def id) { @@ -130,12 +133,12 @@ class AroundExportByNewWay { if (distance == 0) { distance = 50 } - def ret = [] - ret[0] = id - ret[1] = obj.name - ret[2] = formatType(obj.typecode) - ret[3] = distance.toInteger() - result << ret + AroundDTO aroundDTO = new AroundDTO() + aroundDTO.id = id + aroundDTO.name = obj.name + aroundDTO.type = formatType(obj.typecode) + aroundDTO.distance = distance.toInteger() + result.add(aroundDTO) } } } 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 index 2c5f787b2..1c907e236 100644 --- 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 @@ -46,17 +46,13 @@ class POIRule { // 更新规则 // db.getCollection('gaode_address_poi').update({'name': /[ABCD]+栋/, 'status': 0}, {$set: {'status': NumberInt(1), 'flag': '包含栋'}}, {multi:true,upsert:false}); //db.getCollection('gaode_address_poi').update({'name': /[ABCD]+幢/, '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': /[ABCDEFHG]口/, 'typecode': {$nin: ['150700']}, 'status': 2}, {$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}); diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/dto/AroundDTO.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/dto/AroundDTO.groovy new file mode 100644 index 000000000..39ed00ec4 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/temp/shenjian/dto/AroundDTO.groovy @@ -0,0 +1,25 @@ +package com.fangjia.script.temp.shenjian.dto + +/** + * @author shenjian + * @since 2021/5/18 + */ +class AroundDTO implements Comparable { + + String id; + String name; + String type + Integer distance + + @Override + public int compareTo(AroundDTO o2) { + if (this.type.equals(o2.type)) { + if (this.distance != null) { + return this.distance.compareTo(o2.distance); + } + } else { + return this.type.compareTo(o2.type); + } + return 0; + } +}