小区详情接口改为2B接口
This commit is contained in:
+3
-1
@@ -752,7 +752,9 @@ public class PropertyController {
|
||||
districtInfoDto.setDistrict(district.getRegion());
|
||||
districtInfoDto.setName(district.getName());
|
||||
districtInfoDto.setAddress(district.getAddress());
|
||||
int avgPrice = districtStatService.findLatestDistrictAvgPrice(new DistrictKey(district), null);
|
||||
//int avgPrice = districtStatService.findLatestDistrictAvgPrice(new DistrictKey(district), null);
|
||||
// 返回2B价格,小程序用,其他也改为2B
|
||||
int avgPrice = districtStatService.findLatestDistrictAvgPrice2B(new DistrictKey(district), null);
|
||||
if (avgPrice != 0) {
|
||||
districtInfoDto.setAvgPrice(avgPrice);
|
||||
}
|
||||
|
||||
+11
@@ -295,6 +295,17 @@ public interface DistrictStatService {
|
||||
* @return
|
||||
*/
|
||||
public int findLatestDistrictAvgPrice(DistrictKey districtKey,Date weekend);
|
||||
|
||||
/**
|
||||
* 获得指定时间的小区均价2B
|
||||
*
|
||||
* @param districtKey
|
||||
* @param weekend
|
||||
* @return
|
||||
*/
|
||||
int findLatestDistrictAvgPrice2B(DistrictKey districtKey,Date weekend);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
+46
@@ -1524,6 +1524,52 @@ public class DistrictStatServiceImpl implements DistrictStatService {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int findLatestDistrictAvgPrice2B(DistrictKey districtKey, Date weekend) {
|
||||
if (weekend == null) {
|
||||
weekend = DateUtil.getFirstDayOfWeek(new Date());
|
||||
}
|
||||
String cacheKey = districtKey.getCity() + "_" + districtKey.getRegion() + "_" + districtKey.getName() + "_" + DateUtil.formatToYYMMDD(weekend);
|
||||
Object obj = CacheUtils.getValue(this.getClass(), cacheKey);
|
||||
if (obj != null) {
|
||||
return (Integer)obj;
|
||||
}
|
||||
Integer value = doFindLatestDistrictAvgPrice2B(districtKey, weekend);
|
||||
CacheUtils.putValue(CachePolicyEnum.LONG, this.getClass(), cacheKey, value);
|
||||
return value;
|
||||
}
|
||||
|
||||
public Integer doFindLatestDistrictAvgPrice2B(DistrictKey districtKey, Date weekend){
|
||||
|
||||
DistrictStatBo statBo = districtStatService.findDistrictStat(districtKey);
|
||||
if (statBo != null && statBo.getDefaultDistrictStat() != null) {
|
||||
if (statBo.getDefaultDistrictStat().getAvg_price_2b() > 0) {
|
||||
return statBo.getDefaultDistrictStat().getAvg_price_2b();
|
||||
}
|
||||
if (statBo.getDefaultDistrictStat().getAvgPrice() > 0) {
|
||||
return statBo.getDefaultDistrictStat().getAvgPrice();
|
||||
}
|
||||
}
|
||||
|
||||
double r = AveragerUtil.getFloatingRate(districtKey, weekend);
|
||||
if (StringUtils.isNotBlank(districtKey.getCity()) && StringUtils.isNotBlank(districtKey.getRegion())) {
|
||||
RegionStat regionStat = regionStatService.findRegionStat(districtKey.getCity(), districtKey.getRegion(), null);
|
||||
if (regionStat != null) {
|
||||
return (int) (regionStat.getAvgPrice() * r);
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(districtKey.getCity())) {
|
||||
RegionStat regionStat = regionStatService.findRegionStat(districtKey.getCity(), null, null);
|
||||
if (regionStat != null) {
|
||||
return (int) (regionStat.getAvgPrice() * r);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
public Integer doFindLatestDistrictAvgPrice(DistrictKey districtKey, Date weekend){
|
||||
|
||||
DistrictStatBo statBo = districtStatService.findDistrictStat(districtKey);
|
||||
|
||||
Reference in New Issue
Block a user