/house/around接口
This commit is contained in:
+7
-1
@@ -77,6 +77,8 @@ public class HouseController {
|
|||||||
|
|
||||||
private AddressParser addressParser;
|
private AddressParser addressParser;
|
||||||
private HouseService houseService;
|
private HouseService houseService;
|
||||||
|
|
||||||
|
private RentHouseService rentHouseService;
|
||||||
private MenuService menuService;
|
private MenuService menuService;
|
||||||
private NoHouseDistrictService noHouseDistrictService;
|
private NoHouseDistrictService noHouseDistrictService;
|
||||||
private ApiUserService apiUserService;
|
private ApiUserService apiUserService;
|
||||||
@@ -1010,7 +1012,7 @@ public class HouseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
List<House> nearestHasHouseByLocation = houseService.findNearestHasHouseByLocation(model.getCity(), lat, lng, cat, model.getRadius(), 5);
|
List<House> nearestHasHouseByLocation = rentHouseService.findNearestHasHouseByLocation(model.getCity(), lat, lng, cat, model.getRadius(), 5);
|
||||||
if (nearestHasHouseByLocation != null && !nearestHasHouseByLocation.isEmpty()) {
|
if (nearestHasHouseByLocation != null && !nearestHasHouseByLocation.isEmpty()) {
|
||||||
for (House house : nearestHasHouseByLocation) {
|
for (House house : nearestHasHouseByLocation) {
|
||||||
Seawater seawater = new Seawater();
|
Seawater seawater = new Seawater();
|
||||||
@@ -1869,4 +1871,8 @@ public class HouseController {
|
|||||||
public void setSeaweedService(SeaweedService seaweedService) {
|
public void setSeaweedService(SeaweedService seaweedService) {
|
||||||
this.seaweedService = seaweedService;
|
this.seaweedService = seaweedService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setRentHouseService(RentHouseService rentHouseService) {
|
||||||
|
this.rentHouseService = rentHouseService;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -470,5 +470,4 @@ public interface HouseService extends ModeService<String, HouseBo> {
|
|||||||
|
|
||||||
HashMap<String, Object> findHouseStat(District districtKey, Integer avgPrice);
|
HashMap<String, Object> findHouseStat(District districtKey, Integer avgPrice);
|
||||||
|
|
||||||
List<House> findNearestHasHouseByLocation(String city, Double lat,Double lng,String cat, int radiusMeters, int limit);
|
|
||||||
}
|
}
|
||||||
|
|||||||
-20
@@ -2612,25 +2612,5 @@ public class HouseServiceImpl implements HouseService {
|
|||||||
CacheUtils.putValue(CacheUtils.CachePolicyEnum.MIDDLE, HouseServiceImpl.class, key, value);
|
CacheUtils.putValue(CacheUtils.CachePolicyEnum.MIDDLE, HouseServiceImpl.class, key, value);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public List<House> findNearestHasHouseByLocation(String city,Double lat, Double lng, String cat,int radiusMeters, int limit) {
|
|
||||||
if (lat == null || lng == null || lat <= 0 ||lng <= 0) {
|
|
||||||
return Collections.EMPTY_LIST;
|
|
||||||
}
|
|
||||||
List<QueryParam> params = new ArrayList<QueryParam>();
|
|
||||||
// params.add(new QueryParam("cat", cat));
|
|
||||||
if (StringUtils.isNotBlank(city)){
|
|
||||||
params.add(new QueryParam("city", city));
|
|
||||||
}
|
|
||||||
SdQuery sdQuery = new SdQuery();
|
|
||||||
sdQuery.setPoint(lat + "," + lng);
|
|
||||||
sdQuery.setField("lat_lng");
|
|
||||||
// sdQuery.setDistance(String.valueOf((double) radiusMeters / 1000.0));
|
|
||||||
sdQuery.setDistance(String.valueOf(radiusMeters));
|
|
||||||
params.add(new QueryParam(QueryParam.SD_PARAM_NAME, sdQuery));
|
|
||||||
// List<SortParam> sortParams = Arrays.asList(new SortParam("distance", true));
|
|
||||||
List<House> list = houseDao.findAllByParams(params, null, 0, limit);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
@@ -3,6 +3,7 @@ package com.fangjia.service.datastore;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.fangjia.dal.datastore.model.House;
|
||||||
import org.sothis.core.util.Pager;
|
import org.sothis.core.util.Pager;
|
||||||
|
|
||||||
import com.fangjia.dal.FacetQueryResult;
|
import com.fangjia.dal.FacetQueryResult;
|
||||||
@@ -208,4 +209,6 @@ public interface RentHouseService extends ModeService<String, RentHouseBo> {
|
|||||||
boolean refreshHouse(String houseId, int userId);
|
boolean refreshHouse(String houseId, int userId);
|
||||||
|
|
||||||
// 用户中心发布房源接口 END
|
// 用户中心发布房源接口 END
|
||||||
|
|
||||||
|
List<House> findNearestHasHouseByLocation(String city, Double lat, Double lng, String cat, int radiusMeters, int limit);
|
||||||
}
|
}
|
||||||
|
|||||||
+30
-13
@@ -1,14 +1,10 @@
|
|||||||
package com.fangjia.service.datastore;
|
package com.fangjia.service.datastore;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
|
import com.fangjia.dal.*;
|
||||||
|
import com.fangjia.dal.datastore.dao.HouseDao;
|
||||||
|
import com.fangjia.dal.datastore.model.House;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.lucene.search.Query;
|
import org.apache.lucene.search.Query;
|
||||||
import org.sothis.core.util.CollectionUtils;
|
import org.sothis.core.util.CollectionUtils;
|
||||||
@@ -16,11 +12,6 @@ import org.sothis.core.util.Pager;
|
|||||||
|
|
||||||
import com.fangjia.core.util.DateUtil;
|
import com.fangjia.core.util.DateUtil;
|
||||||
import com.fangjia.core.util.RandomUtil;
|
import com.fangjia.core.util.RandomUtil;
|
||||||
import com.fangjia.dal.FacetQuery;
|
|
||||||
import com.fangjia.dal.FacetQueryResult;
|
|
||||||
import com.fangjia.dal.QueryParam;
|
|
||||||
import com.fangjia.dal.SortParam;
|
|
||||||
import com.fangjia.dal.SrQuery;
|
|
||||||
import com.fangjia.dal.common.DistrictKey;
|
import com.fangjia.dal.common.DistrictKey;
|
||||||
import com.fangjia.dal.common.FangjiaServerAreaContextHolder;
|
import com.fangjia.dal.common.FangjiaServerAreaContextHolder;
|
||||||
import com.fangjia.dal.common.ServerAreaData;
|
import com.fangjia.dal.common.ServerAreaData;
|
||||||
@@ -70,6 +61,8 @@ public class RentHouseServiceImpl implements RentHouseService {
|
|||||||
private UserHouseDao userHouseDao;
|
private UserHouseDao userHouseDao;
|
||||||
private MetroDistanceService metroDistanceService;
|
private MetroDistanceService metroDistanceService;
|
||||||
|
|
||||||
|
private HouseDao houseDao;
|
||||||
|
|
||||||
public FacetQueryResult<RentHouseBo> randomGainHouse(RentHouseQueryBean queryBean, int count) {
|
public FacetQueryResult<RentHouseBo> randomGainHouse(RentHouseQueryBean queryBean, int count) {
|
||||||
long totalCount = this.findHouseCount(queryBean);
|
long totalCount = this.findHouseCount(queryBean);
|
||||||
int endCount = count * 100;
|
int endCount = count * 100;
|
||||||
@@ -831,6 +824,27 @@ public class RentHouseServiceImpl implements RentHouseService {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<House> findNearestHasHouseByLocation(String city,Double lat, Double lng, String cat,int radiusMeters, int limit) {
|
||||||
|
if (lat == null || lng == null || lat <= 0 ||lng <= 0) {
|
||||||
|
return Collections.EMPTY_LIST;
|
||||||
|
}
|
||||||
|
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||||
|
// params.add(new QueryParam("cat", cat));
|
||||||
|
if (StringUtils.isNotBlank(city)){
|
||||||
|
params.add(new QueryParam("city", city));
|
||||||
|
}
|
||||||
|
SdQuery sdQuery = new SdQuery();
|
||||||
|
sdQuery.setPoint(lat + "," + lng);
|
||||||
|
sdQuery.setField("lat_lng");
|
||||||
|
// sdQuery.setDistance(String.valueOf((double) radiusMeters / 1000.0));
|
||||||
|
sdQuery.setDistance(String.valueOf(radiusMeters));
|
||||||
|
params.add(new QueryParam(QueryParam.SD_PARAM_NAME, sdQuery));
|
||||||
|
// List<SortParam> sortParams = Arrays.asList(new SortParam("latLng", true));
|
||||||
|
List<House> list = houseDao.findAllByParams(params, null, 0, limit);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean refreshHouse(String houseId, int userId,String source) {
|
public boolean refreshHouse(String houseId, int userId,String source) {
|
||||||
List<QueryParam> params = new ArrayList<QueryParam>(2);
|
List<QueryParam> params = new ArrayList<QueryParam>(2);
|
||||||
params.add(new QueryParam("userId", userId));
|
params.add(new QueryParam("userId", userId));
|
||||||
@@ -899,4 +913,7 @@ public class RentHouseServiceImpl implements RentHouseService {
|
|||||||
this.metroDistanceService = metroDistanceService;
|
this.metroDistanceService = metroDistanceService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setHouseDao(HouseDao houseDao) {
|
||||||
|
this.houseDao = houseDao;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user