Merge branch 'script_gj' into 'master'
Script gj See merge request !1159
This commit is contained in:
+4
-4
@@ -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);
|
||||
@@ -40,7 +40,7 @@ class ThirdPriceMappingBatch extends BaseBatch{
|
||||
@Override
|
||||
public void process(Object args) {
|
||||
// //将新增数据同步过来
|
||||
// addNemCommunity()
|
||||
addNemCommunity()
|
||||
//// //接口进行匹配
|
||||
match()
|
||||
|
||||
@@ -48,7 +48,7 @@ class ThirdPriceMappingBatch extends BaseBatch{
|
||||
}
|
||||
|
||||
def match(){
|
||||
def citys = CommonUtils.findAllCity()
|
||||
def citys = ["北京","厦门","泉州","安顺"]//CommonUtils.findAllCity()
|
||||
def index = 0
|
||||
for(def c : citys){
|
||||
index ++
|
||||
@@ -115,7 +115,7 @@ class ThirdPriceMappingBatch extends BaseBatch{
|
||||
}
|
||||
|
||||
def addNemCommunity(){
|
||||
def citys = CommonUtils.findAllCity()
|
||||
def citys = ["北京","厦门","泉州","安顺"] //CommonUtils.findAllCity()
|
||||
def total = 0
|
||||
def index = 0
|
||||
for(def c : citys){
|
||||
|
||||
+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, "房源")
|
||||
}
|
||||
}
|
||||
}
|
||||
+26
-3
@@ -7,11 +7,11 @@ import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.util.CommonUtils
|
||||
import com.fangjia.script.util.DateUtils
|
||||
import com.fangjia.script.util.ElasticUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import org.bson.types.ObjectId
|
||||
import org.elasticsearch.index.query.BoolQueryBuilder
|
||||
import org.elasticsearch.index.query.QueryBuilder
|
||||
import org.elasticsearch.index.query.QueryBuilders
|
||||
|
||||
@@ -20,7 +20,6 @@ import java.util.concurrent.CountDownLatch
|
||||
import java.util.concurrent.ExecutorService
|
||||
import java.util.concurrent.Executors
|
||||
import java.util.concurrent.atomic.AtomicLong
|
||||
|
||||
/**
|
||||
* 更新小区图片
|
||||
*/
|
||||
@@ -33,7 +32,8 @@ class AddDistImagesBatch extends BaseBatch{
|
||||
public static final DBCollection seaweed_fs_coll = MongoUtils.getCollectionByName("fangjia_base", "seaweed_images", "mongo.db.fangjia.com")
|
||||
|
||||
static main(args) {
|
||||
runBatch(new AddDistImagesBatch(), args);
|
||||
// runBatch(new AddDistImagesBatch(), args);
|
||||
statImgCountByCity()
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -169,5 +169,28 @@ class AddDistImagesBatch extends BaseBatch{
|
||||
println floor_count
|
||||
}
|
||||
|
||||
static def statImgCountByCity(){
|
||||
def fullCityMap = CommonDatautils.queryFullNameByCity()
|
||||
ExcelUtils.multiThreadingModify("D:\\数据\\全国城市.xlsx",{d->
|
||||
// def data = fullCityMap.get(d['A'])
|
||||
// if(data){
|
||||
// def q = new BasicDBObject()
|
||||
// q.put("city", data.city)
|
||||
// def count = seaweed_fs_coll.count(q)
|
||||
// d['B'] = count
|
||||
// }
|
||||
def dists= CommonDatautils.findAllDistricts(d['A'], "district", ["car_site_count","household_count"])
|
||||
if(dists){
|
||||
def total = 0
|
||||
for(def dist : dists){
|
||||
if(dist.car_site_count && dist.household_count){
|
||||
total ++
|
||||
}
|
||||
}
|
||||
d['C'] = total
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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