Merge branch 'master' of http://gitlab.fangjia.com/dev0/main
This commit is contained in:
+59
-2
@@ -99,7 +99,7 @@ public class OfficeController {
|
||||
return mav;
|
||||
}
|
||||
|
||||
List<OfficeRentStat> regionStats = officeService.findOfficeRentStat(city, null, startDate, endDate);
|
||||
List<OfficeRentStat> regionStats = officeService.findOfficeRentStat(city, null, null, "city", startDate, endDate);
|
||||
|
||||
if (CollectionUtils.isEmpty(regionStats)) {
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "该城市没有均价数据"));
|
||||
@@ -155,7 +155,7 @@ public class OfficeController {
|
||||
return mav;
|
||||
}
|
||||
|
||||
List<OfficeRentStat> regionStats = officeService.findOfficeRentStat(city, region, startDate, endDate);
|
||||
List<OfficeRentStat> regionStats = officeService.findOfficeRentStat(city, region, null, "district", startDate, endDate);
|
||||
|
||||
if (CollectionUtils.isEmpty(regionStats)) {
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "该区域没有均价数据"));
|
||||
@@ -165,6 +165,63 @@ public class OfficeController {
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* 写字楼均价走势
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Object officeRentAction(@Param(name = "city") String city, @Param(name = "district") String district,
|
||||
@Param(name = "name") String name, @Param(name = "startDate") Integer startDate,
|
||||
@Param(name = "endDate") Integer endDate) {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if (StringUtils.isBlank(city)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("city不能为null"));
|
||||
return mav;
|
||||
}
|
||||
if (StringUtils.isBlank(district)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("district不能为null"));
|
||||
return mav;
|
||||
}
|
||||
if (!RegionData.isCity(city)) {
|
||||
String formatCity = RegionData.formatCity(city);
|
||||
if (StringUtils.isNotBlank(formatCity)) {
|
||||
city = formatCity;
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("city非法"));
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
ServerArea serverArea = ServerAreaData.getServerAreaByCity(city);
|
||||
if (null == serverArea) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("city非法"));
|
||||
return mav;
|
||||
}
|
||||
String region = RegionData.formatRegion(city, district);
|
||||
if (!RegionData.isRegion(city, region)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("没有找你输入的区域"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
if (startDate == null || endDate == null) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("startDate或endDate不能为null"));
|
||||
return mav;
|
||||
}
|
||||
if (startDate > endDate) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("startDate不能大于endDate"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
List<OfficeRentStat> regionStats = officeService.findOfficeRentStat(city, region, name, "office", startDate, endDate);
|
||||
|
||||
if (CollectionUtils.isEmpty(regionStats)) {
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "该写字楼没有均价数据"));
|
||||
return mav;
|
||||
}
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(regionStats));
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* 写字楼楼租金地址估值
|
||||
*
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ public interface OfficeService {
|
||||
* @param endDate
|
||||
* @return
|
||||
*/
|
||||
List<OfficeRentStat> findOfficeRentStat(final String city, final String region, final Integer startDate, final Integer endDate);
|
||||
List<OfficeRentStat> findOfficeRentStat(final String city, final String region,final String name, final String cat, final Integer startDate, final Integer endDate);
|
||||
|
||||
/**
|
||||
* 租金评估
|
||||
|
||||
+14
-6
@@ -34,7 +34,6 @@ public class OfficeServiceImpl implements OfficeService {
|
||||
private SeawaterService seawaterService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public OfficeEvaluationDto evaluateRent(District district, Evaluation evaluation) {
|
||||
if (null == evaluation.getFloor() || 0 == evaluation.getFloor() || null == evaluation.getHeight() || 0 == evaluation.getHeight()) {
|
||||
@@ -55,7 +54,7 @@ public class OfficeServiceImpl implements OfficeService {
|
||||
return officeEvaluationDto;
|
||||
}
|
||||
|
||||
// 所在楼层
|
||||
// 所在楼层
|
||||
// 总楼层
|
||||
private static final Map<String, String> FITMENT_MAP = new HashMap<String, String>() {
|
||||
{
|
||||
@@ -224,6 +223,7 @@ public class OfficeServiceImpl implements OfficeService {
|
||||
|
||||
/**
|
||||
* 根据均价查询样本
|
||||
*
|
||||
* @param avgPrice
|
||||
* @param evaluation
|
||||
* @return
|
||||
@@ -253,6 +253,7 @@ public class OfficeServiceImpl implements OfficeService {
|
||||
|
||||
/**
|
||||
* 基准价*楼层系数*装修系数*朝向系数
|
||||
*
|
||||
* @param seawaters
|
||||
* @param evaluation
|
||||
* @return
|
||||
@@ -403,26 +404,33 @@ public class OfficeServiceImpl implements OfficeService {
|
||||
return "";
|
||||
}
|
||||
|
||||
public List<OfficeRentStat> findOfficeRentStat(final String city, final String region, final Integer startDate, final Integer endDate) {
|
||||
return CacheUtils.getValue(this.getClass(), "findOfficeRentStat", city + region + startDate + endDate,
|
||||
public List<OfficeRentStat> findOfficeRentStat(final String city, final String region, final String name, final String cat, final Integer startDate, final Integer endDate) {
|
||||
return CacheUtils.getValue(this.getClass(), "findOfficeRentStat", city + region + name + startDate + endDate,
|
||||
CacheUtils.CachePolicyEnum.MIDDLE, new Closure<List<OfficeRentStat>, String>() {
|
||||
public List<OfficeRentStat> execute(String input) {
|
||||
return doFindRegionBlockStat(city, region, startDate, endDate);
|
||||
return doFindRegionBlockStat(city, region, name, cat, startDate, endDate);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public List<OfficeRentStat> doFindRegionBlockStat(final String city, final String region, Integer startDate, Integer endDate) {
|
||||
public List<OfficeRentStat> doFindRegionBlockStat(final String city, final String region, final String name, final String cat, Integer startDate, Integer endDate) {
|
||||
if (startDate == null) {
|
||||
throw new IllegalArgumentException("开始日期不能为空");
|
||||
}
|
||||
if (endDate == null) {
|
||||
throw new IllegalArgumentException("结束日期不能为空");
|
||||
}
|
||||
if (StringUtils.isBlank(cat)) {
|
||||
throw new IllegalArgumentException("cat不能为空");
|
||||
}
|
||||
|
||||
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||
params.add(new QueryParam("city", city));
|
||||
params.add(new QueryParam("district", region));
|
||||
if (StringUtils.isNotBlank(name)) {
|
||||
params.add(new QueryParam("name", name));
|
||||
}
|
||||
params.add(new QueryParam("cat", cat));
|
||||
|
||||
if (startDate != null) {
|
||||
params.add(new QueryParam("date", QueryParam.GREATER_THAN_EQUAL_OPERATOR, startDate));
|
||||
|
||||
Reference in New Issue
Block a user