|
@@ -183,7 +183,7 @@ public class PersonalFacePriceServiceImpl extends ServiceImpl<PersonalFacePriceM
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public BigDecimal querySysFacePrice(PersonalFacePriceQueryDTO facePriceQuery) {
|
|
|
+ public BigDecimal querySysFacePriceByLocation(PersonalFacePriceQueryDTO facePriceQuery) {
|
|
|
//定义面积区间跨度
|
|
|
BigDecimal diff = new BigDecimal(10);
|
|
|
BigDecimal acreage = facePriceQuery.getAcreage();
|
|
@@ -236,6 +236,110 @@ public class PersonalFacePriceServiceImpl extends ServiceImpl<PersonalFacePriceM
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public BigDecimal querySysFacePriceByCommunity(PersonalFacePriceQueryDTO facePriceQuery) {
|
|
|
+ //定义面积区间跨度
|
|
|
+ BigDecimal diff = new BigDecimal(10);
|
|
|
+ BigDecimal acreage = facePriceQuery.getAcreage();
|
|
|
+ if (acreage != null){
|
|
|
+ facePriceQuery.setAcreageMax(acreage.add(diff));
|
|
|
+ facePriceQuery.setAcreageMin(acreage.subtract(diff));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //获取数据源集合
|
|
|
+ List<DayouPersonalPriceVO> dyPrices = this.personalPriceByCommunity(facePriceQuery);
|
|
|
+ ExternalFacePriceVO externalFacePriceVO = this.externalPersonalPriceByCommunity(facePriceQuery);
|
|
|
+
|
|
|
+ //提升查询结果率
|
|
|
+ if (CollectionUtil.isEmpty(dyPrices)){
|
|
|
+ facePriceQuery.setAcreageMin(null);
|
|
|
+ facePriceQuery.setAcreageMax(null);
|
|
|
+ dyPrices = this.personalPriceByCommunity(facePriceQuery);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (externalFacePriceVO==null){
|
|
|
+ facePriceQuery.setAcreageMin(null);
|
|
|
+ facePriceQuery.setAcreageMax(null);
|
|
|
+ externalFacePriceVO = this.externalPersonalPriceByCommunity(facePriceQuery);
|
|
|
+ }
|
|
|
+
|
|
|
+ BigDecimal dealAvgPrice = BigDecimal.ZERO;
|
|
|
+ BigDecimal dyAvgPrice = BigDecimal.ZERO;
|
|
|
+ int i = 0;
|
|
|
+ if (externalFacePriceVO != null){
|
|
|
+ //链家成交均价
|
|
|
+ dealAvgPrice = externalFacePriceVO.getDealPrice();
|
|
|
+ if (dealAvgPrice.compareTo(BigDecimal.ZERO) > 0){
|
|
|
+ i+=1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (CollectionUtil.isNotEmpty(dyPrices)){
|
|
|
+ //大友评估均价
|
|
|
+ double reduce = dyPrices.stream().filter(x->x.getPrice()!=null).map(DayouPersonalPriceVO::getPrice).mapToDouble(BigDecimal::doubleValue).reduce(0, Double::sum);
|
|
|
+ dyAvgPrice = BigDecimal.valueOf(reduce).divide(BigDecimal.valueOf(dyPrices.size()==0?1:dyPrices.size()), 0, RoundingMode.HALF_UP);
|
|
|
+ if (dyAvgPrice.compareTo(BigDecimal.ZERO) > 0){
|
|
|
+ i+=1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //综合均价
|
|
|
+ return i==0?BigDecimal.ZERO:dealAvgPrice.add(dyAvgPrice).divide(new BigDecimal(i), RoundingMode.HALF_UP);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public BigDecimal querySysFacePrice(PersonalFacePriceQueryDTO facePriceQuery) {
|
|
|
+ //定义面积区间跨度
|
|
|
+ BigDecimal diff = new BigDecimal(10);
|
|
|
+ BigDecimal acreage = facePriceQuery.getAcreage();
|
|
|
+ if (acreage != null){
|
|
|
+ facePriceQuery.setAcreageMax(acreage.add(diff));
|
|
|
+ facePriceQuery.setAcreageMin(acreage.subtract(diff));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //获取数据源集合(先用地址查询)
|
|
|
+ List<DayouPersonalPriceVO> dyPrices = this.personalPriceByLocation(facePriceQuery);
|
|
|
+ ExternalFacePriceVO externalFacePriceVO = this.externalPriceByLocation(facePriceQuery);
|
|
|
+
|
|
|
+ //为空再用楼盘名称查
|
|
|
+ if (CollectionUtil.isEmpty(dyPrices)){
|
|
|
+ dyPrices = this.personalPriceByCommunity(facePriceQuery);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (externalFacePriceVO==null){
|
|
|
+ externalFacePriceVO = this.externalPersonalPriceByCommunity(facePriceQuery);
|
|
|
+ }
|
|
|
+
|
|
|
+ BigDecimal dealAvgPrice = BigDecimal.ZERO;
|
|
|
+ BigDecimal dyAvgPrice = BigDecimal.ZERO;
|
|
|
+ int i = 0;
|
|
|
+ if (externalFacePriceVO != null){
|
|
|
+ //链家成交均价
|
|
|
+ dealAvgPrice = externalFacePriceVO.getDealPrice();
|
|
|
+ if (dealAvgPrice.compareTo(BigDecimal.ZERO) > 0){
|
|
|
+ i+=1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (CollectionUtil.isNotEmpty(dyPrices)){
|
|
|
+ //大友评估均价
|
|
|
+ double reduce = dyPrices.stream().filter(x->x.getPrice()!=null).map(DayouPersonalPriceVO::getPrice).mapToDouble(BigDecimal::doubleValue).reduce(0, Double::sum);
|
|
|
+ dyAvgPrice = BigDecimal.valueOf(reduce).divide(BigDecimal.valueOf(dyPrices.size()==0?1:dyPrices.size()), 0, RoundingMode.HALF_UP);
|
|
|
+ if (dyAvgPrice.compareTo(BigDecimal.ZERO) > 0){
|
|
|
+ i+=1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //综合均价
|
|
|
+ return i==0?BigDecimal.ZERO:dealAvgPrice.add(dyAvgPrice).divide(new BigDecimal(i), RoundingMode.HALF_UP);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public String uploadPersonalFacePriceTemp(MultipartFile file,String limit) {
|
|
|
try {
|
|
|
List<PersonalFacePriceBatchDTO> batchQuery = ExcelUtil.importExcel(PersonalFacePriceBatchDTO.class,file.getInputStream(),1);
|