租金估值
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
<dependency>
|
||||
<groupId>org.sothis</groupId>
|
||||
<artifactId>sothis-core</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.2.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@@ -13,10 +13,10 @@ public interface SeawaterDao extends com.fangjia.dal.SeawaterDao<Seawater> {
|
||||
Integer room, String root,String table);
|
||||
|
||||
Seawater findByIdFromEs(String id,String table);
|
||||
|
||||
List<Seawater> findSeawatersFromEs(String category, String city, String region, String name,
|
||||
List<String> alias, List<String> regionAlias, Integer startDate, Integer endDate, Integer room, String root,
|
||||
String sort, boolean order, int start, int limit, String[] keys,String table);
|
||||
|
||||
|
||||
List<Seawater> findSeawatersFromEs(String category, String city, String region, String name, List<String> alias, List<String> regionAlias, Integer startDate, Integer endDate,
|
||||
Double startArea, Double endArea, Integer startPrice, Integer endPrice, Integer room, String root, String sort, boolean order, int start, int limit , String table);
|
||||
|
||||
List<Seawater> findHouses(String city, String region, List<String> alias, Integer minPrice, Integer maxPrice, Integer limit);
|
||||
|
||||
|
||||
+39
-9
@@ -29,7 +29,7 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
@Override
|
||||
public Seawater findByIdFromEs(String id,String table) {
|
||||
Seawater seawater = null;
|
||||
List<JSONObject> jsonList = queryList(id,null,null,null,null,null,null,null,null,null,null,null,false,-1,-1,table);
|
||||
List<JSONObject> jsonList = queryList(id,null,null,null,null,null,null,null,null, null, null, null, null, null,null,null,false,-1,-1,table);
|
||||
if(jsonList == null){
|
||||
return null;
|
||||
}else{
|
||||
@@ -42,11 +42,9 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Seawater> findSeawatersFromEs(String category, String city, String region, String name,
|
||||
List<String> alias, List<String> regionAlias, Integer startDate, Integer endDate, Integer room, String root,
|
||||
String sort, boolean order, int start, int limit, String[] keys,String table) {
|
||||
public List<Seawater> findSeawatersFromEs(String category, String city, String region, String name, List<String> alias, List<String> regionAlias, Integer startDate, Integer endDate, Double startArea, Double endArea, Integer startPrice, Integer endPrice, Integer room, String root, String sort, boolean order, int start, int limit, String table) {
|
||||
List<Seawater> seawaterList= new ArrayList<Seawater>();
|
||||
List<JSONObject> jsonList = queryList(null,category,city,region,name,alias,regionAlias,startDate,endDate,room,root,sort,order,start,limit,table);
|
||||
List<JSONObject> jsonList = queryList(null,category,city,region,name,alias,regionAlias,startDate,endDate, startArea, endArea, startPrice, endPrice, room,root,sort,order,start,limit,table);
|
||||
if(jsonList == null){
|
||||
return null;
|
||||
}else{
|
||||
@@ -55,6 +53,7 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
return seawaterList;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<Seawater> findHouses(String city, String region, List<String> alias, Integer minPrice, Integer maxPrice, Integer limit) {
|
||||
JSONObject reqBody = new JSONObject();
|
||||
@@ -200,7 +199,7 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
}
|
||||
|
||||
private JSONObject query(String id,String category, String city, String region, String name, List<String> alias,
|
||||
List<String> regionAlias, Integer startDate, Integer endDate, Integer room, String root,String sort, boolean order, int start, int limit,String table){
|
||||
List<String> regionAlias, Integer startDate, Integer endDate, Double startArea, Double endArea, Integer startPrice, Integer endPrice, Integer room, String root,String sort, boolean order, int start, int limit,String table){
|
||||
long time1 = System.currentTimeMillis();
|
||||
JSONObject reqBody = new JSONObject();
|
||||
JSONObject q = new JSONObject();
|
||||
@@ -287,6 +286,37 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
temp.put("range", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
|
||||
|
||||
if(startArea != null || endArea != null){
|
||||
JSONObject param = new JSONObject();
|
||||
JSONObject temp = new JSONObject();
|
||||
JSONObject temp2 = new JSONObject();
|
||||
if(startArea != null){
|
||||
temp2.put("gte", startArea);
|
||||
}
|
||||
if(endArea != null){
|
||||
temp2.put("lte", endArea);
|
||||
}
|
||||
param.put("area", temp2);
|
||||
temp.put("range", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
|
||||
if(startPrice != null || endPrice != null){
|
||||
JSONObject param = new JSONObject();
|
||||
JSONObject temp = new JSONObject();
|
||||
JSONObject temp2 = new JSONObject();
|
||||
if(startPrice != null){
|
||||
temp2.put("gte", startPrice);
|
||||
}
|
||||
if(endPrice != null){
|
||||
temp2.put("lte", endPrice);
|
||||
}
|
||||
param.put("total_price", temp2);
|
||||
temp.put("range", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(sort)){
|
||||
JSONObject jsonOrder = new JSONObject();
|
||||
@@ -331,8 +361,8 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
}
|
||||
|
||||
private List<JSONObject> queryList(String id,String category, String city, String region, String name, List<String> alias,
|
||||
List<String> regionAlias, Integer startDate, Integer endDate, Integer room, String root,String sort, boolean order, int start, int limit,String table){
|
||||
JSONObject json = query(id,category,city,region,name,alias,regionAlias,startDate,endDate,room,root,sort,order,start,limit,table);
|
||||
List<String> regionAlias, Integer startDate, Integer endDate, Double startArea, Double endArea, Integer startPrice, Integer endPrice, Integer room, String root,String sort, boolean order, int start, int limit,String table){
|
||||
JSONObject json = query(id,category,city,region,name,alias,regionAlias,startDate,endDate, startArea, endArea, startPrice, endPrice, room,root,sort,order,start,limit,table);
|
||||
if(!json.containsKey("hits") || !json.getJSONObject("hits").containsKey("hits")){
|
||||
return null;
|
||||
}
|
||||
@@ -347,7 +377,7 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
|
||||
private int queryCount(String id,String category, String city, String region, String name, List<String> alias,
|
||||
List<String> regionAlias, Integer startDate, Integer endDate, Integer room, String root,String sort, boolean order, int start, int limit,String table){
|
||||
JSONObject json = query(id,category,city,region,name,alias,regionAlias,startDate,endDate,room,root,sort,order,start,limit,table);
|
||||
JSONObject json = query(id,category,city,region,name,alias,regionAlias,startDate,endDate,null, null, null, null, room,root,sort,order,start,limit,table);
|
||||
if(!json.containsKey("hits") || !json.getJSONObject("hits").containsKey("total")){
|
||||
return 0;
|
||||
}
|
||||
|
||||
+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");
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<dependency>
|
||||
<groupId>org.sothis</groupId>
|
||||
<artifactId>sothis-core</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.2.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
+1
-11
@@ -2408,17 +2408,7 @@ public class DistrictServiceImpl implements DistrictService {
|
||||
}
|
||||
}
|
||||
}
|
||||
for (District d : list) {
|
||||
if (district.getName().equals(d.getName()) && district.getRegion().equals(d.getRegion())
|
||||
&& district.getCity().equals(d.getCity())) {
|
||||
continue;
|
||||
}
|
||||
if (d.getEstateType2() != null) {
|
||||
if ("ÆÕͨסլ".equals(district.getEstateType2())) {
|
||||
ret.add(d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ret.size() > limit) {
|
||||
ret = ret.subList(0, limit);
|
||||
}
|
||||
|
||||
+10
@@ -80,6 +80,16 @@ public interface EvaluationService {
|
||||
Evaluation evaluateWithPadding(Evaluation evaluation,Date weekend);
|
||||
|
||||
Evaluation evaluate(District district, Evaluation evaluation , Date weekend);
|
||||
|
||||
|
||||
/**
|
||||
* 根据条件对小区进行租金估价
|
||||
* @param district
|
||||
* @param evaluation
|
||||
* @param weekend
|
||||
* @return
|
||||
*/
|
||||
Evaluation evaluateRent(District district, Evaluation evaluation, Date weekend);
|
||||
|
||||
/**
|
||||
* ÓÑ´ïÆÀ¹À
|
||||
|
||||
+38
-16
@@ -14,6 +14,8 @@ import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.fangjia.dal.mongo.model.*;
|
||||
import com.fangjia.service.district.SqmetreRentService;
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
@@ -41,17 +43,6 @@ import com.fangjia.dal.mongo.dao.EvaluationDao;
|
||||
import com.fangjia.dal.mongo.dao.EvaluationHistoryDao;
|
||||
import com.fangjia.dal.mongo.dao.HouseLoudongDao;
|
||||
import com.fangjia.dal.mongo.fangjia.model.ServerArea;
|
||||
import com.fangjia.dal.mongo.model.ApiUserCfg;
|
||||
import com.fangjia.dal.mongo.model.BusStation;
|
||||
import com.fangjia.dal.mongo.model.DistrictAnalyData;
|
||||
import com.fangjia.dal.mongo.model.DistrictSellStat;
|
||||
import com.fangjia.dal.mongo.model.DistrictStat;
|
||||
import com.fangjia.dal.mongo.model.DistrictStatRent;
|
||||
import com.fangjia.dal.mongo.model.Evaluation;
|
||||
import com.fangjia.dal.mongo.model.EvaluationHistory;
|
||||
import com.fangjia.dal.mongo.model.HouseLoudong;
|
||||
import com.fangjia.dal.mongo.model.RegionBlock;
|
||||
import com.fangjia.dal.mongo.model.YdDealPrice;
|
||||
import com.fangjia.dal.mongo.pds.model.HourseTypeStat;
|
||||
import com.fangjia.dal.seaweed.model.District;
|
||||
import com.fangjia.service.api.ApiUserCfgService;
|
||||
@@ -96,6 +87,8 @@ public class EvaluationServiceImpl implements EvaluationService {
|
||||
private DistrictSellStatService districtSellStatService;
|
||||
|
||||
private ApiUserCfgService apiUserCfgService;
|
||||
private SqmetreRentService sqmetreRentService;
|
||||
|
||||
private final static Logger LOGGER = LoggerFactory.getLogger(EvaluationServiceImpl.class);
|
||||
|
||||
public static final Map<String, List<Double>> CREDIT_RATE_MAP = new HashMap<String, List<Double>>();
|
||||
@@ -1030,6 +1023,31 @@ public class EvaluationServiceImpl implements EvaluationService {
|
||||
return wrapEvaluation(district,evaluation,weekend,stat);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Evaluation evaluateRent(District district, Evaluation evaluation, Date weekend) {
|
||||
|
||||
if (null == evaluation.getFloor() || 0 == evaluation.getFloor() || null == evaluation.getHeight() || 0 == evaluation.getHeight()) {
|
||||
evaluation.setFloor(null);
|
||||
evaluation.setHeight(null);
|
||||
}
|
||||
SqmetreRent sqmetreRent = sqmetreRentService.findNearestSqmetreRent(district.getCity(), district.getRegion(), district.getName(), DateUtil.formatToYYYYMMDD(weekend), "district");
|
||||
if(sqmetreRent!=null){
|
||||
long totalPrice = evaluationRateService.evaluationRent(sqmetreRent.getAvgPrice(), evaluation);
|
||||
|
||||
evaluation.setTotalPrice(((Number) (totalPrice)).intValue());
|
||||
|
||||
evaluation.setEvaluateWay(sqmetreRent.getSampleEnum());
|
||||
evaluation.setCredit(sqmetreRent.getCredit());
|
||||
}else{
|
||||
evaluation.setTotalPrice(null);
|
||||
}
|
||||
if(weekend != null) {
|
||||
evaluation.setWeekend(weekend);
|
||||
}
|
||||
return evaluation;
|
||||
}
|
||||
|
||||
/**
|
||||
* 友达评估接口
|
||||
*/
|
||||
@@ -1338,6 +1356,10 @@ public class EvaluationServiceImpl implements EvaluationService {
|
||||
this.apiUserCfgService = apiUserCfgService;
|
||||
}
|
||||
|
||||
public void setSqmetreRentService(SqmetreRentService sqmetreRentService) {
|
||||
this.sqmetreRentService = sqmetreRentService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long findUserEvaluationCount(long userId, Date startDate, Date endDate, String source) {
|
||||
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||
@@ -1782,7 +1804,7 @@ public class EvaluationServiceImpl implements EvaluationService {
|
||||
* 封装价格
|
||||
* @author yinjihuan
|
||||
* @param dto
|
||||
* @param model
|
||||
* @param evaluation
|
||||
*/
|
||||
private void buildPrice(EvaluationBeforeLoanBean dto, Evaluation evaluation) {
|
||||
// 获取房屋总价
|
||||
@@ -1808,7 +1830,7 @@ public class EvaluationServiceImpl implements EvaluationService {
|
||||
* 小区年涨幅
|
||||
* @author yinjihuan
|
||||
* @param dto
|
||||
* @param model
|
||||
* @param evaluation
|
||||
*/
|
||||
private void buildOneYearUpDownRange(EvaluationBeforeLoanBean dto, Evaluation evaluation) {
|
||||
List<DistrictSellStat> districtsSellStats = districtSellStatService.getAllWithMonths(evaluation.getCity(), evaluation.getRegion(), evaluation.getDistrictName(), 12);
|
||||
@@ -1824,7 +1846,7 @@ public class EvaluationServiceImpl implements EvaluationService {
|
||||
* 上个月参考均价
|
||||
* @author yinjihuan
|
||||
* @param dto
|
||||
* @param model
|
||||
* @param evaluation
|
||||
*/
|
||||
private void buildTopMonthAvgPrice(EvaluationBeforeLoanBean dto, Evaluation evaluation) {
|
||||
String topMonth = DateUtil.formatByPattern(DateUtil.addMonthToDate(new Date(), -1), "yyyyMM");
|
||||
@@ -1839,7 +1861,7 @@ public class EvaluationServiceImpl implements EvaluationService {
|
||||
* 涨跌幅在城市排名
|
||||
* @author yinjihuan
|
||||
* @param dto
|
||||
* @param key
|
||||
* @param evaluation
|
||||
*/
|
||||
private void buildUpDownRangecityLevel(EvaluationBeforeLoanBean dto, Evaluation evaluation, DistrictAnalyData districtAnalyData) {
|
||||
Double increaseRate = 0d;
|
||||
@@ -1858,7 +1880,7 @@ public class EvaluationServiceImpl implements EvaluationService {
|
||||
* 获得最近一期的小区均价
|
||||
* @author yinjihuan
|
||||
* @param dto
|
||||
* @param model
|
||||
* @param evaluation
|
||||
*/
|
||||
private void buildWeekAvgPrice(EvaluationBeforeLoanBean dto, Evaluation evaluation) {
|
||||
DistrictStatBo bo = getNearestDistrictStat(new DistrictKey(evaluation.getCity(), evaluation.getRegion(), evaluation.getDistrictName()));
|
||||
|
||||
+9
@@ -140,4 +140,13 @@ public interface DistrictStatRentService {
|
||||
|
||||
|
||||
List<DistrictStatRent> findLatestDistrictStatRent(District district, int periodCount, int houseType);
|
||||
|
||||
|
||||
Map<String, Object> getRentTrend(String city, String region, String name, Integer count);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
+44
@@ -898,6 +898,50 @@ public class DistrictStatRentServiceImpl implements DistrictStatRentService {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getRentTrend(String city, String region, String name, Integer count) {
|
||||
List<Date> dates = DateUtil.getLastDayBetweenDates(DateUtil.addMonthToDate(new Date(),count), new Date());
|
||||
|
||||
List<String> times = new ArrayList<String>();
|
||||
for(Date date : dates){
|
||||
times.add(org.apache.tools.ant.util.DateUtils.format(date, "yyyy-MM"));
|
||||
}
|
||||
|
||||
List<DistrictStatRentBo> districtRents = findDistrictStatRentsByParams(city, region, name, 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();
|
||||
}
|
||||
|
||||
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(org.apache.tools.ant.util.DateUtils.format(distRent.getEndMonthDate(), "yyyy-MM"), distRent.getAvgPrice());
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> retMap = new HashMap<String, Object>();
|
||||
if(rooms != null){
|
||||
Collections.sort(rooms);
|
||||
retMap.put("times", times);
|
||||
retMap.put("distMap", distMap);
|
||||
retMap.put("rooms", rooms);
|
||||
}
|
||||
return retMap;
|
||||
}
|
||||
|
||||
private List<DistrictStatRent> doFindLatestDistrictStatRent(District district, int periodCount, int houseType){
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.add(Calendar.MONTH, -4);
|
||||
|
||||
+6
-1
@@ -12,8 +12,13 @@ public interface SeawaterService {
|
||||
|
||||
List<Seawater> findSeawaters(String category, String city, String region, String name, List<String> alias, List<String> regionAlias, Integer startDate, Integer endDate,
|
||||
Integer room, String root, String sort, boolean order, int start, int limit ,String[] keys);
|
||||
|
||||
List<Seawater> findSeawatersFromEs(String category, String city, String region, String name, List<String> alias, List<String> regionAlias, Integer startDate, Integer endDate,
|
||||
Integer room, String root, String sort, boolean order, int start, int limit ,String[] keys,String table);
|
||||
Integer room, String root, String sort, boolean order, int start, int limit ,String[] keys,String table);
|
||||
|
||||
List<Seawater> findSeawatersFromEs2(String category, String city, String region, String name, List<String> alias, List<String> regionAlias, Integer startDate, Integer endDate,
|
||||
Double startArea, Double endArea, Integer startPrice, Integer endPrice, Integer room, String root, String sort, boolean order, int start, int limit ,String[] keys,String table);
|
||||
|
||||
|
||||
long findSeawatersCount(String category, String city, String region, String name, List<String> alias, List<String> regionAlias, Integer startDate, Integer endDate,
|
||||
Integer room, String root);
|
||||
|
||||
+16
-3
@@ -64,7 +64,7 @@ public class SeawaterServiceImpl implements SeawaterService {
|
||||
}
|
||||
return sells;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private Seawater convertDBObjectToSeawater(DBObject dbo) {
|
||||
Seawater seawater = new Seawater();
|
||||
@@ -161,6 +161,9 @@ public class SeawaterServiceImpl implements SeawaterService {
|
||||
return q;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public List<Seawater> findAllSeawater(String category, String city, String name, String region,Integer room, String root, String sort, Integer startDate, Integer endDate,
|
||||
@@ -209,6 +212,8 @@ public class SeawaterServiceImpl implements SeawaterService {
|
||||
return seawaterDao.findSeawatersCountFromEs(category, city, region, name, alias, regionAlias, startDate, endDate, room, root,table);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Seawater findByIdFromEs(String id,String table) {
|
||||
return seawaterDao.findByIdFromEs(id,table);
|
||||
@@ -218,10 +223,18 @@ public class SeawaterServiceImpl implements SeawaterService {
|
||||
public List<Seawater> findSeawatersFromEs(String category, String city, String region, String name,
|
||||
List<String> alias, List<String> regionAlias, Integer startDate, Integer endDate, Integer room, String root,
|
||||
String sort, boolean order, int start, int limit, String[] keys,String table) {
|
||||
return seawaterDao.findSeawatersFromEs(category,city,region,name,alias,regionAlias,startDate,endDate,room,root,
|
||||
sort,order,start,limit,keys,table);
|
||||
return seawaterDao.findSeawatersFromEs(category,city,region,name,alias,regionAlias,startDate,endDate, null, null, null, null, room,root,
|
||||
sort,order,start,limit,table);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<Seawater> findSeawatersFromEs2(String category, String city, String region, String name, List<String> alias, List<String> regionAlias, Integer startDate, Integer endDate, Double startArea, Double endArea, Integer startPrice, Integer endPrice, Integer room, String root, String sort, boolean order, int start, int limit, String[] keys, String table) {
|
||||
return seawaterDao.findSeawatersFromEs(category,city,region,name,alias,regionAlias,startDate,endDate, startArea, endArea, startPrice, endPrice, room,root,
|
||||
sort,order,start,limit,table);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
+3
-1
@@ -23,6 +23,8 @@ public interface EvaluationRateService {
|
||||
long evaluation(int districtAvgPrice, Evaluation evaluation);
|
||||
long evaluation(int districtAvgPrice, FjtEvaluation evaluation);
|
||||
|
||||
long evaluationRent(double districtSqmetreRent, Evaluation evaluation);
|
||||
|
||||
long evaluation(int districtAvgPrice, Evaluation evaluation, boolean min);
|
||||
|
||||
long evalustionShop(int districtAvgPrice, Evaluation evaluation);
|
||||
@@ -40,7 +42,7 @@ public interface EvaluationRateService {
|
||||
/**
|
||||
* 根据房源ID获得房源当前的估价价格,用于房源信息已经经过知识库匹配
|
||||
*
|
||||
* @param houseId
|
||||
* @param house
|
||||
* @return
|
||||
*/
|
||||
public long evaluation(House house);
|
||||
|
||||
+192
@@ -515,6 +515,198 @@ public class EvaluationRateServiceImpl implements EvaluationRateService {
|
||||
return evaluatePrice;
|
||||
}
|
||||
|
||||
private long getEvaluationRatePrice(long evaluatePrice, Evaluation evaluation){
|
||||
String type = "小区";
|
||||
Map<String, Map<String, Float>> rateMap = getEvaluationRateMap();
|
||||
Map<String, Float> map = rateMap.get(evaluation.getCity());
|
||||
if(null == map){
|
||||
map = rateMap.get("默认");
|
||||
}
|
||||
|
||||
// 楼层系数
|
||||
float houseFloorRate = 0;
|
||||
// 房型
|
||||
String roomHall = String.valueOf(evaluation.getRoom()) + "室" + String.valueOf(evaluation.getHall()) + "厅";
|
||||
float chamberRate = getEvaluationRate(map, "房型", roomHall, type);
|
||||
// 朝向系数
|
||||
float directionRate = getEvaluationRate(map, "朝向", evaluation.getDirection(), type);
|
||||
// 小区位置系数
|
||||
float insideposRate = getEvaluationRate(map, "小区位置", evaluation.getInsidepos(), type);
|
||||
// 景观情况系数
|
||||
float sightRate = getEvaluationRate(map, "景观", evaluation.getSight(), type);
|
||||
// 采光通风系数
|
||||
float lightingVentilationRate = getEvaluationRate(map, "采光通风", evaluation.getLightingVentilation(), type);
|
||||
// 噪音影响系数
|
||||
float noiseRate = getEvaluationRate(map, "噪音", evaluation.getNoise(), type);
|
||||
// 边套装置系数
|
||||
float sidesetRate = getEvaluationRate(map, "边套", evaluation.getSideset(), type);
|
||||
// 厌恶设施系数
|
||||
float worryFacilityRate = getEvaluationRate(map, "厌恶设施", evaluation.getWorryFacility(), type);
|
||||
// 车位系数
|
||||
float carportRate = getEvaluationRate(map, "车位", evaluation.getCarport(), type);
|
||||
// 装修系数
|
||||
float fitmentRate = getEvaluationRate(map, "装修情况", evaluation.getFitment(), type);
|
||||
//装修年限系数
|
||||
String fitment = "";
|
||||
if (null != evaluation.getFitmentAge()) {
|
||||
if (evaluation.getFitmentAge() <= 3) {
|
||||
fitment = evaluation.getFitmentAge() + "年";
|
||||
} else if (4 == evaluation.getFitmentAge()) {
|
||||
fitment = evaluation.getFitmentAge() + "年";
|
||||
} else {
|
||||
fitment = "4年以上";
|
||||
}
|
||||
}
|
||||
float fitmentAgeRate = getEvaluationRate(map, "装修年限", fitment, type);
|
||||
|
||||
// 赠送花园
|
||||
float gardenAreaRate = getEvaluationRate(map, "赠送面积因素", "花园", type);
|
||||
// 赠送地下车库
|
||||
float basementAreaRate = getEvaluationRate(map, "赠送面积因素", "地下室", type);
|
||||
// 赠送露台
|
||||
float outerAreaRate = getEvaluationRate(map, "赠送面积因素", "露台", type);
|
||||
// 赠送阁楼
|
||||
float atticAreaRate = getEvaluationRate(map, "赠送面积因素", "阁楼", type);
|
||||
|
||||
// 楼间距
|
||||
float floorSpaceRate = getEvaluationRate(map, "楼间距", evaluation.getFloorSpace(), type);
|
||||
// 政策因素
|
||||
float policyRate = getPolicyRate(map);
|
||||
|
||||
|
||||
String houseFloorRateType = null;
|
||||
if (!StringUtils.contains(evaluation.getBuildType(), DistrictKindEnum.bieshu.getValue())) {// 不是别墅
|
||||
if (null != evaluation.getHeight() && 0 != evaluation.getHeight() && null != evaluation.getFloor() && 0 != evaluation.getFloor()) {
|
||||
houseFloorRateType = getHouseFloorRateType(evaluation.getHeight());
|
||||
if("小高层".equals(houseFloorRateType) || "高层".equals(houseFloorRateType)){
|
||||
if(evaluation.getFloor() == 1 || evaluation.getFloor() == 2){
|
||||
houseFloorRate = getFloorRate(map, "小高层", evaluation.getFloor(), "小区");
|
||||
}else if(evaluation.getFloor().compareTo(evaluation.getHeight()) == 0){
|
||||
houseFloorRate = getFloorRate(map, "小高层", 17, "小区");
|
||||
}else{
|
||||
if(evaluation.getFloor() == 4){//4楼使用3楼的系数
|
||||
houseFloorRate = 0.9545F + 0.108F * ((3 - 1)/(float) (evaluation.getHeight() - 1));
|
||||
}else{
|
||||
houseFloorRate = 0.9545F + 0.108F * ((evaluation.getFloor() - 1)/(float) (evaluation.getHeight() - 1));
|
||||
}
|
||||
}
|
||||
if(evaluation.getFloor() == 14){
|
||||
houseFloorRate *= 0.99F;
|
||||
}
|
||||
evaluatePrice = (long) (evaluatePrice * houseFloorRate);
|
||||
}else{
|
||||
houseFloorRate = getFloorRate(map, houseFloorRateType,(null != evaluation.getFloor() ? evaluation.getFloor() : 0), type);
|
||||
if(houseFloorRateType.equals("多层")){
|
||||
if(houseFloorRate > 0){
|
||||
evaluatePrice = (long) (evaluatePrice * houseFloorRate);
|
||||
}
|
||||
}else{
|
||||
double num;
|
||||
int mid = evaluation.getHeight()/2;
|
||||
if(evaluation.getHeight() == evaluation.getFloor()){
|
||||
num = 1 + (evaluation.getFloor() - mid -1) * 0.004 -0.001;
|
||||
}else{
|
||||
if(evaluation.getFloor() < mid){
|
||||
num = 1- (mid - evaluation.getFloor()) * 0.006;
|
||||
}else{
|
||||
num = 1 + (evaluation.getFloor() - mid) * 0.004;
|
||||
}
|
||||
}
|
||||
evaluatePrice = (long) (evaluatePrice * num * houseFloorRate);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (chamberRate > 0) {
|
||||
evaluatePrice = (long) (evaluatePrice * chamberRate);
|
||||
}
|
||||
if (directionRate > 0) {
|
||||
evaluatePrice = (long) (evaluatePrice * directionRate);
|
||||
}
|
||||
|
||||
if (insideposRate > 0) {
|
||||
evaluatePrice = (long) (evaluatePrice * insideposRate);
|
||||
}
|
||||
|
||||
if (sightRate > 0) {
|
||||
evaluatePrice = (long) (evaluatePrice * sightRate);
|
||||
}
|
||||
|
||||
if (lightingVentilationRate > 0) {
|
||||
evaluatePrice = (long) (evaluatePrice * lightingVentilationRate);
|
||||
}
|
||||
|
||||
if (noiseRate > 0) {
|
||||
evaluatePrice = (long) (evaluatePrice * noiseRate);
|
||||
}
|
||||
|
||||
if (sidesetRate > 0) {
|
||||
evaluatePrice = (long) (evaluatePrice * sidesetRate);
|
||||
}
|
||||
|
||||
if (worryFacilityRate > 0) {
|
||||
evaluatePrice = (long) (evaluatePrice * worryFacilityRate);
|
||||
}
|
||||
|
||||
if (carportRate > 0) {
|
||||
evaluatePrice = (long) (evaluatePrice * carportRate);
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(evaluation.getSource()) && !evaluation.getSource().equals("api_property_evaluate_rent")){
|
||||
if (null != evaluation.getFitmentAge() && evaluation.getFitmentAge() > 0 && null != evaluation.getFitmentCharge()
|
||||
&& evaluation.getFitmentCharge() > 0) {
|
||||
// 输入了装修年限和装修价格
|
||||
evaluatePrice = (long) (evaluatePrice + evaluation.getFitmentCharge() * fitmentAgeRate);
|
||||
}
|
||||
}
|
||||
if(fitmentRate > 0){
|
||||
if(evaluatePrice > 10000000){
|
||||
fitmentRate = (float) (fitmentRate + 0.01);
|
||||
}
|
||||
|
||||
evaluatePrice = (long)(evaluatePrice * fitmentRate);
|
||||
}
|
||||
|
||||
if (null != evaluation.getGardenArea() && evaluation.getGardenArea() > 0) {
|
||||
evaluatePrice = (long) ((gardenAreaRate * evaluation.getGardenArea()/evaluation.getArea() + 1) * evaluatePrice);
|
||||
}
|
||||
|
||||
if (null != evaluation.getBasementArea() && evaluation.getBasementArea() > 0) {
|
||||
evaluatePrice = (long) ((basementAreaRate * evaluation.getBasementArea()/ evaluation.getArea() + 1) * evaluatePrice);
|
||||
}
|
||||
|
||||
if (null != evaluation.getAtticArea() && evaluation.getAtticArea() > 0) {
|
||||
evaluatePrice = (long) ((atticAreaRate * evaluation.getAtticArea()/ evaluation.getArea() + 1) * evaluatePrice);
|
||||
}
|
||||
|
||||
if (null != evaluation.getTerraceArea() && evaluation.getTerraceArea() > 0) {
|
||||
evaluatePrice = (long) ((outerAreaRate * evaluation.getTerraceArea()/ evaluation.getArea() + 1) * evaluatePrice);
|
||||
}
|
||||
|
||||
if (floorSpaceRate > 0) {
|
||||
evaluatePrice = (long) (floorSpaceRate * evaluatePrice);
|
||||
}
|
||||
if (policyRate > 0) {
|
||||
evaluatePrice = (long) (policyRate * evaluatePrice);
|
||||
}
|
||||
if(evaluation.getCarportPrice() !=null){
|
||||
evaluatePrice = (long)(evaluatePrice + evaluation.getCarportPrice().intValue());
|
||||
}
|
||||
return evaluatePrice;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long evaluationRent(double districtSqmetreRent, Evaluation evaluation) {
|
||||
if (districtSqmetreRent < 0 && evaluation != null) {
|
||||
return 0;
|
||||
}
|
||||
long evaluatePrice = (long) (districtSqmetreRent * (null == evaluation.getArea() ? 0 : evaluation.getArea()));
|
||||
evaluatePrice = getEvaluationRatePrice(evaluatePrice, evaluation);
|
||||
return evaluatePrice;
|
||||
}
|
||||
|
||||
/**
|
||||
* 实现估价的功能
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user