新增平米租金接口
This commit is contained in:
@@ -22,8 +22,8 @@ public class SqmetreRent implements MongoEntity {
|
|||||||
private String city;
|
private String city;
|
||||||
private String region;
|
private String region;
|
||||||
private String districtName;
|
private String districtName;
|
||||||
private Integer avgPrice;
|
private Number avgPrice;
|
||||||
private Integer calcAvgPrice;
|
private Number calcAvgPrice;
|
||||||
private Double markup;
|
private Double markup;
|
||||||
private Date weekend;
|
private Date weekend;
|
||||||
private String cat;
|
private String cat;
|
||||||
@@ -74,20 +74,20 @@ public class SqmetreRent implements MongoEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Column(name = "avg_price")
|
@Column(name = "avg_price")
|
||||||
public Integer getAvgPrice() {
|
public Number getAvgPrice() {
|
||||||
return avgPrice;
|
return avgPrice;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAvgPrice(Integer avgPrice) {
|
public void setAvgPrice(Number avgPrice) {
|
||||||
this.avgPrice = avgPrice;
|
this.avgPrice = avgPrice;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Column(name = "calc_avg_price")
|
@Column(name = "calc_avg_price")
|
||||||
public Integer getCalcAvgPrice() {
|
public Number getCalcAvgPrice() {
|
||||||
return calcAvgPrice;
|
return calcAvgPrice;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCalcAvgPrice(Integer calcAvgPrice) {
|
public void setCalcAvgPrice(Number calcAvgPrice) {
|
||||||
this.calcAvgPrice = calcAvgPrice;
|
this.calcAvgPrice = calcAvgPrice;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,6 +164,4 @@ public class SqmetreRent implements MongoEntity {
|
|||||||
this.cat = cat;
|
this.cat = cat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+78
-22
@@ -14,6 +14,7 @@ import java.util.*;
|
|||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import javax.persistence.Id;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
@@ -1300,6 +1301,7 @@ public class PropertyController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static final Map<String, Double> CITY_CORRECTION_FACTOR = new HashMap<String, Double>();
|
static final Map<String, Double> CITY_CORRECTION_FACTOR = new HashMap<String, Double>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
CITY_CORRECTION_FACTOR.put("上海", 0.02);
|
CITY_CORRECTION_FACTOR.put("上海", 0.02);
|
||||||
CITY_CORRECTION_FACTOR.put("杭州", 0.1);
|
CITY_CORRECTION_FACTOR.put("杭州", 0.1);
|
||||||
@@ -1564,8 +1566,10 @@ public class PropertyController {
|
|||||||
mav.setModel(BasicModel.buildOKModel().setResult(districtPriceMap));
|
mav.setModel(BasicModel.buildOKModel().setResult(districtPriceMap));
|
||||||
return mav;
|
return mav;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 地址估值
|
* 地址估值
|
||||||
|
*
|
||||||
* @param model 参数
|
* @param model 参数
|
||||||
* @param request
|
* @param request
|
||||||
* @return
|
* @return
|
||||||
@@ -1779,6 +1783,7 @@ public class PropertyController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 四川锦程 定制接口 多建筑年代
|
* 四川锦程 定制接口 多建筑年代
|
||||||
|
*
|
||||||
* @param model
|
* @param model
|
||||||
* @param request
|
* @param request
|
||||||
* @return
|
* @return
|
||||||
@@ -2457,6 +2462,67 @@ public class PropertyController {
|
|||||||
return mav;
|
return mav;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 平米租金
|
||||||
|
* cat 表示租金类型
|
||||||
|
* city:城市 , region : 区域 ,district :小区
|
||||||
|
*
|
||||||
|
* @param model
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Object sqmeterRentAction(AvgPriceQueryModel model) {
|
||||||
|
RestfulModelAndView mav = new RestfulModelAndView();
|
||||||
|
mav.setViewType("rest");
|
||||||
|
if (StringUtils.isBlank(model.getCat())) {
|
||||||
|
mav.setModel(BasicModel.buildBadRequestModel("参数缺失:cat(租金类型)是必须参数"));
|
||||||
|
return mav;
|
||||||
|
}
|
||||||
|
if ("city".equals(model.getCity()) && StringUtils.isBlank(model.getCity())) {
|
||||||
|
mav.setModel(BasicModel.buildBadRequestModel("城市平米租金,city(城市)是必须参数"));
|
||||||
|
return mav;
|
||||||
|
}
|
||||||
|
if ("region".equals(model.getCity()) && (StringUtils.isBlank(model.getCity()) || StringUtils.isBlank(model.getDistrict()))) {
|
||||||
|
mav.setModel(BasicModel.buildBadRequestModel("区域平米租金,city(城市),district(区域)是必须参数"));
|
||||||
|
return mav;
|
||||||
|
}
|
||||||
|
if ("district".equals(model.getCity()) && (StringUtils.isBlank(model.getCity()) || StringUtils.isBlank(model.getDistrict()) || StringUtils.isBlank(model.getName()))) {
|
||||||
|
mav.setModel(BasicModel.buildBadRequestModel("小区平米租金,city(城市),district(区域),name(小区名)是必须参数"));
|
||||||
|
return mav;
|
||||||
|
}
|
||||||
|
if ("district".equals(model.getCat())) {
|
||||||
|
District district = districtService.findByNameAndAlias(model.getCity(), model.getDistrict(), model.getName(),
|
||||||
|
"district");
|
||||||
|
if (null == district) {
|
||||||
|
mav.setModel(BasicModel.buildBadRequestModel("小区不存在"));
|
||||||
|
return mav;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (model.getPeriodCount() == null) {
|
||||||
|
model.setPeriodCount(1);
|
||||||
|
}
|
||||||
|
if (model.getPeriodCount() < 1 || model.getPeriodCount() > 156) {
|
||||||
|
mav.setModel(BasicModel.buildBadRequestModel("periodCount值不合法,取值范围是:[1-156]"));
|
||||||
|
return mav;
|
||||||
|
}
|
||||||
|
Date startDate = DateUtil.add(new Date(), Calendar.MONTH, -model.getPeriodCount());
|
||||||
|
|
||||||
|
List<SqmetreRent> sqmetreRents = sqmetreRentService.findSqmetreRents(model.getCity(), model.getDistrict(), model.getName(), model.getCat(), startDate, null);
|
||||||
|
List<Map<String, Object>> result = new ArrayList<Map<String, Object>>(model.getPeriodCount());
|
||||||
|
|
||||||
|
for (SqmetreRent sqmetreRent : sqmetreRents) {
|
||||||
|
Map<String, Object> item = new LinkedHashMap<String, Object>();
|
||||||
|
item.put("city", sqmetreRent.getCity());
|
||||||
|
item.put("district", sqmetreRent.getRegion());
|
||||||
|
item.put("name", sqmetreRent.getDistrictName());
|
||||||
|
item.put("rent", sqmetreRent.getAvgPrice().intValue());
|
||||||
|
item.put("date", DateUtil.formatByPattern(sqmetreRent.getWeekend(), "yyyy-MM"));
|
||||||
|
result.add(item);
|
||||||
|
}
|
||||||
|
mav.setModel(BasicModel.buildOKModel().setResult(result));
|
||||||
|
return mav;
|
||||||
|
}
|
||||||
|
|
||||||
public Object rankAction(final DealPriceModel model) {
|
public Object rankAction(final DealPriceModel model) {
|
||||||
|
|
||||||
RestfulModelAndView mav = new RestfulModelAndView();
|
RestfulModelAndView mav = new RestfulModelAndView();
|
||||||
@@ -2495,7 +2561,6 @@ public class PropertyController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 小区成交记录查询
|
* 小区成交记录查询
|
||||||
*
|
*
|
||||||
@@ -4403,17 +4468,13 @@ public class PropertyController {
|
|||||||
* 相同小区相似户型房源挂牌量接口<br>
|
* 相同小区相似户型房源挂牌量接口<br>
|
||||||
* 获取该小区的满足指定相似条件的挂牌房源量 条件说明: 1.输入面积-5<=房源面积<=输入面积+5 2.上个月发布的房源
|
* 获取该小区的满足指定相似条件的挂牌房源量 条件说明: 1.输入面积-5<=房源面积<=输入面积+5 2.上个月发布的房源
|
||||||
*
|
*
|
||||||
|
* @param city 城市
|
||||||
|
* @param district 区域
|
||||||
|
* @param name 小区名
|
||||||
|
* @param size 面积
|
||||||
|
* @return
|
||||||
* @author yinjihuan
|
* @author yinjihuan
|
||||||
* @date 2016年9月1日
|
* @date 2016年9月1日
|
||||||
* @param city
|
|
||||||
* 城市
|
|
||||||
* @param district
|
|
||||||
* 区域
|
|
||||||
* @param name
|
|
||||||
* 小区名
|
|
||||||
* @param size
|
|
||||||
* 面积
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public Object similarHouseAmoutAction(@Param(name = "city") String city, @Param(name = "district") String district,
|
public Object similarHouseAmoutAction(@Param(name = "city") String city, @Param(name = "district") String district,
|
||||||
@Param(name = "name") String name, @Param(name = "size") Double size) {
|
@Param(name = "name") String name, @Param(name = "size") Double size) {
|
||||||
@@ -4443,19 +4504,14 @@ public class PropertyController {
|
|||||||
* 周边小区相似户型挂牌量接口<br>
|
* 周边小区相似户型挂牌量接口<br>
|
||||||
* 获取该小区的满足指定相似条件的挂牌房源量 条件说明: 1.输入面积-5<=房源面积<=输入面积+5 2.上个月发布的房源
|
* 获取该小区的满足指定相似条件的挂牌房源量 条件说明: 1.输入面积-5<=房源面积<=输入面积+5 2.上个月发布的房源
|
||||||
*
|
*
|
||||||
|
* @param city 城市
|
||||||
|
* @param district 区域
|
||||||
|
* @param name 小区名
|
||||||
|
* @param size 面积
|
||||||
|
* @param radius 周边小区最大半径(单位:米,默认2000)
|
||||||
|
* @return
|
||||||
* @author yinjihuan
|
* @author yinjihuan
|
||||||
* @date 2016年9月1日
|
* @date 2016年9月1日
|
||||||
* @param city
|
|
||||||
* 城市
|
|
||||||
* @param district
|
|
||||||
* 区域
|
|
||||||
* @param name
|
|
||||||
* 小区名
|
|
||||||
* @param size
|
|
||||||
* 面积
|
|
||||||
* @param radius
|
|
||||||
* 周边小区最大半径(单位:米,默认2000)
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public Object nearbySimilarHouseAmoutAction(@Param(name = "city") String city,
|
public Object nearbySimilarHouseAmoutAction(@Param(name = "city") String city,
|
||||||
@Param(name = "district") String district, @Param(name = "name") String name,
|
@Param(name = "district") String district, @Param(name = "name") String name,
|
||||||
@@ -4494,9 +4550,9 @@ public class PropertyController {
|
|||||||
/**
|
/**
|
||||||
* 小区周边一公里均价
|
* 小区周边一公里均价
|
||||||
*
|
*
|
||||||
* @author wenyan
|
|
||||||
* @param model
|
* @param model
|
||||||
* @return
|
* @return
|
||||||
|
* @author wenyan
|
||||||
*/
|
*/
|
||||||
public Object aroundAverageAction(@Valid AroundAverageModel model) {
|
public Object aroundAverageAction(@Valid AroundAverageModel model) {
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -203,7 +203,7 @@ public class RentController {
|
|||||||
private Double getSqmetreRent(District district){
|
private Double getSqmetreRent(District district){
|
||||||
SqmetreRent sqmetreRent = sqmetreRentService.findNearestSqmetreRent(district.getCity(), district.getRegion(), district.getName(), null, "district");
|
SqmetreRent sqmetreRent = sqmetreRentService.findNearestSqmetreRent(district.getCity(), district.getRegion(), district.getName(), null, "district");
|
||||||
if(null != sqmetreRent){
|
if(null != sqmetreRent){
|
||||||
return Double.valueOf(sqmetreRent.getAvgPrice());
|
return Double.valueOf(sqmetreRent.getAvgPrice().intValue());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,15 @@ public class AvgPriceQueryModel {
|
|||||||
Integer periodCount;
|
Integer periodCount;
|
||||||
String periodType;
|
String periodType;
|
||||||
Integer houseType;
|
Integer houseType;
|
||||||
|
String cat;
|
||||||
|
|
||||||
|
public String getCat() {
|
||||||
|
return cat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCat(String cat) {
|
||||||
|
this.cat = cat;
|
||||||
|
}
|
||||||
|
|
||||||
public Integer getPeriodCount() {
|
public Integer getPeriodCount() {
|
||||||
return periodCount;
|
return periodCount;
|
||||||
|
|||||||
+1
-1
@@ -1038,7 +1038,7 @@ public class EvaluationServiceImpl implements EvaluationService {
|
|||||||
|
|
||||||
SqmetreRent sqmetreRent = sqmetreRentService.findNearestSqmetreRent(district.getCity(), district.getRegion(), district.getName(), DateUtil.formatToYYYYMMDD(weekend), "district");
|
SqmetreRent sqmetreRent = sqmetreRentService.findNearestSqmetreRent(district.getCity(), district.getRegion(), district.getName(), DateUtil.formatToYYYYMMDD(weekend), "district");
|
||||||
if(sqmetreRent!=null){
|
if(sqmetreRent!=null){
|
||||||
long totalPrice = evaluationRateService.evaluationRent(sqmetreRent.getAvgPrice(), evaluation);
|
long totalPrice = evaluationRateService.evaluationRent(sqmetreRent.getAvgPrice().intValue(), evaluation);
|
||||||
|
|
||||||
evaluation.setTotalPrice(((Number) (totalPrice)).intValue());
|
evaluation.setTotalPrice(((Number) (totalPrice)).intValue());
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -194,7 +194,7 @@ public class HouseReportServiceImpl implements HouseReportService{
|
|||||||
SqmetreRent citySqmetreRent = sqmetreRentService.findNearestSqmetreRent(city, null, null, "city");
|
SqmetreRent citySqmetreRent = sqmetreRentService.findNearestSqmetreRent(city, null, null, "city");
|
||||||
RegionStat cityRegionStat = regionStatService.findByCity(city);
|
RegionStat cityRegionStat = regionStatService.findByCity(city);
|
||||||
if(null != citySqmetreRent && null != cityRegionStat){
|
if(null != citySqmetreRent && null != cityRegionStat){
|
||||||
Double rate = DataUtil.getDoubleRound(2, citySqmetreRent.getAvgPrice()*12*100/cityRegionStat.getAvgPrice());
|
Double rate = DataUtil.getDoubleRound(2, citySqmetreRent.getAvgPrice().intValue()*12*100/cityRegionStat.getAvgPrice());
|
||||||
return rate;
|
return rate;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -205,7 +205,7 @@ public class HouseReportServiceImpl implements HouseReportService{
|
|||||||
SqmetreRent regionSqmetreRent = sqmetreRentService.findNearestSqmetreRent(city, region, null, "region");
|
SqmetreRent regionSqmetreRent = sqmetreRentService.findNearestSqmetreRent(city, region, null, "region");
|
||||||
RegionStat regionStat = regionStatService.findRegionStat(city, region);
|
RegionStat regionStat = regionStatService.findRegionStat(city, region);
|
||||||
if(null != regionSqmetreRent && null != regionStat){
|
if(null != regionSqmetreRent && null != regionStat){
|
||||||
Double rate = DataUtil.getDoubleRound(2, regionSqmetreRent.getAvgPrice()*12*100/regionStat.getAvgPrice());
|
Double rate = DataUtil.getDoubleRound(2, regionSqmetreRent.getAvgPrice().intValue()*12*100/regionStat.getAvgPrice());
|
||||||
return rate;
|
return rate;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -224,7 +224,7 @@ public class HouseReportServiceImpl implements HouseReportService{
|
|||||||
distAvgPrice = statBo.getVillaDistrictStat().getAvgPrice();
|
distAvgPrice = statBo.getVillaDistrictStat().getAvgPrice();
|
||||||
}
|
}
|
||||||
if(distAvgPrice > 0){
|
if(distAvgPrice > 0){
|
||||||
Double rate = DataUtil.getDoubleRound(2, distSqmetreRent.getAvgPrice()*12*100/distAvgPrice);
|
Double rate = DataUtil.getDoubleRound(2, distSqmetreRent.getAvgPrice().intValue()*12*100/distAvgPrice);
|
||||||
return rate;
|
return rate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+7
@@ -126,6 +126,13 @@ public class SqmetreRentServiceImpl implements SqmetreRentService{
|
|||||||
if(StringUtils.isNotBlank(cat)){
|
if(StringUtils.isNotBlank(cat)){
|
||||||
params.add(new QueryParam("cat", cat));
|
params.add(new QueryParam("cat", cat));
|
||||||
}
|
}
|
||||||
|
if(null != startDate){
|
||||||
|
params.add(new QueryParam("weekend",QueryParam.GREATER_THAN_EQUAL_OPERATOR, startDate));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(null != endDate){
|
||||||
|
params.add(new QueryParam("weekend",QueryParam.LESS_THAN_EQUAL_OPERATOR, endDate));
|
||||||
|
}
|
||||||
|
|
||||||
List<SortParam> sortParams = new ArrayList<SortParam>();
|
List<SortParam> sortParams = new ArrayList<SortParam>();
|
||||||
sortParams.add(new SortParam("weekend", true));
|
sortParams.add(new SortParam("weekend", true));
|
||||||
|
|||||||
Reference in New Issue
Block a user