魏超 5 anni fa
parent
commit
d78f0472fb

+ 3
- 0
src/main/java/com/huiju/estateagents/entity/TaPerson.java Vedi File

316
     /**
316
     /**
317
      * 访问内容类型
317
      * 访问内容类型
318
      */
318
      */
319
+    @TableField(exist = false)
319
     private String targetType;
320
     private String targetType;
320
 
321
 
321
     /**
322
     /**
322
      * 访问内容ID
323
      * 访问内容ID
323
      */
324
      */
325
+    @TableField(exist = false)
324
     private String targetId;
326
     private String targetId;
325
 
327
 
326
     /**
328
     /**
327
      * 访问内容名称
329
      * 访问内容名称
328
      */
330
      */
331
+    @TableField(exist = false)
329
     private String targetName;
332
     private String targetName;
330
 }
333
 }

+ 2
- 0
src/main/java/com/huiju/estateagents/excel/ActivityStatistics/ActivityDetailShareRecord.java Vedi File

1
 package com.huiju.estateagents.excel.ActivityStatistics;
1
 package com.huiju.estateagents.excel.ActivityStatistics;
2
 
2
 
3
+import com.alibaba.excel.annotation.ExcelIgnore;
3
 import com.alibaba.excel.annotation.ExcelProperty;
4
 import com.alibaba.excel.annotation.ExcelProperty;
4
 import com.alibaba.excel.annotation.write.style.ColumnWidth;
5
 import com.alibaba.excel.annotation.write.style.ColumnWidth;
5
 import lombok.Data;
6
 import lombok.Data;
7
 @Data
8
 @Data
8
 public class ActivityDetailShareRecord {
9
 public class ActivityDetailShareRecord {
9
 
10
 
11
+    @ExcelIgnore
10
     private String activityId;
12
     private String activityId;
11
 
13
 
12
     /**
14
     /**

+ 2
- 0
src/main/java/com/huiju/estateagents/excel/ActivityStatistics/ShareNum.java Vedi File

1
 package com.huiju.estateagents.excel.ActivityStatistics;
1
 package com.huiju.estateagents.excel.ActivityStatistics;
2
 
2
 
3
+import com.alibaba.excel.annotation.ExcelIgnore;
3
 import com.alibaba.excel.annotation.ExcelProperty;
4
 import com.alibaba.excel.annotation.ExcelProperty;
4
 import com.alibaba.excel.annotation.write.style.ColumnWidth;
5
 import com.alibaba.excel.annotation.write.style.ColumnWidth;
5
 import lombok.Data;
6
 import lombok.Data;
43
     @ExcelProperty(value = "访问人数", index = 4)
44
     @ExcelProperty(value = "访问人数", index = 4)
44
     private Integer visitPersonNum;
45
     private Integer visitPersonNum;
45
 
46
 
47
+    @ExcelIgnore
46
     private String sharePersonId;
48
     private String sharePersonId;
47
 }
49
 }

+ 2
- 0
src/main/java/com/huiju/estateagents/excel/ActivityStatistics/SharePersonNum.java Vedi File

1
 package com.huiju.estateagents.excel.ActivityStatistics;
1
 package com.huiju.estateagents.excel.ActivityStatistics;
2
 
2
 
3
+import com.alibaba.excel.annotation.ExcelIgnore;
3
 import com.alibaba.excel.annotation.ExcelProperty;
4
 import com.alibaba.excel.annotation.ExcelProperty;
4
 import com.alibaba.excel.annotation.write.style.ColumnWidth;
5
 import com.alibaba.excel.annotation.write.style.ColumnWidth;
5
 import lombok.Data;
6
 import lombok.Data;
48
     @ExcelProperty(value = "访问次数", index = 5)
49
     @ExcelProperty(value = "访问次数", index = 5)
49
     private Integer visitNum;
50
     private Integer visitNum;
50
 
51
 
52
+    @ExcelIgnore
51
     private String personId;
53
     private String personId;
52
 }
54
 }

+ 0
- 1
src/main/java/com/huiju/estateagents/service/impl/TaShareServiceImpl.java Vedi File

71
             taBuildingDynamicQuery.eq("dynamic_id",id);
71
             taBuildingDynamicQuery.eq("dynamic_id",id);
72
             TaBuildingDynamic taBuildingDynamic = taBuildingDynamicMapper.selectOne(taBuildingDynamicQuery);
72
             TaBuildingDynamic taBuildingDynamic = taBuildingDynamicMapper.selectOne(taBuildingDynamicQuery);
73
             taBuildingDynamicMapper.updateById( taBuildingDynamic.setShareNum(taBuildingDynamic.getShareNum() == null ? 1:taBuildingDynamic.getShareNum()+1));
73
             taBuildingDynamicMapper.updateById( taBuildingDynamic.setShareNum(taBuildingDynamic.getShareNum() == null ? 1:taBuildingDynamic.getShareNum()+1));
74
-//            return ResponseBean.success("成功");
75
         }
74
         }
76
 
75
 
77
         TaShareCount taShareCount = new TaShareCount();
76
         TaShareCount taShareCount = new TaShareCount();

+ 129
- 87
src/main/resources/mapper/statistic/TaActivityStaticMapper.xml Vedi File

163
             </trim>
163
             </trim>
164
         ) AS temp_date
164
         ) AS temp_date
165
         LEFT JOIN (
165
         LEFT JOIN (
166
-                select temp1.user_count, temp1.create_date from (
167
-                SELECT COUNT( 1 ) AS user_count, t.create_date AS create_date, t.person_id
168
-                FROM
169
-                ta_share_count t
170
-                left join ta_help_activity a on t.be_share = a.help_activity_id
171
-                left join ta_share_activity b on t.be_share = b.share_id
172
-                left join ta_live_activity c on t.be_share = c.live_activity_id
173
-                left join ta_drainage d on t.be_share = d.drainage_id
174
-                left join ta_building_dynamic e on t.be_share = e.dynamic_id
175
-                left join ta_person f on t.person_id = f.person_id
176
-                WHERE
177
-                t.tagert_type in ('activity','group','h5','help','liveApp','livePost') and t.org_id = #{orgId}
178
-                <if test="buildingId != null and buildingId != ''">
179
-                    and (a.building_id = #{buildingId} or b.building_id = #{buildingId} or c.building_id = #{buildingId} or d.building_id = #{buildingId} or e.building_id = #{buildingId})
180
-                </if>
181
-                <if test="targetType != null and targetType != ''">
182
-                    and t.tagert_type = #{targetType}
183
-                </if>
184
-                <if test="startDate != null ">
185
-                    and t.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
186
-                </if>
187
-                <if test="endDate != null ">
188
-                    and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
189
-                </if>
190
-                <if test="startDate == null or endDate == null ">
191
-                    AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
192
-                </if>
193
-                GROUP BY t.person_id
194
-                ) as temp1
195
-            ) AS temp ON temp_date.date = DATE_FORMAT( temp.create_date, '%Y-%m-%d' )
166
+            SELECT count(1) as user_count , temp1.*
167
+            FROM (
168
+            SELECT DISTINCT(t.person_id),t.create_date
169
+            FROM ta_share_count t
170
+            LEFT JOIN ta_help_activity a
171
+            ON t.be_share = a.help_activity_id
172
+            LEFT JOIN ta_share_activity b
173
+            ON t.be_share = b.share_id
174
+            LEFT JOIN ta_live_activity c
175
+            ON t.be_share = c.live_activity_id
176
+            LEFT JOIN ta_drainage d
177
+            ON t.be_share = d.drainage_id
178
+            LEFT JOIN ta_building_dynamic e
179
+            ON t.be_share = e.dynamic_id
180
+            LEFT JOIN ta_person f
181
+            ON t.person_id = f.person_id
182
+            WHERE
183
+            t.tagert_type in ('activity','group','h5','help','liveApp','livePost') and t.org_id = #{orgId}
184
+            <if test="buildingId != null and buildingId != ''">
185
+                and (a.building_id = #{buildingId} or b.building_id = #{buildingId} or c.building_id = #{buildingId} or d.building_id = #{buildingId} or e.building_id = #{buildingId})
186
+            </if>
187
+            <if test="targetType != null and targetType != ''">
188
+                and t.tagert_type = #{targetType}
189
+            </if>
190
+            <if test="startDate != null ">
191
+                and t.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
192
+            </if>
193
+            <if test="endDate != null ">
194
+                and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
195
+            </if>
196
+            <if test="startDate == null or endDate == null ">
197
+                AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
198
+            </if>
199
+            GROUP BY DATE_FORMAT( t.create_date, '%Y-%m-%d' ) ,t.person_id
200
+            ) as temp1  GROUP BY DATE_FORMAT( temp1.create_date, '%Y-%m-%d' )
201
+        ) AS temp1 ON temp_date.date = DATE_FORMAT( temp1.create_date, '%Y-%m-%d' )
202
+
196
         ) AS share_person_count_table
203
         ) AS share_person_count_table
197
 
204
 
198
         group by date order by date
205
         group by date order by date
229
             and t.building_id =  #{buildingId}
236
             and t.building_id =  #{buildingId}
230
         </if>
237
         </if>
231
         <if test="targetType != null and targetType != ''">
238
         <if test="targetType != null and targetType != ''">
232
-            and t.target_type =  #{targetType}
239
+            and (case when #{targetType} = 'activity' then t.target_type = 'dynamic' else t.target_type = #{targetType} end)
233
         </if>
240
         </if>
234
         <if test="startDate != null">
241
         <if test="startDate != null">
235
             and t.visit_time &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
242
             and t.visit_time &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
279
                 and t.building_id =  #{buildingId}
286
                 and t.building_id =  #{buildingId}
280
             </if>
287
             </if>
281
             <if test="targetType != null and targetType != ''">
288
             <if test="targetType != null and targetType != ''">
282
-                and t.target_type =  #{targetType}
289
+                and (case when #{targetType} = 'activity' then t.target_type = 'dynamic' else t.target_type = #{targetType} end)
283
             </if>
290
             </if>
284
             <if test="startDate != null">
291
             <if test="startDate != null">
285
                 and t.visit_time &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
292
                 and t.visit_time &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
300
 
307
 
301
     <select id="selectAddRegistCount" resultType="java.util.Map">
308
     <select id="selectAddRegistCount" resultType="java.util.Map">
302
         SELECT
309
         SELECT
303
-        addRegist_count_table.date AS date,
304
-        ifnull( addRegist_count_table.user_count, 0 ) AS addRegist_count
305
-        FROM (
306
-        SELECT
307
-        *
310
+        date,
311
+        ifnull( addRegistNum, 0 ) AS addRegist_count
308
         FROM
312
         FROM
309
         (
313
         (
310
         SELECT
314
         SELECT
319
         ) AS temp_date
323
         ) AS temp_date
320
         LEFT JOIN (
324
         LEFT JOIN (
321
         SELECT
325
         SELECT
322
-        COUNT( 1 ) AS user_count,
323
-        t.create_date AS create_date
326
+        count( * ) AS addRegistNum,
327
+        temp4.*
328
+        FROM
329
+        (
330
+        SELECT
331
+        t.create_date AS create_date,
332
+        t.person_id
324
         FROM
333
         FROM
325
         ta_share_person_from t
334
         ta_share_person_from t
326
         WHERE
335
         WHERE
327
-        t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share') and t.org_id = #{orgId}
336
+        t.target_type IN ( 'dynamic_share', 'h5_share', 'help_share', 'live_share', 'group_share' )
337
+        AND t.org_id = #{orgId}
338
+        AND t.STATUS = 1
339
+        and t.is_first_time = 1
328
         <if test="buildingId != null and buildingId != ''">
340
         <if test="buildingId != null and buildingId != ''">
329
             and t.building_id =  #{buildingId}
341
             and t.building_id =  #{buildingId}
330
         </if>
342
         </if>
331
-        and t.status = 1
343
+        and t.status = 1 and t.is_first_time = 1
332
         <if test="targetType != null and targetType != ''">
344
         <if test="targetType != null and targetType != ''">
333
             and t.target_type =  #{targetType}
345
             and t.target_type =  #{targetType}
334
         </if>
346
         </if>
342
             AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
354
             AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
343
         </if>
355
         </if>
344
         GROUP BY
356
         GROUP BY
345
-        DATE_FORMAT( t.create_date, '%Y-%m-%d' ) ,t.person_id, t.target_type
346
-        ) AS temp ON temp_date.date = DATE_FORMAT( temp.create_date, '%Y-%m-%d' )
347
-        ) AS addRegist_count_table
348
-
349
-        group by date order by date
357
+        t.person_id,
358
+        t.target_type
359
+        ) AS temp4
360
+        GROUP BY
361
+        DATE_FORMAT( temp4.create_date, '%Y-%m-%d' )
362
+        ) AS temp4 ON temp_date.date = DATE_FORMAT( temp4.create_date, '%Y-%m-%d' )
363
+        GROUP BY
364
+        date
365
+        ORDER BY
366
+        date DESC
350
     </select>
367
     </select>
351
 
368
 
352
     <select id="selectTableData" resultType="com.huiju.estateagents.excel.ActivityStatistics.StatisicAttractUser">
369
     <select id="selectTableData" resultType="com.huiju.estateagents.excel.ActivityStatistics.StatisicAttractUser">
396
         DATE_FORMAT( t.create_date, '%Y-%m-%d' )
413
         DATE_FORMAT( t.create_date, '%Y-%m-%d' )
397
         ) AS temp ON temp_date.date = DATE_FORMAT( temp.create_date, '%Y-%m-%d' )
414
         ) AS temp ON temp_date.date = DATE_FORMAT( temp.create_date, '%Y-%m-%d' )
398
         LEFT JOIN (
415
         LEFT JOIN (
399
-            select temp1.sharePersonNum, temp1.create_date from (
400
-                SELECT COUNT( 1 ) AS sharePersonNum, t.create_date AS create_date, t.person_id
401
-                FROM
402
-                ta_share_count t
403
-                left join ta_help_activity a on t.be_share = a.help_activity_id
404
-                left join ta_share_activity b on t.be_share = b.share_id
405
-                left join ta_live_activity c on t.be_share = c.live_activity_id
406
-                left join ta_drainage d on t.be_share = d.drainage_id
407
-                left join ta_building_dynamic e on t.be_share = e.dynamic_id
408
-                left join ta_person f on t.person_id = f.person_id
416
+            SELECT count(1) as sharePersonNum , temp1.*
417
+            FROM (
418
+                SELECT DISTINCT(t.person_id),t.create_date
419
+                FROM ta_share_count t
420
+                LEFT JOIN ta_help_activity a
421
+                ON t.be_share = a.help_activity_id
422
+                LEFT JOIN ta_share_activity b
423
+                ON t.be_share = b.share_id
424
+                LEFT JOIN ta_live_activity c
425
+                ON t.be_share = c.live_activity_id
426
+                LEFT JOIN ta_drainage d
427
+                ON t.be_share = d.drainage_id
428
+                LEFT JOIN ta_building_dynamic e
429
+                ON t.be_share = e.dynamic_id
430
+                LEFT JOIN ta_person f
431
+                ON t.person_id = f.person_id
409
                 WHERE
432
                 WHERE
410
                 t.tagert_type in ('activity','group','h5','help','liveApp','livePost') and t.org_id = #{orgId}
433
                 t.tagert_type in ('activity','group','h5','help','liveApp','livePost') and t.org_id = #{orgId}
411
                 <if test="buildingId != null and buildingId != ''">
434
                 <if test="buildingId != null and buildingId != ''">
423
                 <if test="startDate == null or endDate == null ">
446
                 <if test="startDate == null or endDate == null ">
424
                     AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
447
                     AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
425
                 </if>
448
                 </if>
426
-                GROUP BY t.person_id, DATE_FORMAT( t.create_date, '%Y-%m-%d' )
427
-            ) as temp1
449
+                GROUP BY DATE_FORMAT( t.create_date, '%Y-%m-%d' ) ,t.person_id
450
+                ) as temp1  GROUP BY DATE_FORMAT( temp1.create_date, '%Y-%m-%d' )
428
         ) AS temp1 ON temp_date.date = DATE_FORMAT( temp1.create_date, '%Y-%m-%d' )
451
         ) AS temp1 ON temp_date.date = DATE_FORMAT( temp1.create_date, '%Y-%m-%d' )
429
         LEFT JOIN (
452
         LEFT JOIN (
430
         SELECT
453
         SELECT
438
             and t.building_id =  #{buildingId}
461
             and t.building_id =  #{buildingId}
439
         </if>
462
         </if>
440
         <if test="targetType != null and targetType != ''">
463
         <if test="targetType != null and targetType != ''">
441
-            and t.target_type =  #{targetType}
464
+            and (case when #{targetType} = 'activity' then t.target_type = 'dynamic' else t.target_type = #{targetType} end)
442
         </if>
465
         </if>
443
         <if test="startDate != null">
466
         <if test="startDate != null">
444
             and t.visit_time &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
467
             and t.visit_time &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
465
                 and t.building_id =  #{buildingId}
488
                 and t.building_id =  #{buildingId}
466
             </if>
489
             </if>
467
             <if test="targetType != null and targetType != ''">
490
             <if test="targetType != null and targetType != ''">
468
-                and t.target_type =  #{targetType}
491
+                and (case when #{targetType} = 'activity' then t.target_type = 'dynamic' else t.target_type = #{targetType} end)
469
             </if>
492
             </if>
470
             <if test="startDate != null">
493
             <if test="startDate != null">
471
                 and t.visit_time &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
494
                 and t.visit_time &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
493
                 and t.building_id =  #{buildingId}
516
                 and t.building_id =  #{buildingId}
494
             </if>
517
             </if>
495
             and t.status = 1
518
             and t.status = 1
519
+            and t.is_first_time = 1
496
             <if test="targetType != null and targetType != ''">
520
             <if test="targetType != null and targetType != ''">
497
                 and t.target_type =  #{targetType}
521
                 and t.target_type =  #{targetType}
498
             </if>
522
             </if>
563
         DATE_FORMAT( t.create_date, '%Y-%m-%d' )
587
         DATE_FORMAT( t.create_date, '%Y-%m-%d' )
564
         ) AS temp ON temp_date.date = DATE_FORMAT( temp.create_date, '%Y-%m-%d' )
588
         ) AS temp ON temp_date.date = DATE_FORMAT( temp.create_date, '%Y-%m-%d' )
565
         LEFT JOIN (
589
         LEFT JOIN (
566
-        select temp1.sharePersonNum, temp1.create_date from (
567
-        SELECT COUNT( 1 ) AS sharePersonNum, t.create_date AS create_date, t.person_id
568
-        FROM
569
-        ta_share_count t
570
-        left join ta_help_activity a on t.be_share = a.help_activity_id
571
-        left join ta_share_activity b on t.be_share = b.share_id
572
-        left join ta_live_activity c on t.be_share = c.live_activity_id
573
-        left join ta_drainage d on t.be_share = d.drainage_id
574
-        left join ta_building_dynamic e on t.be_share = e.dynamic_id
575
-        left join ta_person f on t.person_id = f.person_id
590
+        SELECT count(1) as sharePersonNum , temp1.*
591
+        FROM (
592
+        SELECT DISTINCT(t.person_id),t.create_date
593
+        FROM ta_share_count t
594
+        LEFT JOIN ta_help_activity a
595
+        ON t.be_share = a.help_activity_id
596
+        LEFT JOIN ta_share_activity b
597
+        ON t.be_share = b.share_id
598
+        LEFT JOIN ta_live_activity c
599
+        ON t.be_share = c.live_activity_id
600
+        LEFT JOIN ta_drainage d
601
+        ON t.be_share = d.drainage_id
602
+        LEFT JOIN ta_building_dynamic e
603
+        ON t.be_share = e.dynamic_id
604
+        LEFT JOIN ta_person f
605
+        ON t.person_id = f.person_id
576
         WHERE
606
         WHERE
577
         t.tagert_type in ('activity','group','h5','help','liveApp','livePost') and t.org_id = #{orgId}
607
         t.tagert_type in ('activity','group','h5','help','liveApp','livePost') and t.org_id = #{orgId}
578
         <if test="buildingId != null and buildingId != ''">
608
         <if test="buildingId != null and buildingId != ''">
590
         <if test="startDate == null or endDate == null ">
620
         <if test="startDate == null or endDate == null ">
591
             AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
621
             AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
592
         </if>
622
         </if>
593
-        GROUP BY t.person_id, DATE_FORMAT( t.create_date, '%Y-%m-%d' )
594
-        ) as temp1
623
+        GROUP BY DATE_FORMAT( t.create_date, '%Y-%m-%d' ) ,t.person_id
624
+        ) as temp1  GROUP BY DATE_FORMAT( temp1.create_date, '%Y-%m-%d' )
595
         ) AS temp1 ON temp_date.date = DATE_FORMAT( temp1.create_date, '%Y-%m-%d' )
625
         ) AS temp1 ON temp_date.date = DATE_FORMAT( temp1.create_date, '%Y-%m-%d' )
596
         LEFT JOIN (
626
         LEFT JOIN (
597
         SELECT
627
         SELECT
660
             and t.building_id =  #{buildingId}
690
             and t.building_id =  #{buildingId}
661
         </if>
691
         </if>
662
         and t.status = 1
692
         and t.status = 1
693
+        and t.is_first_time = 1
663
         <if test="targetType != null and targetType != ''">
694
         <if test="targetType != null and targetType != ''">
664
             and t.target_type =  #{targetType}
695
             and t.target_type =  #{targetType}
665
         </if>
696
         </if>
849
 
880
 
850
     <select id="selectActivityStatisDetailExport" resultType="com.huiju.estateagents.excel.ActivityStatistics.ActivityDetailShareRecord">
881
     <select id="selectActivityStatisDetailExport" resultType="com.huiju.estateagents.excel.ActivityStatistics.ActivityDetailShareRecord">
851
         select
882
         select
852
-        activity.*,
883
+        activity.activityId, activity.activityName,
884
+        case when activity.activityType = 'activity' then '报名活动'
885
+        when activity.activityType = 'help' then '助力活动'
886
+        when activity.activityType = 'group' then '拼团活动'
887
+        when activity.activityType = 'h5' then 'H5活动'
888
+        when activity.activityType = 'live' then '直播活动'
889
+        end as activityType,
853
         ifnull(shareNum.shareNum, 0) as shareNum,
890
         ifnull(shareNum.shareNum, 0) as shareNum,
854
         ifnull(sharePersonNum.sharePersonNum, 0) as sharePersonNum,
891
         ifnull(sharePersonNum.sharePersonNum, 0) as sharePersonNum,
855
         ifnull(visitNum.visitNum, 0) as visitNum,
892
         ifnull(visitNum.visitNum, 0) as visitNum,
997
 
1034
 
998
     <select id="selectActivitySharePersonNum" resultType="com.huiju.estateagents.excel.ActivityStatistics.SharePersonNum">
1035
     <select id="selectActivitySharePersonNum" resultType="com.huiju.estateagents.excel.ActivityStatistics.SharePersonNum">
999
         select person.nickname as sharePersonName,
1036
         select person.nickname as sharePersonName,
1000
-               ifnull(person.tel, '空') as sharePersonPhone ,
1037
+               ifnull(person.phone, '空') as sharePersonPhone ,
1001
                ifnull(shareNum, 0) as shareNum,
1038
                ifnull(shareNum, 0) as shareNum,
1002
                ifnull(visitNum, 0) as visitNum,
1039
                ifnull(visitNum, 0) as visitNum,
1003
                ifnull(visitPersonNum, 0) as visitPersonNum,
1040
                ifnull(visitPersonNum, 0) as visitPersonNum,
1004
             person.person_type as sharePersonType,
1041
             person.person_type as sharePersonType,
1005
             person.person_id
1042
             person.person_id
1006
             from (
1043
             from (
1007
-            SELECT t.*, f.nickname, f.tel, f.person_type
1044
+            SELECT t.*, f.nickname, f.phone, f.person_type
1008
             FROM ta_share_count t
1045
             FROM ta_share_count t
1009
             LEFT JOIN ta_help_activity a
1046
             LEFT JOIN ta_help_activity a
1010
             ON t.be_share = a.help_activity_id
1047
             ON t.be_share = a.help_activity_id
1033
                 and f.nickname = #{sharePersonName}
1070
                 and f.nickname = #{sharePersonName}
1034
             </if>
1071
             </if>
1035
             <if test="sharePhone != null and sharePhone != ''">
1072
             <if test="sharePhone != null and sharePhone != ''">
1036
-                and f.tel = #{sharePhone}
1073
+                and f.phone = #{sharePhone}
1037
             </if>
1074
             </if>
1038
             GROUP BY t.person_id
1075
             GROUP BY t.person_id
1039
         ) as person
1076
         ) as person
1092
     </select>
1129
     </select>
1093
     <select id="selectActivitySharePersonNumExport" resultType="com.huiju.estateagents.excel.ActivityStatistics.SharePersonNum">
1130
     <select id="selectActivitySharePersonNumExport" resultType="com.huiju.estateagents.excel.ActivityStatistics.SharePersonNum">
1094
         select person.nickname as sharePersonName,
1131
         select person.nickname as sharePersonName,
1095
-        ifnull(person.tel, '空') as sharePersonPhone ,
1132
+        ifnull(person.phone, '空') as sharePersonPhone ,
1096
         ifnull(shareNum, 0) as shareNum,
1133
         ifnull(shareNum, 0) as shareNum,
1097
         ifnull(visitNum, 0) as visitNum,
1134
         ifnull(visitNum, 0) as visitNum,
1098
         ifnull(visitPersonNum, 0) as visitPersonNum,
1135
         ifnull(visitPersonNum, 0) as visitPersonNum,
1099
-        person.person_type as sharePersonType from (
1100
-        SELECT t.*, f.nickname, f.tel, f.person_type
1136
+        case
1137
+        when person.person_type = 'customer' then '客户'
1138
+        when person.person_type = 'drift' then '游客'
1139
+        when person.person_type = 'Realty Consultant' then '置业顾问'
1140
+        end as sharePersonType from (
1141
+        SELECT t.*, f.nickname, f.phone, f.person_type
1101
         FROM ta_share_count t
1142
         FROM ta_share_count t
1102
         LEFT JOIN ta_help_activity a
1143
         LEFT JOIN ta_help_activity a
1103
         ON t.be_share = a.help_activity_id
1144
         ON t.be_share = a.help_activity_id
1120
             and f.nickname = #{sharePersonName}
1161
             and f.nickname = #{sharePersonName}
1121
         </if>
1162
         </if>
1122
         <if test="sharePhone != null and sharePhone != ''">
1163
         <if test="sharePhone != null and sharePhone != ''">
1123
-            and f.tel = #{sharePhone}
1164
+            and f.phone = #{sharePhone}
1124
         </if>
1165
         </if>
1125
         GROUP BY t.person_id, t.person_id
1166
         GROUP BY t.person_id, t.person_id
1126
         ) as person
1167
         ) as person
1179
 
1220
 
1180
     <select id="selectActivityShareNum" resultType="com.huiju.estateagents.excel.ActivityStatistics.ShareNum">
1221
     <select id="selectActivityShareNum" resultType="com.huiju.estateagents.excel.ActivityStatistics.ShareNum">
1181
         select person.nickname as sharePersonName,
1222
         select person.nickname as sharePersonName,
1182
-        ifnull(person.tel, '空') as sharePersonPhone ,
1223
+        ifnull(person.phone, '空') as sharePersonPhone ,
1183
         person.create_date as shareTime,
1224
         person.create_date as shareTime,
1184
         ifnull(visitPersonNum.visitPersonNum, 0) as visitPersonNum,
1225
         ifnull(visitPersonNum.visitPersonNum, 0) as visitPersonNum,
1185
         person.person_type as sharePersonType
1226
         person.person_type as sharePersonType
1186
         FROM (
1227
         FROM (
1187
-            SELECT t.*, f.nickname, f.tel, f.person_type
1228
+            SELECT t.*, f.nickname, f.phone, f.person_type
1188
             FROM ta_share_count t
1229
             FROM ta_share_count t
1189
             LEFT JOIN ta_help_activity a
1230
             LEFT JOIN ta_help_activity a
1190
             ON t.be_share = a.help_activity_id
1231
             ON t.be_share = a.help_activity_id
1231
 
1272
 
1232
     <select id="selectActivityShareNumExport" resultType="com.huiju.estateagents.excel.ActivityStatistics.ShareNum">
1273
     <select id="selectActivityShareNumExport" resultType="com.huiju.estateagents.excel.ActivityStatistics.ShareNum">
1233
         select person.nickname as sharePersonName,
1274
         select person.nickname as sharePersonName,
1234
-        ifnull(person.tel, '空') as sharePersonPhone ,
1275
+        ifnull(person.phone, '空') as sharePersonPhone ,
1235
         person.create_date as shareTime,
1276
         person.create_date as shareTime,
1236
         ifnull(visitPersonNum.visitPersonNum, 0) as visitPersonNum,
1277
         ifnull(visitPersonNum.visitPersonNum, 0) as visitPersonNum,
1237
         CASE
1278
         CASE
1243
         "置业顾问"
1284
         "置业顾问"
1244
         END `sharePersonType`
1285
         END `sharePersonType`
1245
         FROM (
1286
         FROM (
1246
-        SELECT t.*, f.nickname, f.tel, f.person_type
1287
+        SELECT t.*, f.nickname, f.phone, f.person_type
1247
         FROM ta_share_count t
1288
         FROM ta_share_count t
1248
         LEFT JOIN ta_help_activity a
1289
         LEFT JOIN ta_help_activity a
1249
         ON t.be_share = a.help_activity_id
1290
         ON t.be_share = a.help_activity_id
1276
         if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
1317
         if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
1277
         a.province,
1318
         a.province,
1278
         b1.scene_name as personFrom,
1319
         b1.scene_name as personFrom,
1279
-        d.name as realtyConsultant,
1280
-        d.phone as realtyConsultantPhone,
1320
+        GROUP_CONCAT(c.name) as realtyConsultant,
1321
+        ifnull(d.phone, d.tel) as realtyConsultantPhone,
1281
         ifnull(e.nickname, f.user_name) as sharePersonName,
1322
         ifnull(e.nickname, f.user_name) as sharePersonName,
1282
-        e.phone as sharePersonPhone
1323
+        ifnull(e.phone, e.tel) as sharePersonPhone
1283
         FROM ta_share_person_from t
1324
         FROM ta_share_person_from t
1284
         left join ta_person a on t.person_id = a.person_id
1325
         left join ta_person a on t.person_id = a.person_id
1285
         left join ta_person_from_record b on a.person_id = b.person_id and b.org_id = 84 and b.is_first_time =1
1326
         left join ta_person_from_record b on a.person_id = b.person_id and b.org_id = 84 and b.is_first_time =1
1300
         <if test="personFrom != null and personFrom != ''">
1341
         <if test="personFrom != null and personFrom != ''">
1301
             and b.scene_id = #{personFrom}
1342
             and b.scene_id = #{personFrom}
1302
         </if>
1343
         </if>
1344
+        group by t.person_id
1303
     </select>
1345
     </select>
1304
 
1346
 
1305
     <select id="selectActivityAddRegistNumExport" resultType="com.huiju.estateagents.excel.ActivityStatistics.AddRegistNum">
1347
     <select id="selectActivityAddRegistNumExport" resultType="com.huiju.estateagents.excel.ActivityStatistics.AddRegistNum">