Merge branch 'master' of http://gitlab.fangjia.com/dev0/main
This commit is contained in:
@@ -0,0 +1,242 @@
|
||||
package com.fangjia.dal;
|
||||
import org.sothis.core.util.Pager;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SeawaterQuery {
|
||||
|
||||
private String id;
|
||||
private String cat;
|
||||
private String region;
|
||||
private String districtName;
|
||||
private String cityDisplay;
|
||||
private Integer room;
|
||||
private String direction;
|
||||
private String fitment;
|
||||
private String sort;
|
||||
private Boolean order;
|
||||
private Integer StartDate;
|
||||
private Integer endDate;
|
||||
private String estateType;
|
||||
private Double startArea;
|
||||
private Double endArea;
|
||||
private Integer startPrice;
|
||||
private Integer endPrice;
|
||||
private Integer status;
|
||||
private String rootName;
|
||||
private String sortField;
|
||||
private List<String> regionAlias;
|
||||
private List<String> districtAlias;
|
||||
private String[] keys;
|
||||
private String table;
|
||||
private Pager pager;
|
||||
private String editEstateType;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getCat() {
|
||||
return cat;
|
||||
}
|
||||
|
||||
public void setCat(String cat) {
|
||||
this.cat = cat;
|
||||
}
|
||||
|
||||
public String getRegion() {
|
||||
return region;
|
||||
}
|
||||
|
||||
public void setRegion(String region) {
|
||||
this.region = region;
|
||||
}
|
||||
|
||||
public String getDistrictName() {
|
||||
return districtName;
|
||||
}
|
||||
|
||||
public void setDistrictName(String districtName) {
|
||||
this.districtName = districtName;
|
||||
}
|
||||
|
||||
public Integer getRoom() {
|
||||
return room;
|
||||
}
|
||||
|
||||
public void setRoom(Integer room) {
|
||||
this.room = room;
|
||||
}
|
||||
|
||||
public String getDirection() {
|
||||
return direction;
|
||||
}
|
||||
|
||||
public void setDirection(String direction) {
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
public String getFitment() {
|
||||
return fitment;
|
||||
}
|
||||
|
||||
public void setFitment(String fitment) {
|
||||
this.fitment = fitment;
|
||||
}
|
||||
|
||||
public Boolean getOrder() {
|
||||
return order;
|
||||
}
|
||||
|
||||
public void setOrder(Boolean order) {
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
public Integer getStartDate() {
|
||||
return StartDate;
|
||||
}
|
||||
|
||||
public void setStartDate(Integer startDate) {
|
||||
StartDate = startDate;
|
||||
}
|
||||
|
||||
public Integer getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(Integer endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public String getEstateType() {
|
||||
return estateType;
|
||||
}
|
||||
|
||||
public void setEstateType(String estateType) {
|
||||
this.estateType = estateType;
|
||||
}
|
||||
|
||||
public Integer getStartPrice() {
|
||||
return startPrice;
|
||||
}
|
||||
|
||||
public void setStartPrice(Integer startPrice) {
|
||||
this.startPrice = startPrice;
|
||||
}
|
||||
|
||||
public Integer getEndPrice() {
|
||||
return endPrice;
|
||||
}
|
||||
|
||||
public void setEndPrice(Integer endPrice) {
|
||||
this.endPrice = endPrice;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getSortField() {
|
||||
return sortField;
|
||||
}
|
||||
|
||||
public void setSortField(String sortField) {
|
||||
this.sortField = sortField;
|
||||
}
|
||||
|
||||
public List<String> getRegionAlias() {
|
||||
return regionAlias;
|
||||
}
|
||||
|
||||
public void setRegionAlias(List<String> regionAlias) {
|
||||
this.regionAlias = regionAlias;
|
||||
}
|
||||
|
||||
public List<String> getDistrictAlias() {
|
||||
return districtAlias;
|
||||
}
|
||||
|
||||
public void setDistrictAlias(List<String> districtAlias) {
|
||||
this.districtAlias = districtAlias;
|
||||
}
|
||||
|
||||
public String[] getKeys() {
|
||||
return keys;
|
||||
}
|
||||
|
||||
public void setKeys(String[] keys) {
|
||||
this.keys = keys;
|
||||
}
|
||||
|
||||
public String getTable() {
|
||||
return table;
|
||||
}
|
||||
|
||||
public void setTable(String table) {
|
||||
this.table = table;
|
||||
}
|
||||
|
||||
public String getRootName() {
|
||||
return rootName;
|
||||
}
|
||||
|
||||
public void setRootName(String rootName) {
|
||||
this.rootName = rootName;
|
||||
}
|
||||
|
||||
public Double getStartArea() {
|
||||
return startArea;
|
||||
}
|
||||
|
||||
public void setStartArea(Double startArea) {
|
||||
this.startArea = startArea;
|
||||
}
|
||||
|
||||
public Double getEndArea() {
|
||||
return endArea;
|
||||
}
|
||||
|
||||
public void setEndArea(Double endArea) {
|
||||
this.endArea = endArea;
|
||||
}
|
||||
|
||||
public Pager getPager() {
|
||||
return pager;
|
||||
}
|
||||
|
||||
public void setPager(Pager pager) {
|
||||
this.pager = pager;
|
||||
}
|
||||
|
||||
public String getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public void setSort(String sort) {
|
||||
this.sort = sort;
|
||||
}
|
||||
|
||||
public String getCityDisplay() {
|
||||
return cityDisplay;
|
||||
}
|
||||
|
||||
public void setCityDisplay(String cityDisplay) {
|
||||
this.cityDisplay = cityDisplay;
|
||||
}
|
||||
|
||||
public String getEditEstateType() {
|
||||
return editEstateType;
|
||||
}
|
||||
|
||||
public void setEditEstateType(String editEstateType) {
|
||||
this.editEstateType = editEstateType;
|
||||
}
|
||||
}
|
||||
@@ -102,6 +102,7 @@ public class PaiMai implements MongoEntity {
|
||||
private String houseNum;
|
||||
private String unitNum;
|
||||
private String roomNum;
|
||||
private String estateType;
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@@ -492,6 +493,7 @@ public class PaiMai implements MongoEntity {
|
||||
this.matchEstateType = matchEstateType;
|
||||
}
|
||||
|
||||
@Column(name = "houseNum")
|
||||
public String getHouseNum() {
|
||||
return houseNum;
|
||||
}
|
||||
@@ -500,6 +502,7 @@ public class PaiMai implements MongoEntity {
|
||||
this.houseNum = houseNum;
|
||||
}
|
||||
|
||||
@Column(name = "unitNum")
|
||||
public String getUnitNum() {
|
||||
return unitNum;
|
||||
}
|
||||
@@ -508,6 +511,7 @@ public class PaiMai implements MongoEntity {
|
||||
this.unitNum = unitNum;
|
||||
}
|
||||
|
||||
@Column(name = "roomNum")
|
||||
public String getRoomNum() {
|
||||
return roomNum;
|
||||
}
|
||||
@@ -515,4 +519,13 @@ public class PaiMai implements MongoEntity {
|
||||
public void setRoomNum(String roomNum) {
|
||||
this.roomNum = roomNum;
|
||||
}
|
||||
|
||||
@Column(name = "estateType")
|
||||
public String getEstateType() {
|
||||
return estateType;
|
||||
}
|
||||
|
||||
public void setEstateType(String estateType) {
|
||||
this.estateType = estateType;
|
||||
}
|
||||
}
|
||||
|
||||
+107
-41
@@ -95,10 +95,10 @@ public class AverageStatistics implements MongoEntity {
|
||||
private Double tuboshiEsfDiff;
|
||||
|
||||
/**中原地产二手房均价*/
|
||||
private Integer centanetNewPrice;
|
||||
private Double centanetNewDiff;
|
||||
private Integer centanetEsfPrice;
|
||||
private Double centanetEsfDiff;
|
||||
private Integer zhongyuanNewPrice;
|
||||
private Double zhongyuanNewDiff;
|
||||
private Integer zhongyuanEsfPrice;
|
||||
private Double zhongyuanEsfDiff;
|
||||
|
||||
|
||||
|
||||
@@ -155,9 +155,18 @@ public class AverageStatistics implements MongoEntity {
|
||||
private Integer zhugezhaofangNewPrice;
|
||||
private Double zhugezhaofangNewDiff;
|
||||
|
||||
|
||||
/**吉屋*/
|
||||
private Integer jiwuEsfPrice;
|
||||
private Double jiwuEsfDiff;
|
||||
private Integer jiwuNewPrice;
|
||||
private Double jiwuNewDiff;
|
||||
|
||||
/**365*/
|
||||
private Integer tsfhouseEsfPrice;
|
||||
private Double tsfhouseEsfDiff;
|
||||
private Integer tsfhouseNewPrice;
|
||||
private Double tsfhouseNewDiff;
|
||||
|
||||
|
||||
private String level;//价格评级
|
||||
private Integer lastAvgPrice;//最终价
|
||||
private String maxDeviate;//偏离度最大的网站,房价网-云估价-房估估
|
||||
@@ -578,22 +587,22 @@ public class AverageStatistics implements MongoEntity {
|
||||
this.fangguguNewPrice = fangguguNewPrice;
|
||||
}
|
||||
|
||||
@Column(name = "centanet_new_price")
|
||||
public Integer getCentanetNewPrice() {
|
||||
return centanetNewPrice;
|
||||
@Column(name = "zhongyuan_new_price")
|
||||
public Integer getZhongyuanNewPrice() {
|
||||
return zhongyuanNewPrice;
|
||||
}
|
||||
|
||||
public void setCentanetNewPrice(Integer centanetNewPrice) {
|
||||
this.centanetNewPrice = centanetNewPrice;
|
||||
public void setZhongyuanNewPrice(Integer zhongyuanNewPrice) {
|
||||
this.zhongyuanNewPrice = zhongyuanNewPrice;
|
||||
}
|
||||
|
||||
@Column(name = "centanet_esf_price")
|
||||
public Integer getCentanetEsfPrice() {
|
||||
return centanetEsfPrice;
|
||||
@Column(name = "zhongyuan_esf_price")
|
||||
public Integer getZhongyuanEsfPrice() {
|
||||
return zhongyuanEsfPrice;
|
||||
}
|
||||
|
||||
public void setCentanetEsfPrice(Integer centanetEsfPrice) {
|
||||
this.centanetEsfPrice = centanetEsfPrice;
|
||||
public void setZhongyuanEsfPrice(Integer zhongyuanEsfPrice) {
|
||||
this.zhongyuanEsfPrice = zhongyuanEsfPrice;
|
||||
}
|
||||
|
||||
@Column(name = "lianjia_esf_price")
|
||||
@@ -659,22 +668,22 @@ public class AverageStatistics implements MongoEntity {
|
||||
this.tuboshiEsfDiff = tuboshiEsfDiff;
|
||||
}
|
||||
|
||||
@Column(name = "centanet_new_diff")
|
||||
public Double getCentanetNewDiff() {
|
||||
return centanetNewDiff;
|
||||
@Column(name = "zhongyuan_new_diff")
|
||||
public Double getZhongyuanNewDiff() {
|
||||
return zhongyuanNewDiff;
|
||||
}
|
||||
|
||||
public void setCentanetNewDiff(Double centanetNewDiff) {
|
||||
this.centanetNewDiff = centanetNewDiff;
|
||||
public void setZhongyuanNewDiff(Double zhongyuanNewDiff) {
|
||||
this.zhongyuanNewDiff = zhongyuanNewDiff;
|
||||
}
|
||||
|
||||
@Column(name = "centanet_esf_diff")
|
||||
public Double getCentanetEsfDiff() {
|
||||
return centanetEsfDiff;
|
||||
@Column(name = "zhongyuan_esf_diff")
|
||||
public Double getZhongyuanEsfDiff() {
|
||||
return zhongyuanEsfDiff;
|
||||
}
|
||||
|
||||
public void setCentanetEsfDiff(Double centanetEsfDiff) {
|
||||
this.centanetEsfDiff = centanetEsfDiff;
|
||||
public void setZhongyuanEsfDiff(Double zhongyuanEsfDiff) {
|
||||
this.zhongyuanEsfDiff = zhongyuanEsfDiff;
|
||||
}
|
||||
|
||||
@Column(name = "master_district_name")
|
||||
@@ -1074,19 +1083,76 @@ public class AverageStatistics implements MongoEntity {
|
||||
public void setFangtanEsfDiff(Double fangtanEsfDiff) {
|
||||
this.fangtanEsfDiff = fangtanEsfDiff;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Column(name = "jiwu_esf_price")
|
||||
public Integer getJiwuEsfPrice() {
|
||||
return jiwuEsfPrice;
|
||||
}
|
||||
|
||||
public void setJiwuEsfPrice(Integer jiwuEsfPrice) {
|
||||
this.jiwuEsfPrice = jiwuEsfPrice;
|
||||
}
|
||||
|
||||
@Column(name = "jiwu_esf_diff")
|
||||
public Double getJiwuEsfDiff() {
|
||||
return jiwuEsfDiff;
|
||||
}
|
||||
|
||||
public void setJiwuEsfDiff(Double jiwuEsfDiff) {
|
||||
this.jiwuEsfDiff = jiwuEsfDiff;
|
||||
}
|
||||
|
||||
@Column(name = "jiwu_new_price")
|
||||
public Integer getJiwuNewPrice() {
|
||||
return jiwuNewPrice;
|
||||
}
|
||||
|
||||
public void setJiwuNewPrice(Integer jiwuNewPrice) {
|
||||
this.jiwuNewPrice = jiwuNewPrice;
|
||||
}
|
||||
|
||||
@Column(name = "jiwu_new_diff")
|
||||
public Double getJiwuNewDiff() {
|
||||
return jiwuNewDiff;
|
||||
}
|
||||
|
||||
public void setJiwuNewDiff(Double jiwuNewDiff) {
|
||||
this.jiwuNewDiff = jiwuNewDiff;
|
||||
}
|
||||
|
||||
@Column(name = "365house_esf_price")
|
||||
public Integer getTsfhouseEsfPrice() {
|
||||
return tsfhouseEsfPrice;
|
||||
}
|
||||
|
||||
public void setTsfhouseEsfPrice(Integer tsfhouseEsfPrice) {
|
||||
this.tsfhouseEsfPrice = tsfhouseEsfPrice;
|
||||
}
|
||||
|
||||
@Column(name = "365house_esf_diff")
|
||||
public Double getTsfhouseEsfDiff() {
|
||||
return tsfhouseEsfDiff;
|
||||
}
|
||||
|
||||
public void setTsfhouseEsfDiff(Double tsfhouseEsfDiff) {
|
||||
this.tsfhouseEsfDiff = tsfhouseEsfDiff;
|
||||
}
|
||||
|
||||
@Column(name = "365house_new_price")
|
||||
public Integer getTsfhouseNewPrice() {
|
||||
return tsfhouseNewPrice;
|
||||
}
|
||||
|
||||
public void setTsfhouseNewPrice(Integer tsfhouseNewPrice) {
|
||||
this.tsfhouseNewPrice = tsfhouseNewPrice;
|
||||
}
|
||||
|
||||
@Column(name = "365house_new_diff")
|
||||
public Double getTsfhouseNewDiff() {
|
||||
return tsfhouseNewDiff;
|
||||
}
|
||||
|
||||
public void setTsfhouseNewDiff(Double tsfhouseNewDiff) {
|
||||
this.tsfhouseNewDiff = tsfhouseNewDiff;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,18 +22,16 @@ public class SqmetreRent implements MongoEntity {
|
||||
private String city;
|
||||
private String region;
|
||||
private String districtName;
|
||||
private Double avgPrice;
|
||||
private int markup;
|
||||
private Integer avgPrice;
|
||||
private Integer calcAvgPrice;
|
||||
private Double markup;
|
||||
private Date weekend;
|
||||
private String cat;
|
||||
private Date creationDate;
|
||||
private Date modificationDate;
|
||||
private String sampleEnum;
|
||||
private double credit;
|
||||
private String cluster;
|
||||
|
||||
private Double oldValue;
|
||||
private String oldSampleEnum;
|
||||
private Double credit;
|
||||
private String valueType;
|
||||
private Integer priceToRent;
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@@ -76,22 +74,47 @@ public class SqmetreRent implements MongoEntity {
|
||||
}
|
||||
|
||||
@Column(name = "avg_price")
|
||||
public Double getAvgPrice() {
|
||||
public Integer getAvgPrice() {
|
||||
return avgPrice;
|
||||
}
|
||||
|
||||
public void setAvgPrice(Double avgPrice) {
|
||||
public void setAvgPrice(Integer avgPrice) {
|
||||
this.avgPrice = avgPrice;
|
||||
}
|
||||
|
||||
|
||||
@Column(name = "calc_avg_price")
|
||||
public Integer getCalcAvgPrice() {
|
||||
return calcAvgPrice;
|
||||
}
|
||||
|
||||
public void setCalcAvgPrice(Integer calcAvgPrice) {
|
||||
this.calcAvgPrice = calcAvgPrice;
|
||||
}
|
||||
|
||||
@Column(name = "value_type")
|
||||
public String getValueType() {
|
||||
return valueType;
|
||||
}
|
||||
|
||||
public void setValueType(String valueType) {
|
||||
this.valueType = valueType;
|
||||
}
|
||||
|
||||
@Column(name = "price_to_rent")
|
||||
public Integer getPriceToRent() {
|
||||
return priceToRent;
|
||||
}
|
||||
|
||||
public void setPriceToRent(Integer priceToRent) {
|
||||
this.priceToRent = priceToRent;
|
||||
}
|
||||
|
||||
@Column(name = "markup")
|
||||
public int getMarkup() {
|
||||
public Double getMarkup() {
|
||||
return markup;
|
||||
}
|
||||
|
||||
public void setMarkup(int markup) {
|
||||
public void setMarkup(Double markup) {
|
||||
this.markup = markup;
|
||||
}
|
||||
|
||||
@@ -123,52 +146,15 @@ public class SqmetreRent implements MongoEntity {
|
||||
}
|
||||
|
||||
|
||||
@Column(name = "sample_enum")
|
||||
public String getSampleEnum() {
|
||||
return sampleEnum;
|
||||
}
|
||||
|
||||
public void setSampleEnum(String sampleEnum) {
|
||||
this.sampleEnum = sampleEnum;
|
||||
}
|
||||
|
||||
|
||||
@Column(name = "credit")
|
||||
public double getCredit() {
|
||||
public Double getCredit() {
|
||||
return credit;
|
||||
}
|
||||
|
||||
public void setCredit(double credit) {
|
||||
public void setCredit(Double credit) {
|
||||
this.credit = credit;
|
||||
}
|
||||
|
||||
@Column(name = "cluster")
|
||||
public String getCluster() {
|
||||
return cluster;
|
||||
}
|
||||
|
||||
public void setCluster(String cluster) {
|
||||
this.cluster = cluster;
|
||||
}
|
||||
|
||||
@Column(name = "old_value")
|
||||
public Double getOldValue() {
|
||||
return oldValue;
|
||||
}
|
||||
|
||||
public void setOldValue(Double oldValue) {
|
||||
this.oldValue = oldValue;
|
||||
}
|
||||
|
||||
@Column(name = "old_sample_enum")
|
||||
public String getOldSampleEnum() {
|
||||
return oldSampleEnum;
|
||||
}
|
||||
|
||||
public void setOldSampleEnum(String oldSampleEnum) {
|
||||
this.oldSampleEnum = oldSampleEnum;
|
||||
}
|
||||
|
||||
@Column(name = "cat")
|
||||
public String getCat() {
|
||||
return cat;
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.fangjia.dal.mongo.open.dao;
|
||||
|
||||
import com.fangjia.dal.MongoDao;
|
||||
import com.fangjia.dal.mongo.open.model.EvaluateRatio;
|
||||
|
||||
/**
|
||||
* @author shenjian
|
||||
* @since 2022/7/27
|
||||
*/
|
||||
public interface EvaluateRatioDao extends MongoDao<EvaluateRatio> {
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package com.fangjia.dal.mongo.open.dao.impl;
|
||||
|
||||
import com.fangjia.dal.MongoDaoImpl;
|
||||
import com.fangjia.dal.mongo.open.dao.EvaluateRatioDao;
|
||||
import com.fangjia.dal.mongo.open.model.EvaluateRatio;
|
||||
|
||||
/**
|
||||
* @author shenjian
|
||||
* @since 2022/7/27
|
||||
*/
|
||||
public class EvaluateRatioDaoImpl extends MongoDaoImpl<EvaluateRatio> implements EvaluateRatioDao {
|
||||
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
package com.fangjia.dal.mongo.open.model;
|
||||
|
||||
import com.fangjia.dal.MongoEntity;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
* ¹À¼ÛϵÊý
|
||||
*
|
||||
* @author shenjian
|
||||
* @since 2022/7/27
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "business.evaluate_ratio")
|
||||
public class EvaluateRatio implements MongoEntity {
|
||||
|
||||
private static final long serialVersionUID = 5299813614465690722L;
|
||||
private String id;
|
||||
private String category;
|
||||
private String city;
|
||||
private String region;
|
||||
private Double ratio;
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@Column(name = "_id", unique = true, nullable = false)
|
||||
@Override
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Column(name = "category")
|
||||
public String getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
public void setCategory(String category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
@Column(name = "city")
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
@Column(name = "region")
|
||||
public String getRegion() {
|
||||
return region;
|
||||
}
|
||||
|
||||
public void setRegion(String region) {
|
||||
this.region = region;
|
||||
}
|
||||
|
||||
@Column(name = "ratio")
|
||||
public Double getRatio() {
|
||||
return ratio;
|
||||
}
|
||||
|
||||
public void setRatio(Double ratio) {
|
||||
this.ratio = ratio;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.fangjia.dal.seawater.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.fangjia.dal.SeawaterQuery;
|
||||
import com.fangjia.dal.seawater.model.Seawater;
|
||||
|
||||
/**
|
||||
@@ -18,4 +19,12 @@ public interface SeawaterDao extends com.fangjia.dal.SeawaterDao<Seawater> {
|
||||
Double startArea, Double endArea, Integer startPrice, Integer endPrice, Integer room, String root, String sort, boolean order, int start, int limit , String table);
|
||||
|
||||
List<Seawater> findHouses(String city, String region, List<String> alias, Integer minPrice, Integer maxPrice, Integer limit);
|
||||
|
||||
List<Seawater> findSeawatersByQuery(SeawaterQuery query);
|
||||
|
||||
long findSeawatersCountByQuery(SeawaterQuery query);
|
||||
|
||||
void batchDeleteByParams(SeawaterQuery query);
|
||||
|
||||
void batchUpdateEstateType(SeawaterQuery query);
|
||||
}
|
||||
|
||||
+459
-16
@@ -2,6 +2,7 @@ package com.fangjia.dal.seawater.dao;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.fangjia.dal.SeawaterQuery;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
@@ -11,6 +12,7 @@ import com.fangjia.dal.seawater.model.Seawater;
|
||||
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.sothis.core.util.Pager;
|
||||
|
||||
public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> implements SeawaterDao {
|
||||
|
||||
@@ -29,7 +31,14 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
@Override
|
||||
public Seawater findByIdFromEs(String id,String table) {
|
||||
Seawater seawater = null;
|
||||
List<JSONObject> jsonList = queryList(id,null,null,null,null,null,null,null,null, null, null, null, null, null,null,null,false,-1,-1,table);
|
||||
SeawaterQuery query = new SeawaterQuery();
|
||||
query.setId(id);
|
||||
query.setTable(table);
|
||||
Pager pager = new Pager();
|
||||
pager.setStartRow(-1);
|
||||
pager.setPageSize(-1);
|
||||
query.setPager(pager);
|
||||
List<JSONObject> jsonList = queryList(query);
|
||||
if(jsonList == null){
|
||||
return null;
|
||||
}else{
|
||||
@@ -44,7 +53,28 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
@Override
|
||||
public List<Seawater> findSeawatersFromEs(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) {
|
||||
List<Seawater> seawaterList= new ArrayList<Seawater>();
|
||||
List<JSONObject> jsonList = queryList(null,category,city,region,name,alias,regionAlias,startDate,endDate, startArea, endArea, startPrice, endPrice, room,root,sort,order,start,limit,table);
|
||||
SeawaterQuery query = new SeawaterQuery();
|
||||
query.setCat(category);
|
||||
query.setCityDisplay(city);
|
||||
query.setRegion(region);
|
||||
query.setDistrictName(name);
|
||||
query.setDistrictAlias(alias);
|
||||
query.setRegionAlias(regionAlias);
|
||||
query.setStartDate(startDate);
|
||||
query.setEndDate(endDate);
|
||||
query.setStartArea(startArea);
|
||||
query.setEndArea(endArea);
|
||||
query.setStartPrice(startPrice);
|
||||
query.setEndPrice(endPrice);
|
||||
query.setRoom(room);
|
||||
query.setRootName(root);
|
||||
query.setOrder(order);
|
||||
Pager pager = new Pager();
|
||||
pager.setStartRow(start);
|
||||
pager.setPageSize(limit);
|
||||
query.setPager(pager);
|
||||
query.setTable(table);
|
||||
List<JSONObject> jsonList = queryList(query);
|
||||
if(jsonList == null){
|
||||
return null;
|
||||
}else{
|
||||
@@ -53,6 +83,23 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
return seawaterList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Seawater> findSeawatersByQuery(SeawaterQuery query){
|
||||
List<Seawater> seawaterList;
|
||||
List<JSONObject> jsonList = queryList(query);
|
||||
if(jsonList == null){
|
||||
return null;
|
||||
}else{
|
||||
seawaterList = wrapSeawater(jsonList);
|
||||
}
|
||||
return seawaterList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long findSeawatersCountByQuery(SeawaterQuery query) {
|
||||
int count = queryCount(query);
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Seawater> findHouses(String city, String region, List<String> alias, Integer minPrice, Integer maxPrice, Integer limit) {
|
||||
@@ -136,6 +183,42 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchDeleteByParams(SeawaterQuery query) {
|
||||
HttpRequest request = new HttpRequest();
|
||||
|
||||
JSONObject reqBody = wrapQueryParams(query);
|
||||
|
||||
JSONObject script = new JSONObject();
|
||||
script.put("source", "ctx._source.status=1");
|
||||
script.put("lang", "painless");
|
||||
reqBody.put("script", script);
|
||||
|
||||
try {
|
||||
request.postWithBody("http://es.fangjia.com:9200/seawater/_update_by_query?conflicts=proceed&wait_for_completion=false", reqBody, this.buildHeader(), "UTF-8");
|
||||
} catch (HttpRequestException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchUpdateEstateType(SeawaterQuery query) {
|
||||
HttpRequest request = new HttpRequest();
|
||||
|
||||
JSONObject reqBody = wrapQueryParams(query);
|
||||
|
||||
JSONObject script = new JSONObject();
|
||||
script.put("source", "ctx._source.estate_type="+"'"+query.getEditEstateType()+"'");
|
||||
script.put("lang", "painless");
|
||||
reqBody.put("script", script);
|
||||
|
||||
try {
|
||||
request.postWithBody("http://es.fangjia.com:9200/seawater/_update_by_query?conflicts=proceed&wait_for_completion=false", reqBody, this.buildHeader(), "UTF-8");
|
||||
} catch (HttpRequestException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private JSONObject addMatch(String name, String value){
|
||||
JSONObject term = new JSONObject();
|
||||
JSONObject match = new JSONObject();
|
||||
@@ -234,6 +317,11 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
}catch(Exception e){
|
||||
seawater.setHall(0);
|
||||
}
|
||||
try{
|
||||
seawater.setToilet(source.getInt("toilet"));
|
||||
}catch(Exception e){
|
||||
seawater.setToilet(0);
|
||||
}
|
||||
try{
|
||||
seawater.setpDate(source.getInt("p_date"));
|
||||
}catch(Exception e){
|
||||
@@ -256,6 +344,9 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
if(source.containsKey("build_type")){
|
||||
seawater.setBuildType(source.getString("build_type"));
|
||||
}
|
||||
if(source.containsKey("status")){
|
||||
seawater.setStatus(source.getInt("status"));
|
||||
}
|
||||
seawaterList.add(seawater);
|
||||
}
|
||||
return seawaterList;
|
||||
@@ -431,29 +522,381 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<JSONObject> queryList(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){
|
||||
JSONObject json = query(id,category,city,region,name,alias,regionAlias,startDate,endDate, startArea, endArea, startPrice, endPrice, room,root,sort,order,start,limit,table);
|
||||
|
||||
private JSONObject query(SeawaterQuery query){
|
||||
long time1 = System.currentTimeMillis();
|
||||
JSONObject reqBody = new JSONObject();
|
||||
JSONObject q = new JSONObject();
|
||||
JSONObject queryJson = new JSONObject();
|
||||
List<JSONObject> jsonList = new ArrayList<JSONObject>();
|
||||
if(StringUtils.isNotBlank(query.getId())) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("_id", query.getId());
|
||||
JSONObject temp = new JSONObject();
|
||||
temp.put("term", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
if(StringUtils.isNotBlank(query.getCat())) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("cat", query.getCat());
|
||||
JSONObject temp = new JSONObject();
|
||||
temp.put("term", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
|
||||
Set<String> namesList = new LinkedHashSet<String>();
|
||||
if(StringUtils.isNotBlank(query.getDistrictName())) {
|
||||
namesList.add(query.getDistrictName());
|
||||
}
|
||||
if (query.getDistrictAlias() != null) {
|
||||
namesList.addAll(query.getDistrictAlias());
|
||||
}
|
||||
if(namesList != null && namesList.size() > 0){
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("district_name", namesList);
|
||||
JSONObject temp = new JSONObject();
|
||||
temp.put("terms", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
|
||||
Set<String> regionsList = new LinkedHashSet<String>();
|
||||
if(StringUtils.isNotBlank(query.getRegion())) {
|
||||
regionsList.add(query.getRegion());
|
||||
}
|
||||
if (query.getRegionAlias() != null) {
|
||||
regionsList.addAll(query.getRegionAlias());
|
||||
}
|
||||
if(regionsList != null && regionsList.size() > 0){
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("region", regionsList);
|
||||
JSONObject temp = new JSONObject();
|
||||
temp.put("terms", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(query.getCityDisplay())){
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("city", query.getCityDisplay());
|
||||
JSONObject temp = new JSONObject();
|
||||
temp.put("term", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
if(StringUtils.isNotBlank(query.getEstateType())) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("estate_type", query.getEstateType());
|
||||
JSONObject temp = new JSONObject();
|
||||
temp.put("term", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
if(query.getRoom() != null) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("room", query.getRoom());
|
||||
JSONObject temp = new JSONObject();
|
||||
temp.put("term", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
if(StringUtils.isNotBlank(query.getRootName())) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("root", query.getRootName());
|
||||
JSONObject temp = new JSONObject();
|
||||
temp.put("term", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
|
||||
if(query.getStartDate() != null || query.getEndDate() != null){
|
||||
JSONObject param = new JSONObject();
|
||||
JSONObject temp = new JSONObject();
|
||||
JSONObject temp2 = new JSONObject();
|
||||
if(query.getStartDate() != null){
|
||||
temp2.put("gte", query.getStartDate());
|
||||
}
|
||||
if(query.getEndDate() != null){
|
||||
temp2.put("lte", query.getEndDate());
|
||||
}
|
||||
param.put("p_date", temp2);
|
||||
temp.put("range", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
|
||||
|
||||
if(query.getStartArea() != null || query.getEndArea() != null){
|
||||
JSONObject param = new JSONObject();
|
||||
JSONObject temp = new JSONObject();
|
||||
JSONObject temp2 = new JSONObject();
|
||||
if(query.getStartArea() != null){
|
||||
temp2.put("gte", query.getStartArea());
|
||||
}
|
||||
if(query.getEndArea() != null){
|
||||
temp2.put("lte", query.getEndArea());
|
||||
}
|
||||
param.put("area", temp2);
|
||||
temp.put("range", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
|
||||
if(query.getStartPrice() != null || query.getEndPrice() != null){
|
||||
JSONObject param = new JSONObject();
|
||||
JSONObject temp = new JSONObject();
|
||||
JSONObject temp2 = new JSONObject();
|
||||
if(query.getStartPrice() != null){
|
||||
temp2.put("gte", query.getStartPrice());
|
||||
}
|
||||
if(query.getEndPrice() != null){
|
||||
temp2.put("lte", query.getEndPrice());
|
||||
}
|
||||
param.put("avg_price", temp2);
|
||||
temp.put("range", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(query.getSortField())){
|
||||
JSONObject jsonOrder = new JSONObject();
|
||||
if(query.getOrder()){
|
||||
jsonOrder.put("order", "asc");
|
||||
}else{
|
||||
jsonOrder.put("order", "desc");
|
||||
}
|
||||
JSONObject jsonSort = new JSONObject();
|
||||
jsonSort.put(query.getSortField(), jsonOrder);
|
||||
List<JSONObject> sortJsonList = new ArrayList<JSONObject>();
|
||||
sortJsonList.add(jsonSort);
|
||||
reqBody.put("sort", sortJsonList);
|
||||
}
|
||||
|
||||
if(query.getPager().getStartRow() >= 0){
|
||||
reqBody.put("from", query.getPager().getStartRow());
|
||||
}
|
||||
if(query.getPager().getPageSize() >= 0){
|
||||
reqBody.put("size", query.getPager().getPageSize());
|
||||
}
|
||||
|
||||
if(query.getStatus() != null){
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("status", query.getStatus());
|
||||
JSONObject temp = new JSONObject();
|
||||
temp.put("term", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
|
||||
queryJson.put("must", jsonList);
|
||||
q.put("bool", queryJson);
|
||||
reqBody.put("query", q);
|
||||
//用户名:密码
|
||||
Base64 token = new Base64();
|
||||
String authenticationEncoding = token.encodeAsString(new String(""+ES_USER+":"+ES_PASSWORD+"").getBytes());
|
||||
HttpRequest request = new HttpRequest();
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
headers.put("Content-Type", "application/json");
|
||||
headers.put("Authorization", "Basic "+authenticationEncoding+"");
|
||||
try {
|
||||
String response = request.postWithBody("http://es.fangjia.com:9200/"+query.getTable()+"/_search?rest_total_hits_as_int=true", reqBody, headers, "UTF-8");
|
||||
JSONObject json = JSONObject.fromObject(response);
|
||||
long time2 = System.currentTimeMillis();
|
||||
System.out.println(time2-time1);
|
||||
return json;
|
||||
} catch (HttpRequestException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// private List<JSONObject> queryList(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){
|
||||
// JSONObject json = query(id,category,city,region,name,alias,regionAlias,startDate,endDate, startArea, endArea, startPrice, endPrice, room,root,sort,order,start,limit,table);
|
||||
// if(!json.containsKey("hits") || !json.getJSONObject("hits").containsKey("hits")){
|
||||
// return null;
|
||||
// }
|
||||
// JSONArray hits = json.getJSONObject("hits").getJSONArray("hits");
|
||||
// List<JSONObject> results = new ArrayList<JSONObject>();
|
||||
// for(int i=0 ;i < hits.size(); i++){
|
||||
// JSONObject jsonObject = hits.getJSONObject(i);
|
||||
// results.add(jsonObject);
|
||||
// }
|
||||
// return results;
|
||||
// }
|
||||
|
||||
private List<JSONObject> queryList(SeawaterQuery query){
|
||||
JSONObject json = query(query);
|
||||
if(!json.containsKey("hits") || !json.getJSONObject("hits").containsKey("hits")){
|
||||
return null;
|
||||
}
|
||||
JSONArray hits = json.getJSONObject("hits").getJSONArray("hits");
|
||||
List<JSONObject> results = new ArrayList<JSONObject>();
|
||||
for(int i=0 ;i < hits.size(); i++){
|
||||
JSONObject jsonObject = hits.getJSONObject(i);
|
||||
results.add(jsonObject);
|
||||
}
|
||||
return results;
|
||||
return null;
|
||||
}
|
||||
JSONArray hits = json.getJSONObject("hits").getJSONArray("hits");
|
||||
List<JSONObject> results = new ArrayList<JSONObject>();
|
||||
for(int i=0 ;i < hits.size(); i++){
|
||||
JSONObject jsonObject = hits.getJSONObject(i);
|
||||
results.add(jsonObject);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
private int queryCount(String id,String category, String city, String region, String name, List<String> alias,
|
||||
List<String> regionAlias, Integer startDate, Integer endDate, Integer room, String root,String sort, boolean order, int start, int limit,String table){
|
||||
JSONObject json = query(id,category,city,region,name,alias,regionAlias,startDate,endDate,null, null, null, null, room,root,sort,order,start,limit,table);
|
||||
SeawaterQuery query = new SeawaterQuery();
|
||||
query.setCat(category);
|
||||
query.setCityDisplay(city);
|
||||
query.setRegion(region);
|
||||
query.setDistrictName(name);
|
||||
query.setDistrictAlias(alias);
|
||||
query.setRegionAlias(regionAlias);
|
||||
query.setStartDate(startDate);
|
||||
query.setEndDate(endDate);
|
||||
query.setRoom(room);
|
||||
query.setRootName(root);
|
||||
query.setOrder(order);
|
||||
Pager pager = new Pager();
|
||||
pager.setStartRow(start);
|
||||
pager.setPageSize(limit);
|
||||
query.setPager(pager);
|
||||
query.setTable(table);
|
||||
JSONObject json = query(query);
|
||||
if(!json.containsKey("hits") || !json.getJSONObject("hits").containsKey("total")){
|
||||
return 0;
|
||||
}
|
||||
return json.getJSONObject("hits").getInt("total");
|
||||
}
|
||||
|
||||
private int queryCount(SeawaterQuery query){
|
||||
JSONObject json = query(query);
|
||||
if(!json.containsKey("hits") || !json.getJSONObject("hits").containsKey("total")){
|
||||
return 0;
|
||||
}
|
||||
return json.getJSONObject("hits").getInt("total");
|
||||
}
|
||||
|
||||
private JSONObject wrapQueryParams(SeawaterQuery query){
|
||||
JSONObject reqBody = new JSONObject();
|
||||
JSONObject q = new JSONObject();
|
||||
JSONObject queryJson = new JSONObject();
|
||||
List<JSONObject> jsonList = new ArrayList<JSONObject>();
|
||||
if(StringUtils.isNotBlank(query.getId())) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("_id", query.getId());
|
||||
JSONObject temp = new JSONObject();
|
||||
temp.put("term", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
if(StringUtils.isNotBlank(query.getCat())) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("cat", query.getCat());
|
||||
JSONObject temp = new JSONObject();
|
||||
temp.put("term", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
|
||||
Set<String> namesList = new LinkedHashSet<String>();
|
||||
if(StringUtils.isNotBlank(query.getDistrictName())) {
|
||||
namesList.add(query.getDistrictName());
|
||||
}
|
||||
if(namesList != null && namesList.size() > 0){
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("district_name", namesList);
|
||||
JSONObject temp = new JSONObject();
|
||||
temp.put("terms", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
|
||||
Set<String> regionsList = new LinkedHashSet<String>();
|
||||
if(StringUtils.isNotBlank(query.getRegion())) {
|
||||
regionsList.add(query.getRegion());
|
||||
}
|
||||
if (query.getRegionAlias() != null) {
|
||||
regionsList.addAll(query.getRegionAlias());
|
||||
}
|
||||
if(regionsList != null && regionsList.size() > 0){
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("region", regionsList);
|
||||
JSONObject temp = new JSONObject();
|
||||
temp.put("terms", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(query.getCityDisplay())){
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("city", query.getCityDisplay());
|
||||
JSONObject temp = new JSONObject();
|
||||
temp.put("term", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
if(StringUtils.isNotBlank(query.getEstateType())) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("estate_type", query.getEstateType());
|
||||
JSONObject temp = new JSONObject();
|
||||
temp.put("term", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
if(query.getRoom() != null) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("room", query.getRoom());
|
||||
JSONObject temp = new JSONObject();
|
||||
temp.put("term", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
if(StringUtils.isNotBlank(query.getRootName())) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("root", query.getRootName());
|
||||
JSONObject temp = new JSONObject();
|
||||
temp.put("term", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
|
||||
if(query.getStartDate() != null || query.getEndDate() != null){
|
||||
JSONObject param = new JSONObject();
|
||||
JSONObject temp = new JSONObject();
|
||||
JSONObject temp2 = new JSONObject();
|
||||
if(query.getStartDate() != null){
|
||||
temp2.put("gte", query.getStartDate());
|
||||
}
|
||||
if(query.getEndDate() != null){
|
||||
temp2.put("lte", query.getEndDate());
|
||||
}
|
||||
param.put("p_date", temp2);
|
||||
temp.put("range", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
|
||||
|
||||
if(query.getStartArea() != null || query.getEndArea() != null){
|
||||
JSONObject param = new JSONObject();
|
||||
JSONObject temp = new JSONObject();
|
||||
JSONObject temp2 = new JSONObject();
|
||||
if(query.getStartArea() != null){
|
||||
temp2.put("gte", query.getStartArea());
|
||||
}
|
||||
if(query.getEndArea() != null){
|
||||
temp2.put("lte", query.getEndArea());
|
||||
}
|
||||
param.put("area", temp2);
|
||||
temp.put("range", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
|
||||
if(query.getStartPrice() != null || query.getEndPrice() != null){
|
||||
JSONObject param = new JSONObject();
|
||||
JSONObject temp = new JSONObject();
|
||||
JSONObject temp2 = new JSONObject();
|
||||
if(query.getStartPrice() != null){
|
||||
temp2.put("gte", query.getStartPrice());
|
||||
}
|
||||
if(query.getEndPrice() != null){
|
||||
temp2.put("lte", query.getEndPrice());
|
||||
}
|
||||
param.put("avg_price", temp2);
|
||||
temp.put("range", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
|
||||
if(query.getStatus() != null){
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("status", query.getStatus());
|
||||
JSONObject temp = new JSONObject();
|
||||
temp.put("term", param);
|
||||
jsonList.add(temp);
|
||||
}
|
||||
|
||||
queryJson.put("must", jsonList);
|
||||
q.put("bool", queryJson);
|
||||
reqBody.put("query", q);
|
||||
return reqBody;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user