商铺样本查询优化
This commit is contained in:
@@ -38,6 +38,7 @@ public class SeawaterQuery {
|
||||
|
||||
private Integer radius;
|
||||
private String level;
|
||||
private List<String> tags;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
@@ -278,4 +279,12 @@ public class SeawaterQuery {
|
||||
public void setLevel(String level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public List<String> getTags() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
public void setTags(List<String> tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,6 +146,14 @@ public class Evaluation implements MongoEntity {
|
||||
* 楼层描述
|
||||
*/
|
||||
private String floorDesc;
|
||||
/**
|
||||
* 查询范围
|
||||
*/
|
||||
private Integer radius;
|
||||
/**
|
||||
* 商铺标签
|
||||
*/
|
||||
private String tags;
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
@Column(name = "_id")
|
||||
@@ -1066,4 +1074,22 @@ public class Evaluation implements MongoEntity {
|
||||
public void setFloorDesc(String floorDesc) {
|
||||
this.floorDesc = floorDesc;
|
||||
}
|
||||
|
||||
@Transient
|
||||
public Integer getRadius() {
|
||||
return radius;
|
||||
}
|
||||
|
||||
public void setRadius(Integer radius) {
|
||||
this.radius = radius;
|
||||
}
|
||||
|
||||
@Transient
|
||||
public String getTags() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
public void setTags(String tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -395,6 +395,24 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
if (source.containsKey("business_status")) {
|
||||
seawater.setBusinessStatus(source.getString("business_status"));
|
||||
}
|
||||
if (source.containsKey("tags")) {
|
||||
List<String> tagsList = new ArrayList<String>();
|
||||
JSONArray jsonArray = source.getJSONArray("tags");
|
||||
int size = jsonArray.size();
|
||||
for (int n = 0; n < size; n++) {
|
||||
tagsList.add(jsonArray.getString(n));
|
||||
}
|
||||
seawater.setTags(StringUtils.join(tagsList, ","));
|
||||
}
|
||||
if (source.containsKey("image_urls")) {
|
||||
List<String> imageList = new ArrayList<String>();
|
||||
JSONArray jsonArray = source.getJSONArray("image_urls");
|
||||
int size = jsonArray.size();
|
||||
for (int n = 0; n < size; n++) {
|
||||
imageList.add(jsonArray.getString(n));
|
||||
}
|
||||
seawater.setImageUrls(StringUtils.join(imageList, ","));
|
||||
}
|
||||
try {
|
||||
seawater.setDistance((int) jsonList.get(i).getJSONArray("sort").getDouble(0));
|
||||
} catch (Exception e) {
|
||||
@@ -780,6 +798,17 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
jsonList.add(temp);
|
||||
}
|
||||
|
||||
if (query.getTags() != null && query.getTags().size() > 0) {
|
||||
Set<String> tagsList = new LinkedHashSet<String>(query.getTags());
|
||||
for (String tag : tagsList) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("tags", tag);
|
||||
JSONObject temp = new JSONObject();
|
||||
temp.put("term", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
}
|
||||
|
||||
queryJson.put("must", jsonList);
|
||||
ArrayList<JSONObject> filterList = new ArrayList<JSONObject>();
|
||||
if (filter.size() > 0) {
|
||||
|
||||
@@ -104,6 +104,9 @@ public class Seawater implements SeawaterEntity {
|
||||
|
||||
private String businessStatus;
|
||||
|
||||
private String tags;
|
||||
|
||||
private String imageUrls;
|
||||
|
||||
@Id
|
||||
@Column(name = "_id")
|
||||
@@ -572,4 +575,22 @@ public class Seawater implements SeawaterEntity {
|
||||
public void setBusinessStatus(String businessStatus) {
|
||||
this.businessStatus = businessStatus;
|
||||
}
|
||||
|
||||
@Column(name = "tags")
|
||||
public String getTags() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
public void setTags(String tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
@Column(name = "image_urls")
|
||||
public String getImageUrls() {
|
||||
return imageUrls;
|
||||
}
|
||||
|
||||
public void setImageUrls(String imageUrls) {
|
||||
this.imageUrls = imageUrls;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,12 @@ public class SeawaterDto {
|
||||
|
||||
private String districtName;
|
||||
|
||||
private String tags;
|
||||
|
||||
private String imageUrls;
|
||||
|
||||
private String location;
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
@@ -113,4 +119,28 @@ public class SeawaterDto {
|
||||
public void setDistrictName(String districtName) {
|
||||
this.districtName = districtName;
|
||||
}
|
||||
|
||||
public String getTags() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
public void setTags(String tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
public String getImageUrls() {
|
||||
return imageUrls;
|
||||
}
|
||||
|
||||
public void setImageUrls(String imageUrls) {
|
||||
this.imageUrls = imageUrls;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(String location) {
|
||||
this.location = location;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -467,6 +467,15 @@ public class ShopController {
|
||||
evaluation.setAge(model.getAge());
|
||||
}
|
||||
evaluation.setArea(model.getSize());
|
||||
if (model.getRadius() != null) {
|
||||
evaluation.setRadius(model.getRadius());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getTags())) {
|
||||
evaluation.setTags(model.getTags());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getEstateType())) {
|
||||
evaluation.setEstateType(model.getEstateType());
|
||||
}
|
||||
if (ArrayUtils.isNotEmpty(model.getBuildQuality())) {
|
||||
evaluation.setBuildQuality(convertToString(model.getBuildQuality()));
|
||||
}
|
||||
|
||||
+9
@@ -467,6 +467,15 @@ public class ShopSellController {
|
||||
evaluation.setAge(model.getAge());
|
||||
}
|
||||
evaluation.setArea(model.getSize());
|
||||
if (model.getRadius() != null) {
|
||||
evaluation.setRadius(model.getRadius());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getTags())) {
|
||||
evaluation.setTags(model.getTags());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getEstateType())) {
|
||||
evaluation.setEstateType(model.getEstateType());
|
||||
}
|
||||
if (ArrayUtils.isNotEmpty(model.getBuildQuality())) {
|
||||
evaluation.setBuildQuality(convertToString(model.getBuildQuality()));
|
||||
}
|
||||
|
||||
+10
@@ -292,6 +292,8 @@ public class PropertyEvaluationModel extends FangjiaApiModel {
|
||||
private Integer level;
|
||||
private Integer type;
|
||||
|
||||
private String tags;
|
||||
|
||||
public void setDecorationAge(int decorationAge) {
|
||||
this.decorationAge = decorationAge;
|
||||
}
|
||||
@@ -942,4 +944,12 @@ public class PropertyEvaluationModel extends FangjiaApiModel {
|
||||
public void setType(Integer type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getTags() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
public void setTags(String tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
}
|
||||
|
||||
+25
-2
@@ -223,6 +223,9 @@ public class AiShopServiceImpl implements AiShopService {
|
||||
seawaterDto.setFloorInfo(seawater.getFloorInfo());
|
||||
seawaterDto.setAddress(seawater.getAddress());
|
||||
seawaterDto.setDistrictName(seawater.getDistrictName());
|
||||
seawaterDto.setTags(seawater.getTags());
|
||||
seawaterDto.setImageUrls(seawater.getImageUrls());
|
||||
seawaterDto.setLocation(seawater.getLocation());
|
||||
return seawaterDto;
|
||||
}
|
||||
|
||||
@@ -318,7 +321,17 @@ public class AiShopServiceImpl implements AiShopService {
|
||||
query.setLat(lat);
|
||||
query.setLng(lng);
|
||||
query.setCat("shop_rent");
|
||||
query.setRadius(1000);
|
||||
if (evaluation.getRadius() != null && evaluation.getRadius() > 0) {
|
||||
query.setRadius(evaluation.getRadius());
|
||||
} else {
|
||||
query.setRadius(1000);
|
||||
}
|
||||
if (StringUtils.isNotBlank(evaluation.getEstateType())) {
|
||||
query.setEstateType(evaluation.getEstateType());
|
||||
}
|
||||
if (StringUtils.isNotBlank(evaluation.getTags())) {
|
||||
query.setTags(Arrays.asList(evaluation.getTags().split(",")));
|
||||
}
|
||||
// 查询近一年样本
|
||||
query.setStartDate(Integer.parseInt(DateUtil.formatByPattern(DateUtil.addMonthToDate(new Date(), -12), "yyyyMMdd")));
|
||||
query.setEndDate(Integer.parseInt(DateUtil.formatByPattern(new Date(), "yyyyMMdd")));
|
||||
@@ -371,7 +384,17 @@ public class AiShopServiceImpl implements AiShopService {
|
||||
query.setLat(lat);
|
||||
query.setLng(lng);
|
||||
query.setCat("shop_sell");
|
||||
query.setRadius(1000);
|
||||
if (evaluation.getRadius() != null && evaluation.getRadius() > 0) {
|
||||
query.setRadius(evaluation.getRadius());
|
||||
} else {
|
||||
query.setRadius(1000);
|
||||
}
|
||||
if (StringUtils.isNotBlank(evaluation.getEstateType())) {
|
||||
query.setEstateType(evaluation.getEstateType());
|
||||
}
|
||||
if (StringUtils.isNotBlank(evaluation.getTags())) {
|
||||
query.setTags(Arrays.asList(evaluation.getTags().split(",")));
|
||||
}
|
||||
// 查询近一年样本
|
||||
query.setStartDate(Integer.parseInt(DateUtil.formatByPattern(DateUtil.addMonthToDate(new Date(), -12), "yyyyMMdd")));
|
||||
query.setEndDate(Integer.parseInt(DateUtil.formatByPattern(new Date(), "yyyyMMdd")));
|
||||
|
||||
Reference in New Issue
Block a user