Merge remote-tracking branch 'origin/master'

This commit is contained in:
majintao
2025-01-06 18:40:53 +08:00
7 changed files with 185 additions and 10 deletions
@@ -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);
/**
@@ -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() + "_2B_" + 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);