新增下载逻辑

This commit is contained in:
沈健
2021-04-09 15:35:43 +08:00
parent 182d34f1f9
commit 6d1e03c34a
6 changed files with 649 additions and 515 deletions
@@ -1,18 +1,33 @@
package com.fangjia.open.controllers.weixin;
import com.fangjia.core.util.DataUtil;
import com.fangjia.core.util.GeocodeUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.nacos.client.identify.Base64;
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.BasicModel;
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 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.SeawaterService;
import com.fangjia.service.util.DistrictScoreUtil;
import com.lowagie.text.pdf.BaseFont;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.BooleanClause;
@@ -24,15 +39,13 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.xhtmlrenderer.pdf.ITextFontResolver;
import org.xhtmlrenderer.pdf.ITextRenderer;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.text.ParseException;
import java.util.*;
/**
* 建设银行租金控制类
@@ -43,6 +56,11 @@ import java.util.Map;
public class CcbRentController {
private DistrictService districtService;
private SeawaterService seawaterService;
private DistrictRoomSqmetreRentService districtRoomSqmetreRentService;
private EvaluationService evaluationService;
private HouseService houseService;
private RentDealPriceService rentDealPriceService;
public Object indexAction(BaseModel result) {
return result;
@@ -50,7 +68,9 @@ public class CcbRentController {
public Object reportAction(EvaluationModel result, @Param(name = "address") String address, @Param(name = "totalPrice") String totalPrice) {
result.setLender(address);
result.setDealPrice(Double.valueOf(totalPrice));
if (StringUtils.isNotBlank(totalPrice)) {
result.setDealPrice(Double.valueOf(totalPrice));
}
return result;
}
@@ -58,8 +78,317 @@ public class CcbRentController {
return result;
}
public void downloadAction(HttpServletResponse response, HttpServletRequest request) throws IOException {
response.setHeader("Content-disposition", "attachment; filename=temp.pdf");
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;
}
}
}
districtPriceMap.put("houses", houses);
//周边相似小区租金
if(model.getHouseType()!=null){
room = model.getHouseType();
}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);
//成交的租房房源
List<RentDealPrice> rentTrades = rentDealPriceService.getRentDealPrices(district.getCity(), district.getRegion(), district.getName(), 5);
districtPriceMap.put("trades", rentTrades);
result.setResult(districtPriceMap);
}
// result.setResult(new HashMap<String, Object>());
return result;
}
/**
* 通过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;
@@ -67,14 +396,14 @@ public class CcbRentController {
os = response.getOutputStream();
ITextRenderer renderer = new ITextRenderer(35, 20);
ITextFontResolver fontResolver = renderer.getFontResolver();
String url = "http://localhost:8080/open/ccbRent/detail";
renderer.setDocument(url);
String fontUrl = ActionContext.getContext().getServletContext().getRealPath("/") + "fonts" + File.separator + "simsun.ttc";
fontResolver.addFont(fontUrl, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
String url = "http://localhost:8080/open/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();
System.out.println();
os.flush();
os.close();
} catch (Exception e) {
@@ -146,8 +475,63 @@ public class CcbRentController {
return ret;
}
@Autowired
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;
}
}
@@ -2,6 +2,8 @@ package com.fangjia.open.model.weixin;
import com.fangjia.open.model.BaseModel;
import java.util.Map;
/**
* 建行租房估值
*
@@ -69,6 +71,8 @@ public class PropertyEvaluationModel extends BaseModel {
*/
private String fitment;
private Map<String, Object> result;
@Override
public String getCityName() {
return cityName;
@@ -166,4 +170,12 @@ public class PropertyEvaluationModel extends BaseModel {
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;
}
}
@@ -219,7 +219,8 @@
// jspdf.setFont('SourceHanSans-Light');
//console.log(jspdf.getFontList());
$("#download").bind('click', function(){
window.location.href = "download"
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");
@@ -238,22 +239,23 @@
// });
});
// 后台传参过来用
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() {
// 后台传参过来用
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
};
$.ajax({
// 注意需要加..
url: '../property/rentReport',
@@ -1,475 +0,0 @@
<#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">
估值报告<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 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"
// 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"
// }]
// }]
// });
});
function init() {
// 后台传参过来用
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
};
$.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>
@@ -0,0 +1,214 @@
<#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 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>
<#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.tradeDate??>${bo.tradeDate}</#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.pDate??>${bo.pDate}</#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">
<tr class="">
<td>暂无数据</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</body>
</html>
</#compress>
@@ -3,21 +3,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<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">
<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">