新增接口
This commit is contained in:
+11
@@ -0,0 +1,11 @@
|
||||
package com.fangjia.service.datastore;
|
||||
|
||||
import com.fangjia.dal.mongo.model.BsEvaluation;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public interface BsEvaluationService {
|
||||
|
||||
List<BsEvaluation> getNearlySameEvaluation(String id, Integer minPrice, Integer maxPrice, Date startDate, Date endDate, Integer limit);
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package com.fangjia.service.datastore;
|
||||
|
||||
import com.fangjia.dal.QueryParam;
|
||||
import com.fangjia.dal.SortParam;
|
||||
import com.fangjia.dal.mongo.dao.BsEvaluationDao;
|
||||
import com.fangjia.dal.mongo.dao.EvaluationDao;
|
||||
import com.fangjia.dal.mongo.model.BsEvaluation;
|
||||
import com.fangjia.dal.mongo.model.bkoff.DealPrice;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class BsEvaluationServiceImpl implements BsEvaluationService {
|
||||
|
||||
private BsEvaluationDao bsEvaluationDao;
|
||||
|
||||
public void setBsEvaluationDao(BsEvaluationDao bsEvaluationDao) {
|
||||
this.bsEvaluationDao = bsEvaluationDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BsEvaluation> getNearlySameEvaluation(String id, Integer minPrice, Integer maxPrice, Date startDate, Date endDate, Integer limit) {
|
||||
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||
params.add(new QueryParam("commid", id));
|
||||
if(startDate!=null){
|
||||
params.add(new QueryParam("cDate", QueryParam.GREATER_THAN_EQUAL_OPERATOR, startDate));
|
||||
}
|
||||
if(endDate!=null){
|
||||
params.add(new QueryParam("cDate", QueryParam.LESS_THAN_EQUAL_OPERATOR, startDate));
|
||||
}
|
||||
|
||||
if (minPrice > 0) {
|
||||
params.add(new QueryParam("unitPrice", QueryParam.GREATER_THAN_OPERATOR, minPrice));
|
||||
}
|
||||
if (maxPrice > 0) {
|
||||
params.add(new QueryParam("unitPrice", QueryParam.LESS_THAN_OPERATOR, maxPrice));
|
||||
}
|
||||
List<SortParam> sortParams = new ArrayList<SortParam>();
|
||||
sortParams.add(new SortParam("cDate", false));
|
||||
List<BsEvaluation> bsEvaluations = bsEvaluationDao.findAllByParams(params, sortParams, limit);
|
||||
return bsEvaluations;
|
||||
}
|
||||
}
|
||||
+2
@@ -82,6 +82,8 @@ public interface DealPriceService {
|
||||
|
||||
public List<DealPrice> getNearlySameDealPrice(DistrictKey key, int minPrice, int maxPrice, int radius, int limit);
|
||||
|
||||
public List<DealPrice> getNearlySameDealPrice(String districtId, Integer minPrice, Integer maxPrice,Date startDate, Date endDate, int limit);
|
||||
|
||||
public List<DealPrice> getDisSameDealPrice(DistrictKey key, int minPrice, int maxPrice, int limit);
|
||||
|
||||
/**
|
||||
|
||||
+23
@@ -354,6 +354,29 @@ public class DealPriceServiceImpl implements DealPriceService {
|
||||
return houses;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DealPrice> getNearlySameDealPrice(String districtId, Integer minPrice, Integer maxPrice, Date startDate, Date endDate, int limit) {
|
||||
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||
params.add(new QueryParam("matchId", districtId));
|
||||
if(startDate!=null){
|
||||
params.add(new QueryParam("tradeDate", QueryParam.GREATER_THAN_EQUAL_OPERATOR, startDate));
|
||||
}
|
||||
if(endDate!=null){
|
||||
params.add(new QueryParam("tradeDate", QueryParam.LESS_THAN_EQUAL_OPERATOR, startDate));
|
||||
}
|
||||
|
||||
if (minPrice > 0) {
|
||||
params.add(new QueryParam("avgPrice", QueryParam.GREATER_THAN_OPERATOR, minPrice));
|
||||
}
|
||||
if (maxPrice > 0) {
|
||||
params.add(new QueryParam("avgPrice", QueryParam.LESS_THAN_OPERATOR, maxPrice));
|
||||
}
|
||||
List<SortParam> sortParams = new ArrayList<SortParam>();
|
||||
sortParams.add(new SortParam("tradeDate", false));
|
||||
List<DealPrice> dealPrices = dealPriceDao.findAllByParams(params, sortParams, limit);
|
||||
return dealPrices;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DealPrice> getDisSameDealPrice(DistrictKey key, int minPrice, int maxPrice, int limit) {
|
||||
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||
|
||||
Reference in New Issue
Block a user