傅行帆 5 anos atrás
pai
commit
fb4a51d589

+ 16
- 0
src/main/java/com/huiju/estateagents/controller/TaChannelController.java Ver arquivo

@@ -262,4 +262,20 @@ public class TaChannelController extends BaseController {
262 262
                                                      HttpServletRequest request) {
263 263
         return taChannelService.getChannelIntroductionList(pageNum, pageSize, getOrgId(request), startDate, endDate, channelType, buildingId, channelId);
264 264
     }
265
+
266
+    /**
267
+     * 注册人数统计
268
+     * @return
269
+     */
270
+    @GetMapping(value = "/admin/channel/introduction/newuserList")
271
+    public ResponseBean getNewuserList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
272
+                                       @RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize,
273
+                                       @RequestParam(value = "targetId", required = false) String targetId,
274
+                                       @RequestParam(value = "targetType", required = false) String targetType,
275
+                                       @RequestParam(value = "buildingId", required = false) String buildingId,
276
+                                       @RequestParam(value = "channelId", required = false) Integer channelId,
277
+                                       @RequestParam(value = "statisticType", required = false) String statisticType,
278
+                                       HttpServletRequest request) {
279
+        return taChannelService.getNewuserList(pageNum, pageSize, getOrgId(request), channelId, targetId, targetType, buildingId,statisticType);
280
+    }
265 281
 }

+ 12
- 1
src/main/java/com/huiju/estateagents/entity/TsActivityDaily.java Ver arquivo

@@ -1,12 +1,14 @@
1 1
 package com.huiju.estateagents.entity;
2 2
 
3 3
 import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableField;
4 5
 import com.baomidou.mybatisplus.annotation.TableId;
5
-import java.io.Serializable;
6 6
 import lombok.Data;
7 7
 import lombok.EqualsAndHashCode;
8 8
 import lombok.experimental.Accessors;
9 9
 
10
+import java.io.Serializable;
11
+
10 12
 /**
11 13
  * <p>
12 14
  * 活动统计 
@@ -93,5 +95,14 @@ public class TsActivityDaily implements Serializable {
93 95
      */
94 96
     private Integer newCustomers;
95 97
 
98
+    /**
99
+     * 渠道id
100
+     */
101
+    private Integer channelId;
96 102
 
103
+    /**
104
+     * 统计类型
105
+     */
106
+    @TableField(exist = false)
107
+    private String statisticType;
97 108
 }

+ 45
- 0
src/main/java/com/huiju/estateagents/excel/ActivityStatistics/ChannelAddRegistNum.java Ver arquivo

@@ -0,0 +1,45 @@
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 ChannelAddRegistNum {
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 createDate;
43
+
44
+
45
+}

+ 3
- 0
src/main/java/com/huiju/estateagents/mapper/TaChannelMapper.java Ver arquivo

@@ -4,6 +4,7 @@ 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 8
 import org.apache.ibatis.annotations.Mapper;
8 9
 import org.apache.ibatis.annotations.Param;
9 10
 
@@ -53,4 +54,6 @@ public interface TaChannelMapper extends BaseMapper<TaChannel> {
53 54
      * @return
54 55
      */
55 56
     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
+
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);
56 59
 }

+ 14
- 0
src/main/java/com/huiju/estateagents/service/TaChannelService.java Ver arquivo

@@ -27,4 +27,18 @@ public interface TaChannelService extends IService<TaChannel> {
27 27
      * @return
28 28
      */
29 29
     ResponseBean getChannelIntroductionList(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String channelType, String buildingId, Integer channelId);
30
+
31
+    /**
32
+     * 获取注册用户列表
33
+     * @param pageNum
34
+     * @param pageSize
35
+     * @param orgId
36
+     * @param channelId
37
+     * @param targetId
38
+     * @param targetType
39
+     * @param buildingId
40
+     * @param statisticType
41
+     * @return
42
+     */
43
+    ResponseBean getNewuserList(Integer pageNum, Integer pageSize, Integer orgId, Integer channelId, String targetId, String targetType, String buildingId, String statisticType);
30 44
 }

+ 21
- 0
src/main/java/com/huiju/estateagents/service/impl/TaChannelServiceImpl.java Ver arquivo

@@ -6,6 +6,7 @@ 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 10
 import com.huiju.estateagents.mapper.TaChannelMapper;
10 11
 import com.huiju.estateagents.service.TaChannelService;
11 12
 import org.springframework.beans.factory.annotation.Autowired;
@@ -45,4 +46,24 @@ public class TaChannelServiceImpl extends ServiceImpl<TaChannelMapper, TaChannel
45 46
         IPage<TsActivityDaily> data = taChannelMapper.getChannelIntroductionList(pg, orgId,startDate,endDate,channelType,buildingId, channelId);
46 47
         return ResponseBean.success(data);
47 48
     }
49
+
50
+    /**
51
+     * 获取注册用户列表
52
+     *
53
+     * @param pageNum
54
+     * @param pageSize
55
+     * @param orgId
56
+     * @param channelId
57
+     * @param targetId
58
+     * @param targetType
59
+     * @param buildingId
60
+     * @param statisticType
61
+     * @return
62
+     */
63
+    @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);
67
+        return ResponseBean.success(data);
68
+    }
48 69
 }

+ 43
- 11
src/main/resources/mapper/TaChannelMapper.xml Ver arquivo

@@ -39,9 +39,8 @@
39 39
         ta_channel c
40 40
         LEFT JOIN ta_channel_person cp ON c.channel_id = cp.channel_id
41 41
         LEFT JOIN ta_person tp ON cp.person_id = tp.person_id 	AND tp.person_type = 'estate agent' 	AND cp.STATUS = 1
42
-        LEFT JOIN (SELECT sum(z.customerNum) as customerNum,z.qr_code_id,z.org_id,z.channel_id from (SELECT sum(new_customers) as customerNum,qr_code_id,channel_id,org_id from ts_activity_daily where channel_id is not null and org_id = #{orgId} GROUP BY channel_id
43
-        union all
44
-        SELECT sum(new_customers) as customerNum,qr_code_id,channel_id,org_id from ts_channel_daily where channel_id is not null and org_id = #{orgId} GROUP BY channel_id) z GROUP BY z.channel_id) ts on c.channel_id = ts.channel_id
42
+        LEFT JOIN (
43
+        SELECT sum(new_customers) as customerNum,qr_code_id,channel_id,org_id from ts_channel_daily where channel_id is not null and org_id = #{orgId} GROUP BY channel_id) ts on c.channel_id = ts.channel_id
45 44
         <where>
46 45
             <if test="channelId != null and channelId != ''">
47 46
                 c.channel_id = #{channelId}
@@ -73,18 +72,51 @@
73 72
         SELECT
74 73
             *
75 74
         FROM
76
-            ts_activity_daily
75
+            ts_channel_daily
77 76
         WHERE
78 77
             channel_id = #{channelId}
79 78
         AND org_id = #{orgId}
80
-        UNION ALL
79
+        <if test="startDate != null and endDate != null">
80
+            AND statis_date BETWEEN #{startDate} AND #{endDate}
81
+        </if>
82
+        <if test="channelType != null and channelType != ''">
83
+            and target_type = #{channelType}
84
+        </if>
85
+        <if test="buildingId != null and buildingId != ''">
86
+            and building_id = #{buildingId}
87
+        </if>
88
+    </select>
89
+    <select id="getActivityNewuserList"
90
+            resultType="com.huiju.estateagents.excel.ActivityStatistics.ChannelAddRegistNum">
81 91
         SELECT
82
-            *
83
-        FROM
84
-            ts_channel_daily
85
-        WHERE
86
-            channel_id = #{channelId}
87
-            AND org_id = #{orgId}
92
+        a.nickname, a.phone,
93
+        if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
94
+        a.province,
95
+        t.create_date
96
+        FROM ta_customer_from t
97
+        left join ta_person a on t.person_id = a.person_id
98
+<!--        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-->
99
+<!--        left join td_wx_dict b1 on b.scene_id = b1.scene_id-->
100
+<!--        left join ta_recommend_customer c on c.person_id = t.person_id and c.realty_consultant is not null-->
101
+<!--        LEFT JOIN ta_user d ON c.realty_consultant = d.user_id-->
102
+<!--        LEFT JOIN ta_person e ON t.share_person_id = e.person_id-->
103
+        WHERE t.org_id = #{orgId}
104
+        and t.is_org_first = 1
105
+<!--        and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' ) and t.create_date &lt;= DATE_FORMAT(#{endDate},-->
106
+<!--        '%Y-%m-%d' )-->
107
+        <if test="activityId != null and activityId != ''">
108
+            and t.target_id = #{activityId}
109
+        </if>
110
+        <if test="activityType != null and activityType != ''">
111
+            and t.target_type = #{activityType}
112
+        </if>
113
+        <if test="buildingId != null and buildingId != ''">
114
+            and t.building_id = #{buildingId}
115
+        </if>
116
+        <if test="channelId != null and channelId != ''">
117
+            and t.channel_id = #{channelId}
118
+        </if>
119
+        group by t.person_id order by t.create_date desc
88 120
     </select>
89 121
 
90 122
 </mapper>