Sfoglia il codice sorgente

Merge branch 'master' of http://47.108.172.52:3000/dayou/item-management-1phase

GouGengquan 3 mesi fa
parent
commit
d269065cf0

+ 2 - 2
common/src/main/java/com/dayou/utils/AddressUtil.java

@@ -16,7 +16,7 @@ public class AddressUtil {
     private static final Pattern DISTRICT_PATTERN = Pattern.compile("(?<district>.+区|.+县|.+旗)");
     private static final Pattern TOWN_PATTERN = Pattern.compile("(?<town>.+街道|.+镇|.+乡)");
     private static final Pattern COMMUNITY_PATTERN = Pattern.compile("(?<community>.+社区|.+园区|.+村)");
-    private static final Pattern ROAD_PATTERN = Pattern.compile("(?<road>.+路.+?段|.+路|.+巷|.+?街.+?段|.+?街|.+?道.+?段)");
+    private static final Pattern ROAD_PATTERN = Pattern.compile("(?<road>.+路.+?段|.+路|.+巷|.+?街.+?段|.+?街|.+?道.+?段|.+?道)");
     private static final Pattern ROAD_NUMBER_PATTERN = Pattern.compile("(?<roadNumber>\\d+号附\\d+号|\\d+号)");
     private static final Pattern BUILDING_PATTERN = Pattern.compile("(?<building>\\d+楼|\\d+栋|\\d+幢)");
     private static final Pattern UNIT_PATTERN = Pattern.compile("(?<unit>\\d+单元)");
@@ -158,7 +158,7 @@ public class AddressUtil {
 
 
     public static void main(String[] args) {
-        String location = "公平街办涌泉锦泉街98号锦里光华10栋2单元1层1号";
+        String location = "青羊区青羊大道8号12栋3单元11层A1号";
         //String location = "成都市天府新区万安镇麓山大道二段20号附9号麓山国际3栋2单元2层3号住宅";
         System.out.println(getRoadNumberAddress(location));
         AddressDTO addressDTO = AddressUtil.parseAddress(location);

+ 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);
 }

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

@@ -98,6 +98,7 @@
         SELECT
             pfp.id,
             pfp.query_target,
+            pfp.community_name,
             pfp.query_type,
             pfp.face_price,
             pfp.face_acreage,
@@ -139,4 +140,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>

+ 5 - 0
domain/src/main/java/com/dayou/entity/PersonalFacePrice.java

@@ -14,6 +14,11 @@ public class PersonalFacePrice extends BaseEntity {
      * 口估查询标的
      */
     private String queryTarget;
+
+    /**
+     * 楼盘名称
+     */
+    private String communityName;
     /**
      * 口估查询方式
      */

+ 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;
     }