Merge branch 'script_gj' of http://gitlab.fangjia.com/dev0/main into script_gj
This commit is contained in:
+22
-36
@@ -10,6 +10,8 @@ import com.fangjia.script.util.MongoUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import com.mongodb.DBObject
|
||||
import org.apache.commons.lang.StringUtils
|
||||
import org.bson.types.ObjectId
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import java.util.concurrent.CountDownLatch
|
||||
@@ -27,11 +29,13 @@ class SeaweedExport {
|
||||
|
||||
static DBCollection cityMapConn = MongoUtils.getCollectionByName("business", "fangjia_official_area_map", "192.168.0.43", 28017)
|
||||
static ExecutorService executorService = Executors.newFixedThreadPool(30)
|
||||
static final DBCollection seaweed = MongoUtils.getCollectionByName("fangjia", "seaweed", "192.168.0.43", 28017)
|
||||
|
||||
static def map = new ConcurrentHashMap()
|
||||
|
||||
static void main(String[] args) {
|
||||
def resultMap = new ConcurrentHashMap()
|
||||
List<List<Object>> data = ExcelUtils.read("F:\\数据\\重庆农商行\\测试数据汇总_2021.xlsx", 9)
|
||||
List<List<Object>> data = ExcelUtils.read("D:\\Users\\Domi\\Documents\\知识库\\重庆农商行\\POC测试\\重庆样本匹配结果V4.xlsx")
|
||||
CountDownLatch latch = new CountDownLatch(data.size())
|
||||
for (List<Object> districtT : data) {
|
||||
final List<Object> district = districtT
|
||||
@@ -39,33 +43,16 @@ class SeaweedExport {
|
||||
@Override
|
||||
void run() {
|
||||
try {
|
||||
def city = district.get(1)
|
||||
def district_code = district.get(2)
|
||||
def name = district.get(3)
|
||||
def matchedCity = district.get(22)
|
||||
def matchedRegion = district.get(23)
|
||||
def matchedName = district.get(24)
|
||||
def region;
|
||||
|
||||
if (map.get("district_code") != null) {
|
||||
region = map.get("district_code")
|
||||
} else {
|
||||
cityMapConn.find(new BasicDBObject("district_code", district_code)).each { obj ->
|
||||
region = obj.fangjia_district
|
||||
map.put("district_code", region)
|
||||
}
|
||||
}
|
||||
if (matchedRegion == null) {
|
||||
matchedRegion = region
|
||||
matchedName = name
|
||||
}
|
||||
def no = district.get(0)
|
||||
def id = district.get(2)
|
||||
def ret = []
|
||||
if (id != null) {
|
||||
DBObject query = new BasicDBObject()
|
||||
query.put("city", city)
|
||||
query.put("region", matchedRegion)
|
||||
query.put("_id", new ObjectId(id))
|
||||
//query.put("region", matchedRegion)
|
||||
query.put("cat", "district")
|
||||
query.put("visible", 0)
|
||||
query.put("name", matchedName)
|
||||
//query.put("name", matchedName)
|
||||
|
||||
DBObject filter = new BasicDBObject()
|
||||
filter.put("_id", 1)
|
||||
@@ -81,10 +68,10 @@ class SeaweedExport {
|
||||
filter.put("estate_charge", 1)
|
||||
filter.put("open_date", 1) // 开盘时间
|
||||
filter.put("live_date", 1) // 交房时间
|
||||
filter.put("lng", 1)
|
||||
filter.put("lat", 1)
|
||||
filter.put("elevator", 1) // 电梯
|
||||
|
||||
DbUtils.seaweed.find(query).limit(1).each { obj ->
|
||||
DBObject obj = seaweed.findOne(new ObjectId(id))
|
||||
if (obj) {
|
||||
ret[0] = obj.estate_company
|
||||
ret[1] = obj.developer
|
||||
ret[2] = SeaweedUtils.formatCubagePercent(obj.cubage_percent)
|
||||
@@ -100,11 +87,11 @@ class SeaweedExport {
|
||||
ret[12] = obj.estate_charge
|
||||
ret[13] = DateUtil.formatToYYYYMMDD(obj.open_date)
|
||||
ret[14] = obj.live_date
|
||||
ret[15] = obj.lng
|
||||
ret[16] = obj.lat
|
||||
ret[15] = obj.is_elevator == true ? "有" : (obj.is_elevator == false ? "无" : "")
|
||||
ret[16] = no
|
||||
resultMap.put(no, ret)
|
||||
}
|
||||
}
|
||||
ret[17] = name
|
||||
resultMap.put(district_code + name, ret)
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace()
|
||||
} finally {
|
||||
@@ -115,13 +102,12 @@ class SeaweedExport {
|
||||
};
|
||||
latch.await();
|
||||
def ret = [];
|
||||
ret << ["物业公司名称","开发商名称","容积率","绿化率","楼盘别名","停车位数量","车位配比率","车位价","总占地面积","总楼栋数","总户数","非住宅总户数","物业费","开盘日期","交付时间", "经度", "纬度", "小区名称"];
|
||||
ret << ["物业公司名称","开发商名称","容积率","绿化率","楼盘别名","停车位数量","车位配比率","车位价","总占地面积","总楼栋数","总户数","非住宅总户数","物业费","开盘日期","交付时间", "是否有电梯", "序号"];
|
||||
for (List<Object> district : data) {
|
||||
def district_code = district.get(2)
|
||||
def name = district.get(3)
|
||||
ret << resultMap.get(district_code + name)
|
||||
def no = district.get(0)
|
||||
ret << resultMap.get(no)
|
||||
};
|
||||
com.fangjia.script.util.ExcelUtils.write("F:\\数据\\重庆农商行\\开发商及物业信息.xlsx", ret, "开发商及物业信息");
|
||||
com.fangjia.script.util.ExcelUtils.write("D:\\Users\\Domi\\Documents\\知识库\\重庆农商行\\POC测试\\开发商及物业信息.xlsx", ret, "开发商及物业信息");
|
||||
executorService.shutdown()
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -83,7 +83,7 @@ class SeaweedUtils {
|
||||
static formatCarSiteCount(def car_site_count) {
|
||||
if (car_site_count && FieldValidatorUtils.checkValue(car_site_count)) {
|
||||
long val = Long.valueOf(car_site_count)
|
||||
if (val > 2000 || val < 100) {
|
||||
if (val > 2500 || val < 100) {
|
||||
return ""
|
||||
}
|
||||
return val;
|
||||
|
||||
Reference in New Issue
Block a user