add
This commit is contained in:
+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, "房源")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user