Merge branch 'master' of http://gitlab.fangjia.com/dev0/main
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
<dependency>
|
||||
<groupId>org.sothis</groupId>
|
||||
<artifactId>sothis-core</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.2.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -154,7 +154,7 @@
|
||||
<dependency>
|
||||
<groupId>com.poseidon</groupId>
|
||||
<artifactId>poseidon-message</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>0.0.1</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.mongodb</groupId>
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
<dependency>
|
||||
<groupId>org.sothis</groupId>
|
||||
<artifactId>sothis-web</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
|
||||
+9
@@ -12,6 +12,7 @@ import com.fangjia.service.mongo.fangjia.SeawaterService;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.sothis.core.util.Pager;
|
||||
import org.sothis.web.mvc.annotation.Param;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Arrays;
|
||||
@@ -116,6 +117,14 @@ public class SeawaterController {
|
||||
return ret;
|
||||
}
|
||||
|
||||
public Object batchDeleteAction(@Param(name="ids") String ids) throws UnsupportedEncodingException {
|
||||
JsonModel ret = new JsonModel();
|
||||
if (StringUtils.isNotBlank(ids)){
|
||||
seawaterService.deleteByIds(ids);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void setSeawaterService(SeawaterService seawaterService) {
|
||||
this.seawaterService = seawaterService;
|
||||
}
|
||||
|
||||
@@ -118,9 +118,13 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<span style="font-size:12px;">查询到<b style="color:red;">${pager.totalRows!}</b>条记录</span>
|
||||
<div>
|
||||
<span style="font-size:12px;">查询到<b style="color:red;">${pager.totalRows!}</b>条记录</span>
|
||||
<input class ="btn btn-primary" id="batchDelete" type="submit" value="批量删除" style="float: right" />
|
||||
</div>
|
||||
<table id="dataSheet" class="table table-hover table-condensed" name="reginTable">
|
||||
<tr>
|
||||
<th style="width:30px;"><input type="checkbox" id="checkAll"/>全选</th>
|
||||
<th style="width:60px;">类型</th>
|
||||
<th style="width:50px;">区域</th>
|
||||
<th style="width:130px;">小区名</th>
|
||||
@@ -142,6 +146,7 @@
|
||||
<#if seawaterList??>
|
||||
<#list seawaterList as it>
|
||||
<tr>
|
||||
<td><input type="checkbox" name="houseCheck" value="${it.id}"/></td>
|
||||
<td>
|
||||
<#if it.category! == 'sell'>
|
||||
二手房
|
||||
@@ -249,7 +254,7 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
changeCity('${cityDisplay!}');
|
||||
|
||||
$(".hrefClick").click(function(){
|
||||
@@ -336,8 +341,48 @@
|
||||
$("#roomSpan").hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 全选
|
||||
$("#checkAll").click(function(){
|
||||
$('input[name="houseCheck"]').each(function() {
|
||||
var _this = this
|
||||
if (_this.checked == true) {
|
||||
_this.checked = false
|
||||
} else {
|
||||
_this.checked = true
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
$("#batchDelete").click(function(){
|
||||
if(confirm('确认要删除所选的数据吗?')) {
|
||||
var ids = "";
|
||||
$('input:checkbox[name=houseCheck]:checked').each(function() {
|
||||
var _this = $(this);
|
||||
ids += _this.val() + ","
|
||||
});
|
||||
if (ids == "") {
|
||||
alert("请选择数据")
|
||||
return false;
|
||||
}
|
||||
jQuery.ajax({
|
||||
type: 'POST',
|
||||
url: '../seawater/batchDelete',
|
||||
data:{ids:ids},
|
||||
dataType: 'json',
|
||||
timeout: 100000,
|
||||
success: function(model) {
|
||||
alert("批量删除操作成功");
|
||||
location.reload();
|
||||
},
|
||||
error : function() {
|
||||
//alert("操作失败");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
</html>
|
||||
</#compress>
|
||||
@@ -277,6 +277,39 @@ public class BaiDuApiUtils {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param coords
|
||||
* @param from
|
||||
* @return
|
||||
*/
|
||||
public static JSONObject geoconv(String coords,int from){
|
||||
Map<String,String> params = new HashMap<String, String>();
|
||||
params.put("output", "json");
|
||||
params.put("ak", AK);
|
||||
params.put("coords", coords);
|
||||
params.put("from", String.valueOf(from));
|
||||
HttpRequest request = new HttpRequest();
|
||||
try{
|
||||
String result = request.get("http://api.map.baidu.com/geoconv/v1/",params,"UTF-8");
|
||||
JSONObject json = JSONObject.fromObject(result);
|
||||
while(!(json == null || json.containsKey("result") || json.getJSONArray("result").size() == 0)){
|
||||
changeAK();
|
||||
result = request.get("http://api.map.baidu.com/geoconv/v1/",params,"UTF-8");
|
||||
json = JSONObject.fromObject(result);
|
||||
Thread.sleep(1000 * 60);
|
||||
}
|
||||
if(json.getInt("status") >= 300){
|
||||
changeAK();
|
||||
json = geoconv(coords, from);
|
||||
}
|
||||
return json.getJSONArray("result").getJSONObject(0);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static JSONObject geoconv(String coords, int from, int to){
|
||||
Map<String,String> params = new HashMap<String, String>();
|
||||
|
||||
@@ -312,25 +312,6 @@ public class DataUtil {
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* 加密图片url
|
||||
*
|
||||
* @param u
|
||||
* @param s
|
||||
* @param t
|
||||
* @return
|
||||
*/
|
||||
public static String encodePicUrl(String u, String s, String t) {
|
||||
if (StringUtils.isBlank(u)) {
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
try {
|
||||
return SecurityUtil.encode("u=" + URLEncoder.encode(u, "UTF-8") + "&s=" + s + "&t=" + t);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
return SecurityUtil.encode("u=" + u + "&s=" + s + "&t=" + t);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 把字符串以16进制数值显示出来
|
||||
*
|
||||
@@ -1805,6 +1786,25 @@ public class DataUtil {
|
||||
return b2.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 加密图片url
|
||||
*
|
||||
* @param u
|
||||
* @param s
|
||||
* @param t
|
||||
* @return
|
||||
*/
|
||||
public static String encodePicUrl(String u, String s, String t) {
|
||||
if (StringUtils.isBlank(u)) {
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
try {
|
||||
return SecurityUtil.encode("u=" + URLEncoder.encode(u, "UTF-8") + "&s=" + s + "&t=" + t);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
return SecurityUtil.encode("u=" + u + "&s=" + s + "&t=" + t);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(getFirstChar("文裕花园"));
|
||||
System.out.println(getFirstChar("文怡花园"));
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.fangjia.coresite.controllers;
|
||||
|
||||
import com.fangjia.coresite.model.FangjiaModel;
|
||||
|
||||
public class GuzhiController {
|
||||
|
||||
public FangjiaModel mapAction(FangjiaModel model){
|
||||
return model;
|
||||
}
|
||||
}
|
||||
@@ -124,7 +124,7 @@
|
||||
<a class="partner11"></a>
|
||||
<a class="partner12"></a>
|
||||
<a class="partner13"></a>
|
||||
<a class="partner14"></a>
|
||||
<#-- <a class="partner14"></a>-->
|
||||
<a class="partner15"></a>
|
||||
<a class="partner16" style="margin-right:0;"></a>
|
||||
<a class="partner21"></a>
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<#include "/jsconstants.ftl" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="container" style="background:url('${staticUrl}/images/map/blue.jpg') no-repeat;background-size:100% 100%;">
|
||||
<div id="echartsMap" style="min-width: 300px; height: 800px;padding-top: 32px;"></div>
|
||||
</div>
|
||||
<script type="text/javascript" src="${staticUrl}/js/jquery-3.6.0.min.js?v=${version}"></script>
|
||||
<script type="text/javascript" src="${staticUrl}/js/fangjia/v5/echarts.min.5.0.2.js?v=${version}"></script>
|
||||
<script type="text/javascript" src="${staticUrl}/js/shanghai.js?v=${version}"></script>
|
||||
<script>
|
||||
//省
|
||||
$("#container").height($(window).height() - 20)
|
||||
function echartsMap() {
|
||||
echarts.registerMap('shanghai', data);
|
||||
option = {
|
||||
|
||||
visualMap: {
|
||||
min: 18,
|
||||
max: 106,
|
||||
right: '3%',
|
||||
text: ['最高', '最低'],
|
||||
realtime: false,
|
||||
calculable: true,
|
||||
opacity: 0,
|
||||
textStyle: {
|
||||
color: "#FF7F24"
|
||||
},
|
||||
inRange: {
|
||||
color: ['lightskyblue', 'yellow', 'orangered']
|
||||
}
|
||||
},
|
||||
textStyle: {
|
||||
color: "#FF1493",
|
||||
fontSize: 14,
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
formatter: function (arg) {
|
||||
return arg.name + '<br/>' + rent[arg.name] + '元/平米/月'
|
||||
}
|
||||
},
|
||||
series: [{
|
||||
type: 'map',
|
||||
//这里的“map”值需要与下面的“echarts.registerMap”值对应
|
||||
map: 'shanghai',
|
||||
zoom: 1.25,
|
||||
roam: false,
|
||||
label: {
|
||||
normal: {
|
||||
show: true
|
||||
},
|
||||
emphasis: {
|
||||
show: true
|
||||
}
|
||||
},
|
||||
layoutSize: '100%',
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: "#FFF",
|
||||
label: {
|
||||
show: true
|
||||
}
|
||||
},
|
||||
},
|
||||
data: [{"name": "奉贤", "value": 23}, {"name": "青浦", "value": 30}, {
|
||||
"name": "金山",
|
||||
"value": 19
|
||||
}, {"name": "崇明", "value": 18}, {"name": "嘉定", "value": 37}, {"name": "松江", "value": 41}, {
|
||||
"name": "浦东",
|
||||
"value": 53
|
||||
}, {"name": "闵行", "value": 53}, {"name": "宝山", "value": 59}, {"name": "杨浦", "value": 82}, {
|
||||
"name": "静安",
|
||||
"value": 92
|
||||
}, {"name": "虹口", "value": 79}, {"name": "普陀", "value": 85}, {"name": "长宁", "value": 99}, {
|
||||
"name": "徐汇",
|
||||
"value": 96
|
||||
}, {"name": "黄浦", "value": 106}],
|
||||
nameMap: {}
|
||||
}]
|
||||
};
|
||||
myEcharts = echarts.init(document.getElementById("echartsMap"));
|
||||
myEcharts.setOption(option);
|
||||
window.addEventListener('resize', () => {
|
||||
myEcharts.resize();
|
||||
});
|
||||
};
|
||||
echartsMap();
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -33,7 +33,7 @@
|
||||
<dependency>
|
||||
<groupId>org.sothis</groupId>
|
||||
<artifactId>sothis-core</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.2.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@@ -205,7 +205,6 @@ public abstract class ElasticDaoImpl<E extends MongoEntity> extends AbstractJpaC
|
||||
|
||||
@Override
|
||||
public void deleteByIds(List<String> idList) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+8
@@ -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> {
|
||||
}
|
||||
+8
@@ -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{
|
||||
}
|
||||
+126
@@ -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,11 +13,9 @@ 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);
|
||||
|
||||
}
|
||||
|
||||
+86
-10
@@ -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();
|
||||
@@ -97,6 +96,44 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
return new ArrayList<Seawater>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
deleteByIds(Arrays.asList(id));
|
||||
}
|
||||
|
||||
private Map<String, String> buildHeader() {
|
||||
Base64 token = new Base64();
|
||||
String authenticationEncoding = token.encodeAsString(new String("" + ES_USER + ":" + ES_PASSWORD + "").getBytes());
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
headers.put("Content-Type", "application/json");
|
||||
headers.put("Authorization", "Basic " + authenticationEncoding + "");
|
||||
return headers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByIds(List<String> idList) {
|
||||
HttpRequest request = new HttpRequest();
|
||||
|
||||
JSONObject reqBody = new JSONObject();
|
||||
JSONObject query = new JSONObject();
|
||||
JSONObject bool = new JSONObject();
|
||||
JSONArray must = new JSONArray();
|
||||
must.add(addTerms("_id", idList));
|
||||
bool.put("must", must);
|
||||
query.put("bool", bool);
|
||||
reqBody.put("query", query);
|
||||
|
||||
JSONObject script = new JSONObject();
|
||||
script.put("source", "ctx._source.status=1");
|
||||
reqBody.put("script", script);
|
||||
|
||||
try {
|
||||
request.postWithBody("http://es.fangjia.com:9200/seawater/_update_by_query", 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();
|
||||
@@ -200,7 +237,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 +324,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();
|
||||
@@ -308,6 +376,14 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
if(limit >= 0){
|
||||
reqBody.put("size", limit);
|
||||
}
|
||||
|
||||
// ²»Õ¹Ê¾É¾³ý
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("status", 0);
|
||||
JSONObject temp = new JSONObject();
|
||||
temp.put("term", param);
|
||||
jsonList.add(temp);
|
||||
|
||||
query.put("must", jsonList);
|
||||
q.put("bool", query);
|
||||
reqBody.put("query", q);
|
||||
@@ -319,7 +395,7 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
|
||||
headers.put("Content-Type", "application/json");
|
||||
headers.put("Authorization", "Basic "+authenticationEncoding+"");
|
||||
try {
|
||||
String response = request.postWithBody("http://es.fangjia.com:9200/"+table+"/_search", reqBody, headers, "UTF-8");
|
||||
String response = request.postWithBody("http://es.fangjia.com:9200/"+table+"/_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);
|
||||
@@ -331,8 +407,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 +423,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;
|
||||
}
|
||||
|
||||
@@ -147,5 +147,23 @@
|
||||
<version>1.0.0</version>
|
||||
<classifier>jdk18</classifier>
|
||||
</dependency>
|
||||
<!-- html转pdf -->
|
||||
<dependency>
|
||||
<groupId>org.xhtmlrenderer</groupId>
|
||||
<artifactId>core-renderer</artifactId>
|
||||
<version>R8</version>
|
||||
</dependency>
|
||||
<!-- 绘制折线图等 -->
|
||||
<dependency>
|
||||
<groupId>org.jfree</groupId>
|
||||
<artifactId>jfreechart</artifactId>
|
||||
<version>1.5.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.sothis</groupId>
|
||||
<artifactId>sothis-core</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
+42
-4
@@ -1691,7 +1691,14 @@ public class AddressController {
|
||||
}
|
||||
String result = addressMatchProxyService.standard(convertModelToMap(model));
|
||||
if (result != null) {
|
||||
mav.setModel(result);
|
||||
JSONObject json = JSONObject.fromObject(result);
|
||||
int code = json.getInt("code");
|
||||
String msg = json.getString("msg");
|
||||
BasicModel basicModel = new BasicModel(code, msg);
|
||||
if(json.containsKey("result")){
|
||||
basicModel.setResult(json.get("result"));
|
||||
}
|
||||
mav.setModel(basicModel);
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
|
||||
}
|
||||
@@ -1730,16 +1737,20 @@ public class AddressController {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("地址不能为空"));
|
||||
return mav;
|
||||
}
|
||||
if (StringUtils.isBlank(model.getCity())) {
|
||||
/*if (StringUtils.isBlank(model.getCity())) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("城市不能为空"));
|
||||
return mav;
|
||||
}
|
||||
}*/
|
||||
MatchParams matchParams = new MatchParams();
|
||||
matchParams.setCity(model.getCity());
|
||||
matchParams.setAddress(model.getAddress());
|
||||
matchParams.setAddressParserGoal(AddressParserGoal.Match);
|
||||
matchParams.setPreciseLevel(PreciseLevel.STRICT);
|
||||
matchParams.setProvince(model.getProvince());
|
||||
|
||||
// matchParams.setUseMap(true);
|
||||
matchParams.setUseAliyunApi(true);
|
||||
matchParams.setContainsLocation(model.isContainsLocation());
|
||||
Building building = addressParserService.standard(matchParams);
|
||||
Address address = building.getSearchAddress();
|
||||
UniversalDto dto = UniversalDto.newDto();
|
||||
@@ -1754,11 +1765,38 @@ public class AddressController {
|
||||
dto.append("township", address.getTownship());
|
||||
dto.append("street", address.getStreet());
|
||||
dto.append("streetNumber", address.getStreetNumber());
|
||||
dto.append("name", building.getSuggestName());
|
||||
if(StringUtils.isBlank(building.getSuggestName())){
|
||||
if(StringUtils.isNotBlank(address.getParsedPropertyName())){
|
||||
dto.append("name", address.getParsedPropertyName());
|
||||
}else if(StringUtils.isNotBlank(address.getOrgKeywords())){
|
||||
dto.append("name", address.getOrgKeywords());
|
||||
}
|
||||
}else{
|
||||
dto.append("name", building.getSuggestName());
|
||||
}
|
||||
if(StringUtils.isBlank(address.getStreet()) && StringUtils.isNotBlank(building.getAddress())){
|
||||
String addr = building.getAddress();
|
||||
String street = AddressParserUtil.extractStreet(addr);
|
||||
if(street != null){
|
||||
dto.append("street", street);
|
||||
if(addr.length() != street.length()){
|
||||
dto.append("streetNumber", AddressParserUtil.match(AddressParserUtil.STREET_NUMBER_CONNECTOR_PATTERN, addr));
|
||||
}
|
||||
}else if(StringUtils.isNotBlank(building.getStreet())){
|
||||
dto.append("street", building.getStreet());
|
||||
if(StringUtils.isNotBlank(building.getStreetno())){
|
||||
dto.append("streetNumber", building.getStreetno());
|
||||
}
|
||||
}
|
||||
}
|
||||
dto.append("buildingNumber", address.getBuildingNumber());
|
||||
dto.append("unitNumber", address.getUnitNumber());
|
||||
dto.append("roomNumber", address.getRoomNumber());
|
||||
dto.append("formattedAddress", address.getFormattedAddress());
|
||||
if(matchParams.isContainsLocation()){
|
||||
dto.append("lat", building.getLat());
|
||||
dto.append("lng", building.getLng());
|
||||
}
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(dto));
|
||||
return mav;
|
||||
}
|
||||
|
||||
+332
-41
@@ -28,11 +28,16 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.fangjia.core.util.*;
|
||||
import com.fangjia.dal.*;
|
||||
import com.fangjia.dal.mongo.model.*;
|
||||
import com.fangjia.dal.seawater.dao.SeawaterDao;
|
||||
import com.fangjia.dal.seawater.model.Seawater;
|
||||
import com.fangjia.open.dto.*;
|
||||
import com.fangjia.service.district.*;
|
||||
import com.fangjia.service.mongo.fangjia.*;
|
||||
import com.fangjia.service.open.*;
|
||||
import com.fangjia.service.util.DistrictScoreUtil;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
@@ -56,16 +61,6 @@ import org.sothis.web.mvc.annotation.Param;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import com.fangjia.core.RegionData;
|
||||
import com.fangjia.core.util.AnalyticsUtil;
|
||||
import com.fangjia.core.util.CoordPoint;
|
||||
import com.fangjia.core.util.CoordinateConversion;
|
||||
import com.fangjia.core.util.DataUtil;
|
||||
import com.fangjia.core.util.DateUtil;
|
||||
import com.fangjia.core.util.GeoUtils;
|
||||
import com.fangjia.core.util.GeocodeUtils;
|
||||
import com.fangjia.core.util.HouseValidator;
|
||||
import com.fangjia.core.util.LoggerFactory;
|
||||
import com.fangjia.core.util.SecurityUtil;
|
||||
import com.fangjia.dal.common.DistrictKey;
|
||||
import com.fangjia.dal.common.ServerAreaData;
|
||||
import com.fangjia.dal.datastore.model.House;
|
||||
@@ -81,21 +76,6 @@ import com.fangjia.dal.sql.model.FjtEvaluation;
|
||||
import com.fangjia.dal.sql.model.User;
|
||||
import com.fangjia.open.APIConstant;
|
||||
import com.fangjia.open.FangjiaApiUtil;
|
||||
import com.fangjia.open.dto.AroundDto;
|
||||
import com.fangjia.open.dto.BuildingDto;
|
||||
import com.fangjia.open.dto.DistrictAnalysisDto;
|
||||
import com.fangjia.open.dto.DistrictInfoDto;
|
||||
import com.fangjia.open.dto.FloorPlanDto;
|
||||
import com.fangjia.open.dto.HouseAuctionDetailDto;
|
||||
import com.fangjia.open.dto.HouseAuctionDto;
|
||||
import com.fangjia.open.dto.HouseDealPriceDetailDto;
|
||||
import com.fangjia.open.dto.HouseDealPriceDto;
|
||||
import com.fangjia.open.dto.HouseEvaluateNumDto;
|
||||
import com.fangjia.open.dto.PropertyDto;
|
||||
import com.fangjia.open.dto.RoomDto;
|
||||
import com.fangjia.open.dto.StationDto;
|
||||
import com.fangjia.open.dto.UnitNumberDto;
|
||||
import com.fangjia.open.dto.UniversalDto;
|
||||
import com.fangjia.open.interceptors.AuthenticationBean;
|
||||
import com.fangjia.open.interceptors.Authority;
|
||||
import com.fangjia.open.interceptors.Role;
|
||||
@@ -137,24 +117,9 @@ import com.fangjia.service.datastore.FieldFilterService;
|
||||
import com.fangjia.service.datastore.HouseService;
|
||||
import com.fangjia.service.datastore.NoHouseDistrictService;
|
||||
import com.fangjia.service.datastore.OpenApiLogService;
|
||||
import com.fangjia.service.district.DistrictStatRentService;
|
||||
import com.fangjia.service.district.DistrictStatService;
|
||||
import com.fangjia.service.mongo.bkoff.HouseAuctionService;
|
||||
import com.fangjia.service.mongo.bkoff.HouseLoudongService;
|
||||
import com.fangjia.service.mongo.bkoff.LoudongService;
|
||||
import com.fangjia.service.mongo.fangjia.AddressMatchLogService;
|
||||
import com.fangjia.service.mongo.fangjia.AverageAnalyService;
|
||||
import com.fangjia.service.mongo.fangjia.AverageStatisticsService;
|
||||
import com.fangjia.service.mongo.fangjia.BatchEvaluateService;
|
||||
import com.fangjia.service.mongo.fangjia.BizShopService;
|
||||
import com.fangjia.service.mongo.fangjia.BusStationService;
|
||||
import com.fangjia.service.mongo.fangjia.CityHotService;
|
||||
import com.fangjia.service.mongo.fangjia.DealPriceService;
|
||||
import com.fangjia.service.mongo.fangjia.DistrictAttentionRankService;
|
||||
import com.fangjia.service.mongo.fangjia.DistrictHotService;
|
||||
import com.fangjia.service.mongo.fangjia.DistrictHouseResourceStatService;
|
||||
import com.fangjia.service.mongo.fangjia.NetworkPriceService;
|
||||
import com.fangjia.service.mongo.fangjia.ServerAreaService;
|
||||
import com.fangjia.service.sql.ApiUserService;
|
||||
import com.fangjia.service.sql.FjtEvaluationService;
|
||||
import com.fangjia.service.sql.UserService;
|
||||
@@ -166,7 +131,7 @@ import com.google.common.collect.Sets;
|
||||
import com.mongodb.BasicDBObject;
|
||||
import com.mongodb.DBObject;
|
||||
|
||||
@Authority(role = Role.USER)
|
||||
//@Authority(role = Role.USER)
|
||||
public class PropertyController {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PropertyController.class);
|
||||
@@ -208,6 +173,8 @@ public class PropertyController {
|
||||
private FangjiaOfficialAreaService fangjiaOfficialAreaService;
|
||||
private RegionAnaDataService regionAnaDataService;
|
||||
private SeawaterDao seawaterDao;
|
||||
private SeawaterService seawaterService;
|
||||
private SqmetreRentService sqmetreRentService;
|
||||
|
||||
private FileDao fileDao = FileDao.getInstance();
|
||||
private static final int DEFAULT_PAGE_SIZE = 20;
|
||||
@@ -217,6 +184,10 @@ public class PropertyController {
|
||||
|
||||
private AutoCompleteService autoCompleteService;
|
||||
|
||||
|
||||
private DistrictRoomSqmetreRentService districtRoomSqmetreRentService;
|
||||
private RentDealPriceService rentDealPriceService;
|
||||
|
||||
private static final int EVALUATE_SHOW_DETAIL = 1;
|
||||
private static final Map<String, String> PROPERTY_TYPES = new HashMap<String, String>() {
|
||||
{
|
||||
@@ -4987,6 +4958,310 @@ public class PropertyController {
|
||||
return mav;
|
||||
}
|
||||
|
||||
/***
|
||||
* 小区租金估值报告
|
||||
* @param model
|
||||
* @param request
|
||||
* @return
|
||||
* @throws NumberFormatException
|
||||
* @throws IllegalAccessException
|
||||
*/
|
||||
public Object rentReportAction(PropertyEvaluationModel model, HttpServletRequest request)throws NumberFormatException, IllegalAccessException {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if (StringUtils.isBlank(model.getCity()) || StringUtils.isBlank(model.getName())
|
||||
|| StringUtils.isBlank(model.getDistrict()) || model.getSize() <= 0) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数非法:城市,区域,小区名,面积(size)为必填项"));
|
||||
return mav;
|
||||
}
|
||||
if (model.getCity().endsWith("市")) {
|
||||
model.setCity(model.getCity().replaceAll("市$", ""));
|
||||
}
|
||||
if (StringUtils.isNotBlank(request.getParameter("calDate"))) {
|
||||
Date calDate = null;
|
||||
try {
|
||||
calDate = org.apache.commons.lang.time.DateUtils.parseDate(request.getParameter("calDate"), new String[] { "yyyy-MM-dd" });
|
||||
} catch (ParseException e) {
|
||||
|
||||
}
|
||||
if (calDate == null) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("calDate:数据类型不合法"));
|
||||
return mav;
|
||||
} else {
|
||||
model.setCalDate(calDate);
|
||||
}
|
||||
}
|
||||
/* 先到CPDB库中查找小区 */
|
||||
District district = districtService.findByNameAndAlias(model.getCity(), model.getDistrict(), model.getName(),
|
||||
"district");
|
||||
if (district == null) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("该小区不存在"));
|
||||
return mav;
|
||||
}
|
||||
model.setName(district.getName());
|
||||
|
||||
|
||||
if (model.getMaxFloor() != null && (model.getMaxFloor() <= 0 || model.getMaxFloor() > 59)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("maxFloor取值非法,正确范围[1,60)"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
if (model.getFloor() != null && (model.getFloor() <= 0 || model.getFloor() > 59)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("floor取值非法,正确范围[1,60)"));
|
||||
return mav;
|
||||
}
|
||||
if (model.getMaxFloor() != null && model.getFloor() != null && model.getFloor() > model.getMaxFloor()) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("所在楼层不能大于总楼层"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
model.setRegion(district.getRegion());
|
||||
model.setDistrictName(district.getName());
|
||||
if (StringUtils.isBlank(model.getPropertyType())) {
|
||||
if (district.getEstateType2() != null && district.getEstateType2().contains("别墅")) {
|
||||
model.setPropertyType("1");
|
||||
}
|
||||
}
|
||||
|
||||
if (model.getCalDate() != null) {
|
||||
if (new Date().before(model.getCalDate())) {
|
||||
model.setCalDate(DateUtil.getFirstDayOfWeek(new Date()));
|
||||
} else {
|
||||
model.setCalDate(DateUtil.getFirstDayOfWeek(model.getCalDate()));
|
||||
}
|
||||
} else {
|
||||
model.setCalDate(DateUtil.getFirstDayOfWeek(new Date()));
|
||||
}
|
||||
|
||||
Evaluation evaluation = buildEvaluation(model, request);
|
||||
evaluation.setSource("api_property_evaluate_rent");
|
||||
evaluation = evaluationService.evaluateRent(district, evaluation, model.getCalDate());
|
||||
|
||||
|
||||
if (evaluation.getTotalPrice() != null && evaluation.getTotalPrice() != 0) {
|
||||
evaluation.setAvgPrice((int)(evaluation.getTotalPrice()/evaluation.getArea()));
|
||||
Map<String, Object> districtPriceMap = new HashMap<String, Object>();
|
||||
districtPriceMap.put("city", district.getCity());
|
||||
districtPriceMap.put("district", district.getRegion());
|
||||
districtPriceMap.put("name", district.getName());
|
||||
districtPriceMap.put("address", district.getAddress());
|
||||
districtPriceMap.put("totalPrice", evaluation.getTotalPrice());
|
||||
districtPriceMap.put("totalPriceUpper", CNNMFilter.convert(String.valueOf(evaluation.getTotalPrice())));
|
||||
districtPriceMap.put("cal_date", DateUtil.formatByPattern(new Date(), "yyyy/MM/dd"));
|
||||
districtPriceMap.put("direction", evaluation.getDirection());
|
||||
districtPriceMap.put("size", evaluation.getArea());
|
||||
districtPriceMap.put("floor", model.getFloor());
|
||||
districtPriceMap.put("height", model.getHeight());
|
||||
districtPriceMap.put("fitment", evaluation.getFitment());
|
||||
|
||||
Integer startPrice = (int)(evaluation.getTotalPrice() - evaluation.getTotalPrice()*0.2);
|
||||
Integer endPrice = (int)(evaluation.getTotalPrice() + evaluation.getTotalPrice()*0.2);
|
||||
|
||||
//周边相似小区
|
||||
if (null == model.getRadius()) {// 设置默认值
|
||||
model.setRadius(1000);
|
||||
}
|
||||
String[] fields = { "city", "region", "name", "estateType2", "id","finishBuildingDate"};
|
||||
List<District> allDistricts = districtService.findNearestDistrict(district, model.getRadius(), fields, Integer.MAX_VALUE);
|
||||
//按条件过滤相似小区
|
||||
Integer buildYear = null;
|
||||
List<District> districts = null;
|
||||
if(StringUtils.isNotBlank(district.getFinishBuildingDate())){
|
||||
buildYear = DistrictScoreUtil.parseStringToDate(district.getFinishBuildingDate());
|
||||
if(buildYear!=null){
|
||||
districts = new ArrayList<District>();
|
||||
int startYear = buildYear -7;
|
||||
int endYear = buildYear + 7;
|
||||
for(District dist : allDistricts){
|
||||
if(StringUtils.isNotBlank(dist.getFinishBuildingDate())){
|
||||
int simlarDistYear = DistrictScoreUtil.parseStringToDate(district.getFinishBuildingDate());
|
||||
if(simlarDistYear>=startYear && simlarDistYear<=endYear && StringUtils.isNotBlank(district.getEstateType2()) && StringUtils.isNotBlank(dist.getEstateType2()) && district.getEstateType2().equals(dist.getEstateType2())){
|
||||
districts.add(dist);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//相似房源
|
||||
Double startArea = model.getSize() - model.getSize()*0.1;
|
||||
Double endArea = model.getSize() + model.getSize()*0.1;
|
||||
Integer startDate = Integer.parseInt(org.apache.tools.ant.util.DateUtils.format(DateUtil.addMonthToDate(new Date(), -12), "yyyyMMdd"));
|
||||
List<Seawater> houses = seawaterService.findSeawatersFromEs2("rent", district.getCity(), district.getRegion(), district.getName(), null, null, startDate, null,
|
||||
startArea, endArea, startPrice, endPrice, null, null, "p_date", false, 1, 5 , null,"seawater-20*/_doc");
|
||||
//无评估小区房源用周边相似小区的房源
|
||||
if(null == houses || houses.size()==0){
|
||||
for (District dist : districts) {
|
||||
houses = seawaterService.findSeawatersFromEs2("rent", dist.getCity(), dist.getRegion(), dist.getName(), null, null, startDate, null,
|
||||
startArea, endArea, startPrice, endPrice, null, null, "p_date", false, 1, 5 , null,"seawater-20*/_doc");
|
||||
if(houses!=null && houses.size()>0){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
districtPriceMap.put("houses", houses);
|
||||
|
||||
//周边相似小区租金
|
||||
Integer room = null;
|
||||
if(model.getRoom()!=0){
|
||||
room = model.getRoom();
|
||||
}else{
|
||||
room = houseService.getDistrictRoomType((float)model.getSize());
|
||||
}
|
||||
if (null != districts) {
|
||||
if (null != room) {
|
||||
List<DistrictHouseDtao> dtos = new ArrayList<DistrictHouseDtao>();
|
||||
Date weekend = DateUtil.getFirstDayOfWeek(new Date());
|
||||
for (District dist : districts) {
|
||||
|
||||
List<DistrictRoomSqmetreRent> districtRoomSqmetreRents = districtRoomSqmetreRentService.findDistrictRoomSqmetreRents(dist, 1, room);
|
||||
|
||||
///List<DistrictStatRent> districtStatRents = districtStatRentService.findLatestDistrictStatRent(dist, 1, room);
|
||||
if (null != districtRoomSqmetreRents && districtRoomSqmetreRents.size() > 0) {
|
||||
DistrictRoomSqmetreRent districtRoomSqmetreRent = districtRoomSqmetreRents.get(0);
|
||||
if (districtRoomSqmetreRent.getAvgPrice() > 0) {
|
||||
|
||||
int startSqPrice = (int)(evaluation.getAvgPrice() - evaluation.getAvgPrice()*0.1);
|
||||
int endSqPrice = (int)(evaluation.getAvgPrice() + evaluation.getAvgPrice()*0.1);
|
||||
// SqmetreRent sqmetreRent = sqmetreRentService.findNearestSqmetreRent(dist.getCity(), dist.getRegion(), dist.getName(), DateUtil.formatToYYYYMMDD(weekend), "district");
|
||||
if(districtRoomSqmetreRent.getAvgPrice()>=startSqPrice && districtRoomSqmetreRent.getAvgPrice()<=endSqPrice){
|
||||
DistrictHouseDtao dto = new DistrictHouseDtao();
|
||||
dto.setCity(dist.getCity());
|
||||
dto.setRegion(dist.getRegion());
|
||||
dto.setDistrictName(dist.getName());
|
||||
dto.setSqAvgPrice(districtRoomSqmetreRent.getAvgPrice());
|
||||
dto.setRoom(room);
|
||||
dtos.add(dto);
|
||||
if(dtos.size()>=5){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
districtPriceMap.put("districts", dtos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//近一年户型租金走势
|
||||
Map<String, Object> trendsMap = districtRoomSqmetreRentService.getRentTrends(district.getCity(), district.getRegion(), district.getName(), room, -12);
|
||||
// Map<String, Object> trendsMap = districtStatRentService.getRentTrend(district.getCity(), district.getRegion(), district.getDistrictName(), -12);
|
||||
districtPriceMap.put("trends", trendsMap);
|
||||
|
||||
|
||||
//成交的租房房源
|
||||
List<RentDealPrice> rentTrades = rentDealPriceService.getRentDealPrices(district.getCity(), district.getRegion(), district.getName(), 5);
|
||||
districtPriceMap.put("trades", rentTrades);
|
||||
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(districtPriceMap));
|
||||
return mav;
|
||||
} else {
|
||||
|
||||
mav.setModel(BasicModel.buildOKModel().setMsg("暂时不支持该小区的租金估价").markNoData());
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Object evaluateRentAction(PropertyEvaluationModel model, HttpServletRequest request)throws NumberFormatException, IllegalAccessException {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if (StringUtils.isBlank(model.getCity()) || StringUtils.isBlank(model.getName())
|
||||
|| StringUtils.isBlank(model.getDistrict()) || model.getSize() <= 0) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数非法:城市,区域,小区名,面积(size)为必填项"));
|
||||
return mav;
|
||||
}
|
||||
if (model.getCity().endsWith("市")) {
|
||||
model.setCity(model.getCity().replaceAll("市$", ""));
|
||||
}
|
||||
if (StringUtils.isNotBlank(request.getParameter("calDate"))) {
|
||||
Date calDate = null;
|
||||
try {
|
||||
calDate = org.apache.commons.lang.time.DateUtils.parseDate(request.getParameter("calDate"), new String[] { "yyyy-MM-dd" });
|
||||
} catch (ParseException e) {
|
||||
|
||||
}
|
||||
if (calDate == null) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("calDate:数据类型不合法"));
|
||||
return mav;
|
||||
} else {
|
||||
model.setCalDate(calDate);
|
||||
}
|
||||
}
|
||||
/* 先到CPDB库中查找小区 */
|
||||
District district = districtService.findByNameAndAlias(model.getCity(), model.getDistrict(), model.getName(),
|
||||
"district");
|
||||
if (district == null) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("该小区不存在"));
|
||||
return mav;
|
||||
}
|
||||
model.setName(district.getName());
|
||||
|
||||
|
||||
if (model.getMaxFloor() != null && (model.getMaxFloor() <= 0 || model.getMaxFloor() > 59)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("maxFloor取值非法,正确范围[1,60)"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
if (model.getFloor() != null && (model.getFloor() <= 0 || model.getFloor() > 59)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("floor取值非法,正确范围[1,60)"));
|
||||
return mav;
|
||||
}
|
||||
if (model.getMaxFloor() != null && model.getFloor() != null && model.getFloor() > model.getMaxFloor()) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("所在楼层不能大于总楼层"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
model.setRegion(district.getRegion());
|
||||
model.setDistrictName(district.getName());
|
||||
if (StringUtils.isBlank(model.getPropertyType())) {
|
||||
if (district.getEstateType2() != null && district.getEstateType2().contains("别墅")) {
|
||||
model.setPropertyType("1");
|
||||
}
|
||||
}
|
||||
|
||||
if (model.getCalDate() != null) {
|
||||
if (new Date().before(model.getCalDate())) {
|
||||
model.setCalDate(DateUtil.getFirstDayOfWeek(new Date()));
|
||||
} else {
|
||||
model.setCalDate(DateUtil.getFirstDayOfWeek(model.getCalDate()));
|
||||
}
|
||||
} else {
|
||||
model.setCalDate(DateUtil.getFirstDayOfWeek(new Date()));
|
||||
}
|
||||
|
||||
Evaluation evaluation = buildEvaluation(model, request);
|
||||
evaluation.setSource("api_property_evaluate_rent");
|
||||
evaluation = evaluationService.evaluateRent(district, evaluation, model.getCalDate());
|
||||
|
||||
|
||||
if (evaluation.getTotalPrice() != null && evaluation.getTotalPrice() != 0) {
|
||||
Map<String, Object> districtPriceMap = new HashMap<String, Object>();
|
||||
districtPriceMap.put("city", district.getCity());
|
||||
districtPriceMap.put("district", district.getRegion());
|
||||
districtPriceMap.put("name", district.getName());
|
||||
districtPriceMap.put("address", district.getAddress());
|
||||
districtPriceMap.put("totalPrice", evaluation.getTotalPrice());
|
||||
districtPriceMap.put("cal_date", model.getCalDate());
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(districtPriceMap));
|
||||
return mav;
|
||||
} else {
|
||||
|
||||
mav.setModel(BasicModel.buildOKModel().setMsg("暂时不支持该小区的租金估价").markNoData());
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void setHouseLoudongService(HouseLoudongService houseLoudongService) {
|
||||
this.houseLoudongService = houseLoudongService;
|
||||
}
|
||||
@@ -5159,4 +5434,20 @@ public class PropertyController {
|
||||
public void setRegionAnaDataService(RegionAnaDataService regionAnaDataService) {
|
||||
this.regionAnaDataService = regionAnaDataService;
|
||||
}
|
||||
|
||||
public void setSeawaterService(SeawaterService seawaterService) {
|
||||
this.seawaterService = seawaterService;
|
||||
}
|
||||
|
||||
public void setSqmetreRentService(SqmetreRentService sqmetreRentService) {
|
||||
this.sqmetreRentService = sqmetreRentService;
|
||||
}
|
||||
|
||||
public void setDistrictRoomSqmetreRentService(DistrictRoomSqmetreRentService districtRoomSqmetreRentService) {
|
||||
this.districtRoomSqmetreRentService = districtRoomSqmetreRentService;
|
||||
}
|
||||
|
||||
public void setRentDealPriceService(RentDealPriceService rentDealPriceService) {
|
||||
this.rentDealPriceService = rentDealPriceService;
|
||||
}
|
||||
}
|
||||
|
||||
+108
-44
@@ -1,5 +1,6 @@
|
||||
package com.fangjia.open.controllers;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
@@ -7,6 +8,16 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.fangjia.dal.mongo.model.*;
|
||||
import com.fangjia.dal.mongo.open.model.ApiUserAuthority;
|
||||
import com.fangjia.dal.seawater.model.Seawater;
|
||||
import com.fangjia.open.dto.DistrictDto;
|
||||
import com.fangjia.open.dto.DistrictHouseDtao;
|
||||
import com.fangjia.open.model.PropertyEvaluationModel;
|
||||
import com.fangjia.open.util.CommonUtils;
|
||||
import com.fangjia.service.datastore.EvaluationService;
|
||||
import com.fangjia.service.datastore.HouseService;
|
||||
import com.fangjia.service.mongo.fangjia.SeawaterService;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.tools.ant.util.DateUtils;
|
||||
|
||||
@@ -15,9 +26,6 @@ import com.fangjia.core.util.DateUtil;
|
||||
import com.fangjia.dal.common.DistrictKey;
|
||||
import com.fangjia.dal.common.ServerAreaData;
|
||||
import com.fangjia.dal.mongo.fangjia.model.ServerArea;
|
||||
import com.fangjia.dal.mongo.model.DistrictStatRent;
|
||||
import com.fangjia.dal.mongo.model.RegionStatRent;
|
||||
import com.fangjia.dal.mongo.model.SqmetreRent;
|
||||
import com.fangjia.dal.seaweed.model.District;
|
||||
import com.fangjia.open.HttpCode;
|
||||
import com.fangjia.open.OpenHttpCodeEnum;
|
||||
@@ -35,6 +43,8 @@ import com.fangjia.service.district.DistrictStatService;
|
||||
import com.fangjia.service.district.RegionStatRentService;
|
||||
import com.fangjia.service.district.SqmetreRentService;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
//@Authority(role = Role.USER)
|
||||
public class RentController {
|
||||
|
||||
@@ -43,6 +53,9 @@ public class RentController {
|
||||
private DistrictStatRentService districtStatRentService;
|
||||
private DistrictStatService districtStatService;
|
||||
private RegionStatRentService regionStatRentService;
|
||||
private EvaluationService evaluationService;
|
||||
private SeawaterService seawaterService;
|
||||
private HouseService houseService;
|
||||
//³ÇÊÐÆ½Ã××â½ð
|
||||
public Object cityRentAction(RentModel rentModel){
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
@@ -298,49 +311,93 @@ public class RentController {
|
||||
}else if(rentModel.getType() == 4){ //Á½Äê
|
||||
type = -24;
|
||||
}
|
||||
List<Date> dates = DateUtil.getLastDayBetweenDates(DateUtil.addMonthToDate(new Date(),type), new Date());
|
||||
|
||||
List<String> times = new ArrayList<String>();
|
||||
for(Date date : dates){
|
||||
times.add(DateUtils.format(date, "yyyy-MM"));
|
||||
}
|
||||
|
||||
List<DistrictStatRentBo> districtRents = districtStatRentService.findDistrictStatRentsByParams(rentModel.getCity(), rentModel.getDistrict(), rentModel.getName(), null, dates.get(0), dates.get(dates.size()-1), null, null, null, null, true);
|
||||
Map<String, Map<String, Integer>> distMap = null;
|
||||
List<Integer> rooms = null;
|
||||
|
||||
if(null != districtRents){
|
||||
distMap = new HashMap<String, Map<String, Integer>>();
|
||||
rooms = new ArrayList<Integer>();
|
||||
for(DistrictStatRentBo rent : districtRents){
|
||||
|
||||
DistrictStatRent distRent = rent.getDistrictStatRent();
|
||||
if(null == distRent){
|
||||
distRent = rent.getVillaDistrictStatRent();
|
||||
}
|
||||
|
||||
Map<String, Integer> priceMap = distMap.get(distRent.getHouseType().toString());
|
||||
if(null == priceMap){
|
||||
rooms.add(distRent.getHouseType());
|
||||
priceMap = new HashMap<String, Integer>();
|
||||
distMap.put(distRent.getHouseType().toString(), priceMap);
|
||||
}
|
||||
|
||||
priceMap.put(DateUtils.format(distRent.getEndMonthDate(), "yyyy-MM"), distRent.getAvgPrice());
|
||||
}
|
||||
}
|
||||
|
||||
Collections.sort(rooms);
|
||||
|
||||
Map<String, Object> retMap = new HashMap<String, Object>();
|
||||
retMap.put("times", times);
|
||||
retMap.put("distMap", distMap);
|
||||
retMap.put("rooms", rooms);
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(retMap));
|
||||
Map<String, Object> trendsMap = districtStatRentService.getRentTrend(rentModel.getCity(), rentModel.getDistrict(), rentModel.getName(), type);
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(trendsMap));
|
||||
return mav;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// public Object evaluateRentAction(RentModel model, HttpServletRequest request){
|
||||
// RestfulModelAndView mav = new RestfulModelAndView();
|
||||
//
|
||||
// if (StringUtils.isBlank(model.getCity()) || StringUtils.isBlank(model.getName())
|
||||
// || StringUtils.isBlank(model.getDistrict()) || model.getSize() <= 0) {
|
||||
// mav.setModel(BasicModel.buildBadRequestModel("参数非法:城市,区域,小区名,面积(size)为必填项"));
|
||||
// return mav;
|
||||
// }
|
||||
//
|
||||
// District district = districtService.findByNameAndAlias(model.getCity(), model.getDistrict(), model.getName(),"district");
|
||||
// if (null == district) {
|
||||
// mav.setModel(BasicModel.buildBadRequestModel("小区不存在"));
|
||||
// return mav;
|
||||
// }
|
||||
//
|
||||
// Double startArea = model.getSize() - model.getSize()*0.1;
|
||||
// Double endArea = model.getSize() + model.getSize()*0.1;
|
||||
//
|
||||
// Integer startDate = Integer.parseInt(DateUtils.format(DateUtil.addMonthToDate(new Date(), -12), "yyyyMMdd"));
|
||||
//
|
||||
// //相似房源
|
||||
// List<Seawater> houses = seawaterService.findSeawatersFromEs2("rent", district.getCity(), district.getRegion(), district.getName(), null, null, startDate, null,
|
||||
// startArea, endArea, null, null, null, null, "p_date", false, 1, 5 , null,"seawater-20*/_doc");
|
||||
// Map<String, Object> retMap = new HashMap<String, Object>();
|
||||
// retMap.put("houses", houses);
|
||||
//
|
||||
// if (null == model.getRadius()) {// 设置默认值
|
||||
// model.setRadius(2000);
|
||||
// }
|
||||
//
|
||||
// //相近小区
|
||||
// List<District> districts = districtService.findNearestDistrict(district, model.getRadius(), 50);
|
||||
// if (null != districts) {
|
||||
// Integer room = null;
|
||||
// if(model.getHouseType()!=null){
|
||||
// room = model.getHouseType();
|
||||
// }else{
|
||||
// room = houseService.getDistrictRoomType(model.getSize());
|
||||
// }
|
||||
//
|
||||
// if (null != room) {
|
||||
// List<DistrictHouseDtao> dtos = new ArrayList<DistrictHouseDtao>();
|
||||
// List<Integer> prices = new ArrayList<Integer>();
|
||||
// Date weekend = DateUtil.getFirstDayOfWeek(new Date());
|
||||
// for (District dist : districts) {
|
||||
// List<DistrictStatRent> districtStatRents = districtStatRentService.findLatestDistrictStatRent(dist, 1, room);
|
||||
// if (null != districtStatRents && districtStatRents.size() > 0) {
|
||||
// DistrictStatRent districtStatRent = districtStatRents.get(0);
|
||||
// if (districtStatRent.getAvgPrice() > 0) {
|
||||
// SqmetreRent sqmetreRent = sqmetreRentService.findNearestSqmetreRent(dist.getCity(), dist.getRegion(), dist.getName(), DateUtil.formatToYYYYMMDD(weekend), "district");
|
||||
// if(sqmetreRent != null){
|
||||
// DistrictHouseDtao dto = new DistrictHouseDtao();
|
||||
// dto.setCity(dist.getCity());
|
||||
// dto.setRegion(dist.getRegion());
|
||||
// dto.setDistrictName(dist.getName());
|
||||
// dto.setSqAvgPrice(sqmetreRent.getAvgPrice());
|
||||
// dto.setRoom(room);
|
||||
// dtos.add(dto);
|
||||
// if(dtos.size()>=5){
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// retMap.put("districts", dtos);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// Map<String, Object> trendsMap = districtStatRentService.getRentTrend(model.getCity(), model.getDistrict(), model.getName(), -12);
|
||||
// retMap.put("trends", trendsMap);
|
||||
// mav.setModel(BasicModel.buildOKModel().setResult(retMap));
|
||||
// return mav;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
public void setSeawaterService(SeawaterService seawaterService) {
|
||||
this.seawaterService = seawaterService;
|
||||
}
|
||||
|
||||
public void setSqmetreRentService(SqmetreRentService sqmetreRentService) {
|
||||
this.sqmetreRentService = sqmetreRentService;
|
||||
}
|
||||
@@ -359,4 +416,11 @@ public class RentController {
|
||||
this.regionStatRentService = regionStatRentService;
|
||||
}
|
||||
|
||||
public void setEvaluationService(EvaluationService evaluationService) {
|
||||
this.evaluationService = evaluationService;
|
||||
}
|
||||
|
||||
public void setHouseService(HouseService houseService) {
|
||||
this.houseService = houseService;
|
||||
}
|
||||
}
|
||||
|
||||
+584
@@ -0,0 +1,584 @@
|
||||
package com.fangjia.open.controllers.weixin;
|
||||
|
||||
import com.fangjia.core.util.*;
|
||||
import com.fangjia.dal.QueryParam;
|
||||
import com.fangjia.dal.SdQuery;
|
||||
import com.fangjia.dal.SrQuery;
|
||||
import com.fangjia.dal.mongo.model.DistrictRoomSqmetreRent;
|
||||
import com.fangjia.dal.mongo.model.Evaluation;
|
||||
import com.fangjia.dal.mongo.model.RentDealPrice;
|
||||
import com.fangjia.dal.seawater.model.Seawater;
|
||||
import com.fangjia.dal.seaweed.model.District;
|
||||
import com.fangjia.open.compatible.model.JsonModel;
|
||||
import com.fangjia.open.dto.DistrictHouseDtao;
|
||||
import com.fangjia.open.interceptors.AuthenticationBean;
|
||||
import com.fangjia.open.model.BaseModel;
|
||||
import com.fangjia.open.model.weixin.EvaluationModel;
|
||||
import com.fangjia.open.model.weixin.PropertyEvaluationModel;
|
||||
import com.fangjia.open.util.LineChartsUtils;
|
||||
import com.fangjia.service.api.AutoCompleteBo;
|
||||
import com.fangjia.service.datastore.DistrictService;
|
||||
import com.fangjia.service.datastore.EvaluationService;
|
||||
import com.fangjia.service.datastore.HouseService;
|
||||
import com.fangjia.service.district.DistrictRoomSqmetreRentService;
|
||||
import com.fangjia.service.district.RentDealPriceService;
|
||||
import com.fangjia.service.mongo.fangjia.FileService;
|
||||
import com.fangjia.service.mongo.fangjia.SeawaterService;
|
||||
import com.fangjia.service.util.DistrictScoreUtil;
|
||||
import com.lowagie.text.pdf.BaseFont;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.lucene.index.Term;
|
||||
import org.apache.lucene.search.BooleanClause;
|
||||
import org.apache.lucene.search.BooleanQuery;
|
||||
import org.apache.lucene.search.TermQuery;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.sothis.core.util.CollectionUtils;
|
||||
import org.sothis.web.mvc.ActionContext;
|
||||
import org.sothis.web.mvc.annotation.Param;
|
||||
import org.xhtmlrenderer.pdf.ITextFontResolver;
|
||||
import org.xhtmlrenderer.pdf.ITextRenderer;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.text.ParseException;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 建设银行租金控制类
|
||||
*
|
||||
* @author shenjian
|
||||
* @since 2021/4/6
|
||||
*/
|
||||
public class CcbRentController {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(CcbRentController.class);
|
||||
|
||||
private DistrictService districtService;
|
||||
private SeawaterService seawaterService;
|
||||
private DistrictRoomSqmetreRentService districtRoomSqmetreRentService;
|
||||
private EvaluationService evaluationService;
|
||||
private HouseService houseService;
|
||||
private RentDealPriceService rentDealPriceService;
|
||||
private FileService fileService;
|
||||
|
||||
public Object indexAction(BaseModel result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
public Object reportAction(EvaluationModel result, @Param(name = "address") String address, @Param(name = "totalPrice") String totalPrice) {
|
||||
result.setLender(address);
|
||||
if (StringUtils.isNotBlank(totalPrice)) {
|
||||
result.setDealPrice(Double.valueOf(totalPrice));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public Object detailAction(PropertyEvaluationModel result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
public Object downloadPageAction(PropertyEvaluationModel result, HttpServletRequest request, @Param(name = "city") String city, @Param(name = "district") String districtStr,
|
||||
@Param(name = "name") String name, @Param(name = "address") String address,
|
||||
@Param(name = "size") Double size, @Param(name = "floor") Integer floor, @Param(name = "height") Integer height, @Param(name = "room") Integer room,
|
||||
@Param(name = "hall") Integer hall, @Param(name = "toilet") Integer toilet, @Param(name = "direction") String direction, @Param(name = "fitment") String fitment) {
|
||||
com.fangjia.open.model.PropertyEvaluationModel model = new com.fangjia.open.model.PropertyEvaluationModel();
|
||||
model.setCity(city);
|
||||
model.setDistrict(districtStr);
|
||||
model.setName(name);
|
||||
model.setAddress(address);
|
||||
model.setSize(size);
|
||||
model.setFloor(floor);
|
||||
model.setHeight(height);
|
||||
if (room != null) {
|
||||
model.setRoom(room);
|
||||
}
|
||||
if (hall != null) {
|
||||
model.setHall(hall);
|
||||
}
|
||||
if (toilet != null) {
|
||||
model.setToilet(toilet);
|
||||
}
|
||||
model.setDirection(direction);
|
||||
model.setFitment(fitment);
|
||||
|
||||
if (model.getCity().endsWith("市")) {
|
||||
model.setCity(model.getCity().replaceAll("市$", ""));
|
||||
}
|
||||
if (StringUtils.isNotBlank(request.getParameter("calDate"))) {
|
||||
Date calDate = null;
|
||||
try {
|
||||
calDate = org.apache.commons.lang.time.DateUtils.parseDate(request.getParameter("calDate"), new String[] { "yyyy-MM-dd" });
|
||||
} catch (ParseException e) {
|
||||
|
||||
}
|
||||
model.setCalDate(calDate);
|
||||
}
|
||||
/* 先到CPDB库中查找小区 */
|
||||
District district = districtService.findByNameAndAlias(model.getCity(), model.getDistrict(), model.getName(),
|
||||
"district");
|
||||
model.setName(district.getName());
|
||||
|
||||
|
||||
model.setRegion(district.getRegion());
|
||||
model.setDistrictName(district.getName());
|
||||
if (StringUtils.isBlank(model.getPropertyType())) {
|
||||
if (district.getEstateType2() != null && district.getEstateType2().contains("别墅")) {
|
||||
model.setPropertyType("1");
|
||||
}
|
||||
}
|
||||
|
||||
if (model.getCalDate() != null) {
|
||||
if (new Date().before(model.getCalDate())) {
|
||||
model.setCalDate(DateUtil.getFirstDayOfWeek(new Date()));
|
||||
} else {
|
||||
model.setCalDate(DateUtil.getFirstDayOfWeek(model.getCalDate()));
|
||||
}
|
||||
} else {
|
||||
model.setCalDate(DateUtil.getFirstDayOfWeek(new Date()));
|
||||
}
|
||||
|
||||
Evaluation evaluation = buildEvaluation(model, request);
|
||||
evaluation.setSource("api_property_evaluate_rent");
|
||||
evaluation = evaluationService.evaluateRent(district, evaluation, model.getCalDate());
|
||||
|
||||
if (evaluation.getTotalPrice() != null && evaluation.getTotalPrice() != 0) {
|
||||
evaluation.setAvgPrice((int)(evaluation.getTotalPrice()/evaluation.getArea()));
|
||||
Map<String, Object> districtPriceMap = new HashMap<String, Object>();
|
||||
districtPriceMap.put("city", district.getCity());
|
||||
districtPriceMap.put("district", district.getRegion());
|
||||
districtPriceMap.put("name", district.getName());
|
||||
districtPriceMap.put("address", district.getAddress());
|
||||
districtPriceMap.put("totalPrice", evaluation.getTotalPrice());
|
||||
districtPriceMap.put("totalPriceUpper", CNNMFilter.convert(String.valueOf(evaluation.getTotalPrice())));
|
||||
districtPriceMap.put("cal_date", DateUtil.formatByPattern(new Date(), "yyyy/MM/dd"));
|
||||
districtPriceMap.put("direction", evaluation.getDirection());
|
||||
districtPriceMap.put("size", evaluation.getArea());
|
||||
districtPriceMap.put("floor", model.getFloor());
|
||||
districtPriceMap.put("height", model.getHeight());
|
||||
districtPriceMap.put("fitment", evaluation.getFitment());
|
||||
|
||||
Integer startPrice = (int)(evaluation.getTotalPrice() - evaluation.getTotalPrice()*0.2);
|
||||
Integer endPrice = (int)(evaluation.getTotalPrice() + evaluation.getTotalPrice()*0.2);
|
||||
|
||||
//周边相似小区
|
||||
if (null == model.getRadius()) {// 设置默认值
|
||||
model.setRadius(1000);
|
||||
}
|
||||
String[] fields = { "city", "region", "name", "estateType2", "id","finishBuildingDate"};
|
||||
List<District> allDistricts = districtService.findNearestDistrict(district, model.getRadius(), fields, Integer.MAX_VALUE);
|
||||
//按条件过滤相似小区
|
||||
Integer buildYear = null;
|
||||
List<District> districts = null;
|
||||
if(StringUtils.isNotBlank(district.getFinishBuildingDate())){
|
||||
buildYear = DistrictScoreUtil.parseStringToDate(district.getFinishBuildingDate());
|
||||
if(buildYear!=null){
|
||||
districts = new ArrayList<District>();
|
||||
int startYear = buildYear -7;
|
||||
int endYear = buildYear + 7;
|
||||
for(District dist : allDistricts){
|
||||
if(StringUtils.isNotBlank(dist.getFinishBuildingDate())){
|
||||
int simlarDistYear = DistrictScoreUtil.parseStringToDate(district.getFinishBuildingDate());
|
||||
if(simlarDistYear>=startYear && simlarDistYear<=endYear && StringUtils.isNotBlank(district.getEstateType2()) && StringUtils.isNotBlank(dist.getEstateType2()) && district.getEstateType2().equals(dist.getEstateType2())){
|
||||
districts.add(dist);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//相似房源
|
||||
Double startArea = model.getSize() - model.getSize()*0.1;
|
||||
Double endArea = model.getSize() + model.getSize()*0.1;
|
||||
Integer startDate = Integer.parseInt(org.apache.tools.ant.util.DateUtils.format(DateUtil.addMonthToDate(new Date(), -12), "yyyyMMdd"));
|
||||
List<Seawater> houses = seawaterService.findSeawatersFromEs2("rent", district.getCity(), district.getRegion(), district.getName(), null, null, startDate, null,
|
||||
startArea, endArea, startPrice, endPrice, null, null, "p_date", false, 1, 5 , null,"seawater-20*/_doc");
|
||||
//无评估小区房源用周边相似小区的房源
|
||||
if(null == houses || houses.size()==0){
|
||||
for (District dist : districts) {
|
||||
houses = seawaterService.findSeawatersFromEs2("rent", dist.getCity(), dist.getRegion(), dist.getName(), null, null, startDate, null,
|
||||
startArea, endArea, startPrice, endPrice, null, null, "p_date", false, 1, 5 , null,"seawater-20*/_doc");
|
||||
if(houses!=null && houses.size()>0){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(houses)) {
|
||||
for (Seawater seawater: houses) {
|
||||
if (seawater.getpDate() != null) {
|
||||
seawater.setRoot(DateUtil.formatByPattern(DateUtil.parseDate(String.valueOf(seawater.getpDate()), "yyyyMMdd"), "yyyy-MM-dd"));
|
||||
}
|
||||
}
|
||||
}
|
||||
districtPriceMap.put("houses", houses);
|
||||
|
||||
//周边相似小区租金
|
||||
if(model.getRoom() != 0){
|
||||
room = model.getRoom();
|
||||
}else{
|
||||
room = houseService.getDistrictRoomType((float)model.getSize());
|
||||
}
|
||||
if (null != districts) {
|
||||
if (null != room) {
|
||||
List<DistrictHouseDtao> dtos = new ArrayList<DistrictHouseDtao>();
|
||||
Date weekend = DateUtil.getFirstDayOfWeek(new Date());
|
||||
for (District dist : districts) {
|
||||
|
||||
List<DistrictRoomSqmetreRent> districtRoomSqmetreRents = districtRoomSqmetreRentService.findDistrictRoomSqmetreRents(dist, 1, room);
|
||||
|
||||
///List<DistrictStatRent> districtStatRents = districtStatRentService.findLatestDistrictStatRent(dist, 1, room);
|
||||
if (null != districtRoomSqmetreRents && districtRoomSqmetreRents.size() > 0) {
|
||||
DistrictRoomSqmetreRent districtRoomSqmetreRent = districtRoomSqmetreRents.get(0);
|
||||
if (districtRoomSqmetreRent.getAvgPrice() > 0) {
|
||||
|
||||
int startSqPrice = (int)(evaluation.getAvgPrice() - evaluation.getAvgPrice()*0.1);
|
||||
int endSqPrice = (int)(evaluation.getAvgPrice() + evaluation.getAvgPrice()*0.1);
|
||||
// SqmetreRent sqmetreRent = sqmetreRentService.findNearestSqmetreRent(dist.getCity(), dist.getRegion(), dist.getName(), DateUtil.formatToYYYYMMDD(weekend), "district");
|
||||
if(districtRoomSqmetreRent.getAvgPrice()>=startSqPrice && districtRoomSqmetreRent.getAvgPrice()<=endSqPrice){
|
||||
DistrictHouseDtao dto = new DistrictHouseDtao();
|
||||
dto.setCity(dist.getCity());
|
||||
dto.setRegion(dist.getRegion());
|
||||
dto.setDistrictName(dist.getName());
|
||||
dto.setSqAvgPrice(districtRoomSqmetreRent.getAvgPrice());
|
||||
dto.setRoom(room);
|
||||
dtos.add(dto);
|
||||
if(dtos.size()>=5){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
districtPriceMap.put("districts", dtos);
|
||||
}
|
||||
}
|
||||
|
||||
//近一年户型租金走势
|
||||
Map<String, Object> trendsMap = districtRoomSqmetreRentService.getRentTrends(district.getCity(), district.getRegion(), district.getName(), room, -12);
|
||||
districtPriceMap.put("trends", trendsMap);
|
||||
|
||||
// 生成走势图图片,一遍转pdf
|
||||
String tradesImgUrl = buildTrendImage(trendsMap, room);
|
||||
|
||||
//成交的租房房源
|
||||
List<RentDealPrice> rentTrades = rentDealPriceService.getRentDealPrices(district.getCity(), district.getRegion(), district.getName(), 5);
|
||||
if (CollectionUtils.isNotEmpty(rentTrades)) {
|
||||
for (RentDealPrice price : rentTrades) {
|
||||
// 返回成交日期到前端,直接取日期转pdf报错!!!!!!!!!!!!!!!!!
|
||||
if (price.getTradeDate() != null) {
|
||||
price.setSource(DateUtil.formatByPattern(price.getTradeDate(), "yyyy-MM-dd"));
|
||||
}
|
||||
}
|
||||
}
|
||||
districtPriceMap.put("trades", rentTrades);
|
||||
districtPriceMap.put("tradesImgUrl", tradesImgUrl);
|
||||
|
||||
result.setResult(districtPriceMap);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private String buildTrendImage(Map<String, Object> trendsMap, Integer room) {
|
||||
List<String> times = (List<String>) trendsMap.get("times");
|
||||
Map<String, Object> distMap = (Map<String, Object>) ((Map<String, Object>) trendsMap.get("distMap")).get(String.valueOf(room));
|
||||
if (distMap != null) {
|
||||
List<Integer> values = new ArrayList<Integer>();
|
||||
for (int i = 0; i < times.size(); i++) {
|
||||
if (distMap.get(times.get(i)) != null) {
|
||||
values.add((Integer) distMap.get(times.get(i)));
|
||||
} else {
|
||||
values.add(null);
|
||||
}
|
||||
}
|
||||
// 保存到本地测试
|
||||
//String url = LineChartsUtils.createChartAndSave2Png("d://test.png",room + "居室", times, values);
|
||||
String url = LineChartsUtils.createChartAndUpload(fileService,room + "居室", times, values);
|
||||
logger.info("租金估值图片上传至服务器:{}", url);
|
||||
return url;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过EvaluationModel组装Evaluation实体
|
||||
*
|
||||
* @param model
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
private Evaluation buildEvaluation(com.fangjia.open.model.PropertyEvaluationModel model, HttpServletRequest request) {
|
||||
Evaluation evaluation = new Evaluation();
|
||||
evaluation.setCity(model.getCity());
|
||||
evaluation.setRegion(model.getRegion());
|
||||
evaluation.setDistrictName(model.getName());
|
||||
evaluation.setDirection(DIRECTION.get(model.getDirection()));
|
||||
evaluation.setFitment(EVALUATION_MODEL_FITMENT.get(FITMENT.get(model.getDecoration())));
|
||||
evaluation.setAtticArea(model.getAtticSize());
|
||||
evaluation.setTerraceArea(model.getOuterSize());
|
||||
evaluation.setBasementArea(model.getBasementSize());
|
||||
evaluation.setGardenArea(model.getGardenSize());
|
||||
String worryFacility = model.getNegativeFactor();
|
||||
evaluation.setCreationDate(new Date());
|
||||
evaluation.setModificationDate(new Date());
|
||||
evaluation.setClientNo(model.getClientNo());
|
||||
if (0 != model.getAge()) {
|
||||
evaluation.setAge(model.getAge());
|
||||
}
|
||||
evaluation.setArea(model.getSize());
|
||||
if (StringUtils.isNotBlank(model.getBuildType())) {
|
||||
evaluation.setBuildType(model.getBuildType());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getCarport())) {
|
||||
evaluation.setCarport(model.getCarport());
|
||||
}
|
||||
if (model.getDecorationAge() >= 1 && model.getDecorationAge() <= 5) {
|
||||
evaluation.setFitmentAge(model.getDecorationAge());
|
||||
}
|
||||
evaluation.setCarportPrice(model.getCarportPrice());
|
||||
evaluation.setCity(model.getCity());
|
||||
evaluation.setDistrictName(model.getName());
|
||||
if (model.getDecorationCost() != null && model.getDecorationCost() > 0) {
|
||||
evaluation.setFitmentCharge(model.getDecorationCost());
|
||||
}
|
||||
if (0 != model.getHall()) {
|
||||
evaluation.setHall(model.getHall());
|
||||
}
|
||||
if (null != model.getFloor()) {
|
||||
evaluation.setFloor(model.getFloor());
|
||||
}
|
||||
if (model.getMaxFloor() != null && 0 != model.getMaxFloor()) {
|
||||
evaluation.setHeight(model.getMaxFloor());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getBuildingNumber())) {
|
||||
evaluation.setHouseNum(model.getBuildingNumber());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getHouseProperty())) {
|
||||
evaluation.setHouseProperty(model.getHouseProperty());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getInsidepos())) {
|
||||
evaluation.setInsidepos(model.getInsidepos());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getLightingVentilation())) {
|
||||
evaluation.setLightingVentilation(model.getLightingVentilation());
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(model.getOtherFactor())) {
|
||||
evaluation.setOtherFactor(model.getOtherFactor());
|
||||
}
|
||||
evaluation.setRegion(model.getDistrict());
|
||||
if (0 != model.getRoom()) {
|
||||
evaluation.setRoom(model.getRoom());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getRoomNumber())) {
|
||||
evaluation.setRoomNum(model.getRoomNumber());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getSideset())) {
|
||||
evaluation.setSideset(model.getSideset());
|
||||
}
|
||||
if (0 != model.getToilet()) {
|
||||
evaluation.setToilet(model.getToilet());
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(model.getFacade())) {
|
||||
evaluation.setFacade(model.getFacade());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getTraffice())) {
|
||||
evaluation.setTraffice(model.getTraffice());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getShape())) {
|
||||
evaluation.setShape(model.getShape());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getObstacle())) {
|
||||
evaluation.setObstacle(model.getObstacle());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getIndustry())) {
|
||||
evaluation.setIndustry(model.getIndustry());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getSupportDevice())) {
|
||||
evaluation.setSupportDevice(model.getSupportDevice());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getLeftPosition())) {
|
||||
evaluation.setLeftPosition(model.getLeftPosition());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getShopType())) {
|
||||
evaluation.setShopType(model.getShopType());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getShopUnique())) {
|
||||
evaluation.setShopUnique(model.getShopUnique());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getLocation())) {
|
||||
evaluation.setLocation(model.getLocation());
|
||||
}
|
||||
if (model.isNewDistrict()) {
|
||||
evaluation.setNewDistrict(model.isNewDistrict());
|
||||
}
|
||||
String ip = AnalyticsUtil.getIpAddress(ActionContext.getContext().getRequest());
|
||||
evaluation.setIp(ip);
|
||||
AuthenticationBean authenticationBean = (AuthenticationBean) request
|
||||
.getAttribute(AuthenticationBean.ATTR_AUTHENTICATION_BEAN);
|
||||
if (authenticationBean != null && authenticationBean.apiUser != null) {
|
||||
evaluation.setFromUserId(String.valueOf(authenticationBean.apiUser.getId()));
|
||||
}
|
||||
evaluation.setSource("api_property_evaluation");
|
||||
return evaluation;
|
||||
}
|
||||
|
||||
public void downloadAction(HttpServletResponse response, HttpServletRequest request, @Param(name = "city") String city, @Param(name = "district") String district,
|
||||
@Param(name = "name") String name, @Param(name = "address") String address,
|
||||
@Param(name = "size") Double size, @Param(name = "floor") Integer floor, @Param(name = "height") Integer height, @Param(name = "room") Integer room,
|
||||
@Param(name = "hall") Integer hall, @Param(name = "toilet") Integer toilet, @Param(name = "direction") String direction, @Param(name = "fitment") String fitment) throws IOException {
|
||||
response.setHeader("Content-disposition", "attachment; filename=report.pdf");
|
||||
response.setContentType("application/pdf;charset=UTF-8");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
OutputStream os = null;
|
||||
try {
|
||||
os = response.getOutputStream();
|
||||
ITextRenderer renderer = new ITextRenderer(35, 20);
|
||||
ITextFontResolver fontResolver = renderer.getFontResolver();
|
||||
String fontUrl = ActionContext.getContext().getServletContext().getRealPath("/") + "fonts" + File.separator + "simsun.ttc";
|
||||
fontResolver.addFont(fontUrl, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
|
||||
final String path = "http://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath();
|
||||
String url = path + "/ccbRent/downloadPage?city=" + DataUtil.urlEncode(city) + "&district="+DataUtil.urlEncode(district)+"&name="+DataUtil.urlEncode(name);
|
||||
url += "&address=" + DataUtil.urlEncode(address) +"&size="+size+"&floor="+floor+"&height="+height+"&room="+room+"&hall="+hall+"&toilet="+toilet+"&direction="+direction+"&fitment="+fitment;
|
||||
renderer.setDocument(url);
|
||||
renderer.layout();
|
||||
renderer.createPDF(os, true);
|
||||
renderer.finishPDF();
|
||||
os.flush();
|
||||
os.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (os != null) {
|
||||
os.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 方法同DistrictController#suggestAction
|
||||
*/
|
||||
public Object suggestAction(@Param(name = "city") String city, @Param(name = "cat") String cat, @Param(name = "keyword") String keyword,
|
||||
@Param(name = "limit") Integer limit, @Param(name="lat")Double lat, @Param(name="lng")Double lng) {
|
||||
JsonModel model = new JsonModel();
|
||||
if (limit == null || limit > 100 || limit <= 0) {
|
||||
limit = 10;
|
||||
}
|
||||
System.out.println(cat + "#" + city + "#" + keyword + "#" + limit + "#" + lng + "#" + lat);
|
||||
List<AutoCompleteBo> suggestList = getDistrictByKeyword(cat, city, keyword, limit, lng, lat);
|
||||
model.setJsonModel(suggestList);
|
||||
return model;
|
||||
}
|
||||
|
||||
private List<AutoCompleteBo> getDistrictByKeyword(String cat, String city, String keyword, int limit, final Double lng, final Double lat) {
|
||||
|
||||
keyword = DataUtil.escapeSolr(keyword);
|
||||
if (StringUtils.isBlank(keyword) || keyword.length() >= 30) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||
params.add(new QueryParam("city", city));
|
||||
params.add(new QueryParam("category", cat));
|
||||
params.add(new QueryParam("visible", 0));
|
||||
|
||||
|
||||
BooleanQuery srQuery1 = new BooleanQuery();
|
||||
BooleanQuery nameQuery = new BooleanQuery();
|
||||
// nameQuery.add(new TermQuery(new Term("district_name", keyword)), BooleanClause.Occur.SHOULD);
|
||||
// nameQuery.add(new TermQuery(new Term("alias_std", keyword)), BooleanClause.Occur.SHOULD);
|
||||
// nameQuery.add(new TermQuery(new Term("address", keyword)), BooleanClause.Occur.SHOULD);
|
||||
// nameQuery.add(new TermQuery(new Term("addr_alias_std", keyword)), BooleanClause.Occur.SHOULD);
|
||||
nameQuery.add(new TermQuery(new Term("keyword", keyword)), BooleanClause.Occur.SHOULD);
|
||||
//nameQuery.add(new TermQuery(new Term("keyword_cjk", keyword)), BooleanClause.Occur.SHOULD);//这个重要,因seaweed不支持模糊搜索,当输入"中远两"需用此进行搜索
|
||||
srQuery1.add(nameQuery, BooleanClause.Occur.SHOULD);
|
||||
if(lat != null && lng != null && lat != 0 && lng != 0){
|
||||
Map<String, Double> geo = GeocodeUtils.geoconvBaiduToGoogle(lng, lat);
|
||||
SdQuery sdQuery = new SdQuery();
|
||||
sdQuery.setPoint(geo.get("lat") + "," + geo.get("lng"));
|
||||
sdQuery.setField("lat_lng");
|
||||
sdQuery.setDistance("500");
|
||||
params.add(new QueryParam(QueryParam.SD_PARAM_NAME, sdQuery));
|
||||
}
|
||||
params.add(new QueryParam("$sr", new SrQuery(srQuery1)));
|
||||
List<District> districts = districtService.findAllByParams(params, 0, limit, new String[]{"region", "name", "address", "addrAlias","id"});
|
||||
List<AutoCompleteBo> ret = new ArrayList<AutoCompleteBo>(districts.size());
|
||||
for (District district : districts) {
|
||||
AutoCompleteBo bo = new AutoCompleteBo();
|
||||
bo.setKeyword(district.getName());
|
||||
bo.setVal(district.getName());
|
||||
bo.setDesc(district.getAddress());
|
||||
bo.setRegion(district.getRegion());
|
||||
bo.setId(district.getId());
|
||||
ret.add(bo);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static final Map<String, String> DIRECTION = new HashMap<String, String>() {
|
||||
{
|
||||
put(null, "南");
|
||||
put("1", "西南");
|
||||
put("2", "东南");
|
||||
put("3", "南");
|
||||
put("4", "西北");
|
||||
put("5", "东北");
|
||||
put("6", "东");
|
||||
put("7", "西");
|
||||
put("8", "北");
|
||||
put("9", "东西");
|
||||
put("10", "南北");
|
||||
}
|
||||
};
|
||||
|
||||
private static final Map<String, String> FITMENT = new HashMap<String, String>() {
|
||||
{
|
||||
put(null, "简装");
|
||||
put("1", "毛坯");
|
||||
put("2", "简装");
|
||||
put("3", "精装");
|
||||
put("4", "豪装");
|
||||
}
|
||||
};
|
||||
|
||||
private static final Map<String, String> EVALUATION_MODEL_FITMENT = new HashMap<String, String>() {
|
||||
{
|
||||
put(null, "简单装修");
|
||||
put("简装", "简单装修");
|
||||
put("毛坯", "毛坯");
|
||||
put("精装", "精装修");
|
||||
put("豪装", "豪华装修");
|
||||
}
|
||||
};
|
||||
|
||||
public void setDistrictService(DistrictService districtService) {
|
||||
this.districtService = districtService;
|
||||
}
|
||||
|
||||
public void setSeawaterService(SeawaterService seawaterService) {
|
||||
this.seawaterService = seawaterService;
|
||||
}
|
||||
|
||||
public void setDistrictRoomSqmetreRentService(DistrictRoomSqmetreRentService districtRoomSqmetreRentService) {
|
||||
this.districtRoomSqmetreRentService = districtRoomSqmetreRentService;
|
||||
}
|
||||
|
||||
public void setEvaluationService(EvaluationService evaluationService) {
|
||||
this.evaluationService = evaluationService;
|
||||
}
|
||||
|
||||
public void setHouseService(HouseService houseService) {
|
||||
this.houseService = houseService;
|
||||
}
|
||||
|
||||
public void setRentDealPriceService(RentDealPriceService rentDealPriceService) {
|
||||
this.rentDealPriceService = rentDealPriceService;
|
||||
}
|
||||
|
||||
public void setFileService(FileService fileService) {
|
||||
this.fileService = fileService;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
package com.fangjia.open.dto;
|
||||
|
||||
import groovy.transform.builder.Builder;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 建行租金dto
|
||||
*
|
||||
* @author shenjian
|
||||
* @since 2021/4/6
|
||||
*/
|
||||
@Builder
|
||||
public class CcbRentDto implements Serializable {
|
||||
|
||||
private String city;
|
||||
// 区域
|
||||
private String district;
|
||||
// 小区名
|
||||
private String name;
|
||||
// 面积
|
||||
private Double size;
|
||||
// 半径
|
||||
private Integer radius;
|
||||
// 室
|
||||
private Integer room;
|
||||
// 厅
|
||||
private Integer hall;
|
||||
// 卫
|
||||
private Integer toilet;
|
||||
// 所在楼层
|
||||
private Integer floor;
|
||||
// 总楼层
|
||||
private Integer height;
|
||||
// 朝向
|
||||
private String direction;
|
||||
// 装修情况
|
||||
private String fitment;
|
||||
// 电梯配套
|
||||
private Boolean hasLift;
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getDistrict() {
|
||||
return district;
|
||||
}
|
||||
|
||||
public void setDistrict(String district) {
|
||||
this.district = district;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getRadius() {
|
||||
return radius;
|
||||
}
|
||||
|
||||
public void setRadius(Integer radius) {
|
||||
this.radius = radius;
|
||||
}
|
||||
|
||||
public Integer getRoom() {
|
||||
return room;
|
||||
}
|
||||
|
||||
public void setRoom(Integer room) {
|
||||
this.room = room;
|
||||
}
|
||||
|
||||
public Integer getHall() {
|
||||
return hall;
|
||||
}
|
||||
|
||||
public void setHall(Integer hall) {
|
||||
this.hall = hall;
|
||||
}
|
||||
|
||||
public Integer getToilet() {
|
||||
return toilet;
|
||||
}
|
||||
|
||||
public void setToilet(Integer toilet) {
|
||||
this.toilet = toilet;
|
||||
}
|
||||
|
||||
public Integer getFloor() {
|
||||
return floor;
|
||||
}
|
||||
|
||||
public void setFloor(Integer floor) {
|
||||
this.floor = floor;
|
||||
}
|
||||
|
||||
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 getHasLift() {
|
||||
return hasLift;
|
||||
}
|
||||
|
||||
public void setHasLift(Boolean hasLift) {
|
||||
this.hasLift = hasLift;
|
||||
}
|
||||
|
||||
public Double getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(Double size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public Integer getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public void setHeight(Integer height) {
|
||||
this.height = height;
|
||||
}
|
||||
}
|
||||
@@ -48,7 +48,8 @@ public class DistrictDto implements Serializable {
|
||||
* 均价
|
||||
*/
|
||||
private Integer avgPrice;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 板块
|
||||
*/
|
||||
@@ -525,7 +526,5 @@ public class DistrictDto implements Serializable {
|
||||
public void setAvgPrice(Integer avgPrice) {
|
||||
this.avgPrice = avgPrice;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.fangjia.open.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class DistrictHouseDtao implements Serializable {
|
||||
|
||||
private String city;
|
||||
private String region;
|
||||
private String districtName;
|
||||
private Integer roomPrice;
|
||||
private Integer sqAvgPrice;
|
||||
private Integer room;
|
||||
private Integer hall;
|
||||
private Integer toilet;
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
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 getRoomPrice() {
|
||||
return roomPrice;
|
||||
}
|
||||
|
||||
public void setRoomPrice(Integer roomPrice) {
|
||||
this.roomPrice = roomPrice;
|
||||
}
|
||||
|
||||
public Integer getSqAvgPrice() {
|
||||
return sqAvgPrice;
|
||||
}
|
||||
|
||||
public void setSqAvgPrice(Integer sqAvgPrice) {
|
||||
this.sqAvgPrice = sqAvgPrice;
|
||||
}
|
||||
|
||||
public Integer getRoom() {
|
||||
return room;
|
||||
}
|
||||
|
||||
public void setRoom(Integer room) {
|
||||
this.room = room;
|
||||
}
|
||||
|
||||
public Integer getHall() {
|
||||
return hall;
|
||||
}
|
||||
|
||||
public void setHall(Integer hall) {
|
||||
this.hall = hall;
|
||||
}
|
||||
|
||||
public Integer getToilet() {
|
||||
return toilet;
|
||||
}
|
||||
|
||||
public void setToilet(Integer toilet) {
|
||||
this.toilet = toilet;
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,16 @@ public class AddesssMatchModel extends FangjiaApiModel {
|
||||
private String province;
|
||||
private String debugName;
|
||||
private boolean useMap;
|
||||
|
||||
public boolean isContainsLocation() {
|
||||
return containsLocation;
|
||||
}
|
||||
|
||||
public void setContainsLocation(boolean containsLocation) {
|
||||
this.containsLocation = containsLocation;
|
||||
}
|
||||
|
||||
private boolean containsLocation;
|
||||
private boolean debug;
|
||||
public String getCity() {
|
||||
return city;
|
||||
|
||||
@@ -36,7 +36,15 @@ public class AddressModel extends FangjiaApiModel {
|
||||
private Integer pageNo;
|
||||
// 是否用于检查
|
||||
private String dataLevel;
|
||||
public boolean isContainsLocation() {
|
||||
return containsLocation;
|
||||
}
|
||||
|
||||
public void setContainsLocation(boolean containsLocation) {
|
||||
this.containsLocation = containsLocation;
|
||||
}
|
||||
|
||||
private boolean containsLocation;
|
||||
public boolean isIncludeMaps() {
|
||||
return includeMaps;
|
||||
}
|
||||
|
||||
+8
-3
@@ -1,5 +1,7 @@
|
||||
package com.fangjia.open.model;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import java.util.Date;
|
||||
|
||||
public class PropertyEvaluationModel extends FangjiaApiModel {
|
||||
@@ -267,7 +269,9 @@ public class PropertyEvaluationModel extends FangjiaApiModel {
|
||||
private String estateType;
|
||||
private String periodType;
|
||||
private Integer periodCount;
|
||||
private int houseType;
|
||||
|
||||
|
||||
private Integer houseType;
|
||||
private String clientNo;
|
||||
private int scope;
|
||||
|
||||
@@ -280,6 +284,7 @@ public class PropertyEvaluationModel extends FangjiaApiModel {
|
||||
|
||||
private String user;
|
||||
|
||||
|
||||
public void setDecorationAge(int decorationAge) {
|
||||
this.decorationAge = decorationAge;
|
||||
}
|
||||
@@ -701,11 +706,11 @@ public class PropertyEvaluationModel extends FangjiaApiModel {
|
||||
this.decoration = decoration;
|
||||
}
|
||||
|
||||
public int getHouseType() {
|
||||
public Integer getHouseType() {
|
||||
return houseType;
|
||||
}
|
||||
|
||||
public void setHouseType(int houseType) {
|
||||
public void setHouseType(Integer houseType) {
|
||||
this.houseType = houseType;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,10 +30,15 @@ public class RentModel {
|
||||
|
||||
private String endDate;
|
||||
|
||||
|
||||
@Min(1)
|
||||
@Max(4)
|
||||
private Integer type;//ÀàÐÍ
|
||||
|
||||
@Min(1)
|
||||
@Max(6)
|
||||
private Integer houseType;//·¿ÐÍ
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
@@ -90,9 +95,12 @@ public class RentModel {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public Integer getHouseType() {
|
||||
return houseType;
|
||||
}
|
||||
|
||||
public void setHouseType(Integer houseType) {
|
||||
this.houseType = houseType;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@ public class EvaluationModel extends BaseModel{
|
||||
private Integer role;
|
||||
private String cardId;
|
||||
|
||||
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
|
||||
+181
@@ -0,0 +1,181 @@
|
||||
package com.fangjia.open.model.weixin;
|
||||
|
||||
import com.fangjia.open.model.BaseModel;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 建行租房估值
|
||||
*
|
||||
* @author shenjian
|
||||
* @since 2021/4/7
|
||||
*/
|
||||
public class PropertyEvaluationModel extends BaseModel {
|
||||
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
private String cityName;
|
||||
|
||||
/**
|
||||
* 区域(新版本估价)
|
||||
**/
|
||||
private String district;
|
||||
|
||||
/**
|
||||
* 小区名(新版本)
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 面积
|
||||
*/
|
||||
private double size;
|
||||
|
||||
/**
|
||||
* 所在楼层
|
||||
*/
|
||||
private Integer floor;
|
||||
|
||||
/**
|
||||
* 总楼层
|
||||
*/
|
||||
private Integer height;
|
||||
|
||||
/**
|
||||
* 室数
|
||||
*/
|
||||
private Integer room;
|
||||
|
||||
/**
|
||||
* 厅数
|
||||
*/
|
||||
private Integer hall;
|
||||
|
||||
/**
|
||||
* 卫数
|
||||
*/
|
||||
private Integer toilet;
|
||||
|
||||
/**
|
||||
* 朝向
|
||||
*/
|
||||
private String direction;
|
||||
|
||||
/**
|
||||
* 装修情况
|
||||
*/
|
||||
private String fitment;
|
||||
|
||||
private Map<String, Object> result;
|
||||
|
||||
@Override
|
||||
public String getCityName() {
|
||||
return cityName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCityName(String cityName) {
|
||||
this.cityName = cityName;
|
||||
}
|
||||
|
||||
public String getDistrict() {
|
||||
return district;
|
||||
}
|
||||
|
||||
public void setDistrict(String district) {
|
||||
this.district = district;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public double getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(double size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public Integer getFloor() {
|
||||
return floor;
|
||||
}
|
||||
|
||||
public void setFloor(Integer floor) {
|
||||
this.floor = floor;
|
||||
}
|
||||
|
||||
public Integer getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public void setHeight(Integer height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public Integer getRoom() {
|
||||
return room;
|
||||
}
|
||||
|
||||
public void setRoom(Integer room) {
|
||||
this.room = room;
|
||||
}
|
||||
|
||||
public Integer getHall() {
|
||||
return hall;
|
||||
}
|
||||
|
||||
public void setHall(Integer hall) {
|
||||
this.hall = hall;
|
||||
}
|
||||
|
||||
public Integer getToilet() {
|
||||
return toilet;
|
||||
}
|
||||
|
||||
public void setToilet(Integer toilet) {
|
||||
this.toilet = toilet;
|
||||
}
|
||||
|
||||
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 Map<String, Object> getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(Map<String, Object> result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package com.fangjia.open.util;
|
||||
|
||||
import com.fangjia.core.util.DataUtil;
|
||||
import com.fangjia.service.mongo.fangjia.FileService;
|
||||
import org.bson.types.ObjectId;
|
||||
import org.jfree.chart.ChartFactory;
|
||||
import org.jfree.chart.ChartPanel;
|
||||
import org.jfree.chart.ChartUtilities;
|
||||
import org.jfree.chart.JFreeChart;
|
||||
import org.jfree.chart.axis.NumberAxis;
|
||||
import org.jfree.chart.plot.CategoryPlot;
|
||||
import org.jfree.chart.plot.PlotOrientation;
|
||||
import org.jfree.chart.renderer.category.LineAndShapeRenderer;
|
||||
import org.jfree.chart.ui.ApplicationFrame;
|
||||
import org.jfree.data.category.DefaultCategoryDataset;
|
||||
import org.jfree.ui.RefineryUtilities;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 折线图绘图工具类
|
||||
*
|
||||
* @author shenjian
|
||||
* @since 2021/4/9
|
||||
*/
|
||||
public class LineChartsUtils {
|
||||
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
File file = new File("d://test.png");
|
||||
List<String> columns = new ArrayList<String>();
|
||||
columns.add("2020-02");
|
||||
columns.add("2020-03");
|
||||
columns.add("2020-04");
|
||||
columns.add("2020-05");
|
||||
columns.add("2020-06");
|
||||
columns.add("2020-07");
|
||||
columns.add("2020-08");
|
||||
columns.add("2020-09");
|
||||
columns.add("2020-10");
|
||||
columns.add("2020-11");
|
||||
columns.add("2020-12");
|
||||
columns.add("2021-01");
|
||||
|
||||
List<Integer> values = new ArrayList<Integer>();
|
||||
values.add(1000);
|
||||
values.add(2000);
|
||||
values.add(2000);
|
||||
values.add(2000);
|
||||
values.add(2000);
|
||||
values.add(2000);
|
||||
values.add(2000);
|
||||
values.add(3000);
|
||||
values.add(3000);
|
||||
values.add(3000);
|
||||
values.add(3000);
|
||||
values.add(3000);
|
||||
|
||||
createChartAndSave2Png("d://test.png", "1居室", columns, values);
|
||||
}
|
||||
|
||||
public static String createChartAndSave2Png(String path, String rowKey, List<String> columns, List<Integer> values) {
|
||||
File file = new File(path);
|
||||
try {
|
||||
ChartUtilities.saveChartAsPNG(file, createChart(rowKey, columns, values),800,300);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
public static String createChartAndUpload(FileService fileService, String rowKey, List<String> columns, List<Integer> values) {
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
try {
|
||||
ChartUtilities.writeChartAsPNG(os, createChart(rowKey, columns, values),800,300);
|
||||
byte[] data = os.toByteArray();
|
||||
String id = new ObjectId().toString();
|
||||
fileService.save(id,"o", data, "image/png", "o");
|
||||
String url = "http://img0.fangjia.com/stc/fs/" + DataUtil.encodePicUrl(id, "o", "house");
|
||||
|
||||
return url;
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (os != null) {
|
||||
try {
|
||||
os.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 定义图表对象
|
||||
* @param rowKey 曲线名,如一居室
|
||||
* @param columns 横坐标名
|
||||
* @param values 纵坐标值
|
||||
*/
|
||||
public static JFreeChart createChart(String rowKey, List<String> columns, List<Integer> values) {
|
||||
createDataset(rowKey, columns, values);
|
||||
// 折线图名称, 横坐标名称, 纵坐标名称 数据水平竖直 PlotOrientation.HORIZONTAL, 水平显示图像 true, 水平显示图像 true, include legend true, tooltips false, urls
|
||||
JFreeChart chart = ChartFactory.createLineChart("", "", "", createDataset(rowKey, columns, values), PlotOrientation.VERTICAL, true, true, false);
|
||||
CategoryPlot plot = chart.getCategoryPlot();
|
||||
plot.setRangeGridlinesVisible(false); // 是否显示格子线
|
||||
plot.setBackgroundAlpha(0.3f); // 设置背景透明度
|
||||
LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();
|
||||
renderer.setSeriesPaint(0, Color.BLUE);
|
||||
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
|
||||
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
|
||||
rangeAxis.setAutoRangeIncludesZero(true);
|
||||
rangeAxis.setUpperMargin(0.20);
|
||||
rangeAxis.setLabelAngle(Math.PI / 2.0);
|
||||
return chart;
|
||||
}
|
||||
|
||||
private static DefaultCategoryDataset createDataset(String rowKey, List<String> columns, List<Integer> values) {
|
||||
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
|
||||
for (int i = 0; i < columns.size(); i++) {
|
||||
String column = columns.get(i);
|
||||
if (values.get(i) != null) {
|
||||
dataset.addValue(Double.valueOf(values.get(i)), rowKey, column);
|
||||
} else {
|
||||
dataset.addValue(null, rowKey, column);
|
||||
}
|
||||
}
|
||||
return dataset;
|
||||
}
|
||||
}
|
||||
@@ -38,6 +38,8 @@ public class OpenApiClient {
|
||||
// }
|
||||
|
||||
JSONObject matchResult = request.getJsonContent(url, params, "UTF-8");
|
||||
|
||||
|
||||
if(matchResult.getInt("code") == 200){
|
||||
return matchResult.getJSONObject("result");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,489 @@
|
||||
<#ftl attributes={"content_type":"text/html; charset=UTF-8"}>
|
||||
<#compress>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta name="referrer" content="no-referrer"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
|
||||
<title>租金报告中心</title>
|
||||
<meta name="viewport" content="initial-scale=1, maximum-scale=1"/>
|
||||
<link rel="shortcut icon" href="/favicon.ico"/>
|
||||
<meta name="apple-mobile-web-app-capable" content="yes"/>
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
|
||||
|
||||
<link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm.css"/>
|
||||
<link rel="stylesheet" href="../static/style/wx.css"/>
|
||||
<style type="text/css">
|
||||
body {
|
||||
overflow: hidden;
|
||||
overflow-y: scroll;
|
||||
background: #f8f8f8;
|
||||
}
|
||||
.main {
|
||||
margin: 4px 8px 4px 8px;
|
||||
background: #f8f8f8;
|
||||
}
|
||||
.title {
|
||||
position: relative;
|
||||
color: #1E90FF;
|
||||
}
|
||||
.title1 {
|
||||
font-size: 14px;
|
||||
color: #1E90FF;
|
||||
}
|
||||
.p {
|
||||
font-size: 12px;
|
||||
}
|
||||
.table {
|
||||
width: 100%;
|
||||
overflow-y: hidden;
|
||||
overflow-x: scroll
|
||||
}
|
||||
.inline {
|
||||
width: 550px;
|
||||
border-spacing: 0;
|
||||
text-align: left;
|
||||
}
|
||||
.table .inline th {
|
||||
color: #999;
|
||||
font-weight: normal;
|
||||
line-height: 30px;
|
||||
text-align: left;
|
||||
}
|
||||
.download {
|
||||
float: right;
|
||||
color: #3d4145;
|
||||
border: solid 1px #333;
|
||||
order-radius: 3px;
|
||||
font-size: 12px;
|
||||
line-height: 1rem;
|
||||
width: 43px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="title">
|
||||
估值报告<span class="download" id="download">下载</span>
|
||||
</div>
|
||||
<div>
|
||||
<div class="title1">1 评估申明</div>
|
||||
<div class="p">建设银行遵循中立、客观、公正的原则,通过周密细致的测算,评估求得分析对象的房地产市场参考。</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="title1">2 评估时间</div>
|
||||
<div class="p">
|
||||
<span name="cal_date"></span><br/>
|
||||
评估结果<br/>
|
||||
楼盘名称:<span name="name"></span><br/>
|
||||
楼盘地址:<span name="address"></span><br/>
|
||||
租金估值(RMB):<span name="totalPrice"></span>元/月<br/>
|
||||
大写(人民币):<span name="totalPriceUpper"></span><br/>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="title1">3 报告有效期</div>
|
||||
<div class="p">本报告在市场无较大波动的情况下,该评估价格在报告出具起三个月内有效。</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="title1">4 房产状况</div>
|
||||
<div class="p">
|
||||
详细地址:<span name="address"></span><br/>
|
||||
楼盘名称:<span name="name"></span><br/>
|
||||
室号:<span name="room"></span><br/>
|
||||
朝向:<span name="direction"></span><br/>
|
||||
建筑面积:<span name="size"></span>平米<br/>
|
||||
所在楼层:<span name="floor"></span> 层 <span name="height"></span>总层数<br/>
|
||||
电梯配套:<span name="hasLift"></span><br/>
|
||||
装修情况:<span name="fitment"></span><br/>
|
||||
建筑年代:<span name="buildYear"></span><br/>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="title1">5 历史租金</div>
|
||||
<div class="charts" id="districtRentTrendsChart"></div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="title1">6 已租房源</div>
|
||||
<div class="p table">
|
||||
<table class="inline">
|
||||
<thead>
|
||||
<tr class="bg">
|
||||
<th class="th01">城市</th>
|
||||
<th>区域</th>
|
||||
<th>小区名</th>
|
||||
<th>成交价</th>
|
||||
<th>面积</th>
|
||||
<th>室</th>
|
||||
<th>厅</th>
|
||||
<th>装修</th>
|
||||
<th>成交日期</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="trades">
|
||||
<td colspan="6">暂无数据</td>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="title1">7 样本参考</div>
|
||||
<div class="p table">
|
||||
<table class="inline">
|
||||
<thead>
|
||||
<tr class="bg">
|
||||
<th class="th01">城市</th>
|
||||
<th>区域</th>
|
||||
<th>小区名</th>
|
||||
<th>租金</th>
|
||||
<th>面积</th>
|
||||
<th>室</th>
|
||||
<th>厅</th>
|
||||
<th>装修</th>
|
||||
<th>成交日期</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="referenceHouses">
|
||||
<td colspan="6">暂无数据</td>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="title1">8 周边同类小区租金</div>
|
||||
<div class="p table">
|
||||
<table class="inline" style="width: 300px">
|
||||
<thead>
|
||||
<tr class="bg">
|
||||
<th class="th01">城市</th>
|
||||
<th>区域</th>
|
||||
<th>小区名</th>
|
||||
<th>平米租金</th>
|
||||
<th>室</th>
|
||||
<th>厅</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="sameDistricts">
|
||||
<tr class="">
|
||||
<td colspan="6">暂无数据</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type='text/javascript' src='http://g.alicdn.com/sj/lib/zepto/zepto.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='http://g.alicdn.com/msui/sm/0.6.2/js/sm.js' charset='utf-8'></script>
|
||||
<!-- 暂时注释 -->
|
||||
<script type="text/javascript" src="http://cdn.hcharts.cn/highcharts/highcharts.js"></script>
|
||||
<script type='text/javascript' src='../static/js/wx.js' charset='utf-8'></script>
|
||||
<script type="text/javascript" src="../static/js/trend-charts.js"></script>
|
||||
<script src="https://html2canvas.hertzen.com/dist/html2canvas.js"></script>
|
||||
<#-- <script src="../static/js/purify.min.js"></script>-->
|
||||
<#-- <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.3.1/jspdf.umd.min.js"></script>-->
|
||||
<#-- <script src="../static/js/jspdf.umd.js"></script>-->
|
||||
<#-- <script src="../static/js/SourceHanSans-normal.js"></script>-->
|
||||
<#-- <script src="../static/js/simsun-normal.js"></script>-->
|
||||
<#-- <script type="text/javascript">-->
|
||||
<#-- $("#download").bind('click', function(){-->
|
||||
<#-- window.location.href = "download"-->
|
||||
<#-- // 打印所有可用的字体-->
|
||||
<#-- // jspdf.html(document.body, {-->
|
||||
<#-- // callback: function (doc) {-->
|
||||
<#-- // doc.save("租金报告.pdf");-->
|
||||
<#-- // },-->
|
||||
<#-- // x: 10,-->
|
||||
<#-- // y: 10-->
|
||||
<#-- // });-->
|
||||
<#-- // jspdf.html("test测试", {-->
|
||||
<#-- // callback: function (doc) {-->
|
||||
<#-- // doc.save("租金报告.pdf");-->
|
||||
<#-- // },-->
|
||||
<#-- // x: 10,-->
|
||||
<#-- // y: 10-->
|
||||
<#-- // });-->
|
||||
<#-- });-->
|
||||
<#-- $(function () {-->
|
||||
<#-- $('span[name="name"]').text('场中小区');-->
|
||||
<#-- });-->
|
||||
<#-- </script>-->
|
||||
<script type="text/javascript">
|
||||
// window.jsPDF = window.jspdf.jsPDF
|
||||
// var jspdf = new jsPDF();
|
||||
// jspdf.addFileToVFS('SourceHanSans-Normal.ttf',normalChinese);
|
||||
// jspdf.addFont('SourceHanSans-Normal.ttf', 'SourceHanSans-Normal', 'normal');
|
||||
// jspdf.setFont('SourceHanSans-Light');
|
||||
//console.log(jspdf.getFontList());
|
||||
$("#download").bind('click', function(){
|
||||
window.location.href = "download?city="+params.city+"&district="+params.district+"&name="+params.name+"&address="+params.address+"&size="+params.size+"&floor="+params.floor
|
||||
+"&height="+params.height+"&room="+params.room+"&hall="+params.hall+"&toilet="+params.toilet+"&direction="+params.direction+"&fitment="+params.fitment;
|
||||
// jspdf.html(document.body, {
|
||||
// callback: function (doc) {
|
||||
// doc.save("租金报告.pdf");
|
||||
// },
|
||||
// x: 0,
|
||||
// y: 0,
|
||||
// fontFaces: [{
|
||||
// family: 'SimSun',
|
||||
// weight: 'bold',
|
||||
// //style: style,
|
||||
// src: [{
|
||||
// format: "truetype",
|
||||
// url: "../static/fonts/SimSun.ttf"
|
||||
// }]
|
||||
// }]
|
||||
// });
|
||||
});
|
||||
|
||||
// 后台传参过来用
|
||||
let params = {
|
||||
'city': sessionStorage.city,
|
||||
'district': sessionStorage.district,
|
||||
'name': sessionStorage.name,
|
||||
'address': sessionStorage.address,
|
||||
'size': sessionStorage.size,
|
||||
'floor': sessionStorage.floor,
|
||||
'height': sessionStorage.height,
|
||||
'room': sessionStorage.room,
|
||||
'hall': sessionStorage.hall,
|
||||
'toilet': sessionStorage.toilet,
|
||||
'direction': sessionStorage.direction,
|
||||
'fitment': sessionStorage.fitment
|
||||
};
|
||||
|
||||
function init() {
|
||||
$.ajax({
|
||||
// 注意需要加..
|
||||
url: '../property/rentReport',
|
||||
data: params,
|
||||
dataType:"json",
|
||||
type:"post",
|
||||
success:function(data){
|
||||
if(data.code == 200){
|
||||
let result = data.result;
|
||||
// 评估时间
|
||||
$('span[name="cal_date"]').text(result.cal_date)
|
||||
$('span[name="name"]').text(result.name);
|
||||
$('span[name="address"]').text(result.address);
|
||||
$('span[name="totalPrice"]').text(result.totalPrice)
|
||||
$('span[name="totalPriceUpper"]').text(result.totalPriceUpper)
|
||||
|
||||
// 历史租金
|
||||
var charts = {}
|
||||
// charts.series = [{
|
||||
// name: '1居室',
|
||||
// data: [3800, 3900, 4000, 4100, 4200, 4200, 4200, 4200]
|
||||
// }];
|
||||
if (result.trends.distMap[params.room] == undefined) {
|
||||
console.log("返回历史租金,不存在" + params.room + "居室数据")
|
||||
$('#districtRentTrendsChart').empty();
|
||||
$('#districtRentTrendsChart').removeClass("charts");
|
||||
$('#districtRentTrendsChart').addClass("p table");
|
||||
$('#districtRentTrendsChart').append('<table style="width: 300px"><tr colspan="6">暂无数据<td></tr></table>');
|
||||
} else {
|
||||
var arr = [];
|
||||
result.trends.times.forEach(function (d) {
|
||||
var price = result.trends.distMap[params.room][d];
|
||||
if (price != undefined) {
|
||||
arr.push(price);
|
||||
} else {
|
||||
arr.push('');
|
||||
}
|
||||
})
|
||||
charts.series = [{'name': params.room + '居室', 'data': arr}]; // 纵坐标
|
||||
charts.xData = result.trends.times; // 横坐标值
|
||||
createChartNow('districtRentTrendsChart', charts, true);
|
||||
}
|
||||
// 房产状况
|
||||
$('span[name="room"]').text(result.room)
|
||||
$('span[name="direction"]').text(result.direction)
|
||||
$('span[name="size"]').text(result.size)
|
||||
$('span[name="floor"]').text(result.floor)
|
||||
$('span[name="height"]').text(result.height)
|
||||
$('span[name="hasLift"]').text(result.hasLift)
|
||||
$('span[name="fitment"]').text(result.fitment)
|
||||
$('span[name="buildYear"]').text(result.buildYear)
|
||||
|
||||
// 已租房源
|
||||
var trades = result.trades;
|
||||
if (trades && trades.length > 0) {
|
||||
$('#trades').empty();
|
||||
trades.forEach(function(d){
|
||||
var fitment = d.fitment != undefined ? d.fitment : '';
|
||||
var hall = d.hall != undefined ? d.hall : '';
|
||||
$('#trades').append('<tr class="bg"> \
|
||||
<td class="td01">' + d.city + '</td> \
|
||||
<td class="td02">' + d.region + '</td> \
|
||||
<td>' + d.districtName + '</td> \
|
||||
<td>' + d.totalPrice + '</td> \
|
||||
<td>' + d.area + '</td> \
|
||||
<td>' + d.room + '</td> \
|
||||
<td>' + hall + '</td> \
|
||||
<td>' + fitment + '</td> \
|
||||
<td>' + formatDate(d.tradeDate) + '</td> \
|
||||
</tr>');
|
||||
})
|
||||
}
|
||||
|
||||
// 样本参考
|
||||
var referenceHouses = result.houses;
|
||||
if (referenceHouses && referenceHouses.length > 0) {
|
||||
$('#referenceHouses').empty();
|
||||
referenceHouses.forEach(function(d){
|
||||
var fitment = d.fitment != undefined ? d.fitment : '';
|
||||
var date = (d.pDate + '').substring(0, 4) + "-" + (d.pDate + '').substring(4, 6) + "-" + (d.pDate + '').substring(6, 8)
|
||||
$('#referenceHouses').append('<tr class="bg"> \
|
||||
<td class="td01">' + d.city + '</td> \
|
||||
<td class="td02">' + d.region + '</td> \
|
||||
<td>' + d.districtName + '</td> \
|
||||
<td>' + d.totalPrice + '</td> \
|
||||
<td>' + d.area + '</td> \
|
||||
<td>' + d.room + '</td> \
|
||||
<td>' + d.hall + '</td> \
|
||||
<td>' + fitment + '</td> \
|
||||
<td>' + date + '</td> \
|
||||
</tr>');
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
// 同类小区租金
|
||||
var sameDistricts = result.districts;
|
||||
if (sameDistricts && sameDistricts.length > 0) {
|
||||
$('#sameDistricts').empty()
|
||||
sameDistricts.forEach(function(d){
|
||||
$('#sameDistricts').append('<tr class=""> \
|
||||
<td class="td01">' + d.city + '</td> \
|
||||
<td class="td02">' + d.region + '</td> \
|
||||
<td>' + d.districtName + '</td> \
|
||||
<td>' + d.roomPrice + '</td> \
|
||||
<td>' + d.room + '</td> \
|
||||
<td>1</td> \
|
||||
</tr>');
|
||||
})
|
||||
}
|
||||
}else{
|
||||
$.toast(data.msg);
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
|
||||
}
|
||||
})
|
||||
};
|
||||
var formatDate = function (dateStr) {
|
||||
var date = new Date(dateStr);
|
||||
var y = date.getFullYear();
|
||||
var m = date.getMonth() + 1;
|
||||
m = m < 10 ? ('0' + m) : m;
|
||||
var d = date.getDate();
|
||||
d = d < 10 ? ('0' + d) : d;
|
||||
return y + '-' + m + '-' + d;
|
||||
};
|
||||
function createChartNow(renderId, data, showTradeCount) {
|
||||
if(data == null || data == 'undefined' || typeof(data) == undefined) {
|
||||
return;
|
||||
}
|
||||
if(data.series == 'undefined' || data.series.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
var yaxis = [{
|
||||
title: {
|
||||
enable: false,
|
||||
text: ''
|
||||
},
|
||||
offset : -5,
|
||||
labels: {
|
||||
formatter: function() {
|
||||
return this.value + "元";
|
||||
}
|
||||
}
|
||||
}];
|
||||
|
||||
if(showTradeCount) {
|
||||
yaxis.push({
|
||||
title: {
|
||||
enable: false,
|
||||
text: ''
|
||||
},
|
||||
labels: {
|
||||
formatter: function() {
|
||||
return this.value +'套';
|
||||
},
|
||||
style: {
|
||||
color: '#4572A7'
|
||||
}
|
||||
},
|
||||
opposite: true
|
||||
});
|
||||
}
|
||||
|
||||
var config = {yaxis : yaxis};
|
||||
createHighChartNow(renderId, data, config);
|
||||
};
|
||||
function createHighChartNow(renderId, data, config) {
|
||||
var chart = new Highcharts.Chart({
|
||||
credits:{
|
||||
enabled:true,
|
||||
text: '',
|
||||
href: "",
|
||||
position: {
|
||||
align: 'center',
|
||||
verticalAlign: 'top',
|
||||
x: 0,
|
||||
y: 25
|
||||
},
|
||||
itemStyle: {
|
||||
cursor: 'pointer'
|
||||
}
|
||||
},
|
||||
chart: {
|
||||
renderTo: renderId,
|
||||
type: 'spline'
|
||||
},
|
||||
title: {
|
||||
text: data.title,
|
||||
floating: false,
|
||||
align: 'center',
|
||||
x : 0,
|
||||
y : 10
|
||||
},
|
||||
legend: {
|
||||
align: 'center',
|
||||
verticalAlign: 'bottom'
|
||||
},
|
||||
xAxis: {
|
||||
type: 'datetime',
|
||||
dateTimeLabelFormats: {
|
||||
day: '%m月%d',
|
||||
week: '%m月%d',
|
||||
month: '%Y.%m',
|
||||
year: '%Y-%m'
|
||||
},
|
||||
categories: data.xData
|
||||
},
|
||||
yAxis: config.yaxis,
|
||||
series: data.series,
|
||||
tooltip: {
|
||||
formatter: function() {
|
||||
if(this.series.name.indexOf('成交量') > -1) {
|
||||
return Highcharts.dateFormat('%Y年%m月', this.x) +" 成交: <span style='color:#F50;font-weight: bold;'>"+ this.y +'</span>套';
|
||||
}else {
|
||||
return Highcharts.dateFormat('%Y-%m-%d', this.x) +'<br/>'+ this.series.name+ ": <span style='color:#F50;font-weight: bold;'>"+ this.y +'</span>元/平米';
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
$(function () {
|
||||
init();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</#compress>
|
||||
@@ -0,0 +1,236 @@
|
||||
<#ftl attributes={"content_type":"text/html; charset=UTF-8"}>
|
||||
<#compress>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta name="referrer" content="no-referrer"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
|
||||
<title>租金报告中心</title>
|
||||
<meta name="viewport" content="initial-scale=1, maximum-scale=1"/>
|
||||
<link rel="shortcut icon" href="/favicon.ico"/>
|
||||
<meta name="apple-mobile-web-app-capable" content="yes"/>
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
|
||||
|
||||
<link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm.css"/>
|
||||
<link rel="stylesheet" href="../static/style/wx.css"/>
|
||||
<style type="text/css">
|
||||
body {
|
||||
overflow: hidden;
|
||||
overflow-y: scroll;
|
||||
background: #f8f8f8;
|
||||
/** 特别注意,否则中文不生效 **/
|
||||
font-family: SimSun;
|
||||
}
|
||||
.main {
|
||||
margin: 4px 8px 4px 8px;
|
||||
background: #f8f8f8;
|
||||
}
|
||||
.title {
|
||||
position: relative;
|
||||
color: #1E90FF;
|
||||
}
|
||||
.title1 {
|
||||
font-size: 14px;
|
||||
color: #1E90FF;
|
||||
}
|
||||
.p {
|
||||
font-size: 12px;
|
||||
}
|
||||
.table {
|
||||
width: 100%;
|
||||
overflow-y: hidden;
|
||||
overflow-x: scroll
|
||||
}
|
||||
.inline {
|
||||
width: 550px;
|
||||
border-spacing: 0;
|
||||
text-align: left;
|
||||
}
|
||||
.table .inline th {
|
||||
color: #999;
|
||||
font-weight: normal;
|
||||
line-height: 30px;
|
||||
text-align: left;
|
||||
}
|
||||
.download {
|
||||
float: right;
|
||||
color: #3d4145;
|
||||
border: solid 1px #333;
|
||||
order-radius: 3px;
|
||||
font-size: 12px;
|
||||
line-height: 1rem;
|
||||
width: 43px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="title">
|
||||
估值报告
|
||||
</div>
|
||||
<div>
|
||||
<div class="title1">1 评估申明</div>
|
||||
<div class="p">建设银行遵循中立、客观、公正的原则,通过周密细致的测算,评估求得分析对象的房地产市场参考。</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="title1">2 评估时间</div>
|
||||
<div class="p">
|
||||
<span name="cal_date"><#if result.cal_date??>${result.cal_date}</#if></span><br/>
|
||||
评估结果<br/>
|
||||
楼盘名称:<span name="name"><#if result.name??>${result.name}</#if></span><br/>
|
||||
楼盘地址:<span name="address"><#if result.address??>${result.address}</#if></span><br/>
|
||||
租金估值(RMB):<span name="totalPrice"><#if result.totalPrice??>${result.totalPrice}</#if></span>元/月<br/>
|
||||
大写(人民币):<span name="totalPriceUpper"><#if result.totalPriceUpper??>${result.totalPriceUpper}</#if></span><br/>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="title1">3 报告有效期</div>
|
||||
<div class="p">本报告在市场无较大波动的情况下,该评估价格在报告出具起三个月内有效。</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="title1">4 房产状况</div>
|
||||
<div class="p">
|
||||
详细地址:<span name="address"><#if result.address??>${result.address}</#if></span><br/>
|
||||
楼盘名称:<span name="name"><#if result.name??>${result.name}</#if></span><br/>
|
||||
室号:<span name="room"><#if result.room??>${result.room}</#if></span><br/>
|
||||
朝向:<span name="direction"><#if result.direction??>${result.direction}</#if></span><br/>
|
||||
建筑面积:<span name="size"><#if result.size??>${result.size}</#if></span>平米<br/>
|
||||
所在楼层:<span name="floor"><#if result.floor??>${result.floor}</#if></span> 层 <span name="height"><#if result.height??>${result.height}</#if></span>总层数<br/>
|
||||
电梯配套:<span name="hasLift"><#if result.hasLift??>${result.hasLift}</#if></span><br/>
|
||||
装修情况:<span name="fitment"><#if result.fitment??>${result.fitment}</#if></span><br/>
|
||||
建筑年代:<span name="buildYear"><#if result.buildYear??>${result.buildYear}</#if></span><br/>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="title1">5 历史租金</div>
|
||||
<div>
|
||||
<#if result.tradesImgUrl??>
|
||||
<#-- <img width="800px" height="300px" src="../static/images/test.png"></img>-->
|
||||
<img width="800px" height="300px" src="${result.tradesImgUrl}"></img>
|
||||
<#else>
|
||||
<div class="p table">
|
||||
<table class="inline">
|
||||
<tbody><tr><td>暂无数据</td></tr></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</#if>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="title1">6 已租房源</div>
|
||||
<div class="p table">
|
||||
<table class="inline">
|
||||
<thead>
|
||||
<tr class="bg">
|
||||
<th class="th01">城市</th>
|
||||
<th>区域</th>
|
||||
<th>小区名</th>
|
||||
<th>成交价</th>
|
||||
<th>面积</th>
|
||||
<th>室</th>
|
||||
<th>厅</th>
|
||||
<th>装修</th>
|
||||
<th>成交日期</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<#if (result.trades??&&result.trades?size>0)>
|
||||
<#list result.trades as bo>
|
||||
<tr class="">
|
||||
<td class="td01"><#if bo.city??>${bo.city}</#if></td>
|
||||
<td class="td02"><#if bo.region??>${bo.region}</#if></td>
|
||||
<td><#if bo.districtName??>${bo.districtName}</#if></td>
|
||||
<td><#if bo.totalPrice??>${bo.totalPrice}</#if></td>
|
||||
<td><#if bo.area??>${bo.area}</#if></td>
|
||||
<td><#if bo.room??>${bo.room}</#if></td>
|
||||
<td><#if bo.hall??>${bo.hall}</#if></td>
|
||||
<td><#if bo.fitment??>${bo.fitment}</#if></td>
|
||||
<td><#if bo.source??>${bo.source}</#if></td>
|
||||
</tr>
|
||||
</#list>
|
||||
<#else>
|
||||
<tr><td>暂无数据</td></tr>
|
||||
</#if>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="title1">7 样本参考</div>
|
||||
<div class="p table">
|
||||
<table class="inline">
|
||||
<thead>
|
||||
<tr class="bg">
|
||||
<th class="th01">城市</th>
|
||||
<th>区域</th>
|
||||
<th>小区名</th>
|
||||
<th>租金</th>
|
||||
<th>面积</th>
|
||||
<th>室</th>
|
||||
<th>厅</th>
|
||||
<th>装修</th>
|
||||
<th>成交日期</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="referenceHouses">
|
||||
<#if (result.houses??&&result.houses?size>0)>
|
||||
<#list result.houses as bo>
|
||||
<tr class="">
|
||||
<td class="td01"><#if bo.city??>${bo.city}</#if></td>
|
||||
<td class="td02"><#if bo.region??>${bo.region}</#if></td>
|
||||
<td><#if bo.districtName??>${bo.districtName}</#if></td>
|
||||
<td><#if bo.totalPrice??>${bo.totalPrice}</#if></td>
|
||||
<td><#if bo.area??>${bo.area}</#if></td>
|
||||
<td><#if bo.room??>${bo.room}</#if></td>
|
||||
<td><#if bo.hall??>${bo.hall}</#if></td>
|
||||
<td><#if bo.fitment??>${bo.fitment}</#if></td>
|
||||
<td><#if bo.root??>${bo.root}</#if></td>
|
||||
</tr>
|
||||
</#list>
|
||||
<#else>
|
||||
<tr><td>暂无数据</td></tr>
|
||||
</#if>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="title1">8 周边同类小区租金</div>
|
||||
<div class="p table">
|
||||
<table class="inline" style="width: 300px">
|
||||
<thead>
|
||||
<tr class="bg">
|
||||
<th class="th01">城市</th>
|
||||
<th>区域</th>
|
||||
<th>小区名</th>
|
||||
<th>平米租金</th>
|
||||
<th>室</th>
|
||||
<th>厅</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="sameDistricts">
|
||||
<#if (result.districts??&&result.districts?size>0)>
|
||||
<#list result.districts as bo>
|
||||
<tr class="">
|
||||
<td class="td01"><#if bo.city??>${bo.city}</#if></td>
|
||||
<td class="td02"><#if bo.region??>${bo.region}</#if></td>
|
||||
<td><#if bo.districtName??>${bo.districtName}</#if></td>
|
||||
<td><#if bo.totalPrice??>${bo.totalPrice}</#if></td>
|
||||
<td><#if bo.room??>${bo.room}</#if></td>
|
||||
<td><#if bo.hall??>${bo.hall}</#if></td>
|
||||
</tr>
|
||||
</#list>
|
||||
<#else>
|
||||
<tr><td>暂无数据</td></tr>
|
||||
</#if>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</#compress>
|
||||
@@ -0,0 +1,403 @@
|
||||
<#ftl attributes={"content_type":"text/html; charset=UTF-8"}>
|
||||
<#compress>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>租金评估</title>
|
||||
<meta name="viewport" content="initial-scale=1, maximum-scale=1">
|
||||
<link rel="shortcut icon" href="/favicon.ico">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm.css">
|
||||
<link rel="stylesheet" href="../static/style/wx.css">
|
||||
<style>
|
||||
.list-block .item-content .item-inner{margin-left:0;padding-left:0.75rem;}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="page-group">
|
||||
<div class="page page-current">
|
||||
<input type="hidden" id="t" value="c">
|
||||
<form id="evaluateForm">
|
||||
<div class="content">
|
||||
<div class="list-block" style="margin-bottom:60px;">
|
||||
<ul>
|
||||
<li>
|
||||
<div class="item-content">
|
||||
<div class="item-inner">
|
||||
<input id="cityName" value="上海" name="city" type="hidden">
|
||||
<input value="2000" name="radius" type="hidden">
|
||||
<div class="item-title label">城市:<font>上海</font></div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="item-content">
|
||||
<div class="item-inner">
|
||||
<div class="item-title label">地址:</div>
|
||||
<div class="item-input">
|
||||
<input type="text" placeholder="请输入小区名或地址" id="districtSearch" name="name" class="search_input" required>
|
||||
<input type="hidden" name="address" />
|
||||
</div>
|
||||
<!-- 区域 -->
|
||||
<input value="" name="district" type="hidden" required>
|
||||
<div class="item-media"><span>(必填项)</span></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="searchSpan" style="margin-bottom:50px;z-index:999;position: absolute; width: 100%;" >
|
||||
<ul></ul>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="item-content">
|
||||
<div class="item-inner">
|
||||
<div class="item-title label">面积:</div>
|
||||
<div class="item-input">
|
||||
<input type="number" name="size" placeholder="请输入建筑面积(平米)" id="houseArea" min="0" max="1000" value="" required>
|
||||
</div>
|
||||
<div class="item-media"><span>(必填项)</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="item-content">
|
||||
<div class="item-inner">
|
||||
<div class="content-block">
|
||||
<div class="item-title label di">户型:</div>
|
||||
<input name="room" type="hidden" id="room" placeholder="请选择室" value="1">
|
||||
<input name="hall" type="hidden" id="hall" placeholder="请选择厅">
|
||||
<input name="toilet" type="hidden" id="toilet" placeholder="请选择卫">
|
||||
<p class="di">
|
||||
<a href="#" class="create-actions01-now">1</a>室 <a
|
||||
href="#" class="create-actions02-now">0</a>厅 <a
|
||||
href="#" class="create-actions03-now">0</a>卫
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="item-content">
|
||||
<div class="item-inner">
|
||||
<div class="item-title label">楼层:</div>
|
||||
<div class="item-input">
|
||||
<input type="number" name="floor" id="houseFloor" placeholder="请输入所在楼层" min="1" max="200" required value="">
|
||||
</div>
|
||||
<div class="item-media"><span>(必填项)</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="item-content">
|
||||
<div class="item-inner">
|
||||
<div class="item-title label">总楼层:</div>
|
||||
<div class="item-input">
|
||||
<input type="number" name="height" id="houseHight" placeholder="请输入总楼层" min="1" max="200" value="" required>
|
||||
</div>
|
||||
<div class="item-media"><span>(必填项)</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="moreInput dn">
|
||||
<li>
|
||||
<div class="item-content">
|
||||
|
||||
<div class="item-inner">
|
||||
<div class="content-block">
|
||||
<div class="item-title label di">朝向:</div>
|
||||
<input id="direction" type="hidden" name="direction">
|
||||
<p class="di"><a href="#" class="create-actions04">请选择朝向</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="item-content">
|
||||
|
||||
<div class="item-inner">
|
||||
<div class="content-block">
|
||||
<div class="item-title label di">装修情况:</div>
|
||||
<input type="hidden" id="fitment" name="fitment">
|
||||
<p class="di"><a href="#" class="create-actions05">请选择装修情况</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="item-content">
|
||||
<div class="item-inner">
|
||||
<div class="content-block">
|
||||
<div class="item-title label di">电梯配套:</div>
|
||||
<input type="hidden" id="hasLift" name="hasLift" placeholder="请选择电梯配套">
|
||||
<p class="di"><a href="#" class="create-actions14-now">请选择电梯配套</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
<div class="more_btn">继续填写,租金更加精准↓</div>
|
||||
<div class="little_btn dn">收起</div>
|
||||
</div>
|
||||
<div class="content-block">
|
||||
<p><a id="evaluateBtn" class="button button-big button-fill">查看租金结果</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type='text/javascript' src='http://g.alicdn.com/sj/lib/zepto/zepto.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='http://g.alicdn.com/msui/sm/0.6.2/js/sm.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='../static/js/select.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='../static/js/wx.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='../static/js/autoCompletion.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='../static/js/jquery.cookie.js' charset='utf-8'></script>
|
||||
<script type="text/javascript">
|
||||
function storeSession() {
|
||||
sessionStorage.city = $('input[name="city"]').val()
|
||||
sessionStorage.name = $('input[name="name"]').val()
|
||||
sessionStorage.district = $('input[name="district"]').val()
|
||||
sessionStorage.address = $('input[name="address"]').val()
|
||||
sessionStorage.size = $('input[name="size"]').val()
|
||||
sessionStorage.room = $('input[name="room"]').val()
|
||||
sessionStorage.hall = $('input[name="hall"]').val()
|
||||
sessionStorage.toilet = $('input[name="toilet"]').val()
|
||||
sessionStorage.floor = $('input[name="floor"]').val()
|
||||
sessionStorage.height = $('input[name="height"]').val()
|
||||
sessionStorage.direction = $('input[name="direction"]').val()
|
||||
sessionStorage.fitment = $('input[name="fitment"]').val()
|
||||
}
|
||||
function getSession() {
|
||||
if (sessionStorage.city != undefined) {
|
||||
$('input[name="city"]').val(sessionStorage.city)
|
||||
}
|
||||
if (sessionStorage.name != undefined) {
|
||||
$('input[name="name"]').val(sessionStorage.name)
|
||||
}
|
||||
if (sessionStorage.district != undefined) {
|
||||
$('input[name="district"]').val(sessionStorage.district)
|
||||
}
|
||||
if (sessionStorage.address != undefined) {
|
||||
$('input[name="address"]').val(sessionStorage.address)
|
||||
}
|
||||
if (sessionStorage.size != undefined) {
|
||||
$('input[name="size"]').val(sessionStorage.size)
|
||||
}
|
||||
if (sessionStorage.room != undefined) {
|
||||
$('input[name="room"]').val(sessionStorage.room)
|
||||
}
|
||||
if (sessionStorage.hall != undefined) {
|
||||
$('input[name="hall"]').val(sessionStorage.hall)
|
||||
}
|
||||
if (sessionStorage.toilet != undefined) {
|
||||
$('input[name="toilet"]').val(sessionStorage.toilet)
|
||||
}
|
||||
if (sessionStorage.floor != undefined) {
|
||||
$('input[name="floor"]').val(sessionStorage.floor)
|
||||
}
|
||||
if (sessionStorage.height != undefined) {
|
||||
$('input[name="height"]').val(sessionStorage.height)
|
||||
}
|
||||
if (sessionStorage.direction != undefined) {
|
||||
$('input[name="direction"]').val(sessionStorage.direction)
|
||||
}
|
||||
if (sessionStorage.fitment != undefined) {
|
||||
$('input[name="fitment"]').val(sessionStorage.fitment)
|
||||
}
|
||||
}
|
||||
|
||||
$("#evaluateBtn").on('click', function(){
|
||||
var inputs = $("input")
|
||||
for (var i = 0; i < inputs.length; i++) {
|
||||
var input = $(inputs[i])
|
||||
var fieldName = input.attr("placeholder").substring(3)
|
||||
var fieldVal = $.trim(input.val())
|
||||
if (input.attr("required") && fieldVal == "") {
|
||||
if (input.attr("name").indexOf("district") != -1) {
|
||||
$.toast("请选择输入地址时提示的小区")
|
||||
} else {
|
||||
$.toast(fieldName + "不能为空");
|
||||
}
|
||||
return
|
||||
}
|
||||
if (input.attr("type") == 'number' && fieldVal != "") {
|
||||
if (input.attr("name").indexOf("size") != -1) {
|
||||
if (!/^[0-9]+(.[0-9]+)?$/.test(fieldVal)) {
|
||||
$.toast(fieldName + "非法");
|
||||
return
|
||||
}
|
||||
|
||||
} else {
|
||||
if (!/^[0-9]+$/.test(fieldVal)) {
|
||||
$.toast(fieldName + "必须是正整数");
|
||||
return
|
||||
}
|
||||
}
|
||||
var min = input.attr("min")
|
||||
var max = input.attr("max")
|
||||
if (max && min && (parseFloat(min) > parseFloat(fieldVal) || parseFloat(max) < parseFloat(fieldVal))) {
|
||||
$.toast(fieldName + "的取值范围是:" + min + "到" + max);
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
if(parseFloat($("#houseHight").val()) < parseFloat($("#houseFloor").val())){
|
||||
$.toast("楼层不能大于楼高");
|
||||
return
|
||||
}
|
||||
storeSession()
|
||||
|
||||
if($("#houseHight").val() && parseFloat($("#houseHight").val())>=60){
|
||||
$.toast("请输入合理的楼层数");
|
||||
return
|
||||
}
|
||||
$("#evaluateBtn").prop("disabled", true)
|
||||
$.ajax({
|
||||
// 注意需要加..
|
||||
url: '../property/evaluateRent',
|
||||
data:$("#evaluateForm").serialize(),
|
||||
dataType:"json",
|
||||
type:"post",
|
||||
success:function(data){
|
||||
if(data.code == 200){
|
||||
window.location.href = "report?address=" + data.result.address + "&totalPrice=" + data.result.totalPrice
|
||||
}else{
|
||||
$.toast("估价失败,请重新评估");
|
||||
$("#evaluateBtn").prop("disabled", false)
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
//$.toast("服务器异常,请重新评估");
|
||||
$("#evaluateBtn").prop("disabled", false)
|
||||
}
|
||||
})
|
||||
})
|
||||
// 选择操作-房型-室
|
||||
$(document).on('click', '.create-actions01-now', function () {
|
||||
var buttons1 = [
|
||||
{
|
||||
text: '请选择室',
|
||||
label: true
|
||||
}
|
||||
];
|
||||
for (var i = 1; i < 10; i++) {
|
||||
buttons1.push({
|
||||
text: i + '',
|
||||
onClick: function () {
|
||||
$("#room").val(this.text)
|
||||
$(".create-actions01-now").empty().text(this.text).addClass("selected")
|
||||
}
|
||||
})
|
||||
}
|
||||
var buttons2 = [
|
||||
{
|
||||
text: '取消',
|
||||
bg: 'gray'
|
||||
}
|
||||
];
|
||||
var groups = [buttons1, buttons2];
|
||||
$.actions(groups);
|
||||
});
|
||||
|
||||
// 选择操作-房型-号
|
||||
$(document).on('click', '.create-actions02-now', function () {
|
||||
var buttons1 = [
|
||||
{
|
||||
text: '请选择厅',
|
||||
label: true
|
||||
}
|
||||
];
|
||||
for (var i = 0; i < 10; i++) {
|
||||
buttons1.push({
|
||||
text: i + '',
|
||||
onClick: function () {
|
||||
$("#hall").val(this.text)
|
||||
$(".create-actions02-now").empty().text(this.text).addClass("selected")
|
||||
}
|
||||
})
|
||||
}
|
||||
var buttons2 = [
|
||||
{
|
||||
text: '取消',
|
||||
bg: 'gray'
|
||||
}
|
||||
];
|
||||
var groups = [buttons1, buttons2];
|
||||
$.actions(groups);
|
||||
});
|
||||
|
||||
// 选择操作-房型-卫
|
||||
$(document).on('click', '.create-actions03-now', function () {
|
||||
var buttons1 = [
|
||||
{
|
||||
text: '请选择卫',
|
||||
label: true
|
||||
}
|
||||
];
|
||||
for (var i = 0; i < 10; i++) {
|
||||
buttons1.push({
|
||||
text: i + '',
|
||||
onClick: function () {
|
||||
$("#toilet").val(this.text)
|
||||
$(".create-actions03-now").empty().text(this.text).addClass("selected")
|
||||
}
|
||||
})
|
||||
}
|
||||
var buttons2 = [
|
||||
{
|
||||
text: '取消',
|
||||
bg: 'gray'
|
||||
}
|
||||
];
|
||||
var groups = [buttons1, buttons2];
|
||||
$.actions(groups);
|
||||
});
|
||||
|
||||
// 电梯配套
|
||||
$(document).on('click', '.create-actions14-now', function () {
|
||||
var buttons1 = [
|
||||
{
|
||||
text: '请选择是否有电梯',
|
||||
label: true
|
||||
},
|
||||
{
|
||||
text: '是',
|
||||
bold: true,
|
||||
onClick: function () {
|
||||
$('#hasLift').val(true)
|
||||
$("a.create-actions14-now").empty().text(this.text).addClass("selected")
|
||||
}
|
||||
},
|
||||
{
|
||||
text: '否',
|
||||
onClick: function () {
|
||||
$('#hasLift').val(false)
|
||||
$("a.create-actions14").empty().text(this.text).addClass("selected")
|
||||
}
|
||||
}
|
||||
];
|
||||
var buttons2 = [
|
||||
{
|
||||
text: '取消',
|
||||
bg: 'gray'
|
||||
}
|
||||
];
|
||||
var groups = [buttons1, buttons2];
|
||||
$.actions(groups);
|
||||
});
|
||||
function init() {
|
||||
getSession()
|
||||
}
|
||||
$(function(){
|
||||
init()
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</#compress>
|
||||
@@ -0,0 +1,69 @@
|
||||
<#ftl attributes={"content_type":"text/html; charset=UTF-8"}>
|
||||
<#compress>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
|
||||
<title>租金报告中心</title>
|
||||
<meta name="viewport" content="initial-scale=1, maximum-scale=1"/>
|
||||
<link rel="shortcut icon" href="/favicon.ico"/>
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
|
||||
|
||||
<link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm.css"/>
|
||||
<link rel="stylesheet" href="../static/style/wx.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div class="page-group">
|
||||
<div class="page page-current">
|
||||
<div class="content">
|
||||
<div class="list-block" style="margin-bottom:60px;">
|
||||
<a href="javascript:void(0)" onclick="javascript:history.back(-1);" class="button_12 blue blue_borderbottom radius4"><返回</a>
|
||||
<ul>
|
||||
<li>
|
||||
<div class="item-content">
|
||||
<div class="item-inner">
|
||||
<div class="item-title label">您评估的地址:</div>
|
||||
<div class="item-input">
|
||||
<input type="text" disabled id="districtSearch" name="name" value="${lender}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="item-content">
|
||||
<div class="item-inner">
|
||||
<div class="item-title label">租金:</div>
|
||||
<div class="item-input">
|
||||
<input type="text" name="mount" disabled name="evaluation.mount" value="${dealPrice}元/月">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="content-block">
|
||||
<p><a id="evaluateBtn" class="button button-big button-fill">查看租金报告</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type='text/javascript' src='http://g.alicdn.com/sj/lib/zepto/zepto.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='http://g.alicdn.com/msui/sm/0.6.2/js/sm.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='../static/js/wx.js' charset='utf-8'></script>
|
||||
<script type="text/javascript">
|
||||
$("#evaluateBtn").on('click', function(){
|
||||
window.location.href = "detail"
|
||||
});
|
||||
function init() {
|
||||
|
||||
};
|
||||
$(function () {
|
||||
init();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</#compress>
|
||||
@@ -1,10 +1,15 @@
|
||||
/**小区搜索功能js*/
|
||||
$(function () {
|
||||
resumeHistory()
|
||||
if ($("#t").val() != "c") {
|
||||
resumeHistory()
|
||||
}
|
||||
/**小区自动完成*/
|
||||
$("#districtSearch").on('click input',function () {
|
||||
var city = $("#cityName").val()
|
||||
if($.trim($("#districtSearch").val()) == ""){
|
||||
if ($("#t").val() == "c") {
|
||||
return false;
|
||||
}
|
||||
resumeHistory()
|
||||
return;
|
||||
}
|
||||
@@ -21,26 +26,34 @@ $(function () {
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if(data.length == 0){
|
||||
if(data && data.length == 0){
|
||||
var content = '<li><a class="item-content" style="color:#333;text-align: center"><div class="item-inner"><div class="item-subtitle">未搜索到小区</div></div></a></li>'
|
||||
$("#searchSpan ul").empty().append(content)
|
||||
return
|
||||
}
|
||||
var template = '<li data-id="{0}" data-name="{1}" data-addr ="{2}"><a class="item-link item-content"><div class="item-inner"><div class="item-subtitle">{1}<br><small>{2}</small></div></div></a></li>'
|
||||
var template = '<li data-id="{0}" data-name="{1}" data-addr="{2}" data-region="{3}"><a class="item-link item-content"><div class="item-inner"><div class="item-subtitle">{1}<br><small>{2}</small></div></div></a></li>'
|
||||
var content = ""
|
||||
$(data).each(function () {
|
||||
var district = this
|
||||
content = content + template.template(district.id, district.keyword, district.desc)
|
||||
content = content + template.template(district.id, district.keyword, district.desc, district.region)
|
||||
})
|
||||
$("#searchSpan ul").empty().append(content).find("li>a.item-link").click(function () {
|
||||
var li = $(this).parent();
|
||||
var addr = $(li).attr("data-addr");
|
||||
var id = $(li).attr("data-id")+"";
|
||||
var name = $(li).attr("data-name");
|
||||
var region = $(li).attr("data-region");
|
||||
var isCompany=$("#t").val();
|
||||
saveCookie(id, name, addr)
|
||||
if ($("#t").val() != "c") {
|
||||
saveCookie(id, name, addr)
|
||||
}
|
||||
if ($("#t").val() == "b") {
|
||||
location.href = "districtDetail?id=" + id+"&city="+city
|
||||
} else if ($("#t").val() == "c") {
|
||||
$('#districtSearch').val(name)
|
||||
$('input[name="address"]').val(addr)
|
||||
$('input[name="district"]').val(region)
|
||||
$("#searchSpan ul").empty()
|
||||
} else {
|
||||
location.href = "../weiXinEvaluation/input?id=" + id
|
||||
}
|
||||
@@ -98,6 +111,8 @@ function resumeHistory() {
|
||||
var id = $(li).attr("data-id")
|
||||
if ($("#t").val() == "b") {
|
||||
location.href = "districtDetail?id=" + id+"&city="+city
|
||||
} else if ($("#t").val() == "c") {
|
||||
location.href = "../ccbRent/index?city="+city
|
||||
} else {
|
||||
location.href = "../weiXinEvaluation/input?id=" + id
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<encoding>GBK</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
@@ -111,6 +111,11 @@
|
||||
<artifactId>fangjia-datastore-driver</artifactId>
|
||||
<version>3.9.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cc.blynk.clickhouse</groupId>
|
||||
<artifactId>clickhouse4j</artifactId>
|
||||
<version>1.4.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
@@ -174,7 +179,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.4.1</version>
|
||||
<version>4.5.10</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.ant</groupId>
|
||||
@@ -310,16 +315,6 @@
|
||||
<artifactId>metadata-extractor</artifactId>
|
||||
<version>2.4.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.http</groupId>
|
||||
<artifactId>httpasyncclient</artifactId>
|
||||
<version>4.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.http</groupId>
|
||||
<artifactId>httpcore-nio</artifactId>
|
||||
<version>4.1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.sanselan</groupId>
|
||||
<artifactId>sanselan</artifactId>
|
||||
@@ -443,23 +438,18 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch.client</groupId>
|
||||
<artifactId>x-pack-transport</artifactId>
|
||||
<version>6.4.2</version>
|
||||
<artifactId>elasticsearch-rest-high-level-client</artifactId>
|
||||
<version>7.11.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch.plugin</groupId>
|
||||
<artifactId>x-pack-sql-jdbc</artifactId>
|
||||
<version>6.4.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch.client</groupId>
|
||||
<artifactId>transport</artifactId>
|
||||
<version>6.4.2</version>
|
||||
<version>7.11.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-core</artifactId>
|
||||
<version>7.4.0</version>
|
||||
<version>8.7.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
|
||||
+2
-2
@@ -13,7 +13,7 @@ import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import org.apache.commons.lang.StringUtils
|
||||
import org.apache.solr.client.solrj.util.ClientUtils
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.Connection
|
||||
import java.sql.ResultSet
|
||||
@@ -147,7 +147,7 @@ class DistrictPriceRatingBatch extends BaseBatch {
|
||||
|
||||
def findHouseMaxArea(String city, String region, String name, List alias) {
|
||||
Date startDate = DateUtil.add(new Date(), Calendar.MONTH, -24)
|
||||
JdbcDataSource dataSource = new JdbcDataSource()
|
||||
EsDataSource dataSource = new EsDataSource()
|
||||
String address = "jdbc:es://http://192.168.0.206:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
dataSource.setUrl(address)
|
||||
Properties connectionProperties = new Properties()
|
||||
|
||||
+3
-3
@@ -13,7 +13,7 @@ import com.mongodb.client.MongoCollection
|
||||
import com.mongodb.client.model.UpdateOptions
|
||||
import org.apache.commons.lang.StringUtils
|
||||
import org.bson.Document
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.Connection
|
||||
import java.sql.ResultSet
|
||||
@@ -94,7 +94,7 @@ class DistrictFeatureAnalyBatch extends BaseBatch {
|
||||
DbUtils.seaweed.find(query, new BasicDBObject("name", 1)).each {BasicDBObject it->
|
||||
names << it.name
|
||||
}
|
||||
JdbcDataSource dataSource = new JdbcDataSource()
|
||||
EsDataSource dataSource = new EsDataSource()
|
||||
String address = "jdbc:es://http://192.168.0.45:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
dataSource.setUrl(address)
|
||||
Properties connectionProperties = new Properties()
|
||||
@@ -129,7 +129,7 @@ class DistrictFeatureAnalyBatch extends BaseBatch {
|
||||
|
||||
def findHouseCount(String city, String region, String name, List alias, int months) {
|
||||
Date startDate = DateUtil.add(new Date(), Calendar.MONTH, -months)
|
||||
JdbcDataSource dataSource = new JdbcDataSource()
|
||||
EsDataSource dataSource = new EsDataSource()
|
||||
String address = "jdbc:es://http://192.168.0.206:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
dataSource.setUrl(address)
|
||||
Properties connectionProperties = new Properties()
|
||||
|
||||
+5
-9
@@ -7,18 +7,14 @@ import com.fangjia.script.BatchOwner
|
||||
import com.fangjia.script.Watcher
|
||||
import com.fangjia.script.util.CommonUtils
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection;
|
||||
import com.mongodb.DBCursor
|
||||
import com.mongodb.DBObject
|
||||
import com.mongodb.Mongo
|
||||
import com.mongodb.Bytes
|
||||
import com.mongodb.*
|
||||
import org.apache.commons.lang.StringUtils
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.Connection
|
||||
import java.sql.ResultSet
|
||||
import java.sql.Statement;
|
||||
import java.sql.Statement
|
||||
|
||||
/**
|
||||
*
|
||||
* ÀúÊ·¾ù¼Û¼ÆËã
|
||||
@@ -27,7 +23,7 @@ import java.sql.Statement;
|
||||
*/
|
||||
@BatchOwner(Watcher.JiangYaHui)
|
||||
class HistoricalAverageRevaluationTask extends BaseBatch{
|
||||
JdbcDataSource dataSource = new JdbcDataSource();
|
||||
EsDataSource dataSource = new EsDataSource();
|
||||
String address = "jdbc:es://http://192.168.0.206:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s";
|
||||
public final static DBCollection DISTRICT_STAT_COLL = new Mongo("mongo.db.fangjia.com", 27017).getDB('fangjia_stat').getCollection('district_stat')
|
||||
public final static DBCollection NOPRICE_DISTRICT_STAT_COLL = new Mongo("log.mongo.db.fangjia.com", 52002).getDB('fangjia_log').getCollection('noprice_district_stat')
|
||||
|
||||
+2
-13
@@ -1,6 +1,6 @@
|
||||
package com.fangjia.script.avgprice
|
||||
|
||||
import com.fangjia.core.RegionData
|
||||
|
||||
import com.fangjia.core.util.DateUtil
|
||||
import com.fangjia.script.BaseBatch
|
||||
import com.fangjia.script.BatchOwner
|
||||
@@ -9,18 +9,7 @@ import com.fangjia.script.util.CommonUtils
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.fangjia.script.util.Jms
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection;
|
||||
import com.mongodb.DBCursor
|
||||
import com.mongodb.DBObject
|
||||
import com.mongodb.Mongo
|
||||
import com.mongodb.Bytes
|
||||
import org.apache.commons.lang.StringUtils
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
|
||||
import java.sql.Connection
|
||||
import java.sql.ResultSet
|
||||
import java.sql.Statement;
|
||||
import com.mongodb.*
|
||||
|
||||
/**
|
||||
* 无样本小区历史遗漏数据补充
|
||||
|
||||
+2
-2
@@ -17,7 +17,7 @@ import org.elasticsearch.index.query.BoolQueryBuilder
|
||||
import org.elasticsearch.index.query.QueryBuilder
|
||||
import org.elasticsearch.index.query.QueryBuilders
|
||||
import org.elasticsearch.search.SearchHit
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.ResultSet
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
@@ -37,7 +37,7 @@ class HouseExportBatch extends BaseBatch{
|
||||
def curDate = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -1, "yyyyMM"));
|
||||
|
||||
public static String address = "jdbc:es://http://seawater.es.db.fangjia.com:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
public static JdbcDataSource dataSource = new JdbcDataSource()
|
||||
public static EsDataSource dataSource = new EsDataSource()
|
||||
static {
|
||||
dataSource.setUrl(address)
|
||||
Properties connectionProperties = new Properties()
|
||||
|
||||
+2
-2
@@ -4,13 +4,13 @@ import com.fangjia.core.RegionData
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.ResultSet
|
||||
|
||||
class AddEsHouseField {
|
||||
|
||||
public static JdbcDataSource dataSource = new JdbcDataSource()
|
||||
public static EsDataSource dataSource = new EsDataSource()
|
||||
private static final String address = "jdbc:es://http://seawater.es.db.fangjia.com:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
static {
|
||||
dataSource.setUrl(address)
|
||||
|
||||
+2
-3
@@ -9,10 +9,9 @@ import com.fangjia.script.util.ExcelUtils
|
||||
import com.fangjia.script.yinjihaun.amap.GaoDeApiUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import org.bson.types.ObjectId
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.ResultSet
|
||||
import java.util.concurrent.CountDownLatch
|
||||
import java.util.concurrent.ExecutorService
|
||||
import java.util.concurrent.Executors
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
@@ -63,7 +62,7 @@ class AddThirdPriceDistrict {
|
||||
def province = null
|
||||
def resAddrMap = [:]
|
||||
def filterEstateTypeMap = [:]
|
||||
public static JdbcDataSource dataSource = new JdbcDataSource()
|
||||
public static EsDataSource dataSource = new EsDataSource()
|
||||
private static final String address = "jdbc:es://http://seawater.es.db.fangjia.com:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
static {
|
||||
dataSource.setUrl(address)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.fangjia.script.gj
|
||||
|
||||
import com.esms.common.util.CommonUtil
|
||||
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.common.DataHandleUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.huaban.analysis.jieba.JiebaSegmenter
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.Connection
|
||||
import java.sql.ResultSet
|
||||
@@ -485,7 +485,7 @@ class CrawlDataMatch {
|
||||
}
|
||||
|
||||
def findAllAddress(def cityName){
|
||||
JdbcDataSource dataSource = new JdbcDataSource();
|
||||
EsDataSource dataSource = new EsDataSource();
|
||||
String address = "jdbc:es://http://192.168.0.206:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
dataSource.setUrl(address)
|
||||
Properties connectionProperties = new Properties()
|
||||
|
||||
@@ -1,24 +1,19 @@
|
||||
package com.fangjia.script.gj
|
||||
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
|
||||
import com.fangjia.script.util.DateUtils
|
||||
import com.fangjia.script.util.ElasticUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBObject
|
||||
import org.elasticsearch.index.query.BoolQueryBuilder
|
||||
import org.elasticsearch.index.query.QueryBuilder
|
||||
import org.elasticsearch.index.query.QueryBuilders
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.Connection
|
||||
import java.sql.ResultSet
|
||||
import java.sql.SQLException
|
||||
import java.sql.Statement
|
||||
|
||||
class EsHouseStat {
|
||||
|
||||
public static JdbcDataSource dataSource = new JdbcDataSource()
|
||||
public static EsDataSource dataSource = new EsDataSource()
|
||||
private static final String address = "jdbc:es://http://seawater.es.db.fangjia.com:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
static {
|
||||
dataSource.setUrl(address)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.fangjia.script.gj
|
||||
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.ResultSet
|
||||
|
||||
class EsSearchUtils {
|
||||
|
||||
public static JdbcDataSource dataSource = new JdbcDataSource()
|
||||
public static EsDataSource dataSource = new EsDataSource()
|
||||
private static final String address = "jdbc:es://http://seawater.es.db.fangjia.com:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
static {
|
||||
dataSource.setUrl(address)
|
||||
|
||||
@@ -8,10 +8,9 @@ import com.fangjia.script.util.MongoUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import com.mongodb.DBObject
|
||||
import org.apache.commons.lang.StringUtils
|
||||
import org.elasticsearch.index.query.QueryBuilder
|
||||
import org.elasticsearch.index.query.QueryBuilders
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.ResultSet
|
||||
|
||||
@@ -20,7 +19,7 @@ class FZDataExport {
|
||||
final DBCollection DEAL_PRICE = MongoUtils.getCollectionByName("fangjia", "deal_price", "192.168.0.43")
|
||||
def static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43")
|
||||
|
||||
public static JdbcDataSource dataSource = new JdbcDataSource()
|
||||
public static EsDataSource dataSource = new EsDataSource()
|
||||
private static final String address = "jdbc:es://http://seawater.es.db.fangjia.com:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
static {
|
||||
dataSource.setUrl(address)
|
||||
|
||||
+2
-3
@@ -7,11 +7,10 @@ import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.util.DateUtils
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.Bytes
|
||||
import com.mongodb.DBCollection
|
||||
import com.mongodb.DBObject
|
||||
import org.apache.commons.lang.StringUtils
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.ResultSet
|
||||
import java.util.concurrent.CountDownLatch
|
||||
@@ -27,7 +26,7 @@ class NoHouseDistrictStatBatch extends BaseBatch{
|
||||
public static final DBCollection AVERAGER_CONFIG_COLL = MongoUtils.getCollectionByName2("fangjia", "averager_config", dbUrl)
|
||||
|
||||
public static String address = "jdbc:es://http://seawater.es.db.fangjia.com:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
public static JdbcDataSource dataSource = new JdbcDataSource()
|
||||
public static EsDataSource dataSource = new EsDataSource()
|
||||
static {
|
||||
dataSource.setUrl(address)
|
||||
Properties connectionProperties = new Properties()
|
||||
|
||||
@@ -3,14 +3,14 @@ package com.fangjia.script.gj
|
||||
import com.fangjia.script.common.DataHandleUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import org.apache.commons.lang.StringUtils
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.ResultSet
|
||||
|
||||
class RoomStat {
|
||||
|
||||
public static String address = "jdbc:es://http://seawater.es.db.fangjia.com:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
public static JdbcDataSource dataSource = new JdbcDataSource()
|
||||
public static EsDataSource dataSource = new EsDataSource()
|
||||
static {
|
||||
dataSource.setUrl(address)
|
||||
Properties connectionProperties = new Properties()
|
||||
|
||||
@@ -1,30 +1,25 @@
|
||||
package com.fangjia.script.gj
|
||||
|
||||
import com.fangjia.httpclient.UserAgents
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.util.ElasticUtils
|
||||
import com.fangjia.script.util.JacksonUtil
|
||||
import org.apache.commons.lang.StringUtils
|
||||
import org.elasticsearch.index.query.QueryBuilder
|
||||
import org.elasticsearch.index.query.QueryBuilders
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.ResultSet
|
||||
import java.util.concurrent.CountDownLatch
|
||||
import java.util.concurrent.ExecutorService
|
||||
import java.util.concurrent.Executors
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
import java.util.zip.GZIPInputStream
|
||||
|
||||
import static org.elasticsearch.index.query.QueryBuilders.idsQuery
|
||||
|
||||
class TradeDataMatch {
|
||||
|
||||
static def esf_queryUrl = "http://192.168.0.45:9200/esf_deal_price_lansi/_update_by_query"
|
||||
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(20)
|
||||
def final AtomicInteger count_ = new AtomicInteger(0)
|
||||
public static String address = "jdbc:es://http://192.168.0.45:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
public static JdbcDataSource dataSource = new JdbcDataSource()
|
||||
public static EsDataSource dataSource = new EsDataSource()
|
||||
static {
|
||||
dataSource.setUrl(address)
|
||||
Properties connectionProperties = new Properties()
|
||||
|
||||
+3
-4
File diff suppressed because one or more lines are too long
+7
-15
@@ -1,24 +1,17 @@
|
||||
package com.fangjia.script.gj.ccb
|
||||
|
||||
import com.fangjia.core.RegionData
|
||||
import com.fangjia.core.util.DataUtil
|
||||
import com.fangjia.core.util.DateUtil
|
||||
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.util.DateUtils
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.fangjia.script.util.ElasticUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.fangjia.script.util.FangJiaAreaMapUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBObject
|
||||
import org.apache.commons.lang.StringUtils
|
||||
import org.bson.types.ObjectId
|
||||
import org.elasticsearch.index.query.BoolQueryBuilder
|
||||
import org.elasticsearch.index.query.QueryBuilder
|
||||
import org.elasticsearch.index.query.QueryBuilders
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
|
||||
import java.sql.ResultSet
|
||||
import java.text.SimpleDateFormat
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import java.util.concurrent.CountDownLatch
|
||||
import java.util.concurrent.ExecutorService
|
||||
@@ -26,12 +19,11 @@ import java.util.concurrent.Executors
|
||||
import java.util.concurrent.atomic.AtomicLong
|
||||
import java.util.regex.Matcher
|
||||
import java.util.regex.Pattern
|
||||
import com.fangjia.script.util.FangJiaAreaMapUtils
|
||||
|
||||
class HouseExport {
|
||||
|
||||
|
||||
public static JdbcDataSource dataSource = new JdbcDataSource()
|
||||
public static EsDataSource dataSource = new EsDataSource()
|
||||
private static final String address = "jdbc:es://http://seawater.es.db.fangjia.com:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
static {
|
||||
dataSource.setUrl(address)
|
||||
@@ -83,11 +75,11 @@ class HouseExport {
|
||||
// exportRentCSV(city, districts, 20200201, 20210301, 2020);
|
||||
}else{
|
||||
|
||||
exportRentCSV(city, districts, 20170801, 20181001, 2017)
|
||||
exportRentCSV(city, districts, 20200201, 20210301, 2020);
|
||||
// exportRentCSV(city, districts, 20170801, 20181001, 2017)
|
||||
// exportRentCSV(city, districts, 20200201, 20210301, 2020);
|
||||
|
||||
exportSellCSV(city, districts, 20170801, 20181001, 2017);
|
||||
exportSellCSV(city, districts, 20200201, 20210301, 2020);
|
||||
// exportSellCSV(city, districts, 20200201, 20210301, 2020);
|
||||
|
||||
}
|
||||
|
||||
|
||||
+2
-4
@@ -5,16 +5,14 @@ import com.fangjia.script.thirdPriceCrawl.CrawalDBUtil
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.Connection
|
||||
import java.sql.ResultSet
|
||||
import java.sql.Statement
|
||||
|
||||
class ExportData {
|
||||
|
||||
def static final DBCollection thirdDistrictColl = CrawalDBUtil.getThirdDistrictCol();
|
||||
public static JdbcDataSource dataSource = new JdbcDataSource()
|
||||
public static EsDataSource dataSource = new EsDataSource()
|
||||
private static final String address = "jdbc:es://http://seawater.es.db.fangjia.com:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
static {
|
||||
dataSource.setUrl(address)
|
||||
|
||||
+3
-8
@@ -5,16 +5,11 @@ import com.fangjia.core.util.BaiDuApiUtils
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.gj.EsSearchUtils
|
||||
import com.fangjia.script.gj.district.FangjiaClientUtils
|
||||
import com.fangjia.script.util.CommonUtils
|
||||
import com.fangjia.script.util.DateUtils
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.fangjia.script.util.GeoHelper
|
||||
import com.fangjia.script.util.GeoUtils
|
||||
import com.fangjia.script.util.*
|
||||
import com.fangjia.script.yinjihaun.amap.GaoDeApiUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import org.bson.types.ObjectId
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.ResultSet
|
||||
import java.util.concurrent.CountDownLatch
|
||||
@@ -27,7 +22,7 @@ class DistrictWash {
|
||||
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(5)
|
||||
static def totalCount = new AtomicLong()
|
||||
|
||||
public static JdbcDataSource dataSource = new JdbcDataSource()
|
||||
public static EsDataSource dataSource = new EsDataSource()
|
||||
private static final String address = "jdbc:es://http://seawater.es.db.fangjia.com:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
static {
|
||||
dataSource.setUrl(address)
|
||||
|
||||
+17
-27
@@ -2,38 +2,28 @@ package com.fangjia.script.jiangnanblank
|
||||
|
||||
import com.fangjia.core.util.DataUtil
|
||||
import com.fangjia.core.util.DateUtil
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import org.apache.commons.codec.digest.DigestUtils
|
||||
import org.apache.commons.lang.StringUtils
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
|
||||
import java.sql.ResultSet
|
||||
import java.text.DecimalFormat
|
||||
import java.util.regex.Matcher
|
||||
import java.util.regex.Pattern
|
||||
|
||||
import net.sf.json.JSONObject
|
||||
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook
|
||||
import com.fangjia.datastore.driver.DSCollection;
|
||||
import com.fangjia.datastore.driver.DSCollection
|
||||
import com.fangjia.datastore.driver.DataStore
|
||||
import com.fangjia.script.commData.CommonDatautils;
|
||||
import com.fangjia.script.util.DateUtils;
|
||||
import com.fangjia.script.util.ExcelParser
|
||||
import com.fangjia.script.common.DataHandleUtils;
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.common.DataHandleUtils
|
||||
import com.fangjia.script.util.*
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import com.mongodb.DBObject
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.bson.types.ObjectId
|
||||
|
||||
import com.fangjia.script.util.MongoUtils;
|
||||
import com.mongodb.QueryOperators
|
||||
import com.fangjia.script.util.OpenApiClient
|
||||
|
||||
import java.util.Map.Entry;
|
||||
import net.sf.json.JSONObject
|
||||
import org.apache.commons.codec.digest.DigestUtils
|
||||
import org.apache.commons.io.FileUtils
|
||||
import org.apache.commons.lang.StringUtils
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook
|
||||
import org.bson.types.ObjectId
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.ResultSet
|
||||
import java.text.DecimalFormat
|
||||
import java.util.Map.Entry
|
||||
import java.util.regex.Matcher
|
||||
import java.util.regex.Pattern
|
||||
|
||||
class CZBlankDataExport {
|
||||
|
||||
@@ -62,7 +52,7 @@ class CZBlankDataExport {
|
||||
def directionMap = [1:"ÄÏ",2:"±±",3:"Äϱ±",4:"¶«",5:"Î÷",6:"¶«Î÷",7:"¶«ÄÏ",8:"Î÷ÄÏ",9:"¶«±±",10:"Î÷±±"]
|
||||
|
||||
public static String address = "jdbc:es://http://seawater.es.db.fangjia.com:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
public static JdbcDataSource dataSource = new JdbcDataSource()
|
||||
public static EsDataSource dataSource = new EsDataSource()
|
||||
static {
|
||||
dataSource.setUrl(address)
|
||||
Properties connectionProperties = new Properties()
|
||||
|
||||
-1
@@ -12,7 +12,6 @@ import com.jcraft.jsch.ChannelSftp
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import com.mongodb.DBObject
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
|
||||
/**
|
||||
* 江南银行线上数据交付
|
||||
|
||||
+2
-17
@@ -6,42 +6,27 @@ import com.fangjia.script.BaseBatch
|
||||
import com.fangjia.script.BatchOwner
|
||||
import com.fangjia.script.Watcher
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.crawl.CrawlCommandConsumerBatch
|
||||
import com.fangjia.script.util.DateUtils
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.fangjia.script.util.ElasticUtils
|
||||
import com.fangjia.script.util.ElasticsearchHelper
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
import com.mongodb.BasicDBList
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.Bytes
|
||||
import com.mongodb.DBCollection
|
||||
import com.mongodb.DBObject
|
||||
import org.apache.commons.lang.StringUtils
|
||||
import org.elasticsearch.client.transport.TransportClient
|
||||
import org.elasticsearch.index.query.QueryBuilder
|
||||
import org.elasticsearch.index.query.QueryBuilders
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.BatchUpdateException
|
||||
import java.sql.ResultSet
|
||||
import java.text.NumberFormat
|
||||
import java.util.Map.Entry
|
||||
import java.util.concurrent.BlockingQueue
|
||||
import java.util.concurrent.ExecutorService
|
||||
import java.util.concurrent.Executors
|
||||
import java.util.concurrent.LinkedBlockingDeque
|
||||
import java.util.concurrent.LinkedBlockingQueue
|
||||
import java.util.concurrent.ThreadPoolExecutor
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.regex.Pattern
|
||||
|
||||
@BatchOwner(Watcher.WeiLei)
|
||||
class HousingOverviewExportBatch extends BaseBatch {
|
||||
|
||||
static ThreadPoolExecutor _tpe = new ThreadPoolExecutor(JusfounCommon.CITIES.length, JusfounCommon.CITIES.length, 1, TimeUnit.HOURS, new LinkedBlockingDeque<Runnable>())
|
||||
|
||||
public static JdbcDataSource dataSource = new JdbcDataSource()
|
||||
public static EsDataSource dataSource = new EsDataSource()
|
||||
private static final String address = "jdbc:es://http://seawater.es.db.fangjia.com:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
static {
|
||||
dataSource.setUrl(address)
|
||||
|
||||
+7
-10
@@ -1,11 +1,10 @@
|
||||
package com.fangjia.script.jusfoun
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject
|
||||
import com.fangjia.core.util.DataUtil
|
||||
import com.fangjia.script.util.DateUtils
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.fangjia.script.util.ElasticsearchHelper
|
||||
import com.fangjia.script.util.ElasticUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBObject
|
||||
import groovy.sql.GroovyRowResult
|
||||
@@ -18,9 +17,7 @@ import org.elasticsearch.common.unit.TimeValue
|
||||
import org.elasticsearch.index.query.QueryBuilder
|
||||
import org.elasticsearch.index.query.QueryBuilders
|
||||
import org.elasticsearch.search.SearchHit
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import redis.clients.jedis.JedisPool
|
||||
import redis.clients.jedis.JedisPoolConfig
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.*
|
||||
import java.text.DateFormat
|
||||
@@ -56,7 +53,7 @@ class JusfounCommon {
|
||||
public static Sql DB_Jusfoun_OLd = Sql.newInstance("jdbc:mysql://192.168.0.21:3306/jusfoun_backup?characterEncoding=utf-8&autoReconnect=true", "root", "Goojia123456", "com.mysql.jdbc.Driver");
|
||||
public static Sql DB_Jusfoun_New = Sql.newInstance("jdbc:mysql://192.168.0.21:3306/jusfoun?characterEncoding=utf-8&autoReconnect=true", "root", "Goojia123456", "com.mysql.jdbc.Driver");
|
||||
|
||||
private static JdbcDataSource dataSource = null
|
||||
private static EsDataSource dataSource = null
|
||||
|
||||
private static Map<String, BasicDBObject> _map_seaweed = new HashMap<>();
|
||||
private static Map<String, Map<String, DBObject>> mainCityMap = new HashMap<>();
|
||||
@@ -390,7 +387,7 @@ class JusfounCommon {
|
||||
return DataUtil.hanyuQuanpin(hanzi, '')
|
||||
}
|
||||
|
||||
static JdbcDataSource getESDataSource() {
|
||||
static EsDataSource getESDataSource() {
|
||||
if (dataSource != null) {
|
||||
return dataSource;
|
||||
} else {
|
||||
@@ -399,7 +396,7 @@ class JusfounCommon {
|
||||
return dataSource;
|
||||
}
|
||||
try {
|
||||
dataSource = new JdbcDataSource();
|
||||
dataSource = new EsDataSource();
|
||||
String address = "jdbc:es://http://seawater.es.db.fangjia.com/timezone=UTC&page.size=240&connect.timeout=240s&network.timeout=120s&page.timeout=240s";
|
||||
dataSource.setUrl(address);
|
||||
Properties connectionProperties = new Properties();
|
||||
@@ -625,13 +622,13 @@ class JusfounCommon {
|
||||
String scrollID = null) {
|
||||
try {
|
||||
if (transportClient == null) {
|
||||
transportClient = ElasticsearchHelper.getClient("192.168.0.206");
|
||||
transportClient = ElasticUtils.getClient("192.168.0.206");
|
||||
}
|
||||
return getEsDataOnce(transportClient, city, cat, startDate, endDate, INDEX, scrollID);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace()
|
||||
try {
|
||||
transportClient = ElasticsearchHelper.getClient("192.168.0.206");
|
||||
transportClient = ElasticUtils.getClient("192.168.0.206");
|
||||
return getEsDataOnce(transportClient, city, cat, startDate, endDate, INDEX, scrollID);
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace()
|
||||
|
||||
-8
@@ -8,21 +8,13 @@ import com.fangjia.script.Watcher
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.util.DateUtils
|
||||
import com.fangjia.script.util.ElasticUtils
|
||||
import com.fangjia.script.util.ElasticsearchHelper
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.Bytes
|
||||
import com.mongodb.DBCollection
|
||||
import com.mongodb.DBObject
|
||||
import org.apache.commons.lang.StringUtils
|
||||
import org.elasticsearch.client.transport.TransportClient
|
||||
import org.elasticsearch.index.query.QueryBuilder
|
||||
import org.elasticsearch.index.query.QueryBuilders
|
||||
|
||||
import java.sql.BatchUpdateException
|
||||
import java.util.concurrent.LinkedBlockingDeque
|
||||
import java.util.concurrent.ThreadPoolExecutor
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
@BatchOwner(Watcher.WangWenYan)
|
||||
class RentHouseExportBatch extends BaseBatch {
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@ import org.apache.commons.lang.StringUtils
|
||||
import org.apache.commons.math.stat.descriptive.moment.StandardDeviation
|
||||
import org.apache.commons.math3.stat.descriptive.moment.Mean
|
||||
import org.bson.Document
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.Connection
|
||||
import java.sql.ResultSet
|
||||
@@ -22,7 +22,7 @@ import java.util.concurrent.ConcurrentHashMap
|
||||
import static com.mongodb.client.model.Filters.*
|
||||
|
||||
def List find_rent_house_prices(String city, String region, String name, Date start, Date end){
|
||||
JdbcDataSource dataSource = new JdbcDataSource()
|
||||
EsDataSource dataSource = new EsDataSource()
|
||||
String address = "jdbc:es://http://192.168.0.206:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
dataSource.setUrl(address)
|
||||
Properties connectionProperties = new Properties()
|
||||
|
||||
+5
-8
@@ -1,20 +1,17 @@
|
||||
package com.fangjia.script.log
|
||||
|
||||
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
|
||||
import java.sql.Connection
|
||||
import java.sql.ResultSet
|
||||
import java.sql.Statement
|
||||
|
||||
import com.fangjia.core.util.DateUtil
|
||||
import com.fangjia.script.BaseBatch
|
||||
import com.fangjia.script.BatchOwner
|
||||
import com.fangjia.script.Watcher
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
import java.sql.Connection
|
||||
import java.sql.ResultSet
|
||||
import java.sql.Statement
|
||||
|
||||
@BatchOwner(Watcher.JiangYaHui)
|
||||
class MongoDBLogDisMonitorBatch extends BaseBatch {
|
||||
JdbcDataSource dataSource = new JdbcDataSource();
|
||||
EsDataSource dataSource = new EsDataSource();
|
||||
String address = "jdbc:es://http://192.168.0.86:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s";
|
||||
public final static def TOKEN="2307d2fec8314b3e8b4b83dd1d42da2e2051638e3e668f21e77ca01258bf682c"
|
||||
|
||||
|
||||
+6
-8
@@ -1,20 +1,18 @@
|
||||
package com.fangjia.script.log
|
||||
|
||||
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
|
||||
import java.sql.Connection
|
||||
import java.sql.ResultSet
|
||||
import java.sql.Statement
|
||||
|
||||
import com.fangjia.core.util.DateUtil
|
||||
import com.fangjia.script.BaseBatch
|
||||
import com.fangjia.script.BatchOwner
|
||||
import com.fangjia.script.Watcher
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.Connection
|
||||
import java.sql.ResultSet
|
||||
import java.sql.Statement
|
||||
|
||||
@BatchOwner(Watcher.JiangYaHui)
|
||||
class MongoDBLogMonitorBatch extends BaseBatch {
|
||||
JdbcDataSource dataSource = new JdbcDataSource();
|
||||
EsDataSource dataSource = new EsDataSource();
|
||||
String address = "jdbc:es://http://192.168.0.86:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s";
|
||||
public final static def TOKEN="2307d2fec8314b3e8b4b83dd1d42da2e2051638e3e668f21e77ca01258bf682c"
|
||||
|
||||
|
||||
+3
-2
@@ -10,7 +10,8 @@ import com.fangjia.script.util.MongoUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import org.apache.commons.lang.StringUtils
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.ResultSet
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
|
||||
@@ -25,7 +26,7 @@ class DistrictHouseTypeAnalyzeBatch extends BaseBatch {
|
||||
|
||||
|
||||
private static final String address = "jdbc:es://http://seawater.es.db.fangjia.com:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
private static final JdbcDataSource dataSource = new JdbcDataSource()
|
||||
private static final EsDataSource dataSource = new EsDataSource()
|
||||
static {
|
||||
dataSource.setUrl(address)
|
||||
Properties connectionProperties = new Properties()
|
||||
|
||||
+3
-4
@@ -5,7 +5,7 @@ import com.fangjia.core.util.DateUtil
|
||||
import com.fangjia.script.BaseBatch
|
||||
import com.fangjia.script.BatchOwner
|
||||
import com.fangjia.script.Watcher
|
||||
import com.fangjia.script.util.ElasticsearchHelper
|
||||
import com.fangjia.script.util.ElasticUtils
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
@@ -55,7 +55,6 @@ class AnalysisOpenUriLogSyncBatch extends BaseBatch {
|
||||
Map userInfo = getUserInfo()
|
||||
def startDate = DateUtil.truncateDay(DateUtil.add(new Date(), -3))
|
||||
def endDate = DateUtil.truncateDay(new Date())
|
||||
|
||||
BasicDBObject query = new BasicDBObject()
|
||||
query.append("c_date", new BasicDBObject('$gte', startDate).append('$lt', endDate))
|
||||
|
||||
@@ -64,7 +63,7 @@ class AnalysisOpenUriLogSyncBatch extends BaseBatch {
|
||||
long count = 0
|
||||
long total = cursor.count()
|
||||
print("total="+total)
|
||||
BulkProcessor bulkProcessor = ElasticsearchHelper.createBulkProcessor("192.168.0.206", "fangjia")
|
||||
BulkProcessor bulkProcessor = ElasticUtils.createBulkProcessor("seawater.es.db.fangjia.com")
|
||||
for(BasicDBObject log : cursor){
|
||||
Map<String,Object> parameter_map = (Map) log.get("parameter_map")
|
||||
if(parameter_map == null) {
|
||||
@@ -128,7 +127,7 @@ class AnalysisOpenUriLogSyncBatch extends BaseBatch {
|
||||
cmd.put("user_name", user.user_name)
|
||||
cmd.put("company_name", user.company)
|
||||
}
|
||||
bulkProcessor.add(new IndexRequest("open_uri_log_normal", "_doc", log.get("_id").toString()).source(cmd))
|
||||
bulkProcessor.add(new IndexRequest("open_uri_log_normal").id(log.get("_id").toString()).source(cmd))
|
||||
println(cmd)
|
||||
count++
|
||||
if(count % 100 == 0){
|
||||
|
||||
+11
-37
@@ -1,50 +1,24 @@
|
||||
package com.fangjia.script.trade
|
||||
///µ¼Èë¼Û¸ñÖ¸Êý
|
||||
import com.fangjia.script.BaseBatch;
|
||||
|
||||
import com.fangjia.core.util.DataUtil
|
||||
import com.fangjia.script.BaseBatch
|
||||
|
||||
///导入价格指数
|
||||
|
||||
import com.fangjia.script.BatchOwner
|
||||
import com.fangjia.script.Watcher
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.poi.xssf.usermodel.XSSFCell
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook
|
||||
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.util.DateUtils
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
import com.mongodb.QueryOperators
|
||||
import com.fangjia.script.util.DateUtils;
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection;
|
||||
import com.mongodb.DBCollection
|
||||
import com.mongodb.DBObject
|
||||
import com.mongodb.Mongo
|
||||
|
||||
import groovy.json.JsonSlurper
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import org.apache.commons.lang.StringUtils
|
||||
import org.apache.commons.lang.math.RandomUtils
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.ResultSet
|
||||
import java.text.NumberFormat;
|
||||
import java.util.regex.Matcher
|
||||
import java.util.regex.Pattern
|
||||
|
||||
import com.fangjia.core.util.DBIterator
|
||||
|
||||
|
||||
|
||||
import com.fangjia.core.util.DataUtil
|
||||
import com.fangjia.core.util.StringUtil;
|
||||
import com.fangjia.datastore.driver.DSCollection;
|
||||
import com.fangjia.datastore.driver.DataStore
|
||||
import com.fangjia.script.commData.CommonDatautils;
|
||||
import com.ibm.icu.text.SimpleDateFormat;
|
||||
import com.fangjia.storehouse.DBIterator
|
||||
import com.fangjia.storehouse.DBIterator;
|
||||
import com.fangjia.storehouse.StorehouseDB;
|
||||
|
||||
import org.apache.commons.lang.math.RandomUtils;
|
||||
@BatchOwner(Watcher.GaoJuan)
|
||||
class ImportIndexStats extends BaseBatch{
|
||||
//public final static DBCollection under_line = new Mongo("192.168.0.136", 27017).getDB('fangjia').getCollection('stats_index');
|
||||
@@ -61,7 +35,7 @@ class ImportIndexStats extends BaseBatch{
|
||||
public static final def dingjiYear = 2016;
|
||||
|
||||
private static final String address = "jdbc:es://http://seawater.es.db.fangjia.com:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
private static final JdbcDataSource dataSource = new JdbcDataSource()
|
||||
private static final EsDataSource dataSource = new EsDataSource()
|
||||
static {
|
||||
dataSource.setUrl(address)
|
||||
Properties connectionProperties = new Properties()
|
||||
|
||||
+3
-8
@@ -1,17 +1,12 @@
|
||||
package com.fangjia.script.trade
|
||||
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.util.DateUtil
|
||||
import com.fangjia.script.util.DateUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.Bytes
|
||||
import com.mongodb.DBCollection
|
||||
import com.mongodb.DBObject
|
||||
import com.mongodb.QueryOperators
|
||||
import com.mongodb.*
|
||||
import org.apache.commons.lang.StringUtils
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.ResultSet
|
||||
|
||||
@@ -22,7 +17,7 @@ class TradeDealPriceStat {
|
||||
|
||||
|
||||
public static String address = "jdbc:es://http://192.168.0.45:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
public static JdbcDataSource dataSource = new JdbcDataSource()
|
||||
public static EsDataSource dataSource = new EsDataSource()
|
||||
static {
|
||||
dataSource.setUrl(address)
|
||||
Properties connectionProperties = new Properties()
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ package com.fangjia.script.usahouse
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.ResultSet
|
||||
import java.util.concurrent.CountDownLatch
|
||||
@@ -14,7 +14,7 @@ import java.util.regex.Pattern
|
||||
|
||||
class AddressMatch {
|
||||
|
||||
public static JdbcDataSource dataSource = new JdbcDataSource()
|
||||
public static EsDataSource dataSource = new EsDataSource()
|
||||
private static final String address = "jdbc:es://http://192.168.0.228:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
static {
|
||||
dataSource.setUrl(address)
|
||||
|
||||
+1
-4
@@ -1,6 +1,6 @@
|
||||
package com.fangjia.script.usahouse
|
||||
|
||||
import com.fangjia.core.util.BaiDuApiUtils
|
||||
|
||||
import com.fangjia.core.util.DataUtil
|
||||
import com.fangjia.httpclient.UserAgents
|
||||
import com.fangjia.script.BaseBatch
|
||||
@@ -8,14 +8,11 @@ import com.fangjia.script.BatchOwner
|
||||
import com.fangjia.script.Watcher
|
||||
import com.fangjia.script.crawl.JQueryUtils
|
||||
import com.fangjia.script.thirdPriceCrawl.CrawalUtil
|
||||
import com.fangjia.script.util.HttpClient
|
||||
import com.fangjia.script.util.JacksonUtil
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import net.sf.json.JSON
|
||||
import org.apache.commons.lang.StringUtils
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import org.jsoup.Jsoup
|
||||
import org.jsoup.nodes.Document
|
||||
import org.jsoup.select.Elements
|
||||
|
||||
+174
-156
@@ -1,122 +1,170 @@
|
||||
package com.fangjia.script.util
|
||||
|
||||
import org.apache.commons.lang3.SystemUtils
|
||||
import org.apache.http.HttpHost
|
||||
import org.apache.http.auth.AuthScope
|
||||
import org.apache.http.auth.UsernamePasswordCredentials
|
||||
import org.apache.http.client.CredentialsProvider
|
||||
import org.apache.http.client.config.RequestConfig
|
||||
import org.apache.http.impl.client.BasicCredentialsProvider
|
||||
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder
|
||||
import org.elasticsearch.action.ActionListener
|
||||
import org.elasticsearch.action.bulk.BackoffPolicy
|
||||
import org.elasticsearch.action.bulk.BulkProcessor
|
||||
import org.elasticsearch.action.bulk.BulkRequest
|
||||
import org.elasticsearch.action.bulk.BulkResponse
|
||||
import org.elasticsearch.action.index.IndexRequest
|
||||
import org.elasticsearch.action.search.ClearScrollRequest
|
||||
import org.elasticsearch.action.search.SearchRequest
|
||||
import org.elasticsearch.action.search.SearchResponse
|
||||
import org.elasticsearch.action.search.SearchType
|
||||
import org.elasticsearch.client.transport.TransportClient
|
||||
import org.elasticsearch.common.settings.Settings
|
||||
import org.elasticsearch.common.transport.TransportAddress
|
||||
import org.elasticsearch.common.unit.ByteSizeUnit
|
||||
import org.elasticsearch.common.unit.ByteSizeValue
|
||||
import org.elasticsearch.action.search.SearchScrollRequest
|
||||
import org.elasticsearch.client.RequestOptions
|
||||
import org.elasticsearch.client.RestClient
|
||||
import org.elasticsearch.client.RestClientBuilder
|
||||
import org.elasticsearch.client.RestHighLevelClient
|
||||
import org.elasticsearch.common.unit.TimeValue
|
||||
import org.elasticsearch.index.query.QueryBuilder
|
||||
import org.elasticsearch.index.query.QueryBuilders
|
||||
import org.elasticsearch.search.Scroll
|
||||
import org.elasticsearch.search.SearchHit
|
||||
import org.elasticsearch.search.sort.FieldSortBuilder
|
||||
import org.elasticsearch.search.sort.SortOrder
|
||||
import org.elasticsearch.xpack.client.PreBuiltXPackTransportClient
|
||||
import org.elasticsearch.search.builder.SearchSourceBuilder
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.Connection
|
||||
import java.sql.ResultSet
|
||||
import java.sql.Statement
|
||||
import java.util.concurrent.ExecutorService
|
||||
import java.util.concurrent.Executors
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.function.BiConsumer
|
||||
|
||||
/**
|
||||
* 功能说明:Elasticsearch工具类
|
||||
*/
|
||||
class ElasticUtils {
|
||||
|
||||
private static TransportClient client = null;
|
||||
|
||||
public static TransportClient getClient(def host){
|
||||
if(client != null){
|
||||
return client;
|
||||
static getEsDataSource(String host){
|
||||
EsDataSource dataSource = new EsDataSource ();
|
||||
dataSource.setUrl("jdbc:es://${host}:9200?timezone=UTC&page.size=240&connect.timeout=240&network.timeout=600&page.timeout=240");
|
||||
Properties connectionProperties = new Properties();
|
||||
connectionProperties.setProperty("user","developer");
|
||||
connectionProperties.setProperty("password","5e8edd851d2fdfbd7415232c67367cc3");
|
||||
dataSource.setProperties(connectionProperties);
|
||||
return dataSource;
|
||||
}
|
||||
|
||||
static executeSqlQuery(String sql, Closure<Map> closure, String host = "192.168.0.216"){
|
||||
EsDataSource dataSource = getEsDataSource(host)
|
||||
Connection connection = dataSource.getConnection()
|
||||
Statement statement = connection.createStatement()
|
||||
ResultSet rs = statement.executeQuery(sql)
|
||||
def columns = []
|
||||
for(int i = 1; i <= rs.getMetaData().getColumnCount(); i++){
|
||||
columns << rs.getMetaData().getColumnName(i)
|
||||
}
|
||||
|
||||
def certPath = ""
|
||||
if(SystemUtils.IS_OS_WINDOWS){
|
||||
certPath= "D:\\goojiaconfig\\seawater\\conf\\elastic-certificates.p12"
|
||||
}else{
|
||||
certPath = "/opt/elasticmongo/elastic-certificates.p12"
|
||||
rs.getMetaData().getColumnCount()
|
||||
while(rs.next()){
|
||||
def row = [:]
|
||||
for (String col : columns){
|
||||
row[col] = rs.getObject(col)
|
||||
}
|
||||
closure.call(row)
|
||||
}
|
||||
Settings.Builder builder = Settings.builder()
|
||||
.put("cluster.name", "fangjia")
|
||||
.put("client.transport.sniff", true)
|
||||
|
||||
builder.put("xpack.security.user", "developer" + ":" + "5e8edd851d2fdfbd7415232c67367cc3")
|
||||
.put("xpack.security.transport.ssl.enabled", "true")
|
||||
.put("xpack.security.transport.ssl.truststore.path", certPath)
|
||||
.put("xpack.security.transport.ssl.keystore.path", certPath)
|
||||
.put("xpack.security.transport.ssl.verification_mode", "certificate")
|
||||
|
||||
Settings settings = builder.build();
|
||||
client = new PreBuiltXPackTransportClient(settings)
|
||||
.addTransportAddress(new TransportAddress(InetAddress.getByName(host), 9300))
|
||||
return client
|
||||
rs.close()
|
||||
connection.close()
|
||||
}
|
||||
|
||||
|
||||
static executeQuery(String host, String indexName, QueryBuilder qb, Closure closure, String type= "_doc"){
|
||||
|
||||
client = getClient(host);
|
||||
|
||||
BulkProcessor bulkProcessor = BulkProcessor.builder(
|
||||
client,
|
||||
new BulkProcessor.Listener() {
|
||||
@Override
|
||||
void beforeBulk(long executionId,
|
||||
BulkRequest request) {
|
||||
}
|
||||
|
||||
@Override
|
||||
void afterBulk(long executionId,
|
||||
BulkRequest request,
|
||||
BulkResponse response) {
|
||||
}
|
||||
|
||||
@Override
|
||||
void afterBulk(long executionId,
|
||||
BulkRequest request,
|
||||
Throwable failure) {
|
||||
}
|
||||
})
|
||||
.setBulkActions(10000)
|
||||
.setBulkSize(new ByteSizeValue(5, ByteSizeUnit.MB))
|
||||
.setFlushInterval(TimeValue.timeValueSeconds(5))
|
||||
.setConcurrentRequests(20)
|
||||
.setBackoffPolicy(BackoffPolicy.exponentialBackoff(TimeValue.timeValueMillis(100), 10))
|
||||
.build()
|
||||
|
||||
SearchResponse scrollResp = null;
|
||||
int errorCount = 0;
|
||||
def hits ;
|
||||
def stop = false;
|
||||
while(!stop){
|
||||
try{
|
||||
scrollResp = client.prepareSearch(indexName)
|
||||
.addSort(FieldSortBuilder.DOC_FIELD_NAME, SortOrder.ASC)
|
||||
.setScroll(new TimeValue(600000))
|
||||
.setQuery(qb)
|
||||
.setSize(1000).get()
|
||||
hits = scrollResp.getHits().getHits()
|
||||
stop = true;
|
||||
}catch(Exception e){
|
||||
errorCount++;
|
||||
if(errorCount>11){
|
||||
stop = true;
|
||||
}
|
||||
println "错误:${errorCount} "+e.getMessage()
|
||||
static RestHighLevelClient getClient(String host) {
|
||||
RestClientBuilder builder = RestClient.builder(new HttpHost(host, 9200, "http"));
|
||||
builder.setRequestConfigCallback(new RestClientBuilder.RequestConfigCallback() {
|
||||
@Override
|
||||
RequestConfig.Builder customizeRequestConfig(RequestConfig.Builder requestConfigBuilder) {
|
||||
requestConfigBuilder.setConnectionRequestTimeout(1000 * 60);
|
||||
requestConfigBuilder.setSocketTimeout(1000 * 60);
|
||||
return requestConfigBuilder;
|
||||
}
|
||||
})
|
||||
builder.setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {
|
||||
@Override
|
||||
HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpAsyncClientBuilder) {
|
||||
httpAsyncClientBuilder.disableAuthCaching();
|
||||
CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
|
||||
credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("elastic", "goojia123456"));
|
||||
httpAsyncClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
|
||||
return httpAsyncClientBuilder;
|
||||
}
|
||||
})
|
||||
return new RestHighLevelClient(builder)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 创建一个ES批处理器
|
||||
* @param host
|
||||
* @return
|
||||
*/
|
||||
static createBulkProcessor(String host, RestHighLevelClient client = null) {
|
||||
|
||||
BulkProcessor.Listener listener = new BulkProcessor.Listener() {
|
||||
@Override
|
||||
void beforeBulk(long executionId, BulkRequest request) {
|
||||
}
|
||||
|
||||
@Override
|
||||
void afterBulk(long executionId, BulkRequest request,
|
||||
BulkResponse response) {
|
||||
}
|
||||
|
||||
@Override
|
||||
void afterBulk(long executionId, BulkRequest request,
|
||||
Throwable failure) {
|
||||
}
|
||||
};
|
||||
if(!client){
|
||||
client = getClient(host);
|
||||
}
|
||||
return BulkProcessor.builder(new BiConsumer<BulkRequest, ActionListener<BulkResponse>>() {
|
||||
@Override
|
||||
void accept(BulkRequest bulkRequest, ActionListener<BulkResponse> bulkResponseActionListener) {
|
||||
client.bulkAsync(bulkRequest, RequestOptions.DEFAULT, bulkResponseActionListener)
|
||||
}
|
||||
}, listener).setBulkActions(10000)
|
||||
.setConcurrentRequests(20)
|
||||
.setBackoffPolicy(BackoffPolicy.constantBackoff(TimeValue.timeValueSeconds(1L), 3))
|
||||
.setFlushInterval(TimeValue.timeValueSeconds(10L)).build();
|
||||
}
|
||||
|
||||
if(hits){
|
||||
def nThread = Runtime.getRuntime().availableProcessors() * 5
|
||||
ExecutorService executorService = Executors.newFixedThreadPool(nThread)
|
||||
/**
|
||||
* 关闭一个ES批处理器
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
static closeBulkProcessor(BulkProcessor bulkProcessor) {
|
||||
|
||||
for (int k=0;k<hits.size();k++) {
|
||||
final SearchHit hit = hits[k];
|
||||
bulkProcessor.awaitClose(10, TimeUnit.DAYS)
|
||||
bulkProcessor.flush()
|
||||
bulkProcessor.close()
|
||||
|
||||
}
|
||||
|
||||
static executeQuery(String host, String indexName, QueryBuilder qb, Closure closure){
|
||||
|
||||
RestHighLevelClient client = getClient(host)
|
||||
BulkProcessor bulkProcessor = createBulkProcessor(host, client)
|
||||
final Scroll scroll = new Scroll(TimeValue.timeValueMinutes(60L))
|
||||
SearchRequest searchRequest = new SearchRequest(indexName);
|
||||
searchRequest.scroll(scroll);
|
||||
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
|
||||
searchSourceBuilder.query(qb);
|
||||
searchRequest.source(searchSourceBuilder);
|
||||
SearchResponse searchResponse = client.search(searchRequest, RequestOptions.DEFAULT);
|
||||
String scrollId = searchResponse.getScrollId();
|
||||
SearchHit[] searchHits = searchResponse.getHits().getHits();
|
||||
def nThread = Runtime.getRuntime().availableProcessors() * 5
|
||||
ExecutorService executorService = Executors.newFixedThreadPool(nThread)
|
||||
while (searchHits != null && searchHits.length > 0) {
|
||||
for (int k=0; k < searchHits.size(); k++) {
|
||||
final SearchHit hit = searchHits[k];
|
||||
executorService.submit(new Runnable() {
|
||||
@Override
|
||||
void run() {
|
||||
@@ -124,96 +172,66 @@ class ElasticUtils {
|
||||
if(closure.getMaximumNumberOfParameters() == 1){
|
||||
def update = closure.call(hit.getSourceAsMap())
|
||||
if(update){
|
||||
bulkProcessor.add(new IndexRequest(indexName, type, hit.getId()).source(hit.getSourceAsMap()))
|
||||
bulkProcessor.add(new IndexRequest(indexName).id(hit.getId()).source(hit.getSourceAsMap()))
|
||||
}
|
||||
}else if(closure.getMaximumNumberOfParameters() == 2){
|
||||
def update = closure.call(hit.getId(), hit.getSourceAsMap())
|
||||
if(update){
|
||||
bulkProcessor.add(new IndexRequest(indexName, type, hit.getId()).source(hit.getSourceAsMap()))
|
||||
bulkProcessor.add(new IndexRequest(indexName).id(hit.getId()).source(hit.getSourceAsMap()))
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
// println(hits)
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
scrollResp = client.prepareSearchScroll(scrollResp.getScrollId()).setScroll(new TimeValue(60000)).execute().actionGet()
|
||||
while(scrollResp.getHits().getHits().length != 0){
|
||||
hits = scrollResp.getHits().getHits();
|
||||
for (int k=0;k<hits.size();k++) {
|
||||
final SearchHit hit = hits[k];
|
||||
executorService.submit(new Runnable() {
|
||||
@Override
|
||||
void run() {
|
||||
try{
|
||||
if(closure.getMaximumNumberOfParameters() == 1){
|
||||
def update = closure.call(hit.getSourceAsMap())
|
||||
if(update){
|
||||
bulkProcessor.add(new IndexRequest(indexName, type, hit.getId()).source(hit.getSourceAsMap()))
|
||||
}
|
||||
}else if(closure.getMaximumNumberOfParameters() == 2){
|
||||
def update = closure.call(hit.getId(), hit.getSourceAsMap())
|
||||
if(update){
|
||||
bulkProcessor.add(new IndexRequest(indexName, type, hit.getId()).source(hit.getSourceAsMap()))
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
// println(hits)
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
scrollResp = client.prepareSearchScroll(scrollResp.getScrollId()).setScroll(new TimeValue(60000)).execute().actionGet()
|
||||
}
|
||||
executorService.shutdown()
|
||||
executorService.awaitTermination(1, TimeUnit.DAYS)
|
||||
bulkProcessor.awaitClose(1, TimeUnit.DAYS)
|
||||
SearchScrollRequest scrollRequest = new SearchScrollRequest(scrollId);
|
||||
scrollRequest.scroll(scroll);
|
||||
searchResponse = client.scroll(scrollRequest, RequestOptions.DEFAULT);
|
||||
scrollId = searchResponse.getScrollId();
|
||||
searchHits = searchResponse.getHits().getHits();
|
||||
}
|
||||
ClearScrollRequest clearScrollRequest = new ClearScrollRequest();
|
||||
clearScrollRequest.addScrollId(scrollId);
|
||||
client.clearScroll(clearScrollRequest, RequestOptions.DEFAULT);
|
||||
executorService.shutdown()
|
||||
executorService.awaitTermination(1, TimeUnit.DAYS)
|
||||
bulkProcessor.close()
|
||||
bulkProcessor.awaitClose(1, TimeUnit.DAYS)
|
||||
client.close()
|
||||
}
|
||||
|
||||
|
||||
static def executeSimpleQuery(String host, String indexName, QueryBuilder qb){
|
||||
client = getClient(host);
|
||||
SearchResponse scrollResp = null;
|
||||
int errorCount = 0;
|
||||
def hits ;
|
||||
def stop = false;
|
||||
while(!stop){
|
||||
try{
|
||||
scrollResp = client.prepareSearch(indexName)
|
||||
.addSort(FieldSortBuilder.DOC_FIELD_NAME, SortOrder.ASC)
|
||||
.setScroll(new TimeValue(600000))
|
||||
.setQuery(qb)
|
||||
.setSize(10000)
|
||||
.setScroll(TimeValue.timeValueMinutes(1))//设置 search context 维护1分钟的有效期
|
||||
.get()
|
||||
|
||||
stop = true;
|
||||
}catch(Exception e){
|
||||
errorCount++;
|
||||
if(errorCount>11){
|
||||
stop = true;
|
||||
}
|
||||
println "错误:${errorCount} "+e.getMessage()
|
||||
}
|
||||
}
|
||||
final Scroll scroll = new Scroll(TimeValue.timeValueMinutes(60L))
|
||||
RestHighLevelClient client = getClient(host)
|
||||
SearchRequest searchRequest = new SearchRequest(indexName);
|
||||
searchRequest.scroll(scroll);
|
||||
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
|
||||
searchSourceBuilder.query(qb);
|
||||
searchRequest.source(searchSourceBuilder);
|
||||
SearchResponse searchResponse = client.search(searchRequest, RequestOptions.DEFAULT);
|
||||
String scrollId = searchResponse.getScrollId();
|
||||
SearchHit[] searchHits = searchResponse.getHits().getHits();
|
||||
def results = []
|
||||
while(scrollResp.getHits() && scrollResp.getHits().getHits().length != 0){
|
||||
for (SearchHit searchHit : scrollResp.getHits().getHits()) {
|
||||
while (searchHits != null && searchHits.length > 0) {
|
||||
for (int k=0; k < searchHits.size(); k++) {
|
||||
SearchHit searchHit = searchHits[k]
|
||||
searchHit.getSourceAsMap().put("id", searchHit.getId());
|
||||
results << searchHit.getSourceAsMap()
|
||||
}
|
||||
scrollResp = client.prepareSearchScroll(scrollResp.getScrollId()).setScroll(TimeValue.timeValueMinutes(1)).execute().actionGet();
|
||||
//当searchHits的数组为空的时候结束循环,至此数据全部读取完毕
|
||||
SearchScrollRequest scrollRequest = new SearchScrollRequest(scrollId);
|
||||
scrollRequest.scroll(scroll);
|
||||
searchResponse = client.scroll(scrollRequest, RequestOptions.DEFAULT);
|
||||
scrollId = searchResponse.getScrollId();
|
||||
searchHits = searchResponse.getHits().getHits();
|
||||
}
|
||||
//删除scroll
|
||||
ClearScrollRequest clearScrollRequest = new ClearScrollRequest();
|
||||
clearScrollRequest.addScrollId(scrollResp.getScrollId());
|
||||
client.clearScroll(clearScrollRequest).actionGet();
|
||||
clearScrollRequest.addScrollId(scrollId);
|
||||
client.clearScroll(clearScrollRequest, RequestOptions.DEFAULT);
|
||||
client.close()
|
||||
return results;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
-84
@@ -1,84 +0,0 @@
|
||||
package com.fangjia.script.util
|
||||
|
||||
import org.apache.commons.lang3.SystemUtils
|
||||
import org.elasticsearch.action.bulk.BulkProcessor
|
||||
import org.elasticsearch.action.bulk.BulkRequest
|
||||
import org.elasticsearch.action.bulk.BulkResponse
|
||||
import org.elasticsearch.client.transport.TransportClient
|
||||
import org.elasticsearch.common.settings.Settings
|
||||
import org.elasticsearch.common.transport.TransportAddress
|
||||
import org.elasticsearch.xpack.client.PreBuiltXPackTransportClient
|
||||
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
/**
|
||||
* 功能说明:Elasticsearch工具类
|
||||
*/
|
||||
class ElasticsearchHelper {
|
||||
|
||||
|
||||
static getClient(String host, String clusterName = "fangjia"){
|
||||
Settings.Builder builder = Settings.builder()
|
||||
.put("cluster.name", clusterName)
|
||||
.put("client.transport.sniff", false)
|
||||
.put("client.transport.ping_timeout", "60s")
|
||||
.put("xpack.security.user","developer:5e8edd851d2fdfbd7415232c67367cc3")
|
||||
.put("xpack.security.transport.ssl.enabled", "true")
|
||||
if(SystemUtils.IS_OS_WINDOWS){
|
||||
builder
|
||||
.put("xpack.security.transport.ssl.truststore.path", "D:\\goojiaconfig\\elasticmongo\\elastic-certificates.p12")
|
||||
.put("xpack.security.transport.ssl.keystore.path", "D:\\goojiaconfig\\elasticmongo\\elastic-certificates.p12")
|
||||
}else{
|
||||
builder
|
||||
.put("xpack.security.transport.ssl.truststore.path", "/opt/elasticmongo/elastic-certificates.p12")
|
||||
.put("xpack.security.transport.ssl.keystore.path", "/opt/elasticmongo/elastic-certificates.p12")
|
||||
}
|
||||
builder.put("xpack.security.transport.ssl.verification_mode", "certificate").build()
|
||||
Settings settings = builder.build()
|
||||
return new PreBuiltXPackTransportClient(settings)
|
||||
.addTransportAddress(new TransportAddress(InetAddress.getByName(host), 9300))
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 创建一个ES批处理器
|
||||
* @param clusterName
|
||||
* @param host
|
||||
* @return
|
||||
*/
|
||||
static createBulkProcessor( String host, String clusterName){
|
||||
TransportClient client = getClient(host, clusterName)
|
||||
BulkProcessor bulkProcessor = BulkProcessor.builder(client, new BulkProcessor.Listener() {
|
||||
@Override
|
||||
void beforeBulk(long executionId, BulkRequest request) {
|
||||
}
|
||||
|
||||
@Override
|
||||
void afterBulk(long executionId, BulkRequest request, BulkResponse response) {
|
||||
}
|
||||
|
||||
@Override
|
||||
void afterBulk(long executionId, BulkRequest request, Throwable failure) {
|
||||
failure.printStackTrace()
|
||||
}
|
||||
}).setBulkActions(10000).setConcurrentRequests(20).build()
|
||||
|
||||
return bulkProcessor
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭一个ES批处理器
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
static closeBulkProcessor(BulkProcessor bulkProcessor){
|
||||
|
||||
bulkProcessor.awaitClose(10, TimeUnit.MINUTES)
|
||||
bulkProcessor.flush()
|
||||
bulkProcessor.close()
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+2
-3
@@ -1,19 +1,18 @@
|
||||
package com.fangjia.script.vipsite
|
||||
|
||||
import com.fangjia.script.util.ElasticsearchHelper
|
||||
import com.fangjia.script.util.ElasticUtils
|
||||
import com.mongodb.DBObject
|
||||
import org.elasticsearch.action.search.SearchRequestBuilder
|
||||
import org.elasticsearch.action.search.SearchResponse
|
||||
import org.elasticsearch.action.search.SearchType
|
||||
import org.elasticsearch.client.transport.TransportClient
|
||||
import org.elasticsearch.common.unit.TimeValue
|
||||
import org.elasticsearch.index.query.QueryBuilder
|
||||
import org.elasticsearch.index.query.QueryBuilders
|
||||
import org.elasticsearch.search.SearchHit
|
||||
import org.elasticsearch.search.SearchHits
|
||||
|
||||
try {
|
||||
TransportClient transportClient = ElasticsearchHelper.getClient("192.168.0.206");
|
||||
TransportClient transportClient = ElasticUtils.getClient("192.168.0.206");
|
||||
|
||||
QueryBuilder dateRange_avg_price = QueryBuilders.rangeQuery("avg_price").lte(0);
|
||||
QueryBuilder dateRange_total_price = QueryBuilders.rangeQuery("total_price").lte(0);
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
package com.fangjia.script.weilei
|
||||
|
||||
import com.fangjia.core.util.DateUtil
|
||||
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
import com.mongodb.Bytes
|
||||
import com.mongodb.DBCollection
|
||||
@@ -8,7 +8,7 @@ import com.mongodb.DBCursor
|
||||
import com.mongodb.DBObject
|
||||
import net.sf.json.JSONObject
|
||||
import org.apache.commons.lang.StringUtils
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.Connection
|
||||
import java.sql.ResultSet
|
||||
@@ -16,7 +16,7 @@ import java.sql.SQLException
|
||||
import java.sql.Statement
|
||||
import java.text.SimpleDateFormat
|
||||
|
||||
JdbcDataSource dataSource = new JdbcDataSource();
|
||||
EsDataSource dataSource = new EsDataSource();
|
||||
String address = "jdbc:es://http://seawater.es.db.fangjia.com/timezone=UTC&page.size=240&connect.timeout=240s&network.timeout=120s&page.timeout=240s";
|
||||
dataSource.setUrl(address);
|
||||
Properties connectionProperties = new Properties();
|
||||
|
||||
@@ -1,31 +1,16 @@
|
||||
import com.fangjia.core.Constants
|
||||
import com.fangjia.core.RegionData
|
||||
import com.fangjia.core.util.Mongo3Utils
|
||||
import com.fangjia.script.util.CommonUtils
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.fangjia.script.util.Jms
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.CommandResult
|
||||
import com.mongodb.DB
|
||||
import com.mongodb.DBCollection
|
||||
import com.mongodb.Mongo
|
||||
import com.mongodb.client.MongoCollection
|
||||
import org.bson.Document
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.Connection
|
||||
import java.sql.ResultSet
|
||||
import java.sql.Statement
|
||||
import java.util.function.Consumer
|
||||
|
||||
import static com.mongodb.client.model.Filters.*;
|
||||
|
||||
import org.bson.Document
|
||||
import com.mongodb.client.MongoCollection
|
||||
import static com.mongodb.client.model.Filters.*
|
||||
import com.fangjia.core.util.Mongo3Utils
|
||||
import static com.mongodb.client.model.Filters.and
|
||||
import static com.mongodb.client.model.Filters.eq
|
||||
|
||||
def cityList = ["上海", "广州", "北京", "深圳", "成都", "杭州", "重庆", "武汉", "西安", "天津"]
|
||||
def roots = ["lianjia.com", "zhuge.com", "fang.com", "anjuke.com", "58.com", "soufy.cn"]
|
||||
@@ -43,7 +28,7 @@ cityList.each { def city ->
|
||||
}
|
||||
})
|
||||
roots.each { def root ->
|
||||
JdbcDataSource dataSource = new JdbcDataSource();
|
||||
EsDataSource dataSource = new EsDataSource();
|
||||
String address = "jdbc:es://http://192.168.0.206:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
dataSource.setUrl(address)
|
||||
Properties connectionProperties = new Properties()
|
||||
|
||||
+3
-14
@@ -1,23 +1,12 @@
|
||||
package com.fangjia.script.wenyan.address
|
||||
|
||||
import com.fangjia.core.util.BaiDuApiUtils
|
||||
import com.fangjia.core.util.DateUtil
|
||||
import com.fangjia.core.util.HttpRequest
|
||||
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
import com.fangjia.script.util.OpenApiClient
|
||||
import com.fangjia.script.yinjihaun.util.QQKeyPool
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import net.sf.json.JSONObject
|
||||
import org.apache.commons.lang.StringUtils
|
||||
import org.apache.lucene.index.Term
|
||||
import org.apache.lucene.search.BooleanClause
|
||||
import org.apache.lucene.search.BooleanQuery
|
||||
import org.apache.lucene.search.TermQuery
|
||||
import org.apache.solr.client.solrj.util.ClientUtils
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.Connection
|
||||
import java.sql.ResultSet
|
||||
@@ -44,7 +33,7 @@ import java.sql.Statement
|
||||
// data << (k.split("_") as List)
|
||||
//}
|
||||
//ExcelUtils.write("D:\\ÎÞ¾ù¼ÛÊý¾Ý.xlsx", data, "½á¹û")
|
||||
JdbcDataSource dataSource = new JdbcDataSource();
|
||||
EsDataSource dataSource = new EsDataSource();
|
||||
String address = "jdbc:es://http://192.168.0.18:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s";
|
||||
dataSource.setUrl(address)
|
||||
Properties connectionProperties = new Properties()
|
||||
|
||||
+3
-3
@@ -1,20 +1,20 @@
|
||||
package com.fangjia.script.wenyan.avgPrice
|
||||
|
||||
|
||||
import com.fangjia.script.util.CommonUtils
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import org.apache.commons.lang.StringUtils
|
||||
import org.apache.solr.client.solrj.util.ClientUtils
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.Connection
|
||||
import java.sql.ResultSet
|
||||
import java.sql.Statement
|
||||
|
||||
def findEstateType(String city, String region, String name, List alias) {
|
||||
|
||||
JdbcDataSource dataSource = new JdbcDataSource()
|
||||
EsDataSource dataSource = new EsDataSource()
|
||||
String address = "jdbc:es://http://192.168.0.206:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
dataSource.setUrl(address)
|
||||
Properties connectionProperties = new Properties()
|
||||
|
||||
+2
-7
@@ -10,17 +10,12 @@ import org.apache.commons.lang.StringUtils
|
||||
import org.apache.commons.math3.ml.clustering.CentroidCluster
|
||||
import org.apache.commons.math3.ml.clustering.DoublePoint
|
||||
import org.apache.commons.math3.ml.clustering.KMeansPlusPlusClusterer
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.Connection
|
||||
import java.sql.ResultSet
|
||||
import java.sql.Statement
|
||||
|
||||
import org.bson.Document
|
||||
import com.mongodb.client.MongoCollection
|
||||
import static com.mongodb.client.model.Filters.*
|
||||
import com.fangjia.core.util.Mongo3Utils
|
||||
|
||||
DBCollection RENT_FACTOR_MAP = MongoUtils.getCollectionByName("fangjia", "rent_factor_map", "192.168.0.136", 28017)
|
||||
|
||||
def findHouse(BasicDBObject district){
|
||||
@@ -54,7 +49,7 @@ def findHouse(BasicDBObject district){
|
||||
sqlBuffer.append(" and root !='focus.cn' and root != '58.com' ")
|
||||
sqlBuffer.append(" ORDER BY p_date desc")
|
||||
|
||||
JdbcDataSource dataSource = new JdbcDataSource();
|
||||
EsDataSource dataSource = new EsDataSource();
|
||||
String address = "jdbc:es://http://seawater.es.db.fangjia.com/timezone=UTC&page.size=240&connect.timeout=240s&network.timeout=600s&page.timeout=240s";
|
||||
dataSource.setUrl(address);
|
||||
Properties connectionProperties = new Properties()
|
||||
|
||||
+2
-2
@@ -1,13 +1,13 @@
|
||||
package com.fangjia.script.wenyan.seawater
|
||||
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.Connection
|
||||
import java.sql.ResultSet
|
||||
import java.sql.Statement
|
||||
|
||||
JdbcDataSource dataSource = new JdbcDataSource();
|
||||
EsDataSource dataSource = new EsDataSource();
|
||||
String address = "jdbc:es://http://192.168.0.206:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
dataSource.setUrl(address)
|
||||
Properties connectionProperties = new Properties()
|
||||
|
||||
+2
-2
@@ -1,13 +1,13 @@
|
||||
package com.fangjia.script.wenyan.seawater
|
||||
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.Connection
|
||||
import java.sql.ResultSet
|
||||
import java.sql.Statement
|
||||
|
||||
JdbcDataSource dataSource = new JdbcDataSource();
|
||||
EsDataSource dataSource = new EsDataSource();
|
||||
String address = "jdbc:es://http://192.168.0.206:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
dataSource.setUrl(address)
|
||||
Properties connectionProperties = new Properties()
|
||||
|
||||
+2
-14
@@ -1,20 +1,12 @@
|
||||
package com.fangjia.script.wenyan.temp
|
||||
|
||||
import com.fangjia.core.util.HttpRequest
|
||||
|
||||
import com.fangjia.core.util.Mongo3Utils
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.client.MongoCollection
|
||||
import org.bson.Document
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import java.sql.Connection
|
||||
import java.sql.ResultSet
|
||||
import java.sql.Statement
|
||||
import java.util.function.Consumer
|
||||
|
||||
import static com.mongodb.client.model.Filters.and
|
||||
import static com.mongodb.client.model.Filters.eq
|
||||
|
||||
//
|
||||
//def data = [["城市", "区域", "小区名", "2018", "全部"]]
|
||||
//cityList = ["上海"]
|
||||
@@ -47,10 +39,6 @@ import static com.mongodb.client.model.Filters.eq
|
||||
|
||||
//HttpRequest httpRequest = new HttpRequest()
|
||||
//println httpRequest.get("https://sh.centanet.com/xiaoqu/pudongxinqu/g2", [:], ['User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36'], "UTF-8")
|
||||
import org.bson.Document
|
||||
import com.mongodb.client.MongoCollection
|
||||
import static com.mongodb.client.model.Filters.*
|
||||
import com.fangjia.core.util.Mongo3Utils
|
||||
|
||||
MongoCollection<Document> AVERAGER_CONFIG = Mongo3Utils.getDbCollection("fangjia", "averager_config")
|
||||
AVERAGER_CONFIG.find().each {Document doc->
|
||||
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
package com.fangjia.script.wenyan.temp
|
||||
|
||||
import cc.blynk.clickhouse.copy.CopyManager
|
||||
import cc.blynk.clickhouse.copy.CopyManagerFactory
|
||||
import com.fangjia.core.util.DateUtil
|
||||
import net.sf.json.JSONNull
|
||||
import net.sf.json.JSONObject
|
||||
import org.bson.types.ObjectId
|
||||
import ru.yandex.clickhouse.ClickHouseConnection
|
||||
import ru.yandex.clickhouse.ClickHouseDriver
|
||||
import ru.yandex.clickhouse.settings.ClickHouseProperties
|
||||
|
||||
import java.sql.PreparedStatement
|
||||
import java.sql.Timestamp
|
||||
|
||||
//ClickHouseDriver clickHouseDriver = new ClickHouseDriver()
|
||||
//ClickHouseProperties clickHouseProperties = new ClickHouseProperties()
|
||||
//clickHouseProperties.connectionTimeout = 1000 * 3600 * 24
|
||||
//clickHouseProperties.keepAliveTimeout = 1000 * 3600 * 24
|
||||
//clickHouseProperties.dataTransferTimeout = 1000 * 3600 * 24
|
||||
//clickHouseProperties.user = "default"
|
||||
//clickHouseProperties.password = "goojia123456"
|
||||
//ClickHouseConnection connection = clickHouseDriver.connect("jdbc:clickhouse://192.168.0.93:8123/fangjia", clickHouseProperties)
|
||||
//CopyManager copyManager = CopyManagerFactory.create(connection)
|
||||
//copyManager.copyFromDb("select * from fangjia.SEAWATER", "D://123.csv");
|
||||
|
||||
|
||||
//PreparedStatement sth = connection.prepareStatement("INSERT INTO SEAWATER(id,city,region,name,district_name,address,room,hall,toilet,area,avg_price,total_price ,floor_info,height,floor,direction,fitment,p_date,publish_date,c_date,m_date) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
|
||||
//def cols = ["id", "city", "region", "name", "district_name", "address", "room", "hall", "toilet", "area", "avg_price", "total_price ", "floor_info", "height", "floor", "direction", "fitment", "p_date", "publish_date", "c_date", "m_date"]
|
||||
//int count = 0
|
||||
//new File("D:\\½¨ÐвâÊÔÊý¾Ý").eachFile { def file ->
|
||||
// file.eachLine("UTF-8", { def line ->
|
||||
// String id = line.substring(0, line.indexOf("\t"))
|
||||
// String jsonStr = line.substring(line.indexOf("\t") + 1)
|
||||
// count++
|
||||
// JSONObject json = JSONObject.fromObject(jsonStr)
|
||||
// json.put("id", id)
|
||||
// for (int i = 0; i < cols.size(); i++) {
|
||||
// if (cols[i].toString().endsWith("date") && "p_date" != cols[i]) {
|
||||
// if ("c_date" == cols[i]) {
|
||||
// if (json.get("m_date") instanceof Long) {
|
||||
// sth.setTimestamp(i + 1, new Timestamp(json.get("m_date")))
|
||||
// } else {
|
||||
// sth.setTimestamp(i + 1, new Timestamp(((Date) DateUtil.parseISODate(json.get("m_date"))).getTime()))
|
||||
//
|
||||
// }
|
||||
// } else {
|
||||
// if (json.get(cols[i]) instanceof String) {
|
||||
// sth.setTimestamp(i + 1, new Timestamp(((Date) DateUtil.parseISODate(json.get(cols[i]))).getTime()))
|
||||
// } else {
|
||||
// sth.setTimestamp(i + 1, new Timestamp(json.get(cols[i])))
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// if (json.get(cols[i]) instanceof JSONNull) {
|
||||
// sth.setObject(i + 1, null)
|
||||
// } else {
|
||||
// sth.setObject(i + 1, json.get(cols[i]))
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// sth.addBatch()
|
||||
// if (count % 30000 == 0) {
|
||||
// sth.executeBatch()
|
||||
// println(new Date().format("HH:mm:ss " + count))
|
||||
// }
|
||||
// })
|
||||
//}
|
||||
//sth.execute()
|
||||
def ids = new HashSet()
|
||||
for(int i =0 ; i < 10000 * 10000; i++){
|
||||
if(i%10000 == 0){
|
||||
println(i)
|
||||
}
|
||||
def id = new ObjectId().toString()
|
||||
if(ids.contains(id)){
|
||||
println(id)
|
||||
}else{
|
||||
ids << id
|
||||
}
|
||||
}
|
||||
+10
-11
@@ -1,17 +1,16 @@
|
||||
package com.fangjia.script.wenyan.temp
|
||||
|
||||
import com.fangjia.core.ProvinceData
|
||||
import com.fangjia.core.RegionData
|
||||
import com.fangjia.script.util.CommonUtils
|
||||
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
|
||||
ExcelUtils.multiThreadingModify("D:\\Users\\wenyan\\Desktop\\建行深开数据统计.xlsx",{List item->
|
||||
String city = RegionData.formatCity(item["A"])
|
||||
if(city){
|
||||
item["G"] = DbUtils.seaweed.count(DbUtils.buildSeaweedQuery(RegionData.formatCity(item["A"])))
|
||||
}else{
|
||||
item["G"] = null
|
||||
def data = [["城市", "区域", "小区名", "别名", "地址", "地址别名"]]
|
||||
["ID", "北京", "重庆", "哈尔滨"].each {def city->
|
||||
DbUtils.seaweed.find(DbUtils.buildSeaweedQuery(city)).each {BasicDBObject district->
|
||||
def item = [district._id.toString(), district.city, district.region, district.name, district.alias?.join(","), district.address, district.addr_alias?.join(",")]
|
||||
println(item)
|
||||
data << item
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
ExcelUtils.write("D:\\待抓取小区.xlsx", data, "数据")
|
||||
+2
-2
@@ -11,8 +11,8 @@ import org.bson.Document
|
||||
import static com.mongodb.client.model.Filters.*
|
||||
|
||||
MongoCollection<Document> OPEN_URI_LOG = Mongo3Utils.getDbCollection(Constants.SEAWATER_MONGO_URI, "business", "open_uri_log")
|
||||
def startDate = DateUtil.parseDate("20201101", "yyyyMMdd")
|
||||
def endDate = DateUtil.parseDate("20201201", "yyyyMMdd")
|
||||
def startDate = DateUtil.parseDate("20210301", "yyyyMMdd")
|
||||
def endDate = DateUtil.parseDate("20210401", "yyyyMMdd")
|
||||
Calendar calendar = Calendar.getInstance()
|
||||
calendar.setTime(startDate)
|
||||
def count = 0
|
||||
|
||||
+3
-9
@@ -1,19 +1,13 @@
|
||||
package com.fangjia.script.wenyan.temp
|
||||
|
||||
import com.fangjia.core.RegionData
|
||||
import com.fangjia.core.util.DateUtil
|
||||
import com.fangjia.core.util.HttpRequest
|
||||
import com.fangjia.core.util.Mongo3Utils
|
||||
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import com.mongodb.Mongo
|
||||
import com.mongodb.client.MongoCollection
|
||||
import org.apache.commons.lang.StringUtils
|
||||
import org.bson.Document
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.Connection
|
||||
import java.sql.ResultSet
|
||||
@@ -61,7 +55,7 @@ import java.sql.Statement
|
||||
//println(bigMarkupCount)
|
||||
|
||||
def countHouses(String city, String region, String name){
|
||||
JdbcDataSource dataSource = new JdbcDataSource()
|
||||
EsDataSource dataSource = new EsDataSource()
|
||||
String address = "jdbc:es://http://192.168.0.206:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
dataSource.setUrl(address)
|
||||
Properties connectionProperties = new Properties()
|
||||
|
||||
+3
-15
@@ -1,28 +1,16 @@
|
||||
package com.fangjia.script.wenyan.temp
|
||||
|
||||
import com.fangjia.core.Constants
|
||||
import com.fangjia.core.util.DateUtil
|
||||
import com.fangjia.core.util.HttpRequest
|
||||
import com.fangjia.datastore.driver.DSCollection
|
||||
import com.fangjia.datastore.driver.DataStore
|
||||
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.fangjia.script.util.OpenApiClient
|
||||
import com.mongodb.BasicDBObject
|
||||
import net.sf.json.JSONObject
|
||||
import org.apache.commons.lang.StringUtils
|
||||
import org.bson.Document
|
||||
import com.mongodb.client.MongoCollection
|
||||
import org.bson.types.ObjectId
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.Connection
|
||||
import java.sql.ResultSet
|
||||
import java.sql.Statement
|
||||
import java.util.function.Consumer
|
||||
|
||||
import static com.mongodb.client.model.Filters.*
|
||||
import com.fangjia.core.util.Mongo3Utils
|
||||
def poiData = Collections.synchronizedList([])
|
||||
//
|
||||
//ExcelUtils.multiThreadingModify("D:\\商务数据\\附件1:测试数据\\房价网测试.xlsx", { List item ->
|
||||
@@ -79,7 +67,7 @@ def poiData = Collections.synchronizedList([])
|
||||
// println(item)
|
||||
//},1)
|
||||
def findHouseCount(String city, String region, String name, List alias) {
|
||||
JdbcDataSource dataSource = new JdbcDataSource()
|
||||
EsDataSource dataSource = new EsDataSource()
|
||||
String address = "jdbc:es://http://192.168.0.206:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
dataSource.setUrl(address)
|
||||
Properties connectionProperties = new Properties()
|
||||
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package com.fangjia.script.wenyan.temp
|
||||
|
||||
import com.fangjia.core.Constants
|
||||
import com.fangjia.core.util.DateUtil
|
||||
import com.fangjia.core.util.Mongo3Utils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.mongodb.client.MongoCollection
|
||||
import net.sf.json.JSONObject
|
||||
import org.bson.Document
|
||||
|
||||
import static com.mongodb.client.model.Filters.*
|
||||
|
||||
MongoCollection<Document> OPEN_URI_LOG = Mongo3Utils.getDbCollection(Constants.SEAWATER_MONGO_URI, "business", "open_uri_log")
|
||||
def startDate = DateUtil.parseDate("20210301", "yyyyMMdd")
|
||||
def endDate = DateUtil.parseDate("20210401", "yyyyMMdd")
|
||||
Calendar calendar = Calendar.getInstance()
|
||||
calendar.setTime(startDate)
|
||||
def count = 0
|
||||
def hashSet = []
|
||||
def data = [["用户ID", "用户名称", "IP", "访问链接", "访问时间", "dataStatus", "code", "msg", "参数", "resMap"]]
|
||||
while (startDate.before(endDate)) {
|
||||
calendar.add(Calendar.DATE, 1)
|
||||
def nextDate = calendar.getTime()
|
||||
count++
|
||||
OPEN_URI_LOG.find(and(eq("user_id", "1007721"), eq("request_uri", "/property/evaluate3"), eq("data_status", 1), lt("c_date", nextDate), gte("c_date", startDate))).each { Document doc ->
|
||||
def result = JSONObject.fromObject(doc.res_map.result)
|
||||
if(!result.buildYear || !result.avgPrice){
|
||||
return
|
||||
}
|
||||
def params = JSONObject.fromObject(doc.parameter_map)
|
||||
def key = "${params.address}_${params.size}".toString()
|
||||
if (!hashSet.contains(key)) {
|
||||
def item = ["1007721", "scjc", doc.ip, doc.request_uri, doc.c_date, doc.data_status, doc.code, doc.msg, JSONObject.fromObject(doc.parameter_map).toString(), result.toString()]
|
||||
data << item
|
||||
hashSet << key
|
||||
} else {
|
||||
println("已存在")
|
||||
}
|
||||
}
|
||||
startDate = nextDate
|
||||
}
|
||||
ExcelUtils.write("D:\\四川锦城${startDate.format('yyyyMM')}.xlsx", data, "查询日志")
|
||||
@@ -1,11 +1,17 @@
|
||||
import com.fangjia.core.RegionData
|
||||
import com.fangjia.core.util.BaiDuApiUtils
|
||||
import com.fangjia.core.util.DataUtil
|
||||
import com.fangjia.core.util.DateUtil
|
||||
import com.fangjia.core.util.GeoUtils
|
||||
import com.fangjia.core.util.GeocodeUtils
|
||||
import com.fangjia.core.util.HttpRequest
|
||||
import com.fangjia.datastore.driver.DSCursor
|
||||
import com.fangjia.datastore.driver.FacetResult
|
||||
import com.fangjia.script.util.BaiduMapUtils
|
||||
import com.fangjia.script.util.CommonUtils
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
|
||||
//import com.fangjia.script.util.ExcelUtils
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
import com.fangjia.script.util.OpenApiClient
|
||||
@@ -132,4 +138,70 @@ import org.apache.commons.lang3.StringUtils
|
||||
// item["E"] = RegionData.formatRegion(item["B"], item["C"])
|
||||
// println(item)
|
||||
//})
|
||||
CommonUtils.reFitAverage("常州","新北","龙城花园", "普通住宅")
|
||||
//def border = [13511506.7,3639168.61,13511516.8,3639404.86,13511515.27,3639416.92,13511738.21,3639384.94,13512007.72,3639336.35,13511984.92,3639074.96,13511722.75,3639121.08,13511506.7,3639168.61]
|
||||
//def coords = []
|
||||
//for(int i=0; i < border.size() - 1; i=i+2){
|
||||
// coords << "${border[i]},${border[i+1]}"
|
||||
//}
|
||||
//def json=BaiDuApiUtils.geoconv(coords.join(";"), 6, 5)
|
||||
//println(json)
|
||||
//def points = []
|
||||
//for(JSONObject it : json.result){
|
||||
// def geo = GeocodeUtils.geoconvBaiduToGoogle(it.x, it.y)
|
||||
// points << "${geo.lng},${geo.lat}"
|
||||
// println(" new AMap.LngLat(${geo.lng},${geo.lat}),")
|
||||
//}
|
||||
|
||||
DBCollection BAIDUMAP_BORDER_COLL = MongoUtils.getCollectionByName("addrepo", "baidumap_border", "192.168.0.206", 27020)
|
||||
BAIDUMAP_BORDER_COLL.find(new BasicDBObject("baidu_border", null)).each {BasicDBObject dbo->
|
||||
def border = dbo.getString("border").replace("1-", "").replace(";", "").split(",") as List
|
||||
def coords = []
|
||||
def baidu_points = []
|
||||
def gaode_points = []
|
||||
for(int i=0; i < border.size() - 1; i=i+2){
|
||||
coords << "${border[i]},${border[i+1]}"
|
||||
if(coords.size() > 50){
|
||||
def json=BaiDuApiUtils.geoconv(coords.join(";"), 6, 5)
|
||||
for(JSONObject it : json.result){
|
||||
baidu_points << "${it.x},${it.y}"
|
||||
def geo = GeocodeUtils.geoconvBaiduToGoogle(it.x, it.y)
|
||||
gaode_points << "${DataUtil.roundDouble(geo.lng, 6)},${DataUtil.roundDouble(geo.lat,6)}"
|
||||
}
|
||||
coords.clear()
|
||||
}
|
||||
}
|
||||
if(coords.size() > 0){
|
||||
def json=BaiDuApiUtils.geoconv(coords.join(";"), 6, 5)
|
||||
for(JSONObject it : json.result){
|
||||
baidu_points << "${it.x},${it.y}"
|
||||
def geo = GeocodeUtils.geoconvBaiduToGoogle(it.x, it.y)
|
||||
gaode_points << "${DataUtil.roundDouble(geo.lng, 6)},${DataUtil.roundDouble(geo.lat,6)}"
|
||||
}
|
||||
}
|
||||
dbo.format_city = RegionData.formatCity(dbo.city)
|
||||
dbo.baidu_border = baidu_points.join(";")
|
||||
dbo.gaode_border = gaode_points.join(";")
|
||||
BAIDUMAP_BORDER_COLL.save(dbo)
|
||||
println(dbo)
|
||||
}
|
||||
|
||||
//ExcelUtils.multiThreadingModify("D:\\Users\\wenyan\\Desktop\\È˿ڲâÊÔÊý¾Ý.xlsx",{List item->
|
||||
// def seaweed = DbUtils.seaweed.findOne(DbUtils.buildSeaweedQuery(item["B"], item["C"], item["D"]), new BasicDBObject("alias", 1).append("lng",1).append("lat", 1))
|
||||
// if(seaweed){
|
||||
// item["A"] = seaweed._id.toString()
|
||||
// def names = [item['D']]
|
||||
// if(seaweed.alias){
|
||||
// names.addAll(seaweed.alias)
|
||||
// }
|
||||
// names.unique()
|
||||
// if(seaweed.lng){
|
||||
// item["G"] = DataUtil.roundDouble(seaweed.lng/10000000000d, 6)
|
||||
// item["H"] = DataUtil.roundDouble(seaweed.lat/10000000000d, 6)
|
||||
// }
|
||||
// def one = BAIDUMAP_BORDER_COLL.findOne(new BasicDBObject("format_city", item["B"]).append("format_region", item["C"]).append("name", new BasicDBObject('$in', names)))
|
||||
// if(one){
|
||||
// item["I"] = one.baidu_border
|
||||
// }
|
||||
// println(item)
|
||||
// }
|
||||
//})
|
||||
@@ -669,7 +669,6 @@ def findRentInfoByRoom(String city, String region){
|
||||
|
||||
|
||||
def findRent(def city, def region, def name){
|
||||
DBCollection DISTRICT_STAT_RENT = MongoUtils.getCollectionByName("fangjia", "sqmetre_rent", "mongo.db.fangjia.com", 27017)
|
||||
def query = new BasicDBObject()
|
||||
query.city = city
|
||||
query.region = region
|
||||
|
||||
+67
-47
@@ -14,6 +14,7 @@ import com.fangjia.script.yinjihaun.amap.GaoDeApiUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import com.mongodb.client.MongoCollection
|
||||
import net.sf.json.JSONArray
|
||||
import net.sf.json.JSONObject
|
||||
import org.apache.commons.lang3.StringUtils
|
||||
import org.dom4j.Document
|
||||
@@ -204,52 +205,71 @@ import org.dom4j.io.SAXReader
|
||||
//// }
|
||||
//// }
|
||||
//})
|
||||
DBCollection COMMAND_COLL = MongoUtils.getCollectionByName("business", "open_uri_log", "192.168.0.206", 27020)
|
||||
statMap = [:]
|
||||
def s = new HashSet()
|
||||
int count = 0
|
||||
def data = [["城市", "地址"]]
|
||||
def query = new BasicDBObject("user_id", "1007751").append("c_date", new BasicDBObject('$gte', Date.parse("yyyyMMdd", "20210119")))
|
||||
println JSONObject.fromObject(query)
|
||||
println COMMAND_COLL.count(query)
|
||||
COMMAND_COLL.find(query).batchSize(10000).each { BasicDBObject log ->
|
||||
count++
|
||||
// def city = log.parameter_map.city
|
||||
// def stat = statMap.get(city, [:])
|
||||
// stat["调用次数"] = stat.get("调用次数", 0) + 1
|
||||
if (log.res_map && log.res_map.result && log.res_map.result.totalPrice) {
|
||||
// stat["估价成功次数"] = stat.get("估价成功次数", 0) + 1
|
||||
// if(log.res_map.result.calcType == 1){
|
||||
// stat["有样本"] = stat.get("有样本", 0) + 1
|
||||
// }else{
|
||||
// stat["无样本"] = stat.get("无样本", 0) + 1
|
||||
//DBCollection COMMAND_COLL = MongoUtils.getCollectionByName("business", "open_uri_log", "192.168.0.206", 27020)
|
||||
//statMap = [:]
|
||||
//def s = new HashSet()
|
||||
//int count = 0
|
||||
//def data = [["城市", "地址"]]
|
||||
//def query = new BasicDBObject("user_id", "1007751").append("c_date", new BasicDBObject('$gte', Date.parse("yyyyMMdd", "20210119")))
|
||||
//println JSONObject.fromObject(query)
|
||||
//println COMMAND_COLL.count(query)
|
||||
//COMMAND_COLL.find(query).batchSize(10000).each { BasicDBObject log ->
|
||||
// count++
|
||||
//// def city = log.parameter_map.city
|
||||
//// def stat = statMap.get(city, [:])
|
||||
//// stat["调用次数"] = stat.get("调用次数", 0) + 1
|
||||
// if (log.res_map && log.res_map.result && log.res_map.result.totalPrice) {
|
||||
//// stat["估价成功次数"] = stat.get("估价成功次数", 0) + 1
|
||||
//// if(log.res_map.result.calcType == 1){
|
||||
//// stat["有样本"] = stat.get("有样本", 0) + 1
|
||||
//// }else{
|
||||
//// stat["无样本"] = stat.get("无样本", 0) + 1
|
||||
//// }
|
||||
//// stat["总价"] = stat.get("总价", 0l) + log.res_map.result.totalPrice
|
||||
//// stat["总面积"] = stat.get("总面积", 0d) + log.parameter_map.size.toDouble()
|
||||
//
|
||||
// } else {
|
||||
// if (log.res_map.msg.toString().contains("该小区不存在")) {
|
||||
// println( [log.parameter_map.city, log.parameter_map.address])
|
||||
// data << [log.parameter_map.city, log.parameter_map.address]
|
||||
// }
|
||||
// stat["总价"] = stat.get("总价", 0l) + log.res_map.result.totalPrice
|
||||
// stat["总面积"] = stat.get("总面积", 0d) + log.parameter_map.size.toDouble()
|
||||
|
||||
} else {
|
||||
if (log.res_map.msg.toString().contains("该小区不存在")) {
|
||||
println( [log.parameter_map.city, log.parameter_map.address])
|
||||
data << [log.parameter_map.city, log.parameter_map.address]
|
||||
}
|
||||
// stat["估价失败次数"] = stat.get("估价失败次数", 0) + 1
|
||||
// stat["失败原因:" + log.res_map.msg] = stat.get("失败原因:" + log.res_map.msg, 0) + 1
|
||||
// s << "失败原因:" + log.res_map.msg
|
||||
}
|
||||
if (count % 10000 == 0) {
|
||||
println(count)
|
||||
}
|
||||
}
|
||||
data = data.unique()
|
||||
ExcelUtils.write("D:\\未匹配地址.xlsx", data, "结果")
|
||||
//key = ["调用次数", "估价成功次数", "有样本", "无样本", "总价", "总面积", "估价失败次数"]
|
||||
//key.addAll(s)
|
||||
//print(key.join("\t"))
|
||||
//[ "苏州", "广州", "杭州", "大连", "重庆", "成都", "深圳", "厦门", "上海", "北京" ].each {def city->
|
||||
// stat = statMap.get(city)
|
||||
// con = [city]
|
||||
// for( def k : key){
|
||||
// con << stat[k]
|
||||
//// stat["估价失败次数"] = stat.get("估价失败次数", 0) + 1
|
||||
//// stat["失败原因:" + log.res_map.msg] = stat.get("失败原因:" + log.res_map.msg, 0) + 1
|
||||
//// s << "失败原因:" + log.res_map.msg
|
||||
// }
|
||||
// println con.join("\t")
|
||||
//}
|
||||
// if (count % 10000 == 0) {
|
||||
// println(count)
|
||||
// }
|
||||
//}
|
||||
//data = data.unique()
|
||||
//ExcelUtils.write("D:\\未匹配地址.xlsx", data, "结果")
|
||||
////key = ["调用次数", "估价成功次数", "有样本", "无样本", "总价", "总面积", "估价失败次数"]
|
||||
////key.addAll(s)
|
||||
////print(key.join("\t"))
|
||||
////[ "苏州", "广州", "杭州", "大连", "重庆", "成都", "深圳", "厦门", "上海", "北京" ].each {def city->
|
||||
//// stat = statMap.get(city)
|
||||
//// con = [city]
|
||||
//// for( def k : key){
|
||||
//// con << stat[k]
|
||||
//// }
|
||||
//// println con.join("\t")
|
||||
////}
|
||||
//
|
||||
//DBCollection OPEN_URI_LOG_42 = MongoUtils.getCollectionByName("business", "open_uri_log", "log.mongo.db.fangjia.com", 52002)
|
||||
//def data = [["城市", "地址", "省", "市", "区", "开发区","乡镇", "路", "路号", "小区名", "楼栋号", "单元号", "室号", "标准化地址"]]
|
||||
//OPEN_URI_LOG_42.find(new BasicDBObject("user_id", "1007756")).each {BasicDBObject dbo->
|
||||
// data << [dbo.parameter_map.city, dbo.parameter_map.address, dbo.res_map.result.province, dbo.res_map.result.city, dbo.res_map.result.district, dbo.res_map.result.developmentZone, dbo.res_map.result.township, dbo.res_map.result.street,dbo.res_map.result.streetNumber,dbo.res_map.result.name,dbo.res_map.result.buildingNumber,dbo.res_map.result.unitNumber,dbo.res_map.result.roomNumber,dbo.res_map.result.formattedAddress]
|
||||
//}
|
||||
//ExcelUtils.write("D:\\建行测试地址.xlsx", data, "结果")
|
||||
DBCollection SQMETRE_RENT_COLL = MongoUtils.getCollectionByName("fangjia", "sqmetre_rent", "mongo.db.fangjia.com")
|
||||
def query = new BasicDBObject()
|
||||
query.cat = "region"
|
||||
query.city= "上海"
|
||||
query.weekend = Date.parse("yyyyMMdd", "20210228")
|
||||
def doc = []
|
||||
def prices = []
|
||||
SQMETRE_RENT_COLL.find(query, new BasicDBObject("region", 1).append("avg_price", 1)).each {
|
||||
doc.add(new BasicDBObject("name", it.region+"区").append("value", it.avg_price))
|
||||
prices << it.avg_price
|
||||
}
|
||||
println(JSONArray.fromObject(doc).toString())
|
||||
+2
-13
@@ -1,19 +1,8 @@
|
||||
package com.fangjia.script.wenyan.temp
|
||||
|
||||
import com.fangjia.core.util.DateUtil
|
||||
import com.fangjia.script.util.CommonUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
import com.fangjia.script.yinjihaun.amap.GaoDeApiUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import net.sf.json.JSONArray
|
||||
import net.sf.json.JSONObject
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
|
||||
import java.sql.Connection
|
||||
import java.sql.ResultSet
|
||||
import java.sql.Statement
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
|
||||
//DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "mongo.db.fangjia.com")
|
||||
////ExcelUtils.multiThreadingModify("D:\\Users\\wenyan\\Downloads\\下载记录20200818-结果 - 副本.xlsx",{List item->
|
||||
|
||||
+3
-17
@@ -1,23 +1,9 @@
|
||||
package com.fangjia.script.wenyan.temp
|
||||
|
||||
import com.fangjia.core.RegionData
|
||||
import com.fangjia.script.util.CommonUtils
|
||||
import com.fangjia.script.util.DataUtil
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.fangjia.script.util.FangJiaAreaMapUtils
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
import com.fangjia.script.util.OpenApiClient
|
||||
import com.fangjia.script.util.ProvinceData
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import net.sf.json.JSONObject
|
||||
import org.apache.commons.lang.StringUtils
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
|
||||
import java.sql.Connection
|
||||
import java.sql.ResultSet
|
||||
import java.sql.Statement
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
import com.mongodb.DBCollection
|
||||
|
||||
//
|
||||
//ExcelUtils.multiThreadingModify("D:\\数据\\建行学校数据\\上海学校_0811.xls",{List item->
|
||||
|
||||
@@ -5,13 +5,12 @@ import com.fangjia.script.util.DbUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import org.apache.commons.lang.StringUtils
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.Connection
|
||||
import java.sql.ResultSet
|
||||
import java.sql.Statement
|
||||
|
||||
|
||||
//def data = []
|
||||
//data << ["城市", "区域", "小区名", "近一月", "近三月", "近6月", "近一年", "户数"]
|
||||
//DbUtils.seaweed.find(DbUtils.buildSeaweedQuery("上海")).each {BasicDBObject district->
|
||||
@@ -36,7 +35,7 @@ import java.sql.Statement
|
||||
//ExcelUtils.write("D:\\上海成交统计.xlsx", data, "成交数据")
|
||||
|
||||
def find_rent_house_prices(String city, String region, String name){
|
||||
JdbcDataSource dataSource = new JdbcDataSource()
|
||||
EsDataSource dataSource = new EsDataSource()
|
||||
String address = "jdbc:es://http://192.168.0.206:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
dataSource.setUrl(address)
|
||||
Properties connectionProperties = new Properties()
|
||||
@@ -80,7 +79,7 @@ def find_rent_house_prices(String city, String region, String name){
|
||||
}
|
||||
|
||||
ExcelUtils.multiThreadingModify("D:\\上海成交统计.xlsx", {List item->
|
||||
JdbcDataSource dataSource = new JdbcDataSource()
|
||||
EsDataSource dataSource = new EsDataSource()
|
||||
String address = "jdbc:es://http://192.168.0.45:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
dataSource.setUrl(address)
|
||||
Properties connectionProperties = new Properties()
|
||||
|
||||
+2
-3
@@ -1,13 +1,12 @@
|
||||
package com.fangjia.script.wenyan.temp
|
||||
|
||||
|
||||
import com.fangjia.script.util.*
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import com.mongodb.DBObject
|
||||
import net.sf.json.JSONObject
|
||||
import org.apache.commons.lang.StringUtils
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.Connection
|
||||
import java.sql.ResultSet
|
||||
@@ -16,7 +15,7 @@ import java.sql.Statement
|
||||
DBCollection DIST_COLL = MongoUtils.getCollectionByName("fangjia_stat", "district_grade", "192.168.0.43")
|
||||
|
||||
def String hasElevator(BasicDBObject seaweed){
|
||||
JdbcDataSource dataSource = new JdbcDataSource()
|
||||
EsDataSource dataSource = new EsDataSource()
|
||||
String address = "jdbc:es://http://192.168.0.206:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
dataSource.setUrl(address)
|
||||
Properties connectionProperties = new Properties()
|
||||
|
||||
+12
-34
@@ -1,40 +1,18 @@
|
||||
package com.fangjia.script.wenyan.temp
|
||||
|
||||
import com.fangjia.script.util.ElasticUtils
|
||||
import org.elasticsearch.index.query.QueryBuilders
|
||||
|
||||
import com.fangjia.core.util.DateUtil
|
||||
import com.fangjia.script.util.CommonUtils
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
//ElasticUtils.executeSqlQuery("select * from seawater where p_date > 20210407 limit 10",{ Map row->
|
||||
// println(row.name)
|
||||
//}, "192.168.0.216")
|
||||
|
||||
ExcelUtils.read("D:\\Users\\wenyan\\Desktop\\新增小区.xlsx", 0, 0).each {List item->
|
||||
|
||||
def keys = new BasicDBObject()
|
||||
keys.city = 1
|
||||
keys.region = 1
|
||||
keys.name = 1
|
||||
keys.estate_type2 = 1
|
||||
def query = DbUtils.buildSeaweedQuery(item["A"], item["B"], item["C"])
|
||||
query.put('c_date', new BasicDBObject('$gt', DateUtil.add(DateUtil.truncateDay(new Date()), -1)))
|
||||
DbUtils.seaweed.find(query, keys).each {BasicDBObject dbo->
|
||||
if(!DbUtils.findDistrictStat(dbo, new Date())){
|
||||
CommonUtils.recalculationAverage(dbo.city, dbo.region, dbo.name, dbo.estate_type2)
|
||||
println(dbo)
|
||||
}
|
||||
// CommonUtils.recalculationAverage(dbo.city, dbo.region, dbo.name, dbo.estate_type2)
|
||||
// println(dbo)
|
||||
}
|
||||
}
|
||||
//["佛山","济南","北京","广州","深圳"].each {def city->
|
||||
// def keys = new BasicDBObject()
|
||||
// keys.city = 1
|
||||
// keys.region = 1
|
||||
// keys.name = 1
|
||||
// keys.estate_type2 = 1
|
||||
// def query = DbUtils.buildSeaweedQuery(city)
|
||||
// query.put('c_date', new BasicDBObject('$gt', DateUtil.add(DateUtil.truncateDay(new Date()), -1)))
|
||||
// DbUtils.seaweed.find(query, keys).each {BasicDBObject dbo->
|
||||
// CommonUtils.recalculationAverage(dbo.city, dbo.region, dbo.name, dbo.estate_type2)
|
||||
// println(dbo)
|
||||
// }
|
||||
//ElasticUtils.executeSimpleQuery("192.168.0.216", "seawater-2021", QueryBuilders.termQuery("district_name", "ÐÂãþÈý´å")).each {
|
||||
// println(it)
|
||||
//}
|
||||
|
||||
ElasticUtils.executeQuery("192.168.0.216", "seawater-2021", QueryBuilders.termQuery("district_name", "ÐÂãþÈý´å"),{
|
||||
println(it)
|
||||
})
|
||||
|
||||
|
||||
+3
-9
@@ -1,20 +1,14 @@
|
||||
package com.fangjia.script.yinjihaun.price
|
||||
|
||||
import com.fangjia.core.util.HttpRequest
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.util.DateUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
import com.fangjia.script.util.OpenApiClient
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import org.apache.commons.lang.StringUtils
|
||||
import org.elasticsearch.xpack.sql.jdbc.jdbcx.JdbcDataSource
|
||||
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
|
||||
|
||||
import java.sql.ResultSet
|
||||
|
||||
String address = "jdbc:es://http://seawater.es.db.fangjia.com:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"
|
||||
JdbcDataSource dataSource = new JdbcDataSource()
|
||||
EsDataSource dataSource = new EsDataSource()
|
||||
dataSource.setUrl(address)
|
||||
Properties connectionProperties = new Properties()
|
||||
connectionProperties.put("user", "developer")
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<dependency>
|
||||
<groupId>org.sothis</groupId>
|
||||
<artifactId>sothis-core</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.2.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -214,5 +214,15 @@
|
||||
<artifactId>jieba-analysis</artifactId>
|
||||
<version>1.0.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>aliyun-java-sdk-address-purification</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>aliyun-java-sdk-core</artifactId>
|
||||
<version>4.5.19</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user