Przeglądaj źródła

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

yansen 5 lat temu
rodzic
commit
0583aa6f3b
44 zmienionych plików z 1296 dodań i 267 usunięć
  1. 1
    1
      pom.xml
  2. 1
    1
      src/main/java/com/huiju/estateagents/controller/ExtendContentController.java
  3. 5
    0
      src/main/java/com/huiju/estateagents/controller/HelpActivityController.java
  4. 1
    1
      src/main/java/com/huiju/estateagents/controller/MiniAppController.java
  5. 7
    1
      src/main/java/com/huiju/estateagents/controller/TaBuildingController.java
  6. 5
    0
      src/main/java/com/huiju/estateagents/controller/TaBuildingDynamicController.java
  7. 116
    5
      src/main/java/com/huiju/estateagents/controller/TaChannelController.java
  8. 8
    2
      src/main/java/com/huiju/estateagents/controller/TaHousingResourcesController.java
  9. 7
    1
      src/main/java/com/huiju/estateagents/controller/TaLiveActivityController.java
  10. 7
    1
      src/main/java/com/huiju/estateagents/controller/TaNewsController.java
  11. 9
    2
      src/main/java/com/huiju/estateagents/controller/TaPersonController.java
  12. 24
    22
      src/main/java/com/huiju/estateagents/controller/TaQrcodeController.java
  13. 5
    1
      src/main/java/com/huiju/estateagents/controller/TaShareActivityController.java
  14. 8
    1
      src/main/java/com/huiju/estateagents/drainage/controller/TaDrainageController.java
  15. 2
    0
      src/main/java/com/huiju/estateagents/entity/ExtendContent.java
  16. 0
    1
      src/main/java/com/huiju/estateagents/entity/TaCustomerFrom.java
  17. 4
    0
      src/main/java/com/huiju/estateagents/entity/TaPersonVisitRecord.java
  18. 35
    35
      src/main/java/com/huiju/estateagents/excel/ActivityStatistics/ChannelVisitNum.java
  19. 28
    28
      src/main/java/com/huiju/estateagents/excel/ActivityStatistics/ChannelVisitPersonNum.java
  20. 51
    0
      src/main/java/com/huiju/estateagents/excel/ActivityStatistics/TsChannelDaily.java
  21. 1
    1
      src/main/java/com/huiju/estateagents/excel/QrCodeStatistics/QrCodeNewPersonNum.java
  22. 1
    1
      src/main/java/com/huiju/estateagents/excel/QrCodeStatistics/QrCodeVisitNum.java
  23. 14
    4
      src/main/java/com/huiju/estateagents/mapper/TaChannelMapper.java
  24. 4
    1
      src/main/java/com/huiju/estateagents/mapper/TaQrcodeMapper.java
  25. 0
    1
      src/main/java/com/huiju/estateagents/reportCustomerAop/ReportCustomer.java
  26. 73
    30
      src/main/java/com/huiju/estateagents/reportCustomerAop/ReportCustomerAspect.java
  27. 180
    0
      src/main/java/com/huiju/estateagents/reportCustomerAop/ReportCustomerImpl.java
  28. 4
    1
      src/main/java/com/huiju/estateagents/service/ITaQrcodeService.java
  29. 56
    4
      src/main/java/com/huiju/estateagents/service/TaChannelService.java
  30. 3
    2
      src/main/java/com/huiju/estateagents/service/impl/ExtendContentServiceImpl.java
  31. 114
    9
      src/main/java/com/huiju/estateagents/service/impl/TaChannelServiceImpl.java
  32. 5
    1
      src/main/java/com/huiju/estateagents/service/impl/TaPersonServiceImpl.java
  33. 40
    12
      src/main/java/com/huiju/estateagents/service/impl/TaQrcodeServiceImpl.java
  34. 96
    27
      src/main/java/com/huiju/estateagents/service/impl/TaRecommendCustomerServiceImpl.java
  35. 3
    3
      src/main/java/com/huiju/estateagents/statistic/controller/ActivityStatisticController.java
  36. 13
    6
      src/main/java/com/huiju/estateagents/statistic/mapper/TaActicityStaticMapper.java
  37. 34
    9
      src/main/java/com/huiju/estateagents/statistic/service/impl/TaActivityStaticServiceImpl.java
  38. 230
    15
      src/main/resources/mapper/TaChannelMapper.xml
  39. 3
    0
      src/main/resources/mapper/TaLiveActivityMapper.xml
  40. 62
    31
      src/main/resources/mapper/TaQrcodeMapper.xml
  41. 14
    1
      src/main/resources/mapper/TaRecommendCustomerMapper.xml
  42. 18
    0
      src/main/resources/mapper/statistic/TaActivityStaticMapper.xml
  43. 3
    4
      src/main/resources/mapper/statistic/TsPersonFromStatisticMapper.xml
  44. 1
    1
      src/main/resources/mapper/statistic/TsUserBehaviorStatisticMapper.xml

+ 1
- 1
pom.xml Wyświetl plik

@@ -10,7 +10,7 @@
10 10
 	</parent>
11 11
 	<groupId>com.huiju</groupId>
12 12
 	<artifactId>estateagents</artifactId>
13
-	<version>v3.5.21</version>
13
+	<version>v3.5.28</version>
14 14
 	<name>estateages</name>
15 15
 	<description>置业经纪人</description>
16 16
 

+ 1
- 1
src/main/java/com/huiju/estateagents/controller/ExtendContentController.java Wyświetl plik

@@ -111,7 +111,7 @@ public class ExtendContentController extends BaseController {
111 111
                 taBuildingQueryWrapper.eq("building_id", e.getBuildingId());
112 112
                 TaBuilding taBuilding = iTaBuildingService.getOne(taBuildingQueryWrapper);
113 113
                 e.setCityName(null == tdCity ? "" : tdCity.getName());
114
-                if (taBuilding != null){
114
+                if (taBuilding != null && e.getIsHaveActive()){
115 115
                     e.setBuildingName(taBuilding.getBuildingName());
116 116
                 }
117 117
             });

+ 5
- 0
src/main/java/com/huiju/estateagents/controller/HelpActivityController.java Wyświetl plik

@@ -17,6 +17,7 @@ import com.huiju.estateagents.excel.HelpRecordExport;
17 17
 import com.huiju.estateagents.excel.PublicCustomerExport;
18 18
 import com.huiju.estateagents.excel.handler.CustomCellWriteHandler;
19 19
 import com.huiju.estateagents.mapper.HelpInitiateRecordMapper;
20
+import com.huiju.estateagents.reportCustomerAop.ReportCustomer;
20 21
 import com.huiju.estateagents.service.*;
21 22
 import io.swagger.annotations.Api;
22 23
 import io.swagger.annotations.ApiOperation;
@@ -457,7 +458,11 @@ public class HelpActivityController extends BaseController {
457 458
             @ApiImplicitParam(dataTypeClass = Integer.class, name = "helpActivityId", paramType = "path", value = "活动状态")
458 459
     })
459 460
     @RequestMapping(value = "/wx/helpActivity/{helpActivityId}", method = RequestMethod.GET)
461
+    @ReportCustomer(type = "help")
460 462
     public ResponseBean wxHelpActivityGet(@PathVariable(value = "helpActivityId") Integer helpActivityId,
463
+                                          @RequestParam(value = "qrCodeId", required = false) String qrCodeId,
464
+                                          @RequestParam(value = "channelId", required = false) String channelId,
465
+                                          @RequestParam(value = "sceneId", required = false) String sceneId,
461 466
                                           HttpServletRequest request, @RequestParam(value = "initiateId",required = false) Integer initiateId) {
462 467
         ResponseBean responseBean = new ResponseBean();
463 468
         Integer orgId = getOrgId(request);

+ 1
- 1
src/main/java/com/huiju/estateagents/controller/MiniAppController.java Wyświetl plik

@@ -486,7 +486,7 @@ public class MiniAppController extends BaseController {
486 486
     /**
487 487
      * 获取用户绑定手机号信息
488 488
      */
489
-    @PostMapping("Phone")
489
+    @PostMapping("/userPhone")
490 490
     public ResponseBean phone(@RequestBody String paramStr, HttpServletRequest request) {
491 491
         String appid = request.getHeader("appid");
492 492
         JSONObject params = JSONObject.parseObject(paramStr);

+ 7
- 1
src/main/java/com/huiju/estateagents/controller/TaBuildingController.java Wyświetl plik

@@ -11,6 +11,7 @@ import com.huiju.estateagents.entity.TaOrg;
11 11
 import com.huiju.estateagents.entity.TaPerson;
12 12
 import com.huiju.estateagents.mapper.TaBuildingMapper;
13 13
 import com.huiju.estateagents.mapper.TaOrgMapper;
14
+import com.huiju.estateagents.reportCustomerAop.ReportCustomer;
14 15
 import com.huiju.estateagents.service.ITaBuildingService;
15 16
 import com.huiju.estateagents.service.ITaPersonService;
16 17
 import com.huiju.estateagents.service.ITaSaveService;
@@ -355,7 +356,12 @@ public class TaBuildingController extends BaseController {
355 356
      * @return
356 357
      */
357 358
     @RequestMapping(value = "/wx/buildingSelectId/{id}", method = RequestMethod.GET)
358
-    public ResponseBean wxBuildingSelectId(@PathVariable(value = "id") String id, HttpServletRequest request) {
359
+    @ReportCustomer(type = "building")
360
+    public ResponseBean wxBuildingSelectId(@PathVariable(value = "id") String id,
361
+                                           @RequestParam(value = "qrCodeId", required = false) String qrCodeId,
362
+                                           @RequestParam(value = "channelId", required = false) String channelId,
363
+                                           @RequestParam(value = "sceneId", required = false) String sceneId,
364
+                                           HttpServletRequest request) {
359 365
         String openid = getOpenId(request);
360 366
         Integer orgId = getOrgId(request);
361 367
         List<TaPerson> persons = iTaPersonService.getPersonsByOpenId(openid);

+ 5
- 0
src/main/java/com/huiju/estateagents/controller/TaBuildingDynamicController.java Wyświetl plik

@@ -19,6 +19,7 @@ import com.huiju.estateagents.excel.HelpInitiateRecordSucceed;
19 19
 import com.huiju.estateagents.excel.TaActivityDynamicEnlistExport;
20 20
 import com.huiju.estateagents.excel.handler.CustomCellWriteHandler;
21 21
 import com.huiju.estateagents.mapper.*;
22
+import com.huiju.estateagents.reportCustomerAop.ReportCustomer;
22 23
 import com.huiju.estateagents.service.*;
23 24
 import io.swagger.annotations.Api;
24 25
 import io.swagger.annotations.ApiImplicitParam;
@@ -272,7 +273,11 @@ public class TaBuildingDynamicController extends BaseController {
272 273
             @ApiImplicitParam(dataTypeClass = String.class, name = "dynamicId", paramType = "path",value = "活动ID")
273 274
     })
274 275
     @RequestMapping(value = "/wx/buildingDynamiceInfo/{dynamicId}", method = RequestMethod.GET)
276
+    @ReportCustomer(type = "activity")
275 277
     public ResponseBean iBuildingDynamicInfo(@PathVariable(value = "dynamicId") String dynamicId,
278
+                                             @RequestParam(value = "qrCodeId", required = false) String qrCodeId,
279
+                                             @RequestParam(value = "channelId", required = false) String channelId,
280
+                                             @RequestParam(value = "sceneId", required = false) String sceneId,
276 281
                                              HttpServletRequest request){
277 282
         String openid = getOpenId(request);
278 283
         Integer orgId = getOrgId(request);

+ 116
- 5
src/main/java/com/huiju/estateagents/controller/TaChannelController.java Wyświetl plik

@@ -1,10 +1,15 @@
1 1
 package com.huiju.estateagents.controller;
2 2
 
3
+import com.alibaba.excel.EasyExcel;
4
+import com.alibaba.excel.ExcelWriter;
5
+import com.alibaba.excel.write.metadata.WriteSheet;
3 6
 import com.baomidou.mybatisplus.core.metadata.IPage;
4 7
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5 8
 import com.huiju.estateagents.base.BaseController;
6 9
 import com.huiju.estateagents.base.ResponseBean;
7 10
 import com.huiju.estateagents.entity.TaChannel;
11
+import com.huiju.estateagents.excel.ActivityStatistics.*;
12
+import com.huiju.estateagents.excel.handler.CustomCellWriteHandler;
8 13
 import com.huiju.estateagents.mapper.TaChannelMapper;
9 14
 import com.huiju.estateagents.service.ITaPersonService;
10 15
 import com.huiju.estateagents.service.TaChannelService;
@@ -19,6 +24,8 @@ import org.springframework.format.annotation.DateTimeFormat;
19 24
 import org.springframework.web.bind.annotation.*;
20 25
 
21 26
 import javax.servlet.http.HttpServletRequest;
27
+import javax.servlet.http.HttpServletResponse;
28
+import java.io.IOException;
22 29
 import java.time.LocalDate;
23 30
 import java.util.HashMap;
24 31
 import java.util.List;
@@ -256,11 +263,13 @@ public class TaChannelController extends BaseController {
256 263
                                                      @RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize,
257 264
                                                      @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
258 265
                                                      @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate,
259
-                                                     @RequestParam(value = "channelType", required = false)String channelType,
266
+                                                     @RequestParam(value = "targetType", required = false)String targetType,
260 267
                                                      @RequestParam(value = "buildingId", required = false)String buildingId,
261 268
                                                      @RequestParam(value = "channelId") Integer channelId,
269
+                                                     @RequestParam(value = "sortField", required = false) String sortField,
270
+                                                     @RequestParam(value = "sortOrder", required = false) String sortOrder,
262 271
                                                      HttpServletRequest request) {
263
-        return taChannelService.getChannelIntroductionList(pageNum, pageSize, getOrgId(request), startDate, endDate, channelType, buildingId, channelId);
272
+        return taChannelService.getChannelIntroductionList(pageNum, pageSize, getOrgId(request), startDate, endDate, targetType, buildingId, channelId,sortField,sortOrder, getTaPersonBuildingListByUserId(request));
264 273
     }
265 274
 
266 275
     /**
@@ -274,8 +283,10 @@ public class TaChannelController extends BaseController {
274 283
                                        @RequestParam(value = "targetType", required = false) String targetType,
275 284
                                        @RequestParam(value = "buildingId", required = false) String buildingId,
276 285
                                        @RequestParam(value = "channelId", required = false) Integer channelId,
286
+                                       @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
287
+                                       @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate,
277 288
                                        HttpServletRequest request) {
278
-        return taChannelService.getNewuserList(pageNum, pageSize, getOrgId(request), channelId, targetId, targetType, buildingId);
289
+        return taChannelService.getNewuserList(pageNum, pageSize, getOrgId(request), channelId, targetId, targetType, buildingId,startDate,endDate);
279 290
     }
280 291
 
281 292
     /**
@@ -289,8 +300,10 @@ public class TaChannelController extends BaseController {
289 300
                                        @RequestParam(value = "targetType", required = false) String targetType,
290 301
                                        @RequestParam(value = "buildingId", required = false) String buildingId,
291 302
                                        @RequestParam(value = "channelId", required = false) Integer channelId,
303
+                                       @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
304
+                                       @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate,
292 305
                                        HttpServletRequest request) {
293
-        return taChannelService.getVisitNumList(pageNum, pageSize, getOrgId(request), channelId, targetId, targetType, buildingId);
306
+        return taChannelService.getVisitNumList(pageNum, pageSize, getOrgId(request), channelId, targetId, targetType, buildingId,startDate,endDate);
294 307
     }
295 308
 
296 309
 
@@ -305,7 +318,105 @@ public class TaChannelController extends BaseController {
305 318
                                         @RequestParam(value = "targetType", required = false) String targetType,
306 319
                                         @RequestParam(value = "buildingId", required = false) String buildingId,
307 320
                                         @RequestParam(value = "channelId", required = false) Integer channelId,
321
+                                         @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
322
+                                         @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate,
308 323
                                         HttpServletRequest request) {
309
-        return taChannelService.getPersonNumList(pageNum, pageSize, getOrgId(request), channelId, targetId, targetType, buildingId);
324
+        return taChannelService.getPersonNumList(pageNum, pageSize, getOrgId(request), channelId, targetId, targetType, buildingId,startDate,endDate);
325
+    }
326
+
327
+    /**
328
+     * 渠道引进客户统计导出
329
+     * @return
330
+     */
331
+    @GetMapping(value = "/admin/channel/introductionListExport")
332
+    public void getChannelIntroductionListExport(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
333
+                                                         @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate,
334
+                                                         @RequestParam(value = "targetType", required = false)String targetType,
335
+                                                         @RequestParam(value = "buildingId", required = false)String buildingId,
336
+                                                         @RequestParam(value = "channelId") Integer channelId,
337
+                                                         HttpServletRequest request, HttpServletResponse response) throws IOException {
338
+        response.setContentType("application/octet-stream");
339
+        response.setCharacterEncoding("utf-8");
340
+        response.setHeader("Content-disposition", "attachment;filename=引进注册用户.xlsx");
341
+        ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), TsChannelDaily.class).registerWriteHandler(new CustomCellWriteHandler()).build();
342
+        // 设置 sheet, 同一个sheet只需要设置一次
343
+        WriteSheet writeSheet = EasyExcel.writerSheet("引进注册用户").build();
344
+        List<TsChannelDaily> data = taChannelService.getChannelIntroductionListExport(getOrgId(request), startDate, endDate, targetType, buildingId, channelId, getTaPersonBuildingListByUserId(request));
345
+        excelWriter.write(data, writeSheet);
346
+        // finish 会帮忙关闭流
347
+        excelWriter.finish();
348
+    }
349
+
350
+    /**
351
+     * 渠道注册用户列表导出
352
+     * @return
353
+     */
354
+    @GetMapping(value = "/admin/channel/introduction/newuserListExport")
355
+    public void getNewuserListExport(@RequestParam(value = "targetId", required = false) String targetId,
356
+                                       @RequestParam(value = "targetType", required = false) String targetType,
357
+                                       @RequestParam(value = "buildingId", required = false) String buildingId,
358
+                                       @RequestParam(value = "channelId", required = false) Integer channelId,
359
+                                     @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
360
+                                     @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate,
361
+                                       HttpServletRequest request,HttpServletResponse response) throws IOException {
362
+        response.setContentType("application/octet-stream");
363
+        response.setCharacterEncoding("utf-8");
364
+        response.setHeader("Content-disposition", "attachment;filename=注册用户.xlsx");
365
+        ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), ChannelAddRegistNum.class).registerWriteHandler(new CustomCellWriteHandler()).build();
366
+        // 设置 sheet, 同一个sheet只需要设置一次
367
+        WriteSheet writeSheet = EasyExcel.writerSheet("注册用户").build();
368
+        List<ChannelAddRegistNum> data =  taChannelService.getNewuserListExport(getOrgId(request), channelId, targetId, targetType, buildingId,startDate,endDate);
369
+        excelWriter.write(data, writeSheet);
370
+        // finish 会帮忙关闭流
371
+        excelWriter.finish();
372
+    }
373
+
374
+    /**
375
+     * 渠道访问次数列表导出
376
+     * @return
377
+     */
378
+    @GetMapping(value = "/admin/channel/introduction/visitNumListExport")
379
+    public void getVisitNumListExport(@RequestParam(value = "targetId", required = false) String targetId,
380
+                                        @RequestParam(value = "targetType", required = false) String targetType,
381
+                                        @RequestParam(value = "buildingId", required = false) String buildingId,
382
+                                        @RequestParam(value = "channelId", required = false) Integer channelId,
383
+                                      @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
384
+                                      @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate,
385
+                                        HttpServletRequest request,HttpServletResponse response) throws IOException {
386
+        response.setContentType("application/octet-stream");
387
+        response.setCharacterEncoding("utf-8");
388
+        response.setHeader("Content-disposition", "attachment;filename=访问次数.xlsx");
389
+        ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), ChannelVisitNum.class).registerWriteHandler(new CustomCellWriteHandler()).build();
390
+        // 设置 sheet, 同一个sheet只需要设置一次
391
+        WriteSheet writeSheet = EasyExcel.writerSheet("访问次数").build();
392
+        List<ChannelVisitNum> data = taChannelService.getVisitNumListExport(getOrgId(request), channelId, targetId, targetType, buildingId,startDate,endDate);
393
+        excelWriter.write(data, writeSheet);
394
+        // finish 会帮忙关闭流
395
+        excelWriter.finish();
396
+    }
397
+
398
+
399
+    /**
400
+     * 渠道访问人数列表导出
401
+     * @return
402
+     */
403
+    @GetMapping(value = "/admin/channel/introduction/personNumListExport")
404
+    public void getPersonNumListExport(@RequestParam(value = "targetId", required = false) String targetId,
405
+                                         @RequestParam(value = "targetType", required = false) String targetType,
406
+                                         @RequestParam(value = "buildingId", required = false) String buildingId,
407
+                                         @RequestParam(value = "channelId", required = false) Integer channelId,
408
+                                       @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
409
+                                       @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate,
410
+                                         HttpServletRequest request,HttpServletResponse response) throws IOException {
411
+        response.setContentType("application/octet-stream");
412
+        response.setCharacterEncoding("utf-8");
413
+        response.setHeader("Content-disposition", "attachment;filename=访问人数.xlsx");
414
+        ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), ChannelVisitPersonNum.class).registerWriteHandler(new CustomCellWriteHandler()).build();
415
+        // 设置 sheet, 同一个sheet只需要设置一次
416
+        WriteSheet writeSheet = EasyExcel.writerSheet("访问人数").build();
417
+        List<ChannelVisitPersonNum> data = taChannelService.getPersonNumListExport(getOrgId(request), channelId, targetId, targetType, buildingId,startDate,endDate);
418
+        excelWriter.write(data, writeSheet);
419
+        // finish 会帮忙关闭流
420
+        excelWriter.finish();
310 421
     }
311 422
 }

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

@@ -7,6 +7,7 @@ import com.huiju.estateagents.base.ResponseBean;
7 7
 import com.huiju.estateagents.common.CommConstant;
8 8
 import com.huiju.estateagents.entity.*;
9 9
 import com.huiju.estateagents.po.TaHousingResourcesPO;
10
+import com.huiju.estateagents.reportCustomerAop.ReportCustomer;
10 11
 import com.huiju.estateagents.service.*;
11 12
 import org.apache.commons.collections.CollectionUtils;
12 13
 import org.apache.commons.lang3.StringUtils;
@@ -244,9 +245,14 @@ public class TaHousingResourcesController extends BaseController {
244 245
      * @author gushaoyong
245 246
      */
246 247
     @RequestMapping(value = "/wx/listHousingResources", method = RequestMethod.GET)
248
+    @ReportCustomer(type = "house")
247 249
     public ResponseBean listHousingResources(@RequestParam(value = "salesBatchId") String salesBatchId,
248
-                                             String startPrice, String endPrice, String apartmentId, @RequestParam(value = "source", required = false) String source,
249
-                                             HttpServletRequest request) {
250
+                                             @RequestParam(value = "qrCodeId", required = false) String qrCodeId,
251
+                                             @RequestParam(value = "channelId", required = false) String channelId,
252
+                                             @RequestParam(value = "sceneId", required = false) String sceneId,
253
+                                             HttpServletRequest request,
254
+                                             String startPrice, String endPrice, String apartmentId, @RequestParam(value = "source", required = false) String source
255
+                                             ) {
250 256
         ResponseBean responseBean = new ResponseBean();
251 257
         Integer orgId = getOrgId(request);
252 258
         String openid = getOpenId(request);

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

@@ -8,6 +8,7 @@ import com.huiju.estateagents.common.CommConstant;
8 8
 import com.huiju.estateagents.common.StringUtils;
9 9
 import com.huiju.estateagents.entity.ExtendContent;
10 10
 import com.huiju.estateagents.entity.TaLiveActivity;
11
+import com.huiju.estateagents.reportCustomerAop.ReportCustomer;
11 12
 import com.huiju.estateagents.service.IExtendContentService;
12 13
 import com.huiju.estateagents.service.ITaLiveActivityService;
13 14
 import org.slf4j.Logger;
@@ -221,7 +222,12 @@ public class TaLiveActivityController extends BaseController {
221 222
      * @return
222 223
      */
223 224
     @RequestMapping(value = "/wx/taLiveActivity/{id}", method = RequestMethod.GET)
224
-    public ResponseBean getLiveActivityDetailById(@PathVariable("id") String id, HttpServletRequest request) {
225
+    @ReportCustomer(type = "live")
226
+    public ResponseBean getLiveActivityDetailById(@PathVariable("id") String id,
227
+                                                  @RequestParam(value = "qrCodeId", required = false) String qrCodeId,
228
+                                                  @RequestParam(value = "channelId", required = false) String channelId,
229
+                                                  @RequestParam(value = "sceneId", required = false) String sceneId,
230
+                                                  HttpServletRequest request) {
225 231
         ResponseBean responseBean = new ResponseBean();
226 232
         try {
227 233
             responseBean = iTaLiveActivityService.getLiveActivityDetailById(id, getOrgId(request));

+ 7
- 1
src/main/java/com/huiju/estateagents/controller/TaNewsController.java Wyświetl plik

@@ -10,6 +10,7 @@ import com.huiju.estateagents.common.JWTUtils;
10 10
 import com.huiju.estateagents.entity.TaBuildingDynamic;
11 11
 import com.huiju.estateagents.entity.TaNews;
12 12
 import com.huiju.estateagents.entity.TaPerson;
13
+import com.huiju.estateagents.reportCustomerAop.ReportCustomer;
13 14
 import com.huiju.estateagents.service.*;
14 15
 import io.swagger.annotations.Api;
15 16
 import io.swagger.annotations.ApiImplicitParam;
@@ -215,7 +216,12 @@ public class TaNewsController extends BaseController {
215 216
      * @param id  实体ID
216 217
      */
217 218
     @RequestMapping(value="/wx/taNews/{id}",method= RequestMethod.GET)
218
-    public ResponseBean wxTaNewsGet(@PathVariable Integer id,HttpServletRequest request){
219
+    @ReportCustomer(type = "news")
220
+    public ResponseBean wxTaNewsGet(@PathVariable Integer id,
221
+                                    @RequestParam(value = "qrCodeId", required = false) String qrCodeId,
222
+                                    @RequestParam(value = "channelId", required = false) String channelId,
223
+                                    @RequestParam(value = "sceneId", required = false) String sceneId,
224
+                                    HttpServletRequest request){
219 225
         String openid = getOpenId(request);
220 226
         List<TaPerson> persons = iTaPersonService.getPersonsByOpenId(openid);
221 227
         if (null == persons || persons.size() == 0) {

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

@@ -784,8 +784,15 @@ public class TaPersonController extends BaseController {
784 784
     }
785 785
 
786 786
     @PutMapping("/wx/userInfo/updatePhoto")
787
-    public ResponseBean updateUserPhoto(String photoUrl, HttpServletRequest request){
787
+    public ResponseBean updateUserPhoto(@RequestBody Map<String, String> photoUrl, HttpServletRequest request){
788
+        ResponseBean responseBean = new ResponseBean();
789
+
788 790
         String openId = getOpenId(request);
789
-        return taPersonService.updateUserPhoto(photoUrl, openId);
791
+        String imgUrl = photoUrl.get("photoUrl");
792
+        if (StringUtils.isEmpty(imgUrl)){
793
+            responseBean.addError("请上传图片");
794
+            return responseBean;
795
+        }
796
+        return taPersonService.updateUserPhoto(imgUrl, openId);
790 797
     }
791 798
 }

+ 24
- 22
src/main/java/com/huiju/estateagents/controller/TaQrcodeController.java Wyświetl plik

@@ -1,17 +1,14 @@
1 1
 package com.huiju.estateagents.controller;
2 2
 
3
-import com.alibaba.excel.EasyExcel;
4
-import com.alibaba.excel.ExcelWriter;
5
-import com.alibaba.excel.support.ExcelTypeEnum;
3
+import com.alibaba.fastjson.JSON;
6 4
 import com.alibaba.fastjson.JSONObject;
7 5
 import com.huiju.estateagents.base.BaseController;
8 6
 import com.huiju.estateagents.base.ResponseBean;
9 7
 import com.huiju.estateagents.common.CommConstant;
8
+import com.huiju.estateagents.entity.TaPersonBuilding;
10 9
 import com.huiju.estateagents.entity.TaQrcode;
11
-import com.huiju.estateagents.excel.ActivityStatistics.VisitPersonNum;
12
-import com.huiju.estateagents.service.IMiniAppService;
13 10
 import com.huiju.estateagents.service.ITaQrcodeService;
14
-import org.apache.poi.sl.usermodel.Sheet;
11
+import org.apache.commons.lang3.StringUtils;
15 12
 import org.slf4j.Logger;
16 13
 import org.slf4j.LoggerFactory;
17 14
 import org.springframework.beans.factory.annotation.Autowired;
@@ -20,8 +17,9 @@ import org.springframework.web.bind.annotation.*;
20 17
 import javax.servlet.http.HttpServletRequest;
21 18
 import javax.servlet.http.HttpServletResponse;
22 19
 import java.io.IOException;
23
-import java.io.OutputStream;
20
+import java.util.HashMap;
24 21
 import java.util.List;
22
+import java.util.Map;
25 23
 
26 24
 /**
27 25
  * <p>
@@ -40,10 +38,6 @@ public class TaQrcodeController extends BaseController {
40 38
     @Autowired
41 39
     public ITaQrcodeService iTaQrcodeService;
42 40
 
43
-    @Autowired
44
-    private IMiniAppService iMiniAppService;
45
-
46
-
47 41
     /**
48 42
      * 分页查询列表
49 43
      *
@@ -60,7 +54,8 @@ public class TaQrcodeController extends BaseController {
60 54
                 targetType, targetName, channelId, buildingId);
61 55
         ResponseBean responseBean = new ResponseBean();
62 56
         try {
63
-            responseBean = iTaQrcodeService.listQrCodeByCondition(pageNum, pageSize, targetType, targetName, channelId, buildingId, getOrgId(request));
57
+            List<TaPersonBuilding> personBuildingList = getTaPersonBuildingListByUserId(request);
58
+            responseBean = iTaQrcodeService.listQrCodeByCondition(pageNum, pageSize, targetType, targetName, channelId, buildingId, getUserId(request), getOrgId(request), personBuildingList);
64 59
         } catch (Exception e) {
65 60
             e.printStackTrace();
66 61
             logger.error("taQrcodeList -=- {}", e.toString());
@@ -79,6 +74,11 @@ public class TaQrcodeController extends BaseController {
79 74
     public ResponseBean saveQrcode(@RequestBody TaQrcode taQrcode, HttpServletRequest request) {
80 75
         ResponseBean responseBean = new ResponseBean();
81 76
         try {
77
+            // 校验参数
78
+            if (StringUtils.isBlank(taQrcode.getTargetId()) || StringUtils.isBlank(taQrcode.getTargetType())) {
79
+                responseBean.addError("参数错误");
80
+                return responseBean;
81
+            }
82 82
             responseBean = iTaQrcodeService.saveQrcode(taQrcode, getUserId(request), getOrgId(request));
83 83
         } catch (Exception e) {
84 84
             e.printStackTrace();
@@ -208,7 +208,7 @@ public class TaQrcodeController extends BaseController {
208 208
      * @param request
209 209
      * @return
210 210
      */
211
-    @RequestMapping(value = "/admin/getStatisticRecord", method = RequestMethod.GET)
211
+    @RequestMapping(value = "/admin/qrCode/getStatisticRecord", method = RequestMethod.GET)
212 212
     public ResponseBean getStatisticRecord(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
213 213
                                            @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
214 214
                                            Integer qrCodeId, Integer type, HttpServletRequest request) {
@@ -222,18 +222,20 @@ public class TaQrcodeController extends BaseController {
222 222
         return responseBean;
223 223
     }
224 224
 
225
-    @RequestMapping(value = "/admin/getStatisticRecordExport", method = RequestMethod.GET)
226
-    public void getStatisticRecordExport(Integer qrCodeId, Integer type, HttpServletRequest request, HttpServletResponse response) {
225
+    @RequestMapping(value = "/admin/qrCode/getStatisticRecordExport", method = RequestMethod.GET)
226
+    public void getStatisticRecordExport(@RequestParam(value = "qrCodeId") Integer qrCodeId,
227
+                                         @RequestParam(value = "type") Integer type, HttpServletRequest request, HttpServletResponse response) throws IOException {
227 228
         try {
228 229
             iTaQrcodeService.getStatisticRecordExport(type, qrCodeId, getOrgId(request), response);
229 230
         } catch (Exception e) {
230
-            e.printStackTrace();
231
-        } finally {
232
-            try {
233
-                response.getOutputStream().close();
234
-            } catch (IOException e) {
235
-                e.printStackTrace();
236
-            }
231
+            logger.error("getStatisticRecordExport 异常:", e);
232
+            response.reset();
233
+            response.setContentType("application/json");
234
+            response.setCharacterEncoding("utf-8");
235
+            Map<String, Object> map = new HashMap();
236
+            map.put("code", ResponseBean.ERROR_UNAVAILABLE);
237
+            map.put("message", "下载文件失败" + e.getMessage());
238
+            response.getWriter().println(JSON.toJSONString(map));
237 239
         }
238 240
     }
239 241
 

+ 5
- 1
src/main/java/com/huiju/estateagents/controller/TaShareActivityController.java Wyświetl plik

@@ -363,7 +363,11 @@ public class TaShareActivityController extends BaseController {
363 363
     @RequestMapping(value="/wx/taShareActivity/{groupActivityId}",method= RequestMethod.GET)
364 364
     @ReportCustomer(type = "group")
365 365
     public ResponseBean wxShareActivityGet(@PathVariable Integer groupActivityId,
366
-                                           HttpServletRequest request, @RequestParam(value = "recordId",required = false) Integer recordId ){
366
+                                           @RequestParam(value = "qrCodeId", required = false) String qrCodeId,
367
+                                           @RequestParam(value = "channelId", required = false) String channelId,
368
+                                           @RequestParam(value = "sceneId", required = false) String sceneId,
369
+                                           HttpServletRequest request,
370
+                                           @RequestParam(value = "recordId",required = false) Integer recordId ){
367 371
         ResponseBean responseBean = new ResponseBean();
368 372
         String openid = getOpenId(request);
369 373
         Integer orgId = getOrgId(request);

+ 8
- 1
src/main/java/com/huiju/estateagents/drainage/controller/TaDrainageController.java Wyświetl plik

@@ -15,6 +15,7 @@ import com.huiju.estateagents.entity.ExtendContent;
15 15
 import com.huiju.estateagents.entity.TaMiniapp;
16 16
 import com.huiju.estateagents.entity.TaPersonBuilding;
17 17
 import com.huiju.estateagents.mapper.TaMiniappMapper;
18
+import com.huiju.estateagents.reportCustomerAop.ReportCustomer;
18 19
 import com.huiju.estateagents.service.IExtendContentService;
19 20
 import com.huiju.estateagents.service.IMiniAppService;
20 21
 import com.huiju.estateagents.third.entity.TaThirdPartyMiniappConfig;
@@ -91,6 +92,7 @@ public class TaDrainageController extends BaseController {
91 92
             }
92 93
             queryWrapper.eq(null != status,"status",status);
93 94
             queryWrapper.eq(!StringUtils.isEmpty(buildingId),"building_id",buildingId);
95
+            queryWrapper.isNull(StringUtils.isEmpty(buildingId),"building_id");
94 96
             queryWrapper.eq(null != drainageId,"drainage_id",drainageId);
95 97
             queryWrapper.and(taPersonBuildingList.size() > 0, wapper -> wapper.in("building_id",taPersonBuildingList.stream().map(TaPersonBuilding::getBuildingId).collect(Collectors.toList())).or().eq("create_user",getUserId(request)));
96 98
             queryWrapper.like(!StringUtils.isEmpty(name),"name",name);
@@ -332,7 +334,12 @@ public class TaDrainageController extends BaseController {
332 334
      * @param id  实体ID
333 335
      */
334 336
     @RequestMapping(value="/wx/taDrainage/{id}",method= RequestMethod.GET)
335
-    public ResponseBean wxDrainageGet(@PathVariable Integer id, HttpServletRequest request){
337
+    @ReportCustomer(type = "h5")
338
+    public ResponseBean wxDrainageGet(@PathVariable Integer id,
339
+                                      @RequestParam(value = "qrCodeId", required = false) String qrCodeId,
340
+                                      @RequestParam(value = "channelId", required = false) String channelId,
341
+                                      @RequestParam(value = "sceneId", required = false) String sceneId,
342
+                                      HttpServletRequest request){
336 343
         ResponseBean responseBean = new ResponseBean();
337 344
         try {
338 345
             responseBean.addSuccess(iTaDrainageService.getById(id));

+ 2
- 0
src/main/java/com/huiju/estateagents/entity/ExtendContent.java Wyświetl plik

@@ -104,6 +104,8 @@ public class ExtendContent implements Serializable {
104 104
      */
105 105
     private Integer createUser;
106 106
 
107
+    private Boolean isHaveActive;
108
+
107 109
     /**
108 110
      * 排序
109 111
      */

+ 0
- 1
src/main/java/com/huiju/estateagents/entity/TaCustomerFrom.java Wyświetl plik

@@ -19,7 +19,6 @@ import lombok.experimental.Accessors;
19 19
  */
20 20
 @Data
21 21
 @EqualsAndHashCode(callSuper = false)
22
-@Accessors(chain = true)
23 22
 public class TaCustomerFrom implements Serializable {
24 23
 
25 24
     private static final long serialVersionUID = 1L;

+ 4
- 0
src/main/java/com/huiju/estateagents/entity/TaPersonVisitRecord.java Wyświetl plik

@@ -214,4 +214,8 @@ public class TaPersonVisitRecord implements Serializable {
214 214
      */
215 215
     @TableField(exist = false)
216 216
     private String city;
217
+
218
+    private Integer qrCodeId;
219
+
220
+    private Integer channelId;
217 221
 }

+ 35
- 35
src/main/java/com/huiju/estateagents/excel/ActivityStatistics/ChannelVisitNum.java Wyświetl plik

@@ -34,46 +34,46 @@ public class ChannelVisitNum {
34 34
     @ExcelProperty(value = "归属地", index = 3)
35 35
     private String province;
36 36
 
37
-    /**
38
-     * 来源渠道
39
-     */
40
-    @ColumnWidth(15)
41
-    @ExcelProperty(value = "来源渠道", index = 4)
42
-    private String personFrom;
43
-
44
-    /**
45
-     * 置业顾问
46
-     */
47
-    @ColumnWidth(15)
48
-    @ExcelProperty(value = "置业顾问", index = 5)
49
-    private String realtyConsultant;
50
-
51
-    /**
52
-     * 置业顾问电话
53
-     */
54
-    @ColumnWidth(15)
55
-    @ExcelProperty(value = "置业顾问电话", index = 6)
56
-    private String realtyConsultantPhone;
57
-
58
-    /**
59
-     * 分享者
60
-     */
61
-    @ColumnWidth(15)
62
-    @ExcelProperty(value = "分享者", index = 7)
63
-    private String sharePersonName;
64
-
65
-    /**
66
-     * 分享者电话
67
-     */
68
-    @ColumnWidth(15)
69
-    @ExcelProperty(value = "分享者电话", index = 8)
70
-    private String sharePersonPhone;
37
+//    /**
38
+//     * 来源渠道
39
+//     */
40
+//    @ColumnWidth(15)
41
+//    @ExcelProperty(value = "来源渠道", index = 4)
42
+//    private String personFrom;
43
+//
44
+//    /**
45
+//     * 置业顾问
46
+//     */
47
+//    @ColumnWidth(15)
48
+//    @ExcelProperty(value = "置业顾问", index = 5)
49
+//    private String realtyConsultant;
50
+//
51
+//    /**
52
+//     * 置业顾问电话
53
+//     */
54
+//    @ColumnWidth(15)
55
+//    @ExcelProperty(value = "置业顾问电话", index = 6)
56
+//    private String realtyConsultantPhone;
57
+//
58
+//    /**
59
+//     * 分享者
60
+//     */
61
+//    @ColumnWidth(15)
62
+//    @ExcelProperty(value = "分享者", index = 7)
63
+//    private String sharePersonName;
64
+//
65
+//    /**
66
+//     * 分享者电话
67
+//     */
68
+//    @ColumnWidth(15)
69
+//    @ExcelProperty(value = "分享者电话", index = 8)
70
+//    private String sharePersonPhone;
71 71
 
72 72
     /**
73 73
      * 访问时间
74 74
      */
75 75
     @ColumnWidth(15)
76
-    @ExcelProperty(value = "访问时间", index = 9)
76
+    @ExcelProperty(value = "访问时间", index = 4)
77 77
     private String visitDate;
78 78
 
79 79
 }

+ 28
- 28
src/main/java/com/huiju/estateagents/excel/ActivityStatistics/ChannelVisitPersonNum.java Wyświetl plik

@@ -34,33 +34,33 @@ public class ChannelVisitPersonNum {
34 34
     @ExcelProperty(value = "归属地", index = 3)
35 35
     private String province;
36 36
 
37
-    /**
38
-     * 来源渠道
39
-     */
40
-    @ColumnWidth(15)
41
-    @ExcelProperty(value = "来源渠道", index = 4)
42
-    private String personFrom;
43
-
44
-    /**
45
-     * 置业顾问
46
-     */
47
-    @ColumnWidth(15)
48
-    @ExcelProperty(value = "置业顾问", index = 5)
49
-    private String realtyConsultant;
50
-
51
-    /**
52
-     * 置业顾问电话
53
-     */
54
-    @ColumnWidth(15)
55
-    @ExcelProperty(value = "置业顾问电话", index = 6)
56
-    private String realtyConsultantPhone;
57
-
58
-    /**
59
-     * 推广人
60
-     */
61
-    @ColumnWidth(15)
62
-    @ExcelProperty(value = "推广人", index = 7)
63
-    private String sharePersonName;
37
+//    /**
38
+//     * 来源渠道
39
+//     */
40
+//    @ColumnWidth(15)
41
+//    @ExcelProperty(value = "来源渠道", index = 4)
42
+//    private String personFrom;
43
+//
44
+//    /**
45
+//     * 置业顾问
46
+//     */
47
+//    @ColumnWidth(15)
48
+//    @ExcelProperty(value = "置业顾问", index = 5)
49
+//    private String realtyConsultant;
50
+//
51
+//    /**
52
+//     * 置业顾问电话
53
+//     */
54
+//    @ColumnWidth(15)
55
+//    @ExcelProperty(value = "置业顾问电话", index = 6)
56
+//    private String realtyConsultantPhone;
57
+//
58
+//    /**
59
+//     * 推广人
60
+//     */
61
+//    @ColumnWidth(15)
62
+//    @ExcelProperty(value = "推广人", index = 7)
63
+//    private String sharePersonName;
64 64
 //    /**
65 65
 //     * 分享者
66 66
 //     */
@@ -79,7 +79,7 @@ public class ChannelVisitPersonNum {
79 79
      * 访问次数
80 80
      */
81 81
     @ColumnWidth(15)
82
-    @ExcelProperty(value = "访问次数", index = 8)
82
+    @ExcelProperty(value = "访问次数", index = 4)
83 83
     private String visitNum;
84 84
 
85 85
 

+ 51
- 0
src/main/java/com/huiju/estateagents/excel/ActivityStatistics/TsChannelDaily.java Wyświetl plik

@@ -0,0 +1,51 @@
1
+package com.huiju.estateagents.excel.ActivityStatistics;
2
+
3
+import com.alibaba.excel.annotation.ExcelProperty;
4
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
5
+import lombok.Data;
6
+
7
+@Data
8
+public class TsChannelDaily {
9
+    /**
10
+     * 类型
11
+     */
12
+    @ColumnWidth(15)
13
+    @ExcelProperty(value = "类型", index = 0)
14
+    private String targetType;
15
+
16
+    /**
17
+     * 内容
18
+     */
19
+    @ColumnWidth(15)
20
+    @ExcelProperty(value = "内容", index = 1)
21
+    private String targetName;
22
+
23
+    /**
24
+     * 关联项目
25
+     */
26
+    @ColumnWidth(15)
27
+    @ExcelProperty(value = "关联项目", index = 2)
28
+    private String buildingName;
29
+
30
+    /**
31
+     * 新增注册用户
32
+     */
33
+    @ColumnWidth(15)
34
+    @ExcelProperty(value = "新增注册用户", index = 3)
35
+    private Integer newCustomers;
36
+
37
+    /**
38
+     * 访问人数
39
+     */
40
+    @ColumnWidth(15)
41
+    @ExcelProperty(value = "访问人数", index = 4)
42
+    private Integer visitPersons;
43
+
44
+    /**
45
+     * 访问次数
46
+     */
47
+    @ColumnWidth(15)
48
+    @ExcelProperty(value = "访问次数", index = 5)
49
+    private Integer visitNum;
50
+
51
+}

+ 1
- 1
src/main/java/com/huiju/estateagents/excel/QrCodeStatistics/QrCodeNewPersonNum.java Wyświetl plik

@@ -41,5 +41,5 @@ public class QrCodeNewPersonNum {
41 41
      */
42 42
     @ColumnWidth(15)
43 43
     @ExcelProperty(value = "注册时间", index = 4)
44
-    private LocalDateTime registerTime;
44
+    private String registerTime;
45 45
 }

+ 1
- 1
src/main/java/com/huiju/estateagents/excel/QrCodeStatistics/QrCodeVisitNum.java Wyświetl plik

@@ -41,5 +41,5 @@ public class QrCodeVisitNum {
41 41
      */
42 42
     @ColumnWidth(15)
43 43
     @ExcelProperty(value = "访问时间", index = 4)
44
-    private LocalDateTime visitTime;
44
+    private String visitTime;
45 45
 }

+ 14
- 4
src/main/java/com/huiju/estateagents/mapper/TaChannelMapper.java Wyświetl plik

@@ -3,10 +3,12 @@ package com.huiju.estateagents.mapper;
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.huiju.estateagents.entity.TaChannel;
6
+import com.huiju.estateagents.entity.TaPersonBuilding;
6 7
 import com.huiju.estateagents.entity.TsActivityDaily;
7 8
 import com.huiju.estateagents.excel.ActivityStatistics.ChannelAddRegistNum;
8 9
 import com.huiju.estateagents.excel.ActivityStatistics.ChannelVisitNum;
9 10
 import com.huiju.estateagents.excel.ActivityStatistics.ChannelVisitPersonNum;
11
+import com.huiju.estateagents.excel.ActivityStatistics.TsChannelDaily;
10 12
 import org.apache.ibatis.annotations.Mapper;
11 13
 import org.apache.ibatis.annotations.Param;
12 14
 
@@ -55,11 +57,19 @@ public interface TaChannelMapper extends BaseMapper<TaChannel> {
55 57
      * @param buildingId
56 58
      * @return
57 59
      */
58
-    IPage<TsActivityDaily> getChannelIntroductionList(IPage<TsActivityDaily> pg,@Param("orgId") Integer orgId,@Param("startDate") LocalDate startDate,@Param("endDate") LocalDate endDate,@Param("channelType") String channelType,@Param("buildingId") String buildingId,@Param("channelId") Integer channelId);
60
+    IPage<TsActivityDaily> getChannelIntroductionList(IPage<TsActivityDaily> pg, @Param("orgId") Integer orgId, @Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate, @Param("channelType") String channelType, @Param("buildingId") String buildingId, @Param("channelId") Integer channelId, @Param("sortField") String sortField, @Param("orderType") String orderType, @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings);
59 61
 
60
-    IPage<ChannelAddRegistNum> getChannelNewuserList(IPage<ChannelAddRegistNum> iPage, @Param("orgId") Integer orgId, @Param("channelId") Integer channelId, @Param("activityId") String activityId, @Param("activityType") String activityType, @Param("buildingId") String buildingId);
62
+    IPage<ChannelAddRegistNum> getChannelNewuserList(IPage<ChannelAddRegistNum> iPage, @Param("orgId") Integer orgId, @Param("channelId") Integer channelId, @Param("activityId") String activityId, @Param("activityType") String activityType, @Param("buildingId") String buildingId,@Param("startDate") LocalDate startDate,@Param("endDate") LocalDate endDate);
61 63
 
62
-    IPage<ChannelVisitNum> getChannelVisitNumList(IPage<ChannelVisitNum> iPage,@Param("orgId") Integer orgId,@Param("channelId") Integer channelId,@Param("targetId") String targetId,@Param("targetType") String targetType,@Param("buildingId") String buildingId);
64
+    IPage<ChannelVisitNum> getChannelVisitNumList(IPage<ChannelVisitNum> iPage,@Param("orgId") Integer orgId,@Param("channelId") Integer channelId,@Param("targetId") String targetId,@Param("targetType") String targetType,@Param("buildingId") String buildingId,@Param("startDate") LocalDate startDate,@Param("endDate") LocalDate endDate);
63 65
 
64
-    IPage<ChannelVisitPersonNum> getChannelPersonNumList(IPage<ChannelVisitPersonNum> iPage,@Param("orgId") Integer orgId,@Param("channelId") Integer channelId,@Param("targetId") String targetId,@Param("targetType") String targetType,@Param("buildingId") String buildingId);
66
+    IPage<ChannelVisitPersonNum> getChannelPersonNumList(IPage<ChannelVisitPersonNum> iPage,@Param("orgId") Integer orgId,@Param("channelId") Integer channelId,@Param("targetId") String targetId,@Param("targetType") String targetType,@Param("buildingId") String buildingId,@Param("startDate") LocalDate startDate,@Param("endDate") LocalDate endDate);
67
+
68
+    List<TsChannelDaily> getChannelIntroductionListExport(@Param("orgId") Integer orgId,@Param("startDate") LocalDate startDate,@Param("endDate") LocalDate endDate,@Param("channelType") String channelType,@Param("buildingId") String buildingId,@Param("channelId") Integer channelId,@Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings);
69
+
70
+    List<ChannelAddRegistNum> getChannelNewuserListExport( @Param("orgId") Integer orgId, @Param("channelId") Integer channelId, @Param("activityId") String activityId, @Param("activityType") String activityType, @Param("buildingId") String buildingId,@Param("startDate") LocalDate startDate,@Param("endDate") LocalDate endDate);
71
+
72
+    List<ChannelVisitNum> getChannelVisitNumListExport(@Param("orgId") Integer orgId,@Param("channelId") Integer channelId,@Param("targetId") String targetId,@Param("targetType") String targetType,@Param("buildingId") String buildingId,@Param("startDate") LocalDate startDate,@Param("endDate") LocalDate endDate);
73
+
74
+    List<ChannelVisitPersonNum> getChannelPersonNumListExport(@Param("orgId") Integer orgId,@Param("channelId") Integer channelId,@Param("targetId") String targetId,@Param("targetType") String targetType,@Param("buildingId") String buildingId,@Param("startDate") LocalDate startDate,@Param("endDate") LocalDate endDate);
65 75
 }

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

@@ -3,6 +3,7 @@ package com.huiju.estateagents.mapper;
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.huiju.estateagents.bo.request.QrCodeStatisticResponseBO;
6
+import com.huiju.estateagents.entity.TaPersonBuilding;
6 7
 import com.huiju.estateagents.entity.TaPersonVisitRecord;
7 8
 import com.huiju.estateagents.entity.TaQrcode;
8 9
 import com.huiju.estateagents.excel.QrCodeStatistics.QrCodeNewPersonNum;
@@ -33,7 +34,9 @@ public interface TaQrcodeMapper extends BaseMapper<TaQrcode> {
33 34
                                           @Param("targetName") String targetName,
34 35
                                           @Param("channelId") Integer channelId,
35 36
                                           @Param("buildingId") String buildingId,
36
-                                          @Param("orgId") Integer orgId);
37
+                                          @Param("userId") Integer userId,
38
+                                          @Param("orgId") Integer orgId,
39
+                                          @Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
37 40
 
38 41
     /**
39 42
      * 获取访问用户人数

+ 0
- 1
src/main/java/com/huiju/estateagents/reportCustomerAop/ReportCustomer.java Wyświetl plik

@@ -6,7 +6,6 @@ import java.lang.annotation.Retention;
6 6
 import java.lang.annotation.RetentionPolicy;
7 7
 import java.lang.annotation.Target;
8 8
 
9
-import javax.servlet.http.HttpServletRequest;
10 9
 
11 10
 @Retention(RetentionPolicy.RUNTIME)
12 11
 @Target({ElementType.METHOD})

+ 73
- 30
src/main/java/com/huiju/estateagents/reportCustomerAop/ReportCustomerAspect.java Wyświetl plik

@@ -1,23 +1,22 @@
1 1
 package com.huiju.estateagents.reportCustomerAop;
2 2
 
3 3
 import java.time.LocalDateTime;
4
-import java.util.ArrayList;
5
-import java.util.Arrays;
6 4
 import java.util.List;
5
+import java.util.Map;
7 6
 
8 7
 import javax.servlet.http.HttpServletRequest;
9 8
 
10 9
 import org.aspectj.lang.JoinPoint;
11
-import org.aspectj.lang.ProceedingJoinPoint;
12
-import org.aspectj.lang.annotation.Around;
10
+import org.aspectj.lang.annotation.After;
13 11
 import org.aspectj.lang.annotation.Aspect;
14 12
 import org.aspectj.lang.annotation.Before;
15 13
 import org.aspectj.lang.annotation.Pointcut;
16 14
 import org.aspectj.lang.reflect.MethodSignature;
15
+import org.slf4j.Logger;
16
+import org.slf4j.LoggerFactory;
17 17
 import org.springframework.beans.factory.annotation.Autowired;
18 18
 import org.springframework.stereotype.Component;
19 19
 
20
-import com.alibaba.fastjson.JSONObject;
21 20
 import com.huiju.estateagents.base.BaseController;
22 21
 import com.huiju.estateagents.base.ResponseBean;
23 22
 import com.huiju.estateagents.common.CommConstant;
@@ -29,12 +28,12 @@ import com.huiju.estateagents.mapper.TaBuildingMapper;
29 28
 import com.huiju.estateagents.mapper.TaPersonMapper;
30 29
 import com.huiju.estateagents.service.ITaRecommendCustomerService;
31 30
 
32
-import io.swagger.models.auth.In;
33
-
34 31
 @Aspect
35 32
 @Component
36 33
 public class ReportCustomerAspect extends BaseController {
37 34
 
35
+    private final Logger logger = LoggerFactory.getLogger(ReportCustomerAspect.class);
36
+
38 37
     @Autowired
39 38
     private ITaRecommendCustomerService iTaRecommendCustomerService;
40 39
 
@@ -42,7 +41,10 @@ public class ReportCustomerAspect extends BaseController {
42 41
     TaPersonMapper taPersonMapper;
43 42
 
44 43
     @Autowired
45
-    private TaBuildingMapper taBuildingMapper;
44
+    TaBuildingMapper taBuildingMapper;
45
+
46
+    @Autowired
47
+    ReportCustomerImpl reportCustomerImpl;
46 48
 
47 49
 
48 50
     /** 以自定义 @ReportCustomer 注解为切点 */
@@ -51,58 +53,58 @@ public class ReportCustomerAspect extends BaseController {
51 53
 
52 54
     }
53 55
 
54
-    @Before("reportCustomer()")
56
+    @After("reportCustomer()")
55 57
     public ResponseBean doAround(JoinPoint proceedingJoinPoint) throws Throwable {
56 58
         ResponseBean responseBean = new ResponseBean();
57 59
         try{
58 60
             ReportCustomer reportCustomer = ((MethodSignature)proceedingJoinPoint.getSignature()).getMethod().getAnnotation(ReportCustomer.class);
59 61
             //获取请求参数
60 62
             Object[] args = proceedingJoinPoint.getArgs();
61
-            HttpServletRequest request = (HttpServletRequest)args[1];
63
+            String targetType = reportCustomer.type();
64
+            String targetId = String.valueOf(args[0]);
65
+            String qrCodeId = String.valueOf(args[1]);
66
+            String channelId = String.valueOf(args[2]);
67
+            String sceneId = String.valueOf(args[3]);
68
+            HttpServletRequest request = (HttpServletRequest)args[4];
62 69
 
70
+            Map<String, Object> stringObjectMap = getBuildingByIdAndType(targetId, targetType);
63 71
             if (request == null){
64 72
                 responseBean.addError("未授权,不进行操作");
65 73
                 return responseBean;
66 74
             }
67 75
 
68
-            String params = request.getHeader("reportInfo");
69
-            JSONObject paramObject = JSONObject.parseObject(params);
76
+            String consultantPersonId = request.getHeader("x-consultant");
77
+            String recommend = request.getHeader("x-recommender");
70 78
 
71 79
             List<TaPerson> persons = getPersonsByOpenId(getOpenId(request));
72 80
             TaPerson taPerson = persons.get(0);
73 81
             Integer orgId = getOrgId(request);
74 82
 
75
-            // 楼盘ID
76
-            String buildingId = paramObject.getString("buildingId");
77
-            // 场景ID
78
-            String sceneId = paramObject.getString("sceneId");
79
-            // 访问目标
80
-            String targetType = reportCustomer.type();
81
-            // 目标ID
82
-            String targetId = paramObject.getString("targetId");
83
-            // 目标名称
84
-            String targetName = paramObject.getString("targetName");
85
-            // 推广用户
86
-            String promoter = paramObject.getString("promoter");
87
-
88
-            TaCustomerFrom  taCustomerFrom = assembleVO(taPerson, targetType, targetId, targetName, orgId, sceneId);
83
+            TaCustomerFrom  taCustomerFrom = assembleVO(taPerson, targetType, targetId, stringObjectMap.get("targetName").toString(), orgId, sceneId, channelId, qrCodeId);
89 84
             // 推广人
90
-            TaPerson recPerson = StringUtils.isEmpty(promoter) ? null : taPersonMapper.getById(promoter);
85
+            TaPerson recPerson = StringUtils.isEmpty(recommend) ? null : taPersonMapper.getById(recommend);
91 86
             // 是否置业顾问
92 87
             boolean isConsultant = null != recPerson && CommConstant.PERSON_REALTY_CONSULTANT.equals(recPerson.getPersonType());
88
+            TaPerson consultantInfo = null != consultantPersonId ? reportCustomerImpl.getPerson(consultantPersonId) : (isConsultant ? recPerson : null);
93 89
             // 推荐楼盘
94
-            TaBuilding building = StringUtils.isEmpty(buildingId) ? null : taBuildingMapper.selectById(buildingId);
90
+            TaBuilding taBuilding = (TaBuilding) stringObjectMap.get("taBuilding");
91
+            TaBuilding building = taBuilding == null ? null : taBuildingMapper.selectById(taBuilding.getBuildingId());
95 92
 
96
-            iTaRecommendCustomerService.newCustomer(orgId, taPerson, recPerson, isConsultant ? recPerson : null, building, taCustomerFrom);
93
+            if (StringUtils.isEmpty(taPerson.getPhone())) {
94
+                responseBean.addError("未授权,不进行操作");
95
+                return responseBean;
96
+            }
97
+            iTaRecommendCustomerService.newCustomer(orgId, taPerson, recPerson, consultantInfo, building, taCustomerFrom);
97 98
             responseBean.addSuccess("绑定成功");
98 99
 
99 100
         }catch (Exception e){
101
+            logger.error("绑定失败");
100 102
             responseBean.addError("失败");
101 103
         }
102 104
         return responseBean;
103 105
     }
104 106
 
105
-    public TaCustomerFrom assembleVO(TaPerson person, String targetType, String targetId, String targetName, Integer orgId, String sceneId){
107
+    public TaCustomerFrom assembleVO(TaPerson person, String targetType, String targetId, String targetName, Integer orgId, String sceneId, String channelId, String qrCodeId){
106 108
         // 客户来源
107 109
         TaCustomerFrom customerFrom = new TaCustomerFrom();
108 110
         customerFrom.setPersonId(person.getPersonId());
@@ -112,6 +114,12 @@ public class ReportCustomerAspect extends BaseController {
112 114
         customerFrom.setTargetName(targetName);
113 115
         customerFrom.setOrgId(orgId);
114 116
         customerFrom.setSceneId(sceneId);
117
+        if (!StringUtils.isEmpty(channelId)){
118
+            customerFrom.setChannelId(Integer.valueOf(channelId));
119
+        }
120
+        if(!StringUtils.isEmpty(qrCodeId)){
121
+            customerFrom.setQrCodeId(Integer.valueOf(qrCodeId));
122
+        }
115 123
         customerFrom.setCreateDate(LocalDateTime.now());
116 124
 
117 125
         return customerFrom;
@@ -120,4 +128,39 @@ public class ReportCustomerAspect extends BaseController {
120 128
     public List<TaPerson> getPersonsByOpenId(String openId){
121 129
         return taPersonMapper.getPersonByOpenId(openId);
122 130
     }
131
+
132
+    public Map<String, Object> getBuildingByIdAndType(String targetId, String targetType){
133
+        Map<String, Object> buildingAndNameInfo = null;
134
+
135
+        switch (targetType){
136
+            case CommConstant.FAVOR_ACTIVITY:
137
+                buildingAndNameInfo = reportCustomerImpl.selectActivityBuildingInfo(targetId);
138
+                break;
139
+            case CommConstant.POINTS_CHANGE_HELP:
140
+                buildingAndNameInfo = reportCustomerImpl.selectHelpBuildingInfo(targetId);
141
+                break;
142
+            case CommConstant.POINTS_CHANGE_GROUP:
143
+                buildingAndNameInfo = reportCustomerImpl.selectGroupBuildingInfo(targetId);
144
+                break;
145
+            case CommConstant.LIVE:
146
+                buildingAndNameInfo = reportCustomerImpl.selectLiveBuildingInfo(targetId);
147
+                break;
148
+            case CommConstant.EVENT_H5:
149
+                buildingAndNameInfo = reportCustomerImpl.selectH5BuildingInfo(targetId);
150
+                break;
151
+            case CommConstant.FAVOR_NEWS:
152
+                buildingAndNameInfo = reportCustomerImpl.selectNewsBuildingInfo(targetId);
153
+                break;
154
+            case CommConstant.HOUSE:
155
+                buildingAndNameInfo = reportCustomerImpl.selectHouseBuildingInfo(targetId);
156
+                break;
157
+            default:
158
+                buildingAndNameInfo = reportCustomerImpl.selectBuildingInfo(targetId);
159
+                break;
160
+        }
161
+
162
+        return buildingAndNameInfo;
163
+    }
164
+
165
+
123 166
 }

+ 180
- 0
src/main/java/com/huiju/estateagents/reportCustomerAop/ReportCustomerImpl.java Wyświetl plik

@@ -0,0 +1,180 @@
1
+package com.huiju.estateagents.reportCustomerAop;
2
+
3
+import java.util.HashMap;
4
+import java.util.Map;
5
+
6
+import org.springframework.beans.factory.annotation.Autowired;
7
+import org.springframework.stereotype.Service;
8
+
9
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
10
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
11
+import com.huiju.estateagents.drainage.entity.TaDrainage;
12
+import com.huiju.estateagents.drainage.mapper.TaDrainageMapper;
13
+import com.huiju.estateagents.entity.HelpActivity;
14
+import com.huiju.estateagents.entity.TaBuilding;
15
+import com.huiju.estateagents.entity.TaBuildingDynamic;
16
+import com.huiju.estateagents.entity.TaLiveActivity;
17
+import com.huiju.estateagents.entity.TaNews;
18
+import com.huiju.estateagents.entity.TaPerson;
19
+import com.huiju.estateagents.entity.TaSalesBatch;
20
+import com.huiju.estateagents.entity.TaShareActivity;
21
+import com.huiju.estateagents.mapper.HelpActivityMapper;
22
+import com.huiju.estateagents.mapper.TaBuildingDynamicMapper;
23
+import com.huiju.estateagents.mapper.TaBuildingMapper;
24
+import com.huiju.estateagents.mapper.TaLiveActivityMapper;
25
+import com.huiju.estateagents.mapper.TaNewsMapper;
26
+import com.huiju.estateagents.mapper.TaPersonMapper;
27
+import com.huiju.estateagents.mapper.TaSalesBatchMapper;
28
+import com.huiju.estateagents.mapper.TaShareActivityMapper;
29
+
30
+import lombok.extern.slf4j.Slf4j;
31
+
32
+@Slf4j
33
+@Service
34
+public class ReportCustomerImpl extends ServiceImpl<TaPersonMapper, TaPerson> {
35
+
36
+    @Autowired
37
+    private TaBuildingMapper taBuildingMapper;
38
+
39
+    @Autowired
40
+    private TaNewsMapper taNewsMapper;
41
+
42
+    @Autowired
43
+    private TaBuildingDynamicMapper taBuildingDynamicMapper;
44
+
45
+    @Autowired
46
+    private HelpActivityMapper helpActivityMapper;
47
+
48
+    @Autowired
49
+    private TaShareActivityMapper taShareActivityMapper;
50
+
51
+    @Autowired
52
+    private TaLiveActivityMapper taLiveActivityMapper;
53
+
54
+    @Autowired
55
+    private TaDrainageMapper taDrainageMapper;
56
+
57
+    @Autowired
58
+    private TaSalesBatchMapper taSalesBatchMapper;
59
+
60
+
61
+    public Map<String, Object> selectActivityBuildingInfo(String targetId){
62
+        Map<String, Object> map = new HashMap<>();
63
+
64
+        QueryWrapper<TaBuildingDynamic> taBuildingDynamicQueryWrapper = new QueryWrapper<>();
65
+        taBuildingDynamicQueryWrapper.eq("dynamic_id", targetId);
66
+        TaBuildingDynamic taBuildingDynamic = taBuildingDynamicMapper.selectOne(taBuildingDynamicQueryWrapper);
67
+        map.put("targetName", taBuildingDynamic.getTitle());
68
+
69
+        TaBuilding taBuilding = buildingInfo(taBuildingDynamic.getBuildingId());
70
+        map.put("taBuilding", taBuilding);
71
+
72
+        return map;
73
+    }
74
+
75
+    public Map<String, Object> selectHelpBuildingInfo(String targetId){
76
+        Map<String, Object> map = new HashMap<>();
77
+
78
+        QueryWrapper<HelpActivity> helpActivityQueryWrapper = new QueryWrapper<>();
79
+        helpActivityQueryWrapper.eq("help_activity_id", targetId);
80
+        HelpActivity helpActivity = helpActivityMapper.selectOne(helpActivityQueryWrapper);
81
+        map.put("targetName", helpActivity.getTitle());
82
+
83
+        TaBuilding taBuilding = buildingInfo(helpActivity.getBuildingId());
84
+        map.put("taBuilding", taBuilding);
85
+
86
+        return map;
87
+    }
88
+
89
+    public Map<String, Object> selectGroupBuildingInfo(String targetId){
90
+        Map<String, Object> map = new HashMap<>();
91
+
92
+        QueryWrapper<TaShareActivity> taShareActivityQueryWrapper = new QueryWrapper<>();
93
+        taShareActivityQueryWrapper.eq("group_activity_id", targetId);
94
+        TaShareActivity taShareActivity = taShareActivityMapper.selectOne(taShareActivityQueryWrapper);
95
+        map.put("targetName", taShareActivity.getActivityName());
96
+
97
+        TaBuilding taBuilding = buildingInfo(taShareActivity.getBuildingId());
98
+        map.put("taBuilding", taBuilding);
99
+
100
+        return map;
101
+    }
102
+
103
+    public Map<String, Object> selectLiveBuildingInfo(String targetId){
104
+        Map<String, Object> map = new HashMap<>();
105
+
106
+        QueryWrapper<TaLiveActivity> taLiveActivityQueryWrapper = new QueryWrapper<>();
107
+        taLiveActivityQueryWrapper.eq("live_activity_id", targetId);
108
+        TaLiveActivity taLiveActivity = taLiveActivityMapper.selectOne(taLiveActivityQueryWrapper);
109
+        map.put("targetName", taLiveActivity.getLiveActivityTitle());
110
+
111
+        TaBuilding taBuilding = buildingInfo(taLiveActivity.getBuildingId());
112
+        map.put("taBuilding", taBuilding);
113
+
114
+        return map;
115
+    }
116
+
117
+    public Map<String, Object> selectH5BuildingInfo(String targetId){
118
+        Map<String, Object> map = new HashMap<>();
119
+
120
+        QueryWrapper<TaDrainage> taDrainageQueryWrapper = new QueryWrapper<>();
121
+        taDrainageQueryWrapper.eq("drainage_id", targetId);
122
+        TaDrainage taDrainage = taDrainageMapper.selectOne(taDrainageQueryWrapper);
123
+        map.put("targetName", taDrainage.getName());
124
+
125
+        TaBuilding taBuilding = buildingInfo(taDrainage.getBuildingId());
126
+        map.put("taBuilding", taBuilding);
127
+
128
+        return map;
129
+    }
130
+
131
+    public Map<String, Object> selectBuildingInfo(String targetId){
132
+        Map<String, Object> map = new HashMap<>();
133
+
134
+        QueryWrapper<TaBuilding> taBuildingQueryWrapper = new QueryWrapper<>();
135
+        taBuildingQueryWrapper.eq("building_id", targetId);
136
+        TaBuilding taBuilding = taBuildingMapper.selectOne(taBuildingQueryWrapper);
137
+        map.put("targetName", taBuilding.getBuildingName());
138
+        map.put("taBuilding", taBuilding);
139
+        return map;
140
+    }
141
+
142
+    public Map<String, Object> selectNewsBuildingInfo(String targetId){
143
+        Map<String, Object> map = new HashMap<>();
144
+
145
+        QueryWrapper<TaNews> taNewsQueryWrapper = new QueryWrapper<>();
146
+        taNewsQueryWrapper.eq("news_id", targetId);
147
+        TaNews taNews = taNewsMapper.selectOne(taNewsQueryWrapper);
148
+        map.put("targetName", taNews.getNewsName());
149
+
150
+        TaBuilding taBuilding = buildingInfo(taNews.getBuildingId());
151
+        map.put("taBuilding", taBuilding);
152
+
153
+        return map;
154
+    }
155
+
156
+    public TaBuilding buildingInfo(String buildingId){
157
+        QueryWrapper<TaBuilding> taBuildingQueryWrapper = new QueryWrapper<>();
158
+        taBuildingQueryWrapper.eq("building_id", buildingId);
159
+        TaBuilding taBuilding = taBuildingMapper.selectOne(taBuildingQueryWrapper);
160
+        return taBuilding;
161
+    }
162
+
163
+    public Map<String, Object> selectHouseBuildingInfo(String targetId){
164
+        Map<String, Object> map = new HashMap<>();
165
+
166
+        QueryWrapper<TaSalesBatch> taSalesBatchQueryWrapper = new QueryWrapper<>();
167
+        taSalesBatchQueryWrapper.eq("sales_batch_id", targetId);
168
+        TaSalesBatch taSalesBatch = taSalesBatchMapper.selectOne(taSalesBatchQueryWrapper);
169
+        map.put("targetName", taSalesBatch.getSalesBatchName());
170
+
171
+        TaBuilding taBuilding = buildingInfo(taSalesBatch.getBuildingId());
172
+        map.put("taBuilding", taBuilding);
173
+
174
+        return map;
175
+    }
176
+
177
+    public TaPerson getPerson(String personId){
178
+        return getById(personId);
179
+    }
180
+}

+ 4
- 1
src/main/java/com/huiju/estateagents/service/ITaQrcodeService.java Wyświetl plik

@@ -3,6 +3,7 @@ package com.huiju.estateagents.service;
3 3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4 4
 import com.huiju.estateagents.base.ResponseBean;
5 5
 import com.huiju.estateagents.entity.TaPerson;
6
+import com.huiju.estateagents.entity.TaPersonBuilding;
6 7
 import com.huiju.estateagents.entity.TaQrcode;
7 8
 import com.baomidou.mybatisplus.extension.service.IService;
8 9
 import org.springframework.web.bind.annotation.RequestParam;
@@ -10,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestParam;
10 11
 import javax.servlet.http.HttpServletRequest;
11 12
 import javax.servlet.http.HttpServletResponse;
12 13
 import java.io.IOException;
14
+import java.util.List;
13 15
 
14 16
 /**
15 17
  * <p>
@@ -21,7 +23,8 @@ import java.io.IOException;
21 23
  */
22 24
 public interface ITaQrcodeService extends IService<TaQrcode> {
23 25
 
24
-    ResponseBean listQrCodeByCondition(Integer pageNum, Integer pageSize, String targetType, String targetName, Integer channelId, String buildingId, Integer orgId);
26
+    ResponseBean listQrCodeByCondition(Integer pageNum, Integer pageSize, String targetType, String targetName, Integer channelId,
27
+                                       String buildingId, Integer userId, Integer orgId, List<TaPersonBuilding> personBuildingList);
25 28
 
26 29
     ResponseBean saveQrcode(TaQrcode taQrcode, Integer userId, Integer orgId);
27 30
 

+ 56
- 4
src/main/java/com/huiju/estateagents/service/TaChannelService.java Wyświetl plik

@@ -1,9 +1,16 @@
1 1
 package com.huiju.estateagents.service;
2
+
2 3
 import com.baomidou.mybatisplus.extension.service.IService;
3 4
 import com.huiju.estateagents.base.ResponseBean;
4 5
 import com.huiju.estateagents.entity.TaChannel;
6
+import com.huiju.estateagents.entity.TaPersonBuilding;
7
+import com.huiju.estateagents.excel.ActivityStatistics.ChannelAddRegistNum;
8
+import com.huiju.estateagents.excel.ActivityStatistics.ChannelVisitNum;
9
+import com.huiju.estateagents.excel.ActivityStatistics.ChannelVisitPersonNum;
10
+import com.huiju.estateagents.excel.ActivityStatistics.TsChannelDaily;
5 11
 
6 12
 import java.time.LocalDate;
13
+import java.util.List;
7 14
 
8 15
 /**
9 16
  * <p>
@@ -26,7 +33,7 @@ public interface TaChannelService extends IService<TaChannel> {
26 33
      * @param buildingId
27 34
      * @return
28 35
      */
29
-    ResponseBean getChannelIntroductionList(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String channelType, String buildingId, Integer channelId);
36
+    ResponseBean getChannelIntroductionList(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String channelType, String buildingId, Integer channelId,String sortField,String sortOrder, List<TaPersonBuilding> taPersonBuildings);
30 37
 
31 38
     /**
32 39
      * 获取注册用户列表
@@ -39,7 +46,7 @@ public interface TaChannelService extends IService<TaChannel> {
39 46
      * @param buildingId
40 47
      * @return
41 48
      */
42
-    ResponseBean getNewuserList(Integer pageNum, Integer pageSize, Integer orgId, Integer channelId, String targetId, String targetType, String buildingId);
49
+    ResponseBean getNewuserList(Integer pageNum, Integer pageSize, Integer orgId, Integer channelId, String targetId, String targetType, String buildingId, LocalDate startDate, LocalDate endDate);
43 50
 
44 51
     /**
45 52
      * 获取渠道下的访问次数列表
@@ -52,7 +59,7 @@ public interface TaChannelService extends IService<TaChannel> {
52 59
      * @param buildingId
53 60
      * @return
54 61
      */
55
-    ResponseBean getVisitNumList(Integer pageNum, Integer pageSize, Integer orgId, Integer channelId, String targetId, String targetType, String buildingId);
62
+    ResponseBean getVisitNumList(Integer pageNum, Integer pageSize, Integer orgId, Integer channelId, String targetId, String targetType, String buildingId, LocalDate startDate, LocalDate endDate);
56 63
 
57 64
     /**
58 65
      * 获取渠道下的访问人数列表
@@ -65,5 +72,50 @@ public interface TaChannelService extends IService<TaChannel> {
65 72
      * @param buildingId
66 73
      * @return
67 74
      */
68
-    ResponseBean getPersonNumList(Integer pageNum, Integer pageSize, Integer orgId, Integer channelId, String targetId, String targetType, String buildingId);
75
+    ResponseBean getPersonNumList(Integer pageNum, Integer pageSize, Integer orgId, Integer channelId, String targetId, String targetType, String buildingId, LocalDate startDate, LocalDate endDate);
76
+
77
+    /**
78
+     * 导出
79
+     * @param orgId
80
+     * @param startDate
81
+     * @param endDate
82
+     * @param channelType
83
+     * @param buildingId
84
+     * @param channelId
85
+     * @return
86
+     */
87
+    List<TsChannelDaily> getChannelIntroductionListExport(Integer orgId, LocalDate startDate, LocalDate endDate, String channelType, String buildingId, Integer channelId, List<TaPersonBuilding> taPersonBuildings);
88
+
89
+    /**
90
+     * 导出
91
+     * @param orgId
92
+     * @param channelId
93
+     * @param targetId
94
+     * @param targetType
95
+     * @param buildingId
96
+     * @return
97
+     */
98
+    List<ChannelAddRegistNum> getNewuserListExport(Integer orgId, Integer channelId, String targetId, String targetType, String buildingId, LocalDate startDate, LocalDate endDate);
99
+
100
+    /**
101
+     * 导出
102
+     * @param orgId
103
+     * @param channelId
104
+     * @param targetId
105
+     * @param targetType
106
+     * @param buildingId
107
+     * @return
108
+     */
109
+    List<ChannelVisitNum> getVisitNumListExport(Integer orgId, Integer channelId, String targetId, String targetType, String buildingId, LocalDate startDate, LocalDate endDate);
110
+
111
+    /**
112
+     * 导出
113
+     * @param orgId
114
+     * @param channelId
115
+     * @param targetId
116
+     * @param targetType
117
+     * @param buildingId
118
+     * @return
119
+     */
120
+    List<ChannelVisitPersonNum> getPersonNumListExport(Integer orgId, Integer channelId, String targetId, String targetType, String buildingId, LocalDate startDate, LocalDate endDate);
69 121
 }

+ 3
- 2
src/main/java/com/huiju/estateagents/service/impl/ExtendContentServiceImpl.java Wyświetl plik

@@ -187,11 +187,12 @@ public class ExtendContentServiceImpl extends ServiceImpl<ExtendContentMapper, E
187 187
             taExtendContentQueryWrapper.eq("org_id", orgId);
188 188
             taExtendContentQueryWrapper.eq("status", 1);
189 189
             taExtendContentQueryWrapper.eq("show_type", extendContent.getShowType());
190
+            taExtendContentQueryWrapper.eq("show_position", extendContent.getShowPosition());
190 191
             if (null != extendContent.getContentId()){
191 192
                 taExtendContentQueryWrapper.ne("content_id", extendContent.getContentId());
192 193
             }
193
-            if (CommConstant.BANNER_BUILDING.equals(extendContent.getShowPosition())){
194
-                taExtendContentQueryWrapper.eq("building_id", extendContent.getBuildingId());
194
+            if (extendContent.getIsHaveActive() != null ){
195
+                taExtendContentQueryWrapper.eq(StringUtils.isNotBlank(extendContent.getBuildingId()), "building_id", extendContent.getBuildingId());
195 196
             }
196 197
             List<ExtendContent> extContentInfo = extendContentMapper.selectList(taExtendContentQueryWrapper);
197 198
             if (!Collections.isEmpty(extContentInfo)){

+ 114
- 9
src/main/java/com/huiju/estateagents/service/impl/TaChannelServiceImpl.java Wyświetl plik

@@ -4,18 +4,21 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
4 4
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5 5
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
6 6
 import com.huiju.estateagents.base.ResponseBean;
7
+import com.huiju.estateagents.common.StringUtils;
7 8
 import com.huiju.estateagents.entity.TaChannel;
9
+import com.huiju.estateagents.entity.TaPersonBuilding;
8 10
 import com.huiju.estateagents.entity.TsActivityDaily;
9 11
 import com.huiju.estateagents.excel.ActivityStatistics.ChannelAddRegistNum;
10 12
 import com.huiju.estateagents.excel.ActivityStatistics.ChannelVisitNum;
11 13
 import com.huiju.estateagents.excel.ActivityStatistics.ChannelVisitPersonNum;
12
-import com.huiju.estateagents.excel.ActivityStatistics.VisitPersonNum;
14
+import com.huiju.estateagents.excel.ActivityStatistics.TsChannelDaily;
13 15
 import com.huiju.estateagents.mapper.TaChannelMapper;
14 16
 import com.huiju.estateagents.service.TaChannelService;
15 17
 import org.springframework.beans.factory.annotation.Autowired;
16 18
 import org.springframework.stereotype.Service;
17 19
 
18 20
 import java.time.LocalDate;
21
+import java.util.List;
19 22
 
20 23
 /**
21 24
  * <p>
@@ -44,9 +47,19 @@ public class TaChannelServiceImpl extends ServiceImpl<TaChannelMapper, TaChannel
44 47
      * @return
45 48
      */
46 49
     @Override
47
-    public ResponseBean getChannelIntroductionList(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String channelType, String buildingId, Integer channelId) {
50
+    public ResponseBean getChannelIntroductionList(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String channelType, String buildingId, Integer channelId,String sortField,String sortOrder, List<TaPersonBuilding> taPersonBuildings) {
48 51
         IPage<TsActivityDaily> pg = new Page<>(pageNum, pageSize);
49
-        IPage<TsActivityDaily> data = taChannelMapper.getChannelIntroductionList(pg, orgId,startDate,endDate,channelType,buildingId, channelId);
52
+        String orderType = "asc";
53
+        if ("descend".equals(sortOrder)){
54
+            orderType = "desc";
55
+        }else if ("ascend".equals(sortOrder)){
56
+            orderType = "asc";
57
+        }
58
+        if(StringUtils.isEmpty(sortField)){
59
+            sortField = "new_customers";
60
+            orderType = "desc";
61
+        }
62
+        IPage<TsActivityDaily> data = taChannelMapper.getChannelIntroductionList(pg, orgId,startDate,endDate,channelType,buildingId, channelId, sortField, orderType,taPersonBuildings);
50 63
         return ResponseBean.success(data);
51 64
     }
52 65
 
@@ -63,9 +76,9 @@ public class TaChannelServiceImpl extends ServiceImpl<TaChannelMapper, TaChannel
63 76
      * @return
64 77
      */
65 78
     @Override
66
-    public ResponseBean getNewuserList(Integer pageNum, Integer pageSize, Integer orgId, Integer channelId, String targetId, String targetType, String buildingId) {
79
+    public ResponseBean getNewuserList(Integer pageNum, Integer pageSize, Integer orgId, Integer channelId, String targetId, String targetType, String buildingId, LocalDate startDate, LocalDate endDate) {
67 80
         IPage<ChannelAddRegistNum> iPage = new Page<>(pageNum, pageSize);
68
-        IPage<ChannelAddRegistNum> data = taChannelMapper.getChannelNewuserList(iPage, orgId, channelId, targetId,targetType, buildingId);
81
+        IPage<ChannelAddRegistNum> data = taChannelMapper.getChannelNewuserList(iPage, orgId, channelId, targetId,targetType, buildingId,startDate,endDate);
69 82
         return ResponseBean.success(data);
70 83
     }
71 84
 
@@ -82,9 +95,9 @@ public class TaChannelServiceImpl extends ServiceImpl<TaChannelMapper, TaChannel
82 95
      * @return
83 96
      */
84 97
     @Override
85
-    public ResponseBean getVisitNumList(Integer pageNum, Integer pageSize, Integer orgId, Integer channelId, String targetId, String targetType, String buildingId) {
98
+    public ResponseBean getVisitNumList(Integer pageNum, Integer pageSize, Integer orgId, Integer channelId, String targetId, String targetType, String buildingId, LocalDate startDate, LocalDate endDate) {
86 99
         IPage<ChannelVisitNum> iPage = new Page<>(pageNum, pageSize);
87
-        IPage<ChannelVisitNum> data = taChannelMapper.getChannelVisitNumList(iPage, orgId, channelId, targetId, targetType, buildingId);
100
+        IPage<ChannelVisitNum> data = taChannelMapper.getChannelVisitNumList(iPage, orgId, channelId, targetId, targetType, buildingId,startDate,endDate);
88 101
         return ResponseBean.success(data);
89 102
     }
90 103
 
@@ -101,9 +114,101 @@ public class TaChannelServiceImpl extends ServiceImpl<TaChannelMapper, TaChannel
101 114
      * @return
102 115
      */
103 116
     @Override
104
-    public ResponseBean getPersonNumList(Integer pageNum, Integer pageSize, Integer orgId, Integer channelId, String targetId, String targetType, String buildingId) {
117
+    public ResponseBean getPersonNumList(Integer pageNum, Integer pageSize, Integer orgId, Integer channelId, String targetId, String targetType, String buildingId, LocalDate startDate, LocalDate endDate) {
105 118
         IPage<ChannelVisitPersonNum> iPage = new Page<>(pageNum, pageSize);
106
-        IPage<ChannelVisitPersonNum> data = taChannelMapper.getChannelPersonNumList(iPage, orgId, channelId, targetId, targetType, buildingId);
119
+        IPage<ChannelVisitPersonNum> data = taChannelMapper.getChannelPersonNumList(iPage, orgId, channelId, targetId, targetType, buildingId,startDate,endDate);
107 120
         return ResponseBean.success(data);
108 121
     }
122
+
123
+    /**
124
+     * 导出
125
+     *
126
+     * @param orgId
127
+     * @param startDate
128
+     * @param endDate
129
+     * @param channelType
130
+     * @param buildingId
131
+     * @param channelId
132
+     * @return
133
+     */
134
+    @Override
135
+    public List<TsChannelDaily> getChannelIntroductionListExport(Integer orgId, LocalDate startDate, LocalDate endDate, String channelType, String buildingId, Integer channelId, List<TaPersonBuilding> taPersonBuildings) {
136
+        List<TsChannelDaily> channelIntroductionListExport = taChannelMapper.getChannelIntroductionListExport(orgId, startDate, endDate, channelType, buildingId, channelId,taPersonBuildings);
137
+        channelIntroductionListExport.forEach(e -> {
138
+            String message = "";
139
+            switch (e.getTargetType()){
140
+                case "building":
141
+                    message = "项目";
142
+                    break;
143
+                case "activity":
144
+                    message = "常规活动";
145
+                    break;
146
+                case "help":
147
+                    message = "助力活动";
148
+                    break;
149
+                case "group":
150
+                    message = "拼团活动";
151
+                    break;
152
+                case "h5":
153
+                    message = "H5活动";
154
+                    break;
155
+                case "live":
156
+                    message = "直播活动";
157
+                    break;
158
+                case "news":
159
+                    message = "资讯";
160
+                    break;
161
+                case "house":
162
+                    message = "在线选房";
163
+                    break;
164
+            }
165
+            e.setTargetType(message);
166
+        });
167
+        return channelIntroductionListExport;
168
+    }
169
+
170
+    /**
171
+     * 导出
172
+     *
173
+     * @param orgId
174
+     * @param channelId
175
+     * @param targetId
176
+     * @param targetType
177
+     * @param buildingId
178
+     * @return
179
+     */
180
+    @Override
181
+    public List<ChannelAddRegistNum> getNewuserListExport(Integer orgId, Integer channelId, String targetId, String targetType, String buildingId, LocalDate startDate, LocalDate endDate) {
182
+        return taChannelMapper.getChannelNewuserListExport(orgId, channelId, targetId,targetType, buildingId,startDate,endDate);
183
+    }
184
+
185
+    /**
186
+     * 导出
187
+     *
188
+     * @param orgId
189
+     * @param channelId
190
+     * @param targetId
191
+     * @param targetType
192
+     * @param buildingId
193
+     * @return
194
+     */
195
+    @Override
196
+    public List<ChannelVisitNum> getVisitNumListExport(Integer orgId, Integer channelId, String targetId, String targetType, String buildingId, LocalDate startDate, LocalDate endDate) {
197
+        return taChannelMapper.getChannelVisitNumListExport(orgId, channelId, targetId, targetType, buildingId,startDate,endDate);
198
+    }
199
+
200
+    /**
201
+     * 导出
202
+     *
203
+     * @param orgId
204
+     * @param channelId
205
+     * @param targetId
206
+     * @param targetType
207
+     * @param buildingId
208
+     * @return
209
+     */
210
+    @Override
211
+    public List<ChannelVisitPersonNum> getPersonNumListExport(Integer orgId, Integer channelId, String targetId, String targetType, String buildingId, LocalDate startDate, LocalDate endDate) {
212
+        return taChannelMapper.getChannelPersonNumListExport(orgId, channelId, targetId, targetType, buildingId,startDate,endDate);
213
+    }
109 214
 }

+ 5
- 1
src/main/java/com/huiju/estateagents/service/impl/TaPersonServiceImpl.java Wyświetl plik

@@ -413,13 +413,17 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
413 413
         }
414 414
 
415 415
         TaPerson taPerson = taPersons.get(0);
416
+        QueryWrapper<TaUser> taUserQueryWrapper = new QueryWrapper<>();
417
+        taUserQueryWrapper.eq("user_id", taPerson.getUserId());
418
+        TaUser taUser = taUserMapper.selectOne(taUserQueryWrapper);
419
+
416 420
         Map<String, Object> result = new HashMap<>();
417 421
         result.put("id", taPerson.getPersonId());
418 422
         result.put("name", taPerson.getName());
419 423
         result.put("liked", false);
420 424
         result.put("unReadNum", 0);
421 425
         result.put("nickname", taPerson.getNickname());
422
-        result.put("avatar", taPerson.getAvatarurl());
426
+        result.put("avatar", taUser == null ? taPerson.getAvatarurl() : taUser.getPhoto());
423 427
         result.put("sex", taPerson.getSex());
424 428
         result.put("phone",StringUtils.ifNull(taPerson.getTel(),taPerson.getPhone()) );
425 429
         result.put("points", taPerson.getPoints());

+ 40
- 12
src/main/java/com/huiju/estateagents/service/impl/TaQrcodeServiceImpl.java Wyświetl plik

@@ -7,9 +7,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
7 7
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
8 8
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
9 9
 import com.huiju.estateagents.base.ResponseBean;
10
+import com.huiju.estateagents.center.taUser.entity.TaUser;
11
+import com.huiju.estateagents.center.taUser.service.impl.TaUserServiceImpl;
10 12
 import com.huiju.estateagents.common.CommConstant;
11 13
 import com.huiju.estateagents.common.WxQrCodeUtils;
12 14
 import com.huiju.estateagents.entity.TaMiniapp;
15
+import com.huiju.estateagents.entity.TaPersonBuilding;
13 16
 import com.huiju.estateagents.entity.TaPersonVisitRecord;
14 17
 import com.huiju.estateagents.entity.TaQrcode;
15 18
 import com.huiju.estateagents.excel.QrCodeStatistics.QrCodeNewPersonNum;
@@ -19,6 +22,7 @@ import com.huiju.estateagents.mapper.TaMiniappMapper;
19 22
 import com.huiju.estateagents.mapper.TaQrcodeMapper;
20 23
 import com.huiju.estateagents.service.IMiniAppService;
21 24
 import com.huiju.estateagents.service.ITaQrcodeService;
25
+import org.apache.commons.collections.CollectionUtils;
22 26
 import org.apache.commons.lang3.StringUtils;
23 27
 import org.slf4j.Logger;
24 28
 import org.slf4j.LoggerFactory;
@@ -27,6 +31,7 @@ import org.springframework.stereotype.Service;
27 31
 
28 32
 import javax.servlet.http.HttpServletResponse;
29 33
 import java.io.IOException;
34
+import java.net.URLEncoder;
30 35
 import java.time.LocalDateTime;
31 36
 import java.util.List;
32 37
 
@@ -52,6 +57,9 @@ public class TaQrcodeServiceImpl extends ServiceImpl<TaQrcodeMapper, TaQrcode> i
52 57
     @Autowired
53 58
     private IMiniAppService iMiniAppService;
54 59
 
60
+    @Autowired
61
+    private TaUserServiceImpl taUserService;
62
+
55 63
     /**
56 64
      * 条件查询二维码列表
57 65
      *
@@ -65,10 +73,17 @@ public class TaQrcodeServiceImpl extends ServiceImpl<TaQrcodeMapper, TaQrcode> i
65 73
      * @return
66 74
      */
67 75
     @Override
68
-    public ResponseBean listQrCodeByCondition(Integer pageNum, Integer pageSize, String targetType, String targetName, Integer channelId, String buildingId, Integer orgId) {
76
+    public ResponseBean listQrCodeByCondition(Integer pageNum, Integer pageSize, String targetType, String targetName, Integer channelId,
77
+                                              String buildingId, Integer userId, Integer orgId, List<TaPersonBuilding> personBuildingList) {
69 78
         ResponseBean responseBean = new ResponseBean();
79
+
80
+        TaUser taUser = taUserService.getById(userId);
81
+        if (taUser != null && taUser.getIsAdmin() != null && taUser.getIsAdmin()) {
82
+            userId = null;
83
+        }
84
+
70 85
         IPage<TaQrcode> pg = new Page<>(pageNum, pageSize);
71
-        responseBean.addSuccess(taQrcodeMapper.listQrCodeByCondition(pg, targetType, targetName, channelId, buildingId, orgId));
86
+        responseBean.addSuccess(taQrcodeMapper.listQrCodeByCondition(pg, targetType, targetName, channelId, buildingId, userId, orgId, personBuildingList));
72 87
         return responseBean;
73 88
     }
74 89
 
@@ -87,12 +102,21 @@ public class TaQrcodeServiceImpl extends ServiceImpl<TaQrcodeMapper, TaQrcode> i
87 102
         // 校验是否已有相同的数据
88 103
         QueryWrapper<TaQrcode> qrcodeQueryWrapper = new QueryWrapper<>();
89 104
         qrcodeQueryWrapper.eq("org_id", orgId);
90
-        qrcodeQueryWrapper.eq(StringUtils.isNotBlank(taQrcode.getBuildingId()), "building_id", taQrcode.getBuildingId());
91
-        qrcodeQueryWrapper.eq(taQrcode.getChannelId() != null, "channel_id", taQrcode.getChannelId());
105
+        if (StringUtils.isBlank(taQrcode.getBuildingId())) {
106
+            qrcodeQueryWrapper.isNull("building_id");
107
+        } else {
108
+            qrcodeQueryWrapper.eq("building_id", taQrcode.getBuildingId());
109
+        }
110
+        if (null == taQrcode.getChannelId()) {
111
+            qrcodeQueryWrapper.isNull("channel_id");
112
+        } else {
113
+            qrcodeQueryWrapper.eq("channel_id", taQrcode.getChannelId());
114
+        }
92 115
         qrcodeQueryWrapper.eq("target_type", taQrcode.getTargetType());
93 116
         qrcodeQueryWrapper.eq("target_id", taQrcode.getTargetId());
94
-        TaQrcode taQrCodeCheck = taQrcodeMapper.selectOne(qrcodeQueryWrapper);
95
-        if (taQrCodeCheck != null) {
117
+        qrcodeQueryWrapper.gt("status", CommConstant.STATUS_DELETE);
118
+        List<TaQrcode> taQrCodeCheckList = taQrcodeMapper.selectList(qrcodeQueryWrapper);
119
+        if (CollectionUtils.isNotEmpty(taQrCodeCheckList)) {
96 120
             responseBean.addError("请勿重复提交");
97 121
             return responseBean;
98 122
         }
@@ -114,7 +138,7 @@ public class TaQrcodeServiceImpl extends ServiceImpl<TaQrcodeMapper, TaQrcode> i
114 138
 
115 139
         // 生成二维码
116 140
         String paramsStr = WxQrCodeUtils.generateSceneAndPage(taQrcode.getTargetType(), "",
117
-                taQrcode.getTargetId(), taQrcode.getTargetType(), taQrcode.getChannelId() + "", taQrcode.getQrCodeId() + "", taQrcode.getBuildingId());
141
+                taQrcode.getTargetId(), taQrcode.getTargetType(), String.valueOf(taQrcode.getChannelId()), String.valueOf(taQrcode.getQrCodeId()), taQrcode.getBuildingId());
118 142
         ResponseBean qrCodeResult = iMiniAppService.getQrCode(paramsStr, taMiniapp.getMiniappId());
119 143
         if (qrCodeResult != null && ResponseBean.CODE_SUCCESS == qrCodeResult.getCode()) {
120 144
             // 更新数据
@@ -189,22 +213,26 @@ public class TaQrcodeServiceImpl extends ServiceImpl<TaQrcodeMapper, TaQrcode> i
189 213
 
190 214
     @Override
191 215
     public void getStatisticRecordExport(Integer type, Integer qrCodeId, Integer orgId, HttpServletResponse response) throws IOException {
192
-        response.setContentType("application/vnd.ms-excel");
216
+        response.setContentType("application/octet-stream");
193 217
         response.setCharacterEncoding("utf-8");
218
+        String fileName;
194 219
         switch (type) {
195 220
             case 1:
196
-                List<QrCodeVisitPersonNum> records = taQrcodeMapper.getVisitPersonsRecordExport(qrCodeId,orgId);
197
-                response.setHeader("Content-disposition", "attachment;filename=访问人数.xlsx");
221
+                List<QrCodeVisitPersonNum> records = taQrcodeMapper.getVisitPersonsRecordExport(qrCodeId, orgId);
222
+                fileName = URLEncoder.encode("访问人数", "UTF-8");
223
+                response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
198 224
                 EasyExcel.write(response.getOutputStream(), QrCodeVisitPersonNum.class).sheet("访问人数").doWrite(records);
199 225
                 break;
200 226
             case 2:
201 227
                 List<QrCodeVisitNum> records2 = taQrcodeMapper.getVisitNumRecordExport(qrCodeId, orgId);
202
-                response.setHeader("Content-disposition", "attachment;filename=访问次数.xlsx");
228
+                fileName = URLEncoder.encode("访问次数", "UTF-8");
229
+                response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
203 230
                 EasyExcel.write(response.getOutputStream(), QrCodeVisitNum.class).sheet("访问次数").doWrite(records2);
204 231
                 break;
205 232
             case 3:
206 233
                 List<QrCodeNewPersonNum> records3 = taQrcodeMapper.getNewPersonsRecordExport(qrCodeId, orgId);
207
-                response.setHeader("Content-disposition", "attachment;filename=新增注册用户.xlsx");
234
+                fileName = URLEncoder.encode("新增注册用户", "UTF-8");
235
+                response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
208 236
                 EasyExcel.write(response.getOutputStream(), QrCodeNewPersonNum.class).sheet("新增注册用户").doWrite(records3);
209 237
                 break;
210 238
             default:

+ 96
- 27
src/main/java/com/huiju/estateagents/service/impl/TaRecommendCustomerServiceImpl.java Wyświetl plik

@@ -194,17 +194,26 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
194 194
         from.setCreateDate(now);
195 195
 
196 196
         Map<String, Number> checkNum = taRecommendCustomerMapper.checkCustomerBy(orgId, person.getPersonId(), consultBuildingIds, null != building ? building.getBuildingId() : null);
197
+        // 是否存在小程序客户记录
197 198
         boolean hasOrgCust = checkNum.get("orgNum").intValue() > 0;
199
+        // 是否存在置业绑定的楼盘客户记录
200
+        boolean hasConsultBuildingCust = checkNum.get("consultBuildingNum").intValue() > 0;
201
+        // 是否存在置业绑定的楼盘私客记录
198 202
         boolean hasConsultCust = checkNum.get("consultNum").intValue() > 0;
203
+        // 是否存在当前内容楼盘的客户记录
199 204
         boolean hasBuildingCust = checkNum.get("buildingNum").intValue() > 0;
200 205
 
201
-        // 控制是否需要插入小程序级别公客
202
-        boolean inserted = false;
203
-        // 置业与楼盘是否有关联关系
206
+        // 置业与内容楼盘是否有关联关系
204 207
         boolean builingAssociated = false;
205 208
 
206
-        // 私客
207
-        if (null != consultant && !hasConsultCust && null != consultBuildings) {
209
+        // 职业顾问不插入客户表
210
+        boolean personIsConsultant = CommConstant.PERSON_REALTY_CONSULTANT.equals(person.getPersonType()) ? true : false;
211
+        if (personIsConsultant) {
212
+            return result;
213
+        }
214
+
215
+        // 置业项目
216
+        if (null != consultant && null != consultBuildings && !hasConsultCust) {
208 217
             TaBuilding taBuilding = null;
209 218
             if (consultBuildingIds.contains(null != building ? building.getBuildingId() : null)) {
210 219
                 taBuilding = building;
@@ -213,35 +222,79 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
213 222
                 taBuilding = consultBuildings.get(0);
214 223
             }
215 224
 
216
-            TaRecommendCustomer customer = copyFromPerosn(person, new TaRecommendCustomer());
217
-            fillSomeFieldsOfCustomer(customer, recommender, now);
218
-            customer.setBuildingId(taBuilding.getBuildingId());
219
-            customer.setBuildingName(taBuilding.getBuildingName());
220
-            customer.setRealtyConsultant(consultant.getUserId().toString());
221
-            taRecommendCustomerMapper.insert(customer);
222
-            result.add(customer);
223
-            inserted = true;
225
+            if (hasConsultBuildingCust) {
226
+                // 如果是项目公客
227
+                QueryWrapper<TaRecommendCustomer> taRecommendCustomerQueryWrapper = new QueryWrapper<>();
228
+                taRecommendCustomerQueryWrapper.eq("building_id", taBuilding.getBuildingId());
229
+                taRecommendCustomerQueryWrapper.gt("status", CommConstant.STATUS_DELETE);
230
+                taRecommendCustomerQueryWrapper.orderByAsc("create_date");
231
+                taRecommendCustomerQueryWrapper.last("limit 1");
232
+                TaRecommendCustomer taRecommendCustomer = taRecommendCustomerMapper.selectOne(taRecommendCustomerQueryWrapper);
233
+
234
+                taRecommendCustomer = copyFromPerosn(person, taRecommendCustomer);
235
+                taRecommendCustomer.setRealtyConsultant(consultant.getUserId().toString());
236
+                taRecommendCustomerMapper.updateById(taRecommendCustomer);
237
+                result.add(taRecommendCustomer);
238
+            } else {
239
+                // 如果没有任何置业及置业楼盘相关的数据, 则插入新记录
240
+                TaRecommendCustomer customer = copyFromPerosn(person, new TaRecommendCustomer());
241
+                fillSomeFieldsOfCustomer(customer, recommender, now);
242
+                customer.setBuildingId(taBuilding.getBuildingId());
243
+                customer.setBuildingName(taBuilding.getBuildingName());
244
+                customer.setRealtyConsultant(consultant.getUserId().toString());
245
+                taRecommendCustomerMapper.insert(customer);
246
+                result.add(customer);
247
+
248
+                // 是否首次进入标识
249
+                Boolean isFirstOrg = hasOrgCust;
250
+
251
+                // 如果非小程序公客, 即首次进入
252
+                if (!isFirstOrg) {
253
+                    // 如果分享内容的楼盘跟置业楼盘一致
254
+                    if (builingAssociated) {
255
+                        isFirstOrg = true;
256
+                    }
257
+                } else {
258
+                    isFirstOrg = false;
259
+                }
224 260
 
225
-            TaCustomerFrom customerFrom = copyPropertiesFrom(from);
226
-            customerFrom.setCustomerId(customer.getCustomerId());
227
-            customerFrom.setSharePersonId(recommender.getPersonId());
228
-            customerFrom.setSharePersonName(StringUtils.ifNull(recommender.getName(), recommender.getNickname()));
229
-            customerFrom.setBuildingId(taBuilding.getBuildingId());
230
-            customerFrom.setBuildingName(taBuilding.getBuildingName());
231
-            customerFrom.setIsOrgFirst(!hasOrgCust);
232
-            customerFrom.setIsProjectFirst(true);
233
-            customerFrom.setCreateDate(now);
234
-            taCustomerFromMapper.insert(customerFrom);
261
+                TaCustomerFrom customerFrom = copyPropertiesFrom(from);
262
+                customerFrom.setCustomerId(customer.getCustomerId());
263
+                customerFrom.setSharePersonId(recommender.getPersonId());
264
+                customerFrom.setSharePersonName(StringUtils.ifNull(recommender.getName(), recommender.getNickname()));
265
+                customerFrom.setBuildingId(taBuilding.getBuildingId());
266
+                customerFrom.setBuildingName(taBuilding.getBuildingName());
267
+                customerFrom.setIsOrgFirst(isFirstOrg);
268
+                customerFrom.setIsProjectFirst(true);
269
+                customerFrom.setCreateDate(now);
270
+                taCustomerFromMapper.insert(customerFrom);
271
+
272
+                if (isFirstOrg) {
273
+                    hasOrgCust = true;
274
+                }
275
+            }
235 276
         }
236 277
 
237 278
         // 项目公客
238 279
         if (null != building && !hasBuildingCust && !builingAssociated) {
280
+            // 校验客户是否已经是该项目公客
281
+//            QueryWrapper<TaRecommendCustomer> customerQueryWrapper = new QueryWrapper<>();
282
+//            customerQueryWrapper.eq("org_id", orgId);
283
+//            customerQueryWrapper.eq("person_id", person.getPersonId());
284
+//            customerQueryWrapper.eq("building_id", building.getBuildingId());
285
+//            customerQueryWrapper.gt("status", CommConstant.STATUS_DELETE);
286
+//            customerQueryWrapper.orderByAsc("create_date");
287
+//            customerQueryWrapper.last("limit 1");
288
+//            TaRecommendCustomer customerCheck = taRecommendCustomerMapper.selectOne(customerQueryWrapper);
289
+//            if(customerCheck == null){
239 290
             TaRecommendCustomer customer = copyFromPerosn(person, new TaRecommendCustomer());
240 291
             fillSomeFieldsOfCustomer(customer, recommender, now);
241 292
             customer.setBuildingId(building.getBuildingId());
242 293
             taRecommendCustomerMapper.insert(customer);
243 294
             result.add(customer);
244
-            inserted = true;
295
+
296
+            // 是否首次进入标识
297
+            Boolean isFirstOrg = hasOrgCust;
245 298
 
246 299
             TaCustomerFrom customerFrom = copyPropertiesFrom(from);
247 300
             customerFrom.setCustomerId(customer.getCustomerId());
@@ -249,14 +302,20 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
249 302
             customerFrom.setSharePersonName(null == recommender ? null : StringUtils.ifNull(recommender.getName(), recommender.getNickname()));
250 303
             customerFrom.setBuildingId(building.getBuildingId());
251 304
             customerFrom.setBuildingName(building.getBuildingName());
252
-            customerFrom.setIsOrgFirst(!hasOrgCust);
305
+            customerFrom.setIsOrgFirst(!isFirstOrg);
253 306
             customerFrom.setIsProjectFirst(true);
254 307
             customerFrom.setCreateDate(now);
255 308
             taCustomerFromMapper.insert(customerFrom);
309
+//            }
310
+
311
+            // 如果非小程序公客, 即首次进入
312
+            if (!isFirstOrg) {
313
+                hasOrgCust = true;
314
+            }
256 315
         }
257 316
 
258 317
         // 小程序公客
259
-        if (!hasOrgCust && !inserted) {
318
+        if (!hasOrgCust) {
260 319
             TaRecommendCustomer customer = copyFromPerosn(person, new TaRecommendCustomer());
261 320
             fillSomeFieldsOfCustomer(customer, recommender, now);
262 321
             taRecommendCustomerMapper.insert(customer);
@@ -281,7 +340,7 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
281 340
         customer.setEntryType(null == recommender ? CommConstant.ENTRY_VOLUNTEER : CommConstant.ENTRY_INPUT);
282 341
         customer.setCreateDate(now);
283 342
         customer.setReportDate(now);
284
-        customer.setRecommendPerson(null == recommender ? null : recommender.getPersonId());
343
+//        customer.setRecommendPerson(null == recommender ? null : recommender.getPersonId());
285 344
     }
286 345
 
287 346
     private TaRecommendCustomer copyFromPerosn(TaPerson person, TaRecommendCustomer cust) {
@@ -305,6 +364,16 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
305 364
         return to;
306 365
     }
307 366
 
367
+    public void delPubCust(String personId, String buildingId) {
368
+        TaRecommendCustomer recommendCustomer = new TaRecommendCustomer();
369
+        recommendCustomer.setStatus(CommConstant.STATUS_DELETE);
370
+
371
+        QueryWrapper<TaRecommendCustomer> taRecommendCustomerQueryWrapper = new QueryWrapper<>();
372
+        taRecommendCustomerQueryWrapper.eq("building_id", buildingId);
373
+        taRecommendCustomerQueryWrapper.eq("person_id", personId);
374
+        taRecommendCustomerMapper.update(recommendCustomer, taRecommendCustomerQueryWrapper);
375
+    }
376
+
308 377
     @Override
309 378
     public ResponseBean getCustDetail(String id) {
310 379
         TaRecommendCustomer taRecommendCustomer = taRecommendCustomerMapper.selectById(id);

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

@@ -291,7 +291,7 @@ public class ActivityStatisticController extends BaseController {
291 291
                                                    @RequestParam(value = "personId", required = false)String personId,
292 292
                                                    @RequestParam(value = "buildingId", required = false)String buildingId,
293 293
                                                    HttpServletRequest request) {
294
-        return taActivityStaticService.selectActivityVisitNum(pageNum, pageSize, getOrgId(request), startDate, endDate, personFrom, province, realtyConsultant, realtyConsultantPhone, activityId, activityType, personId, buildingId);
294
+        return taActivityStaticService.selectActivityVisitNum(pageNum, pageSize, getOrgId(request), startDate, endDate, personFrom, province, realtyConsultant, realtyConsultantPhone, activityId, activityType, personId, buildingId, getTaPersonBuildingListByUserId(request));
295 295
     }
296 296
 
297 297
     /**
@@ -339,7 +339,7 @@ public class ActivityStatisticController extends BaseController {
339 339
                                                @RequestParam(value = "activityType", required = false)String activityType,
340 340
                                                @RequestParam(value = "buildingId", required = false)String buildingId,
341 341
                                                HttpServletRequest request) {
342
-        return taActivityStaticService.selectActivityVisitPersonNum(pageNum, pageSize, getOrgId(request), startDate, endDate, personFrom, province, realtyConsultant, realtyConsultantPhone, activityId, activityType, buildingId,  personId);
342
+        return taActivityStaticService.selectActivityVisitPersonNum(pageNum, pageSize, getOrgId(request), startDate, endDate, personFrom, province, realtyConsultant, realtyConsultantPhone, activityId, activityType, buildingId,  personId, getTaPersonBuildingListByUserId(request));
343 343
     }
344 344
 
345 345
     /**
@@ -364,7 +364,7 @@ public class ActivityStatisticController extends BaseController {
364 364
         ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), VisitPersonNum.class).registerWriteHandler(new CustomCellWriteHandler()).build();
365 365
         // 设置 sheet, 同一个sheet只需要设置一次
366 366
         WriteSheet writeSheet = EasyExcel.writerSheet("活动统计").build();
367
-        List<VisitPersonNum> data = taActivityStaticService.selectActivityVisitPersonNumExport(getOrgId(request), startDate, endDate, personFrom, province, realtyConsultant, realtyConsultantPhone, activityId, activityType, buildingId,  personId);
367
+        List<VisitPersonNum> data = taActivityStaticService.selectActivityVisitPersonNumExport(getOrgId(request), startDate, endDate, personFrom, province, realtyConsultant, realtyConsultantPhone, activityId, activityType, buildingId,  personId, getTaPersonBuildingListByUserId(request));
368 368
         excelWriter.write(data, writeSheet);
369 369
         // finish 会帮忙关闭流
370 370
         excelWriter.finish();

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

@@ -1,6 +1,7 @@
1 1
 package com.huiju.estateagents.statistic.mapper;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.huiju.estateagents.entity.TaBuilding;
4 5
 import com.huiju.estateagents.entity.TaPersonBuilding;
5 6
 import com.huiju.estateagents.excel.ActivityStatistics.*;
6 7
 import org.apache.ibatis.annotations.Mapper;
@@ -240,7 +241,8 @@ public interface TaActicityStaticMapper {
240 241
             @Param("realtyConsultantPhone") String realtyConsultantPhone,
241 242
             @Param("activityId") String activityId,
242 243
             @Param("activityType") String activityType,
243
-            @Param("buildingId") String buildingId
244
+            @Param("buildingId") String buildingId,
245
+            @Param("taPersonBuildings")List<TaPersonBuilding> taPersonBuildings
244 246
     );
245 247
 
246 248
     List<VisitNum> selectActivityVisitNumExport(
@@ -267,7 +269,8 @@ public interface TaActicityStaticMapper {
267 269
             @Param("realtyConsultantPhone") String realtyConsultantPhone,
268 270
             @Param("activityId") String activityId,
269 271
             @Param("activityType") String activityType,
270
-            @Param("buildingId") String buildingId
272
+            @Param("buildingId") String buildingId,
273
+            @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings
271 274
     );
272 275
 
273 276
     List<VisitPersonNum> selectActivityVisitPersonNumExport(
@@ -280,7 +283,8 @@ public interface TaActicityStaticMapper {
280 283
             @Param("realtyConsultantPhone") String realtyConsultantPhone,
281 284
             @Param("activityId") String activityId,
282 285
             @Param("activityType") String activityType,
283
-            @Param("buildingId") String buildingId
286
+            @Param("buildingId") String buildingId,
287
+            @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings
284 288
     );
285 289
 
286 290
     IPage<VisitPersonNum> selectActivityVisitPersonNumByPersonId(
@@ -291,7 +295,8 @@ public interface TaActicityStaticMapper {
291 295
             @Param("personId") String personId,
292 296
             @Param("activityId") String activityId,
293 297
             @Param("activityType") String activityType,
294
-            @Param("buildingId") String buildingId
298
+            @Param("buildingId") String buildingId,
299
+            @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings
295 300
     );
296 301
 
297 302
     List<VisitPersonNum> selectActivityVisitPersonNumExportByPersonId(
@@ -301,7 +306,8 @@ public interface TaActicityStaticMapper {
301 306
             @Param("personId") String personId,
302 307
             @Param("activityId") String activityId,
303 308
             @Param("activityType") String activityType,
304
-            @Param("buildingId") String buildingId
309
+            @Param("buildingId") String buildingId,
310
+            @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings
305 311
     );
306 312
 
307 313
     IPage<VisitNum> selectActivityVisitNumByPersonId(
@@ -312,7 +318,8 @@ public interface TaActicityStaticMapper {
312 318
             @Param("personId") String personId,
313 319
             @Param("activityId") String activityId,
314 320
             @Param("activityType") String activityType,
315
-            @Param("buildingId") String buildingId
321
+            @Param("buildingId") String buildingId,
322
+            @Param("taPersonBuildings")List<TaPersonBuilding> taPersonBuildings
316 323
     );
317 324
 
318 325
     List<VisitNum> selectActivityVisitNumExportByPersonId(

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

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
4 4
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5 5
 import com.huiju.estateagents.base.ResponseBean;
6 6
 import com.huiju.estateagents.common.StringUtils;
7
+import com.huiju.estateagents.entity.TaBuilding;
7 8
 import com.huiju.estateagents.entity.TaPersonBuilding;
8 9
 import com.huiju.estateagents.excel.ActivityStatistics.*;
9 10
 import com.huiju.estateagents.statistic.mapper.TaActicityStaticMapper;
@@ -151,13 +152,13 @@ public class TaActivityStaticServiceImpl {
151 152
         return taActicityStaticMapper.selectActivityAddRegistNumExport(orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX), personFrom, activityId, activityType, buildingId, province, taPersonBuildings, userId);
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){
155
+    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, List<TaPersonBuilding> taPersonBuildings){
155 156
         IPage<VisitNum> iPage = new Page<>(pageNum, pageSize);
156 157
         IPage<VisitNum> data;
157 158
         if (StringUtils.isEmpty(personId)){
158
-            data = taActicityStaticMapper.selectActivityVisitNum(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX), personFrom, provice, realtyConsultant, realtyConsultantPhone, activityId, activityType, buildingId);
159
+            data = taActicityStaticMapper.selectActivityVisitNum(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX), personFrom, provice, realtyConsultant, realtyConsultantPhone, activityId, activityType, buildingId, taPersonBuildings);
159 160
         }else{
160
-            data = taActicityStaticMapper.selectActivityVisitNumByPersonId(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX), personId, activityId, activityType, buildingId);
161
+            data = taActicityStaticMapper.selectActivityVisitNumByPersonId(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX), personId, activityId, activityType, buildingId, taPersonBuildings);
161 162
         }
162 163
 
163 164
         return ResponseBean.success(data);
@@ -173,24 +174,48 @@ public class TaActivityStaticServiceImpl {
173 174
         return list;
174 175
     }
175 176
 
176
-    public ResponseBean selectActivityVisitPersonNum(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String personFrom, String provice, String realtyConsultant, String realtyConsultantPhone, String activityId, String activityType, String buildingId, String personId){
177
+    public ResponseBean selectActivityVisitPersonNum(Integer pageNum,
178
+                                                     Integer pageSize,
179
+                                                     Integer orgId,
180
+                                                     LocalDate startDate,
181
+                                                     LocalDate endDate,
182
+                                                     String personFrom,
183
+                                                     String provice,
184
+                                                     String realtyConsultant,
185
+                                                     String realtyConsultantPhone,
186
+                                                     String activityId,
187
+                                                     String activityType,
188
+                                                     String buildingId,
189
+                                                     String personId,
190
+                                                     List<TaPersonBuilding> taBuildings){
177 191
         IPage<VisitPersonNum> iPage = new Page<>(pageNum, pageSize);
178 192
         IPage<VisitPersonNum> data;
179 193
         if (StringUtils.isEmpty(personId)){
180
-            data = taActicityStaticMapper.selectActivityVisitPersonNum(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX), personFrom, provice, realtyConsultant, realtyConsultantPhone, activityId, activityType, buildingId);
194
+            data = taActicityStaticMapper.selectActivityVisitPersonNum(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX), personFrom, provice, realtyConsultant, realtyConsultantPhone, activityId, activityType, buildingId, taBuildings);
181 195
         }else{
182
-            data = taActicityStaticMapper.selectActivityVisitPersonNumByPersonId(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX), personId, activityId, activityType, buildingId);
196
+            data = taActicityStaticMapper.selectActivityVisitPersonNumByPersonId(iPage, orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX), personId, activityId, activityType, buildingId, taBuildings);
183 197
         }
184 198
 
185 199
         return ResponseBean.success(data);
186 200
     }
187 201
 
188
-    public List<VisitPersonNum> selectActivityVisitPersonNumExport(Integer orgId, LocalDate startDate, LocalDate endDate, String personFrom, String provice, String realtyConsultant, String realtyConsultantPhone, String activityId, String activityType, String buildingId, String personId){
202
+    public List<VisitPersonNum> selectActivityVisitPersonNumExport(Integer orgId,
203
+                                                                   LocalDate startDate,
204
+                                                                   LocalDate endDate,
205
+                                                                   String personFrom,
206
+                                                                   String provice,
207
+                                                                   String realtyConsultant,
208
+                                                                   String realtyConsultantPhone,
209
+                                                                   String activityId,
210
+                                                                   String activityType,
211
+                                                                   String buildingId,
212
+                                                                   String personId,
213
+                                                                   List<TaPersonBuilding> taBuildings){
189 214
         List<VisitPersonNum> list = new ArrayList<>();
190 215
         if (StringUtils.isEmpty(personId)){
191
-            list = taActicityStaticMapper.selectActivityVisitPersonNumExport(orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX), personFrom, provice, realtyConsultant, realtyConsultantPhone, activityId, activityType, buildingId);
216
+            list = taActicityStaticMapper.selectActivityVisitPersonNumExport(orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX), personFrom, provice, realtyConsultant, realtyConsultantPhone, activityId, activityType, buildingId, taBuildings);
192 217
         }else{
193
-            list = taActicityStaticMapper.selectActivityVisitPersonNumExportByPersonId(orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX), personId, activityId, activityType, buildingId);
218
+            list = taActicityStaticMapper.selectActivityVisitPersonNumExportByPersonId(orgId, LocalDateTime.of(startDate, LocalTime.MIN), LocalDateTime.of(endDate, LocalTime.MAX), personId, activityId, activityType, buildingId, taBuildings);
194 219
         }
195 220
         return list;
196 221
     }

+ 230
- 15
src/main/resources/mapper/TaChannelMapper.xml Wyświetl plik

@@ -70,7 +70,22 @@
70 70
 
71 71
     <select id="getChannelIntroductionList" resultType="com.huiju.estateagents.entity.TsActivityDaily">
72 72
         SELECT
73
-            *
73
+            serial_no,
74
+            statis_date,
75
+            org_id,
76
+            building_id,
77
+            building_name,
78
+            target_id,
79
+            target_type,
80
+            target_name,
81
+            sum( share_num ) AS share_num,
82
+            sum( share_persons ) AS share_persons,
83
+            sum( visit_num ) AS visit_num,
84
+            sum( visit_persons ) AS visit_persons,
85
+            sum( new_persons ) AS new_persons,
86
+            sum( new_customers ) AS new_customers,
87
+            qr_code_id,
88
+            channel_id
74 89
         FROM
75 90
             ts_channel_daily
76 91
         WHERE
@@ -85,6 +100,16 @@
85 100
         <if test="buildingId != null and buildingId != ''">
86 101
             and building_id = #{buildingId}
87 102
         </if>
103
+        <if test="taPersonBuildings != null and taPersonBuildings.size > 0">
104
+            and building_id in
105
+            <foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
106
+                #{taPersonBuilding.buildingId}
107
+            </foreach>
108
+        </if>
109
+        GROUP BY   target_id, target_type
110
+        <if test="sortField != null and sortField != ''">
111
+            ORDER BY ${sortField} ${orderType}
112
+        </if>
88 113
     </select>
89 114
     <select id="getChannelNewuserList"
90 115
             resultType="com.huiju.estateagents.excel.ActivityStatistics.ChannelAddRegistNum">
@@ -102,8 +127,8 @@
102 127
 <!--        LEFT JOIN ta_person e ON t.share_person_id = e.person_id-->
103 128
         WHERE t.org_id = #{orgId}
104 129
         and t.is_org_first = 1
105
-<!--        and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' ) and t.create_date &lt;= DATE_FORMAT(#{endDate},-->
106
-<!--        '%Y-%m-%d' )-->
130
+        and DATE_FORMAT(t.create_date, '%Y-%m-%d' )  >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' ) and DATE_FORMAT(t.create_date, '%Y-%m-%d' ) &lt;= DATE_FORMAT(#{endDate},
131
+        '%Y-%m-%d' )
107 132
         <if test="activityId != null and activityId != ''">
108 133
             and t.target_id = #{activityId}
109 134
         </if>
@@ -135,19 +160,22 @@
135 160
         FROM
136 161
         ta_person_visit_record t
137 162
         WHERE
138
-        t.`event` = 'detail'
163
+        t.`event` in ( 'detail', 'house_list' , 'poster')
139 164
         AND t.event_type IN (
140 165
         'activity',
141 166
         'help',
142 167
         'group',
143
-        'h5'
168
+        'h5',
169
+        'news',
170
+        'building',
171
+        'live',
172
+        'house'
144 173
         )
145 174
         <if test="targetId != null and targetId != ''">
146 175
             and t.target_id = #{targetId}
147 176
         </if>
148 177
         <if test="targetType != null and targetType != ''">
149
-            and (case when #{targetType} = 'activity' then t.target_type = 'dynamic' when #{targetType} = 'h5' then t.event_type = 'h5' else t.target_type = #{targetType}
150
-            end)
178
+            and t.event_type = #{targetType}
151 179
         </if>
152 180
         <if test="channelId != null and channelId != ''">
153 181
             and t.channel_id = #{channelId}
@@ -156,8 +184,8 @@
156 184
             and t.building_id = #{buildingId}
157 185
         </if>
158 186
         AND t.org_id = #{orgId}
159
-<!--        AND t.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d')-->
160
-<!--        AND t.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d')-->
187
+        AND DATE_FORMAT(t.visit_time, '%Y-%m-%d' )  >= DATE_FORMAT(#{startDate}, '%Y-%m-%d')
188
+        AND DATE_FORMAT(t.visit_time, '%Y-%m-%d' )  &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
161 189
         ) t
162 190
         left join ta_person a on t.person_id = a.person_id
163 191
         left join ta_person_from_record b on a.person_id = b.person_id and b.org_id = #{orgId}
@@ -188,22 +216,209 @@
188 216
         FROM
189 217
         ta_person_visit_record t
190 218
         WHERE
191
-        t.`event` = 'detail'
219
+        t.`event` in ( 'detail', 'house_list' , 'poster')
220
+        AND t.event_type IN (
221
+        'activity',
222
+        'help',
223
+        'group',
224
+        'h5',
225
+        'news',
226
+        'building',
227
+        'live',
228
+        'house'
229
+        )
230
+        AND t.org_id = #{orgId}
231
+        AND DATE_FORMAT(t.visit_time, '%Y-%m-%d' ) >= DATE_FORMAT(#{startDate}, '%Y-%m-%d')
232
+        AND DATE_FORMAT(t.visit_time, '%Y-%m-%d' ) &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
233
+        <if test="targetId != null and targetId != ''">
234
+            and t.target_id = #{targetId}
235
+        </if>
236
+        <if test="targetType != null and targetType != ''">
237
+            and t.event_type = #{targetType}
238
+        </if>
239
+        <if test="buildingId != null and buildingId != ''">
240
+            and t.building_id = #{buildingId}
241
+        </if>
242
+        <if test="channelId != null and channelId != ''">
243
+            and t.channel_id = #{channelId}
244
+        </if>
245
+        GROUP BY
246
+        t.person_id ) as t
247
+        left join ta_person a on t.person_id = a.person_id
248
+        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
249
+        left join td_wx_dict b1 on b.scene_id = b1.scene_id
250
+        LEFT JOIN ta_recommend_customer c on c.person_id = t.person_id
251
+        left join ta_user d on c.realty_consultant = d.user_id
252
+        LEFT JOIN ta_person e ON e.person_id = b.share_person_id
253
+        group by t.person_id
254
+        order by t.create_date desc
255
+    </select>
256
+    <select id="getChannelIntroductionListExport"
257
+            resultType="com.huiju.estateagents.excel.ActivityStatistics.TsChannelDaily">
258
+        SELECT
259
+        serial_no,
260
+        statis_date,
261
+        org_id,
262
+        building_id,
263
+        building_name,
264
+        target_id,
265
+        target_type,
266
+        target_name,
267
+        sum( share_num ) AS share_num,
268
+        sum( share_persons ) AS share_persons,
269
+        sum( visit_num ) AS visit_num,
270
+        sum( visit_persons ) AS visit_persons,
271
+        sum( new_persons ) AS new_persons,
272
+        sum( new_customers ) AS new_customers,
273
+        qr_code_id,
274
+        channel_id
275
+        FROM
276
+        ts_channel_daily
277
+        WHERE
278
+        channel_id = #{channelId}
279
+        AND org_id = #{orgId}
280
+        <if test="startDate != null and endDate != null">
281
+            AND statis_date BETWEEN #{startDate} AND #{endDate}
282
+        </if>
283
+        <if test="channelType != null and channelType != ''">
284
+            and target_type = #{channelType}
285
+        </if>
286
+        <if test="buildingId != null and buildingId != ''">
287
+            and building_id = #{buildingId}
288
+        </if>
289
+        <if test="taPersonBuildings != null and taPersonBuildings.size > 0">
290
+            and building_id in
291
+            <foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
292
+                #{taPersonBuilding.buildingId}
293
+            </foreach>
294
+        </if>
295
+        GROUP BY   target_id, target_type
296
+    </select>
297
+    <select id="getChannelNewuserListExport"
298
+            resultType="com.huiju.estateagents.excel.ActivityStatistics.ChannelAddRegistNum">
299
+        SELECT
300
+        a.nickname, a.phone,
301
+        if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
302
+        a.province,
303
+        t.create_date
304
+        FROM ta_customer_from t
305
+        left join ta_person a on t.person_id = a.person_id
306
+        <!--        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-->
307
+        <!--        left join td_wx_dict b1 on b.scene_id = b1.scene_id-->
308
+        <!--        left join ta_recommend_customer c on c.person_id = t.person_id and c.realty_consultant is not null-->
309
+        <!--        LEFT JOIN ta_user d ON c.realty_consultant = d.user_id-->
310
+        <!--        LEFT JOIN ta_person e ON t.share_person_id = e.person_id-->
311
+        WHERE t.org_id = #{orgId}
312
+        and t.is_org_first = 1
313
+                and DATE_FORMAT(t.create_date, '%Y-%m-%d' ) >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' ) and DATE_FORMAT(t.create_date, '%Y-%m-%d' ) &lt;= DATE_FORMAT(#{endDate},
314
+                '%Y-%m-%d' )
315
+        <if test="activityId != null and activityId != ''">
316
+            and t.target_id = #{activityId}
317
+        </if>
318
+        <if test="activityType != null and activityType != ''">
319
+            and t.target_type = #{activityType}
320
+        </if>
321
+        <if test="buildingId != null and buildingId != ''">
322
+            and t.building_id = #{buildingId}
323
+        </if>
324
+        <if test="channelId != null and channelId != ''">
325
+            and t.channel_id = #{channelId}
326
+        </if>
327
+        group by t.person_id order by t.create_date desc
328
+    </select>
329
+    <select id="getChannelVisitNumListExport"
330
+            resultType="com.huiju.estateagents.excel.ActivityStatistics.ChannelVisitNum">
331
+        select
332
+        a.nickname, a.phone,
333
+        if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
334
+        a.province,
335
+        b1.scene_alias as personFrom,
336
+        GROUP_CONCAT(d.user_name) as realtyConsultant,
337
+        GROUP_CONCAT(d.phone) as realtyConsultantPhone,
338
+        e.nickname as sharePersonName,
339
+        e.phone as sharePersonPhone,
340
+        t.visit_time as visitDate
341
+        From (
342
+        SELECT
343
+        t.person_id, t.visit_time, t.share_person_id
344
+        FROM
345
+        ta_person_visit_record t
346
+        WHERE
347
+        t.`event` in ( 'detail', 'house_list', 'poster' )
348
+        AND t.event_type IN (
349
+        'activity',
350
+        'help',
351
+        'group',
352
+        'h5',
353
+        'news',
354
+        'building',
355
+        'live',
356
+        'house'
357
+        )
358
+        <if test="targetId != null and targetId != ''">
359
+            and t.target_id = #{targetId}
360
+        </if>
361
+        <if test="targetType != null and targetType != ''">
362
+            and t.event_type = #{targetType}
363
+        </if>
364
+        <if test="channelId != null and channelId != ''">
365
+            and t.channel_id = #{channelId}
366
+        </if>
367
+        <if test="buildingId != null and buildingId != ''">
368
+            and t.building_id = #{buildingId}
369
+        </if>
370
+        AND t.org_id = #{orgId}
371
+        AND DATE_FORMAT( t.visit_time, '%Y-%m-%d' ) >= DATE_FORMAT(#{startDate}, '%Y-%m-%d')
372
+        AND DATE_FORMAT( t.visit_time, '%Y-%m-%d' ) &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
373
+        ) t
374
+        left join ta_person a on t.person_id = a.person_id
375
+        left join ta_person_from_record b on a.person_id = b.person_id and b.org_id = #{orgId}
376
+        left join td_wx_dict b1 on b.scene_id = b1.scene_id
377
+        LEFT JOIN ta_recommend_customer c on c.person_id = t.person_id
378
+        left join ta_user d on c.realty_consultant = d.user_id
379
+        left join ta_person e on t.share_person_id = e.person_id
380
+        group by t.visit_time
381
+        order by t.visit_time desc
382
+    </select>
383
+    <select id="getChannelPersonNumListExport"
384
+            resultType="com.huiju.estateagents.excel.ActivityStatistics.ChannelVisitPersonNum">
385
+        select
386
+        a.nickname, a.phone,
387
+        if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
388
+        a.province,
389
+        b1.scene_alias as personFrom,
390
+        GROUP_CONCAT(d.user_name) as realtyConsultant,
391
+        GROUP_CONCAT(d.phone) as realtyConsultantPhone,
392
+        t.create_date as visitDate,
393
+        e.nickName as sharePersonName,
394
+        t.visitNum
395
+        from (
396
+        SELECT
397
+        t.visit_time AS create_date,
398
+        t.person_id,
399
+        count(*) as visitNum
400
+        FROM
401
+        ta_person_visit_record t
402
+        WHERE
403
+        t.`event` in ( 'detail', 'house_list', 'poster' )
192 404
         AND t.event_type IN (
193 405
         'activity',
194 406
         'help',
195 407
         'group',
196
-        'h5'
408
+        'h5',
409
+        'news',
410
+        'building',
411
+        'live',
412
+        'house'
197 413
         )
198 414
         AND t.org_id = #{orgId}
199
-<!--        AND t.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d')-->
200
-<!--        AND t.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d')-->
415
+        AND DATE_FORMAT( t.visit_time, '%Y-%m-%d' ) >= DATE_FORMAT(#{startDate}, '%Y-%m-%d')
416
+        AND DATE_FORMAT( t.visit_time, '%Y-%m-%d' ) &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
201 417
         <if test="targetId != null and targetId != ''">
202 418
             and t.target_id = #{targetId}
203 419
         </if>
204 420
         <if test="targetType != null and targetType != ''">
205
-            and (case when #{targetType} = 'activity' then t.target_type = 'dynamic' when #{targetType} = 'h5' then t.event_type = 'h5' else t.target_type = #{targetType}
206
-            end)
421
+            and t.event_type = #{targetType}
207 422
         </if>
208 423
         <if test="buildingId != null and buildingId != ''">
209 424
             and t.building_id = #{buildingId}

+ 3
- 0
src/main/resources/mapper/TaLiveActivityMapper.xml Wyświetl plik

@@ -39,6 +39,9 @@
39 39
      </if><if test="buildingId != null and buildingId != ''">
40 40
          and t.building_id = #{buildingId}
41 41
     </if>
42
+    <if test="buildingId == null or buildingId == ''">
43
+        and t.building_id is null
44
+    </if>
42 45
     <if test="personBuildingList != null and personBuildingList.size > 0">
43 46
         AND (t.building_id in
44 47
         <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">

+ 62
- 31
src/main/resources/mapper/TaQrcodeMapper.xml Wyświetl plik

@@ -21,11 +21,21 @@
21 21
             AND t.target_type = #{targetType}
22 22
         </if>
23 23
         <if test = "targetName != '' and targetName != null">
24
-            AND t.target_name = #{targetName}
24
+            AND t.target_name like concat ('%',#{targetName},'%')
25 25
         </if>
26 26
         <if test = "channelId != null">
27 27
             AND t.channel_id = #{channelId}
28 28
         </if>
29
+        <if test = "userId != null">
30
+            AND t.create_user = #{userId}
31
+        </if>
32
+        <if test="personBuildingList != null and personBuildingList.size > 0">
33
+            AND (t.building_id in
34
+            <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
35
+                #{personBuilding.buildingId}
36
+            </foreach>
37
+                OR t.building_id is null)
38
+        </if>
29 39
       ORDER BY
30 40
         t.create_date DESC
31 41
     </select>
@@ -37,7 +47,7 @@
37 47
             ta_person_visit_record t
38 48
         WHERE
39 49
             t.org_id = #{orgId}
40
-            AND t.qrcode_id = #{qrCodeId}
50
+            AND t.qr_code_id = #{qrCodeId}
41 51
     </select>
42 52
 
43 53
     <select id="getVisitNum" resultType="java.lang.Integer">
@@ -47,7 +57,7 @@
47 57
             ta_person_visit_record t
48 58
         WHERE
49 59
             t.org_id = #{orgId}
50
-            AND t.qrcode_id = #{qrCodeId}
60
+            AND t.qr_code_id = #{qrCodeId}
51 61
     </select>
52 62
 
53 63
     <select id="getNewPersons" resultType="java.lang.Integer">
@@ -64,68 +74,77 @@
64 74
         SELECT
65 75
             t.*,
66 76
             IFNULL(t2.`name`,t2.nickname) userName,
67
-            t2.tel userTel,
68
-            t2.sex,
69
-            t2.city,
70
-            sum(t.record_id) accessCount
77
+            t2.phone userTel,
78
+            t2.gender sex,
79
+            t3.shortname city,
80
+            count(*) accessCount
71 81
         FROM
72 82
             ta_person_visit_record t
73
-            left join ta_person t2
74
-            on t.person_id = t2.person_id
83
+            left join ta_person t2 on t.person_id = t2.person_id
84
+            LEFT JOIN td_city t3 ON t2.city = t3.id
75 85
         WHERE
76 86
             t.org_id = #{orgId}
77
-            AND t.qrcode_id = #{qrCodeId}
87
+            AND t.qr_code_id = #{qrCodeId}
78 88
         GROUP BY
79 89
 	        t.person_id
90
+	    ORDER BY
91
+		    t.visit_time DESC
80 92
     </select>
81 93
 
82 94
     <select id="getVisitPersonsRecordExport" resultType="com.huiju.estateagents.excel.QrCodeStatistics.QrCodeVisitPersonNum">
83 95
         SELECT
84 96
             IFNULL( t2.`name`, t2.nickname ) nickName,
85
-            t2.tel phone,
86
-            t2.sex gender,
87
-            t2.city province,
88
-            sum( t.record_id ) visitNum
97
+            t2.phone phone,
98
+            (case t2.gender when 1 then '男' when 2 then '女' else '未知' end)  gender,
99
+            t3.shortname province,
100
+            count( * ) visitNum
89 101
         FROM
90 102
             ta_person_visit_record t
91 103
             LEFT JOIN ta_person t2 ON t.person_id = t2.person_id
104
+            LEFT JOIN td_city t3 ON t2.city = t3.id
92 105
         WHERE
93 106
             t.org_id = #{orgId}
94
-
95
-            AND t.qrcode_id = #{qrCodeId}
96
-
107
+            AND t.qr_code_id = #{qrCodeId}
97 108
         GROUP BY
98 109
             t.person_id
110
+        ORDER BY
111
+		    t.visit_time DESC
99 112
     </select>
100 113
 
101 114
     <select id="getVisitNumRecord" resultType="com.huiju.estateagents.entity.TaPersonVisitRecord">
102 115
         SELECT
103 116
             t.*,
104 117
             IFNULL( t2.`name`, t2.nickname ) userName,
105
-            t2.tel userTel,
106
-            t2.sex,
107
-            t2.city
118
+            t2.phone userTel,
119
+            t2.gender sex,
120
+            t3.shortname city
108 121
         FROM
109 122
             ta_person_visit_record t
110 123
             LEFT JOIN ta_person t2 ON t.person_id = t2.person_id
124
+            LEFT JOIN td_city t3 ON t2.city = t3.id
111 125
         WHERE
112 126
             t.org_id = #{orgId}
113
-            AND t.qrcode_id = #{qrCodeId}
127
+            AND t.qr_code_id = #{qrCodeId}
128
+        ORDER BY
129
+            t.visit_time desc
114 130
     </select>
115 131
 
116
-    <select id="getVisitPersonsRecordExport" resultType="com.huiju.estateagents.excel.QrCodeStatistics.QrCodeVisitNum">
132
+    <select id="getVisitNumRecordExport" resultType="com.huiju.estateagents.excel.QrCodeStatistics.QrCodeVisitNum">
117 133
         SELECT
118 134
             IFNULL( t2.`name`, t2.nickname ) nickName,
119
-            t2.tel phone,
120
-            t2.sex gender,
121
-            t2.city province,
135
+            t2.phone phone,
136
+             (case t2.gender when 1 then '男' when 2 then '女' else '未知' end) gender,
137
+            t3.shortname province,
122 138
 			t.visit_time visitTime
123 139
         FROM
124 140
             ta_person_visit_record t
125 141
             LEFT JOIN ta_person t2 ON t.person_id = t2.person_id
142
+            LEFT JOIN td_city t3 ON t2.city = t3.id
126 143
         WHERE
127 144
             t.org_id = #{orgId}
128
-            AND t.qrcode_id = #{qrCodeId}
145
+            AND t.qr_code_id = #{qrCodeId}
146
+        ORDER BY
147
+            t.visit_time desc
129 148
     </select>
130 149
 
131 150
     <select id="getNewPersonsRecord" resultType="com.huiju.estateagents.entity.TaCustomerFrom">
@@ -134,29 +153,41 @@
134 153
             t2.`name` userName,
135 154
             t2.phone userTel,
136 155
             t2.sex,
137
-            t2.city ,
156
+            t3.shortname city,
138 157
             t2.create_date registerTime
139 158
         FROM
140 159
             ta_customer_from t
141 160
             LEFT JOIN ta_recommend_customer t2 ON t.person_id = t2.person_id
161
+            LEFT JOIN td_city t3 ON t2.city = t3.id
142 162
         WHERE
143 163
             t.org_id = #{orgId}
164
+            AND t.is_org_first =1
144 165
             AND t.qr_code_id = #{qrCodeId}
166
+        GROUP BY
167
+	        t.customer_id
168
+	    order by
169
+	        t2.create_date desc
145 170
     </select>
146 171
 
147 172
     <select id="getNewPersonsRecordExport" resultType="com.huiju.estateagents.excel.QrCodeStatistics.QrCodeNewPersonNum">
148 173
         SELECT
149 174
             t2.`name` nickName,
150
-            t2.tel phone,
151
-            t2.sex gender,
152
-            t2.city province,
153
-            t.create_date registerTime
175
+            t2.phone,
176
+            (case t2.sex when 1 then '男' when 2 then '女' else '未知' end) gender,
177
+            t3.shortname province,
178
+            t2.create_date registerTime
154 179
         FROM
155 180
             ta_customer_from t
156 181
             LEFT JOIN ta_recommend_customer t2 ON t.person_id = t2.person_id
182
+            LEFT JOIN td_city t3 ON t2.city = t3.id
157 183
         WHERE
158 184
             t.org_id = #{orgId}
185
+            AND t.is_org_first =1
159 186
             AND t.qr_code_id = #{qrCodeId}
187
+        GROUP BY
188
+	        t.customer_id
189
+	    order by
190
+	        t2.create_date desc
160 191
     </select>
161 192
 
162 193
 </mapper>

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

@@ -951,13 +951,26 @@
951 951
                 COALESCE(sum( IF ( t.building_id IN ('****')
952 952
             </otherwise>
953 953
         </choose>
954
-            , 1, 0 ) ), 0) AS consultNum,
954
+            , 1, 0 ) ), 0) AS consultBuildingNum,
955
+
956
+        <choose>
957
+            <when test="consultBuildingIds != null and consultBuildingIds.size > 0">
958
+                COALESCE(sum( IF ( t.building_id IN <foreach collection="consultBuildingIds" item="id" open="(" close=")" separator=",">#{id}</foreach>
959
+            </when>
960
+            <otherwise>
961
+                COALESCE(sum( IF ( t.building_id IN ('****')
962
+            </otherwise>
963
+        </choose>
964
+
965
+              AND IFNULL(t.realty_consultant, '') != '', 1, 0 ) ), 0) AS consultNum,
955 966
 
956 967
             COALESCE(sum( IF ( t.building_id = #{buildingId}, 1, 0 ) ), 0) AS buildingNum
968
+
957 969
         FROM
958 970
             ta_recommend_customer t
959 971
         WHERE
960 972
             t.org_id = #{orgId}
961 973
             AND t.person_id = #{personId}
974
+            AND t.status > -1
962 975
     </select>
963 976
 </mapper>

+ 18
- 0
src/main/resources/mapper/statistic/TaActivityStaticMapper.xml Wyświetl plik

@@ -2081,6 +2081,12 @@
2081 2081
         <if test="buildingId != null and buildingId != ''">
2082 2082
             and t.building_id = #{buildingId}
2083 2083
         </if>
2084
+        <if test="taPersonBuildings != null and taPersonBuildings.size > 0">
2085
+            and t.building_id in
2086
+            <foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
2087
+                #{taPersonBuilding.buildingId}
2088
+            </foreach>
2089
+        </if>
2084 2090
         AND t.org_id = #{orgId}
2085 2091
         AND t.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d')
2086 2092
         AND t.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
@@ -2143,6 +2149,12 @@
2143 2149
         <if test="buildingId != null and buildingId != ''">
2144 2150
             and t.building_id = #{buildingId}
2145 2151
         </if>
2152
+        <if test="taPersonBuildings != null and taPersonBuildings.size > 0">
2153
+            and t.building_id in
2154
+            <foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
2155
+                #{taPersonBuilding.buildingId}
2156
+            </foreach>
2157
+        </if>
2146 2158
         AND t.org_id = #{orgId}
2147 2159
         AND t.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d')
2148 2160
         AND t.visit_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
@@ -2211,6 +2223,12 @@
2211 2223
         <if test="buildingId != null and buildingId != ''">
2212 2224
             and t.building_id = #{buildingId}
2213 2225
         </if>
2226
+        <if test="taPersonBuildings != null and taPersonBuildings.size > 0">
2227
+            and t.building_id in
2228
+            <foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
2229
+                #{taPersonBuilding.buildingId}
2230
+            </foreach>
2231
+        </if>
2214 2232
         GROUP BY
2215 2233
         t.person_id ) as t
2216 2234
         left join ta_person a on t.person_id = a.person_id

+ 3
- 4
src/main/resources/mapper/statistic/TsPersonFromStatisticMapper.xml Wyświetl plik

@@ -50,8 +50,7 @@
50 50
         select ifnull(tp.from_num, 0) as from_num , ifnull(tp.registered_num, 0) AS registered_num , ifnull(tp.create_time, date.date) AS create_time, ifnull(tp.scene_type, 'other') as scene_type from (
51 51
 
52 52
         SELECT
53
-        DATE_FORMAT(
54
-        DATE_ADD( STR_TO_DATE(#{startDate}, '%Y-%m-%d' ), INTERVAL rownum DAY ), '%Y-%m-%d' ) AS date
53
+        DATE_FORMAT( DATE_SUB( now( ), INTERVAL rownum DAY ), '%Y-%m-%d' ) AS date
55 54
         FROM sequence
56 55
         WHERE rownum &lt; DATEDIFF(STR_TO_DATE( #{endDate}, '%Y-%m-%d' ), STR_TO_DATE( #{startDate}, '%Y-%m-%d' )) ) as date
57 56
 
@@ -73,8 +72,7 @@
73 72
         select ifnull(tp.from_num, 0) as from_num , ifnull(tp.registered_num, 0) AS registered_num , ifnull(tp.create_time, date.date) AS create_time, ifnull(tp.scene_type, 'other') as scene_type from (
74 73
 
75 74
         SELECT
76
-        DATE_FORMAT(
77
-        DATE_ADD( STR_TO_DATE(#{startDate}, '%Y-%m-%d' ), INTERVAL rownum DAY ), '%Y-%m-%d' ) AS date
75
+        DATE_FORMAT( DATE_SUB( now( ), INTERVAL rownum DAY ), '%Y-%m-%d' ) AS date
78 76
         FROM sequence
79 77
         WHERE rownum &lt; DATEDIFF(STR_TO_DATE( #{endDate}, '%Y-%m-%d' ), STR_TO_DATE( #{startDate}, '%Y-%m-%d' )) ) as date
80 78
 
@@ -99,5 +97,6 @@
99 97
         DATE_FORMAT( tp.create_date, '%Y-%m-%d' )
100 98
         ORDER BY tp.create_date
101 99
         ) as tp on date.date = tp.create_time
100
+        order by date.date
102 101
     </select>
103 102
 </mapper>

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

@@ -62,7 +62,7 @@
62 62
             td_biz_event_type b
63 63
             <trim prefix="where">
64 64
                 <if test="startDate != null or endDate != null">
65
-                    a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
65
+                    a.rownum <![CDATA[ < ]]> datediff(#{endDate}, #{startDate})
66 66
                 </if>
67 67
             </trim>
68 68
         ) AS temp_date