魏超 5 år sedan
förälder
incheckning
2d88c9954f

+ 6
- 6
src/main/java/com/huiju/estateagents/excel/ActivityStatistics/ShareNum.java Visa fil

37
     @ExcelProperty(value = "分享时间", index = 3)
37
     @ExcelProperty(value = "分享时间", index = 3)
38
     private String shareTime;
38
     private String shareTime;
39
 
39
 
40
-    /**
41
-     * 访问人数
42
-     */
43
-    @ColumnWidth(15)
44
-    @ExcelProperty(value = "访问人数", index = 4)
45
-    private Integer visitPersonNum;
40
+//    /**
41
+//     * 访问人数
42
+//     */
43
+//    @ColumnWidth(15)
44
+//    @ExcelProperty(value = "访问人数", index = 4)
45
+//    private Integer visitPersonNum;
46
 
46
 
47
     @ExcelIgnore
47
     @ExcelIgnore
48
     private String sharePersonId;
48
     private String sharePersonId;

+ 18
- 10
src/main/java/com/huiju/estateagents/excel/ActivityStatistics/VisitPersonNum.java Visa fil

56
     private String realtyConsultantPhone;
56
     private String realtyConsultantPhone;
57
 
57
 
58
     /**
58
     /**
59
-     * 分享者
59
+     * 推广人
60
      */
60
      */
61
     @ColumnWidth(15)
61
     @ColumnWidth(15)
62
-    @ExcelProperty(value = "分享者", index = 7)
62
+    @ExcelProperty(value = "推广人", index = 7)
63
     private String sharePersonName;
63
     private String sharePersonName;
64
-
65
-    /**
66
-     * 分享者电话
67
-     */
68
-    @ColumnWidth(15)
69
-    @ExcelProperty(value = "分享者电话", index = 8)
70
-    private String sharePersonPhone;
64
+//    /**
65
+//     * 分享者
66
+//     */
67
+//    @ColumnWidth(15)
68
+//    @ExcelProperty(value = "分享者", index = 7)
69
+//    private String sharePersonName;
70
+//
71
+//    /**
72
+//     * 分享者电话
73
+//     */
74
+//    @ColumnWidth(15)
75
+//    @ExcelProperty(value = "分享者电话", index = 8)
76
+//    private String sharePersonPhone;
71
 
77
 
72
     /**
78
     /**
73
      * 访问次数
79
      * 访问次数
74
      */
80
      */
75
     @ColumnWidth(15)
81
     @ColumnWidth(15)
76
-    @ExcelProperty(value = "访问次数", index = 9)
82
+    @ExcelProperty(value = "访问次数", index = 8)
77
     private String visitNum;
83
     private String visitNum;
84
+
85
+
78
 }
86
 }

+ 19
- 23
src/main/resources/mapper/statistic/TaActivityStaticMapper.xml Visa fil

1210
         </if>
1210
         </if>
1211
         group by a.person_id, a.target_type ,a.target_id
1211
         group by a.person_id, a.target_type ,a.target_id
1212
         ) as addRegistNum group by addRegistNum.target_type, addRegistNum.target_id
1212
         ) as addRegistNum group by addRegistNum.target_type, addRegistNum.target_id
1213
-        ) as addRegistNum on addRegistNum.target_id = activity.activityId and REPLACE(addRegistNum.target_type, 'dynamic_share', 'activity') = activity.activityType
1213
+        ) as addRegistNum on addRegistNum.target_id = activity.activityId and activity.activityType  = substring_index(REPLACE(addRegistNum.target_type, 'dynamic_share', 'activity_share') , '_share', 1)
1214
         <if test="targetType != null and targetType != ''">
1214
         <if test="targetType != null and targetType != ''">
1215
             where activity.activityType = #{targetType}
1215
             where activity.activityType = #{targetType}
1216
         </if>
1216
         </if>
1422
         </if>
1422
         </if>
1423
         group by a.person_id, a.target_type ,a.target_id
1423
         group by a.person_id, a.target_type ,a.target_id
1424
         ) as addRegistNum group by addRegistNum.target_type, addRegistNum.target_id
1424
         ) as addRegistNum group by addRegistNum.target_type, addRegistNum.target_id
1425
-        ) as addRegistNum on addRegistNum.target_id = activity.activityId and REPLACE(addRegistNum.target_type, 'dynamic_share', 'activity') = activity.activityType
1425
+        ) as addRegistNum on addRegistNum.target_id = activity.activityId and activity.activityType  = substring_index(REPLACE(addRegistNum.target_type, 'dynamic_share', 'activity_share') , '_share', 1)
1426
         <if test="targetType != null and targetType != ''">
1426
         <if test="targetType != null and targetType != ''">
1427
             where activity.activityType = #{targetType}
1427
             where activity.activityType = #{targetType}
1428
         </if>
1428
         </if>
1516
         ) as person
1516
         ) as person
1517
 
1517
 
1518
         left join (
1518
         left join (
1519
-            select * from (
1520
-                SELECT count(*) as shareNum, t.person_id
1519
+            select count(*) as shareNum, temp.person_id from (
1520
+                SELECT t.person_id, t.create_date
1521
                 FROM ta_share_count t
1521
                 FROM ta_share_count t
1522
                 LEFT JOIN ta_help_activity a ON t.be_share = a.help_activity_id
1522
                 LEFT JOIN ta_help_activity a ON t.be_share = a.help_activity_id
1523
                 LEFT JOIN ta_share_activity b ON t.be_share = b.share_id
1523
                 LEFT JOIN ta_share_activity b ON t.be_share = b.share_id
1536
                     and (case when #{activityType} = 'live' then t.tagert_type in ('liveApp', 'livePost') else t.tagert_type = #{activityType}
1536
                     and (case when #{activityType} = 'live' then t.tagert_type in ('liveApp', 'livePost') else t.tagert_type = #{activityType}
1537
                     end)
1537
                     end)
1538
                 </if>
1538
                 </if>
1539
-                group by person_id
1540
-            ) as temp
1539
+                order by t.create_date desc limit 999999
1540
+            ) as temp group by temp.person_id order by temp.create_date desc
1541
         ) as shareNum on person.person_id = shareNum.person_id
1541
         ) as shareNum on person.person_id = shareNum.person_id
1542
 
1542
 
1543
         left join (
1543
         left join (
1677
         ) as person
1677
         ) as person
1678
 
1678
 
1679
         left join (
1679
         left join (
1680
-        select * from (
1681
-        SELECT count(*) as shareNum, t.person_id
1680
+        select count(*) as shareNum, temp.person_id from (
1681
+        SELECT t.person_id, t.create_date
1682
         FROM ta_share_count t
1682
         FROM ta_share_count t
1683
         LEFT JOIN ta_help_activity a ON t.be_share = a.help_activity_id
1683
         LEFT JOIN ta_help_activity a ON t.be_share = a.help_activity_id
1684
         LEFT JOIN ta_share_activity b ON t.be_share = b.share_id
1684
         LEFT JOIN ta_share_activity b ON t.be_share = b.share_id
1697
             and (case when #{activityType} = 'live' then t.tagert_type in ('liveApp', 'livePost') else t.tagert_type = #{activityType}
1697
             and (case when #{activityType} = 'live' then t.tagert_type in ('liveApp', 'livePost') else t.tagert_type = #{activityType}
1698
             end)
1698
             end)
1699
         </if>
1699
         </if>
1700
-        group by person_id
1701
-        ) as temp
1700
+        order by t.create_date desc limit 999999
1701
+        ) as temp group by temp.person_id order by temp.create_date desc
1702
         ) as shareNum on person.person_id = shareNum.person_id
1702
         ) as shareNum on person.person_id = shareNum.person_id
1703
 
1703
 
1704
         left join (
1704
         left join (
2181
         GROUP_CONCAT(d.user_name) as realtyConsultant,
2181
         GROUP_CONCAT(d.user_name) as realtyConsultant,
2182
         GROUP_CONCAT(d.phone) as realtyConsultantPhone,
2182
         GROUP_CONCAT(d.phone) as realtyConsultantPhone,
2183
         t.create_date as visitDate,
2183
         t.create_date as visitDate,
2184
-        ifnull(e.nickName, f.user_name) as sharePersonName,
2184
+        e.nickName as sharePersonName,
2185
         t.visitNum
2185
         t.visitNum
2186
         from (
2186
         from (
2187
         SELECT
2187
         SELECT
2214
         GROUP BY
2214
         GROUP BY
2215
         t.person_id ) as t
2215
         t.person_id ) as t
2216
         left join ta_person a on t.person_id = a.person_id
2216
         left join ta_person a on t.person_id = a.person_id
2217
-        left join ta_person_from_record b on a.person_id = b.person_id and b.org_id = #{orgId}
2217
+        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
2218
         left join td_wx_dict b1 on b.scene_id = b1.scene_id
2218
         left join td_wx_dict b1 on b.scene_id = b1.scene_id
2219
         LEFT JOIN ta_recommend_customer c on c.person_id = t.person_id
2219
         LEFT JOIN ta_recommend_customer c on c.person_id = t.person_id
2220
         left join ta_user d on c.realty_consultant = d.user_id
2220
         left join ta_user d on c.realty_consultant = d.user_id
2221
-        left join ta_person e on e.person_id = c.recommend_person
2222
-        left join ta_user f on f.user_id = c.recommend_person
2221
+        LEFT JOIN ta_person e ON e.person_id = b.share_person_id
2223
         <where>
2222
         <where>
2224
             <if test="personFrom != null and personFrom != ''">
2223
             <if test="personFrom != null and personFrom != ''">
2225
                 and b.scene_type = #{personFrom}
2224
                 and b.scene_type = #{personFrom}
2248
         GROUP_CONCAT(d.user_name) as realtyConsultant,
2247
         GROUP_CONCAT(d.user_name) as realtyConsultant,
2249
         GROUP_CONCAT(d.phone) as realtyConsultantPhone,
2248
         GROUP_CONCAT(d.phone) as realtyConsultantPhone,
2250
         t.create_date as visitDate,
2249
         t.create_date as visitDate,
2251
-        ifnull(e.nickName, f.user_name) as sharePersonName,
2250
+        e.nickName as sharePersonName,
2252
         t.visitNum
2251
         t.visitNum
2253
         from (
2252
         from (
2254
         SELECT
2253
         SELECT
2285
         left join td_wx_dict b1 on b.scene_id = b1.scene_id
2284
         left join td_wx_dict b1 on b.scene_id = b1.scene_id
2286
         LEFT JOIN ta_recommend_customer c on c.person_id = t.person_id
2285
         LEFT JOIN ta_recommend_customer c on c.person_id = t.person_id
2287
         left join ta_user d on c.realty_consultant = d.user_id
2286
         left join ta_user d on c.realty_consultant = d.user_id
2288
-        left join ta_person e on e.person_id = c.recommend_person
2289
-        left join ta_user f on f.user_id = c.recommend_person
2287
+        LEFT JOIN ta_person e ON e.person_id = b.share_person_id
2290
         <where>
2288
         <where>
2291
             <if test="personFrom != null and personFrom != ''">
2289
             <if test="personFrom != null and personFrom != ''">
2292
                 and b.scene_type = #{personFrom}
2290
                 and b.scene_type = #{personFrom}
2315
         GROUP_CONCAT(d.user_name) as realtyConsultant,
2313
         GROUP_CONCAT(d.user_name) as realtyConsultant,
2316
         GROUP_CONCAT(d.phone) as realtyConsultantPhone,
2314
         GROUP_CONCAT(d.phone) as realtyConsultantPhone,
2317
         t.create_date as visitDate,
2315
         t.create_date as visitDate,
2318
-        ifnull(e.nickName, f.user_name) as sharePersonName,
2316
+        e.nickName as sharePersonName,
2319
         t.visitNum
2317
         t.visitNum
2320
         From (
2318
         From (
2321
         SELECT count(1) as visitNum, t.person_id, t.create_date
2319
         SELECT count(1) as visitNum, t.person_id, t.create_date
2341
         left join td_wx_dict b1 on b.scene_id = b1.scene_id
2339
         left join td_wx_dict b1 on b.scene_id = b1.scene_id
2342
         LEFT JOIN ta_recommend_customer c on c.person_id = t.person_id
2340
         LEFT JOIN ta_recommend_customer c on c.person_id = t.person_id
2343
         left join ta_user d on c.realty_consultant = d.user_id
2341
         left join ta_user d on c.realty_consultant = d.user_id
2344
-        left join ta_person e on e.person_id = c.recommend_person
2345
-        left join ta_user f on f.user_id = c.recommend_person
2342
+        LEFT JOIN ta_person e ON e.person_id = b.share_person_id
2346
         group by t.person_id
2343
         group by t.person_id
2347
     </select>
2344
     </select>
2348
 
2345
 
2400
         GROUP_CONCAT(d.user_name) as realtyConsultant,
2397
         GROUP_CONCAT(d.user_name) as realtyConsultant,
2401
         GROUP_CONCAT(d.phone) as realtyConsultantPhone,
2398
         GROUP_CONCAT(d.phone) as realtyConsultantPhone,
2402
         t.create_date as visitDate,
2399
         t.create_date as visitDate,
2403
-        ifnull(e.nickName, f.user_name) as sharePersonName,
2400
+        e.nickName as sharePersonName,
2404
         t.visitNum
2401
         t.visitNum
2405
         From (
2402
         From (
2406
         SELECT count(1) as visitNum, t.person_id, t.create_date
2403
         SELECT count(1) as visitNum, t.person_id, t.create_date
2426
         left join td_wx_dict b1 on b.scene_id = b1.scene_id
2423
         left join td_wx_dict b1 on b.scene_id = b1.scene_id
2427
         LEFT JOIN ta_recommend_customer c on c.person_id = t.person_id
2424
         LEFT JOIN ta_recommend_customer c on c.person_id = t.person_id
2428
         left join ta_user d on c.realty_consultant = d.user_id
2425
         left join ta_user d on c.realty_consultant = d.user_id
2429
-        left join ta_person e on e.person_id = c.recommend_person
2430
-        left join ta_user f on f.user_id = c.recommend_person
2426
+        LEFT JOIN ta_person e ON e.person_id = b.share_person_id
2431
         group by t.person_id
2427
         group by t.person_id
2432
     </select>
2428
     </select>
2433
 
2429