Przeglądaj źródła

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

张延森 5 lat temu
rodzic
commit
62eb02ea7b

+ 2
- 2
src/main/java/com/huiju/estateagents/controller/TaLiveActivityController.java Wyświetl plik

@@ -62,7 +62,7 @@ public class TaLiveActivityController extends BaseController {
62 62
         ResponseBean responseBean = new ResponseBean();
63 63
         try {
64 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 66
             responseBean.addSuccess(result);
67 67
 
68 68
         } catch (Exception e) {
@@ -255,7 +255,7 @@ public class TaLiveActivityController extends BaseController {
255 255
             status = status == null ? 1 : status;
256 256
             Integer orgId = getOrgId(request);
257 257
             IPage<TaLiveActivity> result = iTaLiveActivityService.listLiveActivityByCondition(pageNum, pageSize, orgId,
258
-                    liveActivityTitle, cityId, buildingId, status, null);
258
+                    liveActivityTitle, cityId, buildingId, status, null, null);
259 259
             responseBean.addSuccess(result);
260 260
 
261 261
         } catch (Exception e) {

+ 102
- 92
src/main/java/com/huiju/estateagents/controller/TsConsultantKpiController.java Wyświetl plik

@@ -32,8 +32,8 @@ import java.util.List;
32 32
 
33 33
 /**
34 34
  * <p>
35
-    * 置业顾问KPI  前端控制器
36
-    * </p>
35
+ * 置业顾问KPI  前端控制器
36
+ * </p>
37 37
  *
38 38
  * @author yansen
39 39
  * @since 2020-04-14
@@ -49,6 +49,7 @@ public class TsConsultantKpiController extends BaseController {
49 49
 
50 50
     /**
51 51
      * 分页查询列表
52
+     *
52 53
      * @param pageNum
53 54
      * @param pageSize
54 55
      * @param startDate
@@ -59,17 +60,16 @@ public class TsConsultantKpiController extends BaseController {
59 60
      * @param request
60 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 73
         if (null == startDate || "".equals(startDate)) {
74 74
             return ResponseBean.error("开始日期不能为空", ResponseBean.ERROR_ILLEGAL_PARAMS);
75 75
         }
@@ -84,12 +84,12 @@ public class TsConsultantKpiController extends BaseController {
84 84
             IPage<TsConsultantKpi> result = iTsConsultantKpiService.stsKPIDaily(pageNum, pageSize, orgId, userId, buildingId, startDate, endDate, StringUtils.humpToLine(asc), StringUtils.humpToLine(desc));
85 85
             // 汇总
86 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 88
                 put("paged", result);
89 89
                 put("total", total);
90 90
             }});
91
-        }catch (Exception e){
92
-//            e.printStackTrace();
91
+        } catch (Exception e) {
92
+            logger.error("stsConsultantKpiList 异常:", e);
93 93
             return ResponseBean.error("查询出错, 请重试 : " + e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
94 94
         }
95 95
     }
@@ -97,20 +97,21 @@ public class TsConsultantKpiController extends BaseController {
97 97
 
98 98
     /**
99 99
      * 导出
100
+     *
100 101
      * @param startDate
101 102
      * @param endDate
102 103
      * @param buildingId
103 104
      * @param request
104 105
      * @return
105 106
      */
106
-    @RequestMapping(value="/consultant/kpi",method= RequestMethod.POST)
107
+    @RequestMapping(value = "/consultant/kpi", method = RequestMethod.POST)
107 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 115
         if (null == startDate || "".equals(startDate)) {
115 116
             return ResponseBean.error("开始日期不能为空", ResponseBean.ERROR_ILLEGAL_PARAMS);
116 117
         }
@@ -125,7 +126,7 @@ public class TsConsultantKpiController extends BaseController {
125 126
             // 汇总明细
126 127
             List<ConsultantKPIExport> result = iTsConsultantKpiService.stsKPIDailyExport(orgId, userId, buildingId, startDate, endDate);
127 128
             ExcelUtils.flush(response, ConsultantKPIExport.class, result, "置业顾问KPI统计" + DateUtils.today());
128
-        } catch (Exception e){
129
+        } catch (Exception e) {
129 130
 //            e.printStackTrace();
130 131
             return ResponseBean.error("导出Excel出错, 请重试 : " + e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
131 132
         }
@@ -142,8 +143,8 @@ public class TsConsultantKpiController extends BaseController {
142 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 150
         return new LocalDateTime[]{startTime, endTime};
@@ -152,6 +153,7 @@ public class TsConsultantKpiController extends BaseController {
152 153
     /**
153 154
      * 查询置业的客户
154 155
      * startDate 存在则统计新增客户, 不存在则统计所有
156
+     *
155 157
      * @param pageNum
156 158
      * @param pageSize
157 159
      * @param buildingId
@@ -162,14 +164,14 @@ public class TsConsultantKpiController extends BaseController {
162 164
      * @return
163 165
      */
164 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 175
         LocalDateTime[] dateRange = {null, null};
174 176
         try {
175 177
             dateRange = getLocalTimeRangeBy(startDate, endDate);
@@ -185,6 +187,7 @@ public class TsConsultantKpiController extends BaseController {
185 187
 
186 188
     /**
187 189
      * 置业分享拓客
190
+     *
188 191
      * @param pageNum
189 192
      * @param pageSize
190 193
      * @param buildingId
@@ -195,12 +198,12 @@ public class TsConsultantKpiController extends BaseController {
195 198
      * @return
196 199
      */
197 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 207
                                                     HttpServletRequest request) {
205 208
 
206 209
         LocalDateTime[] dateRange = {null, null};
@@ -218,6 +221,7 @@ public class TsConsultantKpiController extends BaseController {
218 221
 
219 222
     /**
220 223
      * 置业首页访问人数
224
+     *
221 225
      * @param pageNum
222 226
      * @param pageSize
223 227
      * @param buildingId
@@ -228,12 +232,12 @@ public class TsConsultantKpiController extends BaseController {
228 232
      * @return
229 233
      */
230 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 241
                                                      HttpServletRequest request) {
238 242
         LocalDateTime[] dateRange = {null, null};
239 243
         try {
@@ -250,6 +254,7 @@ public class TsConsultantKpiController extends BaseController {
250 254
 
251 255
     /**
252 256
      * 置业首页访问次数
257
+     *
253 258
      * @param pageNum
254 259
      * @param pageSize
255 260
      * @param buildingId
@@ -260,14 +265,14 @@ public class TsConsultantKpiController extends BaseController {
260 265
      * @return
261 266
      */
262 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 276
         LocalDateTime[] dateRange = {null, null};
272 277
         try {
273 278
             dateRange = getLocalTimeRangeBy(startDate, endDate);
@@ -283,6 +288,7 @@ public class TsConsultantKpiController extends BaseController {
283 288
 
284 289
     /**
285 290
      * 咨询置业次数
291
+     *
286 292
      * @param pageNum
287 293
      * @param pageSize
288 294
      * @param buildingId
@@ -293,12 +299,12 @@ public class TsConsultantKpiController extends BaseController {
293 299
      * @return
294 300
      */
295 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 308
                                                  HttpServletRequest request) {
303 309
         LocalDateTime[] dateRange = {null, null};
304 310
         try {
@@ -315,6 +321,7 @@ public class TsConsultantKpiController extends BaseController {
315 321
 
316 322
     /**
317 323
      * 点赞详情
324
+     *
318 325
      * @param pageNum
319 326
      * @param pageSize
320 327
      * @param buildingId
@@ -325,13 +332,13 @@ public class TsConsultantKpiController extends BaseController {
325 332
      * @return
326 333
      */
327 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 342
         LocalDateTime[] dateRange = {null, null};
336 343
         try {
337 344
             dateRange = getLocalTimeRangeBy(startDate, endDate);
@@ -347,6 +354,7 @@ public class TsConsultantKpiController extends BaseController {
347 354
 
348 355
     /**
349 356
      * 置业分享次数
357
+     *
350 358
      * @param pageNum
351 359
      * @param pageSize
352 360
      * @param buildingId
@@ -359,15 +367,15 @@ public class TsConsultantKpiController extends BaseController {
359 367
      * @return
360 368
      */
361 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 379
         LocalDateTime[] dateRange = {null, null};
372 380
         try {
373 381
             dateRange = getLocalTimeRangeBy(startDate, endDate);
@@ -383,6 +391,7 @@ public class TsConsultantKpiController extends BaseController {
383 391
 
384 392
     /**
385 393
      * 置业分享访问人数
394
+     *
386 395
      * @param pageNum
387 396
      * @param pageSize
388 397
      * @param buildingId
@@ -393,12 +402,12 @@ public class TsConsultantKpiController extends BaseController {
393 402
      * @return
394 403
      */
395 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 411
                                                   HttpServletRequest request) {
403 412
         LocalDateTime[] dateRange = {null, null};
404 413
         try {
@@ -415,6 +424,7 @@ public class TsConsultantKpiController extends BaseController {
415 424
 
416 425
     /**
417 426
      * 置业分享访问次数
427
+     *
418 428
      * @param pageNum
419 429
      * @param pageSize
420 430
      * @param buildingId
@@ -427,16 +437,16 @@ public class TsConsultantKpiController extends BaseController {
427 437
      * @return
428 438
      */
429 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 450
                                                 HttpServletRequest request) {
441 451
         LocalDateTime[] dateRange = {null, null};
442 452
         try {

+ 1
- 1
src/main/java/com/huiju/estateagents/mapper/TaLiveActivityMapper.java Wyświetl plik

@@ -30,7 +30,7 @@ public interface TaLiveActivityMapper extends BaseMapper<TaLiveActivity> {
30 30
      */
31 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 Wyświetl plik

@@ -41,7 +41,7 @@ public interface ITaLiveActivityService extends IService<TaLiveActivity> {
41 41
      * @return
42 42
      */
43 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 Wyświetl plik

@@ -104,13 +104,13 @@ public class TaLiveActivityServiceImpl extends ServiceImpl<TaLiveActivityMapper,
104 104
 
105 105
     @Override
106 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 108
         logger.info("TaLiveActivityServiceImpl.listLiveActivityByCondition 接收参数:pageNum:{},pageSize:{},orgId:{}," +
109 109
                     "liveActivityTitle:{},cityId:{},buildingId:{},liveDetailType:{},status:{}", pageNum, pageSize,
110 110
                 liveActivityTitle, cityId, buildingId, status);
111 111
 
112 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 116
     @Override

+ 6
- 6
src/main/java/com/huiju/estateagents/service/impl/TsConsultantKpiServiceImpl.java Wyświetl plik

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

+ 4
- 2
src/main/java/com/huiju/estateagents/statistic/controller/ActivityStatisticController.java Wyświetl plik

@@ -244,8 +244,9 @@ public class ActivityStatisticController extends BaseController {
244 244
                                                @RequestParam(value = "activityId", required = false)String activityId,
245 245
                                                @RequestParam(value = "activityType", required = false)String activityType,
246 246
                                                @RequestParam(value = "buildingId", required = false)String buildingId,
247
+                                               @RequestParam(value = "province", required = false)String province,
247 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,6 +260,7 @@ public class ActivityStatisticController extends BaseController {
259 260
                                                                @RequestParam(value = "activityId", required = false)String activityId,
260 261
                                                                @RequestParam(value = "activityType", required = false)String activityType,
261 262
                                                                @RequestParam(value = "buildingId", required = false)String buildingId,
263
+                                                               @RequestParam(value = "province", required = false)String province,
262 264
                                                                HttpServletRequest request, HttpServletResponse response) throws IOException {
263 265
         response.setContentType("application/octet-stream");
264 266
         response.setCharacterEncoding("utf-8");
@@ -266,7 +268,7 @@ public class ActivityStatisticController extends BaseController {
266 268
         ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), AddRegistNum.class).registerWriteHandler(new CustomCellWriteHandler()).build();
267 269
         // 设置 sheet, 同一个sheet只需要设置一次
268 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 272
         excelWriter.write(data, writeSheet);
271 273
         // finish 会帮忙关闭流
272 274
         excelWriter.finish();

+ 2
- 0
src/main/java/com/huiju/estateagents/statistic/mapper/TaActicityStaticMapper.java Wyświetl plik

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

+ 4
- 4
src/main/java/com/huiju/estateagents/statistic/service/impl/TaActivityStaticServiceImpl.java Wyświetl plik

@@ -141,14 +141,14 @@ public class TaActivityStaticServiceImpl {
141 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 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 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 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 Wyświetl plik

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

+ 1
- 1
src/main/resources/mapper/TaPersonVisitRecordMapper.xml Wyświetl plik

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

+ 114
- 77
src/main/resources/mapper/statistic/TaActivityStaticMapper.xml Wyświetl plik

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