瀏覽代碼

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

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

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

62
         ResponseBean responseBean = new ResponseBean();
62
         ResponseBean responseBean = new ResponseBean();
63
         try {
63
         try {
64
             IPage<TaLiveActivity> result = iTaLiveActivityService.listLiveActivityByCondition(pageNum, pageSize, getOrgId(request),
64
             IPage<TaLiveActivity> result = iTaLiveActivityService.listLiveActivityByCondition(pageNum, pageSize, getOrgId(request),
65
-                    liveActivityTitle, cityId, buildingId, status, getTaPersonBuildingListByUserId(request));
65
+                    liveActivityTitle, cityId, buildingId, status, getTaPersonBuildingListByUserId(request), getUserId(request));
66
             responseBean.addSuccess(result);
66
             responseBean.addSuccess(result);
67
 
67
 
68
         } catch (Exception e) {
68
         } catch (Exception e) {
255
             status = status == null ? 1 : status;
255
             status = status == null ? 1 : status;
256
             Integer orgId = getOrgId(request);
256
             Integer orgId = getOrgId(request);
257
             IPage<TaLiveActivity> result = iTaLiveActivityService.listLiveActivityByCondition(pageNum, pageSize, orgId,
257
             IPage<TaLiveActivity> result = iTaLiveActivityService.listLiveActivityByCondition(pageNum, pageSize, orgId,
258
-                    liveActivityTitle, cityId, buildingId, status, null);
258
+                    liveActivityTitle, cityId, buildingId, status, null, null);
259
             responseBean.addSuccess(result);
259
             responseBean.addSuccess(result);
260
 
260
 
261
         } catch (Exception e) {
261
         } catch (Exception e) {

+ 102
- 92
src/main/java/com/huiju/estateagents/controller/TsConsultantKpiController.java 查看文件

32
 
32
 
33
 /**
33
 /**
34
  * <p>
34
  * <p>
35
-    * 置业顾问KPI  前端控制器
36
-    * </p>
35
+ * 置业顾问KPI  前端控制器
36
+ * </p>
37
  *
37
  *
38
  * @author yansen
38
  * @author yansen
39
  * @since 2020-04-14
39
  * @since 2020-04-14
49
 
49
 
50
     /**
50
     /**
51
      * 分页查询列表
51
      * 分页查询列表
52
+     *
52
      * @param pageNum
53
      * @param pageNum
53
      * @param pageSize
54
      * @param pageSize
54
      * @param startDate
55
      * @param startDate
59
      * @param request
60
      * @param request
60
      * @return
61
      * @return
61
      */
62
      */
62
-    @RequestMapping(value="/consultant/kpi",method= RequestMethod.GET)
63
-    public ResponseBean stsConsultantKpiList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
64
-                                            @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
65
-                                            // startDate 默认格式 YYYYMMDD
66
-                                            @RequestParam(value ="startDate", required = false) String startDate,
67
-                                            @RequestParam(value ="endDate", required = false) String endDate,
68
-                                            @RequestParam(value ="buildingId", required = false) String buildingId,
69
-                                            @RequestParam(value ="asc", required = false) String asc,
70
-                                            @RequestParam(value ="desc", required = false) String desc,
71
-                                            HttpServletRequest request
72
-        ){
63
+    @RequestMapping(value = "/consultant/kpi", method = RequestMethod.GET)
64
+    public ResponseBean stsConsultantKpiList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
65
+                                             @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
66
+                                             // startDate 默认格式 YYYYMMDD
67
+                                             @RequestParam(value = "startDate", required = false) String startDate,
68
+                                             @RequestParam(value = "endDate", required = false) String endDate,
69
+                                             @RequestParam(value = "buildingId", required = false) String buildingId,
70
+                                             @RequestParam(value = "asc", required = false) String asc,
71
+                                             @RequestParam(value = "desc", required = false) String desc,
72
+                                             HttpServletRequest request) {
73
         if (null == startDate || "".equals(startDate)) {
73
         if (null == startDate || "".equals(startDate)) {
74
             return ResponseBean.error("开始日期不能为空", ResponseBean.ERROR_ILLEGAL_PARAMS);
74
             return ResponseBean.error("开始日期不能为空", ResponseBean.ERROR_ILLEGAL_PARAMS);
75
         }
75
         }
84
             IPage<TsConsultantKpi> result = iTsConsultantKpiService.stsKPIDaily(pageNum, pageSize, orgId, userId, buildingId, startDate, endDate, StringUtils.humpToLine(asc), StringUtils.humpToLine(desc));
84
             IPage<TsConsultantKpi> result = iTsConsultantKpiService.stsKPIDaily(pageNum, pageSize, orgId, userId, buildingId, startDate, endDate, StringUtils.humpToLine(asc), StringUtils.humpToLine(desc));
85
             // 汇总
85
             // 汇总
86
             TsConsultantKpi total = iTsConsultantKpiService.stsKPITotalByOrg(orgId, userId, buildingId, startDate, endDate);
86
             TsConsultantKpi total = iTsConsultantKpiService.stsKPITotalByOrg(orgId, userId, buildingId, startDate, endDate);
87
-            return ResponseBean.success(new HashMap<String, Object>(){{
87
+            return ResponseBean.success(new HashMap<String, Object>() {{
88
                 put("paged", result);
88
                 put("paged", result);
89
                 put("total", total);
89
                 put("total", total);
90
             }});
90
             }});
91
-        }catch (Exception e){
92
-//            e.printStackTrace();
91
+        } catch (Exception e) {
92
+            logger.error("stsConsultantKpiList 异常:", e);
93
             return ResponseBean.error("查询出错, 请重试 : " + e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
93
             return ResponseBean.error("查询出错, 请重试 : " + e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
94
         }
94
         }
95
     }
95
     }
97
 
97
 
98
     /**
98
     /**
99
      * 导出
99
      * 导出
100
+     *
100
      * @param startDate
101
      * @param startDate
101
      * @param endDate
102
      * @param endDate
102
      * @param buildingId
103
      * @param buildingId
103
      * @param request
104
      * @param request
104
      * @return
105
      * @return
105
      */
106
      */
106
-    @RequestMapping(value="/consultant/kpi",method= RequestMethod.POST)
107
+    @RequestMapping(value = "/consultant/kpi", method = RequestMethod.POST)
107
     public ResponseBean stsConsultantKpiExport(// startDate 默认格式 YYYYMMDD
108
     public ResponseBean stsConsultantKpiExport(// startDate 默认格式 YYYYMMDD
108
-                                            @RequestParam(value ="startDate", required = false) String startDate,
109
-                                            @RequestParam(value ="endDate", required = false) String endDate,
110
-                                            @RequestParam(value ="buildingId", required = false) String buildingId,
111
-                                            HttpServletRequest request,
112
-                                            HttpServletResponse response
113
-    ){
109
+                                               @RequestParam(value = "startDate", required = false) String startDate,
110
+                                               @RequestParam(value = "endDate", required = false) String endDate,
111
+                                               @RequestParam(value = "buildingId", required = false) String buildingId,
112
+                                               HttpServletRequest request,
113
+                                               HttpServletResponse response
114
+    ) {
114
         if (null == startDate || "".equals(startDate)) {
115
         if (null == startDate || "".equals(startDate)) {
115
             return ResponseBean.error("开始日期不能为空", ResponseBean.ERROR_ILLEGAL_PARAMS);
116
             return ResponseBean.error("开始日期不能为空", ResponseBean.ERROR_ILLEGAL_PARAMS);
116
         }
117
         }
125
             // 汇总明细
126
             // 汇总明细
126
             List<ConsultantKPIExport> result = iTsConsultantKpiService.stsKPIDailyExport(orgId, userId, buildingId, startDate, endDate);
127
             List<ConsultantKPIExport> result = iTsConsultantKpiService.stsKPIDailyExport(orgId, userId, buildingId, startDate, endDate);
127
             ExcelUtils.flush(response, ConsultantKPIExport.class, result, "置业顾问KPI统计" + DateUtils.today());
128
             ExcelUtils.flush(response, ConsultantKPIExport.class, result, "置业顾问KPI统计" + DateUtils.today());
128
-        } catch (Exception e){
129
+        } catch (Exception e) {
129
 //            e.printStackTrace();
130
 //            e.printStackTrace();
130
             return ResponseBean.error("导出Excel出错, 请重试 : " + e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
131
             return ResponseBean.error("导出Excel出错, 请重试 : " + e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
131
         }
132
         }
142
                 throw new Exception("日期格式必须为YYYYMMDD");
143
                 throw new Exception("日期格式必须为YYYYMMDD");
143
             }
144
             }
144
 
145
 
145
-            startTime = DateUtils.day2LocalDateime(startDate.substring(0,4) + "-" + startDate.substring(4, 6) + "-" + startDate.substring(6, 8));
146
-            endTime = DateUtils.dayToLocalDateime(endDate.substring(0,4) + "-" + endDate.substring(4, 6) + "-" + endDate.substring(6, 8) + " 23:59:59");
146
+            startTime = DateUtils.day2LocalDateime(startDate.substring(0, 4) + "-" + startDate.substring(4, 6) + "-" + startDate.substring(6, 8));
147
+            endTime = DateUtils.dayToLocalDateime(endDate.substring(0, 4) + "-" + endDate.substring(4, 6) + "-" + endDate.substring(6, 8) + " 23:59:59");
147
         }
148
         }
148
 
149
 
149
         return new LocalDateTime[]{startTime, endTime};
150
         return new LocalDateTime[]{startTime, endTime};
152
     /**
153
     /**
153
      * 查询置业的客户
154
      * 查询置业的客户
154
      * startDate 存在则统计新增客户, 不存在则统计所有
155
      * startDate 存在则统计新增客户, 不存在则统计所有
156
+     *
155
      * @param pageNum
157
      * @param pageNum
156
      * @param pageSize
158
      * @param pageSize
157
      * @param buildingId
159
      * @param buildingId
162
      * @return
164
      * @return
163
      */
165
      */
164
     @GetMapping("/consultant/customer")
166
     @GetMapping("/consultant/customer")
165
-    public ResponseBean getConsultantCustomers(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
166
-                                            @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
167
-                                            @RequestParam(value ="buildingId", required = false) String buildingId,
168
-                                            @RequestParam(value ="userId") String userId,
169
-                                            @RequestParam(value ="startDate", required = false) String startDate,
170
-                                            @RequestParam(value ="endDate", required = false) String endDate,
171
-                                            HttpServletRequest request
172
-    ){
167
+    public ResponseBean getConsultantCustomers(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
168
+                                               @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
169
+                                               @RequestParam(value = "buildingId", required = false) String buildingId,
170
+                                               @RequestParam(value = "userId") String userId,
171
+                                               @RequestParam(value = "startDate", required = false) String startDate,
172
+                                               @RequestParam(value = "endDate", required = false) String endDate,
173
+                                               HttpServletRequest request
174
+    ) {
173
         LocalDateTime[] dateRange = {null, null};
175
         LocalDateTime[] dateRange = {null, null};
174
         try {
176
         try {
175
             dateRange = getLocalTimeRangeBy(startDate, endDate);
177
             dateRange = getLocalTimeRangeBy(startDate, endDate);
185
 
187
 
186
     /**
188
     /**
187
      * 置业分享拓客
189
      * 置业分享拓客
190
+     *
188
      * @param pageNum
191
      * @param pageNum
189
      * @param pageSize
192
      * @param pageSize
190
      * @param buildingId
193
      * @param buildingId
195
      * @return
198
      * @return
196
      */
199
      */
197
     @GetMapping("/consultant/share/customer")
200
     @GetMapping("/consultant/share/customer")
198
-    public ResponseBean getConsultantShareCustomers(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
199
-                                                    @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
200
-                                                    @RequestParam(value ="buildingId", required = false) String buildingId,
201
-                                                    @RequestParam(value ="userId") String userId,
202
-                                                    @RequestParam(value ="startDate", required = false) String startDate,
203
-                                                    @RequestParam(value ="endDate", required = false) String endDate,
201
+    public ResponseBean getConsultantShareCustomers(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
202
+                                                    @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
203
+                                                    @RequestParam(value = "buildingId", required = false) String buildingId,
204
+                                                    @RequestParam(value = "userId") String userId,
205
+                                                    @RequestParam(value = "startDate", required = false) String startDate,
206
+                                                    @RequestParam(value = "endDate", required = false) String endDate,
204
                                                     HttpServletRequest request) {
207
                                                     HttpServletRequest request) {
205
 
208
 
206
         LocalDateTime[] dateRange = {null, null};
209
         LocalDateTime[] dateRange = {null, null};
218
 
221
 
219
     /**
222
     /**
220
      * 置业首页访问人数
223
      * 置业首页访问人数
224
+     *
221
      * @param pageNum
225
      * @param pageNum
222
      * @param pageSize
226
      * @param pageSize
223
      * @param buildingId
227
      * @param buildingId
228
      * @return
232
      * @return
229
      */
233
      */
230
     @GetMapping("/consultant/homepage/persons")
234
     @GetMapping("/consultant/homepage/persons")
231
-    public ResponseBean getConsultantHomePagePersons(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
232
-                                                     @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
233
-                                                     @RequestParam(value ="buildingId", required = false) String buildingId,
234
-                                                     @RequestParam(value ="userId") String userId,
235
-                                                     @RequestParam(value ="startDate", required = false) String startDate,
236
-                                                     @RequestParam(value ="endDate", required = false) String endDate,
235
+    public ResponseBean getConsultantHomePagePersons(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
236
+                                                     @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
237
+                                                     @RequestParam(value = "buildingId", required = false) String buildingId,
238
+                                                     @RequestParam(value = "userId") String userId,
239
+                                                     @RequestParam(value = "startDate", required = false) String startDate,
240
+                                                     @RequestParam(value = "endDate", required = false) String endDate,
237
                                                      HttpServletRequest request) {
241
                                                      HttpServletRequest request) {
238
         LocalDateTime[] dateRange = {null, null};
242
         LocalDateTime[] dateRange = {null, null};
239
         try {
243
         try {
250
 
254
 
251
     /**
255
     /**
252
      * 置业首页访问次数
256
      * 置业首页访问次数
257
+     *
253
      * @param pageNum
258
      * @param pageNum
254
      * @param pageSize
259
      * @param pageSize
255
      * @param buildingId
260
      * @param buildingId
260
      * @return
265
      * @return
261
      */
266
      */
262
     @GetMapping("/consultant/homepage/times")
267
     @GetMapping("/consultant/homepage/times")
263
-    public ResponseBean getConsultantHomePageTimes(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
264
-                                                     @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
265
-                                                     @RequestParam(value ="buildingId", required = false) String buildingId,
266
-                                                     @RequestParam(value ="userId") String userId,
267
-                                                     @RequestParam(value ="startDate", required = false) String startDate,
268
-                                                     @RequestParam(value ="endDate", required = false) String endDate,
269
-                                                   @RequestParam(value ="personId", required = false) String personId,
270
-                                                     HttpServletRequest request) {
268
+    public ResponseBean getConsultantHomePageTimes(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
269
+                                                   @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
270
+                                                   @RequestParam(value = "buildingId", required = false) String buildingId,
271
+                                                   @RequestParam(value = "userId") String userId,
272
+                                                   @RequestParam(value = "startDate", required = false) String startDate,
273
+                                                   @RequestParam(value = "endDate", required = false) String endDate,
274
+                                                   @RequestParam(value = "personId", required = false) String personId,
275
+                                                   HttpServletRequest request) {
271
         LocalDateTime[] dateRange = {null, null};
276
         LocalDateTime[] dateRange = {null, null};
272
         try {
277
         try {
273
             dateRange = getLocalTimeRangeBy(startDate, endDate);
278
             dateRange = getLocalTimeRangeBy(startDate, endDate);
283
 
288
 
284
     /**
289
     /**
285
      * 咨询置业次数
290
      * 咨询置业次数
291
+     *
286
      * @param pageNum
292
      * @param pageNum
287
      * @param pageSize
293
      * @param pageSize
288
      * @param buildingId
294
      * @param buildingId
293
      * @return
299
      * @return
294
      */
300
      */
295
     @GetMapping("/consultant/chat/persons")
301
     @GetMapping("/consultant/chat/persons")
296
-    public ResponseBean getConsultantChatPersons(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
297
-                                                 @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
298
-                                                 @RequestParam(value ="buildingId", required = false) String buildingId,
299
-                                                 @RequestParam(value ="userId") String userId,
300
-                                                 @RequestParam(value ="startDate", required = false) String startDate,
301
-                                                 @RequestParam(value ="endDate", required = false) String endDate,
302
+    public ResponseBean getConsultantChatPersons(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
303
+                                                 @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
304
+                                                 @RequestParam(value = "buildingId", required = false) String buildingId,
305
+                                                 @RequestParam(value = "userId") String userId,
306
+                                                 @RequestParam(value = "startDate", required = false) String startDate,
307
+                                                 @RequestParam(value = "endDate", required = false) String endDate,
302
                                                  HttpServletRequest request) {
308
                                                  HttpServletRequest request) {
303
         LocalDateTime[] dateRange = {null, null};
309
         LocalDateTime[] dateRange = {null, null};
304
         try {
310
         try {
315
 
321
 
316
     /**
322
     /**
317
      * 点赞详情
323
      * 点赞详情
324
+     *
318
      * @param pageNum
325
      * @param pageNum
319
      * @param pageSize
326
      * @param pageSize
320
      * @param buildingId
327
      * @param buildingId
325
      * @return
332
      * @return
326
      */
333
      */
327
     @GetMapping("/consultant/favor")
334
     @GetMapping("/consultant/favor")
328
-    public ResponseBean getConsultantFavor(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
329
-                                                 @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
330
-                                                 @RequestParam(value ="buildingId", required = false) String buildingId,
331
-                                                 @RequestParam(value ="userId") String userId,
332
-                                                 @RequestParam(value ="startDate", required = false) String startDate,
333
-                                                 @RequestParam(value ="endDate", required = false) String endDate,
334
-                                                 HttpServletRequest request) {
335
+    public ResponseBean getConsultantFavor(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
336
+                                           @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
337
+                                           @RequestParam(value = "buildingId", required = false) String buildingId,
338
+                                           @RequestParam(value = "userId") String userId,
339
+                                           @RequestParam(value = "startDate", required = false) String startDate,
340
+                                           @RequestParam(value = "endDate", required = false) String endDate,
341
+                                           HttpServletRequest request) {
335
         LocalDateTime[] dateRange = {null, null};
342
         LocalDateTime[] dateRange = {null, null};
336
         try {
343
         try {
337
             dateRange = getLocalTimeRangeBy(startDate, endDate);
344
             dateRange = getLocalTimeRangeBy(startDate, endDate);
347
 
354
 
348
     /**
355
     /**
349
      * 置业分享次数
356
      * 置业分享次数
357
+     *
350
      * @param pageNum
358
      * @param pageNum
351
      * @param pageSize
359
      * @param pageSize
352
      * @param buildingId
360
      * @param buildingId
359
      * @return
367
      * @return
360
      */
368
      */
361
     @GetMapping("/consultant/share/targets")
369
     @GetMapping("/consultant/share/targets")
362
-    public ResponseBean getConsultantShareTargets(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
363
-                                                   @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
364
-                                                   @RequestParam(value ="buildingId", required = false) String buildingId,
365
-                                                   @RequestParam(value ="userId") String userId,
366
-                                                   @RequestParam(value ="startDate", required = false) String startDate,
367
-                                                   @RequestParam(value ="endDate", required = false) String endDate,
368
-                                                  @RequestParam(value ="targetType", required = false) String targetType,
369
-                                                  @RequestParam(value ="targetName", required = false) String targetName,
370
-                                                   HttpServletRequest request) {
370
+    public ResponseBean getConsultantShareTargets(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
371
+                                                  @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
372
+                                                  @RequestParam(value = "buildingId", required = false) String buildingId,
373
+                                                  @RequestParam(value = "userId") String userId,
374
+                                                  @RequestParam(value = "startDate", required = false) String startDate,
375
+                                                  @RequestParam(value = "endDate", required = false) String endDate,
376
+                                                  @RequestParam(value = "targetType", required = false) String targetType,
377
+                                                  @RequestParam(value = "targetName", required = false) String targetName,
378
+                                                  HttpServletRequest request) {
371
         LocalDateTime[] dateRange = {null, null};
379
         LocalDateTime[] dateRange = {null, null};
372
         try {
380
         try {
373
             dateRange = getLocalTimeRangeBy(startDate, endDate);
381
             dateRange = getLocalTimeRangeBy(startDate, endDate);
383
 
391
 
384
     /**
392
     /**
385
      * 置业分享访问人数
393
      * 置业分享访问人数
394
+     *
386
      * @param pageNum
395
      * @param pageNum
387
      * @param pageSize
396
      * @param pageSize
388
      * @param buildingId
397
      * @param buildingId
393
      * @return
402
      * @return
394
      */
403
      */
395
     @GetMapping("/consultant/share/persons")
404
     @GetMapping("/consultant/share/persons")
396
-    public ResponseBean getConsultantSharePersons(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
397
-                                                  @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
398
-                                                  @RequestParam(value ="buildingId", required = false) String buildingId,
399
-                                                  @RequestParam(value ="userId") String userId,
400
-                                                  @RequestParam(value ="startDate", required = false) String startDate,
401
-                                                  @RequestParam(value ="endDate", required = false) String endDate,
405
+    public ResponseBean getConsultantSharePersons(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
406
+                                                  @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
407
+                                                  @RequestParam(value = "buildingId", required = false) String buildingId,
408
+                                                  @RequestParam(value = "userId") String userId,
409
+                                                  @RequestParam(value = "startDate", required = false) String startDate,
410
+                                                  @RequestParam(value = "endDate", required = false) String endDate,
402
                                                   HttpServletRequest request) {
411
                                                   HttpServletRequest request) {
403
         LocalDateTime[] dateRange = {null, null};
412
         LocalDateTime[] dateRange = {null, null};
404
         try {
413
         try {
415
 
424
 
416
     /**
425
     /**
417
      * 置业分享访问次数
426
      * 置业分享访问次数
427
+     *
418
      * @param pageNum
428
      * @param pageNum
419
      * @param pageSize
429
      * @param pageSize
420
      * @param buildingId
430
      * @param buildingId
427
      * @return
437
      * @return
428
      */
438
      */
429
     @GetMapping("/consultant/share/times")
439
     @GetMapping("/consultant/share/times")
430
-    public ResponseBean getConsultantShareTimes(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
431
-                                                @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
432
-                                                @RequestParam(value ="buildingId", required = false) String buildingId,
433
-                                                @RequestParam(value ="userId") String userId,
434
-                                                @RequestParam(value ="startDate", required = false) String startDate,
435
-                                                @RequestParam(value ="endDate", required = false) String endDate,
436
-                                                @RequestParam(value ="targetType", required = false) String targetType,
437
-                                                @RequestParam(value ="targetName", required = false) String targetName,
438
-                                                @RequestParam(value ="userName", required = false) String userName,
439
-                                                @RequestParam(value ="personId", required = false) String personId,
440
+    public ResponseBean getConsultantShareTimes(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
441
+                                                @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
442
+                                                @RequestParam(value = "buildingId", required = false) String buildingId,
443
+                                                @RequestParam(value = "userId") String userId,
444
+                                                @RequestParam(value = "startDate", required = false) String startDate,
445
+                                                @RequestParam(value = "endDate", required = false) String endDate,
446
+                                                @RequestParam(value = "targetType", required = false) String targetType,
447
+                                                @RequestParam(value = "targetName", required = false) String targetName,
448
+                                                @RequestParam(value = "userName", required = false) String userName,
449
+                                                @RequestParam(value = "personId", required = false) String personId,
440
                                                 HttpServletRequest request) {
450
                                                 HttpServletRequest request) {
441
         LocalDateTime[] dateRange = {null, null};
451
         LocalDateTime[] dateRange = {null, null};
442
         try {
452
         try {

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

30
      */
30
      */
31
     Boolean addVisitNum(@Param("id") String id);
31
     Boolean addVisitNum(@Param("id") String id);
32
 
32
 
33
-    IPage<TaLiveActivity> selectLiveListByCondition(IPage<TaLiveActivity> pg, @Param("liveActivityTitle") String liveActivityTitle, @Param("cityId") String cityId, @Param("buildingId") String buildingId, @Param("status") Integer status, @Param("orgId") Integer orgId,@Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
33
+    IPage<TaLiveActivity> selectLiveListByCondition(IPage<TaLiveActivity> pg, @Param("liveActivityTitle") String liveActivityTitle, @Param("cityId") String cityId, @Param("buildingId") String buildingId, @Param("status") Integer status, @Param("orgId") Integer orgId,@Param("personBuildingList") List<TaPersonBuilding> personBuildingList, @Param("userId") Integer userId);
34
     /**
34
     /**
35
      * 批量更新直播活动状态
35
      * 批量更新直播活动状态
36
      *
36
      *

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

41
      * @return
41
      * @return
42
      */
42
      */
43
     IPage<TaLiveActivity> listLiveActivityByCondition(Integer pageNum, Integer pageSize, Integer orgId, String liveActivityTitle,
43
     IPage<TaLiveActivity> listLiveActivityByCondition(Integer pageNum, Integer pageSize, Integer orgId, String liveActivityTitle,
44
-                                                      String cityId, String buildingId, Integer status, List<TaPersonBuilding> taPersonBuildingListByUserId);
44
+                                                      String cityId, String buildingId, Integer status, List<TaPersonBuilding> taPersonBuildingListByUserId, Integer userId);
45
 
45
 
46
     /**
46
     /**
47
      * 访问量自增
47
      * 访问量自增

+ 2
- 2
src/main/java/com/huiju/estateagents/service/impl/TaLiveActivityServiceImpl.java 查看文件

104
 
104
 
105
     @Override
105
     @Override
106
     public IPage<TaLiveActivity> listLiveActivityByCondition(Integer pageNum, Integer pageSize, Integer orgId, String liveActivityTitle,
106
     public IPage<TaLiveActivity> listLiveActivityByCondition(Integer pageNum, Integer pageSize, Integer orgId, String liveActivityTitle,
107
-                                                             String cityId, String buildingId, Integer status, List<TaPersonBuilding> taPersonBuildingListByUserId) {
107
+                                                             String cityId, String buildingId, Integer status, List<TaPersonBuilding> taPersonBuildingListByUserId, Integer userId) {
108
         logger.info("TaLiveActivityServiceImpl.listLiveActivityByCondition 接收参数:pageNum:{},pageSize:{},orgId:{}," +
108
         logger.info("TaLiveActivityServiceImpl.listLiveActivityByCondition 接收参数:pageNum:{},pageSize:{},orgId:{}," +
109
                     "liveActivityTitle:{},cityId:{},buildingId:{},liveDetailType:{},status:{}", pageNum, pageSize,
109
                     "liveActivityTitle:{},cityId:{},buildingId:{},liveDetailType:{},status:{}", pageNum, pageSize,
110
                 liveActivityTitle, cityId, buildingId, status);
110
                 liveActivityTitle, cityId, buildingId, status);
111
 
111
 
112
         IPage<TaLiveActivity> pg = new Page<>(pageNum, pageSize);
112
         IPage<TaLiveActivity> pg = new Page<>(pageNum, pageSize);
113
-        return taLiveActivityMapper.selectLiveListByCondition(pg, liveActivityTitle, cityId, buildingId, status, orgId,taPersonBuildingListByUserId);
113
+        return taLiveActivityMapper.selectLiveListByCondition(pg, liveActivityTitle, cityId, buildingId, status, orgId,taPersonBuildingListByUserId, userId);
114
     }
114
     }
115
 
115
 
116
     @Override
116
     @Override

+ 6
- 6
src/main/java/com/huiju/estateagents/service/impl/TsConsultantKpiServiceImpl.java 查看文件

46
      * @return List 长度 0 代表未授权楼盘, null 代表管理员, 不校验楼盘授权
46
      * @return List 长度 0 代表未授权楼盘, null 代表管理员, 不校验楼盘授权
47
      */
47
      */
48
     public List<String> getBuildingListOf(Integer userId, String buildingId) {
48
     public List<String> getBuildingListOf(Integer userId, String buildingId) {
49
-        List<String> unAuthrized = new ArrayList<String>(){{
49
+        List<String> unAuthrized = new ArrayList<String>() {{
50
             add("*");   // 构造SQL  building_id in ('*') , 目的是为了阻止检索到数据
50
             add("*");   // 构造SQL  building_id in ('*') , 目的是为了阻止检索到数据
51
         }};
51
         }};
52
 
52
 
55
             return unAuthrized;
55
             return unAuthrized;
56
         }
56
         }
57
 
57
 
58
-        if (taUser.getIsAdmin()) {
58
+        if (null != taUser.getIsAdmin() && taUser.getIsAdmin()) {
59
             if (!StringUtils.isEmpty(buildingId)) {
59
             if (!StringUtils.isEmpty(buildingId)) {
60
-                return new ArrayList<String>(){{
60
+                return new ArrayList<String>() {{
61
                     add(buildingId);
61
                     add(buildingId);
62
                 }};
62
                 }};
63
             }
63
             }
74
             desc = "new_persons";
74
             desc = "new_persons";
75
         }
75
         }
76
 
76
 
77
-        List<String> buildingIds =  getBuildingListOf(userId, buildingId);
77
+        List<String> buildingIds = getBuildingListOf(userId, buildingId);
78
         IPage<TsConsultantKpi> page = new Page<>(pageNum, pageSize);
78
         IPage<TsConsultantKpi> page = new Page<>(pageNum, pageSize);
79
         return tsConsultantKpiMapper.stsKPIDaily(page, orgId, buildingIds, startDate, endDate, asc, desc);
79
         return tsConsultantKpiMapper.stsKPIDaily(page, orgId, buildingIds, startDate, endDate, asc, desc);
80
     }
80
     }
81
 
81
 
82
     @Override
82
     @Override
83
     public TsConsultantKpi stsKPITotalByOrg(Integer orgId, Integer userId, String buildingId, String startDate, String endDate) {
83
     public TsConsultantKpi stsKPITotalByOrg(Integer orgId, Integer userId, String buildingId, String startDate, String endDate) {
84
-        List<String> buildingIds =  getBuildingListOf(userId, buildingId);
84
+        List<String> buildingIds = getBuildingListOf(userId, buildingId);
85
 
85
 
86
         // 合计数据, 但是不包含 客户总计 列
86
         // 合计数据, 但是不包含 客户总计 列
87
         TsConsultantKpi result = tsConsultantKpiMapper.stsKPITotalByOrg(orgId, buildingIds, startDate, endDate);
87
         TsConsultantKpi result = tsConsultantKpiMapper.stsKPITotalByOrg(orgId, buildingIds, startDate, endDate);
95
 
95
 
96
     @Override
96
     @Override
97
     public List<ConsultantKPIExport> stsKPIDailyExport(Integer orgId, Integer userId, String buildingId, String startDate, String endDate) {
97
     public List<ConsultantKPIExport> stsKPIDailyExport(Integer orgId, Integer userId, String buildingId, String startDate, String endDate) {
98
-        List<String> buildingIds =  getBuildingListOf(userId, buildingId);
98
+        List<String> buildingIds = getBuildingListOf(userId, buildingId);
99
         return tsConsultantKpiMapper.stsKPIDailyExport(orgId, buildingIds, startDate, endDate);
99
         return tsConsultantKpiMapper.stsKPIDailyExport(orgId, buildingIds, startDate, endDate);
100
     }
100
     }
101
 
101
 

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

244
                                                @RequestParam(value = "activityId", required = false)String activityId,
244
                                                @RequestParam(value = "activityId", required = false)String activityId,
245
                                                @RequestParam(value = "activityType", required = false)String activityType,
245
                                                @RequestParam(value = "activityType", required = false)String activityType,
246
                                                @RequestParam(value = "buildingId", required = false)String buildingId,
246
                                                @RequestParam(value = "buildingId", required = false)String buildingId,
247
+                                               @RequestParam(value = "province", required = false)String province,
247
                                                HttpServletRequest request) {
248
                                                HttpServletRequest request) {
248
-        return taActivityStaticService.selectActivityAddRegistNum(pageNum, pageSize, getOrgId(request), startDate, endDate, personFrom, activityId, activityType, buildingId, getTaPersonBuildingListByUserId(request), getUserId(request));
249
+        return taActivityStaticService.selectActivityAddRegistNum(pageNum, pageSize, getOrgId(request), startDate, endDate, personFrom, activityId, activityType, buildingId, province, getTaPersonBuildingListByUserId(request), getUserId(request));
249
     }
250
     }
250
 
251
 
251
     /**
252
     /**
259
                                                                @RequestParam(value = "activityId", required = false)String activityId,
260
                                                                @RequestParam(value = "activityId", required = false)String activityId,
260
                                                                @RequestParam(value = "activityType", required = false)String activityType,
261
                                                                @RequestParam(value = "activityType", required = false)String activityType,
261
                                                                @RequestParam(value = "buildingId", required = false)String buildingId,
262
                                                                @RequestParam(value = "buildingId", required = false)String buildingId,
263
+                                                               @RequestParam(value = "province", required = false)String province,
262
                                                                HttpServletRequest request, HttpServletResponse response) throws IOException {
264
                                                                HttpServletRequest request, HttpServletResponse response) throws IOException {
263
         response.setContentType("application/octet-stream");
265
         response.setContentType("application/octet-stream");
264
         response.setCharacterEncoding("utf-8");
266
         response.setCharacterEncoding("utf-8");
266
         ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), AddRegistNum.class).registerWriteHandler(new CustomCellWriteHandler()).build();
268
         ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), AddRegistNum.class).registerWriteHandler(new CustomCellWriteHandler()).build();
267
         // 设置 sheet, 同一个sheet只需要设置一次
269
         // 设置 sheet, 同一个sheet只需要设置一次
268
         WriteSheet writeSheet = EasyExcel.writerSheet("活动统计").build();
270
         WriteSheet writeSheet = EasyExcel.writerSheet("活动统计").build();
269
-        List<AddRegistNum> data = taActivityStaticService.selectActivityAddRegistNumExport(getOrgId(request), startDate, endDate, personFrom, activityId, activityType, buildingId, getTaPersonBuildingListByUserId(request), getUserId(request));
271
+        List<AddRegistNum> data = taActivityStaticService.selectActivityAddRegistNumExport(getOrgId(request), startDate, endDate, personFrom, activityId, activityType, buildingId, province, getTaPersonBuildingListByUserId(request), getUserId(request));
270
         excelWriter.write(data, writeSheet);
272
         excelWriter.write(data, writeSheet);
271
         // finish 会帮忙关闭流
273
         // finish 会帮忙关闭流
272
         excelWriter.finish();
274
         excelWriter.finish();

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

196
             @Param("activityId") String activityId,
196
             @Param("activityId") String activityId,
197
             @Param("activityType") String activityType,
197
             @Param("activityType") String activityType,
198
             @Param("buildingId") String buildingId,
198
             @Param("buildingId") String buildingId,
199
+            @Param("province") String province,
199
             @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
200
             @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
200
             @Param("userId") Integer userId
201
             @Param("userId") Integer userId
201
     );
202
     );
208
             @Param("activityId") String activityId,
209
             @Param("activityId") String activityId,
209
             @Param("activityType") String activityType,
210
             @Param("activityType") String activityType,
210
             @Param("buildingId") String buildingId,
211
             @Param("buildingId") String buildingId,
212
+            @Param("province") String province,
211
             @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
213
             @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
212
             @Param("userId") Integer userId
214
             @Param("userId") Integer userId
213
     );
215
     );

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

141
         return taActicityStaticMapper.selectActivityShareNumExport( orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), sharePersonType, sharePersonName, sharePhone, activityId, activityType, personId, buildingId, sortType, colKey, taPersonBuildings, userId);
141
         return taActicityStaticMapper.selectActivityShareNumExport( orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), sharePersonType, sharePersonName, sharePhone, activityId, activityType, personId, buildingId, sortType, colKey, taPersonBuildings, userId);
142
     }
142
     }
143
 
143
 
144
-    public ResponseBean selectActivityAddRegistNum(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String personFrom, String activityId, String activityType, String buildingId, List<TaPersonBuilding> taPersonBuildings, Integer userId){
144
+    public ResponseBean selectActivityAddRegistNum(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String personFrom, String activityId, String activityType, String buildingId, String province, List<TaPersonBuilding> taPersonBuildings, Integer userId){
145
         IPage<AddRegistNum> iPage = new Page<>(pageNum, pageSize);
145
         IPage<AddRegistNum> iPage = new Page<>(pageNum, pageSize);
146
-        IPage<AddRegistNum> data = taActicityStaticMapper.selectActivityAddRegistNum(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), personFrom, activityId, activityType, buildingId, taPersonBuildings, userId);
146
+        IPage<AddRegistNum> data = taActicityStaticMapper.selectActivityAddRegistNum(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), personFrom, activityId, activityType, buildingId, province, taPersonBuildings, userId);
147
         return ResponseBean.success(data);
147
         return ResponseBean.success(data);
148
     }
148
     }
149
 
149
 
150
-    public List<AddRegistNum> selectActivityAddRegistNumExport(Integer orgId, LocalDate startDate, LocalDate endDate, String personFrom, String activityId, String activityType, String buildingId, List<TaPersonBuilding> taPersonBuildings, Integer userId){
151
-        return taActicityStaticMapper.selectActivityAddRegistNumExport(orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), personFrom, activityId, activityType, buildingId, taPersonBuildings, userId);
150
+    public List<AddRegistNum> selectActivityAddRegistNumExport(Integer orgId, LocalDate startDate, LocalDate endDate, String personFrom, String activityId, String activityType, String buildingId, String province, List<TaPersonBuilding> taPersonBuildings, Integer userId){
151
+        return taActicityStaticMapper.selectActivityAddRegistNumExport(orgId, LocalDateTime.of(startDate, LocalTime.MAX), LocalDateTime.of(endDate, LocalTime.MAX), personFrom, activityId, activityType, buildingId, province, taPersonBuildings, userId);
152
     }
152
     }
153
 
153
 
154
     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, String personId, String buildingId){
154
     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, String personId, String buildingId){

+ 2
- 1
src/main/resources/mapper/TaLiveActivityMapper.xml 查看文件

40
          and t.building_id = #{buildingId}
40
          and t.building_id = #{buildingId}
41
     </if>
41
     </if>
42
     <if test="personBuildingList != null and personBuildingList.size > 0">
42
     <if test="personBuildingList != null and personBuildingList.size > 0">
43
-        AND t.building_id in
43
+        AND (t.building_id in
44
         <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
44
         <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
45
             #{personBuilding.buildingId}
45
             #{personBuilding.buildingId}
46
         </foreach>
46
         </foreach>
47
+        or t.create_user = #{userId})
47
     </if>
48
     </if>
48
         order by t.weight desc
49
         order by t.weight desc
49
     </select>
50
     </select>

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

438
         FROM
438
         FROM
439
         ta_person_visit_record tp
439
         ta_person_visit_record tp
440
         where tp.org_id = #{orgId} AND
440
         where tp.org_id = #{orgId} AND
441
-        tp.event  = 'start'
441
+        tp.event  = 'index'
442
         AND DATE_FORMAT(tp.visit_time,'%Y-%m-%d') = DATE_FORMAT(#{nowDate},'%Y-%m-%d')
442
         AND DATE_FORMAT(tp.visit_time,'%Y-%m-%d') = DATE_FORMAT(#{nowDate},'%Y-%m-%d')
443
     </select>
443
     </select>
444
 
444
 

+ 114
- 77
src/main/resources/mapper/statistic/TaActivityStaticMapper.xml 查看文件

170
         sequence a
170
         sequence a
171
         <trim prefix="where">
171
         <trim prefix="where">
172
             <if test="startDate != null or endDate != null">
172
             <if test="startDate != null or endDate != null">
173
-                a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
173
+                a.rownum <![CDATA[ < ]]> datediff(#{endDate}, #{startDate})
174
             </if>
174
             </if>
175
         </trim>
175
         </trim>
176
         ) AS temp_date
176
         ) AS temp_date
248
         sequence a
248
         sequence a
249
         <trim prefix="where">
249
         <trim prefix="where">
250
             <if test="startDate != null or endDate != null">
250
             <if test="startDate != null or endDate != null">
251
-                a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
251
+                a.rownum <![CDATA[ < ]]> datediff(#{endDate}, #{startDate})
252
             </if>
252
             </if>
253
         </trim>
253
         </trim>
254
         ) AS temp_date
254
         ) AS temp_date
326
         sequence a
326
         sequence a
327
         <trim prefix="where">
327
         <trim prefix="where">
328
             <if test="startDate != null or endDate != null">
328
             <if test="startDate != null or endDate != null">
329
-                a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
329
+                a.rownum <![CDATA[ < ]]> datediff(#{endDate}, #{startDate})
330
             </if>
330
             </if>
331
         </trim>
331
         </trim>
332
         ) AS temp_date
332
         ) AS temp_date
376
         sequence a
376
         sequence a
377
         <trim prefix="where">
377
         <trim prefix="where">
378
             <if test="startDate != null or endDate != null">
378
             <if test="startDate != null or endDate != null">
379
-                a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
379
+                a.rownum <![CDATA[ < ]]> datediff(#{endDate}, #{startDate})
380
             </if>
380
             </if>
381
         </trim>
381
         </trim>
382
         ) AS temp_date
382
         ) AS temp_date
425
         sequence a
425
         sequence a
426
         <trim prefix="where">
426
         <trim prefix="where">
427
             <if test="startDate != null or endDate != null">
427
             <if test="startDate != null or endDate != null">
428
-                a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
428
+                a.rownum <![CDATA[ < ]]> datediff(#{endDate}, #{startDate})
429
             </if>
429
             </if>
430
         </trim>
430
         </trim>
431
         ) AS temp_date
431
         ) AS temp_date
481
         sequence a
481
         sequence a
482
         <trim prefix="where">
482
         <trim prefix="where">
483
             <if test="startDate != null or endDate != null">
483
             <if test="startDate != null or endDate != null">
484
-                a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
484
+                a.rownum <![CDATA[ < ]]> datediff(#{endDate}, #{startDate})
485
             </if>
485
             </if>
486
         </trim>
486
         </trim>
487
         ) AS temp_date
487
         ) AS temp_date
694
         sequence a
694
         sequence a
695
         <trim prefix="where">
695
         <trim prefix="where">
696
             <if test="startDate != null or endDate != null">
696
             <if test="startDate != null or endDate != null">
697
-                a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
697
+                a.rownum <![CDATA[ < ]]> datediff(#{endDate}, #{startDate})
698
             </if>
698
             </if>
699
         </trim>
699
         </trim>
700
         ) AS temp_date
700
         ) AS temp_date
912
             and a.building_id = #{buildingId}
912
             and a.building_id = #{buildingId}
913
         </if>
913
         </if>
914
         <if test="activityName != null and activityName != '' ">
914
         <if test="activityName != null and activityName != '' ">
915
-            and a.title = #{activityName}
915
+            and a.title like concat('%', #{activityName}, '%')
916
         </if>
916
         </if>
917
         <if test="taPersonBuildings != null and taPersonBuildings.size > 0">
917
         <if test="taPersonBuildings != null and taPersonBuildings.size > 0">
918
             and a.building_id in
918
             and a.building_id in
927
             and b.building_id = #{buildingId}
927
             and b.building_id = #{buildingId}
928
         </if>
928
         </if>
929
         <if test="activityName != null and activityName != '' ">
929
         <if test="activityName != null and activityName != '' ">
930
-            and b.title = #{activityName}
930
+            and b.title like concat('%', #{activityName}, '%')
931
         </if>
931
         </if>
932
         <if test="taPersonBuildings != null and taPersonBuildings.size > 0">
932
         <if test="taPersonBuildings != null and taPersonBuildings.size > 0">
933
             and b.building_id in
933
             and b.building_id in
943
             and c.building_id = #{buildingId}
943
             and c.building_id = #{buildingId}
944
         </if>
944
         </if>
945
         <if test="activityName != null and activityName != '' ">
945
         <if test="activityName != null and activityName != '' ">
946
-            and c.activity_name = #{activityName}
946
+            and c.activity_name like concat('%', #{activityName}, '%')
947
         </if>
947
         </if>
948
         <if test="taPersonBuildings != null and taPersonBuildings.size > 0">
948
         <if test="taPersonBuildings != null and taPersonBuildings.size > 0">
949
             and c.building_id in
949
             and c.building_id in
958
             and d.building_id = #{buildingId}
958
             and d.building_id = #{buildingId}
959
         </if>
959
         </if>
960
         <if test="activityName != null and activityName != '' ">
960
         <if test="activityName != null and activityName != '' ">
961
-            and d.name = #{activityName}
961
+            and d.name like concat('%', #{activityName}, '%')
962
         </if>
962
         </if>
963
         <if test="taPersonBuildings != null and taPersonBuildings.size > 0">
963
         <if test="taPersonBuildings != null and taPersonBuildings.size > 0">
964
-            and c.building_id in
964
+            and (d.building_id in
965
             <foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
965
             <foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
966
                 #{taPersonBuilding.buildingId}
966
                 #{taPersonBuilding.buildingId}
967
             </foreach>
967
             </foreach>
968
+            or d.create_user = #{userId}
969
+            )
968
         </if>
970
         </if>
969
         union all
971
         union all
970
         select e.live_activity_id as activityId, e.live_activity_title as activityName, "live" as activityType From
972
         select e.live_activity_id as activityId, e.live_activity_title as activityName, "live" as activityType From
974
             and e.building_id = #{buildingId}
976
             and e.building_id = #{buildingId}
975
         </if>
977
         </if>
976
         <if test="activityName != null and activityName != '' ">
978
         <if test="activityName != null and activityName != '' ">
977
-            and e.live_activity_title = #{activityName}
979
+            and e.live_activity_title like concat('%', #{activityName}, '%')
978
         </if>
980
         </if>
979
         <if test="taPersonBuildings != null and taPersonBuildings.size > 0">
981
         <if test="taPersonBuildings != null and taPersonBuildings.size > 0">
980
-            and e.building_id in
982
+            and (e.building_id in
981
             <foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
983
             <foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
982
                 #{taPersonBuilding.buildingId}
984
                 #{taPersonBuilding.buildingId}
983
             </foreach>
985
             </foreach>
986
+            or e.create_user = #{userId}
987
+            )
984
         </if>
988
         </if>
985
         ) as activity
989
         ) as activity
986
 
990
 
990
             'activity', 'group','h5','help','liveApp','livePost')
994
             'activity', 'group','h5','help','liveApp','livePost')
991
             and a.org_id = #{orgId}
995
             and a.org_id = #{orgId}
992
             <if test="targetType != null and targetType != ''">
996
             <if test="targetType != null and targetType != ''">
993
-                and a.tagert_type = #{targetType}
997
+                and (case when #{targetType} = 'live' then a.tagert_type in ('liveApp', 'livePost') else a.tagert_type = #{targetType}
998
+                end)
994
             </if>
999
             </if>
995
             <if test="startDate != null ">
1000
             <if test="startDate != null ">
996
                 and a.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
1001
                 and a.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
1001
             <if test="startDate == null or endDate == null ">
1006
             <if test="startDate == null or endDate == null ">
1002
                 AND a.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
1007
                 AND a.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
1003
             </if>
1008
             </if>
1004
-            group by a.be_share
1009
+            group by a.be_share,a.tagert_type
1005
         ) as shareNum on shareNum.be_share = activity.activityId and shareNum.tagert_type = activity.activityType
1010
         ) as shareNum on shareNum.be_share = activity.activityId and shareNum.tagert_type = activity.activityType
1006
 
1011
 
1007
         left join (
1012
         left join (
1010
         From ta_share_count a where a.tagert_type in ( 'activity', 'group','h5','help','liveApp','livePost')
1015
         From ta_share_count a where a.tagert_type in ( 'activity', 'group','h5','help','liveApp','livePost')
1011
         and a.org_id = #{orgId}
1016
         and a.org_id = #{orgId}
1012
         <if test="targetType != null and targetType != ''">
1017
         <if test="targetType != null and targetType != ''">
1013
-            and a.tagert_type = #{targetType}
1018
+            and (case when #{targetType} = 'live' then a.tagert_type in ('liveApp', 'livePost') else a.tagert_type = #{targetType}
1019
+            end)
1014
         </if>
1020
         </if>
1015
         <if test="startDate != null ">
1021
         <if test="startDate != null ">
1016
             and a.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
1022
             and a.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
1027
         activity.activityType
1033
         activity.activityType
1028
 
1034
 
1029
         left join (
1035
         left join (
1030
-            select count(*) as visitNum, a.target_id, case when a.target_type = 'dynamic' then 'activity' else a.target_type end as target_type
1036
+            select count(*) as visitNum, a.target_id, case when a.target_type = 'dynamic' then 'activity' when a.target_type is null then 'h5' else a.target_type end as target_type
1031
             From ta_person_visit_record a where a.event_type in
1037
             From ta_person_visit_record a where a.event_type in
1032
             ('activity','group','h5','help') and a.`event` = 'detail' and a.org_id = #{orgId}
1038
             ('activity','group','h5','help') and a.`event` = 'detail' and a.org_id = #{orgId}
1033
-            <if test="targetType != null and targetType != ''">
1039
+            <if test="targetType != null and targetType != '' and targetType != 'h5'">
1034
                 and (case when #{targetType} = 'activity' then a.target_type = 'dynamic' else a.target_type = #{targetType}
1040
                 and (case when #{targetType} = 'activity' then a.target_type = 'dynamic' else a.target_type = #{targetType}
1035
                 end)
1041
                 end)
1036
             </if>
1042
             </if>
1043
             <if test="startDate == null or endDate == null ">
1049
             <if test="startDate == null or endDate == null ">
1044
                 AND a.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
1050
                 AND a.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
1045
             </if>
1051
             </if>
1046
-            group by a.target_id, a.event_type
1052
+            group by a.target_id, a.target_type
1047
         ) as visitNum on visitNum.target_id = activity.activityId and visitNum.target_type = activity.activityType
1053
         ) as visitNum on visitNum.target_id = activity.activityId and visitNum.target_type = activity.activityType
1048
 
1054
 
1049
         left join (
1055
         left join (
1050
-            SELECT count(DISTINCT(a.person_id)) as visitPersonNum , a.target_id, case when a.target_type = 'dynamic' then 'activity' else a.target_type end as event_type
1056
+            SELECT count(DISTINCT(a.person_id)) as visitPersonNum , a.target_id, case when a.target_type = 'dynamic' then 'activity' when a.target_type is null then 'h5' else a.target_type end as event_type
1051
             From ta_person_visit_record a where a.event_type in ('activity','group','h5','help') and a.`event` =
1057
             From ta_person_visit_record a where a.event_type in ('activity','group','h5','help') and a.`event` =
1052
             'detail' and a.org_id = #{orgId}
1058
             'detail' and a.org_id = #{orgId}
1053
-            <if test="targetType != null and targetType != ''">
1059
+            <if test="targetType != null and targetType != '' and targetType != 'h5'">
1054
                 and (case when #{targetType} = 'activity' then a.target_type = 'dynamic' else a.target_type = #{targetType}
1060
                 and (case when #{targetType} = 'activity' then a.target_type = 'dynamic' else a.target_type = #{targetType}
1055
                 end)
1061
                 end)
1056
             </if>
1062
             </if>
1063
             <if test="startDate == null or endDate == null ">
1069
             <if test="startDate == null or endDate == null ">
1064
                 AND a.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
1070
                 AND a.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
1065
             </if>
1071
             </if>
1066
-            group by a.target_id, a.event_type
1072
+            group by a.target_id, a.target_type
1067
         ) as visitPersonNum on visitPersonNum.target_id = activity.activityId and visitPersonNum.event_type =
1073
         ) as visitPersonNum on visitPersonNum.target_id = activity.activityId and visitPersonNum.event_type =
1068
         activity.activityType
1074
         activity.activityType
1069
 
1075
 
1073
         'help_share', 'live_share', 'group_share' ) and a.org_id = #{orgId}
1079
         'help_share', 'live_share', 'group_share' ) and a.org_id = #{orgId}
1074
         and a.status = 1
1080
         and a.status = 1
1075
         and a.is_first_time = 1
1081
         and a.is_first_time = 1
1076
-        <if test="targetType != null and targetType != ''">
1082
+        <if test="targetType != null and targetType != '' and targetType != 'h5'">
1077
             and a.target_type = #{targetType}
1083
             and a.target_type = #{targetType}
1078
         </if>
1084
         </if>
1079
         <if test="startDate != null ">
1085
         <if test="startDate != null ">
1104
     <select id="selectActivityStatisDetailExport"
1110
     <select id="selectActivityStatisDetailExport"
1105
             resultType="com.huiju.estateagents.excel.ActivityStatistics.ActivityDetailShareRecord">
1111
             resultType="com.huiju.estateagents.excel.ActivityStatistics.ActivityDetailShareRecord">
1106
         select
1112
         select
1107
-        activity.activityId, activity.activityName,
1108
-        case when activity.activityType = 'activity' then '报名活动'
1109
-        when activity.activityType = 'help' then '助力活动'
1110
-        when activity.activityType = 'group' then '拼团活动'
1111
-        when activity.activityType = 'h5' then 'H5活动'
1112
-        when activity.activityType = 'live' then '直播活动'
1113
-        end as activityType,
1113
+        activity.*,
1114
         ifnull(shareNum.shareNum, 0) as shareNum,
1114
         ifnull(shareNum.shareNum, 0) as shareNum,
1115
         ifnull(sharePersonNum.sharePersonNum, 0) as sharePersonNum,
1115
         ifnull(sharePersonNum.sharePersonNum, 0) as sharePersonNum,
1116
         ifnull(visitNum.visitNum, 0) as visitNum,
1116
         ifnull(visitNum.visitNum, 0) as visitNum,
1173
             and d.name = #{activityName}
1173
             and d.name = #{activityName}
1174
         </if>
1174
         </if>
1175
         <if test="taPersonBuildings != null and taPersonBuildings.size > 0">
1175
         <if test="taPersonBuildings != null and taPersonBuildings.size > 0">
1176
-            and c.building_id in
1176
+            and (d.building_id in
1177
             <foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
1177
             <foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
1178
                 #{taPersonBuilding.buildingId}
1178
                 #{taPersonBuilding.buildingId}
1179
             </foreach>
1179
             </foreach>
1180
+            or d.create_user = #{userId}
1181
+            )
1180
         </if>
1182
         </if>
1181
         union all
1183
         union all
1182
         select e.live_activity_id as activityId, e.live_activity_title as activityName, "live" as activityType From
1184
         select e.live_activity_id as activityId, e.live_activity_title as activityName, "live" as activityType From
1189
             and e.live_activity_title = #{activityName}
1191
             and e.live_activity_title = #{activityName}
1190
         </if>
1192
         </if>
1191
         <if test="taPersonBuildings != null and taPersonBuildings.size > 0">
1193
         <if test="taPersonBuildings != null and taPersonBuildings.size > 0">
1192
-            and e.building_id in
1194
+            and (e.building_id in
1193
             <foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
1195
             <foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
1194
                 #{taPersonBuilding.buildingId}
1196
                 #{taPersonBuilding.buildingId}
1195
             </foreach>
1197
             </foreach>
1198
+            or e.create_user = #{userId}
1199
+            )
1196
         </if>
1200
         </if>
1197
         ) as activity
1201
         ) as activity
1198
 
1202
 
1201
         FROM ta_share_count a where a.tagert_type in (
1205
         FROM ta_share_count a where a.tagert_type in (
1202
         'activity', 'group','h5','help','liveApp','livePost')
1206
         'activity', 'group','h5','help','liveApp','livePost')
1203
         and a.org_id = #{orgId}
1207
         and a.org_id = #{orgId}
1208
+        <if test="targetType != null and targetType != ''">
1209
+            and a.tagert_type = #{targetType}
1210
+        </if>
1204
         <if test="startDate != null ">
1211
         <if test="startDate != null ">
1205
-            and a.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
1212
+            and a.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
1206
         </if>
1213
         </if>
1207
         <if test="endDate != null ">
1214
         <if test="endDate != null ">
1208
-            and a.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
1215
+            and a.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
1209
         </if>
1216
         </if>
1210
         <if test="startDate == null or endDate == null ">
1217
         <if test="startDate == null or endDate == null ">
1211
             AND a.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
1218
             AND a.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
1212
         </if>
1219
         </if>
1213
-        group by a.be_share
1220
+        group by a.be_share,a.tagert_type
1214
         ) as shareNum on shareNum.be_share = activity.activityId and shareNum.tagert_type = activity.activityType
1221
         ) as shareNum on shareNum.be_share = activity.activityId and shareNum.tagert_type = activity.activityType
1215
 
1222
 
1216
         left join (
1223
         left join (
1217
-        select count(*) as sharePersonNum ,sharePersonNum.be_share, sharePersonNum.tagert_type,
1218
-        sharePersonNum.create_date from (
1219
-        SELECT a.be_share, a.create_date ,case when a.tagert_type = 'liveApp' then 'live' when a.tagert_type = 'livePost' then 'live' else a.tagert_type end   as tagert_type From ta_share_count a where a.tagert_type in ( 'activity', 'group','h5','help','liveApp','livePost')
1224
+        SELECT count(*) as sharePersonNum ,sharePersonNum.be_share, sharePersonNum.tagert_type, sharePersonNum.create_date from (
1225
+        SELECT a.be_share, a.create_date ,case when a.tagert_type = 'liveApp' then 'live' when a.tagert_type = 'livePost' then 'live' else a.tagert_type end   as tagert_type
1226
+        From ta_share_count a where a.tagert_type in ( 'activity', 'group','h5','help','liveApp','livePost')
1220
         and a.org_id = #{orgId}
1227
         and a.org_id = #{orgId}
1228
+        <if test="targetType != null and targetType != ''">
1229
+            and a.tagert_type = #{targetType}
1230
+        </if>
1221
         <if test="startDate != null ">
1231
         <if test="startDate != null ">
1222
-            and a.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
1232
+            and a.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
1223
         </if>
1233
         </if>
1224
         <if test="endDate != null ">
1234
         <if test="endDate != null ">
1225
-            and a.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
1235
+            and a.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
1226
         </if>
1236
         </if>
1227
         <if test="startDate == null or endDate == null ">
1237
         <if test="startDate == null or endDate == null ">
1228
             AND a.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
1238
             AND a.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
1233
         activity.activityType
1243
         activity.activityType
1234
 
1244
 
1235
         left join (
1245
         left join (
1236
-        select * from (
1237
-        select count(*) as visitNum, a.target_id, a.event_type From ta_person_visit_record a where a.event_type in
1246
+        select count(*) as visitNum, a.target_id, case when a.target_type = 'dynamic' then 'activity' when a.target_type is null then 'h5' else a.target_type end as target_type
1247
+        From ta_person_visit_record a where a.event_type in
1238
         ('activity','group','h5','help') and a.`event` = 'detail' and a.org_id = #{orgId}
1248
         ('activity','group','h5','help') and a.`event` = 'detail' and a.org_id = #{orgId}
1249
+        <if test="targetType != null and targetType != '' and targetType != 'h5'">
1250
+            and (case when #{targetType} = 'activity' then a.target_type = 'dynamic' else a.target_type = #{targetType}
1251
+            end)
1252
+        </if>
1239
         <if test="startDate != null">
1253
         <if test="startDate != null">
1240
-            and a.visit_time &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
1254
+            and a.visit_time &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
1241
         </if>
1255
         </if>
1242
         <if test="endDate != null">
1256
         <if test="endDate != null">
1243
-            and a.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
1257
+            and a.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
1244
         </if>
1258
         </if>
1245
         <if test="startDate == null or endDate == null ">
1259
         <if test="startDate == null or endDate == null ">
1246
             AND a.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
1260
             AND a.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
1247
         </if>
1261
         </if>
1248
-        group by a.target_id, a.event_type
1249
-        ) as a
1250
-        ) as visitNum on visitNum.target_id = activity.activityId and visitNum.event_type = activity.activityType
1262
+        group by a.target_id, a.target_type
1263
+        ) as visitNum on visitNum.target_id = activity.activityId and visitNum.target_type = activity.activityType
1251
 
1264
 
1252
         left join (
1265
         left join (
1253
-        select count(*) as visitPersonNum ,visitPersonNum.target_id, visitPersonNum.event_type from (
1254
-        select a.* From ta_person_visit_record a where a.event_type in ('activity','group','h5','help') and a.`event` =
1266
+        SELECT count(DISTINCT(a.person_id)) as visitPersonNum , a.target_id, case when a.target_type = 'dynamic' then 'activity' when a.target_type is null then 'h5' else a.target_type end as event_type
1267
+        From ta_person_visit_record a where a.event_type in ('activity','group','h5','help') and a.`event` =
1255
         'detail' and a.org_id = #{orgId}
1268
         'detail' and a.org_id = #{orgId}
1269
+        <if test="targetType != null and targetType != '' and targetType != 'h5'">
1270
+            and (case when #{targetType} = 'activity' then a.target_type = 'dynamic' else a.target_type = #{targetType}
1271
+            end)
1272
+        </if>
1256
         <if test="startDate != null">
1273
         <if test="startDate != null">
1257
-            and a.visit_time &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
1274
+            and a.visit_time &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
1258
         </if>
1275
         </if>
1259
         <if test="endDate != null">
1276
         <if test="endDate != null">
1260
-            and a.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
1277
+            and a.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
1261
         </if>
1278
         </if>
1262
         <if test="startDate == null or endDate == null ">
1279
         <if test="startDate == null or endDate == null ">
1263
             AND a.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
1280
             AND a.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
1264
         </if>
1281
         </if>
1265
-        group by a.person_id, a.target_id, a.event_type
1266
-        ) as visitPersonNum group by visitPersonNum.target_id, visitPersonNum.event_type
1282
+        group by a.target_id, a.target_type
1267
         ) as visitPersonNum on visitPersonNum.target_id = activity.activityId and visitPersonNum.event_type =
1283
         ) as visitPersonNum on visitPersonNum.target_id = activity.activityId and visitPersonNum.event_type =
1268
         activity.activityType
1284
         activity.activityType
1269
 
1285
 
1273
         'help_share', 'live_share', 'group_share' ) and a.org_id = #{orgId}
1289
         'help_share', 'live_share', 'group_share' ) and a.org_id = #{orgId}
1274
         and a.status = 1
1290
         and a.status = 1
1275
         and a.is_first_time = 1
1291
         and a.is_first_time = 1
1292
+        <if test="targetType != null and targetType != '' and targetType != 'h5'">
1293
+            and a.target_type = #{targetType}
1294
+        </if>
1276
         <if test="startDate != null ">
1295
         <if test="startDate != null ">
1277
-            and a.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
1296
+            and a.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
1278
         </if>
1297
         </if>
1279
         <if test="endDate != null ">
1298
         <if test="endDate != null ">
1280
-            and a.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
1299
+            and a.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
1281
         </if>
1300
         </if>
1282
         <if test="startDate == null or endDate == null">
1301
         <if test="startDate == null or endDate == null">
1283
             AND a.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
1302
             AND a.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
1294
             order by sharePersonNum.create_date desc
1313
             order by sharePersonNum.create_date desc
1295
         </if>
1314
         </if>
1296
         <if test="colKey != null and colKey != ''">
1315
         <if test="colKey != null and colKey != ''">
1297
-            ORDER BY ${colKey} ${sort}
1316
+            ORDER BY ${colKey} ${sortType}
1298
         </if>
1317
         </if>
1299
     </select>
1318
     </select>
1300
 
1319
 
1405
         <if test="activityType != null and activityType != ''">
1424
         <if test="activityType != null and activityType != ''">
1406
             and t.target_type = concat(REPLACE(#{activityType}, 'activity', 'dynamic'), '_share')
1425
             and t.target_type = concat(REPLACE(#{activityType}, 'activity', 'dynamic'), '_share')
1407
         </if>
1426
         </if>
1408
-        and t.org_id = #{orgId} group by t.share_person ) t
1427
+        and t.org_id = #{orgId} ) t
1409
         left join ta_person a on t.share_person = a.person_id
1428
         left join ta_person a on t.share_person = a.person_id
1410
         left join ta_person b on t.share_person = b.user_id
1429
         left join ta_person b on t.share_person = b.user_id
1411
         ) as visitNum on visitNum.person_id = person.person_id
1430
         ) as visitNum on visitNum.person_id = person.person_id
1429
         left join ta_person a on t.share_person = a.person_id
1448
         left join ta_person a on t.share_person = a.person_id
1430
         left join ta_person b on t.share_person = b.user_id
1449
         left join ta_person b on t.share_person = b.user_id
1431
         ) as visitPersonNum on visitPersonNum.person_id = person.person_id
1450
         ) as visitPersonNum on visitPersonNum.person_id = person.person_id
1451
+        group by person.person_id
1432
         <if test="colKey == null or colKey == ''">
1452
         <if test="colKey == null or colKey == ''">
1433
             order by person.create_date desc
1453
             order by person.create_date desc
1434
         </if>
1454
         </if>
1544
         <if test="activityType != null and activityType != ''">
1564
         <if test="activityType != null and activityType != ''">
1545
             and t.target_type = concat(REPLACE(#{activityType}, 'activity', 'dynamic'), '_share')
1565
             and t.target_type = concat(REPLACE(#{activityType}, 'activity', 'dynamic'), '_share')
1546
         </if>
1566
         </if>
1547
-        and t.org_id = #{orgId} group by t.share_person ) t
1567
+        and t.org_id = #{orgId} ) t
1548
         left join ta_person a on t.share_person = a.person_id
1568
         left join ta_person a on t.share_person = a.person_id
1549
         left join ta_person b on t.share_person = b.user_id
1569
         left join ta_person b on t.share_person = b.user_id
1550
         ) as visitNum on visitNum.person_id = person.person_id
1570
         ) as visitNum on visitNum.person_id = person.person_id
1568
         left join ta_person a on t.share_person = a.person_id
1588
         left join ta_person a on t.share_person = a.person_id
1569
         left join ta_person b on t.share_person = b.user_id
1589
         left join ta_person b on t.share_person = b.user_id
1570
         ) as visitPersonNum on visitPersonNum.person_id = person.person_id
1590
         ) as visitPersonNum on visitPersonNum.person_id = person.person_id
1591
+        group by person.person_id
1571
         <if test="colKey == null or colKey == ''">
1592
         <if test="colKey == null or colKey == ''">
1572
             order by person.create_date desc
1593
             order by person.create_date desc
1573
         </if>
1594
         </if>
1645
         </if>
1666
         </if>
1646
         ) as person
1667
         ) as person
1647
         LEFT JOIN (
1668
         LEFT JOIN (
1648
-        SELECT count(*) as visitPersonNum, ifnull(a.person_id,b.person_id) as person_id
1669
+        SELECT count(DISTINCT(t.person_id)) as visitPersonNum, ifnull(a.person_id,b.person_id) as person_id
1649
         FROM ta_share_person_from t
1670
         FROM ta_share_person_from t
1650
         left join ta_person a on t.share_person = a.person_id
1671
         left join ta_person a on t.share_person = a.person_id
1651
         left join ta_person b on t.share_person = b.user_id
1672
         left join ta_person b on t.share_person = b.user_id
1652
-        where t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share') and t.org_id =
1653
-        #{orgId}
1673
+        where t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share') and t.org_id = #{orgId}
1674
+        <if test="activityId != null and activityId != ''">
1675
+            and t.target_id = #{activityId}
1676
+        </if>
1677
+        <if test="activityType != null and activityType != ''">
1678
+            and t.target_type = concat(#{activityType}, '_share')
1679
+        </if>
1654
         <if test="personId != null and personId != ''">
1680
         <if test="personId != null and personId != ''">
1655
             and t.share_person = #{personId}
1681
             and t.share_person = #{personId}
1656
         </if>
1682
         </if>
1739
         </if>
1765
         </if>
1740
         ) as person
1766
         ) as person
1741
         LEFT JOIN (
1767
         LEFT JOIN (
1742
-        SELECT count(*) as visitPersonNum, ifnull(a.person_id,b.person_id) as person_id
1768
+        SELECT count(DISTINCT(t.person_id)) as visitPersonNum, ifnull(a.person_id,b.person_id) as person_id
1743
         FROM ta_share_person_from t
1769
         FROM ta_share_person_from t
1744
         left join ta_person a on t.share_person = a.person_id
1770
         left join ta_person a on t.share_person = a.person_id
1745
         left join ta_person b on t.share_person = b.user_id
1771
         left join ta_person b on t.share_person = b.user_id
1746
-        where t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share') and t.org_id =
1747
-        #{orgId}
1772
+        where t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share') and t.org_id = #{orgId}
1773
+        <if test="activityId != null and activityId != ''">
1774
+            and t.target_id = #{activityId}
1775
+        </if>
1776
+        <if test="activityType != null and activityType != ''">
1777
+            and t.target_type = concat(#{activityType}, '_share')
1778
+        </if>
1748
         <if test="personId != null and personId != ''">
1779
         <if test="personId != null and personId != ''">
1749
             and t.share_person = #{personId}
1780
             and t.share_person = #{personId}
1750
         </if>
1781
         </if>
1763
         a.nickname, a.phone,
1794
         a.nickname, a.phone,
1764
         if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
1795
         if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
1765
         a.province,
1796
         a.province,
1766
-        b1.scene_name as personFrom,
1797
+        b1.scene_alias as personFrom,
1767
         GROUP_CONCAT(c.name) as realtyConsultant,
1798
         GROUP_CONCAT(c.name) as realtyConsultant,
1768
         ifnull(d.phone, d.tel) as realtyConsultantPhone,
1799
         ifnull(d.phone, d.tel) as realtyConsultantPhone,
1769
         ifnull(e.nickname, f.user_name) as sharePersonName,
1800
         ifnull(e.nickname, f.user_name) as sharePersonName,
1770
         ifnull(e.phone, e.tel) as sharePersonPhone
1801
         ifnull(e.phone, e.tel) as sharePersonPhone
1771
         FROM ta_share_person_from t
1802
         FROM ta_share_person_from t
1772
         left join ta_person a on t.person_id = a.person_id
1803
         left join ta_person a on t.person_id = a.person_id
1773
-        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
1804
+        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
1774
         left join td_wx_dict b1 on b.scene_id = b1.scene_id
1805
         left join td_wx_dict b1 on b.scene_id = b1.scene_id
1775
         left join ta_recommend_customer c on c.person_id = t.person_id
1806
         left join ta_recommend_customer c on c.person_id = t.person_id
1776
         left join ta_person d on c.recommend_person = d.person_id
1807
         left join ta_person d on c.recommend_person = d.person_id
1787
         <if test="activityType != null and activityType != ''">
1818
         <if test="activityType != null and activityType != ''">
1788
             and t.target_type = concat(#{activityType}, '_share')
1819
             and t.target_type = concat(#{activityType}, '_share')
1789
         </if>
1820
         </if>
1821
+        <if test="province != null and province != ''">
1822
+            and a.province like concat('%', #{province}, '%')
1823
+        </if>
1790
         <if test="personFrom != null and personFrom != ''">
1824
         <if test="personFrom != null and personFrom != ''">
1791
             and b.scene_type = #{personFrom}
1825
             and b.scene_type = #{personFrom}
1792
         </if>
1826
         </if>
1802
         a.nickname, a.phone,
1836
         a.nickname, a.phone,
1803
         if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
1837
         if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
1804
         a.province,
1838
         a.province,
1805
-        b1.scene_name as personFrom,
1839
+        b1.scene_alias as personFrom,
1806
         GROUP_CONCAT(c.name) as realtyConsultant,
1840
         GROUP_CONCAT(c.name) as realtyConsultant,
1807
         ifnull(d.phone, d.tel) as realtyConsultantPhone,
1841
         ifnull(d.phone, d.tel) as realtyConsultantPhone,
1808
         ifnull(e.nickname, f.user_name) as sharePersonName,
1842
         ifnull(e.nickname, f.user_name) as sharePersonName,
1809
         ifnull(e.phone, e.tel) as sharePersonPhone
1843
         ifnull(e.phone, e.tel) as sharePersonPhone
1810
         FROM ta_share_person_from t
1844
         FROM ta_share_person_from t
1811
         left join ta_person a on t.person_id = a.person_id
1845
         left join ta_person a on t.person_id = a.person_id
1812
-        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
1846
+        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
1813
         left join td_wx_dict b1 on b.scene_id = b1.scene_id
1847
         left join td_wx_dict b1 on b.scene_id = b1.scene_id
1814
         left join ta_recommend_customer c on c.person_id = t.person_id
1848
         left join ta_recommend_customer c on c.person_id = t.person_id
1815
         left join ta_person d on c.recommend_person = d.person_id
1849
         left join ta_person d on c.recommend_person = d.person_id
1826
         <if test="activityType != null and activityType != ''">
1860
         <if test="activityType != null and activityType != ''">
1827
             and t.target_type = concat(#{activityType}, '_share')
1861
             and t.target_type = concat(#{activityType}, '_share')
1828
         </if>
1862
         </if>
1863
+        <if test="province != null and province != ''">
1864
+            and a.province like concat('%', #{province}, '%')
1865
+        </if>
1829
         <if test="personFrom != null and personFrom != ''">
1866
         <if test="personFrom != null and personFrom != ''">
1830
             and b.scene_type = #{personFrom}
1867
             and b.scene_type = #{personFrom}
1831
         </if>
1868
         </if>
1863
             and t.target_id = #{activityId}
1900
             and t.target_id = #{activityId}
1864
         </if>
1901
         </if>
1865
         <if test="activityType != null and activityType != ''">
1902
         <if test="activityType != null and activityType != ''">
1866
-            and (case when #{activityType} = 'activity' then t.target_type = 'dynamic' else t.target_type = #{activityType}
1903
+            and (case when #{activityType} = 'activity' then t.target_type = 'dynamic' when #{activityType} = 'h5' then t.event_type = 'h5' else t.target_type = #{activityType}
1867
             end)
1904
             end)
1868
         </if>
1905
         </if>
1869
         <if test="buildingId != null and buildingId != ''">
1906
         <if test="buildingId != null and buildingId != ''">
1925
             and t.target_id = #{activityId}
1962
             and t.target_id = #{activityId}
1926
         </if>
1963
         </if>
1927
         <if test="activityType != null and activityType != ''">
1964
         <if test="activityType != null and activityType != ''">
1928
-            and (case when #{activityType} = 'activity' then t.target_type = 'dynamic' else t.target_type = #{activityType}
1965
+            and (case when #{activityType} = 'activity' then t.target_type = 'dynamic' when #{activityType} = 'h5' then t.event_type = 'h5' else t.target_type = #{activityType}
1929
             end)
1966
             end)
1930
         </if>
1967
         </if>
1931
         <if test="buildingId != null and buildingId != ''">
1968
         <if test="buildingId != null and buildingId != ''">
1993
             and t.target_id = #{activityId}
2030
             and t.target_id = #{activityId}
1994
         </if>
2031
         </if>
1995
         <if test="activityType != null and activityType != ''">
2032
         <if test="activityType != null and activityType != ''">
1996
-            and (case when #{activityType} = 'activity' then t.target_type = 'dynamic' else t.target_type = #{activityType}
2033
+            and (case when #{activityType} = 'activity' then t.target_type = 'dynamic' when #{activityType} = 'h5' then t.event_type = 'h5' else t.target_type = #{activityType}
1997
             end)
2034
             end)
1998
         </if>
2035
         </if>
1999
         <if test="buildingId != null and buildingId != ''">
2036
         <if test="buildingId != null and buildingId != ''">
2060
             and t.target_id = #{activityId}
2097
             and t.target_id = #{activityId}
2061
         </if>
2098
         </if>
2062
         <if test="activityType != null and activityType != ''">
2099
         <if test="activityType != null and activityType != ''">
2063
-            and (case when #{activityType} = 'activity' then t.target_type = 'dynamic' else t.target_type = #{activityType}
2100
+            and (case when #{activityType} = 'activity' then t.target_type = 'dynamic' when #{activityType} = 'h5' then t.event_type = 'h5' else t.target_type = #{activityType}
2064
             end)
2101
             end)
2065
         </if>
2102
         </if>
2066
         <if test="buildingId != null and buildingId != ''">
2103
         <if test="buildingId != null and buildingId != ''">
2140
         if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
2177
         if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
2141
         a.province,
2178
         a.province,
2142
         b1.scene_alias as personFrom,
2179
         b1.scene_alias as personFrom,
2143
-        d.user_name as realtyConsultant,
2144
-        d.phone as realtyConsultantPhone,
2180
+        GROUP_CONCAT(d.user_name) as realtyConsultant,
2181
+        GROUP_CONCAT(d.phone) as realtyConsultantPhone,
2145
         t.create_date as visitDate,
2182
         t.create_date as visitDate,
2146
         ifnull(e.nickname, f.user_name) as sharePersonName,
2183
         ifnull(e.nickname, f.user_name) as sharePersonName,
2147
         ifnull(e.phone, f.phone) as sharePersonPhone
2184
         ifnull(e.phone, f.phone) as sharePersonPhone
2225
         if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
2262
         if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
2226
         a.province,
2263
         a.province,
2227
         b1.scene_alias as personFrom,
2264
         b1.scene_alias as personFrom,
2228
-        d.user_name as realtyConsultant,
2229
-        d.phone as realtyConsultantPhone,
2265
+        GROUP_CONCAT(d.user_name) as realtyConsultant,
2266
+        GROUP_CONCAT(d.phone) as realtyConsultantPhone,
2230
         t.create_date as visitDate,
2267
         t.create_date as visitDate,
2231
         ifnull(e.nickname, f.user_name) as sharePersonName,
2268
         ifnull(e.nickname, f.user_name) as sharePersonName,
2232
         ifnull(e.phone, f.phone) as sharePersonPhone
2269
         ifnull(e.phone, f.phone) as sharePersonPhone