diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java index 37b785212..f31580327 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java @@ -2447,7 +2447,8 @@ public class PropertyController { 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.setFitment(EVALUATION_MODEL_FITMENT.get(FITMENT.get(StringUtils.isNotBlank(model.getDecoration()) ? + model.getDecoration() : model.getFitment()))); evaluation.setNoise(NOISE.get(model.getNoise())); evaluation.setEstateType(PROPERTY_TYPES.get(model.getPropertyType())); evaluation.setSight(SIGHT.get(model.getView())); @@ -5047,13 +5048,14 @@ public class PropertyController { 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("totalPriceUpper", CurrencyConverter.toChinese(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()); + districtPriceMap.put("buildYear",district.getFinishBuildingDate()); Integer startPrice = (int)(evaluation.getTotalPrice() - evaluation.getTotalPrice()*0.2); Integer endPrice = (int)(evaluation.getTotalPrice() + evaluation.getTotalPrice()*0.2); @@ -5066,7 +5068,7 @@ public class PropertyController { List allDistricts = districtService.findNearestDistrict(district, model.getRadius(), fields, Integer.MAX_VALUE); //按条件过滤相似小区 Integer buildYear = null; - List districts = null; + List districts = new ArrayList(); if(StringUtils.isNotBlank(district.getFinishBuildingDate())){ buildYear = DistrictScoreUtil.parseStringToDate(district.getFinishBuildingDate()); if(buildYear!=null){ @@ -5148,6 +5150,16 @@ public class PropertyController { //近一年户型租金走势 Map trendsMap = districtRoomSqmetreRentService.getRentTrends(district.getCity(), district.getRegion(), district.getName(), room, -12); // Map trendsMap = districtStatRentService.getRentTrend(district.getCity(), district.getRegion(), district.getDistrictName(), -12); + if (MapUtils.isNotEmpty(trendsMap)) { + Map distMap = (Map) trendsMap.get("distMap"); + Map trendMap = (Map) distMap.get(String.valueOf(trendsMap.get("room"))); + if (MapUtils.isNotEmpty(trendMap)) { + for (String key : trendMap.keySet()) { + Double totalPrice = (trendMap.get(key) * evaluation.getArea()); + trendMap.put(key, totalPrice.intValue()); + } + } + } districtPriceMap.put("trends", trendsMap); diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/weixin/CcbRentController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/weixin/CcbRentController.java index 3a17ffc8b..6f3646ad6 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/weixin/CcbRentController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/weixin/CcbRentController.java @@ -32,6 +32,7 @@ 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.collections.MapUtils; import org.apache.commons.lang.StringUtils; import org.apache.lucene.index.Term; import org.apache.lucene.search.BooleanClause; @@ -50,6 +51,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.*; import java.lang.reflect.InvocationTargetException; +import java.net.URLEncoder; import java.text.ParseException; import java.util.*; @@ -109,7 +111,7 @@ public class CcbRentController { public Object downloadPageAction(PropertyEvaluationModel result, HttpServletRequest request, @Param(name = "city") String city, @Param(name = "district") String districtStr, @Param(name = "name") String name, @Param(name = "address") String address, @Param(name = "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) { + @Param(name = "hall") Integer hall, @Param(name = "toilet") Integer toilet, @Param(name = "direction") String direction, @Param(name = "fitment") String fitment, @Param(name = "hasLift") String hasLift, @Param(name = "chartImgUrl") String chartImgUrl) { com.fangjia.open.model.PropertyEvaluationModel model = new com.fangjia.open.model.PropertyEvaluationModel(); model.setCity(city); model.setDistrict(districtStr); @@ -178,13 +180,15 @@ public class CcbRentController { 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("totalPriceUpper", CurrencyConverter.toChinese(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()); + districtPriceMap.put("buildYear",district.getFinishBuildingDate()); + districtPriceMap.put("hasLift",hasLift); Integer startPrice = (int)(evaluation.getTotalPrice() - evaluation.getTotalPrice()*0.2); Integer endPrice = (int)(evaluation.getTotalPrice() + evaluation.getTotalPrice()*0.2); @@ -197,7 +201,7 @@ public class CcbRentController { List allDistricts = districtService.findNearestDistrict(district, model.getRadius(), fields, Integer.MAX_VALUE); //按条件过滤相似小区 Integer buildYear = null; - List districts = null; + List districts = new ArrayList(); if(StringUtils.isNotBlank(district.getFinishBuildingDate())){ buildYear = DistrictScoreUtil.parseStringToDate(district.getFinishBuildingDate()); if(buildYear!=null){ @@ -283,6 +287,16 @@ public class CcbRentController { //近一年户型租金走势 Map trendsMap = districtRoomSqmetreRentService.getRentTrends(district.getCity(), district.getRegion(), district.getName(), room, -12); + if (MapUtils.isNotEmpty(trendsMap)) { + Map distMap = (Map) trendsMap.get("distMap"); + Map trendMap = (Map) distMap.get(String.valueOf(trendsMap.get("room"))); + if (MapUtils.isNotEmpty(trendMap)) { + for (String key : trendMap.keySet()) { + Double totalPrice = (trendMap.get(key) * evaluation.getArea()); + trendMap.put(key, totalPrice.intValue()); + } + } + } districtPriceMap.put("trends", trendsMap); // 生成走势图图片,一遍转pdf @@ -341,7 +355,8 @@ public class CcbRentController { 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.setFitment(EVALUATION_MODEL_FITMENT.get(FITMENT.get(StringUtils.isNotBlank(model.getDecoration()) ? + model.getDecoration() : model.getFitment()))); evaluation.setAtticArea(model.getAtticSize()); evaluation.setTerraceArea(model.getOuterSize()); evaluation.setBasementArea(model.getBasementSize()); @@ -486,8 +501,8 @@ public class CcbRentController { public void downloadAction(HttpServletResponse response, HttpServletRequest request, @Param(name = "city") String city, @Param(name = "district") String district, @Param(name = "name") String name, @Param(name = "address") String address, @Param(name = "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"); + @Param(name = "hall") Integer hall, @Param(name = "toilet") Integer toilet, @Param(name = "direction") String direction, @Param(name = "fitment") String fitment, @Param(name = "hasLift") String hasLift, @Param(name = "chartImgUrl") String chartImgUrl) throws IOException { + response.setHeader("Content-disposition", "attachment; filename=" + URLEncoder.encode("租金估值报告", "UTF-8") + ".pdf"); response.setContentType("application/pdf;charset=UTF-8"); response.setCharacterEncoding("UTF-8"); OutputStream os = null; @@ -499,7 +514,7 @@ public class CcbRentController { fontResolver.addFont(fontUrl, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED); final String path = "http://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath(); String url = path + "/ccbRent/downloadPage?city=" + DataUtil.urlEncode(city) + "&district="+DataUtil.urlEncode(district)+"&name="+DataUtil.urlEncode(name); - url += "&address=" + DataUtil.urlEncode(address) +"&size="+size+"&floor="+floor+"&height="+height+"&room="+room+"&hall="+hall+"&toilet="+toilet+"&direction="+direction+"&fitment="+fitment+"&chartImgUrl="+chartImgUrl; + url += "&address=" + DataUtil.urlEncode(address) +"&size="+size+"&floor="+floor+"&height="+height+"&room="+room+"&hall="+hall+"&toilet="+toilet+"&direction="+direction+"&fitment="+fitment+"&chartImgUrl="+chartImgUrl + "&hasLift=" + DataUtil.urlEncode(hasLift); renderer.setDocument(url); renderer.layout(); renderer.createPDF(os, true); diff --git a/projects/fangjia-open/src/main/webapp/ccbRent/detail.ftl b/projects/fangjia-open/src/main/webapp/ccbRent/detail.ftl index e606e1324..29bff8e79 100644 --- a/projects/fangjia-open/src/main/webapp/ccbRent/detail.ftl +++ b/projects/fangjia-open/src/main/webapp/ccbRent/detail.ftl @@ -12,7 +12,7 @@ - +