Ver código fonte

Merge branch 'dev' of http://git.ycjcjy.com/zhiyuxing/estateagents into dev

张延森 5 anos atrás
pai
commit
2d8c740e4c

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

958
         if (null != taBuilding) {
958
         if (null != taBuilding) {
959
             customerFrom.setBuildingId(buildingId);
959
             customerFrom.setBuildingId(buildingId);
960
             customerFrom.setBuildingName(taBuilding.getBuildingName());
960
             customerFrom.setBuildingName(taBuilding.getBuildingName());
961
-            customerFrom.setIsProjectFirst(true);
961
+            QueryWrapper<TaCustomerFrom> queryWrapper = new QueryWrapper<TaCustomerFrom>();
962
+            queryWrapper.eq("person_id", person.getPersonId());
963
+            queryWrapper.eq("org_id", orgId);
964
+            queryWrapper.eq("building_id", buildingId);
965
+            if (taCustomerFromMapper.selectList(queryWrapper).size() < 1){
966
+                customerFrom.setIsProjectFirst(true);
967
+            }
962
 
968
 
963
             for (TaRecommendCustomer cust : customers) {
969
             for (TaRecommendCustomer cust : customers) {
964
                 if (buildingId.equals(cust.getBuildingId())) {
970
                 if (buildingId.equals(cust.getBuildingId())) {

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

431
                 customerFrom.setOrgId(taRecommendCustomer.getOrgId());
431
                 customerFrom.setOrgId(taRecommendCustomer.getOrgId());
432
 //              customerFrom.setSceneId(sceneId);
432
 //              customerFrom.setSceneId(sceneId);
433
                 customerFrom.setIsOrgFirst(orgFirst);
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
                 customerFrom.setCreateDate(LocalDateTime.now());
441
                 customerFrom.setCreateDate(LocalDateTime.now());
436
                 customerFrom.setBuildingId(taRecommendCustomer.getBuildingId());
442
                 customerFrom.setBuildingId(taRecommendCustomer.getBuildingId());
437
                 customerFrom.setBuildingName(taBuilding.getBuildingName());
443
                 customerFrom.setBuildingName(taBuilding.getBuildingName());

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

503
         t.create_date AS create_date,
503
         t.create_date AS create_date,
504
         t.person_id
504
         t.person_id
505
         FROM
505
         FROM
506
-        ta_share_person_from t
506
+        ta_customer_from t
507
         WHERE
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
         AND t.org_id = #{orgId}
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
         <if test="buildingId != null and buildingId != ''">
511
         <if test="buildingId != null and buildingId != ''">
513
             and t.building_id = #{buildingId}
512
             and t.building_id = #{buildingId}
514
         </if>
513
         </if>
744
         t.create_date AS create_date,
743
         t.create_date AS create_date,
745
         t.person_id
744
         t.person_id
746
         FROM
745
         FROM
747
-        ta_share_person_from t
746
+        ta_customer_from t
748
         WHERE
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
         <if test="buildingId != null and buildingId != ''">
749
         <if test="buildingId != null and buildingId != ''">
751
             and t.building_id = #{buildingId}
750
             and t.building_id = #{buildingId}
752
         </if>
751
         </if>
753
-        and t.status = 1
754
-        and t.is_first_time = 1
752
+        and t.is_org_first = 1
755
         <if test="targetType != null and targetType != ''">
753
         <if test="targetType != null and targetType != ''">
756
             and t.target_type = #{targetType}
754
             and t.target_type = #{targetType}
757
         </if>
755
         </if>
979
         t.create_date AS create_date,
977
         t.create_date AS create_date,
980
         t.person_id
978
         t.person_id
981
         FROM
979
         FROM
982
-        ta_share_person_from t
980
+        ta_customer_from t
983
         WHERE
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
         <if test="buildingId != null and buildingId != ''">
983
         <if test="buildingId != null and buildingId != ''">
986
             and t.building_id = #{buildingId}
984
             and t.building_id = #{buildingId}
987
         </if>
985
         </if>
988
-        and t.status = 1
989
-        and t.is_first_time = 1
986
+        and t.is_org_first = 1
990
         <if test="targetType != null and targetType != ''">
987
         <if test="targetType != null and targetType != ''">
991
             and t.target_type = #{targetType}
988
             and t.target_type = #{targetType}
992
         </if>
989
         </if>
1193
 
1190
 
1194
         left join (
1191
         left join (
1195
         select count(*) as addRegistNum ,addRegistNum.target_id, addRegistNum.target_type From (
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
         <if test="targetType != null and targetType != '' and targetType != 'h5'">
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
         </if>
1198
         </if>
1203
         <if test="startDate != null ">
1199
         <if test="startDate != null ">
1204
             and a.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
1200
             and a.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
1211
         </if>
1207
         </if>
1212
         group by a.person_id, a.target_type ,a.target_id
1208
         group by a.person_id, a.target_type ,a.target_id
1213
         ) as addRegistNum group by addRegistNum.target_type, addRegistNum.target_id
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
         <if test="targetType != null and targetType != ''">
1211
         <if test="targetType != null and targetType != ''">
1216
             where activity.activityType = #{targetType}
1212
             where activity.activityType = #{targetType}
1217
         </if>
1213
         </if>
1407
 
1403
 
1408
         left join (
1404
         left join (
1409
         select count(*) as addRegistNum ,addRegistNum.target_id, addRegistNum.target_type From (
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
         <if test="targetType != null and targetType != '' and targetType != 'h5'">
1409
         <if test="targetType != null and targetType != '' and targetType != 'h5'">
1415
             and a.target_type = concat(REPLACE(#{targetType}, 'activity', 'dynamic'), '_share')
1410
             and a.target_type = concat(REPLACE(#{targetType}, 'activity', 'dynamic'), '_share')
1416
         </if>
1411
         </if>
1425
         </if>
1420
         </if>
1426
         group by a.person_id, a.target_type ,a.target_id
1421
         group by a.person_id, a.target_type ,a.target_id
1427
         ) as addRegistNum group by addRegistNum.target_type, addRegistNum.target_id
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
         <if test="targetType != null and targetType != ''">
1424
         <if test="targetType != null and targetType != ''">
1430
             where activity.activityType = #{targetType}
1425
             where activity.activityType = #{targetType}
1431
         </if>
1426
         </if>
1973
         if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
1968
         if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
1974
         a.province,
1969
         a.province,
1975
         b1.scene_alias as personFrom,
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
         left join ta_person a on t.person_id = a.person_id
1976
         left join ta_person a on t.person_id = a.person_id
1982
         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
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
         left join td_wx_dict b1 on b.scene_id = b1.scene_id
1978
         left join td_wx_dict b1 on b.scene_id = b1.scene_id
1984
         left join ta_recommend_customer c on c.person_id = t.person_id
1979
         left join ta_recommend_customer c on c.person_id = t.person_id
1985
         LEFT JOIN ta_user d ON c.realty_consultant = d.user_id
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
         and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' ) and t.create_date &lt;= DATE_FORMAT(#{endDate},
1985
         and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' ) and t.create_date &lt;= DATE_FORMAT(#{endDate},
1992
         '%Y-%m-%d' )
1986
         '%Y-%m-%d' )
1993
         <if test="activityId != null and activityId != ''">
1987
         <if test="activityId != null and activityId != ''">
1994
             and t.target_id = #{activityId}
1988
             and t.target_id = #{activityId}
1995
         </if>
1989
         </if>
1996
         <if test="activityType != null and activityType != ''">
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
         </if>
1992
         </if>
1999
         <if test="province != null and province != ''">
1993
         <if test="province != null and province != ''">
2000
             and a.province like concat('%', #{province}, '%')
1994
             and a.province like concat('%', #{province}, '%')
2017
         b1.scene_alias as personFrom,
2011
         b1.scene_alias as personFrom,
2018
         GROUP_CONCAT(d.user_name) as realtyConsultant,
2012
         GROUP_CONCAT(d.user_name) as realtyConsultant,
2019
         group_concat(d.phone) as realtyConsultantPhone,
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
         left join ta_person a on t.person_id = a.person_id
2017
         left join ta_person a on t.person_id = a.person_id
2024
         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
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
         left join td_wx_dict b1 on b.scene_id = b1.scene_id
2019
         left join td_wx_dict b1 on b.scene_id = b1.scene_id
2026
         left join ta_recommend_customer c on c.person_id = t.person_id
2020
         left join ta_recommend_customer c on c.person_id = t.person_id
2027
         LEFT JOIN ta_user d ON c.realty_consultant = d.user_id
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
         and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' ) and t.create_date &lt;= DATE_FORMAT(#{endDate},
2026
         and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' ) and t.create_date &lt;= DATE_FORMAT(#{endDate},
2034
         '%Y-%m-%d' )
2027
         '%Y-%m-%d' )
2035
         <if test="activityId != null and activityId != ''">
2028
         <if test="activityId != null and activityId != ''">
2036
             and t.target_id = #{activityId}
2029
             and t.target_id = #{activityId}
2037
         </if>
2030
         </if>
2038
         <if test="activityType != null and activityType != ''">
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
         </if>
2033
         </if>
2041
         <if test="province != null and province != ''">
2034
         <if test="province != null and province != ''">
2042
             and a.province like concat('%', #{province}, '%')
2035
             and a.province like concat('%', #{province}, '%')