Merge branch 'master' of http://gitlab.fangjia.com/dev0/main into open_v2

This commit is contained in:
2025-09-18 14:31:11 +08:00
8 changed files with 232 additions and 23 deletions
@@ -185,7 +185,27 @@ public class AddrSvcController {
String msg = json.getString("msg");
BasicModel basicModel = new BasicModel(code, msg);
if (json.containsKey("result")) {
basicModel.setResult(CommonDtoUtils.transformV(StructureAndCompleteDto.class, json.get("result")));
StructureAndCompleteDto structureAndCompleteDto = CommonDtoUtils.transformV(StructureAndCompleteDto.class, json.get("result"));
if("1".equals(model.getShowCode())){
if(StringUtils.isNotBlank(structureAndCompleteDto.getProvinceCode())){
structureAndCompleteDto.setProvinceCode(structureAndCompleteDto.getProvinceCode().substring(0, 6));
}
if(StringUtils.isNotBlank(structureAndCompleteDto.getCityCode())){
structureAndCompleteDto.setCityCode(structureAndCompleteDto.getCityCode().substring(0, 6));
}
if(StringUtils.isNotBlank(structureAndCompleteDto.getDistrictCode())){
structureAndCompleteDto.setDistrictCode(structureAndCompleteDto.getDistrictCode().substring(0, 6));
}
if(StringUtils.isNotBlank(structureAndCompleteDto.getTownshipCode())){
structureAndCompleteDto.setTownshipCode(structureAndCompleteDto.getTownshipCode().substring(0, 9));
}
}else{
structureAndCompleteDto.setProvinceCode(null);
structureAndCompleteDto.setCityCode(null);
structureAndCompleteDto.setDistrictCode(null);
structureAndCompleteDto.setTownshipCode(null);
}
basicModel.setResult(structureAndCompleteDto);
}
mav.setModel(basicModel);
} else {
@@ -12,14 +12,26 @@ public class StructureAndCompleteDto {
* 省份
*/
private String province;
/**
* 省份编码
*/
private String provinceCode;
/**
* 城市
*/
private String city;
/**
* city编码
*/
private String cityCode;
/**
* 区域
*/
private String district;
/**
* 区域编码
*/
private String districtCode;
/**
* 开发区
*/
@@ -28,6 +40,11 @@ public class StructureAndCompleteDto {
* 乡镇街道
*/
private String township;
/**
* 乡镇街道编码
*/
private String townshipCode;
/**
* 道路
*/
@@ -200,4 +217,38 @@ public class StructureAndCompleteDto {
public void setAddrVerify(String addrVerify) {
this.addrVerify = addrVerify;
}
public String getProvinceCode() {
return provinceCode;
}
public void setProvinceCode(String provinceCode) {
this.provinceCode = provinceCode;
}
public String getCityCode() {
return cityCode;
}
public void setCityCode(String cityCode) {
this.cityCode = cityCode;
}
public String getDistrictCode() {
return districtCode;
}
public void setDistrictCode(String districtCode) {
this.districtCode = districtCode;
}
public String getTownshipCode() {
return townshipCode;
}
public void setTownshipCode(String townshipCode) {
this.townshipCode = townshipCode;
}
}
@@ -1,18 +1,14 @@
package com.fangjia.script.fuzhou
import com.fangjia.core.RegionData
import com.fangjia.core.util.DataUtil
import com.fangjia.script.BaseBatch
import com.fangjia.script.BatchOwner
import com.fangjia.script.Watcher
import com.fangjia.script.util.CommonUtils
import com.fangjia.script.util.DateUtils
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.QueryOperators
import java.text.DecimalFormat
import java.util.concurrent.CopyOnWriteArrayList
@@ -20,8 +16,6 @@ import java.util.concurrent.CountDownLatch
import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors
import java.util.concurrent.atomic.AtomicLong
import java.util.regex.Pattern
//小区月度均价表(带涨跌幅控制)
@BatchOwner(Watcher.GaoJuan)
class DistrictSellStatBatch extends BaseBatch {
@@ -75,7 +69,7 @@ class DistrictSellStatBatch extends BaseBatch {
if(!curDate){
curDate = new Date()
}
def citys = ["福州"]//CommonUtils.findAllCity()
def citys = CommonUtils.findAllCity()
def keys = new BasicDBObject("city", 1).append("name", 1).append("region", 1).append("estate_type2", 1).append("status", 1)
def lastMonthWeekend = DateUtils.truncateDay(DateUtils.getLastSundayInWeekOfLastMonth(curDate))
@@ -95,7 +89,7 @@ class DistrictSellStatBatch extends BaseBatch {
index++
def districts = []
if(city == "福州"){
if(day == 12){
if(day == 2){
districts = FZ_DIST_COLL.find(new BasicDBObject("city", city), keys).toList()
}else{
districts = FZ_DIST_COLL.find(new BasicDBObject("city", city).append("m_date", new BasicDBObject('$gte',startMDate).append('$lt', endMDate)), keys).toList()
@@ -104,7 +98,7 @@ class DistrictSellStatBatch extends BaseBatch {
def q = new BasicDBObject("city", city).append("cat", "district").append("status", 0)
// q.put("name", "翠园楼")
if(day == 2){
districts = SEAWEED_MONGO_COLL.find(q, keys).batchSize(2000)
districts = SEAWEED_MONGO_COLL.find(q, keys).batchSize(2000).toList()
}else{
q.put("m_date", new BasicDBObject('$gte',startMDate).append('$lt', endMDate))
districts = SEAWEED_MONGO_COLL.find(q, keys).batchSize(2000)
@@ -155,6 +149,7 @@ class DistrictSellStatBatch extends BaseBatch {
def dist = districts[i]
fixedThreadPool.execute(new Runnable() {
void run() {
try {
totalCount.addAndGet(1)
def key = dist.region +"##" + dist.name
@@ -248,6 +243,7 @@ class DistrictSellStatBatch extends BaseBatch {
} catch (Exception e) {
e.printStackTrace()
} finally {
latch.countDown()
}
@@ -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)
@@ -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, "房源")
}
}
}
@@ -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
}
})
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 989 KiB