瀏覽代碼

口估数据加上历史口估记录

wucl 3 月之前
父節點
當前提交
b39cd109ce

+ 2 - 0
dao/src/main/java/com/dayou/mapper/PersonalFacePriceMapper.java

@@ -19,4 +19,6 @@ public interface PersonalFacePriceMapper extends BaseMapper<PersonalFacePrice> {
     List<DayouPersonalPriceVO> queryByFuzzyCommunityName(@Param("community")String community, @Param("valueTiming")Date valueTiming);
 
     IPage<PersonalFacePrice> getPage(Page page, @Param("facePrice") PersonalFacePrice facePrice);
+
+    List<DayouPersonalPriceVO> queryFromFacePriceHis(@Param("address")String address, @Param("valueTiming") Date startDate);
 }

+ 14 - 0
dao/src/main/resources/mapper/PersonalFacePriceMapper.xml

@@ -139,4 +139,18 @@
          order by pfp.created DESC
     </select>
 
+    <select id="queryFromFacePriceHis" resultType="com.dayou.vo.DayouPersonalPriceVO">
+        SELECT
+            id AS targetId,
+            query_target AS location,
+            value_timing,
+            face_price AS price,
+            face_acreage AS acreage,
+            face_amount AS amount
+        from personal_face_price
+        where value_timing &gt;= #{valueTiming} and query_target like concat('%',#{address},'%')
+        order by created DESC
+            limit 0,10
+    </select>
+
 </mapper>

+ 1 - 1
domain/src/main/java/com/dayou/vo/DayouPersonalPriceVO.java

@@ -83,7 +83,7 @@ public class DayouPersonalPriceVO implements Comparable<DayouPersonalPriceVO> {
         if (this == o) return true;
         if (o == null || getClass() != o.getClass()) return false;
         DayouPersonalPriceVO that = (DayouPersonalPriceVO) o;
-        return Objects.equals(targetId, that.targetId) ;
+        return Objects.equals(targetId, that.targetId) ||  Objects.equals(location, that.location);
     }
 
     @Override

+ 25 - 0
service/src/main/java/com/dayou/service/impl/PersonalFacePriceServiceImpl.java

@@ -48,33 +48,47 @@ public class PersonalFacePriceServiceImpl extends ServiceImpl<PersonalFacePriceM
         Date startDate = DateUtils.facePriceLimitDate(facePriceQuery.getLimit());
         //查询策略1:全地址查询
         List<DayouPersonalPriceVO> byRoadNumberResult = new ArrayList<>();
+        List<DayouPersonalPriceVO> facePricesByRoadNumber = new ArrayList<>();
         String location = facePriceQuery.getQueryTarget();
         AddressDTO targetAddress = AddressUtil.parseAddress(location);
         String roadNumberAddress = AddressUtil.getRoadNumberAddress(location);
         if (StrUtil.isNotBlank(roadNumberAddress)) {
             byRoadNumberResult = personalFacePriceMapper.queryByFuzzyAddress(roadNumberAddress,startDate);
+            facePricesByRoadNumber = personalFacePriceMapper.queryFromFacePriceHis(roadNumberAddress,startDate);
+            facePricesByRoadNumber.stream().forEach(x->x.setMatching("全地址匹配(口估)"));
             byRoadNumberResult.stream().forEach(x->x.setMatching("全地址匹配"));
         }
 
         //查询策略2:路名路号查询
         List<DayouPersonalPriceVO> byRoadNameNumberResult = new ArrayList<>();
+        List<DayouPersonalPriceVO> facePricesByRoadNameNumber = new ArrayList<>();
         String roadAndRoadNumber = AddressUtil.getRoadAndRoadNumber(location);
         if (StrUtil.isNotBlank(roadAndRoadNumber)){
             byRoadNameNumberResult = personalFacePriceMapper.queryByFuzzyAddress(roadAndRoadNumber,startDate);
             filterByCityAndDistrict(byRoadNameNumberResult,targetAddress);
+            facePricesByRoadNameNumber = personalFacePriceMapper.queryFromFacePriceHis(roadNumberAddress,startDate);
+            facePricesByRoadNameNumber.stream().forEach(x->x.setMatching("路名路号匹配(口估)"));
             byRoadNameNumberResult.stream().forEach(x->x.setMatching("路名路号匹配"));
         }
 
         //查询策略3:尝试用小区名字查询
         List<DayouPersonalPriceVO> byCommunityNameResult = new ArrayList<>();
+        List<DayouPersonalPriceVO> facePriceByCommunity = new ArrayList<>();
         String communityNameFromAddress = AddressUtil.getCommunityNameFromAddress(location);
         if (StrUtil.isNotBlank(communityNameFromAddress)){
             byCommunityNameResult = personalFacePriceMapper.queryByFuzzyAddress(communityNameFromAddress,startDate);
+            facePriceByCommunity = personalFacePriceMapper.queryFromFacePriceHis(roadNumberAddress,startDate);
             filterByCityAndDistrict(byCommunityNameResult,targetAddress);
             byCommunityNameResult.stream().forEach(x->x.setMatching("楼盘名匹配"));
+            facePriceByCommunity.stream().forEach(x->x.setMatching("楼盘名匹配(口估)"));
         }
 
 
+        //合并历史口估结果集
+        facePricesByRoadNumber.addAll(facePricesByRoadNameNumber);
+        facePricesByRoadNumber.addAll(facePriceByCommunity);
+        facePricesByRoadNumber = facePricesByRoadNumber.stream().distinct().collect(Collectors.toList());
+
 
         //合并查询结果集
         byRoadNumberResult.addAll(byRoadNameNumberResult);
@@ -83,6 +97,9 @@ public class PersonalFacePriceServiceImpl extends ServiceImpl<PersonalFacePriceM
         //去重
         byRoadNumberResult = byRoadNumberResult.stream().distinct().collect(Collectors.toList());
 
+        //合并评估和口估
+        byRoadNumberResult.addAll(facePricesByRoadNumber);
+
         //排序
         Collections.sort(byRoadNumberResult);
         return byRoadNumberResult;
@@ -127,6 +144,14 @@ public class PersonalFacePriceServiceImpl extends ServiceImpl<PersonalFacePriceM
         Date startDate = DateUtils.facePriceLimitDate(facePriceQuery.getLimit());
         String community = facePriceQuery.getQueryTarget();
         List<DayouPersonalPriceVO> result = personalFacePriceMapper.queryByFuzzyCommunityName(community,startDate);
+        List<DayouPersonalPriceVO> facePrices = personalFacePriceMapper.queryFromFacePriceHis(community, startDate);
+        facePrices.forEach(x->{
+            x.setMatching("楼盘名(口估)");
+            x.setCommunityName(x.getLocation());
+            x.setLocation(null);
+        });
+        result.addAll(facePrices);
+        Collections.sort(result);
         return result;
     }