拆开城市区域stat
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
package com.fangjia.service.bo;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
public class CitySellStatBo implements Serializable {
|
||||
private static final long serialVersionUID = -5310665233447971693L;
|
||||
private String city;
|
||||
private String region;
|
||||
private String block;
|
||||
private int avgPrice;
|
||||
private int weekendMarkup;
|
||||
// Äêͬ±ÈÕǵø
|
||||
private Integer yearMarkup;
|
||||
// Ô»·±ÈÕǵø
|
||||
private Integer monthMarkup;
|
||||
private int month;
|
||||
|
||||
private int lastTimeAvgPrice;
|
||||
private Integer startDate;
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getRegion() {
|
||||
return region;
|
||||
}
|
||||
|
||||
public void setRegion(String region) {
|
||||
this.region = region;
|
||||
}
|
||||
|
||||
public String getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
public void setBlock(String block) {
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
public int getAvgPrice() {
|
||||
return avgPrice;
|
||||
}
|
||||
|
||||
public void setAvgPrice(int avgPrice) {
|
||||
this.avgPrice = avgPrice;
|
||||
}
|
||||
|
||||
public int getWeekendMarkup() {
|
||||
return weekendMarkup;
|
||||
}
|
||||
|
||||
public void setWeekendMarkup(int weekendMarkup) {
|
||||
this.weekendMarkup = weekendMarkup;
|
||||
}
|
||||
|
||||
public Integer getYearMarkup() {
|
||||
return yearMarkup;
|
||||
}
|
||||
|
||||
public void setYearMarkup(Integer yearMarkup) {
|
||||
this.yearMarkup = yearMarkup;
|
||||
}
|
||||
|
||||
public Integer getMonthMarkup() {
|
||||
return monthMarkup;
|
||||
}
|
||||
|
||||
public void setMonthMarkup(Integer monthMarkup) {
|
||||
this.monthMarkup = monthMarkup;
|
||||
}
|
||||
|
||||
public int getMonth() {
|
||||
return month;
|
||||
}
|
||||
|
||||
public void setMonth(int month) {
|
||||
this.month = month;
|
||||
}
|
||||
|
||||
public int getLastTimeAvgPrice() {
|
||||
return lastTimeAvgPrice;
|
||||
}
|
||||
|
||||
public void setLastTimeAvgPrice(int lastTimeAvgPrice) {
|
||||
this.lastTimeAvgPrice = lastTimeAvgPrice;
|
||||
}
|
||||
|
||||
public Integer getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(Integer startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.fangjia.service.bo;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
public class RegionSellStatBo implements Serializable {
|
||||
private static final long serialVersionUID = -5310665233447971693L;
|
||||
private String city;
|
||||
private String region;
|
||||
private String block;
|
||||
private int avgPrice;
|
||||
private int weekendMarkup;
|
||||
// Äêͬ±ÈÕǵø
|
||||
private Integer yearMarkup;
|
||||
// Ô»·±ÈÕǵø
|
||||
private Integer monthMarkup;
|
||||
private int month;
|
||||
|
||||
private int lastTimeAvgPrice;
|
||||
private Integer startDate;
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getRegion() {
|
||||
return region;
|
||||
}
|
||||
|
||||
public void setRegion(String region) {
|
||||
this.region = region;
|
||||
}
|
||||
|
||||
public String getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
public void setBlock(String block) {
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
public int getAvgPrice() {
|
||||
return avgPrice;
|
||||
}
|
||||
|
||||
public void setAvgPrice(int avgPrice) {
|
||||
this.avgPrice = avgPrice;
|
||||
}
|
||||
|
||||
public int getWeekendMarkup() {
|
||||
return weekendMarkup;
|
||||
}
|
||||
|
||||
public void setWeekendMarkup(int weekendMarkup) {
|
||||
this.weekendMarkup = weekendMarkup;
|
||||
}
|
||||
|
||||
public Integer getYearMarkup() {
|
||||
return yearMarkup;
|
||||
}
|
||||
|
||||
public void setYearMarkup(Integer yearMarkup) {
|
||||
this.yearMarkup = yearMarkup;
|
||||
}
|
||||
|
||||
public Integer getMonthMarkup() {
|
||||
return monthMarkup;
|
||||
}
|
||||
|
||||
public void setMonthMarkup(Integer monthMarkup) {
|
||||
this.monthMarkup = monthMarkup;
|
||||
}
|
||||
|
||||
public int getMonth() {
|
||||
return month;
|
||||
}
|
||||
|
||||
public void setMonth(int month) {
|
||||
this.month = month;
|
||||
}
|
||||
|
||||
public int getLastTimeAvgPrice() {
|
||||
return lastTimeAvgPrice;
|
||||
}
|
||||
|
||||
public void setLastTimeAvgPrice(int lastTimeAvgPrice) {
|
||||
this.lastTimeAvgPrice = lastTimeAvgPrice;
|
||||
}
|
||||
|
||||
public Integer getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(Integer startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+11
@@ -2,7 +2,9 @@ package com.fangjia.service.datastore;
|
||||
|
||||
import com.fangjia.dal.mongo.model.CitySellStat;
|
||||
import com.fangjia.dal.mongo.model.DistrictSellStat;
|
||||
import com.fangjia.dal.mongo.model.RegionStat;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -32,4 +34,13 @@ public interface CitySellStatService {
|
||||
* @return
|
||||
*/
|
||||
CitySellStat findCitySellStatByCity(String city);
|
||||
|
||||
List<CitySellStat> findNearCityStat(String city, Integer startDate, int count);
|
||||
|
||||
/**
|
||||
* 查询均价开始的最早时间
|
||||
* @param city
|
||||
* @return
|
||||
*/
|
||||
CitySellStat findStartStat(String city);
|
||||
}
|
||||
|
||||
+35
-7
@@ -1,12 +1,6 @@
|
||||
package com.fangjia.service.datastore;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import com.fangjia.core.util.CacheUtils;
|
||||
import com.fangjia.core.util.DateUtil;
|
||||
@@ -16,9 +10,11 @@ import com.fangjia.dal.SortParam;
|
||||
import com.fangjia.dal.common.DistrictKey;
|
||||
import com.fangjia.dal.mongo.dao.CitySellStatDao;
|
||||
import com.fangjia.dal.mongo.model.CitySellStat;
|
||||
import com.fangjia.dal.mongo.model.RegionStat;
|
||||
import com.fangjia.service.bo.DistrictStatBo;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.sothis.core.util.Closure;
|
||||
|
||||
/**
|
||||
@@ -108,4 +104,36 @@ 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,
|
||||
new Closure<List<CitySellStat>, String>() {
|
||||
@Override
|
||||
public List<CitySellStat> execute(String input) {
|
||||
List<QueryParam> q = new ArrayList<QueryParam>(5);
|
||||
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("date", false));
|
||||
return citySellStatDao.findAllByParams(q, s, count);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public CitySellStat findStartStat(final String city) {
|
||||
return CacheUtils.getValue(this.getClass(), "findStartStat",city, CachePolicyEnum.LONG,
|
||||
new Closure<CitySellStat, String>() {
|
||||
@Override
|
||||
public CitySellStat execute(String input) {
|
||||
List<QueryParam> q = new ArrayList<QueryParam>(5);
|
||||
q.add(new QueryParam("city", city));
|
||||
|
||||
List<SortParam> s = new ArrayList<SortParam>();
|
||||
s.add(new SortParam("date", true));
|
||||
return citySellStatDao.findFirstByParams(q, s);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.fangjia.service.datastore;
|
||||
|
||||
import com.fangjia.dal.mongo.model.RegionStat;
|
||||
import com.fangjia.service.bo.AvgUpdateBo;
|
||||
import com.fangjia.service.bo.RegionStatBo;
|
||||
import org.sothis.core.util.Pager;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public interface RegionSellService {
|
||||
|
||||
|
||||
}
|
||||
-5
@@ -5,10 +5,5 @@ import java.util.List;
|
||||
import com.fangjia.dal.mongo.model.RegionSellStat;
|
||||
|
||||
public interface RegionSellStatService {
|
||||
|
||||
RegionSellStat findNewestRegionPrice();
|
||||
|
||||
List<RegionSellStat> findAllRegionPriceByCity(String city, Integer date, String sortField, Boolean sortWay);
|
||||
|
||||
RegionSellStat findNewestRegionPrice(String city, String region);
|
||||
}
|
||||
|
||||
-49
@@ -11,55 +11,6 @@ import com.fangjia.dal.mongo.dao.RegionSellStatDao;
|
||||
import com.fangjia.dal.mongo.model.RegionSellStat;
|
||||
|
||||
public class RegionSellStatServiceImpl implements RegionSellStatService {
|
||||
|
||||
private RegionSellStatDao regionSellStatDao;
|
||||
|
||||
public RegionSellStatDao getRegionSellStatDao() {
|
||||
return regionSellStatDao;
|
||||
}
|
||||
|
||||
public void setRegionSellStatDao(RegionSellStatDao regionSellStatDao) {
|
||||
this.regionSellStatDao = regionSellStatDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RegionSellStat findNewestRegionPrice() {
|
||||
List<SortParam> sortParams = new ArrayList<SortParam>();
|
||||
sortParams.add(new SortParam("date", false));
|
||||
return regionSellStatDao.findFirstByParams(null, sortParams);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RegionSellStat> findAllRegionPriceByCity(String city,
|
||||
Integer date, String sortField, Boolean sortWay) {
|
||||
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||
params.add(new QueryParam("city", city));
|
||||
params.add(new QueryParam("date", date));
|
||||
|
||||
List<SortParam> sortParams = new ArrayList<SortParam>();
|
||||
if(StringUtils.isNotBlank(sortField)){
|
||||
sortParams.add(new SortParam(sortField, sortWay));
|
||||
}else{
|
||||
sortParams.add(new SortParam("mom", false));
|
||||
}
|
||||
|
||||
|
||||
return regionSellStatDao.findAllByParams(params, sortParams);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RegionSellStat findNewestRegionPrice(String city, String region) {
|
||||
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||
params.add(new QueryParam("city", city));
|
||||
params.add(new QueryParam("region", region));
|
||||
|
||||
List<SortParam> sortParams = new ArrayList<SortParam>();
|
||||
sortParams.add(new SortParam("date", false));
|
||||
return regionSellStatDao.findFirstByParams(params, sortParams);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user