From 13a146e4c6962a6402fbe98db81fe4e46a0b68a2 Mon Sep 17 00:00:00 2001 From: Jian Shen Date: Mon, 23 May 2022 10:30:42 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=80=E6=88=BF?= =?UTF-8?q?=E4=B8=80=E4=BB=B7=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../open/controllers/PropertyController.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) 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 96a414024..eec63ef82 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 @@ -178,6 +178,7 @@ public class PropertyController { private SeawaterService seawaterService; private SqmetreRentService sqmetreRentService; private CommunityPoiServiceImpl communityPoiService; + private EvaluateFactorService evaluateFactorService; private FileDao fileDao = FileDao.getInstance(); private static final int DEFAULT_PAGE_SIZE = 20; @@ -1170,6 +1171,22 @@ public class PropertyController { mav.setModel(BasicModel.buildOKModel().setMsg("暂时不支持该小区的估价").markNoData()); return mav; } + // 调整面积不同面积价格 + DistrictStatBo districtStatBo = districtStatService.findDistrictStat(new DistrictKey(district)); + int orgAvgPrice = 0; + if (districtStatBo != null) { + if (StringUtils.isNotBlank(district.getEstateType2()) && district.getEstateType2().contains("别墅") && districtStatBo.getVillaDistrictStat() != null) { + orgAvgPrice = districtStatBo.getVillaDistrictStat().getAvgPrice(); + } else if (districtStatBo.getDistrictStat() != null) { + orgAvgPrice = districtStatBo.getDistrictStat().getAvgPrice(); + } + } + if (evaluation != null && evaluation.getAvgPrice() != null && evaluation.getAvgPrice() > 0) { + int factorPrice = evaluation.getAvgPrice(); + int avgPrice = evaluateFactorService.recompose(district.getCity(), district.getRegion(), evaluation.getArea(), factorPrice, orgAvgPrice); + evaluation.setAvgPrice(avgPrice); + evaluation.setTotalPrice((int) (avgPrice * evaluation.getArea())); + } Map districtPriceMap = new LinkedHashMap(); districtPriceMap.put("city", district.getCity()); districtPriceMap.put("district", district.getRegion()); @@ -5631,4 +5648,8 @@ public class PropertyController { public void setCommunityPoiService(CommunityPoiServiceImpl communityPoiService) { this.communityPoiService = communityPoiService; } + + public void setEvaluateFactorService(EvaluateFactorService evaluateFactorService) { + this.evaluateFactorService = evaluateFactorService; + } } From 70338124281a42f14e4502e85de8b48351bc912a Mon Sep 17 00:00:00 2001 From: Jian Shen Date: Mon, 23 May 2022 13:20:19 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=80=E6=88=BF?= =?UTF-8?q?=E4=B8=80=E4=BB=B7=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../open/controllers/PropertyController.java | 115 ++++++++++++------ 1 file changed, 75 insertions(+), 40 deletions(-) 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 eec63ef82..69c1eb263 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 @@ -397,7 +397,7 @@ public class PropertyController { /** * 利用百度API把GPS转换成Google经纬度 - * + * * @param lng * @param lat * @return @@ -419,7 +419,7 @@ public class PropertyController { /** * 利用算法模板把GPS转换成Google经纬度 - * + * * @param lng * @param lat * @return @@ -611,7 +611,7 @@ public class PropertyController { /** * 判断小区是否有经纬度 - * + * * @param district * @return */ @@ -622,7 +622,7 @@ public class PropertyController { /** * 调用匹配接口匹配小区 - * + * * @param city * @param address * @param region @@ -1000,6 +1000,32 @@ public class PropertyController { } } + // 调整面积不同面积价格 + try { + DistrictStatBo districtStatBo = districtStatService.findDistrictStat(new DistrictKey(district)); + int orgAvgPrice = 0; + if (districtStatBo != null) { + if (StringUtils.isNotBlank(district.getEstateType2()) && district.getEstateType2().contains("别墅") && districtStatBo.getVillaDistrictStat() != null) { + orgAvgPrice = districtStatBo.getVillaDistrictStat().getAvgPrice(); + } else if (districtStatBo.getDistrictStat() != null) { + orgAvgPrice = districtStatBo.getDistrictStat().getAvgPrice(); + } + } + if (evaluation != null && evaluation.getAvgPrice() != null && evaluation.getAvgPrice() > 0) { + int factorPrice = evaluation.getAvgPrice(); + int avgPrice = evaluateFactorService.recompose(district.getCity(), district.getRegion(), evaluation.getArea(), factorPrice, orgAvgPrice); + Integer minPrice = (int)(evaluation.getAvgPrice() * 0.95); + Integer maxPrice = (int)(evaluation.getAvgPrice() * 1.05); + // 偏离度超过5%不进行调整 + if (minPrice <= avgPrice && avgPrice <= maxPrice) { + evaluation.setAvgPrice(avgPrice); + evaluation.setBigTotalPrice((long) (avgPrice * evaluation.getArea())); + } + } + } catch (Exception ex) { + + } + if (evaluation.getTotalPrice() != null && evaluation.getTotalPrice() != 0 && (cityPriceCredit == null || evaluation.getCredit() >= cityPriceCredit)) { Map districtPriceMap = new HashMap(); @@ -1172,20 +1198,29 @@ public class PropertyController { return mav; } // 调整面积不同面积价格 - DistrictStatBo districtStatBo = districtStatService.findDistrictStat(new DistrictKey(district)); - int orgAvgPrice = 0; - if (districtStatBo != null) { - if (StringUtils.isNotBlank(district.getEstateType2()) && district.getEstateType2().contains("别墅") && districtStatBo.getVillaDistrictStat() != null) { - orgAvgPrice = districtStatBo.getVillaDistrictStat().getAvgPrice(); - } else if (districtStatBo.getDistrictStat() != null) { - orgAvgPrice = districtStatBo.getDistrictStat().getAvgPrice(); + try { + DistrictStatBo districtStatBo = districtStatService.findDistrictStat(new DistrictKey(district)); + int orgAvgPrice = 0; + if (districtStatBo != null) { + if (StringUtils.isNotBlank(district.getEstateType2()) && district.getEstateType2().contains("别墅") && districtStatBo.getVillaDistrictStat() != null) { + orgAvgPrice = districtStatBo.getVillaDistrictStat().getAvgPrice(); + } else if (districtStatBo.getDistrictStat() != null) { + orgAvgPrice = districtStatBo.getDistrictStat().getAvgPrice(); + } } - } - if (evaluation != null && evaluation.getAvgPrice() != null && evaluation.getAvgPrice() > 0) { - int factorPrice = evaluation.getAvgPrice(); - int avgPrice = evaluateFactorService.recompose(district.getCity(), district.getRegion(), evaluation.getArea(), factorPrice, orgAvgPrice); - evaluation.setAvgPrice(avgPrice); - evaluation.setTotalPrice((int) (avgPrice * evaluation.getArea())); + if (evaluation != null && evaluation.getAvgPrice() != null && evaluation.getAvgPrice() > 0) { + int factorPrice = evaluation.getAvgPrice(); + int avgPrice = evaluateFactorService.recompose(district.getCity(), district.getRegion(), evaluation.getArea(), factorPrice, orgAvgPrice); + Integer minPrice = (int)(evaluation.getAvgPrice() * 0.95); + Integer maxPrice = (int)(evaluation.getAvgPrice() * 1.05); + // 偏离度超过5%不进行调整 + if (minPrice <= avgPrice && avgPrice <= maxPrice) { + evaluation.setAvgPrice(avgPrice); + evaluation.setBigTotalPrice((long) (avgPrice * evaluation.getArea())); + } + } + } catch (Exception ex) { + } Map districtPriceMap = new LinkedHashMap(); districtPriceMap.put("city", district.getCity()); @@ -1512,7 +1547,7 @@ public class PropertyController { return mav; } } - + /** * 四川锦程 定制接口 多建筑年代 * @param model @@ -1624,7 +1659,7 @@ public class PropertyController { districtPriceMap.put("buildYear", matcher3.group()); } } - + // 根据城市等 级设置D级可信度 ApiUserAuthority apiUserAuthority = apiUserAuthorityService @@ -2137,7 +2172,7 @@ public class PropertyController { /** * 小区租金查询接口 - * + * * @param model * @return */ @@ -2616,7 +2651,7 @@ public class PropertyController { /** * 批量获取小区的均价,均价走势数据 - * + * * @param request * @return */ @@ -2758,7 +2793,7 @@ public class PropertyController { /** * 批量获取小区的配套数据,最多12个小区 - * + * * @param request * @return */ @@ -2903,7 +2938,7 @@ public class PropertyController { /** * 获取JSON参数中的num参数值 - * + * * @param jo * @return */ @@ -2928,7 +2963,7 @@ public class PropertyController { /** * 获取JSON参数中的radius值 - * + * * @param jo * @return */ @@ -3736,7 +3771,7 @@ public class PropertyController { /** * 解析出关键字中的小区名 - * + * * @param keyword * @return */ @@ -3853,7 +3888,7 @@ public class PropertyController { /** * 小区统计分析接口 - * + * * @param model * @return */ @@ -3938,7 +3973,7 @@ public class PropertyController { /** * 小区交通接口 - * + * * @param model * @return */ @@ -3996,7 +4031,7 @@ public class PropertyController { /** * 小区周边接口 - * + * * @param model * @return */ @@ -4055,7 +4090,7 @@ public class PropertyController { /** * 相同小区相似户型房源挂牌量接口
* 获取该小区的满足指定相似条件的挂牌房源量 条件说明: 1.输入面积-5<=房源面积<=输入面积+5 2.上个月发布的房源 - * + * * @author yinjihuan * @date 2016年9月1日 * @param city @@ -4095,7 +4130,7 @@ public class PropertyController { /** * 周边小区相似户型挂牌量接口
* 获取该小区的满足指定相似条件的挂牌房源量 条件说明: 1.输入面积-5<=房源面积<=输入面积+5 2.上个月发布的房源 - * + * * @author yinjihuan * @date 2016年9月1日 * @param city @@ -4146,7 +4181,7 @@ public class PropertyController { /** * 小区周边一公里均价 - * + * * @author wenyan * @param model * @return @@ -4169,7 +4204,7 @@ public class PropertyController { /** * 相同小区相似户型租金范围查询接口 - * + * * @param model * @return */ @@ -4212,7 +4247,7 @@ public class PropertyController { /** * 周边小区相似户型租金范围查询接口 - * + * * @param model * @return */ @@ -4275,7 +4310,7 @@ public class PropertyController { /** * 室号查询接口 - * + * * @param model * @return */ @@ -4311,7 +4346,7 @@ public class PropertyController { /** * 楼栋楼层信息查询接口 - * + * * @param model * @return */ @@ -4336,7 +4371,7 @@ public class PropertyController { /** * 楼栋查询接口 - * + * * @param model * @return */ @@ -4381,7 +4416,7 @@ public class PropertyController { /** * 楼栋查询接口 - * + * * @param model * @return */ @@ -4834,7 +4869,7 @@ public class PropertyController { /** * 房产交易记录查询 - * + * * @param model * @return */ @@ -4894,7 +4929,7 @@ public class PropertyController { /** * 房产拍卖记录 - * + * * @param model * @return */ @@ -4955,7 +4990,7 @@ public class PropertyController { /** * 房产近期评估次数 - * + * * @param model * @return */ From 1648838af9abb97fb78a8402e7f8fd202e895c16 Mon Sep 17 00:00:00 2001 From: Jian Shen Date: Mon, 23 May 2022 13:30:18 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=BD=AE=E4=BF=A1?= =?UTF-8?q?=E5=BA=A6=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mongo/open/dao/CommunityBasePriceDao.java | 9 +++ .../dao/impl/CommunityBasePriceDaoImpl.java | 10 +++ .../mongo/open/model/CommunityBasePrice.java | 74 +++++++++++++++++++ .../open/controllers/PropertyController.java | 21 ++++-- .../open/CommunityBasePriceService.java | 9 +++ .../impl/CommunityBasePriceServiceImpl.java | 22 ++++++ 6 files changed, 139 insertions(+), 6 deletions(-) create mode 100644 projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/open/dao/CommunityBasePriceDao.java create mode 100644 projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/open/dao/impl/CommunityBasePriceDaoImpl.java create mode 100644 projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/open/model/CommunityBasePrice.java create mode 100644 projects/fangjia-service/src/main/java/com/fangjia/service/open/CommunityBasePriceService.java create mode 100644 projects/fangjia-service/src/main/java/com/fangjia/service/open/impl/CommunityBasePriceServiceImpl.java diff --git a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/open/dao/CommunityBasePriceDao.java b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/open/dao/CommunityBasePriceDao.java new file mode 100644 index 000000000..8275f68f8 --- /dev/null +++ b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/open/dao/CommunityBasePriceDao.java @@ -0,0 +1,9 @@ +package com.fangjia.dal.mongo.open.dao; + +import com.fangjia.dal.MongoDao; +import com.fangjia.dal.mongo.open.model.CommunityBasePrice; +import com.fangjia.dal.mongo.open.model.CommunityPoi; + +public interface CommunityBasePriceDao extends MongoDao { + +} diff --git a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/open/dao/impl/CommunityBasePriceDaoImpl.java b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/open/dao/impl/CommunityBasePriceDaoImpl.java new file mode 100644 index 000000000..c89477b09 --- /dev/null +++ b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/open/dao/impl/CommunityBasePriceDaoImpl.java @@ -0,0 +1,10 @@ +package com.fangjia.dal.mongo.open.dao.impl; + +import com.fangjia.dal.MongoDaoImpl; +import com.fangjia.dal.mongo.open.dao.CommunityBasePriceDao; +import com.fangjia.dal.mongo.open.dao.CommunityPoiDao; +import com.fangjia.dal.mongo.open.model.CommunityBasePrice; +import com.fangjia.dal.mongo.open.model.CommunityPoi; + +public class CommunityBasePriceDaoImpl extends MongoDaoImpl implements CommunityBasePriceDao { +} diff --git a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/open/model/CommunityBasePrice.java b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/open/model/CommunityBasePrice.java new file mode 100644 index 000000000..9321bd542 --- /dev/null +++ b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/open/model/CommunityBasePrice.java @@ -0,0 +1,74 @@ +package com.fangjia.dal.mongo.open.model; + +import com.fangjia.dal.MongoEntity; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * 小区建行置信度信息 + * + * @author shenjian@fangjia.com + */ +@Entity +@Table(name = "business.community_base_price_gj") +public class CommunityBasePrice implements MongoEntity { + + private static final long serialVersionUID = -8010010773207622878L; + + private String id; + private String city; + private String region; + private String name; + private Double credit; + + @Id + @Column(name = "_id") + @Override + public String getId() { + return id; + } + + @Override + public void setId(String id) { + this.id = id; + } + + @Column(name = "city") + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + @Column(name = "region") + public String getRegion() { + return region; + } + + public void setRegion(String region) { + this.region = region; + } + + @Column(name = "name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Column(name = "credit") + public Double getCredit() { + return credit; + } + + public void setCredit(Double credit) { + this.credit = credit; + } +} 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 69c1eb263..0a7df7866 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 @@ -31,6 +31,7 @@ import javax.validation.Valid; import com.fangjia.core.util.*; import com.fangjia.dal.*; import com.fangjia.dal.mongo.model.*; +import com.fangjia.dal.mongo.open.model.CommunityBasePrice; import com.fangjia.dal.mongo.open.model.CommunityPoi; import com.fangjia.dal.seawater.dao.SeawaterDao; import com.fangjia.dal.seawater.model.Seawater; @@ -177,7 +178,8 @@ public class PropertyController { private SeawaterDao seawaterDao; private SeawaterService seawaterService; private SqmetreRentService sqmetreRentService; - private CommunityPoiServiceImpl communityPoiService; + private CommunityPoiService communityPoiService; + private CommunityBasePriceService communityBasePriceService; private EvaluateFactorService evaluateFactorService; private FileDao fileDao = FileDao.getInstance(); @@ -1235,6 +1237,13 @@ public class PropertyController { // } districtPriceMap.put("totalPrice", evaluation.getBigTotalPrice()); districtPriceMap.put("unitPrice", evaluation.getAvgPrice()); + // 新增置信度 + CommunityBasePrice communityBasePrice = communityBasePriceService.getById(district.getId()); + if (communityBasePrice != null) { + districtPriceMap.put("credit", communityBasePrice.getCredit()); + } else { + districtPriceMap.put("credit", evaluation.getCredit()); + } List names = new ArrayList(); names.add(district.getName()); if(district.getAlias() != null){ @@ -5676,15 +5685,15 @@ public class PropertyController { this.rentDealPriceService = rentDealPriceService; } - public CommunityPoiServiceImpl getCommunityPoiService() { - return communityPoiService; - } - - public void setCommunityPoiService(CommunityPoiServiceImpl communityPoiService) { + public void setCommunityPoiService(CommunityPoiService communityPoiService) { this.communityPoiService = communityPoiService; } public void setEvaluateFactorService(EvaluateFactorService evaluateFactorService) { this.evaluateFactorService = evaluateFactorService; } + + public void setCommunityBasePriceService(CommunityBasePriceService communityBasePriceService) { + this.communityBasePriceService = communityBasePriceService; + } } diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/open/CommunityBasePriceService.java b/projects/fangjia-service/src/main/java/com/fangjia/service/open/CommunityBasePriceService.java new file mode 100644 index 000000000..bc8c159de --- /dev/null +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/open/CommunityBasePriceService.java @@ -0,0 +1,9 @@ +package com.fangjia.service.open; + +import com.fangjia.dal.mongo.open.model.CommunityBasePrice; +import com.fangjia.dal.mongo.open.model.CommunityPoi; + +public interface CommunityBasePriceService { + + CommunityBasePrice getById(String id); +} diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/open/impl/CommunityBasePriceServiceImpl.java b/projects/fangjia-service/src/main/java/com/fangjia/service/open/impl/CommunityBasePriceServiceImpl.java new file mode 100644 index 000000000..049e5ae16 --- /dev/null +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/open/impl/CommunityBasePriceServiceImpl.java @@ -0,0 +1,22 @@ +package com.fangjia.service.open.impl; + +import com.fangjia.dal.mongo.open.dao.CommunityBasePriceDao; +import com.fangjia.dal.mongo.open.dao.CommunityPoiDao; +import com.fangjia.dal.mongo.open.model.CommunityBasePrice; +import com.fangjia.dal.mongo.open.model.CommunityPoi; +import com.fangjia.service.open.CommunityBasePriceService; +import com.fangjia.service.open.CommunityPoiService; + +public class CommunityBasePriceServiceImpl implements CommunityBasePriceService { + + private CommunityBasePriceDao communityBasePriceDao; + + @Override + public CommunityBasePrice getById(String id) { + return communityBasePriceDao.findById(id); + } + + public void setCommunityBasePriceDao(CommunityBasePriceDao communityBasePriceDao) { + this.communityBasePriceDao = communityBasePriceDao; + } +}