Browse Source

新需求

傅行帆 5 years ago
parent
commit
f632bc6ba4

+ 33
- 3
src/main/java/com/huiju/estateagents/controller/TaChannelController.java View File

@@ -264,7 +264,7 @@ public class TaChannelController extends BaseController {
264 264
     }
265 265
 
266 266
     /**
267
-     * 注册人数统计
267
+     * 渠道注册用户列表
268 268
      * @return
269 269
      */
270 270
     @GetMapping(value = "/admin/channel/introduction/newuserList")
@@ -274,8 +274,38 @@ public class TaChannelController extends BaseController {
274 274
                                        @RequestParam(value = "targetType", required = false) String targetType,
275 275
                                        @RequestParam(value = "buildingId", required = false) String buildingId,
276 276
                                        @RequestParam(value = "channelId", required = false) Integer channelId,
277
-                                       @RequestParam(value = "statisticType", required = false) String statisticType,
278 277
                                        HttpServletRequest request) {
279
-        return taChannelService.getNewuserList(pageNum, pageSize, getOrgId(request), channelId, targetId, targetType, buildingId,statisticType);
278
+        return taChannelService.getNewuserList(pageNum, pageSize, getOrgId(request), channelId, targetId, targetType, buildingId);
279
+    }
280
+
281
+    /**
282
+     * 渠道访问次数列表
283
+     * @return
284
+     */
285
+    @GetMapping(value = "/admin/channel/introduction/visitNumList")
286
+    public ResponseBean getVisitNumList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
287
+                                       @RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize,
288
+                                       @RequestParam(value = "targetId", required = false) String targetId,
289
+                                       @RequestParam(value = "targetType", required = false) String targetType,
290
+                                       @RequestParam(value = "buildingId", required = false) String buildingId,
291
+                                       @RequestParam(value = "channelId", required = false) Integer channelId,
292
+                                       HttpServletRequest request) {
293
+        return taChannelService.getVisitNumList(pageNum, pageSize, getOrgId(request), channelId, targetId, targetType, buildingId);
294
+    }
295
+
296
+
297
+    /**
298
+     * 渠道访问人数列表
299
+     * @return
300
+     */
301
+    @GetMapping(value = "/admin/channel/introduction/personNumList")
302
+    public ResponseBean getPersonNumList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
303
+                                        @RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize,
304
+                                        @RequestParam(value = "targetId", required = false) String targetId,
305
+                                        @RequestParam(value = "targetType", required = false) String targetType,
306
+                                        @RequestParam(value = "buildingId", required = false) String buildingId,
307
+                                        @RequestParam(value = "channelId", required = false) Integer channelId,
308
+                                        HttpServletRequest request) {
309
+        return taChannelService.getPersonNumList(pageNum, pageSize, getOrgId(request), channelId, targetId, targetType, buildingId);
280 310
     }
281 311
 }

+ 79
- 0
src/main/java/com/huiju/estateagents/excel/ActivityStatistics/ChannelVisitNum.java View File

@@ -0,0 +1,79 @@
1
+package com.huiju.estateagents.excel.ActivityStatistics;
2
+
3
+import com.alibaba.excel.annotation.ExcelProperty;
4
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
5
+import lombok.Data;
6
+
7
+@Data
8
+public class ChannelVisitNum {
9
+    /**
10
+     * 姓名
11
+     */
12
+    @ColumnWidth(15)
13
+    @ExcelProperty(value = "姓名", index = 0)
14
+    private String nickName;
15
+
16
+    /**
17
+     * 电话
18
+     */
19
+    @ColumnWidth(15)
20
+    @ExcelProperty(value = "电话", index = 1)
21
+    private String phone;
22
+
23
+    /**
24
+     * 性别
25
+     */
26
+    @ColumnWidth(15)
27
+    @ExcelProperty(value = "性别", index = 2)
28
+    private String gender;
29
+
30
+    /**
31
+     * 归属地
32
+     */
33
+    @ColumnWidth(15)
34
+    @ExcelProperty(value = "归属地", index = 3)
35
+    private String province;
36
+
37
+    /**
38
+     * 来源渠道
39
+     */
40
+    @ColumnWidth(15)
41
+    @ExcelProperty(value = "来源渠道", index = 4)
42
+    private String personFrom;
43
+
44
+    /**
45
+     * 置业顾问
46
+     */
47
+    @ColumnWidth(15)
48
+    @ExcelProperty(value = "置业顾问", index = 5)
49
+    private String realtyConsultant;
50
+
51
+    /**
52
+     * 置业顾问电话
53
+     */
54
+    @ColumnWidth(15)
55
+    @ExcelProperty(value = "置业顾问电话", index = 6)
56
+    private String realtyConsultantPhone;
57
+
58
+    /**
59
+     * 分享者
60
+     */
61
+    @ColumnWidth(15)
62
+    @ExcelProperty(value = "分享者", index = 7)
63
+    private String sharePersonName;
64
+
65
+    /**
66
+     * 分享者电话
67
+     */
68
+    @ColumnWidth(15)
69
+    @ExcelProperty(value = "分享者电话", index = 8)
70
+    private String sharePersonPhone;
71
+
72
+    /**
73
+     * 访问时间
74
+     */
75
+    @ColumnWidth(15)
76
+    @ExcelProperty(value = "访问时间", index = 9)
77
+    private String visitDate;
78
+
79
+}

+ 86
- 0
src/main/java/com/huiju/estateagents/excel/ActivityStatistics/ChannelVisitPersonNum.java View File

@@ -0,0 +1,86 @@
1
+package com.huiju.estateagents.excel.ActivityStatistics;
2
+
3
+import com.alibaba.excel.annotation.ExcelProperty;
4
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
5
+import lombok.Data;
6
+
7
+@Data
8
+public class ChannelVisitPersonNum {
9
+    /**
10
+     * 姓名
11
+     */
12
+    @ColumnWidth(15)
13
+    @ExcelProperty(value = "姓名", index = 0)
14
+    private String nickName;
15
+
16
+    /**
17
+     * 电话
18
+     */
19
+    @ColumnWidth(15)
20
+    @ExcelProperty(value = "电话", index = 1)
21
+    private String phone;
22
+
23
+    /**
24
+     * 性别
25
+     */
26
+    @ColumnWidth(15)
27
+    @ExcelProperty(value = "性别", index = 2)
28
+    private String gender;
29
+
30
+    /**
31
+     * 归属地
32
+     */
33
+    @ColumnWidth(15)
34
+    @ExcelProperty(value = "归属地", index = 3)
35
+    private String province;
36
+
37
+    /**
38
+     * 来源渠道
39
+     */
40
+    @ColumnWidth(15)
41
+    @ExcelProperty(value = "来源渠道", index = 4)
42
+    private String personFrom;
43
+
44
+    /**
45
+     * 置业顾问
46
+     */
47
+    @ColumnWidth(15)
48
+    @ExcelProperty(value = "置业顾问", index = 5)
49
+    private String realtyConsultant;
50
+
51
+    /**
52
+     * 置业顾问电话
53
+     */
54
+    @ColumnWidth(15)
55
+    @ExcelProperty(value = "置业顾问电话", index = 6)
56
+    private String realtyConsultantPhone;
57
+
58
+    /**
59
+     * 推广人
60
+     */
61
+    @ColumnWidth(15)
62
+    @ExcelProperty(value = "推广人", index = 7)
63
+    private String sharePersonName;
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;
77
+
78
+    /**
79
+     * 访问次数
80
+     */
81
+    @ColumnWidth(15)
82
+    @ExcelProperty(value = "访问次数", index = 8)
83
+    private String visitNum;
84
+
85
+
86
+}

+ 8
- 2
src/main/java/com/huiju/estateagents/mapper/TaChannelMapper.java View File

@@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.huiju.estateagents.entity.TaChannel;
6 6
 import com.huiju.estateagents.entity.TsActivityDaily;
7
-import com.huiju.estateagents.excel.ActivityStatistics.AddRegistNum;
7
+import com.huiju.estateagents.excel.ActivityStatistics.ChannelAddRegistNum;
8
+import com.huiju.estateagents.excel.ActivityStatistics.ChannelVisitNum;
9
+import com.huiju.estateagents.excel.ActivityStatistics.ChannelVisitPersonNum;
8 10
 import org.apache.ibatis.annotations.Mapper;
9 11
 import org.apache.ibatis.annotations.Param;
10 12
 
@@ -55,5 +57,9 @@ public interface TaChannelMapper extends BaseMapper<TaChannel> {
55 57
      */
56 58
     IPage<TsActivityDaily> getChannelIntroductionList(IPage<TsActivityDaily> pg,@Param("orgId") Integer orgId,@Param("startDate") LocalDate startDate,@Param("endDate") LocalDate endDate,@Param("channelType") String channelType,@Param("buildingId") String buildingId,@Param("channelId") Integer channelId);
57 59
 
58
-    IPage<AddRegistNum> getActivityNewuserList(IPage<AddRegistNum> iPage,@Param("orgId") Integer orgId, @Param("channelId") Integer channelId,@Param("activityId") String activityId,@Param("activityType") String activityType,@Param("buildingId") String buildingId);
60
+    IPage<ChannelAddRegistNum> getChannelNewuserList(IPage<ChannelAddRegistNum> iPage, @Param("orgId") Integer orgId, @Param("channelId") Integer channelId, @Param("activityId") String activityId, @Param("activityType") String activityType, @Param("buildingId") String buildingId);
61
+
62
+    IPage<ChannelVisitNum> getChannelVisitNumList(IPage<ChannelVisitNum> iPage,@Param("orgId") Integer orgId,@Param("channelId") Integer channelId,@Param("targetId") String targetId,@Param("targetType") String targetType,@Param("buildingId") String buildingId);
63
+
64
+    IPage<ChannelVisitPersonNum> getChannelPersonNumList(IPage<ChannelVisitPersonNum> iPage,@Param("orgId") Integer orgId,@Param("channelId") Integer channelId,@Param("targetId") String targetId,@Param("targetType") String targetType,@Param("buildingId") String buildingId);
59 65
 }

+ 27
- 2
src/main/java/com/huiju/estateagents/service/TaChannelService.java View File

@@ -37,8 +37,33 @@ public interface TaChannelService extends IService<TaChannel> {
37 37
      * @param targetId
38 38
      * @param targetType
39 39
      * @param buildingId
40
-     * @param statisticType
41 40
      * @return
42 41
      */
43
-    ResponseBean getNewuserList(Integer pageNum, Integer pageSize, Integer orgId, Integer channelId, String targetId, String targetType, String buildingId, String statisticType);
42
+    ResponseBean getNewuserList(Integer pageNum, Integer pageSize, Integer orgId, Integer channelId, String targetId, String targetType, String buildingId);
43
+
44
+    /**
45
+     * 获取渠道下的访问次数列表
46
+     * @param pageNum
47
+     * @param pageSize
48
+     * @param orgId
49
+     * @param channelId
50
+     * @param targetId
51
+     * @param targetType
52
+     * @param buildingId
53
+     * @return
54
+     */
55
+    ResponseBean getVisitNumList(Integer pageNum, Integer pageSize, Integer orgId, Integer channelId, String targetId, String targetType, String buildingId);
56
+
57
+    /**
58
+     * 获取渠道下的访问人数列表
59
+     * @param pageNum
60
+     * @param pageSize
61
+     * @param orgId
62
+     * @param channelId
63
+     * @param targetId
64
+     * @param targetType
65
+     * @param buildingId
66
+     * @return
67
+     */
68
+    ResponseBean getPersonNumList(Integer pageNum, Integer pageSize, Integer orgId, Integer channelId, String targetId, String targetType, String buildingId);
44 69
 }

+ 45
- 5
src/main/java/com/huiju/estateagents/service/impl/TaChannelServiceImpl.java View File

@@ -6,7 +6,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
6 6
 import com.huiju.estateagents.base.ResponseBean;
7 7
 import com.huiju.estateagents.entity.TaChannel;
8 8
 import com.huiju.estateagents.entity.TsActivityDaily;
9
-import com.huiju.estateagents.excel.ActivityStatistics.AddRegistNum;
9
+import com.huiju.estateagents.excel.ActivityStatistics.ChannelAddRegistNum;
10
+import com.huiju.estateagents.excel.ActivityStatistics.ChannelVisitNum;
11
+import com.huiju.estateagents.excel.ActivityStatistics.ChannelVisitPersonNum;
12
+import com.huiju.estateagents.excel.ActivityStatistics.VisitPersonNum;
10 13
 import com.huiju.estateagents.mapper.TaChannelMapper;
11 14
 import com.huiju.estateagents.service.TaChannelService;
12 15
 import org.springframework.beans.factory.annotation.Autowired;
@@ -57,13 +60,50 @@ public class TaChannelServiceImpl extends ServiceImpl<TaChannelMapper, TaChannel
57 60
      * @param targetId
58 61
      * @param targetType
59 62
      * @param buildingId
60
-     * @param statisticType
61 63
      * @return
62 64
      */
63 65
     @Override
64
-    public ResponseBean getNewuserList(Integer pageNum, Integer pageSize, Integer orgId, Integer channelId, String targetId, String targetType, String buildingId, String statisticType) {
65
-        IPage<AddRegistNum> iPage = new Page<>(pageNum, pageSize);
66
-        IPage<AddRegistNum> data = taChannelMapper.getActivityNewuserList(iPage, orgId, channelId, targetId,targetType, buildingId);
66
+    public ResponseBean getNewuserList(Integer pageNum, Integer pageSize, Integer orgId, Integer channelId, String targetId, String targetType, String buildingId) {
67
+        IPage<ChannelAddRegistNum> iPage = new Page<>(pageNum, pageSize);
68
+        IPage<ChannelAddRegistNum> data = taChannelMapper.getChannelNewuserList(iPage, orgId, channelId, targetId,targetType, buildingId);
69
+        return ResponseBean.success(data);
70
+    }
71
+
72
+    /**
73
+     * 获取渠道下的访问次数列表
74
+     *
75
+     * @param pageNum
76
+     * @param pageSize
77
+     * @param orgId
78
+     * @param channelId
79
+     * @param targetId
80
+     * @param targetType
81
+     * @param buildingId
82
+     * @return
83
+     */
84
+    @Override
85
+    public ResponseBean getVisitNumList(Integer pageNum, Integer pageSize, Integer orgId, Integer channelId, String targetId, String targetType, String buildingId) {
86
+        IPage<ChannelVisitNum> iPage = new Page<>(pageNum, pageSize);
87
+        IPage<ChannelVisitNum> data = taChannelMapper.getChannelVisitNumList(iPage, orgId, channelId, targetId, targetType, buildingId);
88
+        return ResponseBean.success(data);
89
+    }
90
+
91
+    /**
92
+     * 获取渠道下的访问人数列表
93
+     *
94
+     * @param pageNum
95
+     * @param pageSize
96
+     * @param orgId
97
+     * @param channelId
98
+     * @param targetId
99
+     * @param targetType
100
+     * @param buildingId
101
+     * @return
102
+     */
103
+    @Override
104
+    public ResponseBean getPersonNumList(Integer pageNum, Integer pageSize, Integer orgId, Integer channelId, String targetId, String targetType, String buildingId) {
105
+        IPage<ChannelVisitPersonNum> iPage = new Page<>(pageNum, pageSize);
106
+        IPage<ChannelVisitPersonNum> data = taChannelMapper.getChannelPersonNumList(iPage, orgId, channelId, targetId, targetType, buildingId);
67 107
         return ResponseBean.success(data);
68 108
     }
69 109
 }

+ 105
- 1
src/main/resources/mapper/TaChannelMapper.xml View File

@@ -86,7 +86,7 @@
86 86
             and building_id = #{buildingId}
87 87
         </if>
88 88
     </select>
89
-    <select id="getActivityNewuserList"
89
+    <select id="getChannelNewuserList"
90 90
             resultType="com.huiju.estateagents.excel.ActivityStatistics.ChannelAddRegistNum">
91 91
         SELECT
92 92
         a.nickname, a.phone,
@@ -118,5 +118,109 @@
118 118
         </if>
119 119
         group by t.person_id order by t.create_date desc
120 120
     </select>
121
+    <select id="getChannelVisitNumList" resultType="com.huiju.estateagents.excel.ActivityStatistics.ChannelVisitNum">
122
+        select
123
+        a.nickname, a.phone,
124
+        if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
125
+        a.province,
126
+        b1.scene_alias as personFrom,
127
+        GROUP_CONCAT(d.user_name) as realtyConsultant,
128
+        GROUP_CONCAT(d.phone) as realtyConsultantPhone,
129
+        e.nickname as sharePersonName,
130
+        e.phone as sharePersonPhone,
131
+        t.visit_time as visitDate
132
+        From (
133
+        SELECT
134
+        t.person_id, t.visit_time, t.share_person_id
135
+        FROM
136
+        ta_person_visit_record t
137
+        WHERE
138
+        t.`event` = 'detail'
139
+        AND t.event_type IN (
140
+        'activity',
141
+        'help',
142
+        'group',
143
+        'h5'
144
+        )
145
+        <if test="targetId != null and targetId != ''">
146
+            and t.target_id = #{targetId}
147
+        </if>
148
+        <if test="targetType != null and targetType != ''">
149
+            and (case when #{targetType} = 'activity' then t.target_type = 'dynamic' when #{targetType} = 'h5' then t.event_type = 'h5' else t.target_type = #{targetType}
150
+            end)
151
+        </if>
152
+        <if test="channelId != null and channelId != ''">
153
+            and t.channel_id = #{channelId}
154
+        </if>
155
+        <if test="buildingId != null and buildingId != ''">
156
+            and t.building_id = #{buildingId}
157
+        </if>
158
+        AND t.org_id = #{orgId}
159
+<!--        AND t.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d')-->
160
+<!--        AND t.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d')-->
161
+        ) t
162
+        left join ta_person a on t.person_id = a.person_id
163
+        left join ta_person_from_record b on a.person_id = b.person_id and b.org_id = #{orgId}
164
+        left join td_wx_dict b1 on b.scene_id = b1.scene_id
165
+        LEFT JOIN ta_recommend_customer c on c.person_id = t.person_id
166
+        left join ta_user d on c.realty_consultant = d.user_id
167
+        left join ta_person e on t.share_person_id = e.person_id
168
+        group by t.visit_time
169
+        order by t.visit_time desc
170
+    </select>
171
+    <select id="getChannelPersonNumList"
172
+            resultType="com.huiju.estateagents.excel.ActivityStatistics.ChannelVisitPersonNum">
173
+        select
174
+        a.nickname, a.phone,
175
+        if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
176
+        a.province,
177
+        b1.scene_alias as personFrom,
178
+        GROUP_CONCAT(d.user_name) as realtyConsultant,
179
+        GROUP_CONCAT(d.phone) as realtyConsultantPhone,
180
+        t.create_date as visitDate,
181
+        e.nickName as sharePersonName,
182
+        t.visitNum
183
+        from (
184
+        SELECT
185
+        t.visit_time AS create_date,
186
+        t.person_id,
187
+        count(*) as visitNum
188
+        FROM
189
+        ta_person_visit_record t
190
+        WHERE
191
+        t.`event` = 'detail'
192
+        AND t.event_type IN (
193
+        'activity',
194
+        'help',
195
+        'group',
196
+        'h5'
197
+        )
198
+        AND t.org_id = #{orgId}
199
+<!--        AND t.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d')-->
200
+<!--        AND t.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d')-->
201
+        <if test="targetId != null and targetId != ''">
202
+            and t.target_id = #{targetId}
203
+        </if>
204
+        <if test="targetType != null and targetType != ''">
205
+            and (case when #{targetType} = 'activity' then t.target_type = 'dynamic' when #{targetType} = 'h5' then t.event_type = 'h5' else t.target_type = #{targetType}
206
+            end)
207
+        </if>
208
+        <if test="buildingId != null and buildingId != ''">
209
+            and t.building_id = #{buildingId}
210
+        </if>
211
+        <if test="channelId != null and channelId != ''">
212
+            and t.channel_id = #{channelId}
213
+        </if>
214
+        GROUP BY
215
+        t.person_id ) as t
216
+        left join ta_person a on t.person_id = a.person_id
217
+        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
218
+        left join td_wx_dict b1 on b.scene_id = b1.scene_id
219
+        LEFT JOIN ta_recommend_customer c on c.person_id = t.person_id
220
+        left join ta_user d on c.realty_consultant = d.user_id
221
+        LEFT JOIN ta_person e ON e.person_id = b.share_person_id
222
+        group by t.person_id
223
+        order by t.create_date desc
224
+    </select>
121 225
 
122 226
 </mapper>