Merge branch 'open_gj' of http://gitlab.fangjia.com/dev0/main into open_gj

This commit is contained in:
2021-08-26 13:28:32 +08:00
6 changed files with 116 additions and 63 deletions
@@ -5295,8 +5295,8 @@ public class PropertyController {
//近一年户型租金走势
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);
// 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);
if (MapUtils.isNotEmpty(trendsMap)) {
Map distMap = (Map) trendsMap.get("distMap");
Map<String, Integer> trendMap = (Map) distMap.get(String.valueOf(trendsMap.get("room")));
@@ -13,6 +13,7 @@ import com.fangjia.open.APIConstant;
import com.fangjia.open.compatible.model.JsonModel;
import com.fangjia.open.dto.DistrictHouseDtao;
import com.fangjia.open.interceptors.AuthenticationBean;
import com.fangjia.open.model.AddesssMatchModel;
import com.fangjia.open.model.BaseModel;
import com.fangjia.open.model.weixin.EvaluationModel;
import com.fangjia.open.model.weixin.PropertyEvaluationModel;
@@ -22,6 +23,7 @@ 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.DistrictStatRentService;
import com.fangjia.service.district.RentDealPriceService;
import com.fangjia.service.mongo.fangjia.FileService;
import com.fangjia.service.mongo.fangjia.SeawaterService;
@@ -67,6 +69,7 @@ public class CcbRentController {
private DistrictService districtService;
private SeawaterService seawaterService;
private DistrictStatRentService districtStatRentService;
private DistrictRoomSqmetreRentService districtRoomSqmetreRentService;
private EvaluationService evaluationService;
private HouseService houseService;
@@ -89,6 +92,27 @@ public class CcbRentController {
return result;
}
public Object matchAction(AddesssMatchModel model) {
String result = null;
HttpRequest httpRequest = new HttpRequest();
try {
Map<String, String> headers = new HashMap<String, String>();
// &__refresh_cache=1 刷新缓存
String url = "http://open.fangjia.com/address/match?token=" + APIConstant.SUPER_USER_TOKEN;
Map<String, String> params = org.apache.commons.beanutils.BeanUtils.describe(model);
result = httpRequest.post(url, params, headers,"UTF-8");
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (HttpRequestException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return result;
}
public Object evaluateRentAction(com.fangjia.open.model.PropertyEvaluationModel model, HttpServletRequest request)throws NumberFormatException, IllegalAccessException {
String result = null;
HttpRequest httpRequest = new HttpRequest();
@@ -109,7 +133,7 @@ public class CcbRentController {
}
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 = "name") String name, @Param(name = "address") String address, @Param(name = "addressDetail") String addressDetail,
@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, @Param(name = "hasLift") String hasLift, @Param(name = "chartImgUrl") String chartImgUrl) {
com.fangjia.open.model.PropertyEvaluationModel model = new com.fangjia.open.model.PropertyEvaluationModel();
@@ -189,6 +213,8 @@ public class CcbRentController {
districtPriceMap.put("fitment", evaluation.getFitment());
districtPriceMap.put("buildYear",district.getFinishBuildingDate());
districtPriceMap.put("hasLift",hasLift);
districtPriceMap.put("room", room);
districtPriceMap.put("addressDetail", addressDetail);
Integer startPrice = (int)(evaluation.getTotalPrice() - evaluation.getTotalPrice()*0.2);
Integer endPrice = (int)(evaluation.getTotalPrice() + evaluation.getTotalPrice()*0.2);
@@ -286,7 +312,8 @@ public class CcbRentController {
}
//近一年户型租金走势
Map<String, Object> trendsMap = districtRoomSqmetreRentService.getRentTrends(district.getCity(), district.getRegion(), district.getName(), room, -12);
//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);
if (MapUtils.isNotEmpty(trendsMap)) {
Map distMap = (Map) trendsMap.get("distMap");
Map<String, Integer> trendMap = (Map) distMap.get(String.valueOf(trendsMap.get("room")));
@@ -499,7 +526,7 @@ public class CcbRentController {
}
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 = "name") String name, @Param(name = "address") String address, @Param(name = "addressDetail") String addressDetail,
@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, @Param(name = "hasLift") String hasLift, @Param(name = "chartImgUrl") String chartImgUrl) throws IOException {
response.setHeader("Content-disposition", "attachment; filename=" + URLEncoder.encode("租金估值报告", "UTF-8") + ".pdf");
@@ -514,7 +541,7 @@ public class CcbRentController {
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+"&chartImgUrl="+chartImgUrl + "&hasLift=" + DataUtil.urlEncode(hasLift);
url += "&address=" + DataUtil.urlEncode(address) + "&addressDetail=" + DataUtil.urlEncode(addressDetail) +"&size="+size+"&floor="+floor+"&height="+height+"&room="+room+"&hall="+hall+"&toilet="+toilet+"&direction="+direction+"&fitment="+fitment+"&chartImgUrl="+chartImgUrl + "&hasLift=" + DataUtil.urlEncode(hasLift);
renderer.setDocument(url);
renderer.layout();
renderer.createPDF(os, true);
@@ -653,4 +680,8 @@ public class CcbRentController {
public void setFileService(FileService fileService) {
this.fileService = fileService;
}
public void setDistrictStatRentService(DistrictStatRentService districtStatRentService) {
this.districtStatRentService = districtStatRentService;
}
}
@@ -97,9 +97,9 @@
<div>
<div class="title1">4 房产状况</div>
<div class="p">
<b>详细地址</b>:<span name="address"></span><br/>
<b>详细地址</b>:<span name="addressDetail"></span><br/>
<b>楼盘名称</b>:<span name="name"></span><br/>
<b>室号</b>:<span name="room"></span><br/>
<b>室号</b>:<span name="roomNumber"></span><br/>
<b>朝向</b>:<span name="direction"></span><br/>
<b>建筑面积</b>:<span name="size"></span>平米<br/>
<b>所在楼层</b>:<span name="floor"></span> 层(共<span name="height"></span>层)<br/>
@@ -204,8 +204,8 @@
$.toast("报告下载中,请耐心等待");
$("#download").css('color', 'blue')
let chartImgUrl = $('#chartImgUrl').val();
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+"&chartImgUrl=" + chartImgUrl + "&hasLift=" + (params.hasLift == 'true' ? '有' : '无');
window.location.href = "download?city="+params.city+"&district="+params.district+"&name="+params.name+"&address="+params.address+"&addressDetail="+params.addressDetail+"&size="+params.size+"&floor="+params.floor
+"&height="+params.height+"&room="+params.roomNumber+"&hall="+params.hall+"&toilet="+params.toilet+"&direction="+params.direction+"&fitment="+params.fitment+"&chartImgUrl=" + chartImgUrl + "&hasLift=" + (params.hasLift == 'true' ? '有' : '无');
});
// 后台传参过来用
@@ -222,11 +222,23 @@
'toilet': sessionStorage.toilet,
'direction': sessionStorage.direction,
'fitment': sessionStorage.fitment,
'hasLift': sessionStorage.hasLift
'hasLift': sessionStorage.hasLift,
'roomNumber': sessionStorage.roomNumber,
'addressDetail': sessionStorage.addressDetail
};
function init() {
// let charts = {}
// charts.xData = ["2020-08", "2020-09", "2020-10", "2020-11", "2020-12", "2021-01", "2021-02", "2021-03", "2021-04", "2021-05", "2021-06", "2021-07"]
// charts.series = [{
// name: '1居室',
// data: [3800, 3900, 4000, 4100, 4200, 4200, 4200, 4200]
// }];
// createChartNow('districtRentTrendsChart', charts, true);
// return false;
$('span[name="hasLift"]').text(params.hasLift == 'true' ? '有' : '无')
$('span[name="roomNumber"]').text(params.roomNumber != '' ? params.roomNumber + '室' : '')
$.ajax({
// 注意需要加..
@@ -242,11 +254,12 @@
$('span[name="cal_date"]').text(result.cal_date)
$('span[name="name"]').text(result.name);
$('span[name="address"]').text(result.address);
$('span[name="addressDetail"]').text(params.addressDetail);
$('span[name="totalPrice"]').text(result.totalPrice)
$('span[name="totalPriceUpper"]').text(result.totalPriceUpper)
// 房产状况
$('span[name="room"]').text(result.room)
//$('span[name="room"]').text(result.room)
$('span[name="floor"]').text(result.floor)
$('span[name="buildYear"]').text(result.buildYear)
$('span[name="direction"]').text(result.direction)
@@ -273,10 +286,6 @@
let result = data.result;
//历史租金
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();
@@ -460,11 +469,7 @@
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>元/平米';
}
return this.x +'<br/>'+ this.series.name+ ": <span style='color:#F50;font-weight: bold;'>"+ this.y +'</span>元/平米';
}
}
});
@@ -50,11 +50,11 @@
<td class="textTd" style="width: 15%;">楼盘名称</td>
<td class="textRight1" style="width: 35%;"><#if result.name??>${result.name}</#if></td>
<td class="textTd" style="width: 15%;">地址</td>
<td class="textRight2" colspan="3" style="width: 35%;"><#if result.address??>${result.address}</#if></td>
<td class="textRight2" colspan="3" style="width: 35%;"><#if result.addressDetail??>${result.addressDetail}</#if></td>
</tr>
<tr class="tdbg">
<td class="textTd">室号</td>
<td class="textRight1"><#if result.room??>${result.room}</#if></td>
<td class="textRight1"><#if result.room??>${result.room + '室'}</#if></td>
<td class="textTd">朝向</td>
<td class="textRight2" colspan="3"><#if result.direction??>${result.direction}</#if></td>
</tr>
@@ -40,8 +40,9 @@
<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" />
<input type="text" placeholder="请输入小区名或地址" id="districtSearch" name="address" class="search_input" required>
<input type="hidden" name="name" />
<input type="hidden" name="roomNumber" />
</div>
<!-- 区域 -->
<input value="" name="district" type="hidden" required>
@@ -165,7 +166,9 @@
sessionStorage.name = $('input[name="name"]').val()
sessionStorage.district = $('input[name="district"]').val()
sessionStorage.address = $('input[name="address"]').val()
sessionStorage.addressDetail = $('input[name="address"]').val()
sessionStorage.size = $('input[name="size"]').val()
sessionStorage.roomNumber = $('input[name="roomNumber"]').val()
sessionStorage.room = $('input[name="room"]').val()
sessionStorage.hall = $('input[name="hall"]').val()
sessionStorage.toilet = $('input[name="toilet"]').val()
@@ -222,11 +225,11 @@
var fieldVal = $.trim(input.val())
if (input.attr("required") && fieldVal == "") {
if (input.attr("name").indexOf("district") != -1) {
$.toast("请选择输入地址时提示的小区")
} else {
$.toast(fieldName + "不能为空");
return
}
return
}
if (input.attr("type") == 'number' && fieldVal != "") {
if (input.attr("name").indexOf("size") != -1) {
@@ -253,7 +256,6 @@
$.toast("楼层不能大于楼高");
return
}
storeSession()
if($("#houseHight").val() && parseFloat($("#houseHight").val())>=60){
$.toast("请输入合理的楼层数");
@@ -262,42 +264,31 @@
$("#evaluateBtn").prop("disabled", true)
// 用户输入可能为地址,需要匹配,在估价
// let city = $('input[name="city"]').val()
// let address = $('input[name="address"]').val()
//
// $.ajax({
// // 注意需要加..
// url: '../address/match',
// data: {'city': city, 'address': address},
// dataType: "json",
// type: "post",
// success: function (data) {
// debugger
// if (data.code == 200) {
//
// }
// }
// })
let city = $('input[name="city"]').val()
let address = $('input[name="address"]').val()
$.ajax({
// 注意需要加..
url: '../ccbRent/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)
if ($('input[name="district"]').val() == '') {
$.ajax({
// 注意需要加..
url: '../ccbRent/match',
data: {'city': city, 'address': address},
dataType: "json",
type: "post",
success: function (data) {
if (data.code == 200) {
let result = data.result
$('input[name="name"]').val(result.name)
$('input[name="district"]').val(result.district)
$('input[name="roomNumber"]').val(result.searchAddress.orgRoomNumber)
evaluateRent()
} else {
$.toast("估价失败,暂不支持该小区估价");
}
}
},
error: function () {
//$.toast("服务器异常,请重新评估");
$("#evaluateBtn").prop("disabled", false)
}
})
})
} else {
evaluateRent()
}
})
// 选择操作-房型-室
$(document).on('click', '.create-actions01-now', function () {
@@ -326,6 +317,30 @@
$.actions(groups);
});
let evaluateRent = function() {
$.ajax({
// 注意需要加..
url: '../ccbRent/evaluateRent',
data:$("#evaluateForm").serialize(),
dataType:"json",
type:"post",
success:function(data){
if(data.code == 200){
let name = $('input[name="name"]').val()
let roomNumber = $('input[name="roomNumber"]').val()
window.location.href = "report?address=" + data.result.address + "&totalPrice=" + data.result.totalPrice
storeSession()
}else{
$.toast("估价失败,请重新评估");
$("#evaluateBtn").prop("disabled", false)
}
},
error: function () {
//$.toast("服务器异常,请重新评估");
$("#evaluateBtn").prop("disabled", false)
}
})
}
// 选择操作-装修情况
$(document).on('click', '.create-actions05-now', function () {
@@ -28,6 +28,8 @@ $(function () {
success: function (data) {
if(data && data.length == 0){
if ($("#t").val() == "c") {
$('input[name="name"]').val('')
$('input[name="district"]').val('')
$("#searchSpan ul").empty()
return ;
} else {
@@ -56,7 +58,7 @@ $(function () {
location.href = "districtDetail?id=" + id+"&city="+city
} else if ($("#t").val() == "c") {
$('#districtSearch').val(name)
$('input[name="address"]').val(addr)
$('input[name="name"]').val(name)
$('input[name="district"]').val(region)
$("#searchSpan ul").empty()
} else {