修复周日均价查询bug
This commit is contained in:
@@ -1556,8 +1556,17 @@ public class DateUtil {
|
||||
return c.getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加日期的天数
|
||||
* 此方法用于给定一个日期后,增加指定数量的天数
|
||||
*
|
||||
* @param date 原始日期
|
||||
* @param amount 要增加的天数,正数表示未来日期,负数表示过去日期
|
||||
* @return 增加天数后的日期
|
||||
*/
|
||||
public static Date add(Date date,int amount){
|
||||
return add(date,Calendar.DATE,amount);
|
||||
// 调用另一个重载的add方法,将Calendar.DATE作为参数,表示按天数增加
|
||||
return add(date,Calendar.DATE,amount);
|
||||
}
|
||||
|
||||
public static String addMonth(Date date, int month){
|
||||
|
||||
+3
@@ -759,6 +759,9 @@ public class PropertyController {
|
||||
//int avgPrice = districtStatService.findLatestDistrictAvgPrice(new DistrictKey(district), null);
|
||||
// 返回2B价格,小程序用,其他也改为2B
|
||||
int avgPrice = districtStatService.findLatestDistrictAvgPrice2B(new DistrictKey(district), null);
|
||||
if(avgPrice == 0){
|
||||
avgPrice = districtStatService.findLatestDistrictAvgPrice2B(new DistrictKey(district), DateUtil.add(new Date(), -7));
|
||||
}
|
||||
if (avgPrice != 0) {
|
||||
districtInfoDto.setAvgPrice(avgPrice);
|
||||
}
|
||||
|
||||
+6
-1
@@ -1527,7 +1527,12 @@ public class DistrictStatServiceImpl implements DistrictStatService {
|
||||
@Override
|
||||
public int findLatestDistrictAvgPrice2B(DistrictKey districtKey, Date weekend) {
|
||||
if (weekend == null) {
|
||||
weekend = DateUtil.getFirstDayOfWeek(new Date());
|
||||
Date now = DateUtil.truncateDay(new Date());
|
||||
if(!DateUtil.isSunday(now)){
|
||||
weekend = DateUtil.getFirstDayOfWeek(now);
|
||||
}else{
|
||||
weekend = now;
|
||||
}
|
||||
}
|
||||
String cacheKey = districtKey.getCity() + "_" + districtKey.getRegion() + "_" + districtKey.getName() + "_2B_" + DateUtil.formatToYYMMDD(weekend);
|
||||
Object obj = CacheUtils.getValue(this.getClass(), cacheKey);
|
||||
|
||||
Reference in New Issue
Block a user