Merge branch 'open_bohai' into 'master'
先去掉权限验证,江南行房源接口修改 See merge request !614
This commit is contained in:
+2
-2
@@ -208,7 +208,7 @@ public class HouseController {
|
||||
|
||||
}
|
||||
|
||||
@Authority(role = Role.USER)
|
||||
@Authority(role = Role.NONE)
|
||||
public Object similarAction(@Valid CollateralSampleQuery collateralSampleQuery){
|
||||
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
@@ -253,7 +253,7 @@ public class HouseController {
|
||||
|
||||
|
||||
/**商铺相似房源接口*/
|
||||
@Authority(role = Role.USER)
|
||||
@Authority(role = Role.NONE)
|
||||
public Object shopSimilarAction(@Valid ShopCollateralSampleQuery query){
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
ShopCollateralSampleQueryBean queryBean = new ShopCollateralSampleQueryBean();
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ public class JnBankController {
|
||||
private static final Pattern STAGE_PATTERN = Pattern.compile(".*[\\w东南北中西甲乙丙丁一二三四五六七八九十百千\\d]+(期|区)$");
|
||||
|
||||
|
||||
@Authority(role = Role.USER)
|
||||
@Authority(role = Role.NONE)
|
||||
public Object searchAction(@Valid JNBankSearchModel model){
|
||||
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
|
||||
+106
-9
@@ -1,9 +1,6 @@
|
||||
package com.fangjia.service.datastore;
|
||||
|
||||
import com.fangjia.core.util.BeanUtils;
|
||||
import com.fangjia.core.util.DataUtil;
|
||||
import com.fangjia.core.util.DateUtil;
|
||||
import com.fangjia.core.util.HouseValidator;
|
||||
import com.fangjia.core.util.*;
|
||||
import com.fangjia.dal.QueryParam;
|
||||
import com.fangjia.dal.SortParam;
|
||||
import com.fangjia.dal.SrQuery;
|
||||
@@ -51,7 +48,7 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{
|
||||
private static String[] HOUSE_FIELDS = new String[]{"city", "region", "districtName", "totalPrice", "avgPrice",
|
||||
"area", "fitment", "direction", "floor", "height", "publishDate", "address", "estateType"};
|
||||
|
||||
|
||||
public static String[] TAGS =new String[]{"独栋", "联排", "叠加", "双拼", "花园面积", "泳池", "别墅", "带花园", "洋房", "叠拼", "独院", "联体", "微墅", "大平墅"};
|
||||
|
||||
private DealPriceDao dealPriceDao;
|
||||
private HouseDao houseDao;
|
||||
@@ -191,7 +188,8 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{
|
||||
}
|
||||
List<SampleWrapper> querySamples= new ArrayList<SampleWrapper>();
|
||||
List<SampleWrapper> samples = findSampleByDistrict(district.getCity(), district.getRegion(), district.getName(), district.getAlias(), district.getMasterDistrictNname(), district.getEstateType2(),queryBean.getPropertyTypeCode(), queryBean.getUpdateDate(), districtStat);
|
||||
scoreForSample(samples, target);
|
||||
// scoreForSample(samples, target);
|
||||
sortForSample(samples, target);
|
||||
for(SampleWrapper sample : samples){
|
||||
sample.setProperty(queryBean.getProperty());
|
||||
}
|
||||
@@ -205,7 +203,8 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{
|
||||
for(SampleWrapper sample : nearlySample){
|
||||
sample.setProperty(d);
|
||||
}
|
||||
scoreForSample(nearlySample, target);
|
||||
// scoreForSample(nearlySample, target);
|
||||
sortForSample(samples, target);
|
||||
querySamples.addAll(nearlySample);
|
||||
if(querySamples.size() > max){
|
||||
break;
|
||||
@@ -481,6 +480,56 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{
|
||||
return samples;
|
||||
}
|
||||
|
||||
|
||||
private List<SampleWrapper> sortForSample(List<SampleWrapper> samples, final SampleWrapper targetSample){
|
||||
|
||||
if(samples.isEmpty()){
|
||||
return samples;
|
||||
}
|
||||
// if(samples!=null && samples.size() < max){
|
||||
// return samples;
|
||||
// }
|
||||
Collections.sort(samples, new Comparator<SampleWrapper>() {
|
||||
public int compare(SampleWrapper o1, SampleWrapper o2) {
|
||||
Double d1 = Math.abs(o1.getStrctureArea() - targetSample.getStrctureArea());
|
||||
Double d2 = Math.abs(o2.getStrctureArea() - targetSample.getStrctureArea());
|
||||
// return (int) (d1 - d2);
|
||||
return d1.compareTo(d2);
|
||||
}
|
||||
});
|
||||
|
||||
List<Integer> prices = new ArrayList<Integer>();
|
||||
for(SampleWrapper sample : samples){
|
||||
if(!prices.contains(sample.getUnitPrice())){
|
||||
prices.add(sample.getUnitPrice());
|
||||
if(prices.size()>=10){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
final Integer midPrice = (int)median(prices);
|
||||
Collections.sort(samples, new Comparator<SampleWrapper>() {
|
||||
public int compare(SampleWrapper o1, SampleWrapper o2) {
|
||||
Integer d1 = Math.abs(o1.getUnitPrice() - midPrice);
|
||||
Integer d2 = Math.abs(o2.getUnitPrice() - midPrice);
|
||||
return d1.compareTo(d2);
|
||||
}
|
||||
});
|
||||
return samples;
|
||||
}
|
||||
|
||||
private static double median(List<Integer> total) {
|
||||
double j = 0;
|
||||
Collections.sort(total);
|
||||
int size = total.size();
|
||||
if(size % 2 == 1){
|
||||
j = total.get((size-1)/2);
|
||||
}else {
|
||||
j = (total.get(size/2-1) + total.get(size/2) + 0.0)/2;
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找小区样本
|
||||
* @param city
|
||||
@@ -514,8 +563,8 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{
|
||||
houseQuery.add(new QueryParam("region", region ));
|
||||
if(districtStat != null && districtStat.getAvgPrice() > 0){
|
||||
int avgPrice = districtStat.getAvgPrice();
|
||||
houseQuery.add(new QueryParam("avgPrice", QueryParam.GREATER_THAN_EQUAL_OPERATOR, (int)(avgPrice * 0.85 )));
|
||||
houseQuery.add(new QueryParam("avgPrice", QueryParam.LESS_THAN_EQUAL_OPERATOR, (int)(avgPrice * 1.15 )));
|
||||
houseQuery.add(new QueryParam("avgPrice", QueryParam.GREATER_THAN_EQUAL_OPERATOR, (int)(avgPrice * 0.5 )));//0.85
|
||||
houseQuery.add(new QueryParam("avgPrice", QueryParam.LESS_THAN_EQUAL_OPERATOR, (int)(avgPrice * 1.5 )));//1.15
|
||||
}
|
||||
BooleanQuery nameQuery = new BooleanQuery();
|
||||
int c = 0;
|
||||
@@ -548,6 +597,21 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{
|
||||
int maxFloor = 0;
|
||||
boolean allSampleHasHeight = true;
|
||||
for(House house : houses){
|
||||
if(StringUtils.isNotBlank(estateType) && estateType.equals("01")){//01:普通住宅 02:别墅
|
||||
if(StringUtils.isNotBlank(house.getEstateType()) && house.getEstateType().contains("别墅")){
|
||||
continue;
|
||||
}
|
||||
if(isVilla(house.getArea(), house.getName(), house.getHeight(), house.getRoom())){
|
||||
continue;
|
||||
}
|
||||
}else if(StringUtils.isNotBlank(estateType) && estateType.equals("02")){
|
||||
if(house.getHeight()!=null && house.getHeight()>=10){
|
||||
continue;
|
||||
}
|
||||
if(house.getFloor()!=null && house.getFloor()>=10){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
SampleWrapper sample = convertHouse2Sample(house);
|
||||
if(isAvailableSample(sample)){
|
||||
@@ -859,6 +923,39 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是别墅
|
||||
* @return
|
||||
*/
|
||||
public boolean isVilla(Double area, String name, Integer height, Integer room) {
|
||||
if (area == null) {
|
||||
return false;
|
||||
}
|
||||
if (area >= 150 && StringUtils.indexOfAny(name, TAGS) > -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean ret = false;
|
||||
if (height != null && room != null) {
|
||||
if (height <= 3) {
|
||||
if (area > 200 && room >= 5) {
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
} else if (height == null && room != null) {
|
||||
if (area > 360 && room >= 6) {
|
||||
ret = true;
|
||||
}
|
||||
} else if (height == null && room == null) {
|
||||
if (area > 500) {
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
public void setDealPriceDao(DealPriceDao dealPriceDao) {
|
||||
this.dealPriceDao = dealPriceDao;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user