新增报告结果

This commit is contained in:
沈健
2021-04-07 10:33:52 +08:00
parent 7acd9402fa
commit cde3566aae
8 changed files with 642 additions and 46 deletions
@@ -28,6 +28,7 @@ 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;
@@ -59,16 +60,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;
@@ -5051,8 +5042,13 @@ public class PropertyController {
districtPriceMap.put("name", district.getName());
districtPriceMap.put("address", district.getAddress());
districtPriceMap.put("totalPrice", evaluation.getTotalPrice());
districtPriceMap.put("cal_date", model.getCalDate());
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);
@@ -9,10 +9,9 @@ import com.fangjia.dal.SrQuery;
import com.fangjia.dal.seaweed.model.District;
import com.fangjia.open.compatible.model.JsonModel;
import com.fangjia.open.controllers.PropertyController;
import com.fangjia.open.dto.CcbRentDto;
import com.fangjia.open.interceptors.Authority;
import com.fangjia.open.model.BaseModel;
import com.fangjia.open.model.PropertyEvaluationModel;
import com.fangjia.open.model.weixin.EvaluationModel;
import com.fangjia.open.model.weixin.PropertyEvaluationModel;
import com.fangjia.service.api.AutoCompleteBo;
import com.fangjia.service.datastore.DistrictService;
import org.apache.commons.lang.StringUtils;
@@ -25,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -37,21 +37,46 @@ import java.util.Map;
public class CcbRentController {
private DistrictService districtService;
private PropertyController propertyController;
public Object indexAction(BaseModel result) {
return result;
}
public Object reportAction(BaseModel result) {
JsonModel model = new JsonModel();
public Object reportAction(EvaluationModel result, @Param(name = "address") String address, @Param(name = "totalPrice") String totalPrice) {
result.setLender(address);
result.setDealPrice(Double.valueOf(totalPrice));
return result;
}
public Object evaluateRentAction(CcbRentDto ccbRentDto, HttpServletRequest request) throws IllegalAccessException {
PropertyEvaluationModel evaluationModel = new PropertyEvaluationModel();
BeanUtils.copyProperties(ccbRentDto, evaluationModel);
return propertyController.evaluateRentAction(evaluationModel, request);
public Object detailAction(PropertyEvaluationModel result, @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) {
result.setCityName("上海");
result.setDistrict("静安");
result.setName("场中小区");
result.setAddress("");
result.setSize(50.0);
result.setFloor(7);
result.setHeight(7);
result.setRoom(1);
result.setHall(1);
result.setToilet(1);
result.setDirection("1");
/* result.setCityName(city);
result.setDistrict(district);
result.setName(name);
result.setAddress(address);
result.setSize(size);
result.setFloor(floor);
result.setHeight(height);
result.setRoom(room);
result.setHall(hall);
result.setToilet(toilet);
result.setDirection(direction);
result.setFitment(fitment);*/
return result;
}
/**
@@ -118,9 +143,4 @@ public class CcbRentController {
public void setDistrictService(DistrictService districtService) {
this.districtService = districtService;
}
@Autowired
public void setPropertyController(PropertyController propertyController) {
this.propertyController = propertyController;
}
}
@@ -39,7 +39,6 @@ public class EvaluationModel extends BaseModel{
private Integer role;
private String cardId;
public void setId(String id) {
this.id = id;
@@ -0,0 +1,169 @@
package com.fangjia.open.model.weixin;
import com.fangjia.open.model.BaseModel;
/**
* 建行租房估值
*
* @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;
@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;
}
}
@@ -0,0 +1,420 @@
<#ftl attributes={"content_type":"text/html; charset=UTF-8"}>
<#compress>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/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">
<style type="text/css">
body {
overflow: hidden;
overflow-y: scroll;
}
.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>
<tr class="">
<td class="td01">上海</td>
<td class="td02">浦东区</td>
<td>永泰花苑</td>
<td>***</td>
<td>82</td>
<td>2</td>
<td>0</td>
<td>普通装修</td>
<td>2020-07-29</td>
</tr>
<tr class="bg">
<td class="td01">上海</td>
<td class="td02">浦东区</td>
<td>永泰花苑</td>
<td>***</td>
<td>82</td>
<td>2</td>
<td>0</td>
<td>普通装修</td>
<td>2020-07-29</td>
</tr>
</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" style="text-align:center">暂无数据</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" style="text-align:center">暂无数据</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 type="text/javascript">
$("#download").bind("click", function(){
});
function init() {
let params = {
'city': '${cityName}',
'district': '${district}',
'name': '${name}',
'address': '${address}',
'size': '${size}',
'floor': '${floor}',
'height': '${height}',
'room': '${room}',
'hall': '${hall}',
'toilet': '${toilet}',
'direction': <#if direction??>${direction}<#else>''</#if>,
'fitment': <#if fitment??>${fitment}<#else>''</#if>
};
$.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.error("返回历史租金房间数有误,不存在" + params.room + "居室数据")
} 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 referenceHouses = result.houses;
if (referenceHouses && referenceHouses.length > 0) {
$('#referenceHouses').empty();
referenceHouses.forEach(function(d){
var fitment = d.fitment != undefined ? d.fitment : '-';
$('#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>' + d.pDate + '</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 () {
}
})
};
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>
@@ -43,6 +43,7 @@
<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>
<div class="item-media"><span>(必填项)</span></div>
</div>
@@ -163,17 +164,14 @@
return
}
$.ajax({
// 注意需要加..
url: '../property/evaluateRent',
data:$("#evaluateForm").serialize(),
dataType:"json",
type:"post",
success:function(data){
debugger
if(data.success){
if(data.msg){
$.toast(data.msg);
}
location.href = "report?address=" + data.address + "&totalPrice=" + data.totalPrice
if(data.code == 200){
window.location.href = "report?address=" + data.result.address + "&totalPrice=" + data.result.totalPrice
}else{
$.toast(data.msg);
}
@@ -18,21 +18,18 @@
<body>
<div class="page-group">
您评估的地址:永泰路630弄66号
租金:6500元/月
</div>
<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">
<input type="text" disabled id="districtSearch" name="name" value="${lender}">
</div>
</div>
</div>
@@ -42,7 +39,7 @@
<div class="item-inner">
<div class="item-title label">租金:</div>
<div class="item-input">
<input name="mount" disabled name="evaluation.mount" value="">
<input type="text" name="mount" disabled name="evaluation.mount" value="${dealPrice}元/月">
</div>
</div>
</div>
@@ -58,11 +55,7 @@
<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">
init()
init = function() {
$alert('报告')
}
</script>
</body>
</html>
@@ -31,7 +31,7 @@ $(function () {
$("#searchSpan ul").empty().append(content)
return
}
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 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
@@ -50,7 +50,8 @@ $(function () {
if ($("#t").val() == "b") {
location.href = "districtDetail?id=" + id+"&city="+city
} else if ($("#t").val() == "c") {
$('#districtSearch').val(addr)
$('#districtSearch').val(name)
$('input[name="address"]').val(addr)
$('input[name="district"]').val(region)
$("#searchSpan ul").empty()
} else {