新增周边配套排序输出

This commit is contained in:
沈健
2021-05-18 17:09:23 +08:00
parent 6ec617af10
commit ae5041e93f
3 changed files with 37 additions and 13 deletions
@@ -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<Object> 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)
}
}
}
@@ -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});
@@ -0,0 +1,25 @@
package com.fangjia.script.temp.shenjian.dto
/**
* @author shenjian
* @since 2021/5/18
*/
class AroundDTO implements Comparable<AroundDTO> {
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;
}
}