Merge branch 'script_gj' of http://gitlab.fangjia.com/dev0/main into script_gj
This commit is contained in:
+11
-10
@@ -31,7 +31,7 @@ class ThirdPriceMappingBatch extends BaseBatch{
|
||||
|
||||
final DBCollection dataProcessColl = MongoUtils.getCollectionByName("fangjia_craw", "data_process", "192.168.0.235", 27018)
|
||||
|
||||
def curDate = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -1, "yyyyMM"));
|
||||
def curDate = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -2, "yyyyMM"));
|
||||
|
||||
static main(args) {
|
||||
runBatch(new ThirdPriceMappingBatch(), args);
|
||||
@@ -39,16 +39,17 @@ class ThirdPriceMappingBatch extends BaseBatch{
|
||||
|
||||
@Override
|
||||
public void process(Object args) {
|
||||
def citys = ["北京","厦门","泉州","安顺"]//CommonUtils.findAllCity()
|
||||
// //将新增数据同步过来
|
||||
// addNemCommunity()
|
||||
// addNemCommunity(citys)
|
||||
//// //接口进行匹配
|
||||
match()
|
||||
match(citys)
|
||||
|
||||
addOldMatchResult()
|
||||
addOldMatchResult(citys)
|
||||
}
|
||||
|
||||
def match(){
|
||||
def citys = CommonUtils.findAllCity()
|
||||
def match(citys){
|
||||
|
||||
def index = 0
|
||||
for(def c : citys){
|
||||
index ++
|
||||
@@ -114,8 +115,8 @@ class ThirdPriceMappingBatch extends BaseBatch{
|
||||
return addCount.get();
|
||||
}
|
||||
|
||||
def addNemCommunity(){
|
||||
def citys = CommonUtils.findAllCity()
|
||||
def addNemCommunity(citys){
|
||||
// def citys = ["北京","厦门","泉州","安顺"] //CommonUtils.findAllCity()
|
||||
def total = 0
|
||||
def index = 0
|
||||
for(def c : citys){
|
||||
@@ -172,8 +173,8 @@ class ThirdPriceMappingBatch extends BaseBatch{
|
||||
return addCount.get();
|
||||
}
|
||||
|
||||
def addOldMatchResult(){
|
||||
def citys = CommonUtils.findAllCity()
|
||||
def addOldMatchResult(citys){
|
||||
// def citys = CommonUtils.findAllCity()
|
||||
def keys = new BasicDBObject()
|
||||
keys.put("_id", 1)
|
||||
keys.put("city", 1)
|
||||
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
package com.fangjia.script.gj.house
|
||||
|
||||
import com.fangjia.core.util.GeoUtils
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.util.CommonUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
|
||||
/**
|
||||
* 导出某小区周边房源
|
||||
*/
|
||||
class ExportArroundHouse {
|
||||
|
||||
static main(args) {
|
||||
def task = new ExportArroundHouse()
|
||||
task.run()
|
||||
}
|
||||
|
||||
def run(){
|
||||
def name = "南山雨果"
|
||||
def lng = 121.270784
|
||||
def lat = 31.160661
|
||||
def districts = CommonDatautils.getDistrictArround("上海", lng, lat)
|
||||
def startPrice = 45000
|
||||
def endPrice = 50000
|
||||
def lastHouses = []
|
||||
for(def d : districts){
|
||||
def distance = GeoUtils.calculateDistance(lng, lat, d.lng/10000000000.0, d.lat/10000000000.0);
|
||||
println d.name +" 相距:"+distance
|
||||
def houses = CommonDatautils.findHouses(d.city, d.region, "sell", 20240829, 20250901, d.name, d.alias, d.estate_type2)
|
||||
for(def h : houses){
|
||||
if(h.avg_price>startPrice && h.avg_price<endPrice){
|
||||
h.distance = distance
|
||||
h.location = d.lng/10000000000.0 +","+ d.lat/10000000000
|
||||
|
||||
h.city = d.city
|
||||
h.district = d.region
|
||||
h.block = d.block
|
||||
h.district_name = d.name
|
||||
lastHouses << h
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if(lastHouses){
|
||||
def list = []
|
||||
list << ["编号","城市","区域","板块","名称","地址","装修","朝向","面积","楼层","楼高","单价","总价","距离","位置","发布时间","标题"]
|
||||
for(def lh : lastHouses){
|
||||
def ret = []
|
||||
ret << lh.houseId.toString()
|
||||
ret << lh.city
|
||||
ret << lh.district
|
||||
ret << lh.block
|
||||
ret << lh.district_name
|
||||
ret << lh.address
|
||||
ret << lh.fitment
|
||||
ret << lh.direction
|
||||
ret << lh.area
|
||||
ret << lh.floor
|
||||
ret << lh.height
|
||||
ret << lh.avg_price
|
||||
ret << lh.total_price
|
||||
ret << lh.distance
|
||||
ret << lh.location
|
||||
ret << lh.p_date.toString().substring(0, lh.p_date.toString().indexOf(" "))
|
||||
ret << lh.title
|
||||
list << ret
|
||||
// list << [lh.houseId.toString(),lh.city,lh.district,lh.block,lh.district_name,lh.address,lh.fitment,lh.direction,lh.area,lh.floor,lh.height,lh.avg_price,lh.total_price,lh.distance,lh.location,lh.p_date,lh.title]
|
||||
}
|
||||
ExcelUtils.write("D:\\数据\\"+name+"附近房源.xlsx", list, "房源")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.fangjia.script.gj.meituan
|
||||
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
|
||||
class AddField {
|
||||
|
||||
static main(args) {
|
||||
def task = new AddField()
|
||||
task.run()
|
||||
}
|
||||
|
||||
def run(){
|
||||
ExcelUtils.multiThreadingModify("D:\\数据\\美团\\小区测试需求测试-结果0828.xlsx",{d->
|
||||
def obj = CommonDatautils.findDistrictById(d['F'])
|
||||
if(obj){
|
||||
d['G'] = obj.city
|
||||
d['H'] = obj.region
|
||||
d['I'] = obj.name
|
||||
d['J'] = obj.address
|
||||
d['K'] = obj.estate_type2
|
||||
d['L'] = obj.build_type
|
||||
d['M'] = obj.township
|
||||
d['N'] = obj.business_quarter
|
||||
d['O'] = obj.household_count
|
||||
d['P'] = obj.car_site_count
|
||||
d['Q'] = obj.estate_charge
|
||||
if(obj.create_year){
|
||||
d['R'] = obj.create_year
|
||||
}else if(obj.build_date){
|
||||
d['R'] = obj.build_date
|
||||
}else if(obj.finish_building_date) {
|
||||
d['R'] = obj.finish_building_date
|
||||
}
|
||||
// d['S'] = obj.live_date
|
||||
d['T'] = obj.all_area
|
||||
d['U'] = obj.build_area
|
||||
d['V'] = obj.cubage_percent
|
||||
d['W'] = obj.virescence_percent
|
||||
d['X'] = obj.developer
|
||||
d['Y'] = obj.estate_company
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user