改造区域均价
This commit is contained in:
+53
-4
@@ -19,6 +19,7 @@ import com.fangjia.coresite.model.*;
|
||||
import com.fangjia.dal.mongo.model.*;
|
||||
import com.fangjia.service.bo.*;
|
||||
import com.fangjia.service.datastore.*;
|
||||
import com.fangjia.service.mongo.fangjia.RegionSellStatService;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
@@ -74,6 +75,7 @@ public class TrendController {
|
||||
private final static Logger LOGGER = LoggerFactory.getLogger(TrendController.class);
|
||||
|
||||
private CitySellStatService citySellStatService;
|
||||
private RegionSellStatService regionSellStatService;
|
||||
|
||||
public Object trendChartAction(TrendModel model, HttpServletRequest request) {
|
||||
TrendView trendView = TrendViewFactory.getInstance().create(model);
|
||||
@@ -175,10 +177,10 @@ public class TrendController {
|
||||
//DistrictStatBo statBo = getDistrictStat(new DistrictKey(trendView.getCityName(), trendView.getRegion(), trendView.getDistrictName()));
|
||||
DistrictStatBo statBo = getNearestDistrictStat(new DistrictKey(trendView.getCityName(), trendView.getRegion(), trendView.getDistrictName()));
|
||||
model.setDistrictStatBo(statBo);
|
||||
} else if (trendView.getType().equals(ViewType.region) || trendView.getType().equals(ViewType.block)) {
|
||||
} else if (trendView.getType().equals(ViewType.region)) {
|
||||
//RegionStatBo regionStat = getRegionBlockStat(trendView.getCityName(), trendView.getRegion(), trendView.getBlock());
|
||||
RegionStatBo regionStat = getNearestRegionStat(trendView.getCityName(), trendView.getRegion(), trendView.getBlock());
|
||||
model.setRegionStatBo(regionStat);
|
||||
RegionSellStatBo regionSellStatBo = getNearestRegionSellStat(trendView.getCityName(), trendView.getRegion());
|
||||
model.setRegionSellStatBo(regionSellStatBo);
|
||||
model.setRegion(trendView.getRegion());
|
||||
} else if (trendView.getType().equals(ViewType.city)) {
|
||||
//RegionStatBo regionStat = getRegionBlockStat(trendView.getCityName(), null, null);
|
||||
@@ -670,13 +672,16 @@ public class TrendController {
|
||||
private List<JSONObject> buildStatJson(String city, String region, String block, int weeks) {
|
||||
List<RegionStat> regionStatList = null;
|
||||
List<CitySellStat> citySellStatList = null;
|
||||
List<RegionSellStat> regionSellStatList = null;
|
||||
Map<String, String> oprions = new HashMap<String, String>();
|
||||
Date currentDate = new Date();
|
||||
if (city != null && region != null && block != null) {
|
||||
regionStatList = regionStatService.findRegionStat(city, region, block, currentDate, weeks);
|
||||
oprions.put("name", block + "板块");
|
||||
} else if (city != null && region != null) {
|
||||
regionStatList = regionStatService.findRegionStat(city, region, null, currentDate, weeks);
|
||||
//regionStatList = regionStatService.findRegionStat(city, region, null, currentDate, weeks);
|
||||
int month = weeks / 4;
|
||||
regionSellStatList = regionSellStatService.getAllWithMonths(city, region, month);
|
||||
oprions.put("name", region);
|
||||
} else if (city != null) {
|
||||
//regionStatList = regionStatService.findRegionStat(city, null, null, currentDate, weeks);
|
||||
@@ -703,6 +708,14 @@ public class TrendController {
|
||||
ja.put(re.getAvgPrice());
|
||||
splineJa.put(ja);
|
||||
}
|
||||
} else if (CollectionUtils.isNotEmpty(regionSellStatList)) {
|
||||
for (int i = regionSellStatList.size() - 1; i >= 0; i--) {
|
||||
RegionSellStat re = regionSellStatList.get(i);
|
||||
JSONArray ja = new JSONArray();
|
||||
ja.put(DateUtil.getBeforeDay(DateUtil.parseDate(re.getDate().toString(), "yyyyMM"), -1).getTime());
|
||||
ja.put(re.getAvgPrice());
|
||||
splineJa.put(ja);
|
||||
}
|
||||
}
|
||||
|
||||
if (splineJa.length() > 0) {
|
||||
@@ -854,6 +867,38 @@ public class TrendController {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 区域均价
|
||||
*
|
||||
* @param city
|
||||
* @return
|
||||
*/
|
||||
private RegionSellStatBo getNearestRegionSellStat(String city, String region) {
|
||||
RegionSellStatBo ret = null;
|
||||
List<RegionSellStat> regionSellStats = null;
|
||||
Integer startDate = Integer.valueOf(DateUtil.formatByPattern(DateUtils.addMonths(new Date(), -3), "yyyyMM"));
|
||||
regionSellStats = regionSellStatService.findNearCityStat(city, region, startDate, 2);
|
||||
if(regionSellStats!=null && regionSellStats.size()>0){
|
||||
RegionSellStatBo bo = new RegionSellStatBo();
|
||||
if(regionSellStats.size()==2){
|
||||
bo.setAvgPrice(regionSellStats.get(0).getAvgPrice());
|
||||
bo.setLastTimeAvgPrice(regionSellStats.get(1).getAvgPrice());
|
||||
int monthMarkup = (regionSellStats.get(0).getAvgPrice()-regionSellStats.get(1).getAvgPrice())*10000/regionSellStats.get(1).getAvgPrice();
|
||||
bo.setMonthMarkup(monthMarkup);
|
||||
|
||||
}else{
|
||||
bo.setAvgPrice(regionSellStats.get(0).getAvgPrice());
|
||||
}
|
||||
|
||||
RegionSellStat rs = regionSellStatService.findStartStat(city, region);
|
||||
if(rs!=null){
|
||||
bo.setStartDate(rs.getDate());
|
||||
}
|
||||
return bo;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private RegionStatBo getNearestRegionStat(String city, String region, String block){
|
||||
RegionStatBo ret = null;
|
||||
@@ -1315,4 +1360,8 @@ public class TrendController {
|
||||
public void setCitySellStatService(CitySellStatService citySellStatService) {
|
||||
this.citySellStatService = citySellStatService;
|
||||
}
|
||||
|
||||
public void setRegionSellStatService(RegionSellStatService regionSellStatService) {
|
||||
this.regionSellStatService = regionSellStatService;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ public class TrendModel extends BaseModel implements TrendViewModel {
|
||||
private DistrictStatBo districtStatBo;
|
||||
private RegionStatBo regionStatBo;
|
||||
private CitySellStatBo citySellStatBo;
|
||||
private RegionSellStatBo regionSellStatBo;
|
||||
private String affectKeyword;
|
||||
private int chartWidth;
|
||||
private int chartHeight;
|
||||
@@ -339,4 +340,8 @@ public class TrendModel extends BaseModel implements TrendViewModel {
|
||||
public void setCitySellStatBo(CitySellStatBo citySellStatBo) {
|
||||
this.citySellStatBo = citySellStatBo;
|
||||
}
|
||||
|
||||
public void setRegionSellStatBo(RegionSellStatBo regionSellStatBo) {
|
||||
this.regionSellStatBo = regionSellStatBo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@
|
||||
</#if>
|
||||
|
||||
<div class="trend01b">
|
||||
<#if districtStatBo?? || regionStatBo?? || citySellStatBo??>
|
||||
<#if districtStatBo?? || regionStatBo?? || citySellStatBo?? || regionSellStatBo??>
|
||||
<#if count??><div><em>${count!}</em><label>楼盘总量</label></div></#if>
|
||||
<#if districtStatBo??>
|
||||
<div><em><#if districtStatBo.lastTimeDistrictStat??>${districtStatBo.lastTimeDistrictStat.avgPrice}<#else>暂无</#if></em><label>上周均价(元/㎡)</label></div>
|
||||
@@ -123,6 +123,11 @@
|
||||
<div><em>${citySellStatBo.lastTimeAvgPrice!}</em><label>上月均价(元/㎡)</label></div>
|
||||
<div><em>${citySellStatBo.avgPrice!}</em><label>本月均价(元/㎡)</label></div>
|
||||
<div style="margin-right:0;"><em class="<#if citySellStatBo.monthMarkup gte 0>up<#else>down</#if>"><i></i>${(citySellStatBo.monthMarkup/100)?string('0.00')}%</em><label>涨跌幅</label></div>
|
||||
<#elseif regionSellStatBo??>
|
||||
<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>
|
||||
@@ -163,7 +168,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="trend_content">
|
||||
<#if districtStatBo?? || regionStatBo?? || citySellStatBo??>
|
||||
<#if districtStatBo?? || regionStatBo?? || citySellStatBo?? || regionSellStatBo??>
|
||||
<ul class="chartTools01">
|
||||
<li><a id="exportButton">下载</a></li>
|
||||
<li><a id="printButton">打印</a></li>
|
||||
@@ -185,7 +190,7 @@
|
||||
</#if>
|
||||
<div class="chart" style="padding:20px;">
|
||||
<div id="container">
|
||||
<#if districtStatBo?? || regionStatBo?? || citySellStatBo??>
|
||||
<#if districtStatBo?? || regionStatBo?? || citySellStatBo?? || regionSellStatBo??>
|
||||
<img class="loading" src="${staticUrl}/images/bgtu/fangjia/trend-loading.gif?v=${version}">
|
||||
<#else>
|
||||
<div class="nofound">
|
||||
@@ -482,7 +487,7 @@
|
||||
var down_pic_temp = 0;
|
||||
$(document).ready(function(){
|
||||
//走势图
|
||||
<#if districtStatBo?? || regionStatBo?? || citySellStatBo??>
|
||||
<#if districtStatBo?? || regionStatBo?? || citySellStatBo?? || regionSellStatBo??>
|
||||
<#if type??>
|
||||
<#if type == '4' || type == 'quarter'>
|
||||
var url = Constants.cityUrl + '/trend/quarterData?defaultCityName=${cityName}&districtName=${districtName!}®ion=${region!}&block=${block!}&keyword=${keyword!}';
|
||||
|
||||
Reference in New Issue
Block a user