瀏覽代碼

新需求

weichaochao 5 年之前
父節點
當前提交
e6df757292

+ 3
- 0
src/main/java/com/huiju/estateagents/excel/ActivityStatistics/ActivityDetailShareRecord.java 查看文件

6
 
6
 
7
 @Data
7
 @Data
8
 public class ActivityDetailShareRecord {
8
 public class ActivityDetailShareRecord {
9
+
10
+    private String activityId;
11
+
9
     /**
12
     /**
10
      * 活动类型
13
      * 活动类型
11
      */
14
      */

+ 78
- 0
src/main/java/com/huiju/estateagents/excel/ActivityStatistics/VisitPersonNum.java 查看文件

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 VisitPersonNum {
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 visitNum;
78
+}

+ 81
- 7
src/main/java/com/huiju/estateagents/statistic/controller/ActivityStatisticController.java 查看文件

144
                                                    @RequestParam(value = "sharePersonType", required = false)String sharePersonType,
144
                                                    @RequestParam(value = "sharePersonType", required = false)String sharePersonType,
145
                                                    @RequestParam(value = "sharePersonName", required = false)  String sharePersonName,
145
                                                    @RequestParam(value = "sharePersonName", required = false)  String sharePersonName,
146
                                                    @RequestParam(value = "sharePhone", required = false)String sharePhone,
146
                                                    @RequestParam(value = "sharePhone", required = false)String sharePhone,
147
+                                                   @RequestParam(value = "activityId", required = false)String activityId,
148
+                                                   @RequestParam(value = "activityType", required = false)String activityType,
147
                                                    @RequestParam(value = "sort", required = false)String sort,
149
                                                    @RequestParam(value = "sort", required = false)String sort,
148
                                                    @RequestParam(value = "colKey", required = false)String colKey,
150
                                                    @RequestParam(value = "colKey", required = false)String colKey,
149
                                                    HttpServletRequest request) {
151
                                                    HttpServletRequest request) {
150
-        return taActivityStaticService.selectActivitySharePersonNum(pageNum, pageSize, getOrgId(request), startDate, endDate, sharePersonType, sharePersonName, sharePhone, sort, colKey);
152
+        return taActivityStaticService.selectActivitySharePersonNum(pageNum, pageSize, getOrgId(request), startDate, endDate, sharePersonType, sharePersonName, sharePhone, activityId, activityType, sort, colKey);
151
     }
153
     }
152
 
154
 
153
     /**
155
     /**
176
     }
178
     }
177
 
179
 
178
     /**
180
     /**
179
-     * 分享数统计
181
+     * 分享数统计
180
      * @return
182
      * @return
181
      */
183
      */
182
     @GetMapping(value = "/admin/activityStatistical/selectActivityShareNum")
184
     @GetMapping(value = "/admin/activityStatistical/selectActivityShareNum")
186
                                                      @RequestParam(value = "sharePersonType", required = false)String sharePersonType,
188
                                                      @RequestParam(value = "sharePersonType", required = false)String sharePersonType,
187
                                                      @RequestParam(value = "sharePersonName", required = false)  String sharePersonName,
189
                                                      @RequestParam(value = "sharePersonName", required = false)  String sharePersonName,
188
                                                      @RequestParam(value = "sharePhone", required = false)String sharePhone,
190
                                                      @RequestParam(value = "sharePhone", required = false)String sharePhone,
191
+                                                     @RequestParam(value = "activityId", required = false)String activityId,
192
+                                                     @RequestParam(value = "activityType", required = false)String activityType,
189
                                                      @RequestParam(value = "sort", required = false)String sort,
193
                                                      @RequestParam(value = "sort", required = false)String sort,
190
                                                      @RequestParam(value = "colKey", required = false)String colKey,
194
                                                      @RequestParam(value = "colKey", required = false)String colKey,
191
                                                      HttpServletRequest request) {
195
                                                      HttpServletRequest request) {
192
-        return taActivityStaticService.selectActivityShareNum(pageNum, pageSize, getOrgId(request), startDate, endDate, sharePersonType, sharePersonName, sharePhone, sort, colKey);
196
+        return taActivityStaticService.selectActivityShareNum(pageNum, pageSize, getOrgId(request), startDate, endDate, sharePersonType, sharePersonName, sharePhone, activityId, activityType, sort, colKey);
193
     }
197
     }
194
 
198
 
195
     /**
199
     /**
196
-     * 分享数统计导出
200
+     * 分享数统计导出
197
      * @return
201
      * @return
198
      */
202
      */
199
     @GetMapping(value = "/admin/activityStatistical/selectActivityShareNumExport")
203
     @GetMapping(value = "/admin/activityStatistical/selectActivityShareNumExport")
226
                                                @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
230
                                                @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
227
                                                @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate,
231
                                                @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate,
228
                                                @RequestParam(value = "personFrom", required = false)String personFrom,
232
                                                @RequestParam(value = "personFrom", required = false)String personFrom,
233
+                                               @RequestParam(value = "activityId", required = false)String activityId,
234
+                                               @RequestParam(value = "activityType", required = false)String activityType,
229
                                                HttpServletRequest request) {
235
                                                HttpServletRequest request) {
230
-        return taActivityStaticService.selectActivityAddRegistNum(pageNum, pageSize, getOrgId(request), startDate, endDate, personFrom);
236
+        return taActivityStaticService.selectActivityAddRegistNum(pageNum, pageSize, getOrgId(request), startDate, endDate, personFrom, activityId, activityType);
231
     }
237
     }
232
 
238
 
233
     /**
239
     /**
252
     }
258
     }
253
 
259
 
254
     /**
260
     /**
255
-     * 注册人数统计
261
+     * 访问次数统计
256
      * @return
262
      * @return
257
      */
263
      */
258
     @GetMapping(value = "/admin/activityStatistical/selectActivityVisitNum")
264
     @GetMapping(value = "/admin/activityStatistical/selectActivityVisitNum")
263
                                                    @RequestParam(value = "province", required = false)String province,
269
                                                    @RequestParam(value = "province", required = false)String province,
264
                                                    @RequestParam(value = "realtyConsultant", required = false)String realtyConsultant,
270
                                                    @RequestParam(value = "realtyConsultant", required = false)String realtyConsultant,
265
                                                    @RequestParam(value = "realtyConsultantPhone", required = false)String realtyConsultantPhone,
271
                                                    @RequestParam(value = "realtyConsultantPhone", required = false)String realtyConsultantPhone,
272
+                                                   @RequestParam(value = "activityId", required = false)String activityId,
273
+                                                   @RequestParam(value = "activityType", required = false)String activityType,
266
                                                    HttpServletRequest request) {
274
                                                    HttpServletRequest request) {
267
-        return taActivityStaticService.selectActivityVisitNum(pageNum, pageSize, getOrgId(request), startDate, endDate, personFrom, province, realtyConsultant, realtyConsultantPhone);
275
+        return taActivityStaticService.selectActivityVisitNum(pageNum, pageSize, getOrgId(request), startDate, endDate, personFrom, province, realtyConsultant, realtyConsultantPhone, activityId, activityType);
276
+    }
277
+
278
+    /**
279
+     * 访问次数统计
280
+     * @return
281
+     */
282
+    @GetMapping(value = "/admin/activityStatistical/selectActivityVisitNumExport")
283
+    public void selectActivityVisitNum(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
284
+                                               @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate,
285
+                                               @RequestParam(value = "personFrom", required = false)String personFrom,
286
+                                               @RequestParam(value = "province", required = false)String province,
287
+                                               @RequestParam(value = "realtyConsultant", required = false)String realtyConsultant,
288
+                                               @RequestParam(value = "realtyConsultantPhone", required = false)String realtyConsultantPhone,
289
+                                               HttpServletRequest request, HttpServletResponse response) throws IOException {
290
+        response.setContentType("application/octet-stream");
291
+        response.setCharacterEncoding("utf-8");
292
+        response.setHeader("Content-disposition", "attachment;filename=活动统计.xlsx");
293
+        ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), VisitNum.class).registerWriteHandler(new CustomCellWriteHandler()).build();
294
+        // 设置 sheet, 同一个sheet只需要设置一次
295
+        WriteSheet writeSheet = EasyExcel.writerSheet("活动统计").build();
296
+        List<VisitNum> data = taActivityStaticService.selectActivityVisitNumExport(getOrgId(request), startDate, endDate, personFrom, province, realtyConsultant, realtyConsultantPhone);
297
+        excelWriter.write(data, writeSheet);
298
+        // finish 会帮忙关闭流
299
+        excelWriter.finish();
300
+    }
301
+
302
+    /**
303
+     * 访问人数统计
304
+     * @return
305
+     */
306
+    @GetMapping(value = "/admin/activityStatistical/selectActivityVisitPersonNum")
307
+    public ResponseBean selectActivityVisitPersonNum(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, @RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize,
308
+                                               @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
309
+                                               @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate,
310
+                                               @RequestParam(value = "personFrom", required = false)String personFrom,
311
+                                               @RequestParam(value = "province", required = false)String province,
312
+                                               @RequestParam(value = "realtyConsultant", required = false)String realtyConsultant,
313
+                                               @RequestParam(value = "realtyConsultantPhone", required = false)String realtyConsultantPhone,
314
+                                               @RequestParam(value = "activityId", required = false)String activityId,
315
+                                               @RequestParam(value = "activityType", required = false)String activityType,
316
+                                               HttpServletRequest request) {
317
+        return taActivityStaticService.selectActivityVisitPersonNum(pageNum, pageSize, getOrgId(request), startDate, endDate, personFrom, province, realtyConsultant, realtyConsultantPhone, activityId, activityType);
318
+    }
319
+
320
+    /**
321
+     * 访问人数统计导出
322
+     * @return
323
+     */
324
+    @GetMapping(value = "/admin/activityStatistical/selectActivityVisitPersonNumExport")
325
+    public void selectActivityVisitPersonNumExport(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
326
+                                       @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate,
327
+                                       @RequestParam(value = "personFrom", required = false)String personFrom,
328
+                                       @RequestParam(value = "province", required = false)String province,
329
+                                       @RequestParam(value = "realtyConsultant", required = false)String realtyConsultant,
330
+                                       @RequestParam(value = "realtyConsultantPhone", required = false)String realtyConsultantPhone,
331
+                                       HttpServletRequest request, HttpServletResponse response) throws IOException {
332
+        response.setContentType("application/octet-stream");
333
+        response.setCharacterEncoding("utf-8");
334
+        response.setHeader("Content-disposition", "attachment;filename=活动统计.xlsx");
335
+        ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), VisitPersonNum.class).registerWriteHandler(new CustomCellWriteHandler()).build();
336
+        // 设置 sheet, 同一个sheet只需要设置一次
337
+        WriteSheet writeSheet = EasyExcel.writerSheet("活动统计").build();
338
+        List<VisitPersonNum> data = taActivityStaticService.selectActivityVisitPersonNumExport(getOrgId(request), startDate, endDate, personFrom, province, realtyConsultant, realtyConsultantPhone);
339
+        excelWriter.write(data, writeSheet);
340
+        // finish 会帮忙关闭流
341
+        excelWriter.finish();
268
     }
342
     }
269
 }
343
 }

+ 43
- 1
src/main/java/com/huiju/estateagents/statistic/mapper/TaActicityStaticMapper.java 查看文件

80
             @Param("sharePersonType") String sharePersonType,
80
             @Param("sharePersonType") String sharePersonType,
81
             @Param("sharePersonName") String sharePersonName,
81
             @Param("sharePersonName") String sharePersonName,
82
             @Param("sharePhone") String sharePhone,
82
             @Param("sharePhone") String sharePhone,
83
+            @Param("activityId") String activityId,
84
+            @Param("activityType") String activityType,
83
             @Param("sort") String sort,
85
             @Param("sort") String sort,
84
             @Param("colKey") String colKey
86
             @Param("colKey") String colKey
85
     );
87
     );
103
             @Param("sharePersonType") String sharePersonType,
105
             @Param("sharePersonType") String sharePersonType,
104
             @Param("sharePersonName") String sharePersonName,
106
             @Param("sharePersonName") String sharePersonName,
105
             @Param("sharePhone") String sharePhone,
107
             @Param("sharePhone") String sharePhone,
108
+            @Param("activityId") String activityId,
109
+            @Param("activityType") String activityType,
106
             @Param("sort") String sort,
110
             @Param("sort") String sort,
107
             @Param("colKey") String colKey
111
             @Param("colKey") String colKey
108
     );
112
     );
123
             @Param("orgId") Integer orgId,
127
             @Param("orgId") Integer orgId,
124
             @Param("startDate") LocalDateTime startDate,
128
             @Param("startDate") LocalDateTime startDate,
125
             @Param("endDate") LocalDateTime endDate,
129
             @Param("endDate") LocalDateTime endDate,
126
-            @Param("personFrom") String personFrom
130
+            @Param("personFrom") String personFrom,
131
+            @Param("activityId") String activityId,
132
+            @Param("activityType") String activityType
127
     );
133
     );
128
 
134
 
129
     List<AddRegistNum> selectActivityAddRegistNumExport(
135
     List<AddRegistNum> selectActivityAddRegistNumExport(
135
 
141
 
136
     IPage<VisitNum> selectActivityVisitNum(
142
     IPage<VisitNum> selectActivityVisitNum(
137
             IPage<VisitNum> iPage,
143
             IPage<VisitNum> iPage,
144
+            @Param("orgId") Integer orgId,
145
+            @Param("startDate") LocalDateTime startDate,
146
+            @Param("endDate") LocalDateTime endDate,
147
+            @Param("personFrom") String personFrom,
148
+            @Param("province") String province,
149
+            @Param("realtyConsultant") String realtyConsultant,
150
+            @Param("realtyConsultantPhone") String realtyConsultantPhone,
151
+            @Param("activityId") String activityId,
152
+            @Param("activityType") String activityType
153
+    );
154
+
155
+    List<VisitNum> selectActivityVisitNumExport(
156
+            @Param("orgId") Integer orgId,
157
+            @Param("startDate") LocalDateTime startDate,
158
+            @Param("endDate") LocalDateTime endDate,
159
+            @Param("personFrom") String personFrom,
160
+            @Param("province") String province,
161
+            @Param("realtyConsultant") String realtyConsultant,
162
+            @Param("realtyConsultantPhone") String realtyConsultantPhone
163
+    );
164
+
165
+    IPage<VisitPersonNum> selectActivityVisitPersonNum(
166
+            IPage<VisitPersonNum> iPage,
167
+            @Param("orgId") Integer orgId,
168
+            @Param("startDate") LocalDateTime startDate,
169
+            @Param("endDate") LocalDateTime endDate,
170
+            @Param("personFrom") String personFrom,
171
+            @Param("province") String province,
172
+            @Param("realtyConsultant") String realtyConsultant,
173
+            @Param("realtyConsultantPhone") String realtyConsultantPhone,
174
+            @Param("activityId") String activityId,
175
+            @Param("activityType") String activityType
176
+    );
177
+
178
+    List<VisitPersonNum> selectActivityVisitPersonNumExport(
138
             @Param("orgId") Integer orgId,
179
             @Param("orgId") Integer orgId,
139
             @Param("startDate") LocalDateTime startDate,
180
             @Param("startDate") LocalDateTime startDate,
140
             @Param("endDate") LocalDateTime endDate,
181
             @Param("endDate") LocalDateTime endDate,
143
             @Param("realtyConsultant") String realtyConsultant,
184
             @Param("realtyConsultant") String realtyConsultant,
144
             @Param("realtyConsultantPhone") String realtyConsultantPhone
185
             @Param("realtyConsultantPhone") String realtyConsultantPhone
145
     );
186
     );
187
+
146
 }
188
 }

+ 22
- 8
src/main/java/com/huiju/estateagents/statistic/service/impl/TaActivityStaticServiceImpl.java 查看文件

112
         return taActicityStaticMapper.selectActivityStatisDetailExport(orgId, startDate, endDate, buildingId, targetType, activityName, sortType, colKey);
112
         return taActicityStaticMapper.selectActivityStatisDetailExport(orgId, startDate, endDate, buildingId, targetType, activityName, sortType, colKey);
113
     }
113
     }
114
 
114
 
115
-    public ResponseBean selectActivitySharePersonNum(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String sharePersonType, String sharePersonName, String sharePhone, String sort, String colKey){
115
+    public ResponseBean selectActivitySharePersonNum(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String sharePersonType, String sharePersonName, String sharePhone, String activityId, String activityType, String sort, String colKey){
116
         IPage<SharePersonNum> iPage = new Page<>(pageNum, pageSize);
116
         IPage<SharePersonNum> iPage = new Page<>(pageNum, pageSize);
117
         String sortType = "ascend".equals(sort) ? "asc" : "desc";
117
         String sortType = "ascend".equals(sort) ? "asc" : "desc";
118
 
118
 
119
-        IPage<SharePersonNum> data = taActicityStaticMapper.selectActivitySharePersonNum(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), sharePersonType, sharePersonName, sharePhone, sortType, colKey);
119
+        IPage<SharePersonNum> data = taActicityStaticMapper.selectActivitySharePersonNum(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), sharePersonType, sharePersonName, sharePhone, activityId, activityType, sortType, colKey);
120
         return ResponseBean.success(data);
120
         return ResponseBean.success(data);
121
     }
121
     }
122
 
122
 
125
         return taActicityStaticMapper.selectActivitySharePersonNumExport(orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), sharePersonType, sharePersonName, sharePhone, sortType, colKey);
125
         return taActicityStaticMapper.selectActivitySharePersonNumExport(orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), sharePersonType, sharePersonName, sharePhone, sortType, colKey);
126
     }
126
     }
127
 
127
 
128
-    public ResponseBean selectActivityShareNum(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String sharePersonType, String sharePersonName, String sharePhone, String sort, String colKey){
128
+    public ResponseBean selectActivityShareNum(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String sharePersonType, String sharePersonName, String sharePhone, String activityId, String activityType, String sort, String colKey){
129
         IPage<ShareNum> iPage = new Page<>(pageNum, pageSize);
129
         IPage<ShareNum> iPage = new Page<>(pageNum, pageSize);
130
         String sortType = "ascend".equals(sort) ? "asc" : "desc";
130
         String sortType = "ascend".equals(sort) ? "asc" : "desc";
131
 
131
 
132
-        IPage<ShareNum> data = taActicityStaticMapper.selectActivityShareNum(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), sharePersonType, sharePersonName, sharePhone, sortType, colKey);
132
+        IPage<ShareNum> data = taActicityStaticMapper.selectActivityShareNum(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), sharePersonType, sharePersonName, sharePhone, activityId, activityType, sortType, colKey);
133
         return ResponseBean.success(data);
133
         return ResponseBean.success(data);
134
     }
134
     }
135
 
135
 
138
         return taActicityStaticMapper.selectActivityShareNumExport( orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), sharePersonType, sharePersonName, sharePhone, sortType, colKey);
138
         return taActicityStaticMapper.selectActivityShareNumExport( orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), sharePersonType, sharePersonName, sharePhone, sortType, colKey);
139
     }
139
     }
140
 
140
 
141
-    public ResponseBean selectActivityAddRegistNum(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String personFrom){
141
+    public ResponseBean selectActivityAddRegistNum(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String personFrom, String activityId, String activityType){
142
         IPage<AddRegistNum> iPage = new Page<>(pageNum, pageSize);
142
         IPage<AddRegistNum> iPage = new Page<>(pageNum, pageSize);
143
-        IPage<AddRegistNum> data = taActicityStaticMapper.selectActivityAddRegistNum(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), personFrom);
143
+        IPage<AddRegistNum> data = taActicityStaticMapper.selectActivityAddRegistNum(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), personFrom, activityId, activityType);
144
         return ResponseBean.success(data);
144
         return ResponseBean.success(data);
145
     }
145
     }
146
 
146
 
148
         return taActicityStaticMapper.selectActivityAddRegistNumExport(orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), personFrom);
148
         return taActicityStaticMapper.selectActivityAddRegistNumExport(orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), personFrom);
149
     }
149
     }
150
 
150
 
151
-    public ResponseBean selectActivityVisitNum(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String personFrom, String provice, String realtyConsultant, String realtyConsultantPhone){
151
+    public ResponseBean selectActivityVisitNum(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String personFrom, String provice, String realtyConsultant, String realtyConsultantPhone, String activityId, String activityType){
152
         IPage<VisitNum> iPage = new Page<>(pageNum, pageSize);
152
         IPage<VisitNum> iPage = new Page<>(pageNum, pageSize);
153
-        IPage<VisitNum> data = taActicityStaticMapper.selectActivityVisitNum(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), personFrom, provice, realtyConsultant, realtyConsultantPhone);
153
+        IPage<VisitNum> data = taActicityStaticMapper.selectActivityVisitNum(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), personFrom, provice, realtyConsultant, realtyConsultantPhone, activityId, activityType);
154
         return ResponseBean.success(data);
154
         return ResponseBean.success(data);
155
     }
155
     }
156
+
157
+    public List<VisitNum> selectActivityVisitNumExport(Integer orgId, LocalDate startDate, LocalDate endDate, String personFrom, String provice, String realtyConsultant, String realtyConsultantPhone){
158
+        return taActicityStaticMapper.selectActivityVisitNumExport(orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), personFrom, provice, realtyConsultant, realtyConsultantPhone);
159
+    }
160
+
161
+    public ResponseBean selectActivityVisitPersonNum(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String personFrom, String provice, String realtyConsultant, String realtyConsultantPhone, String activityId, String activityType){
162
+        IPage<VisitPersonNum> iPage = new Page<>(pageNum, pageSize);
163
+        IPage<VisitPersonNum> data = taActicityStaticMapper.selectActivityVisitPersonNum(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), personFrom, provice, realtyConsultant, realtyConsultantPhone, activityId, activityType);
164
+        return ResponseBean.success(data);
165
+    }
166
+
167
+    public List<VisitPersonNum> selectActivityVisitPersonNumExport(Integer orgId, LocalDate startDate, LocalDate endDate, String personFrom, String provice, String realtyConsultant, String realtyConsultantPhone){
168
+        return taActicityStaticMapper.selectActivityVisitPersonNumExport(orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), personFrom, provice, realtyConsultant, realtyConsultantPhone);
169
+    }
156
 }
170
 }

+ 304
- 91
src/main/resources/mapper/statistic/TaActivityStaticMapper.xml 查看文件

10
         left join ta_drainage d on t.be_share = d.drainage_id
10
         left join ta_drainage d on t.be_share = d.drainage_id
11
         left join ta_building_dynamic e on t.be_share = e.dynamic_id
11
         left join ta_building_dynamic e on t.be_share = e.dynamic_id
12
         left join ta_person f on t.person_id = f.person_id
12
         left join ta_person f on t.person_id = f.person_id
13
-        where t.tagert_type in ('activity','group','h5','help','liveApp','livePost') and f.org_id = #{orgId}
13
+        where t.tagert_type in ('activity','group','h5','help','liveApp','livePost') and t.org_id = #{orgId}
14
         <if test="buildingId != null and buildingId != ''">
14
         <if test="buildingId != null and buildingId != ''">
15
             and (a.building_id = #{buildingId} or b.building_id = #{buildingId} or c.building_id = #{buildingId} or d.building_id = #{buildingId} or e.building_id = #{buildingId})
15
             and (a.building_id = #{buildingId} or b.building_id = #{buildingId} or c.building_id = #{buildingId} or d.building_id = #{buildingId} or e.building_id = #{buildingId})
16
         </if>
16
         </if>
34
         left join ta_drainage d on t.be_share = d.drainage_id
34
         left join ta_drainage d on t.be_share = d.drainage_id
35
         left join ta_building_dynamic e on t.be_share = e.dynamic_id
35
         left join ta_building_dynamic e on t.be_share = e.dynamic_id
36
         left join ta_person f on t.person_id = f.person_id
36
         left join ta_person f on t.person_id = f.person_id
37
-        where t.tagert_type in ('activity','group','h5','help','liveApp','livePost') and f.org_id = #{orgId}
37
+        where t.tagert_type in ('activity','group','h5','help','liveApp','livePost') and t.org_id = #{orgId}
38
         <if test="buildingId != null and buildingId != ''">
38
         <if test="buildingId != null and buildingId != ''">
39
             and (a.building_id = #{buildingId} or b.building_id = #{buildingId} or c.building_id = #{buildingId} or d.building_id = #{buildingId} or e.building_id = #{buildingId})
39
             and (a.building_id = #{buildingId} or b.building_id = #{buildingId} or c.building_id = #{buildingId} or d.building_id = #{buildingId} or e.building_id = #{buildingId})
40
         </if>
40
         </if>
118
         left join ta_building_dynamic e on t.be_share = e.dynamic_id
118
         left join ta_building_dynamic e on t.be_share = e.dynamic_id
119
         left join ta_person f on t.person_id = f.person_id
119
         left join ta_person f on t.person_id = f.person_id
120
         WHERE
120
         WHERE
121
-        t.tagert_type in ('activity','group','h5','help','liveApp','livePost') and f.org_id = #{orgId}
121
+        t.tagert_type in ('activity','group','h5','help','liveApp','livePost') and t.org_id = #{orgId}
122
         <if test="buildingId != null and buildingId != ''">
122
         <if test="buildingId != null and buildingId != ''">
123
             and (a.building_id = #{buildingId} or b.building_id = #{buildingId} or c.building_id = #{buildingId} or d.building_id = #{buildingId} or e.building_id = #{buildingId})
123
             and (a.building_id = #{buildingId} or b.building_id = #{buildingId} or c.building_id = #{buildingId} or d.building_id = #{buildingId} or e.building_id = #{buildingId})
124
         </if>
124
         </if>
375
         left join ta_building_dynamic e on t.be_share = e.dynamic_id
375
         left join ta_building_dynamic e on t.be_share = e.dynamic_id
376
         left join ta_person f on t.person_id = f.person_id
376
         left join ta_person f on t.person_id = f.person_id
377
         WHERE
377
         WHERE
378
-        t.tagert_type in ('activity','group','h5','help','liveApp','livePost') and f.org_id = #{orgId}
378
+        t.tagert_type in ('activity','group','h5','help','liveApp','livePost') and t.org_id = #{orgId}
379
         <if test="buildingId != null and buildingId != ''">
379
         <if test="buildingId != null and buildingId != ''">
380
             and (a.building_id = #{buildingId} or b.building_id = #{buildingId} or c.building_id = #{buildingId} or d.building_id = #{buildingId} or e.building_id = #{buildingId})
380
             and (a.building_id = #{buildingId} or b.building_id = #{buildingId} or c.building_id = #{buildingId} or d.building_id = #{buildingId} or e.building_id = #{buildingId})
381
         </if>
381
         </if>
395
         DATE_FORMAT( t.create_date, '%Y-%m-%d' )
395
         DATE_FORMAT( t.create_date, '%Y-%m-%d' )
396
         ) AS temp ON temp_date.date = DATE_FORMAT( temp.create_date, '%Y-%m-%d' )
396
         ) AS temp ON temp_date.date = DATE_FORMAT( temp.create_date, '%Y-%m-%d' )
397
         LEFT JOIN (
397
         LEFT JOIN (
398
-            select COUNT(1) AS sharePersonNum, temp1.create_date from (
398
+            select temp1.sharePersonNum, temp1.create_date from (
399
                 SELECT COUNT( 1 ) AS sharePersonNum, t.create_date AS create_date, t.person_id
399
                 SELECT COUNT( 1 ) AS sharePersonNum, t.create_date AS create_date, t.person_id
400
                 FROM
400
                 FROM
401
                 ta_share_count t
401
                 ta_share_count t
452
         DATE_FORMAT( t.visit_time, '%Y-%m-%d' )
452
         DATE_FORMAT( t.visit_time, '%Y-%m-%d' )
453
         ) AS temp2 ON temp_date.date = DATE_FORMAT( temp2.create_date, '%Y-%m-%d' )
453
         ) AS temp2 ON temp_date.date = DATE_FORMAT( temp2.create_date, '%Y-%m-%d' )
454
         LEFT JOIN (
454
         LEFT JOIN (
455
-        SELECT
456
-        COUNT( 1 ) AS visitPersonNum,
457
-        t.visit_time AS create_date
458
-        FROM
459
-        ta_person_visit_record t
460
-        WHERE
461
-        t.`event` = 'detail'  and t.event_type in ('activity','help','group','h5') and t.org_id = #{orgId}
462
-        <if test="buildingId != null and buildingId != ''">
463
-            and t.building_id =  #{buildingId}
464
-        </if>
465
-        <if test="targetType != null and targetType != ''">
466
-            and t.target_type =  #{targetType}
467
-        </if>
468
-        <if test="startDate != null">
469
-            and t.visit_time &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
470
-        </if>
471
-        <if test="endDate != null">
472
-            and t.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
473
-        </if>
474
-        <if test="startDate == null or endDate == null">
475
-            AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
476
-        </if>
477
-        GROUP BY
478
-        DATE_FORMAT( t.visit_time, '%Y-%m-%d' ) , person_id
455
+            select  count(*)AS visitPersonNum , visitPersonCount.* from (
456
+            SELECT
457
+            t.visit_time AS create_date,
458
+            t.person_id
459
+            FROM
460
+            ta_person_visit_record t
461
+            WHERE
462
+            t.`event` = 'detail'  and t.event_type in ('activity','help','group','h5') and t.org_id = #{orgId}
463
+            <if test="buildingId != null and buildingId != ''">
464
+                and t.building_id =  #{buildingId}
465
+            </if>
466
+            <if test="targetType != null and targetType != ''">
467
+                and t.target_type =  #{targetType}
468
+            </if>
469
+            <if test="startDate != null">
470
+                and t.visit_time &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
471
+            </if>
472
+            <if test="endDate != null">
473
+                and t.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
474
+            </if>
475
+            <if test="startDate == null or endDate == null">
476
+                AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
477
+            </if>
478
+            GROUP BY
479
+            DATE_FORMAT(t.visit_time, '%Y-%m-%d'),
480
+            person_id) as visitPersonCount GROUP BY DATE_FORMAT(visitPersonCount.create_date, '%Y-%m-%d')
479
         ) AS temp3 ON temp_date.date = DATE_FORMAT( temp3.create_date, '%Y-%m-%d' )
481
         ) AS temp3 ON temp_date.date = DATE_FORMAT( temp3.create_date, '%Y-%m-%d' )
480
         LEFT JOIN (
482
         LEFT JOIN (
481
-        SELECT
482
-        COUNT( 1 ) AS addRegistNum ,
483
-        t.create_date AS create_date
484
-        FROM
485
-        ta_share_person_from t
486
-        WHERE
487
-        t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share') and t.org_id = #{orgId}
488
-        <if test="buildingId != null and buildingId != ''">
489
-            and t.building_id =  #{buildingId}
490
-        </if>
491
-        and t.status = 1
492
-        <if test="targetType != null and targetType != ''">
493
-            and t.target_type =  #{targetType}
494
-        </if>
495
-        <if test="startDate != null ">
496
-            and t.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
497
-        </if>
498
-        <if test="endDate != null ">
499
-            and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
500
-        </if>
501
-        <if test="startDate == null or endDate == null">
502
-            AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
503
-        </if>
504
-        GROUP BY
505
-        DATE_FORMAT( t.create_date, '%Y-%m-%d' ) ,t.person_id, t.target_type
483
+        select count(*) as addRegistNum,temp4.* from (
484
+            SELECT
485
+            t.create_date AS create_date,
486
+            t.person_id
487
+            FROM
488
+            ta_share_person_from t
489
+            WHERE
490
+            t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share') and t.org_id = #{orgId}
491
+            <if test="buildingId != null and buildingId != ''">
492
+                and t.building_id =  #{buildingId}
493
+            </if>
494
+            and t.status = 1
495
+            <if test="targetType != null and targetType != ''">
496
+                and t.target_type =  #{targetType}
497
+            </if>
498
+            <if test="startDate != null ">
499
+                and t.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
500
+            </if>
501
+            <if test="endDate != null ">
502
+                and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
503
+            </if>
504
+            <if test="startDate == null or endDate == null">
505
+                AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
506
+            </if>
507
+              GROUP BY t.person_id, t.target_type
508
+            ) as temp4 GROUP BY DATE_FORMAT(temp4.create_date,'%Y-%m-%d')
506
         ) AS temp4 ON temp_date.date = DATE_FORMAT( temp4.create_date, '%Y-%m-%d' )
509
         ) AS temp4 ON temp_date.date = DATE_FORMAT( temp4.create_date, '%Y-%m-%d' )
507
-
508
         GROUP BY date
510
         GROUP BY date
509
         <if test="colKey == null or colKey == ''">
511
         <if test="colKey == null or colKey == ''">
510
             ORDER BY  date desc
512
             ORDER BY  date desc
541
         left join ta_building_dynamic e on t.be_share = e.dynamic_id
543
         left join ta_building_dynamic e on t.be_share = e.dynamic_id
542
         left join ta_person f on t.person_id = f.person_id
544
         left join ta_person f on t.person_id = f.person_id
543
         WHERE
545
         WHERE
544
-        t.tagert_type in ('activity','group','h5','help','liveApp','livePost') and f.org_id = #{orgId}
546
+        t.tagert_type in ('activity','group','h5','help','liveApp','livePost') and t.org_id = #{orgId}
545
         <if test="buildingId != null and buildingId != ''">
547
         <if test="buildingId != null and buildingId != ''">
546
             and (a.building_id = #{buildingId} or b.building_id = #{buildingId} or c.building_id = #{buildingId} or d.building_id = #{buildingId} or e.building_id = #{buildingId})
548
             and (a.building_id = #{buildingId} or b.building_id = #{buildingId} or c.building_id = #{buildingId} or d.building_id = #{buildingId} or e.building_id = #{buildingId})
547
         </if>
549
         </if>
561
         DATE_FORMAT( t.create_date, '%Y-%m-%d' )
563
         DATE_FORMAT( t.create_date, '%Y-%m-%d' )
562
         ) AS temp ON temp_date.date = DATE_FORMAT( temp.create_date, '%Y-%m-%d' )
564
         ) AS temp ON temp_date.date = DATE_FORMAT( temp.create_date, '%Y-%m-%d' )
563
         LEFT JOIN (
565
         LEFT JOIN (
564
-        select COUNT(1) AS sharePersonNum, temp1.create_date from (
566
+        select temp1.sharePersonNum, temp1.create_date from (
565
         SELECT COUNT( 1 ) AS sharePersonNum, t.create_date AS create_date, t.person_id
567
         SELECT COUNT( 1 ) AS sharePersonNum, t.create_date AS create_date, t.person_id
566
         FROM
568
         FROM
567
         ta_share_count t
569
         ta_share_count t
618
         DATE_FORMAT( t.visit_time, '%Y-%m-%d' )
620
         DATE_FORMAT( t.visit_time, '%Y-%m-%d' )
619
         ) AS temp2 ON temp_date.date = DATE_FORMAT( temp2.create_date, '%Y-%m-%d' )
621
         ) AS temp2 ON temp_date.date = DATE_FORMAT( temp2.create_date, '%Y-%m-%d' )
620
         LEFT JOIN (
622
         LEFT JOIN (
623
+        select  count(*)AS visitPersonNum , visitPersonCount.* from (
621
         SELECT
624
         SELECT
622
-        COUNT( 1 ) AS visitPersonNum,
623
-        t.visit_time AS create_date
625
+        t.visit_time AS create_date,
626
+        t.person_id
624
         FROM
627
         FROM
625
         ta_person_visit_record t
628
         ta_person_visit_record t
626
         WHERE
629
         WHERE
641
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
644
             AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
642
         </if>
645
         </if>
643
         GROUP BY
646
         GROUP BY
644
-        DATE_FORMAT( t.visit_time, '%Y-%m-%d' ) , person_id
647
+        DATE_FORMAT(t.visit_time, '%Y-%m-%d'),
648
+        person_id) as visitPersonCount GROUP BY DATE_FORMAT(visitPersonCount.create_date, '%Y-%m-%d')
645
         ) AS temp3 ON temp_date.date = DATE_FORMAT( temp3.create_date, '%Y-%m-%d' )
649
         ) AS temp3 ON temp_date.date = DATE_FORMAT( temp3.create_date, '%Y-%m-%d' )
646
         LEFT JOIN (
650
         LEFT JOIN (
651
+        select count(*) as addRegistNum,temp4.* from (
647
         SELECT
652
         SELECT
648
-        COUNT( 1 ) AS addRegistNum ,
649
-        t.create_date AS create_date
653
+        t.create_date AS create_date,
654
+        t.person_id
650
         FROM
655
         FROM
651
         ta_share_person_from t
656
         ta_share_person_from t
652
         WHERE
657
         WHERE
667
         <if test="startDate == null or endDate == null">
672
         <if test="startDate == null or endDate == null">
668
             AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
673
             AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
669
         </if>
674
         </if>
670
-        GROUP BY
671
-        DATE_FORMAT( t.create_date, '%Y-%m-%d' ) ,t.person_id, t.target_type
675
+        GROUP BY t.person_id, t.target_type
676
+        ) as temp4 GROUP BY DATE_FORMAT(temp4.create_date,'%Y-%m-%d')
672
         ) AS temp4 ON temp_date.date = DATE_FORMAT( temp4.create_date, '%Y-%m-%d' )
677
         ) AS temp4 ON temp_date.date = DATE_FORMAT( temp4.create_date, '%Y-%m-%d' )
673
-
674
         GROUP BY date
678
         GROUP BY date
675
         <if test="colKey == null or colKey == ''">
679
         <if test="colKey == null or colKey == ''">
676
             ORDER BY  date desc
680
             ORDER BY  date desc
1014
             ON t.person_id = f.person_id
1018
             ON t.person_id = f.person_id
1015
             WHERE t.tagert_type in ('activity','group','h5','help','liveApp','livePost') and t.org_id = #{orgId}
1019
             WHERE t.tagert_type in ('activity','group','h5','help','liveApp','livePost') and t.org_id = #{orgId}
1016
             and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%I:%S' ) and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S' )
1020
             and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%I:%S' ) and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S' )
1021
+            <if test="activityId != null and activityId != ''">
1022
+                and t.be_share = #{activityId}
1023
+            </if>
1024
+            <if test="activityType != null and activityType != ''">
1025
+                and t.tagert_type = #{activityType}
1026
+            </if>
1017
             <if test="sharePersonType != null and sharePersonType != ''">
1027
             <if test="sharePersonType != null and sharePersonType != ''">
1018
                 and f.person_type = #{sharePersonType}
1028
                 and f.person_type = #{sharePersonType}
1019
             </if>
1029
             </if>
1150
     </select>
1160
     </select>
1151
 
1161
 
1152
     <select id="selectActivityShareNum" resultType="com.huiju.estateagents.excel.ActivityStatistics.ShareNum">
1162
     <select id="selectActivityShareNum" resultType="com.huiju.estateagents.excel.ActivityStatistics.ShareNum">
1153
-        select person.nickname as sharePersonName, ifnull(person.tel, '空') as sharePersonPhone , person.create_date as shareTime, ifnull(visitPersonNum.visitPersonNum, 0) as visitPersonNum, person.person_type as sharePersonType
1163
+        select person.nickname as sharePersonName,
1164
+        ifnull(person.tel, '空') as sharePersonPhone ,
1165
+        person.create_date as shareTime,
1166
+        ifnull(visitPersonNum.visitPersonNum, 0) as visitPersonNum,
1167
+        person.person_type as sharePersonType
1154
         FROM (
1168
         FROM (
1155
             SELECT t.*, f.nickname, f.tel, f.person_type
1169
             SELECT t.*, f.nickname, f.tel, f.person_type
1156
             FROM ta_share_count t
1170
             FROM ta_share_count t
1167
             LEFT JOIN ta_person f
1181
             LEFT JOIN ta_person f
1168
             ON t.person_id = f.person_id
1182
             ON t.person_id = f.person_id
1169
             WHERE t.tagert_type in ('activity','group','h5','help','liveApp','livePost')
1183
             WHERE t.tagert_type in ('activity','group','h5','help','liveApp','livePost')
1170
-            and f.org_id = #{orgId}
1184
+            <if test="activityId != null and activityId != ''">
1185
+                and t.be_share = #{activityId}
1186
+            </if>
1187
+            <if test="activityType != null and activityType != ''">
1188
+                and t.tagert_type = #{activityType}
1189
+            </if>
1190
+            and t.org_id = #{orgId}
1171
             and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%I:%S' )
1191
             and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%I:%S' )
1172
             and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S' )
1192
             and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S' )
1173
         ) as person
1193
         ) as person
1239
         left join ta_person e on t.share_person = e.person_id
1259
         left join ta_person e on t.share_person = e.person_id
1240
         left join ta_user f on t.share_person = f.user_id
1260
         left join ta_user f on t.share_person = f.user_id
1241
         WHERE t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share') and t.org_id = #{orgId} and t.status = 1
1261
         WHERE t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share') and t.org_id = #{orgId} and t.status = 1
1262
+        and t.is_first_time = 1
1242
         and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' ) and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
1263
         and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' ) and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
1264
+        <if test="activityId != null and activityId != ''">
1265
+            and t.target_id = #{activityId}
1266
+        </if>
1267
+        <if test="activityType != null and activityType != ''">
1268
+            and t.target_type = concat(#{activityType}, '_share')
1269
+        </if>
1243
         <if test="personFrom != null and personFrom != ''">
1270
         <if test="personFrom != null and personFrom != ''">
1244
             and b.scene_id = #{personFrom}
1271
             and b.scene_id = #{personFrom}
1245
         </if>
1272
         </if>
1271
     </select>
1298
     </select>
1272
 
1299
 
1273
     <select id="selectActivityVisitNum" resultType="com.huiju.estateagents.excel.ActivityStatistics.VisitNum">
1300
     <select id="selectActivityVisitNum" resultType="com.huiju.estateagents.excel.ActivityStatistics.VisitNum">
1274
-        SELECT
1301
+        select
1302
+            a.nickname, a.phone,
1303
+            if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
1304
+            a.province,
1305
+            b1.scene_name as personFrom,
1306
+            d.name as realtyConsultant,
1307
+            d.phone as realtyConsultantPhone,
1308
+            t.visit_time as visitDate
1309
+        From (
1310
+            SELECT
1311
+            t.person_id, t.visit_time
1312
+            FROM
1313
+            ta_person_visit_record t
1314
+            WHERE
1315
+            t.`event` = 'detail'
1316
+            AND t.event_type IN (
1317
+            'activity',
1318
+            'help',
1319
+            'group',
1320
+            'h5'
1321
+            )
1322
+            <if test="activityId != null and activityId != ''">
1323
+                and t.target_id = #{activityId}
1324
+            </if>
1325
+            <if test="activityType != null and activityType != ''">
1326
+                and t.event_type = #{activityType}
1327
+            </if>
1328
+            AND t.org_id = #{orgId}
1329
+            AND t.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d')
1330
+            AND t.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
1331
+        ) t
1332
+        left join ta_person a on  t.person_id = a.person_id
1333
+        left join ta_person_from_record b on a.person_id = b.person_id and b.org_id = #{orgId}
1334
+        left join td_wx_dict b1 on b.scene_id = b1.scene_id
1335
+        left join (
1336
+        select d.person_id, d.`name`, d.phone From  ta_recommend_customer c
1337
+          left join ta_person d on c.recommend_person = d.person_id where c.org_id = #{orgId} group by d.person_id
1338
+        ) as d on t.person_id = d.person_id
1339
+        <where>
1340
+            <if test="personFrom != null and personFrom != ''">
1341
+                and b.scene_id = #{personFrom}
1342
+            </if>
1343
+            <if test="province != null and province != ''">
1344
+                and a.province = #{province}
1345
+            </if>
1346
+            <if test="realtyConsultant != null and realtyConsultant != ''">
1347
+                and d.name = #{realtyConsultant}
1348
+            </if>
1349
+            <if test="realtyConsultantPhone != null and realtyConsultantPhone != ''">
1350
+                and d.phone = #{realtyConsultantPhone}
1351
+            </if>
1352
+        </where>
1353
+        order by t.visit_time desc
1354
+    </select>
1355
+
1356
+    <select id="selectActivityVisitNumExport" resultType="com.huiju.estateagents.excel.ActivityStatistics.VisitNum">
1357
+        select
1275
         a.nickname, a.phone,
1358
         a.nickname, a.phone,
1276
         if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
1359
         if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
1277
         a.province,
1360
         a.province,
1278
         b1.scene_name as personFrom,
1361
         b1.scene_name as personFrom,
1279
         d.name as realtyConsultant,
1362
         d.name as realtyConsultant,
1280
         d.phone as realtyConsultantPhone,
1363
         d.phone as realtyConsultantPhone,
1281
-        ifnull(e.nickname, f.user_name) as sharePersonName,
1282
-        e.phone as sharePersonPhone,
1283
-        t.create_date as visitDate
1284
-        FROM ta_share_person_from t
1285
-        left join ta_person a on t.person_id = a.person_id
1286
-        left join ta_person_from_record b on a.person_id = b.person_id and b.org_id = 84 and b.is_first_time =1
1364
+        t.visit_time as visitDate
1365
+        From (
1366
+        SELECT
1367
+        t.person_id, t.visit_time
1368
+        FROM
1369
+        ta_person_visit_record t
1370
+        WHERE
1371
+        t.`event` = 'detail'
1372
+        AND t.event_type IN (
1373
+        'activity',
1374
+        'help',
1375
+        'group',
1376
+        'h5'
1377
+        )
1378
+        AND t.org_id = #{orgId}
1379
+        AND t.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d')
1380
+        AND t.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
1381
+        ) t
1382
+        left join ta_person a on  t.person_id = a.person_id
1383
+        left join ta_person_from_record b on a.person_id = b.person_id and b.org_id = #{orgId}
1287
         left join td_wx_dict b1 on b.scene_id = b1.scene_id
1384
         left join td_wx_dict b1 on b.scene_id = b1.scene_id
1288
-        left join ta_recommend_customer  c on c.person_id = t.person_id
1289
-        left join ta_person d on c.recommend_person = d.person_id
1290
-        left join ta_person e on t.share_person = e.person_id
1291
-        left join ta_user f on t.share_person = f.user_id
1292
-        WHERE t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share') and t.org_id = #{orgId} and t.status = 1
1293
-        and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' ) and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
1294
-        <if test="personFrom != null and personFrom != ''">
1295
-            and b.scene_id = #{personFrom}
1296
-        </if>
1297
-        <if test="province != null and province != ''">
1298
-            and a.province = #{province}
1299
-        </if>
1300
-        <if test="realtyConsultant != null and realtyConsultant != ''">
1301
-            and d.name = #{realtyConsultant}
1302
-        </if>
1303
-        <if test="realtyConsultantPhone != null and realtyConsultantPhone != ''">
1304
-            and d.phone = #{realtyConsultantPhone}
1385
+        left join (
1386
+            select d.person_id, d.`name`, d.phone From  ta_recommend_customer c
1387
+            left join ta_person d on c.recommend_person = d.person_id where c.org_id = #{orgId} group by d.person_id
1388
+        ) as d on t.person_id = d.person_id
1389
+        <where>
1390
+            <if test="personFrom != null and personFrom != ''">
1391
+                and b.scene_id = #{personFrom}
1392
+            </if>
1393
+            <if test="province != null and province != ''">
1394
+                and a.province = #{province}
1395
+            </if>
1396
+            <if test="realtyConsultant != null and realtyConsultant != ''">
1397
+                and d.name = #{realtyConsultant}
1398
+            </if>
1399
+            <if test="realtyConsultantPhone != null and realtyConsultantPhone != ''">
1400
+                and d.phone = #{realtyConsultantPhone}
1401
+            </if>
1402
+        </where>
1403
+        order by t.visit_time desc
1404
+    </select>
1405
+
1406
+    <select id="selectActivityVisitPersonNum" resultType="com.huiju.estateagents.excel.ActivityStatistics.VisitPersonNum">
1407
+        select
1408
+        a.nickname, a.phone,
1409
+        if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
1410
+        a.province,
1411
+        b1.scene_name as personFrom,
1412
+        d.name as realtyConsultant,
1413
+        d.phone as realtyConsultantPhone,
1414
+        t.create_date as visitDate,
1415
+        t.visitNum
1416
+        from (
1417
+        SELECT
1418
+        t.visit_time AS create_date,
1419
+        t.person_id,
1420
+        count(*) as visitNum
1421
+        FROM
1422
+        ta_person_visit_record t
1423
+        WHERE
1424
+        t.`event` = 'detail'
1425
+        AND t.event_type IN (
1426
+        'activity',
1427
+        'help',
1428
+        'group',
1429
+        'h5'
1430
+        )
1431
+        AND t.org_id = 84
1432
+        AND t.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d')
1433
+        AND t.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
1434
+        <if test="activityId != null and activityId != ''">
1435
+            and t.target_id = #{activityId}
1436
+        </if>
1437
+        <if test="activityType != null and activityType != ''">
1438
+            and t.event_type = #{activityType}
1305
         </if>
1439
         </if>
1440
+        GROUP BY
1441
+        t.person_id ) as t
1442
+        left join ta_person a on  t.person_id = a.person_id
1443
+        left join ta_person_from_record b on a.person_id = b.person_id and b.org_id = #{orgId}
1444
+        left join td_wx_dict b1 on b.scene_id = b1.scene_id
1445
+        left join (
1446
+        select d.person_id, d.`name`, d.phone From  ta_recommend_customer c
1447
+        left join ta_person d on c.recommend_person = d.person_id where c.org_id = #{orgId} group by d.person_id
1448
+        ) as d on t.person_id = d.person_id
1449
+        <where>
1450
+            <if test="personFrom != null and personFrom != ''">
1451
+                and b.scene_id = #{personFrom}
1452
+            </if>
1453
+            <if test="province != null and province != ''">
1454
+                and a.province = #{province}
1455
+            </if>
1456
+            <if test="realtyConsultant != null and realtyConsultant != ''">
1457
+                and d.name = #{realtyConsultant}
1458
+            </if>
1459
+            <if test="realtyConsultantPhone != null and realtyConsultantPhone != ''">
1460
+                and d.phone = #{realtyConsultantPhone}
1461
+            </if>
1462
+        </where>
1463
+        order by t.create_date desc
1464
+    </select>
1465
+
1466
+    <select id="selectActivityVisitPersonNumExport"
1467
+            resultType="com.huiju.estateagents.excel.ActivityStatistics.VisitPersonNum">
1468
+        select
1469
+        a.nickname, a.phone,
1470
+        if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
1471
+        a.province,
1472
+        b1.scene_name as personFrom,
1473
+        d.name as realtyConsultant,
1474
+        d.phone as realtyConsultantPhone,
1475
+        t.create_date as visitDate,
1476
+        t.visitNum
1477
+        from (
1478
+        SELECT
1479
+        t.visit_time AS create_date,
1480
+        t.person_id,
1481
+        count(*) as visitNum
1482
+        FROM
1483
+        ta_person_visit_record t
1484
+        WHERE
1485
+        t.`event` = 'detail'
1486
+        AND t.event_type IN (
1487
+        'activity',
1488
+        'help',
1489
+        'group',
1490
+        'h5'
1491
+        )
1492
+        AND t.org_id = 84
1493
+        AND t.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d')
1494
+        AND t.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
1495
+        GROUP BY
1496
+        t.person_id ) as t
1497
+        left join ta_person a on  t.person_id = a.person_id
1498
+        left join ta_person_from_record b on a.person_id = b.person_id and b.org_id = #{orgId}
1499
+        left join td_wx_dict b1 on b.scene_id = b1.scene_id
1500
+        left join (
1501
+        select d.person_id, d.`name`, d.phone From  ta_recommend_customer c
1502
+        left join ta_person d on c.recommend_person = d.person_id where c.org_id = #{orgId} group by d.person_id
1503
+        ) as d on t.person_id = d.person_id
1504
+        <where>
1505
+            <if test="personFrom != null and personFrom != ''">
1506
+                and b.scene_id = #{personFrom}
1507
+            </if>
1508
+            <if test="province != null and province != ''">
1509
+                and a.province = #{province}
1510
+            </if>
1511
+            <if test="realtyConsultant != null and realtyConsultant != ''">
1512
+                and d.name = #{realtyConsultant}
1513
+            </if>
1514
+            <if test="realtyConsultantPhone != null and realtyConsultantPhone != ''">
1515
+                and d.phone = #{realtyConsultantPhone}
1516
+            </if>
1517
+        </where>
1518
+        order by t.create_date desc
1306
     </select>
1519
     </select>
1307
 
1520
 
1308
 </mapper>
1521
 </mapper>