新增农商行开发商物业等信息导出
This commit is contained in:
+18
@@ -0,0 +1,18 @@
|
||||
package com.fangjia.script.temp.shenjian.cqrcb
|
||||
|
||||
import com.fangjia.script.temp.shenjian.util.GaoDeUtils
|
||||
|
||||
/**
|
||||
* 小区周围信息导出
|
||||
*
|
||||
* @author shenjian
|
||||
* @since 2021/5/15
|
||||
*/
|
||||
class AroundExport {
|
||||
|
||||
def static types = ""
|
||||
|
||||
static void main(String[] args) {
|
||||
GaoDeUtils.searchNearByPoi()
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.fangjia.script.temp.shenjian.cqrcb
|
||||
|
||||
/**
|
||||
* @author shenjian
|
||||
* @since 2021/5/15
|
||||
*/
|
||||
class Constants {
|
||||
|
||||
|
||||
}
|
||||
+126
@@ -0,0 +1,126 @@
|
||||
package com.fangjia.script.temp.shenjian.cqrcb
|
||||
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import com.mongodb.DBObject
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import java.util.concurrent.ConcurrentLinkedQueue
|
||||
import java.util.concurrent.CountDownLatch
|
||||
import java.util.concurrent.ExecutorService
|
||||
import java.util.concurrent.Executors
|
||||
|
||||
/**
|
||||
* 重庆农商行
|
||||
* 开发商物业公司等小区信息导出
|
||||
*
|
||||
* @author shenjian
|
||||
* @since 2021/5/14
|
||||
*/
|
||||
class SeaweedExport {
|
||||
|
||||
static DBCollection cityMapConn = MongoUtils.getCollectionByName("business", "fangjia_official_area_map", "192.168.0.43", 28017)
|
||||
static ExecutorService executorService = Executors.newFixedThreadPool(30)
|
||||
static def map = new ConcurrentHashMap()
|
||||
|
||||
static void main(String[] args) {
|
||||
def resultMap = new ConcurrentHashMap()
|
||||
List<List<Object>> data = ExcelUtils.read("F:\\数据\\重庆农商行\\测试数据汇总_2021.xlsx", 9)
|
||||
CountDownLatch latch = new CountDownLatch(data.size())
|
||||
for (List<Object> districtT : data) {
|
||||
final List<Object> district = districtT
|
||||
executorService.execute(new Runnable() {
|
||||
@Override
|
||||
void run() {
|
||||
try {
|
||||
def city = district.get(1)
|
||||
def district_code = district.get(2)
|
||||
def name = district.get(3)
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
DBObject query = new BasicDBObject()
|
||||
query.put("city", city)
|
||||
query.put("cat", "district")
|
||||
query.put("visible", 0)
|
||||
query.put("name", name)
|
||||
|
||||
DBObject filter = new BasicDBObject()
|
||||
filter.put("_id", 1)
|
||||
filter.put("developer", 1)
|
||||
filter.put("estate_company", 1)
|
||||
filter.put("cubage_percent", 1) // 容积率
|
||||
filter.put("virescence_percent", 1) // 绿化率
|
||||
filter.put("alias", 1)
|
||||
filter.put("car_site_count", 1)
|
||||
filter.put("all_area", 1)
|
||||
filter.put("loudong_count", 1)
|
||||
filter.put("household_count", 1)
|
||||
filter.put("estate_charge", 1)
|
||||
filter.put("open_date", 1) // 开盘时间
|
||||
filter.put("live_date", 1) // 交房时间
|
||||
filter.put("lng", 1)
|
||||
filter.put("lat", 1)
|
||||
|
||||
def ret = []
|
||||
DbUtils.seaweed.find(query).limit(1).each { obj ->
|
||||
ret[0] = obj.developer
|
||||
ret[1] = obj.estate_company
|
||||
ret[2] = obj.cubage_percent
|
||||
ret[3] = obj.virescence_percent
|
||||
|
||||
if (obj.alias) {
|
||||
// 小区可能存在多个别名
|
||||
def temp = []
|
||||
for (def a : obj.alias) {
|
||||
temp.add(a)
|
||||
}
|
||||
ret[4] = temp.join(",")
|
||||
}
|
||||
ret[5] = obj.car_site_count
|
||||
ret[6] = ""
|
||||
ret[7] = ""
|
||||
ret[8] = obj.all_area
|
||||
ret[9] = obj.loudong_count
|
||||
ret[10] = obj.household_count
|
||||
ret[11] = ""
|
||||
ret[12] = obj.estate_charge
|
||||
ret[13] = obj.open_date
|
||||
ret[14] = obj.live_date
|
||||
ret[15] = obj.lng
|
||||
ret[16] = obj.lat
|
||||
}
|
||||
ret[17] = name
|
||||
resultMap.put(district_code + name, ret)
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace()
|
||||
} finally {
|
||||
latch.countDown()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
latch.await()
|
||||
def ret = []
|
||||
ret << ["物业公司名称","开发商名称","容积率","绿化率","楼盘别名","停车位数量","车位配比率","车位价","总占地面积","总楼栋数","总户数","非住宅总户数","物业费","开盘日期","交付时间", "经度", "纬度", "小区名称"]
|
||||
for (List<Object> district : data) {
|
||||
def district_code = district.get(2)
|
||||
def name = district.get(3)
|
||||
ret << resultMap.get(district_code + name)
|
||||
}
|
||||
com.fangjia.script.util.ExcelUtils.write("F:\\数据\\重庆农商行\\开发商物业公司.xlsx", ret, "项目统计");
|
||||
executorService.shutdown()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
package com.fangjia.script.temp.shenjian.util
|
||||
|
||||
import com.fangjia.core.util.DataUtil
|
||||
import com.fangjia.script.util.GeoUtils
|
||||
import com.fangjia.script.util.HttpRequestUtil
|
||||
import net.sf.json.JSONObject
|
||||
|
||||
/**
|
||||
* ¸ßµÂ¹¤¾ßÀà
|
||||
*
|
||||
* @author shenjian
|
||||
* @since 2021/5/15
|
||||
*/
|
||||
class GaoDeUtils {
|
||||
|
||||
def static GAO_DE_AK = "4ccfe3c898a9489884bd2bcb1ef6dcde"
|
||||
|
||||
/**
|
||||
*
|
||||
* @param city
|
||||
* @param kw
|
||||
* @param lng
|
||||
* @param lat
|
||||
* @param radius
|
||||
* @param types "150500|1507|090100|090101|090200|090202|090203|090204|090205|090206|090207|090208|090209|090210|090211|1601|1603|0601"; @see com.fangjia.script.wenyan.auto.KeywordSearchUtils.KEYWORDS_MAP.get(kw)
|
||||
* @return
|
||||
*/
|
||||
static List searchNearByPoi(String city, String types, Double lng, Double lat, String radius, String keywords){
|
||||
def params = [:]
|
||||
params.key = GAO_DE_AK
|
||||
|
||||
if (types) {
|
||||
params.types = types
|
||||
} else {
|
||||
params.keywords = keywords
|
||||
}
|
||||
params.city = city
|
||||
params.radius = radius
|
||||
params.location = "${lng},${lat}".toString()
|
||||
List result = []
|
||||
|
||||
int page = 1
|
||||
int count = 10000
|
||||
while (result.size() < count) {
|
||||
params.page = "${page}".toString()
|
||||
page++
|
||||
JSONObject json = HttpRequestUtil.getJsonContent("http://restapi.amap.com/v3/place/around", params);
|
||||
if (json == null) {
|
||||
json = HttpRequestUtil.getJsonContent("http://restapi.amap.com/v3/place/around", params);
|
||||
}
|
||||
if (json && json.info && json.info == "OK") {
|
||||
count = json.getString("count").toInteger()
|
||||
result.addAll(DataUtil.toMongoDbObj(json.pois))
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user