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

This commit is contained in:
2021-06-02 15:36:47 +08:00
149 changed files with 21579 additions and 5050 deletions
@@ -1705,6 +1705,25 @@ public class AddressController {
return mav;
}
public Object addressSimilarityAction(AddesssMatchModel model) {
RestfulModelAndView mav = new RestfulModelAndView();
if (StringUtils.isBlank(model.getAddress_1()) || StringUtils.isBlank(model.getAddress_2())) {
mav.setModel(BasicModel.buildBadRequestModel("两个地址均不能为空"));
return mav;
}
model.setAddress(model.getAddress_1());
String result1 = addressMatchProxyService.standard(convertModelToMap(model));
model.setAddress(model.getAddress_2());
String result2 = addressMatchProxyService.standard(convertModelToMap(model));
if (result1 != null && result2 != null) {
Map<String, Object> resultMap = addressService.addressSimilarity(result1, result2);
mav.setModel(BasicModel.buildOKModel().setResult(resultMap));
} else {
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
}
return mav;
}
public Object parseCityAction(AddressModel model) {
RestfulModelAndView mav = new RestfulModelAndView();
if (StringUtils.isBlank(model.getProvince())) {
@@ -1765,13 +1784,14 @@ 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();
@@ -1789,6 +1809,7 @@ public class AddressController {
}
}
dto.append("buildingNumber", address.getBuildingNumber());
dto.append("floor", address.getFloor());
dto.append("unitNumber", address.getUnitNumber());
dto.append("roomNumber", address.getRoomNumber());
dto.append("formattedAddress", address.getFormattedAddress());
@@ -131,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);
@@ -4966,6 +4966,7 @@ public class PropertyController {
* @throws NumberFormatException
* @throws IllegalAccessException
*/
@Authority(role = Role.NONE)
public Object rentReportAction(PropertyEvaluationModel model, HttpServletRequest request)throws NumberFormatException, IllegalAccessException {
RestfulModelAndView mav = new RestfulModelAndView();
mav.setViewType("rest");
@@ -5103,8 +5104,8 @@ public class PropertyController {
//周边相似小区租金
Integer room = null;
if(model.getHouseType()!=null){
room = model.getHouseType();
if(model.getRoom()!=0){
room = model.getRoom();
}else{
room = houseService.getDistrictRoomType((float)model.getSize());
}
@@ -5164,7 +5165,6 @@ public class PropertyController {
}
public Object evaluateRentAction(PropertyEvaluationModel model, HttpServletRequest request)throws NumberFormatException, IllegalAccessException {
RestfulModelAndView mav = new RestfulModelAndView();
mav.setViewType("rest");
@@ -5255,13 +5255,6 @@ public class PropertyController {
}
public void setHouseLoudongService(HouseLoudongService houseLoudongService) {
this.houseLoudongService = houseLoudongService;
}
@@ -1,32 +1,57 @@
package com.fangjia.open.controllers.weixin;
import com.fangjia.core.util.BeanUtils;
import com.fangjia.core.util.DataUtil;
import com.fangjia.core.util.GeocodeUtils;
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.APIConstant;
import com.fangjia.open.compatible.model.JsonModel;
import com.fangjia.open.controllers.PropertyController;
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.batik.transcoder.Transcoder;
import org.apache.batik.transcoder.TranscoderException;
import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.transcoder.TranscoderOutput;
import org.apache.batik.transcoder.image.PNGTranscoder;
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.bson.types.ObjectId;
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.springframework.beans.factory.annotation.Autowired;
import org.xhtmlrenderer.pdf.ITextFontResolver;
import org.xhtmlrenderer.pdf.ITextRenderer;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.lang.reflect.InvocationTargetException;
import java.text.ParseException;
import java.util.*;
/**
* 建设银行租金控制类
@@ -36,7 +61,15 @@ import java.util.Map;
*/
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;
@@ -44,7 +77,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;
}
@@ -52,6 +87,434 @@ public class CcbRentController {
return result;
}
public Object evaluateRentAction(com.fangjia.open.model.PropertyEvaluationModel model, HttpServletRequest request)throws NumberFormatException, IllegalAccessException {
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/property/evaluateRent?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();
}
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, @Param(name = "chartImgUrl") String chartImgUrl) {
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);
String tradesImgUrl = chartImgUrl;
//成交的租房房源
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 Object saveHighChartAsImageAction(HttpServletRequest request, HttpServletResponse response) {
String svg = request.getParameter("svg");
ByteArrayOutputStream out = null;
String url = null;
try {
svg = svg.replaceAll(":rect", "rect");
Transcoder t = new PNGTranscoder();
out = new ByteArrayOutputStream();
TranscoderInput input = new TranscoderInput(new StringReader(svg));
TranscoderOutput output = new TranscoderOutput(out);
t.transcode(input, output);
byte[] data = out.toByteArray();
String id = new ObjectId().toString();
fileService.save(id,"o", data, "image/png", "o");
url = "http://img0.fangjia.com/stc/fs/" + DataUtil.encodePicUrl(id, "o", "house");
} catch (TranscoderException e) {
e.printStackTrace();
} finally {
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
JsonModel model = new JsonModel();
AutoCompleteBo bo = new AutoCompleteBo();
bo.setAddress(url);
model.setJsonModel(bo);
return model;
}
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, @Param(name = "chartImgUrl") String chartImgUrl) 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, 24);
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+"&chartImgUrl="+chartImgUrl;
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
*/
@@ -112,8 +575,67 @@ 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;
}
public void setFileService(FileService fileService) {
this.fileService = fileService;
}
}
@@ -19,7 +19,24 @@ public class AddesssMatchModel extends FangjiaApiModel {
private String province;
private String debugName;
private boolean useMap;
private String address_1;
private String address_2;
public String getAddress_1() {
return address_1;
}
public void setAddress_1(String address_1) {
this.address_1 = address_1;
}
public String getAddress_2() {
return address_2;
}
public void setAddress_2(String address_2) {
this.address_2 = address_2;
}
public boolean isContainsLocation() {
return containsLocation;
}
@@ -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;
}
}
@@ -0,0 +1,174 @@
package com.fangjia.open.util;
import com.fangjia.core.util.DataUtil;
import com.fangjia.service.mongo.fangjia.FileService;
import org.apache.batik.transcoder.Transcoder;
import org.apache.batik.transcoder.TranscoderException;
import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.transcoder.TranscoderOutput;
import org.apache.batik.transcoder.image.JPEGTranscoder;
import org.apache.batik.transcoder.image.PNGTranscoder;
import org.bson.types.ObjectId;
import org.jfree.chart.ChartFactory;
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.data.category.DefaultCategoryDataset;
import java.awt.*;
import java.io.*;
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;
}
public static void svg2ImgTest() {
String svg = "<svg height=\"200\" xmlns=\"http://www.w3.org/2000/svg\"><polygon points=\"10,10 75,150 150,60\" style=\"fill:#63BCF7;stroke:black;stroke-width:3\"/></svg>";
String type="image/png";
String filename="svg";
if (null != type && null != svg) {
svg = svg.replaceAll(":rect", "rect");
String ext = "";
Transcoder t = null;
if (type.equals("image/png")) {
ext = "png";
t = new PNGTranscoder();
}
else if (type.equals("image/jpeg")) {
ext = "jpg";
t = new JPEGTranscoder();
}
if (null != t) {
OutputStream out = null;
try {
out = new FileOutputStream("D:\\"+filename+"."+ext);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
TranscoderInput input = new TranscoderInput(new StringReader(svg));
TranscoderOutput output = new TranscoderOutput(out);
try{
t.transcode(input, output);
System.out.println("out");
}
catch (TranscoderException e) {
e.printStackTrace();
}
}
}
}
/**
* 定义图表对象
* @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;
}
}
@@ -1,37 +1,45 @@
<#ftl attributes={"content_type":"text/html; charset=UTF-8"}>
<#compress>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/html">
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<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">
<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">
<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: white;
}
.main {
margin: 4px 8px 4px 8px;
background: #f8f8f8;
background: white;
}
.title {
position: relative;
color: #1E90FF;
font-size: 20px;
font-weight: bold;
}
.title1 {
font-size: 14px;
font-size: 18px;
font-weight: bold;
color: #1E90FF;
margin-top: 2px;
margin-bottom: 2px;
}
.p {
font-size: 12px;
font-size: 18px;
line-height: 30px;
}
.table {
width: 100%;
@@ -63,11 +71,9 @@
</head>
<body>
<div class="main">
<div class="title">
估值报告
<span class="download" id="download">下载</span>
估值报告<span class="download" id="download">下载</span>
</div>
<div>
<div class="title1">1 评估申明</div>
@@ -76,12 +82,12 @@
<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>
<span name="cal_date"></span><br/>
<b>评估结果</b><br/>
<b>楼盘名称</b>:<span name="name"></span><br/>
<b>楼盘地址</b>:<span name="address"></span><br/>
<b>租金估值(RMB)</b>:<span name="totalPrice"></span>元/月<br/>
<b>大写(人民币)</b>:<span name="totalPriceUpper"></span><br/>
</div>
</div>
<div>
@@ -91,20 +97,21 @@
<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>
<b>详细地址</b>:<span name="address"></span><br/>
<b>楼盘名称</b>:<span name="name"></span><br/>
<b>室号</b>:<span name="room"></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/>
<b>电梯配套</b>:<span name="hasLift"></span><br/>
<b>装修情况</b>:<span name="fitment"></span><br/>
<b>建筑年代</b>:<span name="buildYear"></span><br/>
</div>
</div>
<div>
<div class="title1">5 历史租金</div>
<div class="charts" id="districtRentTrendsChart"></div>
<input type="hidden" id="chartImgUrl"/>
</div>
<div>
<div class="title1">6 已租房源</div>
@@ -123,29 +130,8 @@
<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 id="trades">
<td colspan="6">暂无数据</td>
</tbody>
</table>
</div>
@@ -168,7 +154,7 @@
</tr>
</thead>
<tbody id="referenceHouses">
<td colspan="6" style="text-align:center">暂无数据</td>
<td colspan="6">暂无数据</td>
</tbody>
</table>
</div>
@@ -189,7 +175,7 @@
</thead>
<tbody id="sameDistricts">
<tr class="">
<td colspan="6" style="text-align:center">暂无数据</td>
<td colspan="6">暂无数据</td>
</tr>
</tbody>
</table>
@@ -199,44 +185,87 @@
<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="http://cdn.highcharts.com.cn/highcharts/9.0.1/highcharts.js"></script>
<script type="text/javascript" src="https://code.highcharts.com.cn/highcharts/modules/exporting.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">
$("#download").bind("click", function(){
// 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());
var chart;
$("#download").bind('click', function(){
var 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;
// 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() {
// 后台传参过来用
<#--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>-->
<#--};-->
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',
@@ -260,7 +289,11 @@
// data: [3800, 3900, 4000, 4100, 4200, 4200, 4200, 4200]
// }];
if (result.trends.distMap[params.room] == undefined) {
console.error("返回历史租金房间数有误,不存在" + params.room + "居室数据")
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) {
@@ -275,7 +308,6 @@
charts.xData = result.trends.times; // 横坐标值
createChartNow('districtRentTrendsChart', charts, true);
}
// 房产状况
$('span[name="room"]').text(result.room)
$('span[name="direction"]').text(result.direction)
@@ -286,22 +318,44 @@
$('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 != undefined ? d.totalPrice : '') + '</td> \
<td>' + (d.area != undefined ? d.area : '') + '</td> \
<td>' + (d.room != undefined ? 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 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>' + (d.totalPrice != undefined ? d.totalPrice : '') + '</td> \
<td>' + (d.area != undefined ? d.area : '') + '</td> \
<td>' + (d.room != undefined ? d.room : '') + '</td> \
<td>' + (d.hall != undefined ? d.hall : '')+ '</td> \
<td>' + fitment + '</td> \
<td>' + d.pDate + '</td> \
<td>' + date + '</td> \
</tr>');
})
@@ -315,9 +369,9 @@
$('#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>' + (d.districtName != undefined ? d.districtName:'' ) + '</td> \
<td>' + (d.roomPrice != undefined ? d.roomPrice:'') + '</td> \
<td>' + (d.room != undefined ? d.room:'') + '</td> \
<td>1</td> \
</tr>');
})
@@ -331,6 +385,15 @@
}
})
};
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;
@@ -373,8 +436,9 @@
var config = {yaxis : yaxis};
createHighChartNow(renderId, data, config);
};
function createHighChartNow(renderId, data, config) {
var chart = new Highcharts.Chart({
chart = new Highcharts.Chart({
credits:{
enabled:true,
text: '',
@@ -393,6 +457,9 @@
renderTo: renderId,
type: 'spline'
},
exporting: {
enabled: false
},
title: {
text: data.title,
floating: false,
@@ -421,12 +488,31 @@
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 Highcharts.dateFormat('%Y-%m-%d', this.x) +'<br/>'+ this.series.name+ ": <span style='color:#F50;font-weight: bold;'>"+ this.y +'</span>元/平米';
}
}
}
});
saveHighChartImg();
};
function saveHighChartImg() {
var svg = chart.getSVG();
$.ajax({
// 注意需要加..
url: "saveHighChartAsImage",
data: {
svg:svg
},
dataType: "json",
type: "post",
success: function (ret) {
if (ret.address != null) {
$('#chartImgUrl').val(ret.address)
}
}
})
}
$(function () {
init();
});
@@ -0,0 +1,206 @@
<#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"/>
<link rel="stylesheet" href="../static/style/report.css"/>
<style type="text/css">
</style>
</head>
<body>
<div class="content">
<div class="t1">
<em>1</em>估价结果
</div>
<div class="st1"><em>1.1</em>评估申明:</div>
<div class="text1">建设银行遵循中立、客观、公正的原则,通过周密细致的测算,评估求得分析对象的房<br/>地产市场参考。</div>
<div class="st1"><em>1.2</em>评估时间:</div>
<div class="text1"><#if result.cal_date??>${result.cal_date}</#if></div>
<div class="st1"><em>1.3</em>评估结果:</div>
<div class="text2">
<b>楼盘名称</b>:<#if result.name??>${result.name}</#if><br/><br/>
<b>楼盘地址</b>:<#if result.address??>${result.address}</#if><br/><br/>
<b>租金估值(RMB)</b>:<#if result.totalPrice??>${result.totalPrice}</#if>元/月<br/><br/>
<b>大写(人民币)</b>:<#if result.totalPriceUpper??>${result.totalPriceUpper}</#if><br/><br/>
</div>
<div class="st1"><em>1.4</em>报告有效期:</div>
<div class="text1" style="margin-bottom: 30px">本报告在市场无较大波动的情况下,该评估价格在报告出具起三个月内有效。</div>
<div class="t1"><em>2</em>房产状况</div>
<div class="c1">
<table class="distTab" width="700" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<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>
</tr>
<tr class="tdbg">
<td class="textTd">室号</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>
<tr>
<td class="textTd" style="width: 15%;">建筑面积</td>
<td class="textRight1" style="width: 35%;"><#if result.size??>${result.size}</#if>平米</td>
<td class="textTd" style="width: 15%;">所在楼层</td>
<td class="textRight2" colspan="3" style="width: 35%;"><#if result.floor??>${result.floor}</#if> 层 <#if result.height??>${result.height}</#if>总层数</td>
</tr>
<tr class="tdbg">
<td class="textTd">电梯配套</td>
<td class="textRight1"><#if result.hasLift??>${result.hasLift}</#if></td>
<td class="textTd">装修情况</td>
<td class="textRight2" colspan="3"><#if result.fitment??>${result.fitment}</#if></td>
</tr>
<tr class="tdbg">
<td class="textTd">建筑年代</td>
<td class="textRight1"><#if result.buildYear??>${result.buildYear}</#if></td>
</tr>
</tbody>
</table>
</div>
<div class="t1">
<em>3</em>历史租金
</div>
<div>
<#if result.tradesImgUrl??>
<#-- <img width="800px" height="300px" src="../static/images/test.png"></img>-->
<img width="600px" 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 class="t1">
<em>4</em>已租房源
</div>
<div style="margin-bottom: 30px;">
<table class="distTab" width="780" border="0" cellspacing="0" cellpadding="0">
<thead>
<tr class="tdbg">
<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="tdbg">
<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 class="t1">
<em>5</em>样本参考
</div>
<div style="margin-bottom: 30px;">
<table class="distTab" width="780" border="0" cellspacing="0" cellpadding="0">
<thead>
<tr class="tdbg">
<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="tdbg">
<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 class="t1">
<em>6</em>周边同类小区租金
</div>
<div style="margin-bottom: 30px;">
<table class="distTab" width="500" border="0" cellspacing="0" cellpadding="0">
<thead>
<tr class="tdbg">
<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="tdbg">
<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}<#else>1</#if></td>
</tr>
</#list>
<#else>
<tr><td>暂无数据</td></tr>
</#if>
</tbody>
</table>
</div>
</div>
</body>
</html>
</#compress>
@@ -30,8 +30,6 @@
<div class="item-content">
<div class="item-inner">
<input id="cityName" value="上海" name="city" type="hidden">
<!-- 区域 -->
<input value="" name="district" type="hidden">
<input value="2000" name="radius" type="hidden">
<div class="item-title label">城市:<font>上海</font></div>
</div>
@@ -45,6 +43,8 @@
<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>
@@ -68,9 +68,9 @@
<div class="item-inner">
<div class="content-block">
<div class="item-title label di">户型:</div>
<input name="room" type="hidden" id="room">
<input name="hall" type="hidden" id="hall">
<input name="toilet" type="hidden" id="toilet">
<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>室&nbsp;&nbsp;&nbsp;&nbsp;<a
href="#" class="create-actions02-now">0</a>厅&nbsp;&nbsp;&nbsp;&nbsp;<a
@@ -147,6 +147,7 @@
<div class="content-block">
<p><a id="evaluateBtn" class="button button-big button-fill">查看租金结果</a></p>
</div>
</div>
</form>
</div>
</div>
@@ -212,15 +213,54 @@
}
$("#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',
url: '../ccbRent/evaluateRent',
data:$("#evaluateForm").serialize(),
dataType:"json",
type:"post",
@@ -228,11 +268,13 @@
if(data.code == 200){
window.location.href = "report?address=" + data.result.address + "&totalPrice=" + data.result.totalPrice
}else{
$.toast(data.msg);
$.toast("估价失败,请重新评估");
$("#evaluateBtn").prop("disabled", false)
}
},
error: function () {
//$.toast("服务器异常,请重新评估");
$("#evaluateBtn").prop("disabled", false)
}
})
})
@@ -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">
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

@@ -0,0 +1,141 @@
body {
overflow: hidden;
overflow-y: scroll;
background: white;
/** 特别注意,否则中文不生效 **/
font-family: SimSun;
}
.content {
width: 840px;
height: 100%;
margin: 0 auto;
background: #fff;
padding-left: 20px;
}
.content .t1 {
background: url(../images/fjt/bg.png) 0 0 no-repeat;
width: 820px;
height: 42px;
color: #704f1c;
font-size: 20px;
font-weight: bold;
text-indent: 14px;
line-height: 46px;
margin-bottom: 25px;
}
.content .t1 em {
font-family: "Arial";
color: #FFF;
margin-right: 20px;
}
em {
font-style: normal;
}
.content .st1 {
background: url(../images/fjt/bg.png) 0 -60px no-repeat;
width: 172px;
height: 40px;
color: #704f1c;
font-size: 18px;
font-weight: bold;
text-indent: 7px;
line-height: 46px;
margin-bottom: 10px;
}
.content .st1 em {
font-family: "Arial";
color: #FFF;
margin-right: 14px;
}
.content .text1 {
font-size: 18px;
line-height: 26px;
margin: 0 20px 10px 50px;
word-wrap: break-word;
}
.text1 td {
text-align: center
}
.content .text2 {
font-size: 18px;
line-height: 40px;
padding: 10px 20px 10px 50px;
background: #eee;
width: 750px;
margin-bottom: 30px;
}
.content .text3 {
font-size: 16px;
line-height: 40px;
padding: 10px 20px 10px 50px;
background: #eee;
width: 750px;
margin-bottom: 30px;
}
.content .c1 {
height: 200px;
}
.content .distTab {
font-size: 18px
}
.content .distTab .textTd {
font-weight: bold;
}
.content .distTab tr td {
height: 30px;
}
.content .distTab tr th {
text-align: left;
}
.content .distTab .textRight1 {
text-align: right;
padding-right: 80px;
}
.content .distTab .textRight2 {
text-align: right;
padding-right: 5px;
}
.title {
position: relative;
color: #1E90FF;
}
.title1 {
font-size: 19px;
color: #1E90FF;
margin-top: 3px;
margin-bottom: 3px;
}
.p {
font-size: 16px;
}
table {
border-collapse: separate;
text-indent: initial;
border-spacing: 2px;
}
tbody {
display: table-row-group;
vertical-align: middle;
border-color: inherit;
}
.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;
}