+27
@@ -0,0 +1,27 @@
|
||||
package com.fangjia.job.common.base;
|
||||
|
||||
public class ReponseData {
|
||||
private int code;
|
||||
private String msg;
|
||||
private Object result;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
public Object getResult() {
|
||||
return result;
|
||||
}
|
||||
public void setResult(Object result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
}
|
||||
+61
-5
@@ -2,14 +2,19 @@ package com.fangjia.job.youfang.config;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.data.mongodb.MongoDbFactory;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.springframework.data.mongodb.core.SimpleMongoDbFactory;
|
||||
import org.springframework.data.mongodb.core.convert.DefaultMongoTypeMapper;
|
||||
import org.springframework.data.mongodb.core.convert.MappingMongoConverter;
|
||||
import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
|
||||
|
||||
import com.mongodb.MongoClient;
|
||||
import com.mongodb.MongoClientOptions;
|
||||
import com.mongodb.ServerAddress;
|
||||
@@ -17,8 +22,28 @@ import com.mongodb.ServerAddress;
|
||||
@Configuration
|
||||
public class SpringMongoConfig {
|
||||
|
||||
public @Bean MongoDbFactory mongoDbFactory() throws Exception {
|
||||
List<ServerAddress> seeds = Arrays.asList(new ServerAddress("mongo.db.fangjia.com", 27017));
|
||||
@Value("${mongo.youfang.url}")
|
||||
private String youfangUrl;
|
||||
|
||||
@Value("${mongo.youfang.name}")
|
||||
private String youfangName;
|
||||
|
||||
@Value("${mongo.youfang.port}")
|
||||
private int youfangPort;
|
||||
|
||||
@Value("${mongo.seaweed.url}")
|
||||
private String seaweedUrl;
|
||||
|
||||
@Value("${mongo.seaweed.name}")
|
||||
private String seaweedName;
|
||||
|
||||
@Value("${mongo.seaweed.port}")
|
||||
private int seaweedPort;
|
||||
|
||||
@Primary
|
||||
@Bean
|
||||
public MongoDbFactory mongoDbFactory() throws Exception {
|
||||
List<ServerAddress> seeds = Arrays.asList(new ServerAddress(youfangUrl, youfangPort));
|
||||
MongoClientOptions.Builder builder = new MongoClientOptions.Builder();
|
||||
int connPerHost = 10;
|
||||
builder.connectionsPerHost(connPerHost);
|
||||
@@ -30,16 +55,47 @@ public class SpringMongoConfig {
|
||||
builder.connectTimeout(timeOut);
|
||||
MongoClientOptions options = builder.build();
|
||||
MongoClient mongoClient = new MongoClient(seeds, options);
|
||||
return new SimpleMongoDbFactory(mongoClient, "fangjia_youfang");
|
||||
return new SimpleMongoDbFactory(mongoClient, youfangName);
|
||||
}
|
||||
|
||||
|
||||
@Primary
|
||||
@Bean
|
||||
@SuppressWarnings("deprecation")
|
||||
public @Bean MongoTemplate mongoTemplate() throws Exception {
|
||||
public MongoTemplate mongoTemplate() throws Exception {
|
||||
//remove _class
|
||||
MappingMongoConverter converter = new MappingMongoConverter(mongoDbFactory(), new MongoMappingContext());
|
||||
converter.setTypeMapper(new DefaultMongoTypeMapper(null));
|
||||
MongoTemplate mongoTemplate = new MongoTemplate(mongoDbFactory(), converter);
|
||||
return mongoTemplate;
|
||||
}
|
||||
|
||||
@Qualifier("seaweedMongoDbFactory")
|
||||
@Bean
|
||||
public MongoDbFactory seaweedMongoDbFactory() throws Exception {
|
||||
List<ServerAddress> seeds = Arrays.asList(new ServerAddress(seaweedUrl, seaweedPort));
|
||||
MongoClientOptions.Builder builder = new MongoClientOptions.Builder();
|
||||
int connPerHost = 10;
|
||||
builder.connectionsPerHost(connPerHost);
|
||||
int threadCount = 10;
|
||||
builder.threadsAllowedToBlockForConnectionMultiplier(threadCount);
|
||||
int maxWaitTime = 10000;
|
||||
builder.maxWaitTime(maxWaitTime);
|
||||
int timeOut = 10000;
|
||||
builder.connectTimeout(timeOut);
|
||||
MongoClientOptions options = builder.build();
|
||||
MongoClient mongoClient = new MongoClient(seeds, options);
|
||||
return new SimpleMongoDbFactory(mongoClient, seaweedName);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Qualifier("seaweedMongoTemplate")
|
||||
@Bean
|
||||
public MongoTemplate seaweedMongoTemplate() throws Exception {
|
||||
//remove _class
|
||||
MappingMongoConverter converter = new MappingMongoConverter(seaweedMongoDbFactory(), new MongoMappingContext());
|
||||
converter.setTypeMapper(new DefaultMongoTypeMapper(null));
|
||||
MongoTemplate mongoTemplate = new MongoTemplate(seaweedMongoDbFactory(), converter);
|
||||
return mongoTemplate;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
package com.fangjia.job.youfang.document;
|
||||
|
||||
/**
|
||||
* 小区中介信息
|
||||
*
|
||||
* @author yinjihuan
|
||||
*
|
||||
*/
|
||||
public class AgencyInfo {
|
||||
/**
|
||||
* 中介总数量
|
||||
*/
|
||||
private int agencyMount;
|
||||
/**
|
||||
* 城市排名总量
|
||||
*/
|
||||
private int citySize;
|
||||
/**
|
||||
* 知名中介数量
|
||||
*/
|
||||
private int famousAgency;
|
||||
/**
|
||||
* 城市中介最多的数量
|
||||
*/
|
||||
private int maxCityAgency;
|
||||
/**
|
||||
* 中介数量在城市中的排名
|
||||
*/
|
||||
private int momCityLevel;
|
||||
/**
|
||||
* 其他中介数量
|
||||
*/
|
||||
private int otherAgency;
|
||||
|
||||
public int getAgencyMount() {
|
||||
return agencyMount;
|
||||
}
|
||||
|
||||
public void setAgencyMount(int agencyMount) {
|
||||
this.agencyMount = agencyMount;
|
||||
}
|
||||
|
||||
public int getCitySize() {
|
||||
return citySize;
|
||||
}
|
||||
|
||||
public void setCitySize(int citySize) {
|
||||
this.citySize = citySize;
|
||||
}
|
||||
|
||||
public int getFamousAgency() {
|
||||
return famousAgency;
|
||||
}
|
||||
|
||||
public void setFamousAgency(int famousAgency) {
|
||||
this.famousAgency = famousAgency;
|
||||
}
|
||||
|
||||
public int getMaxCityAgency() {
|
||||
return maxCityAgency;
|
||||
}
|
||||
|
||||
public void setMaxCityAgency(int maxCityAgency) {
|
||||
this.maxCityAgency = maxCityAgency;
|
||||
}
|
||||
|
||||
public int getMomCityLevel() {
|
||||
return momCityLevel;
|
||||
}
|
||||
|
||||
public void setMomCityLevel(int momCityLevel) {
|
||||
this.momCityLevel = momCityLevel;
|
||||
}
|
||||
|
||||
public int getOtherAgency() {
|
||||
return otherAgency;
|
||||
}
|
||||
|
||||
public void setOtherAgency(int otherAgency) {
|
||||
this.otherAgency = otherAgency;
|
||||
}
|
||||
|
||||
}
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
package com.fangjia.job.youfang.document;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ChangeHouseDto {
|
||||
|
||||
private List<String> poiTags;
|
||||
private int purpose;
|
||||
private String city;
|
||||
private String region;
|
||||
private String name;
|
||||
private List<Integer> areaTags;
|
||||
private int poiSize;
|
||||
private double lat;
|
||||
private double lng;
|
||||
private int avgPrice;
|
||||
private String address;
|
||||
private Integer index;//小区潜力指数
|
||||
private Double rentRate;//租房回报率
|
||||
|
||||
public List<String> getPoiTags() {
|
||||
return poiTags;
|
||||
}
|
||||
public void setPoiTags(List<String> poiTags) {
|
||||
this.poiTags = poiTags;
|
||||
}
|
||||
public int getPurpose() {
|
||||
return purpose;
|
||||
}
|
||||
public void setPurpose(int purpose) {
|
||||
this.purpose = purpose;
|
||||
}
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
public String getRegion() {
|
||||
return region;
|
||||
}
|
||||
public void setRegion(String region) {
|
||||
this.region = region;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public int getPoiSize() {
|
||||
return poiSize;
|
||||
}
|
||||
public void setPoiSize(int poiSize) {
|
||||
this.poiSize = poiSize;
|
||||
}
|
||||
public List<Integer> getAreaTags() {
|
||||
return areaTags;
|
||||
}
|
||||
public void setAreaTags(List<Integer> areaTags) {
|
||||
this.areaTags = areaTags;
|
||||
}
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
public double getLng() {
|
||||
return lng;
|
||||
}
|
||||
public void setLng(double lng) {
|
||||
this.lng = lng;
|
||||
}
|
||||
public int getAvgPrice() {
|
||||
return avgPrice;
|
||||
}
|
||||
public void setAvgPrice(int avgPrice) {
|
||||
this.avgPrice = avgPrice;
|
||||
}
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
public Integer getIndex() {
|
||||
return index;
|
||||
}
|
||||
public void setIndex(Integer index) {
|
||||
this.index = index;
|
||||
}
|
||||
public Double getRentRate() {
|
||||
return rentRate;
|
||||
}
|
||||
public void setRentRate(Double rentRate) {
|
||||
this.rentRate = rentRate;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
package com.fangjia.job.youfang.document;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class DistrictBaseInfoDto {
|
||||
|
||||
private DistrictDto district;
|
||||
|
||||
private Integer curAvgPrice;
|
||||
|
||||
private String moreArea;
|
||||
|
||||
private Integer lastWeekendMarkup;
|
||||
|
||||
private Integer topMonthAvgPrice;
|
||||
|
||||
|
||||
private Double oneYearUpDownRange;
|
||||
|
||||
|
||||
private Double upDownRangecityLevel;
|
||||
|
||||
|
||||
private List<DistrictDto> districtDtos;
|
||||
|
||||
|
||||
public Integer getCurAvgPrice() {
|
||||
return curAvgPrice;
|
||||
}
|
||||
|
||||
public void setCurAvgPrice(Integer curAvgPrice) {
|
||||
this.curAvgPrice = curAvgPrice;
|
||||
}
|
||||
|
||||
public Integer getLastWeekendMarkup() {
|
||||
return lastWeekendMarkup;
|
||||
}
|
||||
|
||||
public void setLastWeekendMarkup(Integer lastWeekendMarkup) {
|
||||
this.lastWeekendMarkup = lastWeekendMarkup;
|
||||
}
|
||||
|
||||
public Integer getTopMonthAvgPrice() {
|
||||
return topMonthAvgPrice;
|
||||
}
|
||||
|
||||
public void setTopMonthAvgPrice(Integer topMonthAvgPrice) {
|
||||
this.topMonthAvgPrice = topMonthAvgPrice;
|
||||
}
|
||||
|
||||
public Double getOneYearUpDownRange() {
|
||||
return oneYearUpDownRange;
|
||||
}
|
||||
|
||||
public void setOneYearUpDownRange(Double oneYearUpDownRange) {
|
||||
this.oneYearUpDownRange = oneYearUpDownRange;
|
||||
}
|
||||
|
||||
public Double getUpDownRangecityLevel() {
|
||||
return upDownRangecityLevel;
|
||||
}
|
||||
|
||||
public void setUpDownRangecityLevel(Double upDownRangecityLevel) {
|
||||
this.upDownRangecityLevel = upDownRangecityLevel;
|
||||
}
|
||||
|
||||
public DistrictDto getDistrict() {
|
||||
return district;
|
||||
}
|
||||
|
||||
public void setDistrict(DistrictDto district) {
|
||||
this.district = district;
|
||||
}
|
||||
|
||||
public String getMoreArea() {
|
||||
return moreArea;
|
||||
}
|
||||
|
||||
public void setMoreArea(String moreArea) {
|
||||
this.moreArea = moreArea;
|
||||
}
|
||||
|
||||
public List<DistrictDto> getDistrictDtos() {
|
||||
return districtDtos;
|
||||
}
|
||||
|
||||
public void setDistrictDtos(List<DistrictDto> districtDtos) {
|
||||
this.districtDtos = districtDtos;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
package com.fangjia.job.youfang.document;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
|
||||
/**
|
||||
* 小区详情<br>用于有房中小区的信息汇总
|
||||
* @author yinjihuan
|
||||
*/
|
||||
@Document(collection="district_detail")
|
||||
public class DistrictDetail {
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
private String city;
|
||||
|
||||
/**
|
||||
* 区域
|
||||
*/
|
||||
private String region;
|
||||
|
||||
/**
|
||||
* 小区名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date modifyTime;
|
||||
|
||||
/**
|
||||
* 中介信息
|
||||
*/
|
||||
private AgencyInfo agencyInfo;
|
||||
|
||||
/**
|
||||
* 小区综合信息(标签等)
|
||||
*/
|
||||
private DistrictEvaluateDto districtNewPriceInfo;
|
||||
|
||||
/**
|
||||
* 小区基础信息
|
||||
*/
|
||||
private DistrictBaseInfoDto districtBaseInfo;
|
||||
|
||||
public Date getModifyTime() {
|
||||
return modifyTime;
|
||||
}
|
||||
|
||||
public void setModifyTime(Date modifyTime) {
|
||||
this.modifyTime = modifyTime;
|
||||
}
|
||||
|
||||
public DistrictBaseInfoDto getDistrictBaseInfo() {
|
||||
return districtBaseInfo;
|
||||
}
|
||||
|
||||
public void setDistrictBaseInfo(DistrictBaseInfoDto districtBaseInfo) {
|
||||
this.districtBaseInfo = districtBaseInfo;
|
||||
}
|
||||
|
||||
public DistrictEvaluateDto getDistrictNewPriceInfo() {
|
||||
return districtNewPriceInfo;
|
||||
}
|
||||
|
||||
public void setDistrictNewPriceInfo(DistrictEvaluateDto districtNewPriceInfo) {
|
||||
this.districtNewPriceInfo = districtNewPriceInfo;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getRegion() {
|
||||
return region;
|
||||
}
|
||||
|
||||
public void setRegion(String region) {
|
||||
this.region = region;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public AgencyInfo getAgencyInfo() {
|
||||
return agencyInfo;
|
||||
}
|
||||
|
||||
public void setAgencyInfo(AgencyInfo agencyInfo) {
|
||||
this.agencyInfo = agencyInfo;
|
||||
}
|
||||
|
||||
}
|
||||
+256
@@ -0,0 +1,256 @@
|
||||
package com.fangjia.job.youfang.document;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DistrictDto {
|
||||
private String city;
|
||||
private String district;
|
||||
private String name;
|
||||
private String address;
|
||||
private String estateType;
|
||||
private List<String> alias;
|
||||
private double credit;
|
||||
private boolean exists;
|
||||
|
||||
//均价
|
||||
private int avgPrice;
|
||||
|
||||
//总价
|
||||
private int totalPrice;
|
||||
|
||||
//资产等级
|
||||
private double levelRate;
|
||||
|
||||
//一年前房屋均价
|
||||
private int oneYearAvgPrice;
|
||||
|
||||
//一年前房屋均价
|
||||
private int oneMonthAvgPrice;
|
||||
|
||||
//经度
|
||||
private double lng2;
|
||||
|
||||
//纬度
|
||||
private double lat2;
|
||||
|
||||
//小区标签
|
||||
private String tag;
|
||||
|
||||
//流动性评级得分
|
||||
private double totalScore;
|
||||
|
||||
//城市相对最低价
|
||||
private int cityDistrictMinSellPrice;
|
||||
|
||||
//城市相对最高价
|
||||
private int cityDistrictMaxSellPrice;
|
||||
|
||||
//涨跌幅城市中的排名
|
||||
private double upDownRangecityLevel;
|
||||
|
||||
//价格城市中的排名
|
||||
private double priceRate;
|
||||
|
||||
|
||||
private String developer;//开发商
|
||||
private String estateCompany;//物业公司
|
||||
private String cubagePercent;//容积率
|
||||
private String virescencePercent;//绿化率
|
||||
private String estateCharge;// 物业费
|
||||
private String buildDate;//创建时间
|
||||
private Integer carSiteCount;//停车位
|
||||
private Integer householdCount;//总户数
|
||||
private String finishBuildingDate;//竣工时间
|
||||
|
||||
private Integer distance;
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
public String getDistrict() {
|
||||
return district;
|
||||
}
|
||||
public void setDistrict(String district) {
|
||||
this.district = district;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public List<String> getAlias() {
|
||||
return alias;
|
||||
}
|
||||
public void setAlias(List<String> alias) {
|
||||
this.alias = alias;
|
||||
}
|
||||
public double getCredit() {
|
||||
return credit;
|
||||
}
|
||||
public void setCredit(double credit) {
|
||||
this.credit = credit;
|
||||
}
|
||||
public boolean isExists() {
|
||||
return exists;
|
||||
}
|
||||
public void setExists(boolean exists) {
|
||||
this.exists = exists;
|
||||
}
|
||||
public int getAvgPrice() {
|
||||
return avgPrice;
|
||||
}
|
||||
public void setAvgPrice(int avgPrice) {
|
||||
this.avgPrice = avgPrice;
|
||||
}
|
||||
public int getTotalPrice() {
|
||||
return totalPrice;
|
||||
}
|
||||
public void setTotalPrice(int totalPrice) {
|
||||
this.totalPrice = totalPrice;
|
||||
}
|
||||
public double getLevelRate() {
|
||||
return levelRate;
|
||||
}
|
||||
public void setLevelRate(double levelRate) {
|
||||
this.levelRate = levelRate;
|
||||
}
|
||||
public int getOneYearAvgPrice() {
|
||||
return oneYearAvgPrice;
|
||||
}
|
||||
public void setOneYearAvgPrice(int oneYearAvgPrice) {
|
||||
this.oneYearAvgPrice = oneYearAvgPrice;
|
||||
}
|
||||
public double getLat2() {
|
||||
return lat2;
|
||||
}
|
||||
public void setLat2(double lat2) {
|
||||
this.lat2 = lat2;
|
||||
}
|
||||
public double getLng2() {
|
||||
return lng2;
|
||||
}
|
||||
public void setLng2(double lng2) {
|
||||
this.lng2 = lng2;
|
||||
}
|
||||
public String getTag() {
|
||||
return tag;
|
||||
}
|
||||
public void setTag(String tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
public String getEstateType() {
|
||||
return estateType;
|
||||
}
|
||||
public void setEstateType(String estateType) {
|
||||
this.estateType = estateType;
|
||||
}
|
||||
public double getTotalScore() {
|
||||
return totalScore;
|
||||
}
|
||||
public void setTotalScore(double totalScore) {
|
||||
this.totalScore = totalScore;
|
||||
}
|
||||
public int getCityDistrictMinSellPrice() {
|
||||
return cityDistrictMinSellPrice;
|
||||
}
|
||||
public void setCityDistrictMinSellPrice(int cityDistrictMinSellPrice) {
|
||||
this.cityDistrictMinSellPrice = cityDistrictMinSellPrice;
|
||||
}
|
||||
public int getCityDistrictMaxSellPrice() {
|
||||
return cityDistrictMaxSellPrice;
|
||||
}
|
||||
public void setCityDistrictMaxSellPrice(int cityDistrictMaxSellPrice) {
|
||||
this.cityDistrictMaxSellPrice = cityDistrictMaxSellPrice;
|
||||
}
|
||||
public double getUpDownRangecityLevel() {
|
||||
return upDownRangecityLevel;
|
||||
}
|
||||
public void setUpDownRangecityLevel(double upDownRangecityLevel) {
|
||||
this.upDownRangecityLevel = upDownRangecityLevel;
|
||||
}
|
||||
public double getPriceRate() {
|
||||
return priceRate;
|
||||
}
|
||||
public void setPriceRate(double priceRate) {
|
||||
this.priceRate = priceRate;
|
||||
}
|
||||
public String getDeveloper() {
|
||||
return developer;
|
||||
}
|
||||
public void setDeveloper(String developer) {
|
||||
this.developer = developer;
|
||||
}
|
||||
public String getEstateCompany() {
|
||||
return estateCompany;
|
||||
}
|
||||
public void setEstateCompany(String estateCompany) {
|
||||
this.estateCompany = estateCompany;
|
||||
}
|
||||
public String getCubagePercent() {
|
||||
return cubagePercent;
|
||||
}
|
||||
public void setCubagePercent(String cubagePercent) {
|
||||
this.cubagePercent = cubagePercent;
|
||||
}
|
||||
public String getVirescencePercent() {
|
||||
return virescencePercent;
|
||||
}
|
||||
public void setVirescencePercent(String virescencePercent) {
|
||||
this.virescencePercent = virescencePercent;
|
||||
}
|
||||
public String getEstateCharge() {
|
||||
return estateCharge;
|
||||
}
|
||||
public void setEstateCharge(String estateCharge) {
|
||||
this.estateCharge = estateCharge;
|
||||
}
|
||||
public String getBuildDate() {
|
||||
return buildDate;
|
||||
}
|
||||
public void setBuildDate(String buildDate) {
|
||||
this.buildDate = buildDate;
|
||||
}
|
||||
public Integer getCarSiteCount() {
|
||||
return carSiteCount;
|
||||
}
|
||||
public void setCarSiteCount(Integer carSiteCount) {
|
||||
this.carSiteCount = carSiteCount;
|
||||
}
|
||||
public Integer getHouseholdCount() {
|
||||
return householdCount;
|
||||
}
|
||||
public void setHouseholdCount(Integer householdCount) {
|
||||
this.householdCount = householdCount;
|
||||
}
|
||||
public Integer getDistance() {
|
||||
return distance;
|
||||
}
|
||||
public void setDistance(Integer distance) {
|
||||
this.distance = distance;
|
||||
}
|
||||
public String getFinishBuildingDate() {
|
||||
return finishBuildingDate;
|
||||
}
|
||||
public void setFinishBuildingDate(String finishBuildingDate) {
|
||||
this.finishBuildingDate = finishBuildingDate;
|
||||
}
|
||||
public int getOneMonthAvgPrice() {
|
||||
return oneMonthAvgPrice;
|
||||
}
|
||||
public void setOneMonthAvgPrice(int oneMonthAvgPrice) {
|
||||
this.oneMonthAvgPrice = oneMonthAvgPrice;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+156
@@ -0,0 +1,156 @@
|
||||
package com.fangjia.job.youfang.document;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 房生活小区估价查询
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
public class DistrictEvaluateDto {
|
||||
|
||||
/**
|
||||
* 涨跌幅在城市中的排名
|
||||
*/
|
||||
private double upDownRangecityLevel;
|
||||
|
||||
/**
|
||||
* 相对最高价
|
||||
*/
|
||||
private int cityDistrictMaxSellPrice;
|
||||
|
||||
/**
|
||||
* 相对最低价
|
||||
*/
|
||||
private int cityDistrictMinSellPrice;
|
||||
|
||||
/**
|
||||
* 价格在城市中的排名
|
||||
*/
|
||||
private double priceRate;
|
||||
|
||||
/**
|
||||
* 均价
|
||||
*/
|
||||
private int avgPrice;
|
||||
|
||||
/**
|
||||
* 城市均价走势
|
||||
*/
|
||||
private Map<String, Integer> cityAvgZouShi;
|
||||
|
||||
/**
|
||||
* 区域均价走势
|
||||
*/
|
||||
private Map<String, Integer> regionAvgZouShi;
|
||||
|
||||
/**
|
||||
* 小区均价走势
|
||||
*/
|
||||
private Map<String, Integer> districtAvgZouShi;
|
||||
|
||||
/**
|
||||
* 城市均价相近
|
||||
*/
|
||||
private List<DistrictStatDto> cityAroundList;
|
||||
|
||||
/**
|
||||
* 区域价格相近小区
|
||||
*/
|
||||
private List<DistrictStatDto> regionAroundList;
|
||||
|
||||
/**
|
||||
* 以房换房相近小区
|
||||
*/
|
||||
private List<ChangeHouseDto> tagList;
|
||||
|
||||
private ChangeHouseDto tagBo;
|
||||
|
||||
/**
|
||||
* 以房换房相近小区总数量
|
||||
*/
|
||||
private long count;
|
||||
|
||||
public int getAvgPrice() {
|
||||
return avgPrice;
|
||||
}
|
||||
public void setAvgPrice(int avgPrice) {
|
||||
this.avgPrice = avgPrice;
|
||||
}
|
||||
public double getUpDownRangecityLevel() {
|
||||
return upDownRangecityLevel;
|
||||
}
|
||||
public void setUpDownRangecityLevel(double upDownRangecityLevel) {
|
||||
this.upDownRangecityLevel = upDownRangecityLevel;
|
||||
}
|
||||
public int getCityDistrictMaxSellPrice() {
|
||||
return cityDistrictMaxSellPrice;
|
||||
}
|
||||
public void setCityDistrictMaxSellPrice(int cityDistrictMaxSellPrice) {
|
||||
this.cityDistrictMaxSellPrice = cityDistrictMaxSellPrice;
|
||||
}
|
||||
public int getCityDistrictMinSellPrice() {
|
||||
return cityDistrictMinSellPrice;
|
||||
}
|
||||
public void setCityDistrictMinSellPrice(int cityDistrictMinSellPrice) {
|
||||
this.cityDistrictMinSellPrice = cityDistrictMinSellPrice;
|
||||
}
|
||||
public double getPriceRate() {
|
||||
return priceRate;
|
||||
}
|
||||
public void setPriceRate(double priceRate) {
|
||||
this.priceRate = priceRate;
|
||||
}
|
||||
public Map<String, Integer> getCityAvgZouShi() {
|
||||
return cityAvgZouShi;
|
||||
}
|
||||
public void setCityAvgZouShi(Map<String, Integer> cityAvgZouShi) {
|
||||
this.cityAvgZouShi = cityAvgZouShi;
|
||||
}
|
||||
public Map<String, Integer> getRegionAvgZouShi() {
|
||||
return regionAvgZouShi;
|
||||
}
|
||||
public void setRegionAvgZouShi(Map<String, Integer> regionAvgZouShi) {
|
||||
this.regionAvgZouShi = regionAvgZouShi;
|
||||
}
|
||||
public Map<String, Integer> getDistrictAvgZouShi() {
|
||||
return districtAvgZouShi;
|
||||
}
|
||||
public void setDistrictAvgZouShi(Map<String, Integer> districtAvgZouShi) {
|
||||
this.districtAvgZouShi = districtAvgZouShi;
|
||||
}
|
||||
public List<DistrictStatDto> getCityAroundList() {
|
||||
return cityAroundList;
|
||||
}
|
||||
public void setCityAroundList(List<DistrictStatDto> cityAroundList) {
|
||||
this.cityAroundList = cityAroundList;
|
||||
}
|
||||
public List<DistrictStatDto> getRegionAroundList() {
|
||||
return regionAroundList;
|
||||
}
|
||||
public void setRegionAroundList(List<DistrictStatDto> regionAroundList) {
|
||||
this.regionAroundList = regionAroundList;
|
||||
}
|
||||
public List<ChangeHouseDto> getTagList() {
|
||||
return tagList;
|
||||
}
|
||||
public void setTagList(List<ChangeHouseDto> tagList) {
|
||||
this.tagList = tagList;
|
||||
}
|
||||
public long getCount() {
|
||||
return count;
|
||||
}
|
||||
public void setCount(long count) {
|
||||
this.count = count;
|
||||
}
|
||||
public ChangeHouseDto getTagBo() {
|
||||
return tagBo;
|
||||
}
|
||||
public void setTagBo(ChangeHouseDto tagBo) {
|
||||
this.tagBo = tagBo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.fangjia.job.youfang.document;
|
||||
|
||||
import com.fangjia.job.common.base.ReponseData;
|
||||
|
||||
public class DistrictEvaluateSingleDto extends ReponseData {
|
||||
private DistrictEvaluateDto result;
|
||||
|
||||
public DistrictEvaluateDto getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(DistrictEvaluateDto result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.fangjia.job.youfang.document;
|
||||
|
||||
import com.fangjia.job.common.base.ReponseData;
|
||||
|
||||
public class DistrictInfoDto extends ReponseData{
|
||||
private DistrictBaseInfoDto result;
|
||||
|
||||
public DistrictBaseInfoDto getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(DistrictBaseInfoDto result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.fangjia.job.youfang.document;
|
||||
|
||||
import com.fangjia.job.common.base.ReponseData;
|
||||
|
||||
public class DistrictSearchSingleDto extends ReponseData {
|
||||
private DistrictDto result;
|
||||
|
||||
public DistrictDto getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(DistrictDto result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
||||
+199
@@ -0,0 +1,199 @@
|
||||
package com.fangjia.job.youfang.document;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class DistrictStatDto {
|
||||
private String id;
|
||||
/**
|
||||
* 小区名
|
||||
*/
|
||||
private String districtName;
|
||||
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
private String city;
|
||||
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 区域
|
||||
*/
|
||||
private String region;
|
||||
|
||||
/**
|
||||
* 板块
|
||||
*/
|
||||
private String block;
|
||||
private String estateType;
|
||||
private double credit;
|
||||
private Integer valueType;
|
||||
private Date weekend;
|
||||
private int avgPrice;
|
||||
private int markup;
|
||||
private int weekendMarkup;
|
||||
private int changedMarkup;
|
||||
private int calcValue;
|
||||
private int sampleSize;
|
||||
/********来源于DistrictTag*******/
|
||||
private List<String> poiTags; //小区地图标签
|
||||
private Integer purpose; //小区用途
|
||||
private List<Integer> areaTags;//编辑标签
|
||||
private Integer poiSize; //地图标签大小
|
||||
|
||||
private Map<String,Double> avgArea;
|
||||
|
||||
private Integer index; //潜力指数
|
||||
|
||||
private double rentRate;//租售比
|
||||
private double distance;//距离
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getDistrictName() {
|
||||
return districtName;
|
||||
}
|
||||
public void setDistrictName(String districtName) {
|
||||
this.districtName = districtName;
|
||||
}
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
public String getRegion() {
|
||||
return region;
|
||||
}
|
||||
public void setRegion(String region) {
|
||||
this.region = region;
|
||||
}
|
||||
public String getBlock() {
|
||||
return block;
|
||||
}
|
||||
public void setBlock(String block) {
|
||||
this.block = block;
|
||||
}
|
||||
public String getEstateType() {
|
||||
return estateType;
|
||||
}
|
||||
public void setEstateType(String estateType) {
|
||||
this.estateType = estateType;
|
||||
}
|
||||
public double getCredit() {
|
||||
return credit;
|
||||
}
|
||||
public void setCredit(double credit) {
|
||||
this.credit = credit;
|
||||
}
|
||||
public Integer getValueType() {
|
||||
return valueType;
|
||||
}
|
||||
public void setValueType(Integer valueType) {
|
||||
this.valueType = valueType;
|
||||
}
|
||||
public Date getWeekend() {
|
||||
return weekend;
|
||||
}
|
||||
public void setWeekend(Date weekend) {
|
||||
this.weekend = weekend;
|
||||
}
|
||||
public int getAvgPrice() {
|
||||
return avgPrice;
|
||||
}
|
||||
public void setAvgPrice(int avgPrice) {
|
||||
this.avgPrice = avgPrice;
|
||||
}
|
||||
public int getMarkup() {
|
||||
return markup;
|
||||
}
|
||||
public void setMarkup(int markup) {
|
||||
this.markup = markup;
|
||||
}
|
||||
public int getWeekendMarkup() {
|
||||
return weekendMarkup;
|
||||
}
|
||||
public void setWeekendMarkup(int weekendMarkup) {
|
||||
this.weekendMarkup = weekendMarkup;
|
||||
}
|
||||
public int getChangedMarkup() {
|
||||
return changedMarkup;
|
||||
}
|
||||
public void setChangedMarkup(int changedMarkup) {
|
||||
this.changedMarkup = changedMarkup;
|
||||
}
|
||||
public int getCalcValue() {
|
||||
return calcValue;
|
||||
}
|
||||
public void setCalcValue(int calcValue) {
|
||||
this.calcValue = calcValue;
|
||||
}
|
||||
public int getSampleSize() {
|
||||
return sampleSize;
|
||||
}
|
||||
public void setSampleSize(int sampleSize) {
|
||||
this.sampleSize = sampleSize;
|
||||
}
|
||||
public List<String> getPoiTags() {
|
||||
return poiTags;
|
||||
}
|
||||
public void setPoiTags(List<String> poiTags) {
|
||||
this.poiTags = poiTags;
|
||||
}
|
||||
public Integer getPurpose() {
|
||||
return purpose;
|
||||
}
|
||||
public void setPurpose(Integer purpose) {
|
||||
this.purpose = purpose;
|
||||
}
|
||||
public List<Integer> getAreaTags() {
|
||||
return areaTags;
|
||||
}
|
||||
public void setAreaTags(List<Integer> areaTags) {
|
||||
this.areaTags = areaTags;
|
||||
}
|
||||
public Integer getPoiSize() {
|
||||
return poiSize;
|
||||
}
|
||||
public void setPoiSize(Integer poiSize) {
|
||||
this.poiSize = poiSize;
|
||||
}
|
||||
public Map<String,Double> getAvgArea() {
|
||||
return avgArea;
|
||||
}
|
||||
public void setAvgArea(Map<String,Double> avgArea) {
|
||||
this.avgArea = avgArea;
|
||||
}
|
||||
public Integer getIndex() {
|
||||
return index;
|
||||
}
|
||||
public void setIndex(Integer index) {
|
||||
this.index = index;
|
||||
}
|
||||
public double getRentRate() {
|
||||
return rentRate;
|
||||
}
|
||||
public void setRentRate(double rentRate) {
|
||||
this.rentRate = rentRate;
|
||||
}
|
||||
public double getDistance() {
|
||||
return distance;
|
||||
}
|
||||
public void setDistance(double distance) {
|
||||
this.distance = distance;
|
||||
}
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
}
|
||||
+146
@@ -0,0 +1,146 @@
|
||||
package com.fangjia.job.youfang.job;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Semaphore;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.springframework.data.mongodb.core.query.Criteria;
|
||||
import org.springframework.data.mongodb.core.query.Query;
|
||||
|
||||
import com.dangdang.ddframe.job.api.ShardingContext;
|
||||
import com.dangdang.ddframe.job.api.simple.SimpleJob;
|
||||
import com.fangjia.job.common.util.DingDingMessageUtil;
|
||||
import com.fangjia.job.common.util.RestApiCallUtils;
|
||||
import com.fangjia.job.youfang.document.AgencyInfo;
|
||||
import com.fangjia.job.youfang.document.DistrictBaseInfoDto;
|
||||
import com.fangjia.job.youfang.document.DistrictDetail;
|
||||
import com.fangjia.job.youfang.document.DistrictDto;
|
||||
import com.fangjia.job.youfang.document.DistrictEvaluateDto;
|
||||
import com.fangjia.job.youfang.document.DistrictEvaluateSingleDto;
|
||||
import com.fangjia.job.youfang.document.DistrictInfoDto;
|
||||
import com.fangjia.job.youfang.document.DistrictSearchSingleDto;
|
||||
import com.fangjia.job.youfang.remote.FshApiRemoteService;
|
||||
import com.mongodb.BasicDBObject;
|
||||
import com.mongodb.Bytes;
|
||||
import com.mongodb.DBCollection;
|
||||
import com.mongodb.DBCursor;
|
||||
import com.mongodb.DBObject;
|
||||
|
||||
public class DistrictInfoJob implements SimpleJob{
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(DistrictInfoJob.class);
|
||||
|
||||
@Value("${FANGJIA_API_TOKEN}")
|
||||
private String token;
|
||||
|
||||
@Value("${open.url}")
|
||||
private String openApiUrl;
|
||||
|
||||
@Autowired
|
||||
private MongoTemplate mongoTemplate;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("seaweedMongoTemplate")
|
||||
private MongoTemplate seaweedMongoTemplate;
|
||||
|
||||
private ExecutorService fixPool = Executors.newFixedThreadPool(5);
|
||||
|
||||
@Override
|
||||
public void execute(ShardingContext shardingContext) {
|
||||
logger.info("开始进行小区数据汇总任务");
|
||||
final FshApiRemoteService fshApiRemoteService = RestApiCallUtils.getRestClient(FshApiRemoteService.class, openApiUrl);
|
||||
DBCollection collection = seaweedMongoTemplate.getCollection("seaweed");
|
||||
DBCursor cursor = collection.find(new BasicDBObject("cat", "district").append("status", 0),
|
||||
new BasicDBObject("city", 1).append("region", 1).append("name", 1)).addOption(Bytes.QUERYOPTION_NOTIMEOUT);
|
||||
final Semaphore semaphore = new Semaphore(5);
|
||||
while (cursor.hasNext()) {
|
||||
final DBObject data = cursor.next();
|
||||
try {
|
||||
semaphore.acquire();
|
||||
} catch (InterruptedException e1) {
|
||||
}
|
||||
fixPool.execute(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
String city = String.valueOf(data.get("city"));
|
||||
String region = String.valueOf(data.get("region"));
|
||||
String name = String.valueOf(data.get("name"));
|
||||
Map<String, Object> params = new HashMap<String,Object>();
|
||||
params.put("city", city);
|
||||
params.put("district", region);
|
||||
params.put("name", name);
|
||||
params.put("token", token);
|
||||
DistrictDetail districtDetail = mongoTemplate.findOne(Query.query(Criteria.where("city").is(city).and("region").is(region).and("name").is(name)), DistrictDetail.class);
|
||||
if(districtDetail == null) {
|
||||
districtDetail = new DistrictDetail();
|
||||
}
|
||||
districtDetail.setCity(city);
|
||||
districtDetail.setRegion(region);
|
||||
districtDetail.setName(name);
|
||||
districtDetail.setModifyTime(new Date());
|
||||
DistrictEvaluateSingleDto dto = fshApiRemoteService.getDistrictNewPriceInfo(params);
|
||||
DistrictInfoDto districtInfoDto = fshApiRemoteService.detail(params);
|
||||
Map<String,Object> s = fshApiRemoteService.getAgencyInfo(params);
|
||||
params.put("size", 111.11);
|
||||
params.put("propertyType", 2);
|
||||
DistrictSearchSingleDto dssDto = fshApiRemoteService.evaluate(params);
|
||||
|
||||
AgencyInfo a = new AgencyInfo();
|
||||
if(s!=null&&(s.get("result")!=null)) {
|
||||
Map<String,Object> result = (Map<String, Object>) s.get("result");
|
||||
a.setAgencyMount(result.get("agencyMount")==null?0:(Integer)result.get("agencyMount"));
|
||||
a.setCitySize(result.get("citySize")==null?0:(Integer)result.get("citySize"));
|
||||
a.setFamousAgency(result.get("famousAgency")==null?0:(Integer)result.get("famousAgency"));
|
||||
a.setMaxCityAgency(result.get("maxCityAgency")==null?0:(Integer)result.get("maxCityAgency"));
|
||||
a.setMomCityLevel(result.get("momCityLevel")==null?0:(Integer)result.get("momCityLevel"));
|
||||
a.setOtherAgency(result.get("otherAgency")==null?0:(Integer)result.get("otherAgency"));
|
||||
}
|
||||
DistrictEvaluateDto deDto = dto==null?null:dto.getResult();
|
||||
if(deDto!=null&&null!=dssDto&&dssDto.getResult()!=null) {
|
||||
DistrictDto dDto = dssDto.getResult();
|
||||
deDto.setUpDownRangecityLevel(dDto.getUpDownRangecityLevel());
|
||||
deDto.setAvgPrice(dDto.getAvgPrice());
|
||||
deDto.setCityDistrictMaxSellPrice(dDto.getCityDistrictMaxSellPrice());
|
||||
deDto.setCityDistrictMinSellPrice(dDto.getCityDistrictMinSellPrice());
|
||||
deDto.setPriceRate(dDto.getPriceRate());
|
||||
}
|
||||
DistrictBaseInfoDto dbiDto = districtInfoDto==null?null:districtInfoDto.getResult();
|
||||
if(dbiDto!=null&&null!=dssDto&&dssDto.getResult()!=null) {
|
||||
DistrictDto add = dssDto.getResult();// FROM evaluate
|
||||
DistrictDto original = dbiDto.getDistrict();
|
||||
original.setUpDownRangecityLevel(add.getUpDownRangecityLevel());
|
||||
original.setAvgPrice(add.getAvgPrice());
|
||||
original.setCityDistrictMaxSellPrice(add.getCityDistrictMaxSellPrice());
|
||||
original.setCityDistrictMinSellPrice(add.getCityDistrictMinSellPrice());
|
||||
original.setPriceRate(add.getPriceRate());
|
||||
original.setTotalScore(add.getTotalScore());
|
||||
}
|
||||
districtDetail.setAgencyInfo(a);
|
||||
districtDetail.setDistrictBaseInfo(null!=districtInfoDto?districtInfoDto.getResult():null);
|
||||
districtDetail.setDistrictNewPriceInfo(deDto);
|
||||
mongoTemplate.save(districtDetail);
|
||||
}catch(Exception e) {
|
||||
logger.error("有房小区详情数据汇总异常", e);
|
||||
DingDingMessageUtil.sendTextMessage("有房小区详情数据汇总异常:" + e.getMessage());
|
||||
}finally {
|
||||
semaphore.release();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
logger.info("结束小区数据汇总任务");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
package com.fangjia.job.youfang.job;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Semaphore;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import com.dangdang.ddframe.job.api.ShardingContext;
|
||||
import com.dangdang.ddframe.job.api.simple.SimpleJob;
|
||||
import com.fangjia.job.common.util.DingDingMessageUtil;
|
||||
import com.fangjia.job.common.util.RestApiCallUtils;
|
||||
import com.fangjia.job.youfang.remote.FshApiRemoteService;
|
||||
import com.mongodb.BasicDBObject;
|
||||
import com.mongodb.Bytes;
|
||||
import com.mongodb.DBCollection;
|
||||
import com.mongodb.DBCursor;
|
||||
import com.mongodb.DBObject;
|
||||
|
||||
/**
|
||||
* 提前刷新缓存任务
|
||||
* @author yinjihuan
|
||||
*
|
||||
*/
|
||||
public class RefreshCacheJob implements SimpleJob {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(RefreshCacheJob.class);
|
||||
|
||||
@Autowired
|
||||
@Qualifier("seaweedMongoTemplate")
|
||||
private MongoTemplate seaweedMongoTemplate;
|
||||
|
||||
@Value("${fsh.url}")
|
||||
private String fshApiUrl;
|
||||
|
||||
private ExecutorService fixPool = Executors.newFixedThreadPool(1);
|
||||
|
||||
@Override
|
||||
public void execute(ShardingContext shardingContext) {
|
||||
logger.info("开始进行缓存刷新任务");
|
||||
final FshApiRemoteService fshApiRemoteService = RestApiCallUtils.getRestClient(FshApiRemoteService.class, fshApiUrl);
|
||||
DBCollection collection = seaweedMongoTemplate.getCollection("seaweed");
|
||||
DBCursor cursor = collection.find(new BasicDBObject("cat", "district").append("status", 0).append("city", "上海"),
|
||||
new BasicDBObject("city", 1).append("region", 1).append("name", 1)).addOption(Bytes.QUERYOPTION_NOTIMEOUT);
|
||||
final Semaphore semaphore = new Semaphore(5);
|
||||
while (cursor.hasNext()) {
|
||||
final DBObject data = cursor.next();
|
||||
try {
|
||||
semaphore.acquire();
|
||||
} catch (InterruptedException e1) {
|
||||
}
|
||||
fixPool.execute(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
String city = String.valueOf(data.get("city"));
|
||||
String region = String.valueOf(data.get("region"));
|
||||
String name = String.valueOf(data.get("name"));
|
||||
Map<String, Object> params = new HashMap<String,Object>();
|
||||
params.put("city", city);
|
||||
params.put("region", region);
|
||||
params.put("name", name);
|
||||
fshApiRemoteService.refreshDistrictDetailPageData(params);
|
||||
} catch(Exception e) {
|
||||
} finally {
|
||||
semaphore.release();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
logger.info("结束缓存刷新任务");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+35
@@ -1,7 +1,14 @@
|
||||
package com.fangjia.job.youfang.remote;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.fangjia.job.common.base.Response;
|
||||
import com.fangjia.job.youfang.document.DistrictEvaluateSingleDto;
|
||||
import com.fangjia.job.youfang.document.DistrictInfoDto;
|
||||
import com.fangjia.job.youfang.document.DistrictSearchSingleDto;
|
||||
|
||||
import feign.Param;
|
||||
import feign.QueryMap;
|
||||
import feign.RequestLine;
|
||||
|
||||
/**
|
||||
@@ -34,4 +41,32 @@ public interface FshApiRemoteService {
|
||||
@RequestLine("GET /rest/houses/eval?token={token}")
|
||||
public Response evalAllHousePrice(@Param("token")String token);
|
||||
|
||||
@RequestLine("GET /fsh/getAgencyInfo")
|
||||
public Map<String,Object> getAgencyInfo(@QueryMap Map<String, Object> queryMap);
|
||||
|
||||
/**
|
||||
* 获取小区综合信息district_new_price
|
||||
* @param queryMap
|
||||
* @return
|
||||
*/
|
||||
@RequestLine("GET /fsh/getDistrictNewPriceInfo")
|
||||
public DistrictEvaluateSingleDto getDistrictNewPriceInfo(@QueryMap Map<String, Object> queryMap);
|
||||
|
||||
/**
|
||||
* 小区详情
|
||||
*/
|
||||
@RequestLine("GET /fsh/detail")
|
||||
public DistrictInfoDto detail(@QueryMap Map<String, Object> queryMap);
|
||||
|
||||
//小区估价接口
|
||||
@RequestLine("GET /fsh/evaluate")
|
||||
public DistrictSearchSingleDto evaluate(@QueryMap Map<String, Object> queryMap);
|
||||
|
||||
/**
|
||||
* 刷新小区详情页面缓存数据
|
||||
* @param queryMap
|
||||
* @return
|
||||
*/
|
||||
@RequestLine("GET /district/details")
|
||||
public String refreshDistrictDetailPageData(@QueryMap Map<String, Object> queryMap);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
spring.data.mongodb.uri=mongodb://192.168.0.136/fangjia_youfang
|
||||
mongo.youfang.url=mongo.db.fangjia.com
|
||||
mongo.youfang.name=fangjia_youfang
|
||||
mongo.youfang.port=27017
|
||||
|
||||
mongo.seaweed.url=mongo.db.fangjia.com
|
||||
mongo.seaweed.name=fangjia
|
||||
mongo.seaweed.port=27017
|
||||
|
||||
spring.datasource.url=jdbc:mysql://192.168.0.132:4306/fangjia_youfang
|
||||
spring.datasource.username=sa
|
||||
@@ -10,7 +16,11 @@ spring.datasource.log.username=sa
|
||||
spring.datasource.log.password=G00jia
|
||||
spring.datasource.log.driver-class-name=com.mysql.jdbc.Driver
|
||||
|
||||
fsh.url=http://192.168.0.251:8086
|
||||
fsh.url=http://192.168.10.47:8086
|
||||
|
||||
zk.server-lists=192.168.10.47:2181
|
||||
zk.namespace=fangjia-job-youfang-test
|
||||
zk.namespace=fangjia-job-youfang-test
|
||||
|
||||
|
||||
open.url=http://192.168.10.47:9180
|
||||
FANGJIA_API_TOKEN=F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB
|
||||
@@ -1,4 +1,10 @@
|
||||
spring.data.mongodb.uri=mongodb://mongo.db.fangjia.com/fangjia_youfang
|
||||
mongo.youfang.url=mongo.db.fangjia.com
|
||||
mongo.youfang.name=fangjia_youfang
|
||||
mongo.youfang.port=27017
|
||||
|
||||
mongo.seaweed.url=222.73.196.152
|
||||
mongo.seaweed.name=fangjia
|
||||
mongo.seaweed.port=57009
|
||||
|
||||
spring.datasource.url=jdbc:mysql://mysql.db.fangjia.com:4306/fangjia_youfang
|
||||
spring.datasource.username=sa
|
||||
@@ -16,4 +22,8 @@ spring.datasource.log.driver-class-name=com.mysql.jdbc.Driver
|
||||
fsh.url=http://youfang.fangjia.com
|
||||
|
||||
zk.server-lists=192.168.0.45:2181,192.168.0.46:2181,192.168.0.109:2181
|
||||
zk.namespace=fangjia-job-youfang
|
||||
zk.namespace=fangjia-job-youfang
|
||||
|
||||
|
||||
open.url=http://open.fangjia.com
|
||||
FANGJIA_API_TOKEN=F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB
|
||||
@@ -1,4 +1,10 @@
|
||||
spring.data.mongodb.uri=mongodb://192.168.0.136/fangjia_youfang
|
||||
mongo.youfang.url=mongo.db.fangjia.com
|
||||
mongo.youfang.name=fangjia_youfang
|
||||
mongo.youfang.port=27017
|
||||
|
||||
mongo.seaweed.url=mongo.db.fangjia.com
|
||||
mongo.seaweed.name=fangjia
|
||||
mongo.seaweed.port=27017
|
||||
|
||||
spring.datasource.url=jdbc:mysql://192.168.0.132:4306/fangjia_youfang
|
||||
spring.datasource.username=sa
|
||||
@@ -10,7 +16,11 @@ spring.datasource.log.username=sa
|
||||
spring.datasource.log.password=G00jia
|
||||
spring.datasource.log.driver-class-name=com.mysql.jdbc.Driver
|
||||
|
||||
fsh.url=http://192.168.0.251:8086
|
||||
fsh.url=http://192.168.10.47:8086
|
||||
|
||||
zk.server-lists=192.168.10.47:2181
|
||||
zk.namespace=fangjia-job-youfang-test
|
||||
zk.namespace=fangjia-job-youfang-test
|
||||
|
||||
|
||||
open.url=http://192.168.10.47:9180
|
||||
FANGJIA_API_TOKEN=F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB
|
||||
@@ -93,4 +93,24 @@
|
||||
|
||||
</job:simple>
|
||||
|
||||
<!-- 有房小区详情信息汇总 每周一0点10分执行-->
|
||||
<job:simple id="districtInfoJob" class="com.fangjia.job.youfang.job.DistrictInfoJob" registry-center-ref="regCenter"
|
||||
sharding-total-count="1" cron="0 10 0 ? * 2" sharding-item-parameters=""
|
||||
failover="true" description="【有房】 有房小区详情信息汇总"
|
||||
overwrite="true" event-trace-rdb-data-source="elasticJobLog" job-exception-handler="com.fangjia.job.youfang.handler.CustomJobExceptionHandler">
|
||||
|
||||
<job:listener class="com.fangjia.job.youfang.listener.MessageElasticJobListener"></job:listener>
|
||||
|
||||
</job:simple>
|
||||
|
||||
<!-- 有房小区详情缓存刷新任务
|
||||
<job:simple id="refreshCacheJob" class="com.fangjia.job.youfang.job.RefreshCacheJob" registry-center-ref="regCenter"
|
||||
sharding-total-count="1" cron="0 30 11 * * ?" sharding-item-parameters="" disabled="true"
|
||||
failover="true" description="【有房】 有房小区详情缓存刷新任务"
|
||||
overwrite="true" event-trace-rdb-data-source="elasticJobLog" job-exception-handler="com.fangjia.job.youfang.handler.CustomJobExceptionHandler">
|
||||
|
||||
<job:listener class="com.fangjia.job.youfang.listener.MessageElasticJobListener"></job:listener>
|
||||
|
||||
</job:simple>-->
|
||||
|
||||
</beans>
|
||||
Reference in New Issue
Block a user