Merge remote-tracking branch 'origin/master'
This commit is contained in:
+30
-37
@@ -28,6 +28,9 @@ import javax.servlet.http.Cookie;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
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 net.sf.json.JSONObject;
|
||||||
|
|
||||||
import org.apache.commons.codec.digest.DigestUtils;
|
import org.apache.commons.codec.digest.DigestUtils;
|
||||||
@@ -105,19 +108,6 @@ import com.fangjia.dal.mongo.fangjia.model.LoanLeads;
|
|||||||
import com.fangjia.dal.mongo.fangjia.model.LoanProduct;
|
import com.fangjia.dal.mongo.fangjia.model.LoanProduct;
|
||||||
import com.fangjia.dal.mongo.fangjia.model.LoanProductTag;
|
import com.fangjia.dal.mongo.fangjia.model.LoanProductTag;
|
||||||
import com.fangjia.dal.mongo.fangjia.model.ServerArea;
|
import com.fangjia.dal.mongo.fangjia.model.ServerArea;
|
||||||
import com.fangjia.dal.mongo.model.AddressMatchLog;
|
|
||||||
import com.fangjia.dal.mongo.model.CityNewPrice;
|
|
||||||
import com.fangjia.dal.mongo.model.DistrictSellStat;
|
|
||||||
import com.fangjia.dal.mongo.model.DistrictStat;
|
|
||||||
import com.fangjia.dal.mongo.model.Evaluation;
|
|
||||||
import com.fangjia.dal.mongo.model.FangjiaCommonLog;
|
|
||||||
import com.fangjia.dal.mongo.model.HouseLoudong;
|
|
||||||
import com.fangjia.dal.mongo.model.HousePrice;
|
|
||||||
import com.fangjia.dal.mongo.model.InputUserInfo;
|
|
||||||
import com.fangjia.dal.mongo.model.IpCount;
|
|
||||||
import com.fangjia.dal.mongo.model.RegionStat;
|
|
||||||
import com.fangjia.dal.mongo.model.SnapData;
|
|
||||||
import com.fangjia.dal.mongo.model.ThirdIpCount;
|
|
||||||
import com.fangjia.dal.mongo.model.bkoff.AdLog;
|
import com.fangjia.dal.mongo.model.bkoff.AdLog;
|
||||||
import com.fangjia.dal.mongo.model.bkoff.Advertisement;
|
import com.fangjia.dal.mongo.model.bkoff.Advertisement;
|
||||||
import com.fangjia.dal.mongo.pds.model.AlgorithmRule;
|
import com.fangjia.dal.mongo.pds.model.AlgorithmRule;
|
||||||
@@ -145,16 +135,6 @@ import com.fangjia.service.chart.generator.ChartGenerator;
|
|||||||
import com.fangjia.service.chart.ofc.bean.OfcStyleConfig;
|
import com.fangjia.service.chart.ofc.bean.OfcStyleConfig;
|
||||||
import com.fangjia.service.common.CookieName;
|
import com.fangjia.service.common.CookieName;
|
||||||
import com.fangjia.service.cpc.CpcService;
|
import com.fangjia.service.cpc.CpcService;
|
||||||
import com.fangjia.service.datastore.DistrictDto;
|
|
||||||
import com.fangjia.service.datastore.DistrictSellStatService;
|
|
||||||
import com.fangjia.service.datastore.DistrictService;
|
|
||||||
import com.fangjia.service.datastore.EvaluationService;
|
|
||||||
import com.fangjia.service.datastore.HouseService;
|
|
||||||
import com.fangjia.service.datastore.IpCountService;
|
|
||||||
import com.fangjia.service.datastore.RegionStatService;
|
|
||||||
import com.fangjia.service.datastore.ReportDistrictInfoService;
|
|
||||||
import com.fangjia.service.datastore.SchoolService;
|
|
||||||
import com.fangjia.service.datastore.ThirdIpCountService;
|
|
||||||
import com.fangjia.service.datastore.bean.DistrictQueryBean;
|
import com.fangjia.service.datastore.bean.DistrictQueryBean;
|
||||||
import com.fangjia.service.datastore.bean.EvaluationBeforeLoanBean;
|
import com.fangjia.service.datastore.bean.EvaluationBeforeLoanBean;
|
||||||
import com.fangjia.service.datastore.bean.HousePicEnum;
|
import com.fangjia.service.datastore.bean.HousePicEnum;
|
||||||
@@ -173,13 +153,6 @@ import com.fangjia.service.fangjia.LoanProductService;
|
|||||||
import com.fangjia.service.fangjia.LoanProductTagService;
|
import com.fangjia.service.fangjia.LoanProductTagService;
|
||||||
import com.fangjia.service.fsh.CityNewPriceService;
|
import com.fangjia.service.fsh.CityNewPriceService;
|
||||||
import com.fangjia.service.menu.MenuCategoryEnum;
|
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.news.NewsService;
|
||||||
import com.fangjia.service.pds.AlgorithmRuleService;
|
import com.fangjia.service.pds.AlgorithmRuleService;
|
||||||
import com.fangjia.service.pds.DistrictHouseNumberService;
|
import com.fangjia.service.pds.DistrictHouseNumberService;
|
||||||
@@ -212,6 +185,8 @@ public class EvaluationController {
|
|||||||
private SnapDataService snapDataService;
|
private SnapDataService snapDataService;
|
||||||
private HouseService houseService;
|
private HouseService houseService;
|
||||||
private RegionStatService regionStatService;
|
private RegionStatService regionStatService;
|
||||||
|
private CitySellStatService citySellStatService;
|
||||||
|
private RegionSellStatService regionSellStatService;
|
||||||
private MenuService menuService;
|
private MenuService menuService;
|
||||||
private CpcService cpcService;
|
private CpcService cpcService;
|
||||||
private DistrictStatRentService districtStatRentService;
|
private DistrictStatRentService districtStatRentService;
|
||||||
@@ -3626,23 +3601,34 @@ public Object checkUserAction(EvaluationModel model, HttpServletRequest req, Htt
|
|||||||
|
|
||||||
private Map<String,Integer> buildStatJson(String city, String region, String block, Date startDate) {
|
private Map<String,Integer> buildStatJson(String city, String region, String block, Date startDate) {
|
||||||
List<RegionStat> regionStatList = null;
|
List<RegionStat> regionStatList = null;
|
||||||
|
List<CitySellStat> citySellStats = null;
|
||||||
|
List<RegionSellStat> regionSellStats = null;
|
||||||
Map<String, String> oprions = new HashMap<String, String>();
|
Map<String, String> oprions = new HashMap<String, String>();
|
||||||
Date currentDate = new Date();
|
Date currentDate = new Date();
|
||||||
if (city != null && region != null) {
|
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);
|
oprions.put("name", region);
|
||||||
} else if (city != null) {
|
} else if (city != null) {
|
||||||
regionStatList = regionStatService.findRegionStat(city, null, null, startDate, currentDate);
|
citySellStats = citySellStatService.findCitySellStat(city, Integer.parseInt(DateUtil.formatByPattern(startDate, "yyyyMM")), Integer.parseInt(DateUtil.formatByPattern(currentDate, "yyyyMM")));
|
||||||
oprions.put("name", city);
|
oprions.put("name", city);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (regionStatList == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
Map<String,Integer> map = new HashMap<String,Integer>();
|
Map<String,Integer> map = new HashMap<String,Integer>();
|
||||||
SimpleDateFormat format = new SimpleDateFormat("yyyy.MM");
|
SimpleDateFormat format = new SimpleDateFormat("yyyy.MM");
|
||||||
for (RegionStat re : regionStatList) {
|
if (CollectionUtils.isNotEmpty(regionStatList)) {
|
||||||
map.put(format.format(DateUtil.getBeforeDay(re.getWeekend(), -1)),re.getAvgPrice());
|
for (RegionStat re : regionStatList) {
|
||||||
|
map.put(format.format(DateUtil.getBeforeDay(re.getWeekend(), -1)), re.getAvgPrice());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isNotEmpty(citySellStats)) {
|
||||||
|
for (CitySellStat re : citySellStats) {
|
||||||
|
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;
|
return map;
|
||||||
}
|
}
|
||||||
@@ -4750,4 +4736,11 @@ public Object checkUserAction(EvaluationModel model, HttpServletRequest req, Htt
|
|||||||
this.ipCountService = ipCountService;
|
this.ipCountService = ipCountService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setCitySellStatService(CitySellStatService citySellStatService) {
|
||||||
|
this.citySellStatService = citySellStatService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRegionSellStatService(RegionSellStatService regionSellStatService) {
|
||||||
|
this.regionSellStatService = regionSellStatService;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+135
-29
@@ -14,8 +14,12 @@ import java.util.Map;
|
|||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import com.fangjia.core.City;
|
||||||
import com.fangjia.coresite.model.*;
|
import com.fangjia.coresite.model.*;
|
||||||
|
import com.fangjia.dal.mongo.model.*;
|
||||||
import com.fangjia.service.bo.*;
|
import com.fangjia.service.bo.*;
|
||||||
|
import com.fangjia.service.datastore.*;
|
||||||
|
import com.fangjia.service.mongo.fangjia.RegionSellStatService;
|
||||||
import net.sf.json.JSONObject;
|
import net.sf.json.JSONObject;
|
||||||
|
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
@@ -39,21 +43,9 @@ import com.fangjia.dal.common.DistrictKey;
|
|||||||
import com.fangjia.dal.common.FangjiaServerAreaContextHolder;
|
import com.fangjia.dal.common.FangjiaServerAreaContextHolder;
|
||||||
import com.fangjia.dal.datastore.model.News;
|
import com.fangjia.dal.datastore.model.News;
|
||||||
import com.fangjia.dal.mongo.fangjia.model.ServerArea;
|
import com.fangjia.dal.mongo.fangjia.model.ServerArea;
|
||||||
import com.fangjia.dal.mongo.model.CityTradeStat;
|
|
||||||
import com.fangjia.dal.mongo.model.DistrictNewPrice;
|
|
||||||
import com.fangjia.dal.mongo.model.DistrictSellStat;
|
|
||||||
import com.fangjia.dal.mongo.model.DistrictStat;
|
|
||||||
import com.fangjia.dal.mongo.model.DistrictTradeStat;
|
|
||||||
import com.fangjia.dal.mongo.model.RegionBlock;
|
|
||||||
import com.fangjia.dal.mongo.model.RegionStat;
|
|
||||||
import com.fangjia.dal.seaweed.model.District;
|
import com.fangjia.dal.seaweed.model.District;
|
||||||
import com.fangjia.service.datastore.DistrictSellStatService;
|
|
||||||
import com.fangjia.service.datastore.DistrictService;
|
|
||||||
import com.fangjia.service.datastore.HouseService;
|
|
||||||
import com.fangjia.service.datastore.RegionStatService;
|
|
||||||
import com.fangjia.service.datastore.bean.HousePicEnum;
|
import com.fangjia.service.datastore.bean.HousePicEnum;
|
||||||
import com.fangjia.service.datastore.bean.HouseQueryBean;
|
import com.fangjia.service.datastore.bean.HouseQueryBean;
|
||||||
import com.fangjia.service.datastore.EvaluationService;
|
|
||||||
import com.fangjia.service.district.DistrictStatService;
|
import com.fangjia.service.district.DistrictStatService;
|
||||||
import com.fangjia.service.district.TradeStatService;
|
import com.fangjia.service.district.TradeStatService;
|
||||||
import com.fangjia.service.fsh.DistrictNewPriceService;
|
import com.fangjia.service.fsh.DistrictNewPriceService;
|
||||||
@@ -82,6 +74,9 @@ public class TrendController {
|
|||||||
private static int QUARTER_WEEK = 13;
|
private static int QUARTER_WEEK = 13;
|
||||||
private final static Logger LOGGER = LoggerFactory.getLogger(TrendController.class);
|
private final static Logger LOGGER = LoggerFactory.getLogger(TrendController.class);
|
||||||
|
|
||||||
|
private CitySellStatService citySellStatService;
|
||||||
|
private RegionSellStatService regionSellStatService;
|
||||||
|
|
||||||
public Object trendChartAction(TrendModel model, HttpServletRequest request) {
|
public Object trendChartAction(TrendModel model, HttpServletRequest request) {
|
||||||
TrendView trendView = TrendViewFactory.getInstance().create(model);
|
TrendView trendView = TrendViewFactory.getInstance().create(model);
|
||||||
if (trendView != null) {
|
if (trendView != null) {
|
||||||
@@ -171,7 +166,9 @@ public class TrendController {
|
|||||||
|
|
||||||
model.setRegionItems(getRegionItems(model));
|
model.setRegionItems(getRegionItems(model));
|
||||||
model.setBlockItems(getRegionBlocks(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);
|
model.setDefaultCityName(city);
|
||||||
TrendView trendView = TrendViewFactory.getInstance().create(model);
|
TrendView trendView = TrendViewFactory.getInstance().create(model);
|
||||||
if (trendView == null) {
|
if (trendView == null) {
|
||||||
@@ -182,15 +179,15 @@ public class TrendController {
|
|||||||
//DistrictStatBo statBo = getDistrictStat(new DistrictKey(trendView.getCityName(), trendView.getRegion(), trendView.getDistrictName()));
|
//DistrictStatBo statBo = getDistrictStat(new DistrictKey(trendView.getCityName(), trendView.getRegion(), trendView.getDistrictName()));
|
||||||
DistrictStatBo statBo = getNearestDistrictStat(new DistrictKey(trendView.getCityName(), trendView.getRegion(), trendView.getDistrictName()));
|
DistrictStatBo statBo = getNearestDistrictStat(new DistrictKey(trendView.getCityName(), trendView.getRegion(), trendView.getDistrictName()));
|
||||||
model.setDistrictStatBo(statBo);
|
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 = getRegionBlockStat(trendView.getCityName(), trendView.getRegion(), trendView.getBlock());
|
||||||
RegionStatBo regionStat = getNearestRegionStat(trendView.getCityName(), trendView.getRegion(), trendView.getBlock());
|
RegionSellStatBo regionSellStatBo = getNearestRegionSellStat(trendView.getCityName(), trendView.getRegion());
|
||||||
model.setRegionStatBo(regionStat);
|
model.setRegionSellStatBo(regionSellStatBo);
|
||||||
model.setRegion(trendView.getRegion());
|
model.setRegion(trendView.getRegion());
|
||||||
} else if (trendView.getType().equals(ViewType.city)) {
|
} else if (trendView.getType().equals(ViewType.city)) {
|
||||||
//RegionStatBo regionStat = getRegionBlockStat(trendView.getCityName(), null, null);
|
//RegionStatBo regionStat = getRegionBlockStat(trendView.getCityName(), null, null);
|
||||||
RegionStatBo regionStat = getNearestRegionStat(trendView.getCityName(), null, null);
|
CitySellStatBo citySellStat = getNearestCitySellStat(trendView.getCityName());
|
||||||
model.setRegionStatBo(regionStat);
|
model.setCitySellStatBo(citySellStat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -275,6 +272,30 @@ public class TrendController {
|
|||||||
return Collections.EMPTY_LIST;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 城市房价排行
|
* 城市房价排行
|
||||||
*/
|
*/
|
||||||
@@ -676,31 +697,51 @@ public class TrendController {
|
|||||||
|
|
||||||
private List<JSONObject> buildStatJson(String city, String region, String block, int weeks) {
|
private List<JSONObject> buildStatJson(String city, String region, String block, int weeks) {
|
||||||
List<RegionStat> regionStatList = null;
|
List<RegionStat> regionStatList = null;
|
||||||
|
List<CitySellStat> citySellStatList = null;
|
||||||
|
List<RegionSellStat> regionSellStatList = null;
|
||||||
Map<String, String> oprions = new HashMap<String, String>();
|
Map<String, String> oprions = new HashMap<String, String>();
|
||||||
Date currentDate = new Date();
|
Date currentDate = new Date();
|
||||||
if (city != null && region != null && block != null) {
|
if (city != null && region != null && block != null) {
|
||||||
regionStatList = regionStatService.findRegionStat(city, region, block, currentDate, weeks);
|
regionStatList = regionStatService.findRegionStat(city, region, block, currentDate, weeks);
|
||||||
oprions.put("name", block + "板块");
|
oprions.put("name", block + "板块");
|
||||||
} else if (city != null && region != null) {
|
} 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);
|
oprions.put("name", region);
|
||||||
} else if (city != null) {
|
} else if (city != null) {
|
||||||
regionStatList = regionStatService.findRegionStat(city, null, null, currentDate, weeks);
|
//regionStatList = regionStatService.findRegionStat(city, null, null, currentDate, weeks);
|
||||||
|
int month = weeks / 4;
|
||||||
|
citySellStatList = citySellStatService.getAllWithMonths(city, month);
|
||||||
oprions.put("name", city);
|
oprions.put("name", city);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<JSONObject> ret = new ArrayList<JSONObject>();
|
List<JSONObject> ret = new ArrayList<JSONObject>();
|
||||||
if (regionStatList == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
JSONArray splineJa = new JSONArray();
|
JSONArray splineJa = new JSONArray();
|
||||||
|
|
||||||
for (RegionStat re : regionStatList) {
|
if (CollectionUtils.isNotEmpty(regionStatList)) {
|
||||||
JSONArray ja = new JSONArray();
|
for (RegionStat re : regionStatList) {
|
||||||
ja.put(DateUtil.getBeforeDay(re.getWeekend(), -1).getTime());
|
JSONArray ja = new JSONArray();
|
||||||
ja.put(re.getAvgPrice());
|
ja.put(DateUtil.getBeforeDay(re.getWeekend(), -1).getTime());
|
||||||
splineJa.put(ja);
|
ja.put(re.getAvgPrice());
|
||||||
|
splineJa.put(ja);
|
||||||
|
}
|
||||||
|
} else if (CollectionUtils.isNotEmpty(citySellStatList)) {
|
||||||
|
for (int i = citySellStatList.size() - 1; i >= 0; i--) {
|
||||||
|
CitySellStat re = citySellStatList.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);
|
||||||
|
}
|
||||||
|
} 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) {
|
if (splineJa.length() > 0) {
|
||||||
@@ -826,6 +867,64 @@ public class TrendController {
|
|||||||
seriesOptions.addAll(data);
|
seriesOptions.addAll(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private CitySellStatBo getNearestCitySellStat(String city) {
|
||||||
|
CitySellStatBo ret = null;
|
||||||
|
List<CitySellStat> citySellStats = null;
|
||||||
|
Integer startDate = Integer.valueOf(DateUtil.formatByPattern(DateUtils.addMonths(new Date(), -3), "yyyyMM"));
|
||||||
|
citySellStats = citySellStatService.findNearCityStat(city, startDate, 2);
|
||||||
|
if(citySellStats!=null && citySellStats.size()>0){
|
||||||
|
CitySellStatBo bo = new CitySellStatBo();
|
||||||
|
if(citySellStats.size()==2){
|
||||||
|
bo.setAvgPrice(citySellStats.get(0).getAvgPrice());
|
||||||
|
bo.setLastTimeAvgPrice(citySellStats.get(1).getAvgPrice());
|
||||||
|
int monthMarkup = (citySellStats.get(0).getAvgPrice()-citySellStats.get(1).getAvgPrice())*10000/citySellStats.get(1).getAvgPrice();
|
||||||
|
bo.setMonthMarkup(monthMarkup);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
bo.setAvgPrice(citySellStats.get(0).getAvgPrice());
|
||||||
|
}
|
||||||
|
|
||||||
|
CitySellStat rs = citySellStatService.findStartStat(city);
|
||||||
|
if(rs!=null){
|
||||||
|
bo.setStartDate(rs.getDate() / 100);
|
||||||
|
}
|
||||||
|
return bo;
|
||||||
|
}
|
||||||
|
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() / 100);
|
||||||
|
}
|
||||||
|
return bo;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private RegionStatBo getNearestRegionStat(String city, String region, String block){
|
private RegionStatBo getNearestRegionStat(String city, String region, String block){
|
||||||
RegionStatBo ret = null;
|
RegionStatBo ret = null;
|
||||||
@@ -1284,4 +1383,11 @@ public class TrendController {
|
|||||||
this.evaluationService = evaluationService;
|
this.evaluationService = evaluationService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setCitySellStatService(CitySellStatService citySellStatService) {
|
||||||
|
this.citySellStatService = citySellStatService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRegionSellStatService(RegionSellStatService regionSellStatService) {
|
||||||
|
this.regionSellStatService = regionSellStatService;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ public class TrendModel extends BaseModel implements TrendViewModel {
|
|||||||
private String trendDesc;
|
private String trendDesc;
|
||||||
private DistrictStatBo districtStatBo;
|
private DistrictStatBo districtStatBo;
|
||||||
private RegionStatBo regionStatBo;
|
private RegionStatBo regionStatBo;
|
||||||
|
private CitySellStatBo citySellStatBo;
|
||||||
|
private RegionSellStatBo regionSellStatBo;
|
||||||
private String affectKeyword;
|
private String affectKeyword;
|
||||||
private int chartWidth;
|
private int chartWidth;
|
||||||
private int chartHeight;
|
private int chartHeight;
|
||||||
@@ -330,4 +332,20 @@ public class TrendModel extends BaseModel implements TrendViewModel {
|
|||||||
public void setCityStatInfoBos(List<CityStatInfoBo> cityStatInfoBos) {
|
public void setCityStatInfoBos(List<CityStatInfoBo> cityStatInfoBos) {
|
||||||
this.cityStatInfoBos = cityStatInfoBos;
|
this.cityStatInfoBos = cityStatInfoBos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CitySellStatBo getCitySellStatBo() {
|
||||||
|
return citySellStatBo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCitySellStatBo(CitySellStatBo citySellStatBo) {
|
||||||
|
this.citySellStatBo = citySellStatBo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RegionSellStatBo getRegionSellStatBo() {
|
||||||
|
return regionSellStatBo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRegionSellStatBo(RegionSellStatBo regionSellStatBo) {
|
||||||
|
this.regionSellStatBo = regionSellStatBo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,21 +104,34 @@
|
|||||||
|
|
||||||
|
|
||||||
<div class="trend trend01">
|
<div class="trend trend01">
|
||||||
<#if districtStatBo?? || regionStatBo??>
|
<#if districtStatBo?? || regionStatBo?? || citySellStatBo?? || regionSellStatBo??>
|
||||||
<div class="trend01a">
|
<div class="trend01a">
|
||||||
<div class="herder"><p><span class="text_56">${affectValue}房产</span>均价走势</p></div>
|
<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>
|
<p class="mobile01 description">${descWord}</p>
|
||||||
</div>
|
</div>
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
<div class="trend01b">
|
<div class="trend01b">
|
||||||
<#if districtStatBo?? || regionStatBo??>
|
<#if districtStatBo?? || regionStatBo?? || citySellStatBo?? || regionSellStatBo??>
|
||||||
<#if count??><div><em>${count!}</em><label>楼盘总量</label></div></#if>
|
<#if count??><div><em>${count!}</em><label>楼盘总量</label></div></#if>
|
||||||
<#if districtStatBo??>
|
<#if districtStatBo??>
|
||||||
<div><em><#if districtStatBo.lastTimeDistrictStat??>${districtStatBo.lastTimeDistrictStat.avgPrice}<#else>暂无</#if></em><label>上周均价(元/㎡)</label></div>
|
<div><em><#if districtStatBo.lastTimeDistrictStat??>${districtStatBo.lastTimeDistrictStat.avgPrice}<#else>暂无</#if></em><label>上周均价(元/㎡)</label></div>
|
||||||
<div><em><#if districtStatBo.districtStat??>${districtStatBo.districtStat.avgPrice}<#else>暂无</#if></em><label>本周均价(元/㎡)</label></div>
|
<div><em><#if districtStatBo.districtStat??>${districtStatBo.districtStat.avgPrice}<#else>暂无</#if></em><label>本周均价(元/㎡)</label></div>
|
||||||
<div><em class="<#if districtStatBo.districtStat.weekendMarkup/100 gte 0>up<#else>down</#if>"><i></i>${(districtStatBo.districtStat.weekendMarkup/100)?string('0.00')}%</em><label>涨跌幅</label></div>
|
<div><em class="<#if districtStatBo.districtStat.weekendMarkup/100 gte 0>up<#else>down</#if>"><i></i>${(districtStatBo.districtStat.weekendMarkup/100)?string('0.00')}%</em><label>涨跌幅</label></div>
|
||||||
|
<#elseif citySellStatBo??>
|
||||||
|
<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??>
|
<#elseif regionStatBo??>
|
||||||
<div><em>${regionStatBo.lastTimeAvgPrice!}</em><label>上周均价(元/㎡)</label></div>
|
<div><em>${regionStatBo.lastTimeAvgPrice!}</em><label>上周均价(元/㎡)</label></div>
|
||||||
<div><em>${regionStatBo.avgPrice!}</em><label>本周均价(元/㎡)</label></div>
|
<div><em>${regionStatBo.avgPrice!}</em><label>本周均价(元/㎡)</label></div>
|
||||||
@@ -145,21 +158,21 @@
|
|||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<#if blockItems?? && blockItems?size gt 0>
|
<#-- <#if blockItems?? && blockItems?size gt 0>-->
|
||||||
<span><a><#if block??>${block!}<#else>板块</#if></a><i></i>
|
<#-- <span><a><#if block??>${block!}<#else>板块</#if></a><i></i>-->
|
||||||
<div class="noteText dn" id="blockDiv">
|
<#-- <div class="noteText dn" id="blockDiv">-->
|
||||||
<font></font>
|
<#-- <font></font>-->
|
||||||
<a <#if !(block??)>class="cur"</#if> href="<@d_url schema="${citySchema}" uri="/${controllerName}/${actionName}"><@d_param name="region" value="${region!}" /><@d_param name="block" value="" /><@d_param name="type" value="${type!}" /></@d_url>">不限</a>
|
<#-- <a <#if !(block??)>class="cur"</#if> href="<@d_url schema="${citySchema}" uri="/${controllerName}/${actionName}"><@d_param name="region" value="${region!}" /><@d_param name="block" value="" /><@d_param name="type" value="${type!}" /></@d_url>">不限</a>-->
|
||||||
<#list blockItems as item>
|
<#-- <#list blockItems as item>-->
|
||||||
<a href="<@d_url schema="${citySchema}" uri="/${controllerName}/${actionName}"><@d_param name="region" value="${item.name!}" /><@d_param name="type" value="${type!}" /></@d_url>" title="最新${item.caption}房价走势">${item.caption}</a>
|
<#-- <a href="<@d_url schema="${citySchema}" uri="/${controllerName}/${actionName}"><@d_param name="region" value="${item.name!}" /><@d_param name="type" value="${type!}" /></@d_url>" title="最新${item.caption}房价走势">${item.caption}</a>-->
|
||||||
</#list>
|
<#-- </#list>-->
|
||||||
</div>
|
<#-- </div>-->
|
||||||
</span>
|
<#-- </span>-->
|
||||||
</#if>
|
<#-- </#if>-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="trend_content">
|
<div class="trend_content">
|
||||||
<#if districtStatBo?? || regionStatBo??>
|
<#if districtStatBo?? || regionStatBo?? || citySellStatBo?? || regionSellStatBo??>
|
||||||
<ul class="chartTools01">
|
<ul class="chartTools01">
|
||||||
<li><a id="exportButton">下载</a></li>
|
<li><a id="exportButton">下载</a></li>
|
||||||
<li><a id="printButton">打印</a></li>
|
<li><a id="printButton">打印</a></li>
|
||||||
@@ -181,7 +194,7 @@
|
|||||||
</#if>
|
</#if>
|
||||||
<div class="chart" style="padding:20px;">
|
<div class="chart" style="padding:20px;">
|
||||||
<div id="container">
|
<div id="container">
|
||||||
<#if districtStatBo?? || regionStatBo??>
|
<#if districtStatBo?? || regionStatBo?? || citySellStatBo?? || regionSellStatBo??>
|
||||||
<img class="loading" src="${staticUrl}/images/bgtu/fangjia/trend-loading.gif?v=${version}">
|
<img class="loading" src="${staticUrl}/images/bgtu/fangjia/trend-loading.gif?v=${version}">
|
||||||
<#else>
|
<#else>
|
||||||
<div class="nofound">
|
<div class="nofound">
|
||||||
@@ -478,7 +491,7 @@
|
|||||||
var down_pic_temp = 0;
|
var down_pic_temp = 0;
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
//走势图
|
//走势图
|
||||||
<#if districtStatBo?? || regionStatBo??>
|
<#if districtStatBo?? || regionStatBo?? || citySellStatBo?? || regionSellStatBo??>
|
||||||
<#if type??>
|
<#if type??>
|
||||||
<#if type == '4' || type == 'quarter'>
|
<#if type == '4' || type == 'quarter'>
|
||||||
var url = Constants.cityUrl + '/trend/quarterData?defaultCityName=${cityName}&districtName=${districtName!}®ion=${region!}&block=${block!}&keyword=${keyword!}';
|
var url = Constants.cityUrl + '/trend/quarterData?defaultCityName=${cityName}&districtName=${districtName!}®ion=${region!}&block=${block!}&keyword=${keyword!}';
|
||||||
|
|||||||
@@ -103,12 +103,12 @@
|
|||||||
<div class="trend01b">
|
<div class="trend01b">
|
||||||
<#if districtStatBo?? || regionStatBo??>
|
<#if districtStatBo?? || regionStatBo??>
|
||||||
<#if districtStatBo??>
|
<#if districtStatBo??>
|
||||||
<div><em><#if districtStatBo.lastTimeDistrictStat??>${districtStatBo.lastTimeDistrictStat.avgPrice}<#else>暂无</#if></em><label>上周均价(元/㎡)</label></div>
|
<div><em><#if districtStatBo.lastTimeDistrictStat??>${districtStatBo.lastTimeDistrictStat.avgPrice}<#else>暂无</#if></em><label>上月均价(元/㎡)</label></div>
|
||||||
<div><em><#if districtStatBo.districtStat??>${districtStatBo.districtStat.avgPrice}<#else>暂无</#if></em><label>本周均价(元/㎡)</label></div>
|
<div><em><#if districtStatBo.districtStat??>${districtStatBo.districtStat.avgPrice}<#else>暂无</#if></em><label>本月均价(元/㎡)</label></div>
|
||||||
<div style="margin-right:0;"><em class="<#if districtStatBo.districtStat.weekendMarkup/100 gte 0>up<#else>down</#if>"><i></i>${(districtStatBo.districtStat.weekendMarkup/100)?string('0.00')}%</em><label>涨跌幅</label></div>
|
<div style="margin-right:0;"><em class="<#if districtStatBo.districtStat.weekendMarkup/100 gte 0>up<#else>down</#if>"><i></i>${(districtStatBo.districtStat.weekendMarkup/100)?string('0.00')}%</em><label>涨跌幅</label></div>
|
||||||
<#elseif regionStatBo??>
|
<#elseif regionStatBo??>
|
||||||
<div><em>${regionStatBo.lastTimeAvgPrice!}</em><label>上周均价(元/㎡)</label></div>
|
<div><em>${regionStatBo.lastTimeAvgPrice!}</em><label>上月均价(元/㎡)</label></div>
|
||||||
<div><em>${regionStatBo.avgPrice!}</em><label>本周均价(元/㎡)</label></div>
|
<div><em>${regionStatBo.avgPrice!}</em><label>本月均价(元/㎡)</label></div>
|
||||||
<div style="margin-right:0;"><em class="<#if regionStatBo.weekendMarkup gte 0>up<#else>down</#if>"><i></i>${(regionStatBo.weekendMarkup/100)?string('0.00')}%</em><label>涨跌幅</label></div>
|
<div style="margin-right:0;"><em class="<#if regionStatBo.weekendMarkup gte 0>up<#else>down</#if>"><i></i>${(regionStatBo.weekendMarkup/100)?string('0.00')}%</em><label>涨跌幅</label></div>
|
||||||
</#if>
|
</#if>
|
||||||
</#if>
|
</#if>
|
||||||
|
|||||||
@@ -2,9 +2,16 @@ package com.fangjia.dal.mongo.dao;
|
|||||||
|
|
||||||
import com.fangjia.dal.MongoDao;
|
import com.fangjia.dal.MongoDao;
|
||||||
import com.fangjia.dal.mongo.model.CitySellStat;
|
import com.fangjia.dal.mongo.model.CitySellStat;
|
||||||
|
import com.fangjia.dal.mongo.model.RegionStat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by hubingliang on 2016/12/8.
|
* Created by hubingliang on 2016/12/8.
|
||||||
*/
|
*/
|
||||||
public interface CitySellStatDao extends MongoDao<CitySellStat> {
|
public interface CitySellStatDao extends MongoDao<CitySellStat> {
|
||||||
|
|
||||||
|
List<CitySellStat> findCitySellStat(String city, Integer startDate, Integer endDate);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,33 @@
|
|||||||
package com.fangjia.dal.mongo.dao;
|
package com.fangjia.dal.mongo.dao;
|
||||||
|
|
||||||
import com.fangjia.dal.MongoDaoImpl;
|
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.CitySellStat;
|
||||||
|
import com.fangjia.dal.mongo.model.RegionStat;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by hubingliang on 2016/12/8.
|
* Created by hubingliang on 2016/12/8.
|
||||||
*/
|
*/
|
||||||
public class CitySellStatDaoImpl extends MongoDaoImpl<CitySellStat> implements CitySellStatDao {
|
public class CitySellStatDaoImpl extends MongoDaoImpl<CitySellStat> implements CitySellStatDao {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CitySellStat> findCitySellStat(String city, Integer startDate, Integer endDate) {
|
||||||
|
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||||
|
params.add(new QueryParam("city", city));
|
||||||
|
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<CitySellStat> statList = findAllByParams(params, sortParms);
|
||||||
|
return statList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
package com.fangjia.dal.mongo.dao;
|
package com.fangjia.dal.mongo.dao;
|
||||||
|
|
||||||
import com.fangjia.dal.MongoDao;
|
import com.fangjia.dal.MongoDao;
|
||||||
|
import com.fangjia.dal.mongo.model.CitySellStat;
|
||||||
import com.fangjia.dal.mongo.model.RegionSellStat;
|
import com.fangjia.dal.mongo.model.RegionSellStat;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface RegionSellStatDao extends MongoDao<RegionSellStat> {
|
public interface RegionSellStatDao extends MongoDao<RegionSellStat> {
|
||||||
|
|
||||||
|
List<RegionSellStat> findRegionSellStat(String city, String region, Integer startDate, Integer endDate);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+22
@@ -1,9 +1,31 @@
|
|||||||
package com.fangjia.dal.mongo.dao;
|
package com.fangjia.dal.mongo.dao;
|
||||||
|
|
||||||
import com.fangjia.dal.MongoDaoImpl;
|
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 com.fangjia.dal.mongo.model.RegionSellStat;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class RegionSellStatDaoImpl extends MongoDaoImpl<RegionSellStat>
|
public class RegionSellStatDaoImpl extends MongoDaoImpl<RegionSellStat>
|
||||||
implements RegionSellStatDao {
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+31
-47
@@ -452,18 +452,18 @@ public class CityController {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Object avgPrice2Action(@Param(name = "city") String city, @Param(name = "periodCount") Integer periodCount,@Param(name = "periodType") String periodType) {
|
public Object avgPrice2Action(@Param(name = "city") String city, @Param(name = "periodCount") Integer periodCount) {
|
||||||
RestfulModelAndView mav = new RestfulModelAndView();
|
RestfulModelAndView mav = new RestfulModelAndView();
|
||||||
mav.setViewType("rest");
|
mav.setViewType("rest");
|
||||||
if (StringUtils.isBlank(city)) {
|
if (StringUtils.isBlank(city)) {
|
||||||
mav.setModel(BasicModel.buildBadRequestModel("city不能为null"));
|
mav.setModel(BasicModel.buildBadRequestModel("city不能为null"));
|
||||||
return mav;
|
return mav;
|
||||||
}
|
}
|
||||||
if(!RegionData.isCity(city)){
|
if (!RegionData.isCity(city)) {
|
||||||
String formatCity = RegionData.formatCity(city);
|
String formatCity = RegionData.formatCity(city);
|
||||||
if(StringUtils.isNotBlank(formatCity)){
|
if (StringUtils.isNotBlank(formatCity)) {
|
||||||
city = formatCity;
|
city = formatCity;
|
||||||
}else{
|
} else {
|
||||||
mav.setModel(BasicModel.buildBadRequestModel("city非法"));
|
mav.setModel(BasicModel.buildBadRequestModel("city非法"));
|
||||||
return mav;
|
return mav;
|
||||||
}
|
}
|
||||||
@@ -473,57 +473,41 @@ public class CityController {
|
|||||||
mav.setModel(BasicModel.buildBadRequestModel("city非法"));
|
mav.setModel(BasicModel.buildBadRequestModel("city非法"));
|
||||||
return mav;
|
return mav;
|
||||||
}
|
}
|
||||||
if(null == periodCount || 0 == periodCount){
|
if (null == periodCount || 0 == periodCount) {
|
||||||
periodCount = 1;
|
periodCount = 1;
|
||||||
}
|
}
|
||||||
if(periodCount < 1 || periodCount>156){
|
if (periodCount < 1 || periodCount > 36) {
|
||||||
mav.setModel(BasicModel.buildBadRequestModel("periodCount值不合法,取值范围是:[1-156]"));
|
mav.setModel(BasicModel.buildBadRequestModel("periodCount值不合法,取值范围是:[1-36]"));
|
||||||
return mav;
|
return mav;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(StringUtils.isBlank(periodType)){
|
Calendar calendar = Calendar.getInstance();
|
||||||
periodType = "weekly";
|
calendar.add(Calendar.MONTH, -periodCount);
|
||||||
}else{
|
|
||||||
if(!"weekly".equals(periodType) && !"monthly".equals(periodType)){
|
|
||||||
mav.setModel(BasicModel.buildBadRequestModel("periodModel值非法,合法值为:weekly,monthly"));
|
|
||||||
return mav;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Calendar calendar = Calendar.getInstance();
|
int year = calendar.get(Calendar.YEAR);
|
||||||
if("weekly".equals(periodType)){
|
int month = calendar.get(Calendar.MONTH) + 1; // 注意:月份从 0 开始,需要加 1
|
||||||
calendar.add(Calendar.DATE, -periodCount*7);
|
int montyInt = year * 100 + month;
|
||||||
}else{
|
List<CitySellStat> cityStats = citySellStatService.findNearCityStat(city, montyInt, periodCount);
|
||||||
calendar.add(Calendar.MONTH, -periodCount);
|
if (CollectionUtils.isEmpty(cityStats)) {
|
||||||
}
|
|
||||||
|
|
||||||
List<RegionStat> regionStats = regionStatService.findRegionBlockStat(city,null,null,calendar.getTime(),new Date(),periodType);
|
|
||||||
|
|
||||||
if (CollectionUtils.isEmpty(regionStats)) {
|
|
||||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "该城市没有均价数据"));
|
mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "该城市没有均价数据"));
|
||||||
return mav;
|
return mav;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(regionStats.size() > periodCount){
|
if (cityStats.size() > periodCount) {
|
||||||
regionStats = regionStats.subList(regionStats.size() - periodCount,regionStats.size());
|
cityStats = cityStats.subList(cityStats.size() - periodCount, cityStats.size());
|
||||||
}
|
}
|
||||||
List<Map<String,Object>> result = new ArrayList<Map<String,Object>>(periodCount);
|
List<Map<String, Object>> result = new ArrayList<Map<String, Object>>(periodCount);
|
||||||
for (RegionStat regionStat : regionStats) {
|
for (CitySellStat cityStat : cityStats) {
|
||||||
Map<String,Object> item = new LinkedHashMap<String,Object>();
|
Map<String, Object> item = new LinkedHashMap<String, Object>();
|
||||||
item.put("city", regionStat.getCity());
|
item.put("city", cityStat.getCity());
|
||||||
item.put("avgPrice", String.valueOf(regionStat.getAvgPrice()));
|
item.put("avgPrice", String.valueOf(cityStat.getAvgPrice()));
|
||||||
if("monthly".equals(periodType)){
|
item.put("date", cityStat.getDate() / 100 + "-" + String.format("%02d", cityStat.getDate() % 100));
|
||||||
item.put("date", DateUtil.formatByPattern(regionStat.getWeekend(), "yyyy-MM"));
|
item.put("changePercent", String.format("%.2f", cityStat.getMom() * 100));
|
||||||
}else{
|
result.add(item);
|
||||||
item.put("date", DateUtil.formatByPattern(regionStat.getWeekend(), "yyyy-MM-dd"));
|
}
|
||||||
}
|
mav.setModel(BasicModel.buildOKModel().setResult(result));
|
||||||
item.put("changePercent", String.valueOf(regionStat.getMarkup() / 100d));
|
|
||||||
result.add(item);
|
|
||||||
}
|
|
||||||
mav.setModel(BasicModel.buildOKModel().setResult(result));
|
|
||||||
return mav;
|
return mav;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 城市均价范围Action
|
* 城市均价范围Action
|
||||||
*
|
*
|
||||||
|
|||||||
+27
-35
@@ -17,10 +17,8 @@ import com.fangjia.service.datastore.RegionStatService;
|
|||||||
import com.fangjia.service.district.DistrictFacilitysService;
|
import com.fangjia.service.district.DistrictFacilitysService;
|
||||||
import com.fangjia.service.district.DistrictStatRentService;
|
import com.fangjia.service.district.DistrictStatRentService;
|
||||||
import com.fangjia.service.district.RegionStatRentService;
|
import com.fangjia.service.district.RegionStatRentService;
|
||||||
import com.fangjia.service.mongo.fangjia.AverageAnalyService;
|
import com.fangjia.service.mongo.fangjia.*;
|
||||||
import com.fangjia.service.mongo.fangjia.RegionBlockService;
|
|
||||||
|
|
||||||
import com.fangjia.service.mongo.fangjia.SeaweedImagesService;
|
|
||||||
import net.sf.json.JSONArray;
|
import net.sf.json.JSONArray;
|
||||||
import net.sf.json.JSONException;
|
import net.sf.json.JSONException;
|
||||||
import net.sf.json.JSONObject;
|
import net.sf.json.JSONObject;
|
||||||
@@ -69,7 +67,6 @@ import com.fangjia.service.index.BoostQueryPolicy;
|
|||||||
import com.fangjia.service.menu.Menu;
|
import com.fangjia.service.menu.Menu;
|
||||||
import com.fangjia.service.menu.MenuCategoryEnum;
|
import com.fangjia.service.menu.MenuCategoryEnum;
|
||||||
import com.fangjia.service.mongo.bkoff.ExtractDistrictService;
|
import com.fangjia.service.mongo.bkoff.ExtractDistrictService;
|
||||||
import com.fangjia.service.mongo.fangjia.DistrictHouseService;
|
|
||||||
import com.fangjia.service.open.DistrictBo;
|
import com.fangjia.service.open.DistrictBo;
|
||||||
import com.fangjia.service.sql.ApiUserService;
|
import com.fangjia.service.sql.ApiUserService;
|
||||||
import com.fangjia.service.web.MenuService;
|
import com.fangjia.service.web.MenuService;
|
||||||
@@ -94,6 +91,7 @@ public class DistrictController {
|
|||||||
private RegionStatRentService regionStatRentService;
|
private RegionStatRentService regionStatRentService;
|
||||||
private DistrictFacilitysService districtFacilitysService;
|
private DistrictFacilitysService districtFacilitysService;
|
||||||
private SeaweedImagesService seaweedImagesService;
|
private SeaweedImagesService seaweedImagesService;
|
||||||
|
private RegionStatTrendService regionStatTrendService;
|
||||||
|
|
||||||
|
|
||||||
public static final String[] COLUMNS = {"id", "name", "estateType", "buildType", "licence", "buildArea", "allArea",
|
public static final String[] COLUMNS = {"id", "name", "estateType", "buildType", "licence", "buildArea", "allArea",
|
||||||
@@ -692,42 +690,30 @@ public class DistrictController {
|
|||||||
if (model.getPeriodCount() == null) {
|
if (model.getPeriodCount() == null) {
|
||||||
model.setPeriodCount(1);
|
model.setPeriodCount(1);
|
||||||
}
|
}
|
||||||
if (model.getPeriodCount() < 1 || model.getPeriodCount() > 156) {
|
if (model.getPeriodCount() < 1 || model.getPeriodCount() > 36) {
|
||||||
mav.setModel(BasicModel.buildBadRequestModel("periodCount值不合法,取值范围是:[1-156]"));
|
mav.setModel(BasicModel.buildBadRequestModel("periodCount值不合法,取值范围是:[1-36]"));
|
||||||
return mav;
|
return mav;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StringUtils.isBlank(model.getPeriodType())) {
|
|
||||||
model.setPeriodType("weekly");
|
|
||||||
} else {
|
|
||||||
if (!"weekly".equals(model.getPeriodType()) && !"monthly".equals(model.getPeriodType())) {
|
|
||||||
mav.setModel(BasicModel.buildBadRequestModel("periodModel值非法,合法值为:weekly,monthly"));
|
|
||||||
return mav;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
if ("weekly".equals(model.getPeriodType())) {
|
calendar.add(Calendar.MONTH, -model.getPeriodCount());
|
||||||
calendar.add(Calendar.DATE, -model.getPeriodCount().intValue() * 7);
|
|
||||||
} else {
|
int year = calendar.get(Calendar.YEAR);
|
||||||
calendar.add(Calendar.MONTH, -model.getPeriodCount().intValue());
|
int month = calendar.get(Calendar.MONTH) + 1; // 注意:月份从 0 开始,需要加 1
|
||||||
}
|
int montyInt = year * 100 + month;
|
||||||
List<RegionStat> regionStats = regionStatService.findRegionBlockStat(model.getCity(), model.getDistrict(), null, calendar.getTime(), new Date(), model.getPeriodType());
|
List<RegionStatTrend> datas = regionStatTrendService.getAllWithMonths(model.getCity(), region, model.getPeriodCount());
|
||||||
if (regionStats.size() > model.getPeriodCount()) {
|
|
||||||
regionStats = regionStats.subList(regionStats.size() - model.getPeriodCount(), regionStats.size());
|
if (datas.size() > model.getPeriodCount()) {
|
||||||
|
datas = datas.subList(datas.size() - model.getPeriodCount(), datas.size());
|
||||||
}
|
}
|
||||||
List<Map<String, Object>> result = new ArrayList<Map<String, Object>>(model.getPeriodCount());
|
List<Map<String, Object>> result = new ArrayList<Map<String, Object>>(model.getPeriodCount());
|
||||||
for (RegionStat regionStat : regionStats) {
|
for (RegionStatTrend regionStat : datas) {
|
||||||
Map<String, Object> item = new LinkedHashMap<String, Object>();
|
Map<String, Object> item = new LinkedHashMap<String, Object>();
|
||||||
item.put("city", regionStat.getCity());
|
item.put("city", regionStat.getCity());
|
||||||
item.put("district", regionStat.getRegion());
|
item.put("district", regionStat.getRegion());
|
||||||
item.put("block", regionStat.getBlock());
|
|
||||||
item.put("avgPrice", String.valueOf(regionStat.getAvgPrice()));
|
item.put("avgPrice", String.valueOf(regionStat.getAvgPrice()));
|
||||||
if ("monthly".equals(model.getPeriodType())) {
|
item.put("date", regionStat.getDate() / 100 + "-" + String.format("%02d", regionStat.getDate() % 100));
|
||||||
item.put("date", DateUtil.formatByPattern(regionStat.getWeekend(), "yyyy-MM"));
|
item.put("changePercent", String.format("%.2f", regionStat.getMom() * 100));
|
||||||
} else {
|
|
||||||
item.put("date", DateUtil.formatByPattern(regionStat.getWeekend(), "yyyy-MM-dd"));
|
|
||||||
}
|
|
||||||
item.put("changePercent", String.valueOf(regionStat.getMarkup() / 100d));
|
|
||||||
result.add(item);
|
result.add(item);
|
||||||
}
|
}
|
||||||
mav.setModel(BasicModel.buildOKModel().setResult(result));
|
mav.setModel(BasicModel.buildOKModel().setResult(result));
|
||||||
@@ -1186,7 +1172,7 @@ public class DistrictController {
|
|||||||
data.put("bus", model.getBus());
|
data.put("bus", model.getBus());
|
||||||
data.put("bank", model.getBank());
|
data.put("bank", model.getBank());
|
||||||
data.put("atm", model.getAtm());
|
data.put("atm", model.getAtm());
|
||||||
data.put("metro",model.getMetro());
|
data.put("metro", model.getMetro());
|
||||||
districtService.updateDistrictFacilitysById(data, model.getId());
|
districtService.updateDistrictFacilitysById(data, model.getId());
|
||||||
} else {
|
} else {
|
||||||
DistrictFacilitys districtFacilitys = CommonDtoUtils.transformV(DistrictFacilitys.class, model);
|
DistrictFacilitys districtFacilitys = CommonDtoUtils.transformV(DistrictFacilitys.class, model);
|
||||||
@@ -1199,7 +1185,7 @@ public class DistrictController {
|
|||||||
List<String> result = new ArrayList<String>();
|
List<String> result = new ArrayList<String>();
|
||||||
|
|
||||||
if (value != null && !value.isEmpty()) {
|
if (value != null && !value.isEmpty()) {
|
||||||
value = value.replaceAll("\\[", "").replaceAll("]", "").replaceAll(" ","");
|
value = value.replaceAll("\\[", "").replaceAll("]", "").replaceAll(" ", "");
|
||||||
String[] splitValues = value.split(","); // 按逗号分割
|
String[] splitValues = value.split(","); // 按逗号分割
|
||||||
|
|
||||||
// 遍历数组并过滤空字符串
|
// 遍历数组并过滤空字符串
|
||||||
@@ -1285,6 +1271,7 @@ public class DistrictController {
|
|||||||
}
|
}
|
||||||
return mav;
|
return mav;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object deletePicAction(DistrictModel model) {
|
public Object deletePicAction(DistrictModel model) {
|
||||||
RestfulModelAndView mav = new RestfulModelAndView();
|
RestfulModelAndView mav = new RestfulModelAndView();
|
||||||
mav.setViewType("rest");
|
mav.setViewType("rest");
|
||||||
@@ -1292,21 +1279,22 @@ public class DistrictController {
|
|||||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "ID必须输入"));
|
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "ID必须输入"));
|
||||||
return mav;
|
return mav;
|
||||||
}
|
}
|
||||||
seaweedImagesService.deleteImage(model.getId(),model.getUrl(),model.getPicType(), model.getRoomType());
|
seaweedImagesService.deleteImage(model.getId(), model.getUrl(), model.getPicType(), model.getRoomType());
|
||||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.OK, "删除成功"));
|
mav.setModel(new HttpCode(OpenHttpCodeEnum.OK, "删除成功"));
|
||||||
return mav;
|
return mav;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object addPicAction(DistrictModel model) {
|
public Object addPicAction(DistrictModel model) {
|
||||||
RestfulModelAndView mav = new RestfulModelAndView();
|
RestfulModelAndView mav = new RestfulModelAndView();
|
||||||
mav.setViewType("rest");
|
mav.setViewType("rest");
|
||||||
if (model.getImageUrls()!=null){
|
if (model.getImageUrls() != null) {
|
||||||
model.setImageUrls(convertToList(model.getImageUrls().toString()));
|
model.setImageUrls(convertToList(model.getImageUrls().toString()));
|
||||||
}
|
}
|
||||||
if (StringUtils.isBlank(model.getId())) {
|
if (StringUtils.isBlank(model.getId())) {
|
||||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "ID必须输入"));
|
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "ID必须输入"));
|
||||||
return mav;
|
return mav;
|
||||||
}
|
}
|
||||||
seaweedImagesService.addImage(model.getId(),model.getImageUrls(),model.getPicType(), model.getRoomType());
|
seaweedImagesService.addImage(model.getId(), model.getImageUrls(), model.getPicType(), model.getRoomType());
|
||||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.OK, "添加成功"));
|
mav.setModel(new HttpCode(OpenHttpCodeEnum.OK, "添加成功"));
|
||||||
return mav;
|
return mav;
|
||||||
}
|
}
|
||||||
@@ -1435,4 +1423,8 @@ public class DistrictController {
|
|||||||
public void setSeaweedImagesService(SeaweedImagesService seaweedImagesService) {
|
public void setSeaweedImagesService(SeaweedImagesService seaweedImagesService) {
|
||||||
this.seaweedImagesService = seaweedImagesService;
|
this.seaweedImagesService = seaweedImagesService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setRegionStatTrendService(RegionStatTrendService regionStatTrendService) {
|
||||||
|
this.regionStatTrendService = regionStatTrendService;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1017,6 +1017,10 @@ public class HouseController {
|
|||||||
} else {
|
} else {
|
||||||
pager.setPageSize(5);
|
pager.setPageSize(5);
|
||||||
}
|
}
|
||||||
|
if (model.getPrice() != null) {
|
||||||
|
query.setStartPrice((int) (model.getPrice() * 0.9));
|
||||||
|
query.setEndPrice((int) (model.getPrice() * 1.1));
|
||||||
|
}
|
||||||
query.setPager(pager);
|
query.setPager(pager);
|
||||||
query.setSortField("p_date");
|
query.setSortField("p_date");
|
||||||
query.setOrder(false);
|
query.setOrder(false);
|
||||||
|
|||||||
+3
-1
@@ -107,7 +107,9 @@ public class DistrictController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<QueryParam> params = new ArrayList<QueryParam>();
|
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||||
params.add(new QueryParam("city", city));
|
if (StringUtils.isNotBlank(city)) {
|
||||||
|
params.add(new QueryParam("city", city));
|
||||||
|
}
|
||||||
params.add(new QueryParam("category", cat));
|
params.add(new QueryParam("category", cat));
|
||||||
params.add(new QueryParam("visible", 0));
|
params.add(new QueryParam("visible", 0));
|
||||||
params.add(new QueryParam("$srByStr", String.format("keyword:%s^6.0 OR keyword_cjk:%s", keyword, keyword)));
|
params.add(new QueryParam("$srByStr", String.format("keyword:%s^6.0 OR keyword_cjk:%s", keyword, keyword)));
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ public class HouseSearchModel extends SearchModel {
|
|||||||
private String cat;
|
private String cat;
|
||||||
|
|
||||||
private Integer pageSize;
|
private Integer pageSize;
|
||||||
|
|
||||||
|
private Double price;
|
||||||
@Override
|
@Override
|
||||||
public QueryBean getQueryBean() {
|
public QueryBean getQueryBean() {
|
||||||
HouseQueryBean queryBean = new HouseQueryBean();
|
HouseQueryBean queryBean = new HouseQueryBean();
|
||||||
@@ -209,4 +211,12 @@ public class HouseSearchModel extends SearchModel {
|
|||||||
public void setPageSize(Integer pageSize) {
|
public void setPageSize(Integer pageSize) {
|
||||||
this.pageSize = pageSize;
|
this.pageSize = pageSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Double getPrice() {
|
||||||
|
return price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrice(Double price) {
|
||||||
|
this.price = price;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-3
@@ -37,7 +37,9 @@ class SynchAdministrativeMappingDataBatch extends BaseBatch{
|
|||||||
//删除旧的,再同步新的
|
//删除旧的,再同步新的
|
||||||
ADMINISTRATIVE_MAPPING_COLL_100.remove(new BasicDBObject())
|
ADMINISTRATIVE_MAPPING_COLL_100.remove(new BasicDBObject())
|
||||||
|
|
||||||
def dbcursor = ADMINISTRATIVE_MAPPING_COLL.find(new BasicDBObject()).batchSize(1000)
|
def q = new BasicDBObject()
|
||||||
|
// q.put("shape.type","MultiPolygon")
|
||||||
|
def dbcursor = ADMINISTRATIVE_MAPPING_COLL.find(q).batchSize(1000)
|
||||||
def datas = []
|
def datas = []
|
||||||
def retMap = [:]
|
def retMap = [:]
|
||||||
for(def d : dbcursor){
|
for(def d : dbcursor){
|
||||||
@@ -59,6 +61,7 @@ class SynchAdministrativeMappingDataBatch extends BaseBatch{
|
|||||||
|
|
||||||
def synchToEs(retMap, host, indexName){
|
def synchToEs(retMap, host, indexName){
|
||||||
QueryBuilder queryBuilder = QueryBuilders.boolQuery()
|
QueryBuilder queryBuilder = QueryBuilders.boolQuery()
|
||||||
|
// queryBuilder.must(QueryBuilders.termQuery("street", "¿¦ÀÂê¸ÇÕò"))
|
||||||
def oldIds = new CopyOnWriteArrayList()
|
def oldIds = new CopyOnWriteArrayList()
|
||||||
|
|
||||||
ElasticUtils89.queryUpdate(host, indexName, queryBuilder, { String id, doc->
|
ElasticUtils89.queryUpdate(host, indexName, queryBuilder, { String id, doc->
|
||||||
@@ -69,11 +72,11 @@ class SynchAdministrativeMappingDataBatch extends BaseBatch{
|
|||||||
if(!["id","_id","c_date","m_date","polyline_source","operator","city_simple_pinyin","prefecture_level_city"].contains(k)){
|
if(!["id","_id","c_date","m_date","polyline_source","operator","city_simple_pinyin","prefecture_level_city"].contains(k)){
|
||||||
def val = doc.get(k)
|
def val = doc.get(k)
|
||||||
if(val!=v){
|
if(val!=v){
|
||||||
if(k!="shape" || (k=="shape" && v.type!="MultiPolygon")){
|
// if(k!="shape" || (k=="shape" && v.type!="MultiPolygon")){
|
||||||
println k +" 修改 "+id
|
println k +" 修改 "+id
|
||||||
updateFieldCount++
|
updateFieldCount++
|
||||||
doc.put(k,v)
|
doc.put(k,v)
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -35,7 +35,8 @@ class SynchDevDataBatch extends BaseBatch{
|
|||||||
}
|
}
|
||||||
|
|
||||||
def synchDevTo100(){
|
def synchDevTo100(){
|
||||||
def dbcursor = DEVELOPMENT_ZONE_43_COLL.find()
|
def q = new BasicDBObject()
|
||||||
|
def dbcursor = DEVELOPMENT_ZONE_43_COLL.find(q)
|
||||||
def rets = []
|
def rets = []
|
||||||
def devMap = [:]
|
def devMap = [:]
|
||||||
for(def r : dbcursor){
|
for(def r : dbcursor){
|
||||||
@@ -87,7 +88,7 @@ class SynchDevDataBatch extends BaseBatch{
|
|||||||
QueryBuilder queryBuilder = QueryBuilders.boolQuery()
|
QueryBuilder queryBuilder = QueryBuilders.boolQuery()
|
||||||
def oldIds = new CopyOnWriteArrayList()
|
def oldIds = new CopyOnWriteArrayList()
|
||||||
|
|
||||||
ElasticUtils89.executeQuery(host, indexName, queryBuilder, { String id, doc->
|
ElasticUtils89.queryUpdate(host, indexName, queryBuilder, { String id, doc->
|
||||||
oldIds << id
|
oldIds << id
|
||||||
def mongoObj = devMap.get(id)
|
def mongoObj = devMap.get(id)
|
||||||
def updateFieldCount = 0
|
def updateFieldCount = 0
|
||||||
|
|||||||
+1
-1
@@ -343,7 +343,7 @@ class SeaweedDataSynch extends BaseBatch{
|
|||||||
map.region = distData.district
|
map.region = distData.district
|
||||||
area_code = distData.mca_district_code
|
area_code = distData.mca_district_code
|
||||||
}else{
|
}else{
|
||||||
if(["东莞市","中山市","济源市","仙桃市","潜江市","天门市","神农架林区","五指山市","琼海市","文昌市","万宁市","东方市","定安县","屯昌县","澄迈县","临高县","白沙黎族自治县","昌江黎族自治县","乐东黎族自治县","陵水黎族自治县","保亭黎族苗族自治县","琼中黎族苗族自治县","五指山市","琼海市","文昌市","万宁市","东方市","定安县","屯昌县","澄迈县","临高县","白沙黎族自治县","昌江黎族自治县","乐东黎族自治县","陵水黎族自治县","保亭黎族苗族自治县","琼中黎族苗族自治县","石河子市","阿拉尔市","图木舒克市","五家渠市","北屯市","铁门关市","双河市","可克达拉市","昆玉市","胡杨河市","新星市","白杨市","嘉峪关市"].contains(map.city)){
|
if(["东莞市","中山市","济源市","仙桃市","潜江市","天门市","神农架林区","五指山市","琼海市","文昌市","万宁市","东方市","定安县","屯昌县","澄迈县","临高县","白沙黎族自治县","昌江黎族自治县","乐东黎族自治县","陵水黎族自治县","保亭黎族苗族自治县","琼中黎族苗族自治县","五指山市","琼海市","文昌市","万宁市","东方市","定安县","屯昌县","澄迈县","临高县","白沙黎族自治县","昌江黎族自治县","乐东黎族自治县","陵水黎族自治县","保亭黎族苗族自治县","琼中黎族苗族自治县","石河子市","阿拉尔市","图木舒克市","五家渠市","北屯市","铁门关市","双河市","可克达拉市","昆玉市","胡杨河市","新星市","白杨市","嘉峪关市","儋州市"].contains(map.city)){
|
||||||
map.region = map.city
|
map.region = map.city
|
||||||
}
|
}
|
||||||
// map.region = dist.region
|
// map.region = dist.region
|
||||||
|
|||||||
+22
@@ -30,6 +30,28 @@ class DingDingMessageUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void sendTextMessageAndAt(String access_token, String msg, String atMobile) throws Exception {
|
||||||
|
HttpRequest request = new HttpRequest();
|
||||||
|
HttpPost httppost = new HttpPost("https://oapi.dingtalk.com/robot/send?access_token=" + access_token);
|
||||||
|
httppost.addHeader("Content-Type", "application/json; charset=utf-8");
|
||||||
|
|
||||||
|
// 创建消息体,只包含一个手机号
|
||||||
|
String textMsg = "{ " +
|
||||||
|
"\"msgtype\": \"text\", " +
|
||||||
|
"\"text\": {\"content\": \"" + msg + "\"}, " +
|
||||||
|
"\"at\": {\"atMobiles\": [\"" + atMobile + "\"]}" + // 只 @ 一个手机号
|
||||||
|
"}";
|
||||||
|
|
||||||
|
StringEntity se = new StringEntity(textMsg, "utf-8");
|
||||||
|
httppost.setEntity(se);
|
||||||
|
HttpResponse response = request.getHttpClient().execute(httppost);
|
||||||
|
|
||||||
|
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
|
||||||
|
String result = EntityUtils.toString(response.getEntity(), "utf-8");
|
||||||
|
System.out.println("消息发送结果:" + result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void sendMarkdownMessage(String access_token, String title, String msg){
|
static void sendMarkdownMessage(String access_token, String title, String msg){
|
||||||
HttpRequest request = new HttpRequest()
|
HttpRequest request = new HttpRequest()
|
||||||
JSONObject requestBody = new JSONObject()
|
JSONObject requestBody = new JSONObject()
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+16
@@ -2,7 +2,9 @@ package com.fangjia.service.datastore;
|
|||||||
|
|
||||||
import com.fangjia.dal.mongo.model.CitySellStat;
|
import com.fangjia.dal.mongo.model.CitySellStat;
|
||||||
import com.fangjia.dal.mongo.model.DistrictSellStat;
|
import com.fangjia.dal.mongo.model.DistrictSellStat;
|
||||||
|
import com.fangjia.dal.mongo.model.RegionStat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,4 +34,18 @@ public interface CitySellStatService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
CitySellStat findCitySellStatByCity(String city);
|
CitySellStat findCitySellStatByCity(String city);
|
||||||
|
|
||||||
|
List<CitySellStat> findNearCityStat(String city, Integer startDate, int count);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询均价开始的最早时间
|
||||||
|
* @param city
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
CitySellStat findStartStat(String city);
|
||||||
|
|
||||||
|
List<CitySellStat> findCityOrderByAvgPrice(final String city, final Integer startDate, final int count) ;
|
||||||
|
|
||||||
|
List<CitySellStat> findCitySellStat(String city, Integer startDate, Integer endDate);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+60
-7
@@ -1,12 +1,6 @@
|
|||||||
package com.fangjia.service.datastore;
|
package com.fangjia.service.datastore;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
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 com.fangjia.core.util.CacheUtils;
|
import com.fangjia.core.util.CacheUtils;
|
||||||
import com.fangjia.core.util.DateUtil;
|
import com.fangjia.core.util.DateUtil;
|
||||||
@@ -16,9 +10,12 @@ import com.fangjia.dal.SortParam;
|
|||||||
import com.fangjia.dal.common.DistrictKey;
|
import com.fangjia.dal.common.DistrictKey;
|
||||||
import com.fangjia.dal.mongo.dao.CitySellStatDao;
|
import com.fangjia.dal.mongo.dao.CitySellStatDao;
|
||||||
import com.fangjia.dal.mongo.model.CitySellStat;
|
import com.fangjia.dal.mongo.model.CitySellStat;
|
||||||
|
import com.fangjia.dal.mongo.model.RegionStat;
|
||||||
|
import com.fangjia.dal.mongo.model.StatFlag;
|
||||||
import com.fangjia.service.bo.DistrictStatBo;
|
import com.fangjia.service.bo.DistrictStatBo;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.sothis.core.util.Closure;
|
import org.sothis.core.util.Closure;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -108,4 +105,60 @@ public class CitySellStatServiceImpl implements CitySellStatService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CitySellStat> findNearCityStat(final String city, final Integer startDate, final int count) {
|
||||||
|
return CacheUtils.getValue(this.getClass(), "findNearCityStat",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);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@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);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CitySellStat> findCitySellStat(final String city, final Integer startDate, final Integer endDate) {
|
||||||
|
return CacheUtils.getValue(this.getClass(), city, String.valueOf(endDate + startDate),
|
||||||
|
CachePolicyEnum.MIDDLE, new Closure<List<CitySellStat>, String>() {
|
||||||
|
public List<CitySellStat> execute(String input) {
|
||||||
|
return citySellStatDao.findCitySellStat(city, startDate, endDate);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-4
@@ -187,7 +187,7 @@ public class CzbankSampleServiceImpl implements CzbankSampleService {
|
|||||||
BooleanQuery nameQuery = new BooleanQuery();
|
BooleanQuery nameQuery = new BooleanQuery();
|
||||||
int c = 0;
|
int c = 0;
|
||||||
for (String n : names) {
|
for (String n : names) {
|
||||||
if (StringUtils.isNotBlank(name)) {
|
if (StringUtils.isNotBlank(n)) {
|
||||||
if (name.indexOf("£¨") > -1 || name.indexOf("£©") > -1 || name.indexOf("(") > -1 || name.indexOf(")") > -1
|
if (name.indexOf("£¨") > -1 || name.indexOf("£©") > -1 || name.indexOf("(") > -1 || name.indexOf(")") > -1
|
||||||
| name.indexOf("[") > -1 || name.indexOf("]") > -1 || name.indexOf("-") > -1 || name.indexOf("{") > -1
|
| name.indexOf("[") > -1 || name.indexOf("]") > -1 || name.indexOf("-") > -1 || name.indexOf("{") > -1
|
||||||
|| name.indexOf("}") > -1 || name.indexOf("{") > -1 || name.indexOf("}") > -1 || name.indexOf(":") > -1) {
|
|| name.indexOf("}") > -1 || name.indexOf("{") > -1 || name.indexOf("}") > -1 || name.indexOf(":") > -1) {
|
||||||
@@ -200,9 +200,11 @@ public class CzbankSampleServiceImpl implements CzbankSampleService {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BooleanQuery srQuery = new BooleanQuery();
|
if (!nameQuery.clauses().isEmpty()) {
|
||||||
srQuery.add(nameQuery, BooleanClause.Occur.MUST);
|
BooleanQuery srQuery = new BooleanQuery();
|
||||||
houseQuery.add(new QueryParam("$sr", new SrQuery(srQuery)));
|
srQuery.add(nameQuery, BooleanClause.Occur.MUST);
|
||||||
|
houseQuery.add(new QueryParam("$sr", new SrQuery(srQuery)));
|
||||||
|
}
|
||||||
List<SortParam> houseSortParams = new ArrayList<SortParam>();
|
List<SortParam> houseSortParams = new ArrayList<SortParam>();
|
||||||
houseSortParams.add(new SortParam("publishDate", false));
|
houseSortParams.add(new SortParam("publishDate", false));
|
||||||
houseQuery.add(new QueryParam("category", "shop_sell"));
|
houseQuery.add(new QueryParam("category", "shop_sell"));
|
||||||
|
|||||||
+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 {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+27
-3
@@ -1,14 +1,38 @@
|
|||||||
package com.fangjia.service.mongo.fangjia;
|
package com.fangjia.service.mongo.fangjia;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.fangjia.dal.mongo.model.CitySellStat;
|
||||||
import com.fangjia.dal.mongo.model.RegionSellStat;
|
import com.fangjia.dal.mongo.model.RegionSellStat;
|
||||||
|
import com.fangjia.dal.mongo.model.RegionStat;
|
||||||
|
|
||||||
public interface RegionSellStatService {
|
public interface RegionSellStatService {
|
||||||
|
|
||||||
RegionSellStat findNewestRegionPrice();
|
/**
|
||||||
|
* 获取过去 monCount 个月的数据(不包含本月数据)
|
||||||
|
* @param city
|
||||||
|
* @param region
|
||||||
|
* @param monthCount
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<RegionSellStat> getAllWithMonths(String city, String region, int monthCount);
|
||||||
|
|
||||||
List<RegionSellStat> findAllRegionPriceByCity(String city, Integer date, String sortField, Boolean sortWay);
|
List<RegionSellStat> findNearCityStat(String city, final String region, Integer startDate, int count);
|
||||||
|
|
||||||
RegionSellStat findNewestRegionPrice(String city, String region);
|
/**
|
||||||
|
* 查询均价开始的最早时间
|
||||||
|
* @param city
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
RegionSellStat findStartStat(String city, final String region);
|
||||||
|
|
||||||
|
RegionSellStat findNewestRegionPrice();
|
||||||
|
|
||||||
|
List<RegionSellStat> findAllRegionPriceByCity(String city, Integer date, String sortField, Boolean sortWay);
|
||||||
|
|
||||||
|
RegionSellStat findNewestRegionPrice(String city, String region);
|
||||||
|
|
||||||
|
|
||||||
|
List<RegionSellStat> findRegionSellStat(final String city, final String region, final Integer startDate, final Integer endDate);
|
||||||
}
|
}
|
||||||
|
|||||||
+110
-38
@@ -1,65 +1,137 @@
|
|||||||
package com.fangjia.service.mongo.fangjia;
|
package com.fangjia.service.mongo.fangjia;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.fangjia.core.util.CacheUtils;
|
||||||
|
import com.fangjia.core.util.DateUtil;
|
||||||
|
import com.fangjia.dal.mongo.model.*;
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
import com.fangjia.dal.QueryParam;
|
import com.fangjia.dal.QueryParam;
|
||||||
import com.fangjia.dal.SortParam;
|
import com.fangjia.dal.SortParam;
|
||||||
import com.fangjia.dal.mongo.dao.RegionSellStatDao;
|
import com.fangjia.dal.mongo.dao.RegionSellStatDao;
|
||||||
import com.fangjia.dal.mongo.model.RegionSellStat;
|
import com.fangjia.dal.mongo.model.RegionSellStat;
|
||||||
|
import org.sothis.core.util.Closure;
|
||||||
|
|
||||||
public class RegionSellStatServiceImpl implements RegionSellStatService {
|
public class RegionSellStatServiceImpl implements RegionSellStatService {
|
||||||
|
|
||||||
private RegionSellStatDao regionSellStatDao;
|
private RegionSellStatDao regionSellStatDao;
|
||||||
|
|
||||||
public RegionSellStatDao getRegionSellStatDao() {
|
@Override
|
||||||
return regionSellStatDao;
|
public RegionSellStat findNewestRegionPrice() {
|
||||||
}
|
List<SortParam> sortParams = new ArrayList<SortParam>();
|
||||||
|
sortParams.add(new SortParam("date", false));
|
||||||
|
return regionSellStatDao.findFirstByParams(null, sortParams);
|
||||||
|
}
|
||||||
|
|
||||||
public void setRegionSellStatDao(RegionSellStatDao regionSellStatDao) {
|
@Override
|
||||||
this.regionSellStatDao = regionSellStatDao;
|
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));
|
||||||
|
|
||||||
@Override
|
List<SortParam> sortParams = new ArrayList<SortParam>();
|
||||||
public RegionSellStat findNewestRegionPrice() {
|
if(StringUtils.isNotBlank(sortField)){
|
||||||
List<SortParam> sortParams = new ArrayList<SortParam>();
|
sortParams.add(new SortParam(sortField, sortWay));
|
||||||
sortParams.add(new SortParam("date", false));
|
}else{
|
||||||
return regionSellStatDao.findFirstByParams(null, sortParams);
|
sortParams.add(new SortParam("mom", false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@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);
|
return regionSellStatDao.findAllByParams(params, sortParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RegionSellStat findNewestRegionPrice(String city, String region) {
|
public RegionSellStat findNewestRegionPrice(String city, String region) {
|
||||||
List<QueryParam> params = new ArrayList<QueryParam>();
|
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||||
params.add(new QueryParam("city", city));
|
params.add(new QueryParam("city", city));
|
||||||
params.add(new QueryParam("region", region));
|
params.add(new QueryParam("region", region));
|
||||||
|
|
||||||
List<SortParam> sortParams = new ArrayList<SortParam>();
|
List<SortParam> sortParams = new ArrayList<SortParam>();
|
||||||
sortParams.add(new SortParam("date", false));
|
sortParams.add(new SortParam("date", false));
|
||||||
return regionSellStatDao.findFirstByParams(params, sortParams);
|
return regionSellStatDao.findFirstByParams(params, sortParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<RegionSellStat> getAllWithMonths(final String city, final String region, final int monthCount) {
|
||||||
|
return CacheUtils.getValue(this.getClass(), "getAllWithMonths",city+"_"+monthCount, CacheUtils.CachePolicyEnum.LONG,
|
||||||
|
new Closure<List<RegionSellStat>, String>() {
|
||||||
|
@Override
|
||||||
|
public List<RegionSellStat> execute(String input) {
|
||||||
|
System.out.println("getAllWithMonths");
|
||||||
|
Date now = new Date();
|
||||||
|
Date lastMonth = DateUtil.getBeforeDate(now, -1);
|
||||||
|
Date monthInLastYear = DateUtil.getBeforeDate(now, -1 * monthCount);
|
||||||
|
int lastMonthNum = DateUtil.getYear(lastMonth) * 100 + DateUtil.getMonth(lastMonth);
|
||||||
|
int monthInLastYearNum = DateUtil.getYear(monthInLastYear) * 100 + DateUtil.getMonth(monthInLastYear);
|
||||||
|
|
||||||
|
List<QueryParam> queryParams = ImmutableList.of(
|
||||||
|
new QueryParam("city", city),
|
||||||
|
new QueryParam("region", region),
|
||||||
|
new QueryParam("date", QueryParam.LESS_THAN_EQUAL_OPERATOR, lastMonthNum),
|
||||||
|
new QueryParam("date", QueryParam.GREATER_THAN_EQUAL_OPERATOR, monthInLastYearNum)
|
||||||
|
);
|
||||||
|
List<SortParam> sortParams = ImmutableList.of(
|
||||||
|
new SortParam("date", false)
|
||||||
|
);
|
||||||
|
return regionSellStatDao.findAllByParams(queryParams, sortParams);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<RegionSellStat> findNearCityStat(final String city, final String region, final Integer startDate, final int count) {
|
||||||
|
return CacheUtils.getValue(this.getClass(), "findNearRegionStat",city+"_"+startDate, CacheUtils.CachePolicyEnum.LONG,
|
||||||
|
new Closure<List<RegionSellStat>, String>() {
|
||||||
|
@Override
|
||||||
|
public List<RegionSellStat> execute(String input) {
|
||||||
|
List<QueryParam> q = new ArrayList<QueryParam>(5);
|
||||||
|
q.add(new QueryParam("city", city));
|
||||||
|
q.add(new QueryParam("region", region));
|
||||||
|
q.add(new QueryParam("date", QueryParam.GREATER_THAN_EQUAL_OPERATOR, startDate));
|
||||||
|
|
||||||
|
List<SortParam> s = new ArrayList<SortParam>();
|
||||||
|
s.add(new SortParam("date", false));
|
||||||
|
return regionSellStatDao.findAllByParams(q, s, count);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RegionSellStat findStartStat(final String city, final String region) {
|
||||||
|
return CacheUtils.getValue(this.getClass(), "findStartStat",city, CacheUtils.CachePolicyEnum.LONG,
|
||||||
|
new Closure<RegionSellStat, String>() {
|
||||||
|
@Override
|
||||||
|
public RegionSellStat execute(String input) {
|
||||||
|
List<QueryParam> q = new ArrayList<QueryParam>(5);
|
||||||
|
q.add(new QueryParam("city", city));
|
||||||
|
q.add(new QueryParam("region", region));
|
||||||
|
|
||||||
|
List<SortParam> s = new ArrayList<SortParam>();
|
||||||
|
s.add(new SortParam("date", true));
|
||||||
|
return regionSellStatDao.findFirstByParams(q, s);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user