魏超 преди 5 години
родител
ревизия
f844c6e7ca

+ 18
- 3
src/main/java/com/huiju/estateagents/statistic/mapper/TaActicityStaticMapper.java Целия файл

@@ -63,11 +63,26 @@ public interface TaActicityStaticMapper {
63 63
                                                      @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
64 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 87
     IPage<StatisicAttractUser> selectTableData(
73 88
             IPage<StatisicAttractUser> attractUserIPage,

+ 3
- 3
src/main/java/com/huiju/estateagents/statistic/service/impl/TaActivityStaticServiceImpl.java Целия файл

@@ -52,9 +52,9 @@ public class TaActivityStaticServiceImpl {
52 52
         // 新增用户数
53 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 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 60
         for (Map<String, Object> ssc : selectShareCount){

+ 64
- 5
src/main/resources/mapper/statistic/TaActivityStaticMapper.xml Целия файл

@@ -131,6 +131,12 @@
131 131
         <if test="startDate == null or endDate == null">
132 132
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
133 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 140
         GROUP BY
135 141
         DATE_FORMAT(t.visit_time, '%Y-%m-%d'),
136 142
         person_id) as visitPersonCount
@@ -152,6 +158,12 @@
152 158
         <if test="endDate != null">
153 159
             and t.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
154 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 167
     </select>
156 168
 
157 169
     <select id="selectShareCount" resultType="java.util.Map">
@@ -354,6 +366,12 @@
354 366
         <if test="startDate == null or endDate == null ">
355 367
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
356 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 375
         GROUP BY
358 376
         DATE_FORMAT( t.visit_time, '%Y-%m-%d' )
359 377
         ) AS temp ON temp_date.date = DATE_FORMAT( temp.create_date, '%Y-%m-%d' )
@@ -405,6 +423,12 @@
405 423
         <if test="startDate == null or endDate == null">
406 424
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
407 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 432
         GROUP BY
409 433
         DATE_FORMAT(t.visit_time, '%Y-%m-%d'),
410 434
         person_id) as visitPersonCount GROUP BY DATE_FORMAT(visitPersonCount.create_date, '%Y-%m-%d')
@@ -460,6 +484,12 @@
460 484
         <if test="startDate == null or endDate == null">
461 485
             AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
462 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 493
         ) AS temp4
464 494
         GROUP BY
465 495
         DATE_FORMAT( temp4.create_date, '%Y-%m-%d' )
@@ -614,6 +644,12 @@
614 644
         <if test="startDate == null or endDate == null ">
615 645
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
616 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 653
         GROUP BY
618 654
         DATE_FORMAT( t.visit_time, '%Y-%m-%d' )
619 655
         ) AS temp2 ON temp_date.date = DATE_FORMAT( temp2.create_date, '%Y-%m-%d' )
@@ -642,6 +678,12 @@
642 678
         <if test="startDate == null or endDate == null">
643 679
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
644 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 687
         GROUP BY
646 688
         DATE_FORMAT(t.visit_time, '%Y-%m-%d'),
647 689
         person_id) as visitPersonCount GROUP BY DATE_FORMAT(visitPersonCount.create_date, '%Y-%m-%d')
@@ -826,6 +868,12 @@
826 868
         <if test="startDate == null or endDate == null ">
827 869
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
828 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 877
         GROUP BY
830 878
         DATE_FORMAT( t.visit_time, '%Y-%m-%d' )
831 879
         ) AS temp2 ON temp_date.date = DATE_FORMAT( temp2.create_date, '%Y-%m-%d' )
@@ -853,6 +901,12 @@
853 901
         <if test="startDate == null or endDate == null">
854 902
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
855 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 910
         GROUP BY
857 911
         DATE_FORMAT(t.visit_time, '%Y-%m-%d'),
858 912
         person_id) as visitPersonCount GROUP BY DATE_FORMAT(visitPersonCount.create_date, '%Y-%m-%d')
@@ -1027,7 +1081,8 @@
1027 1081
         <if test="startDate == null or endDate == null ">
1028 1082
             AND a.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
1029 1083
         </if>
1030
-        group by a.person_id, be_share, tagert_type
1084
+        group by a.person_id
1085
+<!--        , be_share, tagert_type-->
1031 1086
         ) as sharePersonNum group by sharePersonNum.be_share, sharePersonNum.tagert_type
1032 1087
         ) as sharePersonNum on sharePersonNum.be_share = activity.activityId and sharePersonNum.tagert_type =
1033 1088
         activity.activityType
@@ -1372,7 +1427,8 @@
1372 1427
             and t.be_share = #{activityId}
1373 1428
         </if>
1374 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 1432
         </if>
1377 1433
         <if test="sharePersonType != null and sharePersonType != ''">
1378 1434
             and f.person_type = #{sharePersonType}
@@ -1404,7 +1460,8 @@
1404 1460
                     and t.be_share = #{activityId}
1405 1461
                 </if>
1406 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 1465
                 </if>
1409 1466
                 group by person_id
1410 1467
             ) as temp
@@ -1512,7 +1569,8 @@
1512 1569
             and t.be_share = #{activityId}
1513 1570
         </if>
1514 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 1574
         </if>
1517 1575
         <if test="sharePersonType != null and sharePersonType != ''">
1518 1576
             and f.person_type = #{sharePersonType}
@@ -1544,7 +1602,8 @@
1544 1602
             and t.be_share = #{activityId}
1545 1603
         </if>
1546 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 1607
         </if>
1549 1608
         group by person_id
1550 1609
         ) as temp