/house/around 完善
This commit is contained in:
+20
-10
@@ -15,11 +15,11 @@ import net.sf.json.JSONObject;
|
||||
import org.sothis.core.util.Pager;
|
||||
|
||||
public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> implements SeawaterDao {
|
||||
|
||||
|
||||
|
||||
|
||||
private static final String ES_USER = "developer";
|
||||
private static final String ES_PASSWORD = "5e8edd851d2fdfbd7415232c67367cc3";
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public long findSeawatersCountFromEs(String category, String city, String region, String name, List<String> alias,
|
||||
@@ -267,6 +267,10 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
seawater.setCity(source.getString("city"));
|
||||
seawater.setRegion(source.getString("region"));
|
||||
seawater.setDistrictName(source.getString("district_name"));
|
||||
if (source.containsKey("location")){
|
||||
String location = source.getJSONObject("location").getString("lon") + "," + source.getJSONObject("location").getString("lat");
|
||||
seawater.setLocation(location);
|
||||
}
|
||||
if(source.containsKey("address")){
|
||||
seawater.setAddress(source.getString("address"));
|
||||
}
|
||||
@@ -372,11 +376,16 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
if(source.containsKey("elevator")){
|
||||
seawater.setElevator(source.getString("elevator"));
|
||||
}
|
||||
try {
|
||||
seawater.setDistance((int)jsonList.get(i).getJSONArray("sort").getDouble(0));
|
||||
}catch (Exception e){
|
||||
seawater.setDistance(null);
|
||||
}
|
||||
seawaterList.add(seawater);
|
||||
}
|
||||
return seawaterList;
|
||||
}
|
||||
|
||||
|
||||
private JSONObject query(String id,String category, String city, String region, String name, List<String> alias,
|
||||
List<String> regionAlias, Integer startDate, Integer endDate, Double startArea, Double endArea, Integer startPrice, Integer endPrice,
|
||||
Integer room, String root,String sort, boolean order, int start, int limit,String table){
|
||||
@@ -399,7 +408,7 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
temp.put("term", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
|
||||
|
||||
Set<String> namesList = new LinkedHashSet<String>();
|
||||
if(StringUtils.isNotBlank(name)) {
|
||||
namesList.add(name);
|
||||
@@ -414,7 +423,7 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
temp.put("terms", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
|
||||
|
||||
Set<String> regionsList = new LinkedHashSet<String>();
|
||||
if(StringUtils.isNotBlank(region)) {
|
||||
regionsList.add(region);
|
||||
@@ -429,7 +438,7 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
temp.put("terms", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
|
||||
|
||||
if(StringUtils.isNotBlank(city)){
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("city", city);
|
||||
@@ -451,7 +460,7 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
temp.put("term", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
|
||||
|
||||
if(startDate != null || endDate != null){
|
||||
JSONObject param = new JSONObject();
|
||||
JSONObject temp = new JSONObject();
|
||||
@@ -497,7 +506,7 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
temp.put("range", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
|
||||
|
||||
if(StringUtils.isNotBlank(sort)){
|
||||
JSONObject jsonOrder = new JSONObject();
|
||||
if(order){
|
||||
@@ -511,7 +520,7 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
sortJsonList.add(jsonSort);
|
||||
reqBody.put("sort", sortJsonList);
|
||||
}
|
||||
|
||||
|
||||
if(start >= 0){
|
||||
reqBody.put("from", start);
|
||||
}
|
||||
@@ -557,6 +566,7 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
Double lat = query.getLat();
|
||||
Double lng = query.getLng();
|
||||
Integer radius = query.getRadius();
|
||||
// 添加地理位置过滤器和排序
|
||||
if (lat != null && lng != null && radius != null) {
|
||||
// 1. 设置地理位置参数
|
||||
JSONObject geoDistanceParam = new JSONObject();
|
||||
|
||||
@@ -80,6 +80,10 @@ public class Seawater implements SeawaterEntity {
|
||||
|
||||
private String decoration;
|
||||
|
||||
private Integer distance;
|
||||
|
||||
private String location;
|
||||
|
||||
@Id
|
||||
@Column(name = "_id")
|
||||
public String getId() {
|
||||
@@ -453,4 +457,20 @@ public class Seawater implements SeawaterEntity {
|
||||
public void setDecoration(String decoration) {
|
||||
this.decoration = decoration;
|
||||
}
|
||||
|
||||
public Integer getDistance() {
|
||||
return distance;
|
||||
}
|
||||
|
||||
public void setDistance(Integer distance) {
|
||||
this.distance = distance;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(String location) {
|
||||
this.location = location;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user