改造城市排行
This commit is contained in:
+29
-3
@@ -166,7 +166,9 @@ public class TrendController {
|
||||
|
||||
model.setRegionItems(getRegionItems(model));
|
||||
model.setBlockItems(getRegionBlocks(model));
|
||||
model.setCityStatInfoBos(findCitysAvgPrice(10));
|
||||
|
||||
List<CitySellStat> citySellStats = citySellStatService.getAllWithMonths(city, 2);
|
||||
model.setCityStatInfoBos(findCitysAvgPricePlus(city,citySellStats.get(0).getDate(), 10));
|
||||
model.setDefaultCityName(city);
|
||||
TrendView trendView = TrendViewFactory.getInstance().create(model);
|
||||
if (trendView == null) {
|
||||
@@ -270,6 +272,30 @@ public class TrendController {
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
|
||||
private List<CityStatInfoBo> findCitysAvgPricePlus(String city, Integer startDate, int limit){
|
||||
List<CityStatInfoBo> cityStatInfoBos = new ArrayList<CityStatInfoBo>();
|
||||
List<CitySellStat> citySellStats = citySellStatService.findCityOrderByAvgPrice(null, startDate, limit);
|
||||
for(int i=0;i<citySellStats.size();i++){
|
||||
|
||||
CitySellStat regionStat = citySellStats.get(i);
|
||||
|
||||
CityStatInfoBo cityStatInfoBo = new CityStatInfoBo();
|
||||
|
||||
String cityName = regionStat.getCity();
|
||||
int avg_price = regionStat.getAvgPrice();
|
||||
|
||||
cityStatInfoBo.setSeq(i+1);
|
||||
cityStatInfoBo.setCity(cityName);
|
||||
cityStatInfoBo.setAvgPrice(regionStat.getAvgPrice());
|
||||
cityStatInfoBo.setHuanBi((int) (regionStat.getMom()*100));
|
||||
cityStatInfoBo.setTongBi((int) (regionStat.getYoy()*100));
|
||||
cityStatInfoBos.add(cityStatInfoBo);
|
||||
}
|
||||
return cityStatInfoBos;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 城市房价排行
|
||||
*/
|
||||
@@ -860,7 +886,7 @@ public class TrendController {
|
||||
|
||||
CitySellStat rs = citySellStatService.findStartStat(city);
|
||||
if(rs!=null){
|
||||
bo.setStartDate(rs.getDate());
|
||||
bo.setStartDate(rs.getDate() / 100);
|
||||
}
|
||||
return bo;
|
||||
}
|
||||
@@ -892,7 +918,7 @@ public class TrendController {
|
||||
|
||||
RegionSellStat rs = regionSellStatService.findStartStat(city, region);
|
||||
if(rs!=null){
|
||||
bo.setStartDate(rs.getDate());
|
||||
bo.setStartDate(rs.getDate() / 100);
|
||||
}
|
||||
return bo;
|
||||
}
|
||||
|
||||
@@ -341,6 +341,10 @@ public class TrendModel extends BaseModel implements TrendViewModel {
|
||||
this.citySellStatBo = citySellStatBo;
|
||||
}
|
||||
|
||||
public RegionSellStatBo getRegionSellStatBo() {
|
||||
return regionSellStatBo;
|
||||
}
|
||||
|
||||
public void setRegionSellStatBo(RegionSellStatBo regionSellStatBo) {
|
||||
this.regionSellStatBo = regionSellStatBo;
|
||||
}
|
||||
|
||||
@@ -104,10 +104,15 @@
|
||||
|
||||
|
||||
<div class="trend trend01">
|
||||
<#if districtStatBo?? || regionStatBo??>
|
||||
<#if districtStatBo?? || regionStatBo?? || citySellStatBo?? || regionSellStatBo??>
|
||||
<div class="trend01a">
|
||||
<div class="herder"><p><span class="text_56">${affectValue}房产</span>均价走势</p></div>
|
||||
<p><small><#if districtStatBo??>${districtStatBo.startYear!}<#else><#if regionStatBo?? && regionStatBo.startDate??>${regionStatBo.startDate?string('yyyy')}</#if></#if>-${.now?string('yyyy')} | 周度 | 元/㎡ | 数据来源:房价网</small></p>
|
||||
<p>
|
||||
<small><#if districtStatBo??>${districtStatBo.startYear!}
|
||||
<#elseif citySellStatBo?? && citySellStatBo.startDate??>${citySellStatBo.startDate}
|
||||
<#elseif regionSellStatBo?? && regionSellStatBo.startDate??>${regionSellStatBo.startDate}
|
||||
</#if>
|
||||
-${.now?string('yyyy')} | 周度 | 元/㎡ | 数据来源:房价网</small></p>
|
||||
<p class="mobile01 description">${descWord}</p>
|
||||
</div>
|
||||
</#if>
|
||||
@@ -127,7 +132,6 @@
|
||||
<div><em>${regionSellStatBo.lastTimeAvgPrice!}</em><label>上月均价(元/㎡)</label></div>
|
||||
<div><em>${regionSellStatBo.avgPrice!}</em><label>本月均价(元/㎡)</label></div>
|
||||
<div style="margin-right:0;"><em class="<#if regionSellStatBo.monthMarkup gte 0>up<#else>down</#if>"><i></i>${(regionSellStatBo.monthMarkup/100)?string('0.00')}%</em><label>涨跌幅</label></div>
|
||||
|
||||
<#elseif regionStatBo??>
|
||||
<div><em>${regionStatBo.lastTimeAvgPrice!}</em><label>上周均价(元/㎡)</label></div>
|
||||
<div><em>${regionStatBo.avgPrice!}</em><label>本周均价(元/㎡)</label></div>
|
||||
|
||||
+2
@@ -43,4 +43,6 @@ public interface CitySellStatService {
|
||||
* @return
|
||||
*/
|
||||
CitySellStat findStartStat(String city);
|
||||
|
||||
List<CitySellStat> findCityOrderByAvgPrice(final String city, final Integer startDate, final int count) ;
|
||||
}
|
||||
|
||||
+15
-1
@@ -106,7 +106,7 @@ public class CitySellStatServiceImpl implements CitySellStatService {
|
||||
|
||||
@Override
|
||||
public List<CitySellStat> findNearCityStat(final String city, final Integer startDate, final int count) {
|
||||
return CacheUtils.getValue(this.getClass(), "findNearRegionStat",city+"_"+startDate, CachePolicyEnum.LONG,
|
||||
return CacheUtils.getValue(this.getClass(), "findNearCityStat",city+"_"+startDate, CachePolicyEnum.LONG,
|
||||
new Closure<List<CitySellStat>, String>() {
|
||||
@Override
|
||||
public List<CitySellStat> execute(String input) {
|
||||
@@ -136,4 +136,18 @@ public class CitySellStatServiceImpl implements CitySellStatService {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CitySellStat> findCityOrderByAvgPrice(final String city, final Integer startDate, final int count) {
|
||||
List<QueryParam> q = new ArrayList<QueryParam>();
|
||||
if (StringUtils.isNotBlank(city)) {
|
||||
q.add(new QueryParam("city", city));
|
||||
}
|
||||
q.add(new QueryParam("date", QueryParam.GREATER_THAN_EQUAL_OPERATOR, startDate));
|
||||
|
||||
List<SortParam> s = new ArrayList<SortParam>();
|
||||
s.add(new SortParam("avgPrice", false));
|
||||
return citySellStatDao.findAllByParams(q, s, count);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user