魏超 5 years ago
parent
commit
f844c6e7ca

+ 18
- 3
src/main/java/com/huiju/estateagents/statistic/mapper/TaActicityStaticMapper.java View File

63
                                                      @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
63
                                                      @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
64
                                                      @Param("userId") Integer userId);
64
                                                      @Param("userId") Integer userId);
65
 
65
 
66
-    List<Map<String, Object>> selectVisitCount(@Param("orgId") Integer orgId, @Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate, @Param("buildingId") String buildingId, @Param("targetType") String targetType);
66
+    List<Map<String, Object>> selectVisitCount(@Param("orgId") Integer orgId,
67
+                                               @Param("startDate") LocalDateTime startDate,
68
+                                               @Param("endDate") LocalDateTime endDate,
69
+                                               @Param("buildingId") String buildingId,
70
+                                               @Param("targetType") String targetType,
71
+                                               @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings);
67
 
72
 
68
-    List<Map<String, Object>> selectVisitPersonCount(@Param("orgId") Integer orgId, @Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate, @Param("buildingId") String buildingId, @Param("targetType") String targetType);
73
+    List<Map<String, Object>> selectVisitPersonCount(@Param("orgId") Integer orgId,
74
+                                                     @Param("startDate") LocalDateTime startDate,
75
+                                                     @Param("endDate") LocalDateTime endDate,
76
+                                                     @Param("buildingId") String buildingId,
77
+                                                     @Param("targetType") String targetType,
78
+                                                     @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings);
69
 
79
 
70
-    List<Map<String, Object>> selectAddRegistCount(@Param("orgId") Integer orgId, @Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate, @Param("buildingId") String buildingId, @Param("targetType") String targetType);
80
+    List<Map<String, Object>> selectAddRegistCount(@Param("orgId") Integer orgId,
81
+                                                   @Param("startDate") LocalDateTime startDate,
82
+                                                   @Param("endDate") LocalDateTime endDate,
83
+                                                   @Param("buildingId") String buildingId,
84
+                                                   @Param("targetType") String targetType,
85
+                                                   @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings);
71
 
86
 
72
     IPage<StatisicAttractUser> selectTableData(
87
     IPage<StatisicAttractUser> selectTableData(
73
             IPage<StatisicAttractUser> attractUserIPage,
88
             IPage<StatisicAttractUser> attractUserIPage,

+ 3
- 3
src/main/java/com/huiju/estateagents/statistic/service/impl/TaActivityStaticServiceImpl.java View File

52
         // 新增用户数
52
         // 新增用户数
53
         List<Map<String, Object>> selectShareCount = taActicityStaticMapper.selectShareCount(orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX.withNano(0)), buildingId, targetType, taPersonBuildings, userId);
53
         List<Map<String, Object>> selectShareCount = taActicityStaticMapper.selectShareCount(orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX.withNano(0)), buildingId, targetType, taPersonBuildings, userId);
54
         List<Map<String, Object>> selectSharePersonCount = taActicityStaticMapper.selectSharePersonCount(orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX.withNano(0)), buildingId, targetType, taPersonBuildings, userId);
54
         List<Map<String, Object>> selectSharePersonCount = taActicityStaticMapper.selectSharePersonCount(orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX.withNano(0)), buildingId, targetType, taPersonBuildings, userId);
55
-        List<Map<String, Object>> selectVisitCount = taActicityStaticMapper.selectVisitCount(orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX.withNano(0)), buildingId, targetType);
56
-        List<Map<String, Object>> selectVisitPersonCount = taActicityStaticMapper.selectVisitPersonCount(orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX.withNano(0)), buildingId, targetType);
57
-        List<Map<String, Object>> selectAddRegistCount = taActicityStaticMapper.selectAddRegistCount(orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX.withNano(0)), buildingId, targetType);
55
+        List<Map<String, Object>> selectVisitCount = taActicityStaticMapper.selectVisitCount(orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX.withNano(0)), buildingId, targetType, taPersonBuildings);
56
+        List<Map<String, Object>> selectVisitPersonCount = taActicityStaticMapper.selectVisitPersonCount(orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX.withNano(0)), buildingId, targetType, taPersonBuildings);
57
+        List<Map<String, Object>> selectAddRegistCount = taActicityStaticMapper.selectAddRegistCount(orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX.withNano(0)), buildingId, targetType, taPersonBuildings);
58
 
58
 
59
 
59
 
60
         for (Map<String, Object> ssc : selectShareCount){
60
         for (Map<String, Object> ssc : selectShareCount){

+ 64
- 5
src/main/resources/mapper/statistic/TaActivityStaticMapper.xml View File

131
         <if test="startDate == null or endDate == null">
131
         <if test="startDate == null or endDate == null">
132
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
132
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
133
         </if>
133
         </if>
134
+        <if test="taPersonBuildings != null and taPersonBuildings.size > 0">
135
+            AND t.building_id in
136
+            <foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
137
+                #{taPersonBuilding.buildingId}
138
+            </foreach>
139
+        </if>
134
         GROUP BY
140
         GROUP BY
135
         DATE_FORMAT(t.visit_time, '%Y-%m-%d'),
141
         DATE_FORMAT(t.visit_time, '%Y-%m-%d'),
136
         person_id) as visitPersonCount
142
         person_id) as visitPersonCount
152
         <if test="endDate != null">
158
         <if test="endDate != null">
153
             and t.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
159
             and t.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
154
         </if>
160
         </if>
161
+        <if test="taPersonBuildings != null and taPersonBuildings.size > 0">
162
+            AND t.building_id in
163
+            <foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
164
+                #{taPersonBuilding.buildingId}
165
+            </foreach>
166
+        </if>
155
     </select>
167
     </select>
156
 
168
 
157
     <select id="selectShareCount" resultType="java.util.Map">
169
     <select id="selectShareCount" resultType="java.util.Map">
354
         <if test="startDate == null or endDate == null ">
366
         <if test="startDate == null or endDate == null ">
355
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
367
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
356
         </if>
368
         </if>
369
+        <if test="taPersonBuildings != null and taPersonBuildings.size > 0">
370
+            AND t.building_id in
371
+            <foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
372
+                #{taPersonBuilding.buildingId}
373
+            </foreach>
374
+        </if>
357
         GROUP BY
375
         GROUP BY
358
         DATE_FORMAT( t.visit_time, '%Y-%m-%d' )
376
         DATE_FORMAT( t.visit_time, '%Y-%m-%d' )
359
         ) AS temp ON temp_date.date = DATE_FORMAT( temp.create_date, '%Y-%m-%d' )
377
         ) AS temp ON temp_date.date = DATE_FORMAT( temp.create_date, '%Y-%m-%d' )
405
         <if test="startDate == null or endDate == null">
423
         <if test="startDate == null or endDate == null">
406
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
424
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
407
         </if>
425
         </if>
426
+        <if test="taPersonBuildings != null and taPersonBuildings.size > 0">
427
+            AND t.building_id in
428
+            <foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
429
+                #{taPersonBuilding.buildingId}
430
+            </foreach>
431
+        </if>
408
         GROUP BY
432
         GROUP BY
409
         DATE_FORMAT(t.visit_time, '%Y-%m-%d'),
433
         DATE_FORMAT(t.visit_time, '%Y-%m-%d'),
410
         person_id) as visitPersonCount GROUP BY DATE_FORMAT(visitPersonCount.create_date, '%Y-%m-%d')
434
         person_id) as visitPersonCount GROUP BY DATE_FORMAT(visitPersonCount.create_date, '%Y-%m-%d')
460
         <if test="startDate == null or endDate == null">
484
         <if test="startDate == null or endDate == null">
461
             AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
485
             AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
462
         </if>
486
         </if>
487
+        <if test="taPersonBuildings != null and taPersonBuildings.size > 0">
488
+            AND t.building_id in
489
+            <foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
490
+                #{taPersonBuilding.buildingId}
491
+            </foreach>
492
+        </if>
463
         ) AS temp4
493
         ) AS temp4
464
         GROUP BY
494
         GROUP BY
465
         DATE_FORMAT( temp4.create_date, '%Y-%m-%d' )
495
         DATE_FORMAT( temp4.create_date, '%Y-%m-%d' )
614
         <if test="startDate == null or endDate == null ">
644
         <if test="startDate == null or endDate == null ">
615
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
645
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
616
         </if>
646
         </if>
647
+        <if test="taPersonBuildings != null and taPersonBuildings.size > 0">
648
+            AND t.building_id in
649
+            <foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
650
+                #{taPersonBuilding.buildingId}
651
+            </foreach>
652
+        </if>
617
         GROUP BY
653
         GROUP BY
618
         DATE_FORMAT( t.visit_time, '%Y-%m-%d' )
654
         DATE_FORMAT( t.visit_time, '%Y-%m-%d' )
619
         ) AS temp2 ON temp_date.date = DATE_FORMAT( temp2.create_date, '%Y-%m-%d' )
655
         ) AS temp2 ON temp_date.date = DATE_FORMAT( temp2.create_date, '%Y-%m-%d' )
642
         <if test="startDate == null or endDate == null">
678
         <if test="startDate == null or endDate == null">
643
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
679
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
644
         </if>
680
         </if>
681
+        <if test="taPersonBuildings != null and taPersonBuildings.size > 0">
682
+            AND t.building_id in
683
+            <foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
684
+                #{taPersonBuilding.buildingId}
685
+            </foreach>
686
+        </if>
645
         GROUP BY
687
         GROUP BY
646
         DATE_FORMAT(t.visit_time, '%Y-%m-%d'),
688
         DATE_FORMAT(t.visit_time, '%Y-%m-%d'),
647
         person_id) as visitPersonCount GROUP BY DATE_FORMAT(visitPersonCount.create_date, '%Y-%m-%d')
689
         person_id) as visitPersonCount GROUP BY DATE_FORMAT(visitPersonCount.create_date, '%Y-%m-%d')
826
         <if test="startDate == null or endDate == null ">
868
         <if test="startDate == null or endDate == null ">
827
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
869
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
828
         </if>
870
         </if>
871
+        <if test="taPersonBuildings != null and taPersonBuildings.size > 0">
872
+            AND t.building_id in
873
+            <foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
874
+                #{taPersonBuilding.buildingId}
875
+            </foreach>
876
+        </if>
829
         GROUP BY
877
         GROUP BY
830
         DATE_FORMAT( t.visit_time, '%Y-%m-%d' )
878
         DATE_FORMAT( t.visit_time, '%Y-%m-%d' )
831
         ) AS temp2 ON temp_date.date = DATE_FORMAT( temp2.create_date, '%Y-%m-%d' )
879
         ) AS temp2 ON temp_date.date = DATE_FORMAT( temp2.create_date, '%Y-%m-%d' )
853
         <if test="startDate == null or endDate == null">
901
         <if test="startDate == null or endDate == null">
854
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
902
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
855
         </if>
903
         </if>
904
+        <if test="taPersonBuildings != null and taPersonBuildings.size > 0">
905
+            AND t.building_id in
906
+            <foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
907
+                #{taPersonBuilding.buildingId}
908
+            </foreach>
909
+        </if>
856
         GROUP BY
910
         GROUP BY
857
         DATE_FORMAT(t.visit_time, '%Y-%m-%d'),
911
         DATE_FORMAT(t.visit_time, '%Y-%m-%d'),
858
         person_id) as visitPersonCount GROUP BY DATE_FORMAT(visitPersonCount.create_date, '%Y-%m-%d')
912
         person_id) as visitPersonCount GROUP BY DATE_FORMAT(visitPersonCount.create_date, '%Y-%m-%d')
1027
         <if test="startDate == null or endDate == null ">
1081
         <if test="startDate == null or endDate == null ">
1028
             AND a.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
1082
             AND a.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
1029
         </if>
1083
         </if>
1030
-        group by a.person_id, be_share, tagert_type
1084
+        group by a.person_id
1085
+<!--        , be_share, tagert_type-->
1031
         ) as sharePersonNum group by sharePersonNum.be_share, sharePersonNum.tagert_type
1086
         ) as sharePersonNum group by sharePersonNum.be_share, sharePersonNum.tagert_type
1032
         ) as sharePersonNum on sharePersonNum.be_share = activity.activityId and sharePersonNum.tagert_type =
1087
         ) as sharePersonNum on sharePersonNum.be_share = activity.activityId and sharePersonNum.tagert_type =
1033
         activity.activityType
1088
         activity.activityType
1372
             and t.be_share = #{activityId}
1427
             and t.be_share = #{activityId}
1373
         </if>
1428
         </if>
1374
         <if test="activityType != null and activityType != ''">
1429
         <if test="activityType != null and activityType != ''">
1375
-            and t.tagert_type = #{activityType}
1430
+            and (case when #{activityType} = 'live' then t.tagert_type in ('liveApp', 'livePost') else t.tagert_type = #{activityType}
1431
+            end)
1376
         </if>
1432
         </if>
1377
         <if test="sharePersonType != null and sharePersonType != ''">
1433
         <if test="sharePersonType != null and sharePersonType != ''">
1378
             and f.person_type = #{sharePersonType}
1434
             and f.person_type = #{sharePersonType}
1404
                     and t.be_share = #{activityId}
1460
                     and t.be_share = #{activityId}
1405
                 </if>
1461
                 </if>
1406
                 <if test="activityType != null and activityType != ''">
1462
                 <if test="activityType != null and activityType != ''">
1407
-                    and t.tagert_type = #{activityType}
1463
+                    and (case when #{activityType} = 'live' then t.tagert_type in ('liveApp', 'livePost') else t.tagert_type = #{activityType}
1464
+                    end)
1408
                 </if>
1465
                 </if>
1409
                 group by person_id
1466
                 group by person_id
1410
             ) as temp
1467
             ) as temp
1512
             and t.be_share = #{activityId}
1569
             and t.be_share = #{activityId}
1513
         </if>
1570
         </if>
1514
         <if test="activityType != null and activityType != ''">
1571
         <if test="activityType != null and activityType != ''">
1515
-            and t.tagert_type = #{activityType}
1572
+            and (case when #{activityType} = 'live' then t.tagert_type in ('liveApp', 'livePost') else t.tagert_type = #{activityType}
1573
+            end)
1516
         </if>
1574
         </if>
1517
         <if test="sharePersonType != null and sharePersonType != ''">
1575
         <if test="sharePersonType != null and sharePersonType != ''">
1518
             and f.person_type = #{sharePersonType}
1576
             and f.person_type = #{sharePersonType}
1544
             and t.be_share = #{activityId}
1602
             and t.be_share = #{activityId}
1545
         </if>
1603
         </if>
1546
         <if test="activityType != null and activityType != ''">
1604
         <if test="activityType != null and activityType != ''">
1547
-            and t.tagert_type = #{activityType}
1605
+            and (case when #{activityType} = 'live' then t.tagert_type in ('liveApp', 'livePost') else t.tagert_type = #{activityType}
1606
+            end)
1548
         </if>
1607
         </if>
1549
         group by person_id
1608
         group by person_id
1550
         ) as temp
1609
         ) as temp