改造估值区域均价

This commit is contained in:
沈健
2025-06-13 15:20:39 +08:00
parent 28eed814f7
commit c25aee0fec
5 changed files with 52 additions and 8 deletions
@@ -30,6 +30,7 @@ import javax.servlet.http.HttpServletResponse;
import com.fangjia.dal.mongo.model.*;
import com.fangjia.service.datastore.*;
import com.fangjia.service.mongo.fangjia.*;
import net.sf.json.JSONObject;
import org.apache.commons.codec.digest.DigestUtils;
@@ -152,13 +153,6 @@ import com.fangjia.service.fangjia.LoanProductService;
import com.fangjia.service.fangjia.LoanProductTagService;
import com.fangjia.service.fsh.CityNewPriceService;
import com.fangjia.service.menu.MenuCategoryEnum;
import com.fangjia.service.mongo.fangjia.AddressMatchLogService;
import com.fangjia.service.mongo.fangjia.CopyrightConfigService;
import com.fangjia.service.mongo.fangjia.FangjiaCommonLogService;
import com.fangjia.service.mongo.fangjia.InputUserInfoService;
import com.fangjia.service.mongo.fangjia.MetroService;
import com.fangjia.service.mongo.fangjia.ServerAreaService;
import com.fangjia.service.mongo.fangjia.SnapDataService;
import com.fangjia.service.news.NewsService;
import com.fangjia.service.pds.AlgorithmRuleService;
import com.fangjia.service.pds.DistrictHouseNumberService;
@@ -192,6 +186,7 @@ public class EvaluationController {
private HouseService houseService;
private RegionStatService regionStatService;
private CitySellStatService citySellStatService;
private RegionSellStatService regionSellStatService;
private MenuService menuService;
private CpcService cpcService;
private DistrictStatRentService districtStatRentService;
@@ -3607,10 +3602,11 @@ public Object checkUserAction(EvaluationModel model, HttpServletRequest req, Htt
private Map<String,Integer> buildStatJson(String city, String region, String block, Date startDate) {
List<RegionStat> regionStatList = null;
List<CitySellStat> citySellStats = null;
List<RegionSellStat> regionSellStats = null;
Map<String, String> oprions = new HashMap<String, String>();
Date currentDate = new Date();
if (city != null && region != null) {
regionStatList = regionStatService.findRegionStat(city, region, null, startDate, currentDate);
regionSellStats = regionSellStatService.findRegionSellStat(city, region, Integer.parseInt(DateUtil.formatByPattern(startDate, "yyyyMM")), Integer.parseInt(DateUtil.formatByPattern(currentDate, "yyyyMM")));
oprions.put("name", region);
} else if (city != null) {
citySellStats = citySellStatService.findCitySellStat(city, Integer.parseInt(DateUtil.formatByPattern(startDate, "yyyyMM")), Integer.parseInt(DateUtil.formatByPattern(currentDate, "yyyyMM")));
@@ -3629,6 +3625,11 @@ public Object checkUserAction(EvaluationModel model, HttpServletRequest req, Htt
map.put(re.getDate().toString().substring(0, 4) + "." + re.getDate().toString().substring(4, 6), re.getAvgPrice());
}
}
if (CollectionUtils.isNotEmpty(regionSellStats)) {
for (RegionSellStat re : regionSellStats) {
map.put(re.getDate().toString().substring(0, 4) + "." + re.getDate().toString().substring(4, 6), re.getAvgPrice());
}
}
return map;
}
@@ -4738,4 +4739,8 @@ public Object checkUserAction(EvaluationModel model, HttpServletRequest req, Htt
public void setCitySellStatService(CitySellStatService citySellStatService) {
this.citySellStatService = citySellStatService;
}
public void setRegionSellStatService(RegionSellStatService regionSellStatService) {
this.regionSellStatService = regionSellStatService;
}
}
@@ -1,8 +1,13 @@
package com.fangjia.dal.mongo.dao;
import com.fangjia.dal.MongoDao;
import com.fangjia.dal.mongo.model.CitySellStat;
import com.fangjia.dal.mongo.model.RegionSellStat;
import java.util.List;
public interface RegionSellStatDao extends MongoDao<RegionSellStat> {
List<RegionSellStat> findRegionSellStat(String city, String region, Integer startDate, Integer endDate);
}
@@ -1,9 +1,31 @@
package com.fangjia.dal.mongo.dao;
import com.fangjia.dal.MongoDaoImpl;
import com.fangjia.dal.QueryParam;
import com.fangjia.dal.SortParam;
import com.fangjia.dal.mongo.model.CitySellStat;
import com.fangjia.dal.mongo.model.RegionSellStat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class RegionSellStatDaoImpl extends MongoDaoImpl<RegionSellStat>
implements RegionSellStatDao {
@Override
public List<RegionSellStat> findRegionSellStat(String city, String region, Integer startDate, Integer endDate) {
List<QueryParam> params = new ArrayList<QueryParam>();
params.add(new QueryParam("city", city));
params.add(new QueryParam("region", region));
params.add(new QueryParam("date", QueryParam.LESS_THAN_EQUAL_OPERATOR, endDate));
if (startDate!=null) {
params.add(new QueryParam("date", QueryParam.GREATER_THAN_EQUAL_OPERATOR, startDate));
}
List<SortParam> sortParms = new ArrayList<SortParam>(1);
sortParms.add(new SortParam("date", true));
List<RegionSellStat> statList = findAllByParams(params, sortParms);
return statList;
}
}
@@ -33,4 +33,6 @@ public interface RegionSellStatService {
RegionSellStat findNewestRegionPrice(String city, String region);
List<RegionSellStat> findRegionSellStat(final String city, final String region, final Integer startDate, final Integer endDate);
}
@@ -121,6 +121,16 @@ public class RegionSellStatServiceImpl implements RegionSellStatService {
});
}
@Override
public List<RegionSellStat> findRegionSellStat(final String city, final String region, final Integer startDate, final Integer endDate) {
return CacheUtils.getValue(this.getClass(), city, String.valueOf(endDate + startDate),
CacheUtils.CachePolicyEnum.MIDDLE, new Closure<List<RegionSellStat>, String>() {
public List<RegionSellStat> execute(String input) {
return regionSellStatDao.findRegionSellStat(city, region, startDate, endDate);
}
});
}
public void setRegionSellStatDao(RegionSellStatDao regionSellStatDao) {
this.regionSellStatDao = regionSellStatDao;
}