瀏覽代碼

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

张延森 5 年之前
父節點
當前提交
affca7aefa

+ 5
- 2
src/main/java/com/huiju/estateagents/controller/StatisticalController.java 查看文件

@@ -65,8 +65,11 @@ public class StatisticalController {
65 65
                                            @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
66 66
                                            @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
67 67
                                            @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDate endDate,
68
-                                           @RequestParam(value = "buildingId", required = false) String buildingId) {
69
-        return iStatisticalService.selectUserBehavior(pageNum, pageSize, startDate, endDate, buildingId);
68
+                                           @RequestParam(value = "buildingId", required = false) String buildingId,
69
+                                           @RequestParam(value = "eventType", required = false) String eventType,
70
+                                           @RequestParam(value = "event", required = false) String event,
71
+                                           @RequestParam(value = "activity", required = false) String activity) {
72
+        return iStatisticalService.selectUserBehavior(pageNum, pageSize, startDate, endDate, buildingId, eventType, event, activity);
70 73
     }
71 74
 
72 75
     /**

+ 16
- 0
src/main/java/com/huiju/estateagents/entity/TaPersonVisitRecord.java 查看文件

@@ -81,6 +81,22 @@ public class TaPersonVisitRecord implements Serializable {
81 81
 
82 82
     private String targetId;
83 83
 
84
+    /**
85
+     * 用户名称
86
+     */
87
+    @TableField(exist = false)
88
+    private String userName;
89
+
90
+    /**
91
+     * 事件名称
92
+     */
93
+    @TableField(exist = false)
94
+    private String eventName;
84 95
 
96
+    /**
97
+     * 访问次数
98
+     */
99
+    @TableField(exist = false)
100
+    private Integer accessCount;
85 101
 
86 102
 }

+ 7
- 1
src/main/java/com/huiju/estateagents/mapper/TaPersonMapper.java 查看文件

@@ -86,7 +86,13 @@ public interface TaPersonMapper extends BaseMapper<TaPerson> {
86 86
      * @param endDate
87 87
      * @return
88 88
      */
89
-    List<PersonPO> selectUserBehavior(@Param("personType") String personType, @Param("startDate")LocalDate startDate, @Param("endDate")LocalDate endDate, @Param("buildingId") String buildingId);
89
+    List<PersonPO> selectUserBehavior(@Param("personType") String personType,
90
+                                      @Param("startDate")LocalDate startDate,
91
+                                      @Param("endDate")LocalDate endDate,
92
+                                      @Param("buildingId") String buildingId,
93
+                                      @Param("eventType") String eventType,
94
+                                      @Param("event") String event,
95
+                                      @Param("activity") String activity);
90 96
 
91 97
     /**
92 98
      * 活跃用户数 / 最近新增的用户数

+ 5
- 1
src/main/java/com/huiju/estateagents/mapper/TaPersonVisitRecordMapper.java 查看文件

@@ -30,7 +30,11 @@ public interface TaPersonVisitRecordMapper extends BaseMapper<TaPersonVisitRecor
30 30
      * @param page
31 31
      * @return
32 32
      */
33
-    IPage<TaPersonVisitRecord> selectAll(IPage<TaPersonVisitRecord> page, String buildingId);
33
+    IPage<TaPersonVisitRecord> selectAll(IPage<TaPersonVisitRecord> page,
34
+                                         @Param("buildingId") String buildingId,
35
+                                         @Param("eventType") String eventType,
36
+                                         @Param("event") String event,
37
+                                         @Param("activity") String activity);
34 38
 
35 39
 
36 40
     /**

+ 8
- 1
src/main/java/com/huiju/estateagents/service/IStatisticalService.java 查看文件

@@ -69,7 +69,14 @@ public interface IStatisticalService {
69 69
      * @param endDate
70 70
      * @return
71 71
      */
72
-    ResponseBean selectUserBehavior(Integer pageNum, Integer pageSize, LocalDate startDate,LocalDate endDate, String buildingId);
72
+    ResponseBean selectUserBehavior(Integer pageNum,
73
+                                    Integer pageSize,
74
+                                    LocalDate startDate,
75
+                                    LocalDate endDate,
76
+                                    String buildingId,
77
+                                    String eventType,
78
+                                    String event,
79
+                                    String activity);
73 80
 
74 81
     /**
75 82
      * 行为分析的 具体数据列表

+ 11
- 4
src/main/java/com/huiju/estateagents/service/impl/StatisticalServiceImpl.java 查看文件

@@ -61,7 +61,7 @@ public class StatisticalServiceImpl implements IStatisticalService {
61 61
         Integer selectRecentlyCount = taPersonMapper.selectRecentlyCount(CommConstant.PERSON_REALTY_CONSULTANT, null, null);
62 62
 
63 63
         // 用户行为
64
-        List<PersonPO> selectUserBehavior = taPersonMapper.selectUserBehavior(CommConstant.PERSON_REALTY_CONSULTANT, null, null, null);
64
+        List<PersonPO> selectUserBehavior = taPersonMapper.selectUserBehavior(CommConstant.PERSON_REALTY_CONSULTANT, null, null, null, null, null, null);
65 65
 
66 66
         // 用户活跃数
67 67
         List<Map<String, Object>> selectActiveUserCount = taPersonMapper.selectActiveUserCount(CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.DAY, null, null);
@@ -163,14 +163,21 @@ public class StatisticalServiceImpl implements IStatisticalService {
163 163
     }
164 164
 
165 165
     @Override
166
-    public ResponseBean selectUserBehavior(Integer pageNum, Integer pageSize, LocalDate startDate, LocalDate endDate, String buildingId) {
166
+    public ResponseBean selectUserBehavior(Integer pageNum,
167
+                                           Integer pageSize,
168
+                                           LocalDate startDate,
169
+                                           LocalDate endDate,
170
+                                           String buildingId,
171
+                                           String eventType,
172
+                                           String event,
173
+                                           String activity) {
167 174
         ResponseBean responseBean = new ResponseBean();
168 175
 
169 176
         // 用户行为
170
-        List<PersonPO> selectUserBehavior = taPersonMapper.selectUserBehavior(CommConstant.PERSON_REALTY_CONSULTANT, startDate, endDate, buildingId);
177
+        List<PersonPO> selectUserBehavior = taPersonMapper.selectUserBehavior(CommConstant.PERSON_REALTY_CONSULTANT, startDate, endDate, buildingId, eventType, event, activity);
171 178
 
172 179
         IPage<TaPersonVisitRecord> page = new Page<>(pageNum, pageSize);
173
-        IPage<TaPersonVisitRecord> visitRecordIPage = taPersonVisitRecordMapper.selectAll(page, buildingId);
180
+        IPage<TaPersonVisitRecord> visitRecordIPage = taPersonVisitRecordMapper.selectAll(page, buildingId, eventType, event, activity);
174 181
 
175 182
         Map<String, Object> map = new HashMap<>();
176 183
         map.put("selectUserBehavior", selectUserBehavior);

+ 10
- 0
src/main/resources/mapper/TaPersonMapper.xml 查看文件

@@ -201,6 +201,16 @@ FROM
201 201
         <if test="buildingId != null and buildingId != ''">
202 202
             and tpvr.building_id = #{buildingId}
203 203
         </if>
204
+        <if test="eventType != null and eventType != ''">
205
+            and tpvr.event_type = #{eventType}
206
+        </if>
207
+        <if test="event != null and event != ''">
208
+            and tpvr.event = #{event}
209
+        </if>
210
+        <if test="activity != null and activity != ''">
211
+            and tpvr.activity = #{activity}
212
+        </if>
213
+
204 214
         GROUP BY  tpvr.event_type, DATE_FORMAT( tpvr.visit_time , '%Y-%m-%d' )
205 215
         ) AS temp ON temp_date.date = temp.date and temp_date.type_id = temp.event_type
206 216
         order by temp_date.date asc

+ 17
- 5
src/main/resources/mapper/TaPersonVisitRecordMapper.xml 查看文件

@@ -6,19 +6,31 @@
6 6
         where person_id = #{personId}
7 7
     </select>
8 8
 
9
-    <select id="selectAll">
9
+    <select id="selectAll" resultType="com.huiju.estateagents.entity.TaPersonVisitRecord">
10 10
         SELECT
11 11
             tpvr.*,
12
-            tp.name,
12
+            tp.name as userName,
13
+            tbe.event_name as eventName,
13 14
             COUNT(1) as accessCount
14 15
         FROM
15 16
             ta_person_visit_record tpvr
16 17
             LEFT JOIN ta_person tp ON tpvr.person_id = tp.person_id
17
-            <where>
18
+            LEFT JOIN td_biz_event tbe on tpvr.event = tbe.event_code
19
+            <trim prefix="where" prefixOverrides="and | or">
18 20
                 <if test="buildingId != null and buildingId != ''">
19
-                    tpvr.building_id = #{buildingId}
21
+                    and tpvr.building_id = #{buildingId}
20 22
                 </if>
21
-            </where>
23
+                <if test="eventType != null and eventType != ''">
24
+                    and tpvr.event_type = #{eventType}
25
+                </if>
26
+                <if test="event != null and event != ''">
27
+                    and tpvr.event = #{event}
28
+                </if>
29
+                <if test="activity != null and activity != ''">
30
+                    and tpvr.activity = #{activity}
31
+                </if>
32
+            </trim>
33
+
22 34
         GROUP BY tpvr.person_id, tpvr.event
23 35
     </select>
24 36