租金估值
This commit is contained in:
+274
-29
@@ -32,6 +32,9 @@ import com.fangjia.dal.*;
|
||||
import com.fangjia.dal.mongo.model.*;
|
||||
import com.fangjia.dal.seawater.dao.SeawaterDao;
|
||||
import com.fangjia.dal.seawater.model.Seawater;
|
||||
import com.fangjia.open.dto.*;
|
||||
import com.fangjia.service.district.SqmetreRentService;
|
||||
import com.fangjia.service.mongo.fangjia.*;
|
||||
import com.fangjia.service.open.*;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
@@ -81,21 +84,6 @@ import com.fangjia.dal.sql.model.FjtEvaluation;
|
||||
import com.fangjia.dal.sql.model.User;
|
||||
import com.fangjia.open.APIConstant;
|
||||
import com.fangjia.open.FangjiaApiUtil;
|
||||
import com.fangjia.open.dto.AroundDto;
|
||||
import com.fangjia.open.dto.BuildingDto;
|
||||
import com.fangjia.open.dto.DistrictAnalysisDto;
|
||||
import com.fangjia.open.dto.DistrictInfoDto;
|
||||
import com.fangjia.open.dto.FloorPlanDto;
|
||||
import com.fangjia.open.dto.HouseAuctionDetailDto;
|
||||
import com.fangjia.open.dto.HouseAuctionDto;
|
||||
import com.fangjia.open.dto.HouseDealPriceDetailDto;
|
||||
import com.fangjia.open.dto.HouseDealPriceDto;
|
||||
import com.fangjia.open.dto.HouseEvaluateNumDto;
|
||||
import com.fangjia.open.dto.PropertyDto;
|
||||
import com.fangjia.open.dto.RoomDto;
|
||||
import com.fangjia.open.dto.StationDto;
|
||||
import com.fangjia.open.dto.UnitNumberDto;
|
||||
import com.fangjia.open.dto.UniversalDto;
|
||||
import com.fangjia.open.interceptors.AuthenticationBean;
|
||||
import com.fangjia.open.interceptors.Authority;
|
||||
import com.fangjia.open.interceptors.Role;
|
||||
@@ -142,19 +130,6 @@ import com.fangjia.service.district.DistrictStatService;
|
||||
import com.fangjia.service.mongo.bkoff.HouseAuctionService;
|
||||
import com.fangjia.service.mongo.bkoff.HouseLoudongService;
|
||||
import com.fangjia.service.mongo.bkoff.LoudongService;
|
||||
import com.fangjia.service.mongo.fangjia.AddressMatchLogService;
|
||||
import com.fangjia.service.mongo.fangjia.AverageAnalyService;
|
||||
import com.fangjia.service.mongo.fangjia.AverageStatisticsService;
|
||||
import com.fangjia.service.mongo.fangjia.BatchEvaluateService;
|
||||
import com.fangjia.service.mongo.fangjia.BizShopService;
|
||||
import com.fangjia.service.mongo.fangjia.BusStationService;
|
||||
import com.fangjia.service.mongo.fangjia.CityHotService;
|
||||
import com.fangjia.service.mongo.fangjia.DealPriceService;
|
||||
import com.fangjia.service.mongo.fangjia.DistrictAttentionRankService;
|
||||
import com.fangjia.service.mongo.fangjia.DistrictHotService;
|
||||
import com.fangjia.service.mongo.fangjia.DistrictHouseResourceStatService;
|
||||
import com.fangjia.service.mongo.fangjia.NetworkPriceService;
|
||||
import com.fangjia.service.mongo.fangjia.ServerAreaService;
|
||||
import com.fangjia.service.sql.ApiUserService;
|
||||
import com.fangjia.service.sql.FjtEvaluationService;
|
||||
import com.fangjia.service.sql.UserService;
|
||||
@@ -166,7 +141,7 @@ import com.google.common.collect.Sets;
|
||||
import com.mongodb.BasicDBObject;
|
||||
import com.mongodb.DBObject;
|
||||
|
||||
@Authority(role = Role.USER)
|
||||
//@Authority(role = Role.USER)
|
||||
public class PropertyController {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PropertyController.class);
|
||||
@@ -208,6 +183,8 @@ public class PropertyController {
|
||||
private FangjiaOfficialAreaService fangjiaOfficialAreaService;
|
||||
private RegionAnaDataService regionAnaDataService;
|
||||
private SeawaterDao seawaterDao;
|
||||
private SeawaterService seawaterService;
|
||||
private SqmetreRentService sqmetreRentService;
|
||||
|
||||
private FileDao fileDao = FileDao.getInstance();
|
||||
private static final int DEFAULT_PAGE_SIZE = 20;
|
||||
@@ -4987,6 +4964,266 @@ public class PropertyController {
|
||||
return mav;
|
||||
}
|
||||
|
||||
/***
|
||||
* 小区租金估值报告
|
||||
* @param model
|
||||
* @param request
|
||||
* @return
|
||||
* @throws NumberFormatException
|
||||
* @throws IllegalAccessException
|
||||
*/
|
||||
public Object rentReportAction(PropertyEvaluationModel model, HttpServletRequest request)throws NumberFormatException, IllegalAccessException {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if (StringUtils.isBlank(model.getCity()) || StringUtils.isBlank(model.getName())
|
||||
|| StringUtils.isBlank(model.getDistrict()) || model.getSize() <= 0) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数非法:城市,区域,小区名,面积(size)为必填项"));
|
||||
return mav;
|
||||
}
|
||||
if (model.getCity().endsWith("市")) {
|
||||
model.setCity(model.getCity().replaceAll("市$", ""));
|
||||
}
|
||||
if (StringUtils.isNotBlank(request.getParameter("calDate"))) {
|
||||
Date calDate = null;
|
||||
try {
|
||||
calDate = org.apache.commons.lang.time.DateUtils.parseDate(request.getParameter("calDate"), new String[] { "yyyy-MM-dd" });
|
||||
} catch (ParseException e) {
|
||||
|
||||
}
|
||||
if (calDate == null) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("calDate:数据类型不合法"));
|
||||
return mav;
|
||||
} else {
|
||||
model.setCalDate(calDate);
|
||||
}
|
||||
}
|
||||
/* 先到CPDB库中查找小区 */
|
||||
District district = districtService.findByNameAndAlias(model.getCity(), model.getDistrict(), model.getName(),
|
||||
"district");
|
||||
if (district == null) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("该小区不存在"));
|
||||
return mav;
|
||||
}
|
||||
model.setName(district.getName());
|
||||
|
||||
|
||||
if (model.getMaxFloor() != null && (model.getMaxFloor() <= 0 || model.getMaxFloor() > 59)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("maxFloor取值非法,正确范围[1,60)"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
if (model.getFloor() != null && (model.getFloor() <= 0 || model.getFloor() > 59)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("floor取值非法,正确范围[1,60)"));
|
||||
return mav;
|
||||
}
|
||||
if (model.getMaxFloor() != null && model.getFloor() != null && model.getFloor() > model.getMaxFloor()) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("所在楼层不能大于总楼层"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
model.setRegion(district.getRegion());
|
||||
model.setDistrictName(district.getName());
|
||||
if (StringUtils.isBlank(model.getPropertyType())) {
|
||||
if (district.getEstateType2() != null && district.getEstateType2().contains("别墅")) {
|
||||
model.setPropertyType("1");
|
||||
}
|
||||
}
|
||||
|
||||
if (model.getCalDate() != null) {
|
||||
if (new Date().before(model.getCalDate())) {
|
||||
model.setCalDate(DateUtil.getFirstDayOfWeek(new Date()));
|
||||
} else {
|
||||
model.setCalDate(DateUtil.getFirstDayOfWeek(model.getCalDate()));
|
||||
}
|
||||
} else {
|
||||
model.setCalDate(DateUtil.getFirstDayOfWeek(new Date()));
|
||||
}
|
||||
|
||||
Evaluation evaluation = buildEvaluation(model, request);
|
||||
evaluation.setSource("api_property_evaluate_rent");
|
||||
evaluation = evaluationService.evaluateRent(district, evaluation, model.getCalDate());
|
||||
|
||||
|
||||
if (evaluation.getTotalPrice() != null && evaluation.getTotalPrice() != 0) {
|
||||
Map<String, Object> districtPriceMap = new HashMap<String, Object>();
|
||||
districtPriceMap.put("city", district.getCity());
|
||||
districtPriceMap.put("district", district.getRegion());
|
||||
districtPriceMap.put("name", district.getName());
|
||||
districtPriceMap.put("address", district.getAddress());
|
||||
districtPriceMap.put("totalPrice", evaluation.getTotalPrice());
|
||||
districtPriceMap.put("cal_date", model.getCalDate());
|
||||
|
||||
|
||||
Integer startPrice = (int)(evaluation.getTotalPrice() - evaluation.getTotalPrice()*0.2);
|
||||
Integer endPrice = (int)(evaluation.getTotalPrice() + evaluation.getTotalPrice()*0.2);
|
||||
|
||||
//相似房源
|
||||
Double startArea = model.getSize() - model.getSize()*0.1;
|
||||
Double endArea = model.getSize() + model.getSize()*0.1;
|
||||
Integer startDate = Integer.parseInt(org.apache.tools.ant.util.DateUtils.format(DateUtil.addMonthToDate(new Date(), -12), "yyyyMMdd"));
|
||||
List<Seawater> houses = seawaterService.findSeawatersFromEs2("rent", district.getCity(), district.getRegion(), district.getName(), null, null, startDate, null,
|
||||
startArea, endArea, startPrice, endPrice, null, null, "p_date", false, 1, 5 , null,"seawater-20*/_doc");
|
||||
districtPriceMap.put("houses", houses);
|
||||
|
||||
//周边同类小区租金
|
||||
if (null == model.getRadius()) {// 设置默认值
|
||||
model.setRadius(2000);
|
||||
}
|
||||
List<District> districts = districtService.findNearestDistrict(district, model.getRadius(), 50);
|
||||
if (null != districts) {
|
||||
Integer room = null;
|
||||
if(model.getHouseType()!=null){
|
||||
room = model.getHouseType();
|
||||
}else{
|
||||
room = houseService.getDistrictRoomType((float)model.getSize());
|
||||
}
|
||||
|
||||
if (null != room) {
|
||||
List<DistrictHouseDtao> dtos = new ArrayList<DistrictHouseDtao>();
|
||||
Date weekend = DateUtil.getFirstDayOfWeek(new Date());
|
||||
for (District dist : districts) {
|
||||
if(StringUtils.isNotBlank(district.getEstateType2()) && StringUtils.isNotBlank(dist.getEstateType2()) && !district.getEstateType2().equals(dist.getEstateType2())){
|
||||
continue;
|
||||
}
|
||||
List<DistrictStatRent> districtStatRents = districtStatRentService.findLatestDistrictStatRent(dist, 1, room);
|
||||
if (null != districtStatRents && districtStatRents.size() > 0) {
|
||||
DistrictStatRent districtStatRent = districtStatRents.get(0);
|
||||
if (districtStatRent.getAvgPrice() > 0) {
|
||||
SqmetreRent sqmetreRent = sqmetreRentService.findNearestSqmetreRent(dist.getCity(), dist.getRegion(), dist.getName(), DateUtil.formatToYYYYMMDD(weekend), "district");
|
||||
if(sqmetreRent != null){
|
||||
DistrictHouseDtao dto = new DistrictHouseDtao();
|
||||
dto.setCity(dist.getCity());
|
||||
dto.setRegion(dist.getRegion());
|
||||
dto.setDistrictName(dist.getName());
|
||||
dto.setRoomPrice(districtStatRent.getAvgPrice());
|
||||
dto.setSqAvgPrice(sqmetreRent.getAvgPrice());
|
||||
dto.setRoom(room);
|
||||
dtos.add(dto);
|
||||
if(dtos.size()>=5){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
districtPriceMap.put("districts", dtos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//近一年户型租金走势
|
||||
Map<String, Object> trendsMap = districtStatRentService.getRentTrend(model.getCity(), model.getDistrict(), model.getName(), -12);
|
||||
districtPriceMap.put("trends", trendsMap);
|
||||
|
||||
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(districtPriceMap));
|
||||
return mav;
|
||||
} else {
|
||||
|
||||
mav.setModel(BasicModel.buildOKModel().setMsg("暂时不支持该小区的租金估价").markNoData());
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Object evaluateRentAction(PropertyEvaluationModel model, HttpServletRequest request)throws NumberFormatException, IllegalAccessException {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if (StringUtils.isBlank(model.getCity()) || StringUtils.isBlank(model.getName())
|
||||
|| StringUtils.isBlank(model.getDistrict()) || model.getSize() <= 0) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数非法:城市,区域,小区名,面积(size)为必填项"));
|
||||
return mav;
|
||||
}
|
||||
if (model.getCity().endsWith("市")) {
|
||||
model.setCity(model.getCity().replaceAll("市$", ""));
|
||||
}
|
||||
if (StringUtils.isNotBlank(request.getParameter("calDate"))) {
|
||||
Date calDate = null;
|
||||
try {
|
||||
calDate = org.apache.commons.lang.time.DateUtils.parseDate(request.getParameter("calDate"), new String[] { "yyyy-MM-dd" });
|
||||
} catch (ParseException e) {
|
||||
|
||||
}
|
||||
if (calDate == null) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("calDate:数据类型不合法"));
|
||||
return mav;
|
||||
} else {
|
||||
model.setCalDate(calDate);
|
||||
}
|
||||
}
|
||||
/* 先到CPDB库中查找小区 */
|
||||
District district = districtService.findByNameAndAlias(model.getCity(), model.getDistrict(), model.getName(),
|
||||
"district");
|
||||
if (district == null) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("该小区不存在"));
|
||||
return mav;
|
||||
}
|
||||
model.setName(district.getName());
|
||||
|
||||
|
||||
if (model.getMaxFloor() != null && (model.getMaxFloor() <= 0 || model.getMaxFloor() > 59)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("maxFloor取值非法,正确范围[1,60)"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
if (model.getFloor() != null && (model.getFloor() <= 0 || model.getFloor() > 59)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("floor取值非法,正确范围[1,60)"));
|
||||
return mav;
|
||||
}
|
||||
if (model.getMaxFloor() != null && model.getFloor() != null && model.getFloor() > model.getMaxFloor()) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("所在楼层不能大于总楼层"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
model.setRegion(district.getRegion());
|
||||
model.setDistrictName(district.getName());
|
||||
if (StringUtils.isBlank(model.getPropertyType())) {
|
||||
if (district.getEstateType2() != null && district.getEstateType2().contains("别墅")) {
|
||||
model.setPropertyType("1");
|
||||
}
|
||||
}
|
||||
|
||||
if (model.getCalDate() != null) {
|
||||
if (new Date().before(model.getCalDate())) {
|
||||
model.setCalDate(DateUtil.getFirstDayOfWeek(new Date()));
|
||||
} else {
|
||||
model.setCalDate(DateUtil.getFirstDayOfWeek(model.getCalDate()));
|
||||
}
|
||||
} else {
|
||||
model.setCalDate(DateUtil.getFirstDayOfWeek(new Date()));
|
||||
}
|
||||
|
||||
Evaluation evaluation = buildEvaluation(model, request);
|
||||
evaluation.setSource("api_property_evaluate_rent");
|
||||
evaluation = evaluationService.evaluateRent(district, evaluation, model.getCalDate());
|
||||
|
||||
|
||||
if (evaluation.getTotalPrice() != null && evaluation.getTotalPrice() != 0) {
|
||||
Map<String, Object> districtPriceMap = new HashMap<String, Object>();
|
||||
districtPriceMap.put("city", district.getCity());
|
||||
districtPriceMap.put("district", district.getRegion());
|
||||
districtPriceMap.put("name", district.getName());
|
||||
districtPriceMap.put("address", district.getAddress());
|
||||
districtPriceMap.put("totalPrice", evaluation.getTotalPrice());
|
||||
districtPriceMap.put("cal_date", model.getCalDate());
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(districtPriceMap));
|
||||
return mav;
|
||||
} else {
|
||||
|
||||
mav.setModel(BasicModel.buildOKModel().setMsg("暂时不支持该小区的租金估价").markNoData());
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void setHouseLoudongService(HouseLoudongService houseLoudongService) {
|
||||
this.houseLoudongService = houseLoudongService;
|
||||
}
|
||||
@@ -5159,4 +5396,12 @@ public class PropertyController {
|
||||
public void setRegionAnaDataService(RegionAnaDataService regionAnaDataService) {
|
||||
this.regionAnaDataService = regionAnaDataService;
|
||||
}
|
||||
|
||||
public void setSeawaterService(SeawaterService seawaterService) {
|
||||
this.seawaterService = seawaterService;
|
||||
}
|
||||
|
||||
public void setSqmetreRentService(SqmetreRentService sqmetreRentService) {
|
||||
this.sqmetreRentService = sqmetreRentService;
|
||||
}
|
||||
}
|
||||
|
||||
+104
-39
@@ -1,5 +1,6 @@
|
||||
package com.fangjia.open.controllers;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
@@ -7,6 +8,16 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.fangjia.dal.mongo.model.*;
|
||||
import com.fangjia.dal.mongo.open.model.ApiUserAuthority;
|
||||
import com.fangjia.dal.seawater.model.Seawater;
|
||||
import com.fangjia.open.dto.DistrictDto;
|
||||
import com.fangjia.open.dto.DistrictHouseDtao;
|
||||
import com.fangjia.open.model.PropertyEvaluationModel;
|
||||
import com.fangjia.open.util.CommonUtils;
|
||||
import com.fangjia.service.datastore.EvaluationService;
|
||||
import com.fangjia.service.datastore.HouseService;
|
||||
import com.fangjia.service.mongo.fangjia.SeawaterService;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.tools.ant.util.DateUtils;
|
||||
|
||||
@@ -15,9 +26,6 @@ import com.fangjia.core.util.DateUtil;
|
||||
import com.fangjia.dal.common.DistrictKey;
|
||||
import com.fangjia.dal.common.ServerAreaData;
|
||||
import com.fangjia.dal.mongo.fangjia.model.ServerArea;
|
||||
import com.fangjia.dal.mongo.model.DistrictStatRent;
|
||||
import com.fangjia.dal.mongo.model.RegionStatRent;
|
||||
import com.fangjia.dal.mongo.model.SqmetreRent;
|
||||
import com.fangjia.dal.seaweed.model.District;
|
||||
import com.fangjia.open.HttpCode;
|
||||
import com.fangjia.open.OpenHttpCodeEnum;
|
||||
@@ -35,6 +43,8 @@ import com.fangjia.service.district.DistrictStatService;
|
||||
import com.fangjia.service.district.RegionStatRentService;
|
||||
import com.fangjia.service.district.SqmetreRentService;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
//@Authority(role = Role.USER)
|
||||
public class RentController {
|
||||
|
||||
@@ -43,6 +53,9 @@ public class RentController {
|
||||
private DistrictStatRentService districtStatRentService;
|
||||
private DistrictStatService districtStatService;
|
||||
private RegionStatRentService regionStatRentService;
|
||||
private EvaluationService evaluationService;
|
||||
private SeawaterService seawaterService;
|
||||
private HouseService houseService;
|
||||
//城市平米租金
|
||||
public Object cityRentAction(RentModel rentModel){
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
@@ -298,49 +311,94 @@ public class RentController {
|
||||
}else if(rentModel.getType() == 4){ //两年
|
||||
type = -24;
|
||||
}
|
||||
List<Date> dates = DateUtil.getLastDayBetweenDates(DateUtil.addMonthToDate(new Date(),type), new Date());
|
||||
|
||||
List<String> times = new ArrayList<String>();
|
||||
for(Date date : dates){
|
||||
times.add(DateUtils.format(date, "yyyy-MM"));
|
||||
Map<String, Object> trendsMap = districtStatRentService.getRentTrend(rentModel.getCity(), rentModel.getDistrict(), rentModel.getName(), type);
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(trendsMap));
|
||||
return mav;
|
||||
}
|
||||
|
||||
public Object evaluateRentAction(RentModel model, HttpServletRequest request){
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
|
||||
if (StringUtils.isBlank(model.getCity()) || StringUtils.isBlank(model.getName())
|
||||
|| StringUtils.isBlank(model.getDistrict()) || model.getSize() <= 0) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数非法:城市,区域,小区名,面积(size)为必填项"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
List<DistrictStatRentBo> districtRents = districtStatRentService.findDistrictStatRentsByParams(rentModel.getCity(), rentModel.getDistrict(), rentModel.getName(), null, dates.get(0), dates.get(dates.size()-1), null, null, null, null, true);
|
||||
Map<String, Map<String, Integer>> distMap = null;
|
||||
List<Integer> rooms = null;
|
||||
|
||||
if(null != districtRents){
|
||||
distMap = new HashMap<String, Map<String, Integer>>();
|
||||
rooms = new ArrayList<Integer>();
|
||||
for(DistrictStatRentBo rent : districtRents){
|
||||
|
||||
DistrictStatRent distRent = rent.getDistrictStatRent();
|
||||
if(null == distRent){
|
||||
distRent = rent.getVillaDistrictStatRent();
|
||||
|
||||
District district = districtService.findByNameAndAlias(model.getCity(), model.getDistrict(), model.getName(),"district");
|
||||
if (null == district) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("小区不存在"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
Double startArea = model.getSize() - model.getSize()*0.1;
|
||||
Double endArea = model.getSize() + model.getSize()*0.1;
|
||||
|
||||
Integer startDate = Integer.parseInt(DateUtils.format(DateUtil.addMonthToDate(new Date(), -12), "yyyyMMdd"));
|
||||
|
||||
//相似房源
|
||||
List<Seawater> houses = seawaterService.findSeawatersFromEs2("rent", district.getCity(), district.getRegion(), district.getName(), null, null, startDate, null,
|
||||
startArea, endArea, null, null, null, null, "p_date", false, 1, 5 , null,"seawater-20*/_doc");
|
||||
Map<String, Object> retMap = new HashMap<String, Object>();
|
||||
retMap.put("houses", houses);
|
||||
|
||||
if (null == model.getRadius()) {// 设置默认值
|
||||
model.setRadius(2000);
|
||||
}
|
||||
|
||||
//相近小区
|
||||
List<District> districts = districtService.findNearestDistrict(district, model.getRadius(), 50);
|
||||
if (null != districts) {
|
||||
Integer room = null;
|
||||
if(model.getHouseType()!=null){
|
||||
room = model.getHouseType();
|
||||
}else{
|
||||
room = houseService.getDistrictRoomType(model.getSize());
|
||||
}
|
||||
|
||||
if (null != room) {
|
||||
List<DistrictHouseDtao> dtos = new ArrayList<DistrictHouseDtao>();
|
||||
List<Integer> prices = new ArrayList<Integer>();
|
||||
Date weekend = DateUtil.getFirstDayOfWeek(new Date());
|
||||
for (District dist : districts) {
|
||||
List<DistrictStatRent> districtStatRents = districtStatRentService.findLatestDistrictStatRent(dist, 1, room);
|
||||
if (null != districtStatRents && districtStatRents.size() > 0) {
|
||||
DistrictStatRent districtStatRent = districtStatRents.get(0);
|
||||
if (districtStatRent.getAvgPrice() > 0) {
|
||||
SqmetreRent sqmetreRent = sqmetreRentService.findNearestSqmetreRent(dist.getCity(), dist.getRegion(), dist.getName(), DateUtil.formatToYYYYMMDD(weekend), "district");
|
||||
if(sqmetreRent != null){
|
||||
DistrictHouseDtao dto = new DistrictHouseDtao();
|
||||
dto.setCity(dist.getCity());
|
||||
dto.setRegion(dist.getRegion());
|
||||
dto.setDistrictName(dist.getName());
|
||||
dto.setRoomPrice(districtStatRent.getAvgPrice());
|
||||
dto.setSqAvgPrice(sqmetreRent.getAvgPrice());
|
||||
dto.setRoom(room);
|
||||
dtos.add(dto);
|
||||
if(dtos.size()>=5){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Integer> priceMap = distMap.get(distRent.getHouseType().toString());
|
||||
if(null == priceMap){
|
||||
rooms.add(distRent.getHouseType());
|
||||
priceMap = new HashMap<String, Integer>();
|
||||
distMap.put(distRent.getHouseType().toString(), priceMap);
|
||||
}
|
||||
|
||||
priceMap.put(DateUtils.format(distRent.getEndMonthDate(), "yyyy-MM"), distRent.getAvgPrice());
|
||||
retMap.put("districts", dtos);
|
||||
}
|
||||
}
|
||||
|
||||
Collections.sort(rooms);
|
||||
|
||||
Map<String, Object> retMap = new HashMap<String, Object>();
|
||||
retMap.put("times", times);
|
||||
retMap.put("distMap", distMap);
|
||||
retMap.put("rooms", rooms);
|
||||
|
||||
|
||||
Map<String, Object> trendsMap = districtStatRentService.getRentTrend(model.getCity(), model.getDistrict(), model.getName(), -12);
|
||||
retMap.put("trends", trendsMap);
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(retMap));
|
||||
return mav;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void setSeawaterService(SeawaterService seawaterService) {
|
||||
this.seawaterService = seawaterService;
|
||||
}
|
||||
|
||||
public void setSqmetreRentService(SqmetreRentService sqmetreRentService) {
|
||||
this.sqmetreRentService = sqmetreRentService;
|
||||
}
|
||||
@@ -359,4 +417,11 @@ public class RentController {
|
||||
this.regionStatRentService = regionStatRentService;
|
||||
}
|
||||
|
||||
public void setEvaluationService(EvaluationService evaluationService) {
|
||||
this.evaluationService = evaluationService;
|
||||
}
|
||||
|
||||
public void setHouseService(HouseService houseService) {
|
||||
this.houseService = houseService;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,8 @@ public class DistrictDto implements Serializable {
|
||||
* 均价
|
||||
*/
|
||||
private Integer avgPrice;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 板块
|
||||
*/
|
||||
@@ -525,7 +526,5 @@ public class DistrictDto implements Serializable {
|
||||
public void setAvgPrice(Integer avgPrice) {
|
||||
this.avgPrice = avgPrice;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.fangjia.open.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class DistrictHouseDtao implements Serializable {
|
||||
|
||||
private String city;
|
||||
private String region;
|
||||
private String districtName;
|
||||
private Integer roomPrice;
|
||||
private Double sqAvgPrice;
|
||||
private Integer room;
|
||||
private Integer hall;
|
||||
private Integer toilet;
|
||||
|
||||
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 getDistrictName() {
|
||||
return districtName;
|
||||
}
|
||||
|
||||
public void setDistrictName(String districtName) {
|
||||
this.districtName = districtName;
|
||||
}
|
||||
|
||||
public Integer getRoomPrice() {
|
||||
return roomPrice;
|
||||
}
|
||||
|
||||
public void setRoomPrice(Integer roomPrice) {
|
||||
this.roomPrice = roomPrice;
|
||||
}
|
||||
|
||||
public Double getSqAvgPrice() {
|
||||
return sqAvgPrice;
|
||||
}
|
||||
|
||||
public void setSqAvgPrice(Double sqAvgPrice) {
|
||||
this.sqAvgPrice = sqAvgPrice;
|
||||
}
|
||||
|
||||
public Integer getRoom() {
|
||||
return room;
|
||||
}
|
||||
|
||||
public void setRoom(Integer room) {
|
||||
this.room = room;
|
||||
}
|
||||
|
||||
public Integer getHall() {
|
||||
return hall;
|
||||
}
|
||||
|
||||
public void setHall(Integer hall) {
|
||||
this.hall = hall;
|
||||
}
|
||||
|
||||
public Integer getToilet() {
|
||||
return toilet;
|
||||
}
|
||||
|
||||
public void setToilet(Integer toilet) {
|
||||
this.toilet = toilet;
|
||||
}
|
||||
}
|
||||
+8
-3
@@ -1,5 +1,7 @@
|
||||
package com.fangjia.open.model;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import java.util.Date;
|
||||
|
||||
public class PropertyEvaluationModel extends FangjiaApiModel {
|
||||
@@ -267,7 +269,9 @@ public class PropertyEvaluationModel extends FangjiaApiModel {
|
||||
private String estateType;
|
||||
private String periodType;
|
||||
private Integer periodCount;
|
||||
private int houseType;
|
||||
|
||||
|
||||
private Integer houseType;
|
||||
private String clientNo;
|
||||
private int scope;
|
||||
|
||||
@@ -280,6 +284,7 @@ public class PropertyEvaluationModel extends FangjiaApiModel {
|
||||
|
||||
private String user;
|
||||
|
||||
|
||||
public void setDecorationAge(int decorationAge) {
|
||||
this.decorationAge = decorationAge;
|
||||
}
|
||||
@@ -701,11 +706,11 @@ public class PropertyEvaluationModel extends FangjiaApiModel {
|
||||
this.decoration = decoration;
|
||||
}
|
||||
|
||||
public int getHouseType() {
|
||||
public Integer getHouseType() {
|
||||
return houseType;
|
||||
}
|
||||
|
||||
public void setHouseType(int houseType) {
|
||||
public void setHouseType(Integer houseType) {
|
||||
this.houseType = houseType;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,10 +30,15 @@ public class RentModel {
|
||||
|
||||
private String endDate;
|
||||
|
||||
|
||||
@Min(1)
|
||||
@Max(4)
|
||||
private Integer type;//ÀàÐÍ
|
||||
|
||||
@Min(1)
|
||||
@Max(6)
|
||||
private Integer houseType;//·¿ÐÍ
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
@@ -90,9 +95,12 @@ public class RentModel {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public Integer getHouseType() {
|
||||
return houseType;
|
||||
}
|
||||
|
||||
public void setHouseType(Integer houseType) {
|
||||
this.houseType = houseType;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,8 @@ public class OpenApiClient {
|
||||
// }
|
||||
|
||||
JSONObject matchResult = request.getJsonContent(url, params, "UTF-8");
|
||||
|
||||
|
||||
if(matchResult.getInt("code") == 200){
|
||||
return matchResult.getJSONObject("result");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user