Merge branch 'open_gj' into 'master'

租金估值报告合并

See merge request !9
This commit is contained in:
2021-04-12 09:17:15 +08:00
43 changed files with 3793 additions and 158 deletions
@@ -0,0 +1,8 @@
package com.fangjia.dal.mongo.dao;
import com.fangjia.dal.MongoDao;
import com.fangjia.dal.mongo.model.DistrictRoomSqmetreRent;
public interface DistrictRoomSqmetreRentDao extends MongoDao<DistrictRoomSqmetreRent> {
}
@@ -0,0 +1,8 @@
package com.fangjia.dal.mongo.dao;
import com.fangjia.dal.MongoDaoImpl;
import com.fangjia.dal.mongo.model.DistrictRoomSqmetreRent;
import com.fangjia.dal.mongo.model.bkoff.DistrictRentCoverage;
public class DistrictRoomSqmetreRentDaoImpl extends MongoDaoImpl<DistrictRoomSqmetreRent> implements DistrictRoomSqmetreRentDao{
}
@@ -0,0 +1,8 @@
package com.fangjia.dal.mongo.dao;
import com.fangjia.dal.MongoDao;
import com.fangjia.dal.MongoDaoImpl;
import com.fangjia.dal.mongo.model.RentDealPrice;
public interface RentDealPriceDao extends MongoDao<RentDealPrice> {
}
@@ -0,0 +1,7 @@
package com.fangjia.dal.mongo.dao;
import com.fangjia.dal.MongoDaoImpl;
import com.fangjia.dal.mongo.model.RentDealPrice;
public class RentDealPriceDaoImpl extends MongoDaoImpl<RentDealPrice> implements RentDealPriceDao{
}
@@ -0,0 +1,126 @@
package com.fangjia.dal.mongo.model;
import com.fangjia.dal.MongoEntity;
import javax.persistence.*;
import java.util.Date;
@Entity
@Table(name = "fangjia.district_room_sqmetre_rent")
public class DistrictRoomSqmetreRent implements MongoEntity {
private String id;
private String city;
private String region;
private String block;
private String districtName;
private int avgPrice;
private String estateType;
private Integer houseType;
private int markup;
private Date creationDate;
private int sDate;
@Override
@Id
@GeneratedValue
@Column(name = "_id", unique = true, nullable = false)
public String getId() {
return id;
}
@Override
public void setId(String id) {
this.id = id;
}
@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 = "block")
public String getBlock() {
return block;
}
public void setBlock(String block) {
this.block = block;
}
@Column(name = "district_name")
public String getDistrictName() {
return districtName;
}
public void setDistrictName(String districtName) {
this.districtName = districtName;
}
@Column(name = "avg_price")
public int getAvgPrice() {
return avgPrice;
}
public void setAvgPrice(int avgPrice) {
this.avgPrice = avgPrice;
}
@Column(name = "estate_type")
public String getEstateType() {
return estateType;
}
public void setEstateType(String estateType) {
this.estateType = estateType;
}
@Column(name = "house_type")
public Integer getHouseType() {
return houseType;
}
public void setHouseType(Integer houseType) {
this.houseType = houseType;
}
@Column(name = "markup")
public int getMarkup() {
return markup;
}
public void setMarkup(int markup) {
this.markup = markup;
}
@Column(name = "c_date")
public Date getCreationDate() {
return creationDate;
}
public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
}
@Column(name = "s_date")
public int getsDate() {
return sDate;
}
public void setsDate(int sDate) {
this.sDate = sDate;
}
}
@@ -0,0 +1,200 @@
package com.fangjia.dal.mongo.model;
import com.fangjia.dal.MongoEntity;
import javax.persistence.*;
import java.util.Date;
@Entity
@Table(name = "fangjia.rent_deal_price")
public class RentDealPrice implements MongoEntity {
private String id;
private String city;
private String region;
private String districtName;
private Double area;
private Integer totalPrice;
private Integer avgPrice;
private String source;
private Integer room;
private Integer hall;
private Integer toilet;
private String fitment;
private String url;
private String direction;
private Integer height;
private Date modificationDate;
private Date tradeDate;
private Date createDate;
@Override
@Id
@GeneratedValue
@Column(name = "_id", unique = true, nullable = false)
public String getId() {
return id;
}
@Override
public void setId(String id) {
this.id = id;
}
@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 = "district_name")
public String getDistrictName() {
return districtName;
}
public void setDistrictName(String districtName) {
this.districtName = districtName;
}
@Column(name = "area")
public Double getArea() {
return area;
}
public void setArea(Double area) {
this.area = area;
}
@Column(name = "total_price")
public Integer getTotalPrice() {
return totalPrice;
}
public void setTotalPrice(Integer totalPrice) {
this.totalPrice = totalPrice;
}
@Column(name = "avg_price")
public Integer getAvgPrice() {
return avgPrice;
}
public void setAvgPrice(Integer avgPrice) {
this.avgPrice = avgPrice;
}
@Column(name = "source")
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
@Column(name = "room")
public Integer getRoom() {
return room;
}
public void setRoom(Integer room) {
this.room = room;
}
@Column(name = "hall")
public Integer getHall() {
return hall;
}
public void setHall(Integer hall) {
this.hall = hall;
}
@Column(name = "toilet")
public Integer getToilet() {
return toilet;
}
public void setToilet(Integer toilet) {
this.toilet = toilet;
}
@Column(name = "fitment")
public String getFitment() {
return fitment;
}
public void setFitment(String fitment) {
this.fitment = fitment;
}
@Column(name = "url")
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
@Column(name = "direction")
public String getDirection() {
return direction;
}
public void setDirection(String direction) {
this.direction = direction;
}
@Column(name = "height")
public Integer getHeight() {
return height;
}
public void setHeight(Integer height) {
this.height = height;
}
@Column(name = "trade_date")
public Date getTradeDate() {
return tradeDate;
}
public void setTradeDate(Date tradeDate) {
this.tradeDate = tradeDate;
}
@Column(name = "create_date")
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
@Column(name = "m_date")
public Date getModificationDate() {
return modificationDate;
}
public void setModificationDate(Date modificationDate) {
this.modificationDate = modificationDate;
}
}
@@ -13,10 +13,10 @@ public interface SeawaterDao extends com.fangjia.dal.SeawaterDao<Seawater> {
Integer room, String root,String table);
Seawater findByIdFromEs(String id,String table);
List<Seawater> findSeawatersFromEs(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[] keys,String table);
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> findHouses(String city, String region, List<String> alias, Integer minPrice, Integer maxPrice, Integer limit);
@@ -29,7 +29,7 @@ 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,false,-1,-1,table);
List<JSONObject> jsonList = queryList(id,null,null,null,null,null,null,null,null, null, null, null, null, null,null,null,false,-1,-1,table);
if(jsonList == null){
return null;
}else{
@@ -42,11 +42,9 @@ 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, Integer room, String root,
String sort, boolean order, int start, int limit, String[] keys,String table) {
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,room,root,sort,order,start,limit,table);
List<JSONObject> jsonList = queryList(null,category,city,region,name,alias,regionAlias,startDate,endDate, startArea, endArea, startPrice, endPrice, room,root,sort,order,start,limit,table);
if(jsonList == null){
return null;
}else{
@@ -55,6 +53,7 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
return seawaterList;
}
@Override
public List<Seawater> findHouses(String city, String region, List<String> alias, Integer minPrice, Integer maxPrice, Integer limit) {
JSONObject reqBody = new JSONObject();
@@ -200,7 +199,7 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
}
private JSONObject query(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){
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){
long time1 = System.currentTimeMillis();
JSONObject reqBody = new JSONObject();
JSONObject q = new JSONObject();
@@ -287,6 +286,37 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
temp.put("range", param);
jsonList.add(temp);
}
if(startArea != null || endArea != null){
JSONObject param = new JSONObject();
JSONObject temp = new JSONObject();
JSONObject temp2 = new JSONObject();
if(startArea != null){
temp2.put("gte", startArea);
}
if(endArea != null){
temp2.put("lte", endArea);
}
param.put("area", temp2);
temp.put("range", param);
jsonList.add(temp);
}
if(startPrice != null || endPrice != null){
JSONObject param = new JSONObject();
JSONObject temp = new JSONObject();
JSONObject temp2 = new JSONObject();
if(startPrice != null){
temp2.put("gte", startPrice);
}
if(endPrice != null){
temp2.put("lte", endPrice);
}
param.put("total_price", temp2);
temp.put("range", param);
jsonList.add(temp);
}
if(StringUtils.isNotBlank(sort)){
JSONObject jsonOrder = new JSONObject();
@@ -331,8 +361,8 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
}
private List<JSONObject> queryList(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,room,root,sort,order,start,limit,table);
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;
}
@@ -347,7 +377,7 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
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,room,root,sort,order,start,limit,table);
JSONObject json = query(id,category,city,region,name,alias,regionAlias,startDate,endDate,null, null, null, null, room,root,sort,order,start,limit,table);
if(!json.containsKey("hits") || !json.getJSONObject("hits").containsKey("total")){
return 0;
}