傅行帆 hace 5 años
padre
commit
93a8db27d0

+ 7
- 1
src/main/java/com/huiju/estateagents/service/impl/TaPersonServiceImpl.java Ver fichero

@@ -948,7 +948,13 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
948 948
         if (null != taBuilding) {
949 949
             customerFrom.setBuildingId(buildingId);
950 950
             customerFrom.setBuildingName(taBuilding.getBuildingName());
951
-            customerFrom.setIsProjectFirst(true);
951
+            QueryWrapper<TaCustomerFrom> queryWrapper = new QueryWrapper<TaCustomerFrom>();
952
+            queryWrapper.eq("person_id", person.getPersonId());
953
+            queryWrapper.eq("org_id", orgId);
954
+            queryWrapper.eq("building_id", buildingId);
955
+            if (taCustomerFromMapper.selectList(queryWrapper).size() < 1){
956
+                customerFrom.setIsProjectFirst(true);
957
+            }
952 958
 
953 959
             for (TaRecommendCustomer cust : customers) {
954 960
                 if (buildingId.equals(cust.getBuildingId())) {

+ 7
- 1
src/main/java/com/huiju/estateagents/service/impl/TaRecommendCustomerServiceImpl.java Ver fichero

@@ -431,7 +431,13 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
431 431
                 customerFrom.setOrgId(taRecommendCustomer.getOrgId());
432 432
 //              customerFrom.setSceneId(sceneId);
433 433
                 customerFrom.setIsOrgFirst(orgFirst);
434
-                customerFrom.setIsProjectFirst(true);
434
+                QueryWrapper<TaCustomerFrom> queryWrapper = new QueryWrapper<TaCustomerFrom>();
435
+                queryWrapper.eq("person_id", taRecommendCustomer.getPersonId());
436
+                queryWrapper.eq("org_id", taRecommendCustomer.getOrgId());
437
+                queryWrapper.eq("building_id", taRecommendCustomer.getBuildingId());
438
+                if (taCustomerFromMapper.selectList(queryWrapper).size() < 1){
439
+                    customerFrom.setIsProjectFirst(true);
440
+                }
435 441
                 customerFrom.setCreateDate(LocalDateTime.now());
436 442
                 customerFrom.setBuildingId(taRecommendCustomer.getBuildingId());
437 443
                 customerFrom.setBuildingName(taBuilding.getBuildingName());

+ 36
- 43
src/main/resources/mapper/statistic/TaActivityStaticMapper.xml Ver fichero

@@ -503,12 +503,11 @@
503 503
         t.create_date AS create_date,
504 504
         t.person_id
505 505
         FROM
506
-        ta_share_person_from t
506
+        ta_customer_from t
507 507
         WHERE
508
-        t.target_type IN ( 'dynamic_share', 'h5_share', 'help_share', 'live_share', 'group_share' )
508
+        t.target_type IN ( 'dynamic', 'h5', 'help', 'live', 'group', 'activity' )
509 509
         AND t.org_id = #{orgId}
510
-        AND t.STATUS = 1
511
-        and t.is_first_time = 1
510
+        and t.is_org_first = 1
512 511
         <if test="buildingId != null and buildingId != ''">
513 512
             and t.building_id = #{buildingId}
514 513
         </if>
@@ -744,14 +743,13 @@
744 743
         t.create_date AS create_date,
745 744
         t.person_id
746 745
         FROM
747
-        ta_share_person_from t
746
+        ta_customer_from t
748 747
         WHERE
749
-        t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share') and t.org_id = #{orgId}
748
+        t.target_type in ('dynamic','h5','help','live', 'group', 'activity') and t.org_id = #{orgId}
750 749
         <if test="buildingId != null and buildingId != ''">
751 750
             and t.building_id = #{buildingId}
752 751
         </if>
753
-        and t.status = 1
754
-        and t.is_first_time = 1
752
+        and t.is_org_first = 1
755 753
         <if test="targetType != null and targetType != ''">
756 754
             and t.target_type = #{targetType}
757 755
         </if>
@@ -979,14 +977,13 @@
979 977
         t.create_date AS create_date,
980 978
         t.person_id
981 979
         FROM
982
-        ta_share_person_from t
980
+        ta_customer_from t
983 981
         WHERE
984
-        t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share') and t.org_id = #{orgId}
982
+        t.target_type in ('dynamic','h5','help','live', 'group', 'activity') and t.org_id = #{orgId}
985 983
         <if test="buildingId != null and buildingId != ''">
986 984
             and t.building_id = #{buildingId}
987 985
         </if>
988
-        and t.status = 1
989
-        and t.is_first_time = 1
986
+        and t.is_org_first = 1
990 987
         <if test="targetType != null and targetType != ''">
991 988
             and t.target_type = #{targetType}
992 989
         </if>
@@ -1193,12 +1190,11 @@
1193 1190
 
1194 1191
         left join (
1195 1192
         select count(*) as addRegistNum ,addRegistNum.target_id, addRegistNum.target_type From (
1196
-        select count(*), a.* From ta_share_person_from a where a.target_type IN ( 'dynamic_share', 'h5_share',
1197
-        'help_share', 'live_share', 'group_share' ) and a.org_id = #{orgId}
1198
-        and a.status = 1
1199
-        and a.is_first_time = 1
1193
+        select count(*), a.* From ta_customer_from a where a.target_type IN ( 'dynamic', 'h5',
1194
+        'help', 'live', 'group', 'activity' ) and a.org_id = #{orgId}
1195
+        and a.is_org_first = 1
1200 1196
         <if test="targetType != null and targetType != '' and targetType != 'h5'">
1201
-            and a.target_type = concat(REPLACE(#{targetType}, 'activity', 'dynamic'), '_share')
1197
+            and a.target_type = #{targetType}
1202 1198
         </if>
1203 1199
         <if test="startDate != null ">
1204 1200
             and a.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
@@ -1211,7 +1207,7 @@
1211 1207
         </if>
1212 1208
         group by a.person_id, a.target_type ,a.target_id
1213 1209
         ) as addRegistNum group by addRegistNum.target_type, addRegistNum.target_id
1214
-        ) as addRegistNum on addRegistNum.target_id = activity.activityId and activity.activityType  = substring_index(REPLACE(addRegistNum.target_type, 'dynamic_share', 'activity_share') , '_share', 1)
1210
+        ) as addRegistNum on addRegistNum.target_id = activity.activityId and activity.activityType  = addRegistNum.target_type
1215 1211
         <if test="targetType != null and targetType != ''">
1216 1212
             where activity.activityType = #{targetType}
1217 1213
         </if>
@@ -1407,10 +1403,9 @@
1407 1403
 
1408 1404
         left join (
1409 1405
         select count(*) as addRegistNum ,addRegistNum.target_id, addRegistNum.target_type From (
1410
-        select count(*), a.* From ta_share_person_from a where a.target_type IN ( 'dynamic_share', 'h5_share',
1411
-        'help_share', 'live_share', 'group_share' ) and a.org_id = #{orgId}
1412
-        and a.status = 1
1413
-        and a.is_first_time = 1
1406
+        select count(*), a.* From ta_customer_from a where a.target_type IN ( 'dynamic', 'h5',
1407
+        'help', 'live', 'group', 'activity') and a.org_id = #{orgId}
1408
+        and a.is_org_first = 1
1414 1409
         <if test="targetType != null and targetType != '' and targetType != 'h5'">
1415 1410
             and a.target_type = concat(REPLACE(#{targetType}, 'activity', 'dynamic'), '_share')
1416 1411
         </if>
@@ -1425,7 +1420,7 @@
1425 1420
         </if>
1426 1421
         group by a.person_id, a.target_type ,a.target_id
1427 1422
         ) as addRegistNum group by addRegistNum.target_type, addRegistNum.target_id
1428
-        ) as addRegistNum on addRegistNum.target_id = activity.activityId and activity.activityType  = substring_index(REPLACE(addRegistNum.target_type, 'dynamic_share', 'activity_share') , '_share', 1)
1423
+        ) as addRegistNum on addRegistNum.target_id = activity.activityId and activity.activityType  = addRegistNum.target_type
1429 1424
         <if test="targetType != null and targetType != ''">
1430 1425
             where activity.activityType = #{targetType}
1431 1426
         </if>
@@ -1973,28 +1968,27 @@
1973 1968
         if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
1974 1969
         a.province,
1975 1970
         b1.scene_alias as personFrom,
1976
-        GROUP_CONCAT(d.user_name) as realtyConsultant,
1977
-        group_concat(d.phone) as realtyConsultantPhone,
1978
-        ifnull(e.nickname, f.name) as sharePersonName,
1979
-        ifnull(e.phone, f.phone) as sharePersonPhone
1980
-        FROM ta_share_person_from t
1971
+        d.user_name as realtyConsultant,
1972
+        d.phone as realtyConsultantPhone,
1973
+        e.nickname  AS sharePersonName,
1974
+        e.phone AS sharePersonPhone
1975
+        FROM ta_customer_from t
1981 1976
         left join ta_person a on t.person_id = a.person_id
1982 1977
         left join ta_person_from_record b on a.person_id = b.person_id and b.org_id = #{orgId} and b.is_first_time =1
1983 1978
         left join td_wx_dict b1 on b.scene_id = b1.scene_id
1984 1979
         left join ta_recommend_customer c on c.person_id = t.person_id
1985 1980
         LEFT JOIN ta_user d ON c.realty_consultant = d.user_id
1986
-        LEFT JOIN ta_person e ON t.share_person = e.person_id
1987
-        LEFT JOIN ta_person f ON t.share_person = f.user_id
1988
-        WHERE t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share') and t.org_id =
1989
-        #{orgId} and t.status = 1
1990
-        and t.is_first_time = 1
1981
+        LEFT JOIN ta_person e ON t.share_person_id = e.person_id
1982
+        WHERE t.target_type in ('dynamic','h5','help','live', 'group','activity') and t.org_id =
1983
+        #{orgId}
1984
+        and t.is_org_first = 1
1991 1985
         and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' ) and t.create_date &lt;= DATE_FORMAT(#{endDate},
1992 1986
         '%Y-%m-%d' )
1993 1987
         <if test="activityId != null and activityId != ''">
1994 1988
             and t.target_id = #{activityId}
1995 1989
         </if>
1996 1990
         <if test="activityType != null and activityType != ''">
1997
-            and t.target_type = concat(REPLACE(#{activityType}, 'activity', 'dynamic'), '_share')
1991
+            and t.target_type = #{activityType}
1998 1992
         </if>
1999 1993
         <if test="province != null and province != ''">
2000 1994
             and a.province like concat('%', #{province}, '%')
@@ -2017,26 +2011,25 @@
2017 2011
         b1.scene_alias as personFrom,
2018 2012
         GROUP_CONCAT(d.user_name) as realtyConsultant,
2019 2013
         group_concat(d.phone) as realtyConsultantPhone,
2020
-        ifnull(e.nickname, f.name) as sharePersonName,
2021
-        ifnull(e.phone, f.phone) as sharePersonPhone
2022
-        FROM ta_share_person_from t
2014
+        e.nickname  AS sharePersonName,
2015
+        e.phone AS sharePersonPhone
2016
+        FROM ta_customer_from t
2023 2017
         left join ta_person a on t.person_id = a.person_id
2024 2018
         left join ta_person_from_record b on a.person_id = b.person_id and b.org_id = #{orgId} and b.is_first_time =1
2025 2019
         left join td_wx_dict b1 on b.scene_id = b1.scene_id
2026 2020
         left join ta_recommend_customer c on c.person_id = t.person_id
2027 2021
         LEFT JOIN ta_user d ON c.realty_consultant = d.user_id
2028
-        LEFT JOIN ta_person e ON t.share_person = e.person_id
2029
-        LEFT JOIN ta_person f ON t.share_person = f.user_id
2030
-        WHERE t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share') and t.org_id =
2031
-        #{orgId} and t.status = 1
2032
-        and t.is_first_time = 1
2022
+        LEFT JOIN ta_person e ON t.share_person_id = e.person_id
2023
+        WHERE t.target_type in ('dynamic','h5','help','live', 'group','activity') and t.org_id =
2024
+        #{orgId}
2025
+        and t.is_org_first = 1
2033 2026
         and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' ) and t.create_date &lt;= DATE_FORMAT(#{endDate},
2034 2027
         '%Y-%m-%d' )
2035 2028
         <if test="activityId != null and activityId != ''">
2036 2029
             and t.target_id = #{activityId}
2037 2030
         </if>
2038 2031
         <if test="activityType != null and activityType != ''">
2039
-            and t.target_type = concat(REPLACE(#{activityType}, 'activity', 'dynamic'), '_share')
2032
+            and t.target_type = #{activityType}
2040 2033
         </if>
2041 2034
         <if test="province != null and province != ''">
2042 2035
             and a.province like concat('%', #{province}, '%')