Explorar el Código

Merge branch 'dev'

# Conflicts:
#	src/main/resources/mapper/TaRecommendCustomerMapper.xml
顾绍勇 hace 5 años
padre
commit
348830f7a6
Se han modificado 75 ficheros con 3851 adiciones y 420 borrados
  1. 7
    1
      pom.xml
  2. 2
    0
      src/main/java/com/huiju/estateagents/base/BaseController.java
  3. 29
    0
      src/main/java/com/huiju/estateagents/bo/request/QrCodeStatisticResponseBO.java
  4. 18
    0
      src/main/java/com/huiju/estateagents/common/CommConstant.java
  5. 90
    0
      src/main/java/com/huiju/estateagents/common/MiniAppPageEnum.java
  6. 1
    1
      src/main/java/com/huiju/estateagents/common/StringUtils.java
  7. 33
    0
      src/main/java/com/huiju/estateagents/common/WxQrCodeUtils.java
  8. 4
    3
      src/main/java/com/huiju/estateagents/controller/ExtendContentController.java
  9. 6
    1
      src/main/java/com/huiju/estateagents/controller/HelpActivityController.java
  10. 15
    6
      src/main/java/com/huiju/estateagents/controller/IndexController.java
  11. 31
    14
      src/main/java/com/huiju/estateagents/controller/MiniAppController.java
  12. 7
    1
      src/main/java/com/huiju/estateagents/controller/TaBuildingController.java
  13. 5
    0
      src/main/java/com/huiju/estateagents/controller/TaBuildingDynamicController.java
  14. 177
    18
      src/main/java/com/huiju/estateagents/controller/TaChannelController.java
  15. 28
    2
      src/main/java/com/huiju/estateagents/controller/TaCustomImgController.java
  16. 8
    2
      src/main/java/com/huiju/estateagents/controller/TaHousingResourcesController.java
  17. 22
    7
      src/main/java/com/huiju/estateagents/controller/TaLiveActivityController.java
  18. 7
    1
      src/main/java/com/huiju/estateagents/controller/TaNewsController.java
  19. 12
    0
      src/main/java/com/huiju/estateagents/controller/TaPersonController.java
  20. 244
    0
      src/main/java/com/huiju/estateagents/controller/TaQrcodeController.java
  21. 3
    6
      src/main/java/com/huiju/estateagents/controller/TaRaiseController.java
  22. 19
    11
      src/main/java/com/huiju/estateagents/controller/TaRecommendCustomerController.java
  23. 7
    1
      src/main/java/com/huiju/estateagents/controller/TaShareActivityController.java
  24. 114
    88
      src/main/java/com/huiju/estateagents/drainage/controller/TaDrainageController.java
  25. 2
    0
      src/main/java/com/huiju/estateagents/entity/ExtendContent.java
  26. 3
    0
      src/main/java/com/huiju/estateagents/entity/TaBuilding.java
  27. 8
    4
      src/main/java/com/huiju/estateagents/entity/TaChannel.java
  28. 39
    1
      src/main/java/com/huiju/estateagents/entity/TaCustomerFrom.java
  29. 2
    0
      src/main/java/com/huiju/estateagents/entity/TaMiniappQrcode.java
  30. 10
    0
      src/main/java/com/huiju/estateagents/entity/TaPerson.java
  31. 16
    0
      src/main/java/com/huiju/estateagents/entity/TaPersonVisitRecord.java
  32. 99
    0
      src/main/java/com/huiju/estateagents/entity/TaQrcode.java
  33. 12
    1
      src/main/java/com/huiju/estateagents/entity/TsActivityDaily.java
  34. 45
    0
      src/main/java/com/huiju/estateagents/excel/ActivityStatistics/ChannelAddRegistNum.java
  35. 79
    0
      src/main/java/com/huiju/estateagents/excel/ActivityStatistics/ChannelVisitNum.java
  36. 86
    0
      src/main/java/com/huiju/estateagents/excel/ActivityStatistics/ChannelVisitPersonNum.java
  37. 58
    0
      src/main/java/com/huiju/estateagents/excel/ActivityStatistics/TsChannelDaily.java
  38. 45
    0
      src/main/java/com/huiju/estateagents/excel/QrCodeStatistics/QrCodeNewPersonNum.java
  39. 45
    0
      src/main/java/com/huiju/estateagents/excel/QrCodeStatistics/QrCodeVisitNum.java
  40. 44
    0
      src/main/java/com/huiju/estateagents/excel/QrCodeStatistics/QrCodeVisitPersonNum.java
  41. 3
    0
      src/main/java/com/huiju/estateagents/interceptor/AccessInterceptor.java
  42. 33
    0
      src/main/java/com/huiju/estateagents/mapper/TaChannelMapper.java
  43. 9
    1
      src/main/java/com/huiju/estateagents/mapper/TaLiveActivityMapper.java
  44. 2
    0
      src/main/java/com/huiju/estateagents/mapper/TaMiniappMapper.java
  45. 1
    0
      src/main/java/com/huiju/estateagents/mapper/TaPersonBuildingMapper.java
  46. 92
    0
      src/main/java/com/huiju/estateagents/mapper/TaQrcodeMapper.java
  47. 83
    27
      src/main/java/com/huiju/estateagents/mapper/TaRecommendCustomerMapper.java
  48. 15
    0
      src/main/java/com/huiju/estateagents/reportCustomerAop/ReportCustomer.java
  49. 171
    0
      src/main/java/com/huiju/estateagents/reportCustomerAop/ReportCustomerAspect.java
  50. 169
    0
      src/main/java/com/huiju/estateagents/reportCustomerAop/ReportCustomerImpl.java
  51. 2
    1
      src/main/java/com/huiju/estateagents/service/ITaLiveActivityService.java
  52. 6
    5
      src/main/java/com/huiju/estateagents/service/ITaPersonService.java
  53. 36
    0
      src/main/java/com/huiju/estateagents/service/ITaQrcodeService.java
  54. 14
    3
      src/main/java/com/huiju/estateagents/service/ITaRecommendCustomerService.java
  55. 106
    0
      src/main/java/com/huiju/estateagents/service/TaChannelService.java
  56. 6
    1
      src/main/java/com/huiju/estateagents/service/impl/ExtendContentServiceImpl.java
  57. 13
    3
      src/main/java/com/huiju/estateagents/service/impl/MiniAppServiceImpl.java
  58. 15
    1
      src/main/java/com/huiju/estateagents/service/impl/TaBuildingServiceImpl.java
  59. 203
    0
      src/main/java/com/huiju/estateagents/service/impl/TaChannelServiceImpl.java
  60. 5
    5
      src/main/java/com/huiju/estateagents/service/impl/TaLiveActivityServiceImpl.java
  61. 71
    100
      src/main/java/com/huiju/estateagents/service/impl/TaPersonServiceImpl.java
  62. 242
    0
      src/main/java/com/huiju/estateagents/service/impl/TaQrcodeServiceImpl.java
  63. 213
    0
      src/main/java/com/huiju/estateagents/service/impl/TaRecommendCustomerServiceImpl.java
  64. 3
    3
      src/main/java/com/huiju/estateagents/statistic/controller/ActivityStatisticController.java
  65. 13
    6
      src/main/java/com/huiju/estateagents/statistic/mapper/TaActicityStaticMapper.java
  66. 34
    9
      src/main/java/com/huiju/estateagents/statistic/service/impl/TaActivityStaticServiceImpl.java
  67. 1
    1
      src/main/java/com/huiju/estateagents/third/controller/TaThirdPartyMiniappConfigController.java
  68. 6
    6
      src/main/resources/log/logback-spring.xml
  69. 397
    0
      src/main/resources/mapper/TaChannelMapper.xml
  70. 41
    24
      src/main/resources/mapper/TaLiveActivityMapper.xml
  71. 194
    0
      src/main/resources/mapper/TaQrcodeMapper.xml
  72. 130
    42
      src/main/resources/mapper/TaRecommendCustomerMapper.xml
  73. 18
    0
      src/main/resources/mapper/statistic/TaActivityStaticMapper.xml
  74. 21
    12
      src/main/resources/mapper/statistic/TsPersonFromStatisticMapper.xml
  75. 1
    1
      src/main/resources/mapper/statistic/TsUserBehaviorStatisticMapper.xml

+ 7
- 1
pom.xml Ver fichero

@@ -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
 
@@ -129,6 +129,12 @@
129 129
 			<version>2.7.0</version>
130 130
 		</dependency>
131 131
 
132
+        <!-- aop 依赖 -->
133
+        <dependency>
134
+            <groupId>org.springframework.boot</groupId>
135
+            <artifactId>spring-boot-starter-aop</artifactId>
136
+        </dependency>
137
+
132 138
 
133 139
 		<dependency>
134 140
 			<groupId>fadada</groupId>

+ 2
- 0
src/main/java/com/huiju/estateagents/base/BaseController.java Ver fichero

@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
10 10
 
11 11
 import javax.servlet.http.HttpServletRequest;
12 12
 import java.util.ArrayList;
13
+import java.util.Enumeration;
13 14
 import java.util.List;
14 15
 import java.util.Map;
15 16
 
@@ -140,3 +141,4 @@ public class BaseController {
140 141
         return taPersonBuildingList;
141 142
     }
142 143
 }
144
+

+ 29
- 0
src/main/java/com/huiju/estateagents/bo/request/QrCodeStatisticResponseBO.java Ver fichero

@@ -0,0 +1,29 @@
1
+package com.huiju.estateagents.bo.request;
2
+
3
+import lombok.Data;
4
+
5
+/**
6
+ * 二维码统计返回实体
7
+ *
8
+ * @author gusy
9
+ * @date 2020/5/21 13:53
10
+ */
11
+@Data
12
+public class QrCodeStatisticResponseBO {
13
+
14
+    /**
15
+     * 访问人数
16
+     */
17
+    private Integer visitPersons;
18
+
19
+    /**
20
+     * 访问次数
21
+     */
22
+    private Integer visitNum;
23
+
24
+    /**
25
+     * 新增用户
26
+     */
27
+    private Integer newPersons;
28
+
29
+}

+ 18
- 0
src/main/java/com/huiju/estateagents/common/CommConstant.java Ver fichero

@@ -206,6 +206,17 @@ public class CommConstant {
206 206
      */
207 207
     public static final String BANNER_INDEX = "index";
208 208
 
209
+    /**
210
+     * 首屏广告_发布位置——项目
211
+     */
212
+    public static final String BANNER_BUILDING = "building";
213
+
214
+    //首页资讯
215
+    public static final String INDEX_NEWS = "indexNews";
216
+
217
+    //首页分享类型
218
+    public static final String IMG_TYPE = "imgType";
219
+
209 220
     //=================  首屏广告 / 轮播图 end =======================
210 221
 
211 222
     /**
@@ -541,6 +552,13 @@ public class CommConstant {
541 552
      */
542 553
     public static final String HOUSE = "house";
543 554
 
555
+
556
+    /**
557
+     * 首页分享
558
+     */
559
+    public static final String INDEX = "index";
560
+
561
+
544 562
     /**
545 563
      * 批量销售
546 564
      */

+ 90
- 0
src/main/java/com/huiju/estateagents/common/MiniAppPageEnum.java Ver fichero

@@ -0,0 +1,90 @@
1
+package com.huiju.estateagents.common;
2
+
3
+/**
4
+ * 小程序页面枚举
5
+ *
6
+ * @author gusy
7
+ * @date 2020/5/21 15:58
8
+ */
9
+public enum MiniAppPageEnum {
10
+
11
+    /**
12
+     * 项目
13
+     */
14
+    PROJECT("project", "id=%s&targetType=%S&channelId=%s&qrCodeId=%s&buildingId=%s", "pages/project/detail/index"),
15
+
16
+    /**
17
+     * 报名活动
18
+     */
19
+    ACTIVITY("activity", "id=%s&targetType=%S&channelId=%s&qrCodeId=%s&buildingId=%s", "pages/activity/detail/index"),
20
+
21
+    /**
22
+     * 助力活动
23
+     */
24
+    HELP("help", "id=%s&targetType=%S&channelId=%s&qrCodeId=%s&buildingId=%s", "pages/activity/detail/assistance"),
25
+
26
+    /**
27
+     * 拼团活动
28
+     */
29
+    GROUP("group", "id=%s&targetType=%S&channelId=%s&qrCodeId=%s&buildingId=%s", "pages/activity/detail/assemble"),
30
+
31
+    /**
32
+     * h5活动
33
+     */
34
+    H5("h5", "id=%s&targetType=%S&channelId=%s&qrCodeId=%s&buildingId=%s", "pages/project/h5Page"),
35
+
36
+    /**
37
+     * 直播活动
38
+     */
39
+    LIVE("live", "id=%s&targetType=%S&channelId=%s&qrCodeId=%s&buildingId=%s", "onlineSelling/pages/live/index"),
40
+
41
+    /**
42
+     * 资讯
43
+     */
44
+    NEWS("news", "id=%s&targetType=%S&channelId=%s&qrCodeId=%s&buildingId=%s", "pages/news/detail/index"),
45
+
46
+    /**
47
+     * 在线选房
48
+     */
49
+    SALESBATCH("salesBatch", "id=%s&targetType=%S&channelId=%s&qrCodeId=%s&buildingId=%s", "onlineSelling/pages/houseList/index");
50
+
51
+    private String type;
52
+    private String scene;
53
+    private String page;
54
+
55
+    MiniAppPageEnum(String type, String scene, String page) {
56
+        this.type = type;
57
+        this.scene = scene;
58
+        this.page = page;
59
+    }
60
+
61
+    public String getType() {
62
+        return type;
63
+    }
64
+
65
+    public String getScene() {
66
+        return scene;
67
+    }
68
+
69
+    public String getPage() {
70
+        return page;
71
+    }
72
+
73
+    public static String getSceneByType(String type) {
74
+        for (MiniAppPageEnum pageEnum : MiniAppPageEnum.values()) {
75
+            if (type.equals(pageEnum.getType())) {
76
+                return pageEnum.getScene();
77
+            }
78
+        }
79
+        return null;
80
+    }
81
+
82
+    public static String getPageByType(String type) {
83
+        for (MiniAppPageEnum pageEnum : MiniAppPageEnum.values()) {
84
+            if (type.equals(pageEnum.getType())) {
85
+                return pageEnum.getPage();
86
+            }
87
+        }
88
+        return null;
89
+    }
90
+}

+ 1
- 1
src/main/java/com/huiju/estateagents/common/StringUtils.java Ver fichero

@@ -26,7 +26,7 @@ public class StringUtils {
26 26
     }
27 27
 
28 28
     public static String ifNull(String src, String defaultVal) {
29
-        return null == src || "".equals(src) ? defaultVal : src;
29
+        return isEmpty(src) ? defaultVal : src;
30 30
     }
31 31
 
32 32
     public static String random(int length) {

+ 33
- 0
src/main/java/com/huiju/estateagents/common/WxQrCodeUtils.java Ver fichero

@@ -0,0 +1,33 @@
1
+package com.huiju.estateagents.common;
2
+
3
+import com.alibaba.fastjson.JSONObject;
4
+import org.apache.commons.lang3.StringUtils;
5
+
6
+/**
7
+ * 微信二维码生成工具类
8
+ *
9
+ * @author gusy
10
+ * @date 2020/5/21 15:40
11
+ */
12
+public class WxQrCodeUtils {
13
+
14
+    /**
15
+     * 生成scene和页面
16
+     *
17
+     * @param type
18
+     * @param scene  为空则使用配置的通用模板
19
+     * @param params scene为空是必须按照模板内容填写
20
+     * @return
21
+     */
22
+    public static String generateSceneAndPage(String type, String scene, String... params) {
23
+        if (StringUtils.isBlank(scene)) {
24
+            String sceneTemplate = MiniAppPageEnum.getSceneByType(type);
25
+            scene = String.format(sceneTemplate, params);
26
+        }
27
+
28
+        JSONObject obj = new JSONObject();
29
+        obj.put("scene", scene);
30
+        obj.put("page", MiniAppPageEnum.getPageByType(type));
31
+        return obj.toJSONString();
32
+    }
33
+}

+ 4
- 3
src/main/java/com/huiju/estateagents/controller/ExtendContentController.java Ver fichero

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.huiju.estateagents.base.BaseController;
7 7
 import com.huiju.estateagents.base.ResponseBean;
8
+import com.huiju.estateagents.common.CommConstant;
8 9
 import com.huiju.estateagents.entity.*;
9 10
 import com.huiju.estateagents.service.*;
10 11
 import com.huiju.estateagents.service.impl.HelpActivityServiceImpl;
@@ -110,7 +111,7 @@ public class ExtendContentController extends BaseController {
110 111
                 taBuildingQueryWrapper.eq("building_id", e.getBuildingId());
111 112
                 TaBuilding taBuilding = iTaBuildingService.getOne(taBuildingQueryWrapper);
112 113
                 e.setCityName(null == tdCity ? "" : tdCity.getName());
113
-                if (taBuilding != null){
114
+                if (taBuilding != null && e.getIsHaveActive()){
114 115
                     e.setBuildingName(taBuilding.getBuildingName());
115 116
                 }
116 117
             });
@@ -172,7 +173,7 @@ public class ExtendContentController extends BaseController {
172 173
         //一个城市只能有一个开屏广告
173 174
         boolean existFlag = iExtendContentService.advertistExistFlag(extendContent, getOrgId(request));
174 175
         if (!existFlag){
175
-            responseBean.addError("该城市已有开屏广告,请勿再次上架");
176
+            responseBean.addError("该发布位置已有开屏广告,请勿再次上架");
176 177
             return responseBean;
177 178
         }
178 179
 
@@ -251,7 +252,7 @@ public class ExtendContentController extends BaseController {
251 252
             //一个城市只能有一个开屏广告
252 253
             boolean existFlag = iExtendContentService.advertistExistFlag(extendContent, getOrgId(request));
253 254
             if (!existFlag){
254
-                responseBean.addError("该城市已有开屏广告,请勿再次上架");
255
+                responseBean.addError("该发布位置已有开屏广告,请勿再次上架");
255 256
                 return responseBean;
256 257
             }
257 258
 

+ 6
- 1
src/main/java/com/huiju/estateagents/controller/HelpActivityController.java Ver fichero

@@ -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,8 +458,12 @@ 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,
461
-                                          @RequestParam(value = "initiateId",required = false) Integer initiateId,HttpServletRequest request) {
463
+                                          @RequestParam(value = "qrCodeId", required = false) String qrCodeId,
464
+                                          @RequestParam(value = "channelId", required = false) String channelId,
465
+                                          @RequestParam(value = "sceneId", required = false) String sceneId,
466
+                                          HttpServletRequest request, @RequestParam(value = "initiateId",required = false) Integer initiateId) {
462 467
         ResponseBean responseBean = new ResponseBean();
463 468
         Integer orgId = getOrgId(request);
464 469
         String openid = getOpenId(request);

+ 15
- 6
src/main/java/com/huiju/estateagents/controller/IndexController.java Ver fichero

@@ -1,19 +1,28 @@
1 1
 package com.huiju.estateagents.controller;
2 2
 
3
-import org.springframework.web.bind.annotation.RequestMapping;
4
-import org.springframework.web.bind.annotation.RestController;
3
+import com.huiju.estateagents.base.ResponseBean;
4
+import com.huiju.estateagents.reportCustomerAop.ReportCustomer;
5
+import org.springframework.web.bind.annotation.*;
6
+
7
+import javax.servlet.http.HttpServletRequest;
5 8
 
6 9
 /**
7 10
  * 微信首页
8 11
  */
9 12
 @RestController
10
-@RequestMapping("/api")
13
+@RequestMapping("/api/wx")
11 14
 public class IndexController {
12 15
 
13 16
 
14 17
 
15
-
16
-
17
-
18
+    @PostMapping("/indexCustomer")
19
+    @ReportCustomer(type = "index")
20
+    public ResponseBean getPreloadData(@RequestParam(value = "id", required = false) String id,
21
+                                       @RequestParam(value = "qrCodeId", required = false) String qrCodeId,
22
+                                       @RequestParam(value = "channelId", required = false) String channelId,
23
+                                       @RequestParam(value = "sceneId", required = false) String sceneId,
24
+                                       HttpServletRequest request) {
25
+        return ResponseBean.success("success");
26
+    }
18 27
 
19 28
 }

+ 31
- 14
src/main/java/com/huiju/estateagents/controller/MiniAppController.java Ver fichero

@@ -12,6 +12,7 @@ import com.huiju.estateagents.center.taUser.entity.TaUser;
12 12
 import com.huiju.estateagents.center.taUser.service.ITaUserService;
13 13
 import com.huiju.estateagents.common.CommConstant;
14 14
 import com.huiju.estateagents.common.JWTUtils;
15
+import com.huiju.estateagents.common.StringUtils;
15 16
 import com.huiju.estateagents.drainage.entity.TaDrainage;
16 17
 import com.huiju.estateagents.drainage.service.ITaDrainageService;
17 18
 import com.huiju.estateagents.entity.*;
@@ -22,7 +23,6 @@ import com.huiju.estateagents.service.*;
22 23
 import com.huiju.estateagents.third.service.ITaThirdPartyMiniappConfigService;
23 24
 import me.chanjar.weixin.common.error.WxErrorException;
24 25
 import org.apache.commons.collections.CollectionUtils;
25
-import org.apache.commons.lang3.StringUtils;
26 26
 import org.apache.http.HttpStatus;
27 27
 import org.slf4j.Logger;
28 28
 import org.slf4j.LoggerFactory;
@@ -194,10 +194,10 @@ public class MiniAppController extends BaseController {
194 194
             HttpServletRequest request) {
195 195
         String appid = request.getHeader("appid");
196 196
 
197
-        if (StringUtils.isBlank(code)) {
197
+        if (StringUtils.isEmpty(code)) {
198 198
             return ResponseBean.error("参数 code 不能为空", ResponseBean.ERROR_ILLEGAL_PARAMS);
199 199
         }
200
-        if (StringUtils.isBlank(appid)) {
200
+        if (StringUtils.isEmpty(appid)) {
201 201
             return ResponseBean.error("Header 参数 appid 不能为空", ResponseBean.ERROR_ILLEGAL_PARAMS);
202 202
         }
203 203
 
@@ -254,8 +254,8 @@ public class MiniAppController extends BaseController {
254 254
             // 增加积分线程 --- 3.5.23版本授权手机分享者增加积分,单纯分享不增加积分
255 255
 //            ExecutorService threadPool = Executors.newCachedThreadPool();
256 256
 //            threadPool.execute(() -> {
257
-////                if (null != from && from.contains("share") && !com.huiju.estateagents.common.StringUtils.isEmpty(recommender) && count > 0) {
258
-//                if (null != from && from.contains("share") && !com.huiju.estateagents.common.StringUtils.isEmpty(recommender)) {
257
+////                if (null != from && from.contains("share") && !StringUtils.isEmpty(recommender) && count > 0) {
258
+//                if (null != from && from.contains("share") && !StringUtils.isEmpty(recommender)) {
259 259
 //                    // 校验是否点击过此人的分享
260 260
 //                    boolean checkPoint = checkSharePersonFrom(from, taPerson.getPersonId(), targetId, orgId);
261 261
 //                    if (checkPoint) {
@@ -265,7 +265,7 @@ public class MiniAppController extends BaseController {
265 265
 //                }
266 266
 //            });
267 267
 
268
-            if (StringUtils.isNotBlank(from) && StringUtils.isNotBlank(recommender) && StringUtils.isNotBlank(targetId)) {
268
+            if (!StringUtils.isEmpty(from) && !StringUtils.isEmpty(recommender) && !StringUtils.isEmpty(targetId)) {
269 269
                 TaSharePersonFrom taSharePersonFrom = new TaSharePersonFrom();
270 270
                 TaPerson recommenderPerson = taPersonService.getById(recommender);
271 271
                 taSharePersonFrom.setCreateDate(LocalDateTime.now());
@@ -509,12 +509,18 @@ public class MiniAppController extends BaseController {
509 509
         String targetId = params.getString("targetId");
510 510
         // 目标名称
511 511
         String targetName = params.getString("targetName");
512
-        // 推广用户
512
+        // 推广用户 - 分享人
513 513
         String promoter = params.getString("promoter");
514
+        // 置业顾问
515
+        String consultantPersonId = request.getHeader("x-consultant");
516
+        // 渠道ID
517
+        String channelId = params.getString("channelId");
518
+        // 推广码ID
519
+        String qrCodeId = params.getString("qrCodeId");
514 520
 
515 521
         // 解密
516 522
         WxMaPhoneNumberInfo phoneNoInfo = miniAppService.getPhoneNoInfo(sessionKey, encryptedData, iv, appid);
517
-        if (null == phoneNoInfo || com.huiju.estateagents.common.StringUtils.isEmpty(phoneNoInfo.getPhoneNumber())) {
523
+        if (null == phoneNoInfo || StringUtils.isEmpty(phoneNoInfo.getPhoneNumber())) {
518 524
             ResponseBean.error("解析用户手机号码出错", ResponseBean.ERROR_UNAVAILABLE);
519 525
         }
520 526
 
@@ -522,21 +528,32 @@ public class MiniAppController extends BaseController {
522 528
         Integer orgId = getOrgId(request);
523 529
         String phone = phoneNoInfo.getPhoneNumber();
524 530
 
531
+        TaCustomerFrom customerFrom = new TaCustomerFrom();
532
+        customerFrom.setTargetType(targetType);
533
+        customerFrom.setTargetId(targetId);
534
+        customerFrom.setTargetName(targetName);
535
+        customerFrom.setOrgId(orgId);
536
+        customerFrom.setSceneId(sceneId);
537
+        if (!StringUtils.isEmpty(channelId)) {
538
+            customerFrom.setChannelId(Integer.valueOf(channelId));
539
+        }
540
+        if (!StringUtils.isEmpty(qrCodeId)) {
541
+            customerFrom.setQrCodeId(Integer.valueOf(qrCodeId));
542
+        }
543
+
525 544
         try {
526 545
             taPersonService.authPhone(
527 546
                     orgId,
528 547
                     openid,
529 548
                     phone,
530 549
                     buildingId,
531
-                    sceneId,
532
-                    targetType,
533
-                    targetId,
534
-                    targetName,
535
-                    promoter);
550
+                    promoter,
551
+                    consultantPersonId,
552
+                    customerFrom);
536 553
 
537 554
             return ResponseBean.success(phoneNoInfo);
538 555
         } catch (Exception e) {
539
-//           e.printStackTrace();
556
+           e.printStackTrace();
540 557
             return ResponseBean.error("授权手机失败: " + e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
541 558
         }
542 559
     }

+ 7
- 1
src/main/java/com/huiju/estateagents/controller/TaBuildingController.java Ver fichero

@@ -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 Ver fichero

@@ -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);

+ 177
- 18
src/main/java/com/huiju/estateagents/controller/TaChannelController.java Ver fichero

@@ -1,41 +1,34 @@
1 1
 package com.huiju.estateagents.controller;
2 2
 
3
-import com.alibaba.fastjson.JSONObject;
4
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
3
+import com.alibaba.excel.EasyExcel;
4
+import com.alibaba.excel.ExcelWriter;
5
+import com.alibaba.excel.write.metadata.WriteSheet;
5 6
 import com.baomidou.mybatisplus.core.metadata.IPage;
6 7
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7 8
 import com.huiju.estateagents.base.BaseController;
8 9
 import com.huiju.estateagents.base.ResponseBean;
9
-import io.swagger.annotations.ApiOperation;
10
-import com.huiju.estateagents.common.JWTUtils;
11
-import com.huiju.estateagents.common.StringUtils;
12
-import com.huiju.estateagents.entity.TaBuildingReport;
13 10
 import com.huiju.estateagents.entity.TaChannel;
14
-import com.huiju.estateagents.entity.TaPerson;
11
+import com.huiju.estateagents.excel.ActivityStatistics.*;
12
+import com.huiju.estateagents.excel.handler.CustomCellWriteHandler;
15 13
 import com.huiju.estateagents.mapper.TaChannelMapper;
16 14
 import com.huiju.estateagents.service.ITaPersonService;
17 15
 import com.huiju.estateagents.service.TaChannelService;
18 16
 import io.swagger.annotations.Api;
19 17
 import io.swagger.annotations.ApiImplicitParam;
20 18
 import io.swagger.annotations.ApiImplicitParams;
21
-import org.apache.http.HttpRequest;
19
+import io.swagger.annotations.ApiOperation;
22 20
 import org.slf4j.Logger;
23 21
 import org.slf4j.LoggerFactory;
24 22
 import org.springframework.beans.factory.annotation.Autowired;
25
-import org.springframework.web.bind.annotation.PathVariable;
26
-import org.springframework.web.bind.annotation.RequestBody;
27
-import org.springframework.web.bind.annotation.RequestMapping;
28
-import org.springframework.web.bind.annotation.RequestMethod;
29
-import org.springframework.web.bind.annotation.RequestParam;
30
-import org.springframework.web.bind.annotation.ResponseBody;
31
-import org.springframework.web.bind.annotation.RestController;
23
+import org.springframework.format.annotation.DateTimeFormat;
24
+import org.springframework.web.bind.annotation.*;
32 25
 
33 26
 import javax.servlet.http.HttpServletRequest;
34
-
35
-import java.time.LocalDateTime;
27
+import javax.servlet.http.HttpServletResponse;
28
+import java.io.IOException;
29
+import java.time.LocalDate;
36 30
 import java.util.HashMap;
37 31
 import java.util.List;
38
-import java.util.stream.Collectors;
39 32
 
40 33
 
41 34
 /**
@@ -260,4 +253,170 @@ public class TaChannelController extends BaseController {
260 253
         ResponseBean taPerson =  taPersonService.InviteClientsList(id,phone,pageNum,pageSize);
261 254
         return taPerson;
262 255
     }
256
+
257
+    /**
258
+     * 渠道引进客户统计
259
+     * @return
260
+     */
261
+    @GetMapping(value = "/admin/channel/introductionList")
262
+    public ResponseBean getChannelIntroductionList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
263
+                                                     @RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize,
264
+                                                     @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
265
+                                                     @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate,
266
+                                                     @RequestParam(value = "targetType", required = false)String targetType,
267
+                                                     @RequestParam(value = "buildingId", required = false)String buildingId,
268
+                                                     @RequestParam(value = "channelId") Integer channelId,
269
+                                                     @RequestParam(value = "sortField", required = false) String sortField,
270
+                                                     @RequestParam(value = "sortOrder", required = false) String sortOrder,
271
+                                                     HttpServletRequest request) {
272
+        return taChannelService.getChannelIntroductionList(pageNum, pageSize, getOrgId(request), startDate, endDate, targetType, buildingId, channelId,sortField,sortOrder, getTaPersonBuildingListByUserId(request));
273
+    }
274
+
275
+    /**
276
+     * 渠道注册用户列表
277
+     * @return
278
+     */
279
+    @GetMapping(value = "/admin/channel/introduction/newuserList")
280
+    public ResponseBean getNewuserList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
281
+                                       @RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize,
282
+                                       @RequestParam(value = "targetId", required = false) String targetId,
283
+                                       @RequestParam(value = "targetType", required = false) String targetType,
284
+                                       @RequestParam(value = "buildingId", required = false) String buildingId,
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,
288
+                                       HttpServletRequest request) {
289
+        return taChannelService.getNewuserList(pageNum, pageSize, getOrgId(request), channelId, targetId, targetType, buildingId,startDate,endDate);
290
+    }
291
+
292
+    /**
293
+     * 渠道访问次数列表
294
+     * @return
295
+     */
296
+    @GetMapping(value = "/admin/channel/introduction/visitNumList")
297
+    public ResponseBean getVisitNumList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
298
+                                       @RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize,
299
+                                       @RequestParam(value = "targetId", required = false) String targetId,
300
+                                       @RequestParam(value = "targetType", required = false) String targetType,
301
+                                       @RequestParam(value = "buildingId", required = false) String buildingId,
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,
305
+                                       HttpServletRequest request) {
306
+        return taChannelService.getVisitNumList(pageNum, pageSize, getOrgId(request), channelId, targetId, targetType, buildingId,startDate,endDate);
307
+    }
308
+
309
+
310
+    /**
311
+     * 渠道访问人数列表
312
+     * @return
313
+     */
314
+    @GetMapping(value = "/admin/channel/introduction/personNumList")
315
+    public ResponseBean getPersonNumList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
316
+                                        @RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize,
317
+                                        @RequestParam(value = "targetId", required = false) String targetId,
318
+                                        @RequestParam(value = "targetType", required = false) String targetType,
319
+                                        @RequestParam(value = "buildingId", required = false) String buildingId,
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,
323
+                                        HttpServletRequest request) {
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();
421
+    }
263 422
 }

+ 28
- 2
src/main/java/com/huiju/estateagents/controller/TaCustomImgController.java Ver fichero

@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
16 16
 
17 17
 import javax.servlet.http.HttpServletRequest;
18 18
 import java.time.LocalDateTime;
19
+import java.util.ArrayList;
19 20
 import java.util.List;
20 21
 
21 22
 /**
@@ -82,9 +83,34 @@ public class TaCustomImgController extends BaseController {
82 83
                 return responseBean;
83 84
             }
84 85
 
85
-            taCustomImg.setOrgId(getOrgId(request));
86 86
             taCustomImg.setStatus(CommConstant.STATUS_NORMAL);
87
-            if (iTaCustomImgService.save(taCustomImg)){
87
+            taCustomImg.setOrgId(getOrgId(request));
88
+
89
+            List<TaCustomImg> taCustomImgs = new ArrayList<>();
90
+            taCustomImgs.add(taCustomImg);
91
+            if (CommConstant.IMG_TYPE.equals(taCustomImg.getImgType())){
92
+                TaCustomImg customImg = new TaCustomImg();
93
+                customImg.setCreateTime(LocalDateTime.now());
94
+                customImg.setUpdateTime(LocalDateTime.now());
95
+                customImg.setOrgId(getOrgId(request));
96
+                customImg.setStatus(CommConstant.STATUS_NORMAL);
97
+                customImg.setImgUrl("https://estateagents.oss-cn-shanghai.aliyuncs.com/miniapp/upload/images/1574145199853-97feda7895c65be33aa234a7b81b37f.jpg");
98
+                customImg.setImgType(CommConstant.BANNER_INDEX);
99
+                customImg.setImgDesc("小程序首页分享配图");
100
+                taCustomImgs.add(customImg);
101
+            }
102
+            if (CommConstant.BANNER_INDEX.equals(taCustomImg.getImgType())){
103
+                TaCustomImg customImg = new TaCustomImg();
104
+                customImg.setCreateTime(LocalDateTime.now());
105
+                customImg.setUpdateTime(LocalDateTime.now());
106
+                customImg.setOrgId(getOrgId(request));
107
+                customImg.setStatus(CommConstant.STATUS_NORMAL);
108
+                customImg.setImgUrl("http://njcj.oss-cn-shanghai.aliyuncs.com/icon.png");
109
+                customImg.setImgType(CommConstant.INDEX_NEWS);
110
+                customImg.setImgDesc("首页资讯logo");
111
+                taCustomImgs.add(customImg);
112
+            }
113
+            if (iTaCustomImgService.saveBatch(taCustomImgs)){
88 114
                 responseBean.addSuccess(taCustomImg);
89 115
             }else {
90 116
                 responseBean.addError("fail");

+ 8
- 2
src/main/java/com/huiju/estateagents/controller/TaHousingResourcesController.java Ver fichero

@@ -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);

+ 22
- 7
src/main/java/com/huiju/estateagents/controller/TaLiveActivityController.java Ver fichero

@@ -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;
@@ -51,18 +52,23 @@ public class TaLiveActivityController extends BaseController {
51 52
      * @param buildingId        所属楼盘
52 53
      * @param liveDetailType    详情类型 0是模板,1是自定义
53 54
      * @param status            状态
55
+     * @param source            查询来源,1:直播等活动,2:开屏广告
54 56
      * @param request
55 57
      * @return
56 58
      */
57 59
     @RequestMapping(value = "/admin/taLiveActivity", method = RequestMethod.GET)
58 60
     public ResponseBean taLiveActivityList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
59 61
                                            @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
60
-                                           String liveActivityTitle, String cityId, String buildingId, Integer status,
62
+                                           String liveActivityTitle,
63
+                                           String cityId,
64
+                                           String buildingId,
65
+                                           Integer status,
66
+                                           @RequestParam(value = "source", defaultValue = "1") Integer source,
61 67
                                            HttpServletRequest request) {
62 68
         ResponseBean responseBean = new ResponseBean();
63 69
         try {
64 70
             IPage<TaLiveActivity> result = iTaLiveActivityService.listLiveActivityByCondition(pageNum, pageSize, getOrgId(request),
65
-                    liveActivityTitle, cityId, buildingId, status, getTaPersonBuildingListByUserId(request), getUserId(request));
71
+                    liveActivityTitle, cityId, buildingId, status, getTaPersonBuildingListByUserId(request), getUserId(request), source);
66 72
             responseBean.addSuccess(result);
67 73
 
68 74
         } catch (Exception e) {
@@ -160,8 +166,8 @@ public class TaLiveActivityController extends BaseController {
160 166
                 iExtendContentService.updateBatchById(list);
161 167
             }
162 168
 
163
-            if(!StringUtils.isEmpty(taLiveActivity.getLiveRoomParam())){
164
-                taLiveActivity.setLiveAppPath(taLiveActivity.getLiveRoomParam().replace(".html",""));
169
+            if (!StringUtils.isEmpty(taLiveActivity.getLiveRoomParam())) {
170
+                taLiveActivity.setLiveAppPath(taLiveActivity.getLiveRoomParam().replace(".html", ""));
165 171
             }
166 172
 
167 173
             if (iTaLiveActivityService.updateById(taLiveActivity)) {
@@ -221,7 +227,12 @@ public class TaLiveActivityController extends BaseController {
221 227
      * @return
222 228
      */
223 229
     @RequestMapping(value = "/wx/taLiveActivity/{id}", method = RequestMethod.GET)
224
-    public ResponseBean getLiveActivityDetailById(@PathVariable("id") String id, HttpServletRequest request) {
230
+    @ReportCustomer(type = "live")
231
+    public ResponseBean getLiveActivityDetailById(@PathVariable("id") String id,
232
+                                                  @RequestParam(value = "qrCodeId", required = false) String qrCodeId,
233
+                                                  @RequestParam(value = "channelId", required = false) String channelId,
234
+                                                  @RequestParam(value = "sceneId", required = false) String sceneId,
235
+                                                  HttpServletRequest request) {
225 236
         ResponseBean responseBean = new ResponseBean();
226 237
         try {
227 238
             responseBean = iTaLiveActivityService.getLiveActivityDetailById(id, getOrgId(request));
@@ -248,14 +259,18 @@ public class TaLiveActivityController extends BaseController {
248 259
     @RequestMapping(value = "/wx/taLiveActivity", method = RequestMethod.GET)
249 260
     public ResponseBean taLiveActivityListForMiniApp(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
250 261
                                                      @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
251
-                                                     String liveActivityTitle, String cityId, String buildingId, Integer status,
262
+                                                     String liveActivityTitle,
263
+                                                     String cityId,
264
+                                                     String buildingId,
265
+                                                     Integer status,
266
+                                                     @RequestParam(value = "source", defaultValue = "1") Integer source,
252 267
                                                      HttpServletRequest request) {
253 268
         ResponseBean responseBean = new ResponseBean();
254 269
         try {
255 270
             status = status == null ? 1 : status;
256 271
             Integer orgId = getOrgId(request);
257 272
             IPage<TaLiveActivity> result = iTaLiveActivityService.listLiveActivityByCondition(pageNum, pageSize, orgId,
258
-                    liveActivityTitle, cityId, buildingId, status, null, null);
273
+                    liveActivityTitle, cityId, buildingId, status, null, null, source);
259 274
             responseBean.addSuccess(result);
260 275
 
261 276
         } catch (Exception e) {

+ 7
- 1
src/main/java/com/huiju/estateagents/controller/TaNewsController.java Ver fichero

@@ -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) {

+ 12
- 0
src/main/java/com/huiju/estateagents/controller/TaPersonController.java Ver fichero

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

+ 244
- 0
src/main/java/com/huiju/estateagents/controller/TaQrcodeController.java Ver fichero

@@ -0,0 +1,244 @@
1
+package com.huiju.estateagents.controller;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import com.alibaba.fastjson.JSONObject;
5
+import com.huiju.estateagents.base.BaseController;
6
+import com.huiju.estateagents.base.ResponseBean;
7
+import com.huiju.estateagents.common.CommConstant;
8
+import com.huiju.estateagents.entity.TaPersonBuilding;
9
+import com.huiju.estateagents.entity.TaQrcode;
10
+import com.huiju.estateagents.service.ITaQrcodeService;
11
+import org.apache.commons.lang3.StringUtils;
12
+import org.slf4j.Logger;
13
+import org.slf4j.LoggerFactory;
14
+import org.springframework.beans.factory.annotation.Autowired;
15
+import org.springframework.web.bind.annotation.*;
16
+
17
+import javax.servlet.http.HttpServletRequest;
18
+import javax.servlet.http.HttpServletResponse;
19
+import java.io.IOException;
20
+import java.util.HashMap;
21
+import java.util.List;
22
+import java.util.Map;
23
+
24
+/**
25
+ * <p>
26
+ * 二维码管理表 前端控制器
27
+ * </p>
28
+ *
29
+ * @author fxf
30
+ * @since 2020-05-20
31
+ */
32
+@RestController
33
+@RequestMapping("/api")
34
+public class TaQrcodeController extends BaseController {
35
+
36
+    private final Logger logger = LoggerFactory.getLogger(TaQrcodeController.class);
37
+
38
+    @Autowired
39
+    public ITaQrcodeService iTaQrcodeService;
40
+
41
+    /**
42
+     * 分页查询列表
43
+     *
44
+     * @param pageNum
45
+     * @param pageSize
46
+     * @return
47
+     */
48
+    @RequestMapping(value = "/admin/listQrCode", method = RequestMethod.GET)
49
+    public ResponseBean listQrCodeByCondition(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
50
+                                              @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
51
+                                              String targetType, String targetName, Integer channelId, String buildingId,
52
+                                              HttpServletRequest request) {
53
+        logger.info("接收参数:targetType:{},targetName:{},channelId:{},buildingId:{}",
54
+                targetType, targetName, channelId, buildingId);
55
+        ResponseBean responseBean = new ResponseBean();
56
+        try {
57
+            List<TaPersonBuilding> personBuildingList = getTaPersonBuildingListByUserId(request);
58
+            responseBean = iTaQrcodeService.listQrCodeByCondition(pageNum, pageSize, targetType, targetName, channelId, buildingId, getUserId(request), getOrgId(request), personBuildingList);
59
+        } catch (Exception e) {
60
+            e.printStackTrace();
61
+            logger.error("taQrcodeList -=- {}", e.toString());
62
+            responseBean.addError(e.getMessage());
63
+        }
64
+        return responseBean;
65
+    }
66
+
67
+    /**
68
+     * 保存对象
69
+     *
70
+     * @param taQrcode 实体对象
71
+     * @return
72
+     */
73
+    @RequestMapping(value = "/admin/taQrcode", method = RequestMethod.POST)
74
+    public ResponseBean saveQrcode(@RequestBody TaQrcode taQrcode, HttpServletRequest request) {
75
+        ResponseBean responseBean = new ResponseBean();
76
+        try {
77
+            // 校验参数
78
+            if (StringUtils.isBlank(taQrcode.getTargetId()) || StringUtils.isBlank(taQrcode.getTargetType())) {
79
+                responseBean.addError("参数错误");
80
+                return responseBean;
81
+            }
82
+            responseBean = iTaQrcodeService.saveQrcode(taQrcode, getUserId(request), getOrgId(request));
83
+        } catch (Exception e) {
84
+            e.printStackTrace();
85
+            logger.error("saveQrcode -=- {}", e.toString());
86
+            responseBean.addError(e.getMessage());
87
+        }
88
+        return responseBean;
89
+    }
90
+
91
+    /**
92
+     * 根据id删除对象
93
+     *
94
+     * @param id 实体ID
95
+     */
96
+    @ResponseBody
97
+    @RequestMapping(value = "/taQrcode/{id}", method = RequestMethod.DELETE)
98
+    public ResponseBean taQrcodeDelete(@PathVariable Integer id) {
99
+        ResponseBean responseBean = new ResponseBean();
100
+        try {
101
+            if (iTaQrcodeService.removeById(id)) {
102
+                responseBean.addSuccess("success");
103
+            } else {
104
+                responseBean.addError("fail");
105
+            }
106
+        } catch (Exception e) {
107
+            e.printStackTrace();
108
+            logger.error("taQrcodeDelete -=- {}", e.toString());
109
+            responseBean.addError(e.getMessage());
110
+        }
111
+        return responseBean;
112
+    }
113
+
114
+    /**
115
+     * 批量删除
116
+     */
117
+    @ResponseBody
118
+    @RequestMapping(value = "/admin/qrCode/batchDelete", method = RequestMethod.DELETE)
119
+    public ResponseBean batchDelete(@RequestBody List<TaQrcode> taQrcodeList) {
120
+        ResponseBean responseBean = new ResponseBean();
121
+        try {
122
+
123
+            taQrcodeList.stream().forEach((record) -> {
124
+                record.setStatus(CommConstant.STATUS_DELETE);
125
+            });
126
+
127
+            responseBean.addSuccess(iTaQrcodeService.updateBatchById(taQrcodeList));
128
+
129
+        } catch (Exception e) {
130
+            e.printStackTrace();
131
+            logger.error("taQrcodeDelete -=- {}", e.toString());
132
+            responseBean.addError(e.getMessage());
133
+        }
134
+        return responseBean;
135
+    }
136
+
137
+
138
+    /**
139
+     * 修改对象
140
+     *
141
+     * @param id       实体ID
142
+     * @param taQrcode 实体对象
143
+     * @return
144
+     */
145
+    @RequestMapping(value = "/taQrcode/{id}", method = RequestMethod.PUT)
146
+    public ResponseBean taQrcodeUpdate(@PathVariable Integer id,
147
+                                       @RequestBody TaQrcode taQrcode) {
148
+        ResponseBean responseBean = new ResponseBean();
149
+        try {
150
+            if (iTaQrcodeService.updateById(taQrcode)) {
151
+                responseBean.addSuccess(taQrcode);
152
+            } else {
153
+                responseBean.addError("fail");
154
+            }
155
+        } catch (Exception e) {
156
+            e.printStackTrace();
157
+            logger.error("taQrcodeUpdate -=- {}", e.toString());
158
+            responseBean.addError(e.getMessage());
159
+        }
160
+        return responseBean;
161
+    }
162
+
163
+    /**
164
+     * 根据id查询对象
165
+     *
166
+     * @param id 实体ID
167
+     */
168
+    @RequestMapping(value = "/taQrcode/{id}", method = RequestMethod.GET)
169
+    public ResponseBean taQrcodeGet(@PathVariable Integer id) {
170
+        ResponseBean responseBean = new ResponseBean();
171
+        try {
172
+            responseBean.addSuccess(iTaQrcodeService.getById(id));
173
+        } catch (Exception e) {
174
+            e.printStackTrace();
175
+            logger.error("taQrcodeDelete -=- {}", e.toString());
176
+            responseBean.addError(e.getMessage());
177
+        }
178
+        return responseBean;
179
+    }
180
+
181
+    /**
182
+     * 获取二维码统计信息
183
+     *
184
+     * @param request
185
+     * @return
186
+     */
187
+    @RequestMapping(value = "/admin/qrCode/getStatisticData", method = RequestMethod.GET)
188
+    public ResponseBean getStatisticData(Integer qrCodeId, HttpServletRequest request) {
189
+        logger.info("getStatisticData 接收参数:qrCodeId:{}", qrCodeId);
190
+        ResponseBean responseBean = new ResponseBean();
191
+        try {
192
+            responseBean = iTaQrcodeService.getStatisticData(qrCodeId, getOrgId(request));
193
+            logger.info("getStatisticData 返回结果:{}", JSONObject.toJSONString(responseBean));
194
+        } catch (Exception e) {
195
+            logger.error("getStatisticData 异常:", e);
196
+            responseBean.addError(e.getMessage());
197
+        }
198
+        return responseBean;
199
+    }
200
+
201
+    /**
202
+     * 获取二维码统计信息记录
203
+     *
204
+     * @param pageNum
205
+     * @param pageSize
206
+     * @param qrCodeId
207
+     * @param type     1:访问人数,2:访问次数,3:新增注册用户数
208
+     * @param request
209
+     * @return
210
+     */
211
+    @RequestMapping(value = "/admin/qrCode/getStatisticRecord", method = RequestMethod.GET)
212
+    public ResponseBean getStatisticRecord(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
213
+                                           @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
214
+                                           Integer qrCodeId, Integer type, HttpServletRequest request) {
215
+        ResponseBean responseBean = new ResponseBean();
216
+        try {
217
+            responseBean = iTaQrcodeService.getStatisticRecord(type, pageNum, pageSize, qrCodeId, getOrgId(request));
218
+        } catch (Exception e) {
219
+            logger.error("getStatisticRecord 异常:", e);
220
+            responseBean.addError("fail");
221
+        }
222
+        return responseBean;
223
+    }
224
+
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 {
228
+        try {
229
+            iTaQrcodeService.getStatisticRecordExport(type, qrCodeId, getOrgId(request), response);
230
+        } catch (Exception e) {
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));
239
+        }
240
+    }
241
+
242
+}
243
+
244
+

+ 3
- 6
src/main/java/com/huiju/estateagents/controller/TaRaiseController.java Ver fichero

@@ -7,23 +7,20 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7 7
 import com.huiju.estateagents.base.BaseController;
8 8
 import com.huiju.estateagents.base.ResponseBean;
9 9
 import com.huiju.estateagents.common.CommConstant;
10
-import com.huiju.estateagents.common.StringUtils;
11 10
 import com.huiju.estateagents.entity.TaPersonBuilding;
12 11
 import com.huiju.estateagents.entity.TaRaise;
13
-import com.huiju.estateagents.entity.TaRaiseInvite;
14 12
 import com.huiju.estateagents.entity.TaSalesBatch;
15
-import com.huiju.estateagents.service.*;
13
+import com.huiju.estateagents.service.ITaRaiseService;
14
+import com.huiju.estateagents.service.ITaSalesBatchService;
15
+import com.huiju.estateagents.service.ITdCityService;
16 16
 import com.huiju.estateagents.service.impl.TaRaiseInviteServiceImpl;
17
-import io.swagger.models.auth.In;
18 17
 import org.slf4j.Logger;
19 18
 import org.slf4j.LoggerFactory;
20 19
 import org.springframework.beans.factory.annotation.Autowired;
21 20
 import org.springframework.web.bind.annotation.*;
22 21
 
23 22
 import javax.servlet.http.HttpServletRequest;
24
-import java.lang.reflect.Array;
25 23
 import java.time.LocalDateTime;
26
-import java.util.ArrayList;
27 24
 import java.util.List;
28 25
 
29 26
 /**

+ 19
- 11
src/main/java/com/huiju/estateagents/controller/TaRecommendCustomerController.java Ver fichero

@@ -848,6 +848,8 @@ public class TaRecommendCustomerController extends BaseController {
848 848
                                       @RequestParam(value = "customerType") String customerType,
849 849
                                       @RequestParam(value = "status", required = false) Integer status,
850 850
                                       @RequestParam(value = "sceneType", required = false) String sceneType,
851
+                                      @RequestParam(value = "startCreateDate", required = false) String startCreateDate,
852
+                                      @RequestParam(value = "endCreateDate", required = false) String endCreateDate,
851 853
                                       @RequestParam(value = "belongStatus", required = false) Integer belongStatus) throws IOException { // public 公  private 私
852 854
 
853 855
         //        response.setContentType("application/vnd.ms-excel");
@@ -876,7 +878,9 @@ public class TaRecommendCustomerController extends BaseController {
876 878
 //            pageCount = count % pageSize == 0 ? count / pageSize : (count / pageSize) + 1;
877 879
 //            List<PublicCustomerExport> publicList = null;
878 880
 //            do {
879
-            List<PublicCustomerExport> publicList = taRecommendCustomerMapper.getPublicCustomerExportList(pageCode * pageSize, pageSize, buildingId, name, tel, entryType, verifyStatus, sex, orgId, consultTel, sceneType, getTaPersonBuildingListByUserId(request), belongStatus);
881
+            List<PublicCustomerExport> publicList = taRecommendCustomerMapper.getPublicCustomerExportList(pageCode * pageSize, pageSize,
882
+                    buildingId, name, tel, entryType, verifyStatus, sex, orgId, consultTel, sceneType, getTaPersonBuildingListByUserId(request),
883
+                    belongStatus, startCreateDate, endCreateDate);
880 884
             excelWriter.write(publicList, writeSheet);
881 885
 
882 886
 //                pageCode ++;
@@ -898,7 +902,9 @@ public class TaRecommendCustomerController extends BaseController {
898 902
 //            pageCount = count % pageSize == 0 ? count / pageSize : (count / pageSize) + 1;
899 903
 //            List<PrivateCustomerExport> privateList = null;
900 904
 //            do {
901
-            List<PrivateCustomerExport> privateList = taRecommendCustomerMapper.getCustomerExportList(pageCode * pageSize, pageSize, buildingId, name, tel, consultName, consultTel, entryType, verifyStatus, sex, orgId, status, sceneType, getTaPersonBuildingListByUserId(request));
905
+            List<PrivateCustomerExport> privateList = taRecommendCustomerMapper.getCustomerExportList(pageCode * pageSize, pageSize,
906
+                    buildingId, name, tel, consultName, consultTel, entryType, verifyStatus, sex, orgId, status, sceneType, startCreateDate,
907
+                    endCreateDate, getTaPersonBuildingListByUserId(request));
902 908
             excelWriter.write(privateList, writeSheet);
903 909
 
904 910
 //                pageCode ++;
@@ -978,35 +984,37 @@ public class TaRecommendCustomerController extends BaseController {
978 984
 
979 985
     /**
980 986
      * 校验此职业顾问下有没有私客存在
987
+     *
981 988
      * @return
982 989
      */
983 990
     @GetMapping("/admin/consultant/customer/list")
984 991
     public ResponseBean consultantCustomerList(@RequestParam(value = "userId") Integer userId,
985 992
                                                @RequestParam(value = "personId") String personId,
986 993
                                                @RequestParam(value = "buildingId") String buildingId,
987
-                                               HttpServletRequest request){
994
+                                               HttpServletRequest request) {
988 995
         Integer orgId = getOrgId(request);
989
-        try{
990
-            List<TaRecommendCustomer> list = taRecommendCustomerService.getConsultantCustomerList(userId,personId,buildingId,orgId,getTaPersonBuildingListByUserId(request));
996
+        try {
997
+            List<TaRecommendCustomer> list = taRecommendCustomerService.getConsultantCustomerList(userId, personId, buildingId, orgId, getTaPersonBuildingListByUserId(request));
991 998
             return ResponseBean.success(list);
992
-        }catch (Exception e){
999
+        } catch (Exception e) {
993 1000
             e.printStackTrace();
994
-            return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
1001
+            return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
995 1002
         }
996 1003
     }
997 1004
 
998 1005
     /**
999 1006
      * 迁移私客到新的置业顾问
1007
+     *
1000 1008
      * @return
1001 1009
      */
1002 1010
     @PutMapping("/admin/consultant/customer/move")
1003
-    public ResponseBean moveConsultantCustomer(@RequestBody List<TaRecommendCustomer> list,HttpServletRequest request){
1004
-        try{
1011
+    public ResponseBean moveConsultantCustomer(@RequestBody List<TaRecommendCustomer> list, HttpServletRequest request) {
1012
+        try {
1005 1013
             taRecommendCustomerService.updateBatchById(list);
1006 1014
             return ResponseBean.success(list);
1007
-        }catch (Exception e){
1015
+        } catch (Exception e) {
1008 1016
             e.printStackTrace();
1009
-            return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
1017
+            return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
1010 1018
         }
1011 1019
     }
1012 1020
 }

+ 7
- 1
src/main/java/com/huiju/estateagents/controller/TaShareActivityController.java Ver fichero

@@ -7,6 +7,7 @@ import com.huiju.estateagents.base.BaseController;
7 7
 import com.huiju.estateagents.base.ResponseBean;
8 8
 import com.huiju.estateagents.common.CommConstant;
9 9
 import com.huiju.estateagents.entity.*;
10
+import com.huiju.estateagents.reportCustomerAop.ReportCustomer;
10 11
 import com.huiju.estateagents.service.*;
11 12
 import com.huiju.estateagents.service.ITaPersonService;
12 13
 import com.huiju.estateagents.service.ITaShareActivityService;
@@ -360,8 +361,13 @@ public class TaShareActivityController extends BaseController {
360 361
      * @param groupActivityId  实体ID
361 362
      */
362 363
     @RequestMapping(value="/wx/taShareActivity/{groupActivityId}",method= RequestMethod.GET)
364
+    @ReportCustomer(type = "group")
363 365
     public ResponseBean wxShareActivityGet(@PathVariable Integer groupActivityId,
364
-                                           @RequestParam(value = "recordId",required = false) Integer recordId, HttpServletRequest request){
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 ){
365 371
         ResponseBean responseBean = new ResponseBean();
366 372
         String openid = getOpenId(request);
367 373
         Integer orgId = getOrgId(request);

+ 114
- 88
src/main/java/com/huiju/estateagents/drainage/controller/TaDrainageController.java Ver fichero

@@ -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;
@@ -33,8 +34,8 @@ import java.util.stream.Collectors;
33 34
 
34 35
 /**
35 36
  * <p>
36
-    * 引流项目  前端控制器
37
-    * </p>
37
+ * 引流项目  前端控制器
38
+ * </p>
38 39
  *
39 40
  * @author jobob
40 41
  * @since 2019-10-18
@@ -47,7 +48,7 @@ public class TaDrainageController extends BaseController {
47 48
 
48 49
     @Autowired
49 50
     public ITaDrainageService iTaDrainageService;
50
-    
51
+
51 52
     @Autowired
52 53
     public ITaThirdPartyMiniappConfigService iTaThirdPartyMiniappConfigService;
53 54
 
@@ -65,55 +66,68 @@ public class TaDrainageController extends BaseController {
65 66
 
66 67
     /**
67 68
      * 分页查询列表
69
+     *
68 70
      * @param pageNum
69 71
      * @param pageSize
72
+     * @param drainageId
73
+     * @param name
74
+     * @param isMiniapp
75
+     * @param status
76
+     * @param buildingId
77
+     * @param source     查询来源,1:H5等活动,2:开屏广告
78
+     * @param request
70 79
      * @return
71 80
      */
72
-    @RequestMapping(value="/admin/taDrainage",method= RequestMethod.GET)
73
-    public ResponseBean taDrainageList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
74
-                                       @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
75
-                                       @RequestParam(value ="drainageId",required = false) Integer drainageId,
76
-                                       @RequestParam(value ="name",required = false) String name,
77
-                                       @RequestParam(value ="isMiniapp",required = false) Integer isMiniapp,
78
-                                       @RequestParam(value ="status",required = false) Integer status,
79
-                                       @RequestParam(value ="buildingId",required = false) String buildingId,
80
-                                       HttpServletRequest request){
81
+    @RequestMapping(value = "/admin/taDrainage", method = RequestMethod.GET)
82
+    public ResponseBean taDrainageList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
83
+                                       @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
84
+                                       @RequestParam(value = "drainageId", required = false) Integer drainageId,
85
+                                       @RequestParam(value = "name", required = false) String name,
86
+                                       @RequestParam(value = "isMiniapp", required = false) Integer isMiniapp,
87
+                                       @RequestParam(value = "status", required = false) Integer status,
88
+                                       @RequestParam(value = "buildingId", required = false) String buildingId,
89
+                                       @RequestParam(value = "source", defaultValue = "1") Integer source,
90
+                                       HttpServletRequest request) {
81 91
         ResponseBean responseBean = new ResponseBean();
82 92
         try {
83 93
             List<TaPersonBuilding> taPersonBuildingList = getTaPersonBuildingListByUserId(request);
84 94
             //使用分页插件
85
-		    IPage<TaDrainage> pg = new Page<>(pageNum, pageSize);
95
+            IPage<TaDrainage> pg = new Page<>(pageNum, pageSize);
86 96
             QueryWrapper<TaDrainage> queryWrapper = new QueryWrapper<>();
87
-            queryWrapper.eq("org_id",getOrgId(request));
88
-            queryWrapper.eq(null != isMiniapp,"is_miniapp",isMiniapp);
89
-            if (null == status){
90
-                queryWrapper.gt("status",-1);
97
+            queryWrapper.eq("org_id", getOrgId(request));
98
+            queryWrapper.eq(null != isMiniapp, "is_miniapp", isMiniapp);
99
+            if (null == status) {
100
+                queryWrapper.gt("status", -1);
101
+            }
102
+            queryWrapper.eq(null != status, "status", status);
103
+            if(2 == source){
104
+                queryWrapper.isNull(StringUtils.isEmpty(buildingId), "building_id");
105
+            }else{
106
+                queryWrapper.eq(!StringUtils.isEmpty(buildingId), "building_id", buildingId);
91 107
             }
92
-            queryWrapper.eq(null != status,"status",status);
93
-            queryWrapper.eq(!StringUtils.isEmpty(buildingId),"building_id",buildingId);
94
-            queryWrapper.eq(null != drainageId,"drainage_id",drainageId);
95
-            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
-            queryWrapper.like(!StringUtils.isEmpty(name),"name",name);
108
+            queryWrapper.eq(null != drainageId, "drainage_id", drainageId);
109
+            queryWrapper.and(taPersonBuildingList.size() > 0, wapper -> wapper.in("building_id", taPersonBuildingList.stream().map(TaPersonBuilding::getBuildingId).collect(Collectors.toList())).or().eq("create_user", getUserId(request)));
110
+            queryWrapper.like(!StringUtils.isEmpty(name), "name", name);
97 111
             queryWrapper.orderByDesc("create_date");
98 112
 
99 113
             IPage<TaDrainage> result = iTaDrainageService.page(pg, queryWrapper);
100 114
             List<TaDrainage> records = result.getRecords();
101 115
             records.forEach(e -> {
102 116
                 QueryWrapper<TaThirdPartyMiniappConfig> taThirdPartyMiniappConfigQueryWrapper = new QueryWrapper<>();
103
-                taThirdPartyMiniappConfigQueryWrapper.eq("target_type",CommConstant.TARGET_TYPE_H5);
104
-                taThirdPartyMiniappConfigQueryWrapper.eq("target_id",e.getDrainageId());
105
-                taThirdPartyMiniappConfigQueryWrapper.eq("org_id",getOrgId(request));
117
+                taThirdPartyMiniappConfigQueryWrapper.eq("target_type", CommConstant.TARGET_TYPE_H5);
118
+                taThirdPartyMiniappConfigQueryWrapper.eq("target_id", e.getDrainageId());
119
+                taThirdPartyMiniappConfigQueryWrapper.eq("org_id", getOrgId(request));
106 120
                 TaThirdPartyMiniappConfig taThirdPartyMiniappConfig = iTaThirdPartyMiniappConfigService.getOne(taThirdPartyMiniappConfigQueryWrapper);
107
-                if (null != taThirdPartyMiniappConfig){
121
+                if (null != taThirdPartyMiniappConfig) {
108 122
                     e.setAppid(taThirdPartyMiniappConfig.getAppid());
109 123
                     e.setAppSecret(taThirdPartyMiniappConfig.getAppSecret());
110 124
                 }
111 125
             });
112 126
             result.setRecords(records);
113 127
             responseBean.addSuccess(result);
114
-        }catch (Exception e){
128
+        } catch (Exception e) {
115 129
             e.printStackTrace();
116
-            logger.error("taDrainageList -=- {}",e.toString());
130
+            logger.error("taDrainageList -=- {}", e.toString());
117 131
             responseBean.addError(e.getMessage());
118 132
         }
119 133
         return responseBean;
@@ -121,27 +135,28 @@ public class TaDrainageController extends BaseController {
121 135
 
122 136
     /**
123 137
      * 保存对象
138
+     *
124 139
      * @param taDrainage 实体对象
125 140
      * @return
126 141
      */
127
-    @RequestMapping(value="/admin/taDrainage/add",method= RequestMethod.POST)
128
-    public ResponseBean taDrainageAdd(@RequestBody TaDrainage taDrainage,HttpServletRequest request){
142
+    @RequestMapping(value = "/admin/taDrainage/add", method = RequestMethod.POST)
143
+    public ResponseBean taDrainageAdd(@RequestBody TaDrainage taDrainage, HttpServletRequest request) {
129 144
         ResponseBean responseBean = new ResponseBean();
130 145
         try {
131 146
             taDrainage.setOrgId(getOrgId(request));
132 147
             taDrainage.setCreateDate(LocalDateTime.now());
133 148
             taDrainage.setStatus(CommConstant.STATUS_UNACCALIMED);
134
-            if (DateUtils.dayToLocalDateime(taDrainage.getEndDate()).isAfter(LocalDateTime.now())){
149
+            if (DateUtils.dayToLocalDateime(taDrainage.getEndDate()).isAfter(LocalDateTime.now())) {
135 150
                 taDrainage.setStatus(CommConstant.STATUS_NORMAL);
136 151
             }
137 152
             taDrainage.setCreateUser(getUserId(request));
138
-            if (iTaDrainageService.save(taDrainage)){
153
+            if (iTaDrainageService.save(taDrainage)) {
139 154
                 // 根据ORGID查询当前小程序表的miniapp_id
140
-                QueryWrapper<TaMiniapp> taMiniappQuery= new QueryWrapper<>();
141
-                taMiniappQuery.eq("org_id",getOrgId(request));
155
+                QueryWrapper<TaMiniapp> taMiniappQuery = new QueryWrapper<>();
156
+                taMiniappQuery.eq("org_id", getOrgId(request));
142 157
                 TaMiniapp taMiniapp = taMiniappMapper.selectOne(taMiniappQuery);
143 158
                 // 生成二维码
144
-                ResponseBean taMiniappQrcode = miniAppService.getQrCode(CommConstant.DRAINAGE_QRCODE.replace("#0",taDrainage.getDrainageId().toString()).replace("#1","h5"),taMiniapp.getMiniappId());
159
+                ResponseBean taMiniappQrcode = miniAppService.getQrCode(CommConstant.DRAINAGE_QRCODE.replace("#0", taDrainage.getDrainageId().toString()).replace("#1", "h5"), taMiniapp.getMiniappId());
145 160
                 taDrainage.setQrCode(String.valueOf(taMiniappQrcode.getData()));
146 161
                 iTaDrainageService.updateById(taDrainage);
147 162
 
@@ -155,33 +170,35 @@ public class TaDrainageController extends BaseController {
155 170
                 taThirdPartyMiniappConfig.setTargetId(taDrainage.getDrainageId().toString());
156 171
                 iTaThirdPartyMiniappConfigService.save(taThirdPartyMiniappConfig);
157 172
                 responseBean.addSuccess(taDrainage);
158
-            }else {
173
+            } else {
159 174
                 responseBean.addError("fail");
160 175
             }
161
-        }catch (Exception e){
176
+        } catch (Exception e) {
162 177
             e.printStackTrace();
163
-            logger.error("taDrainageAdd -=- {}",e.toString());
178
+            logger.error("taDrainageAdd -=- {}", e.toString());
164 179
             responseBean.addError(e.getMessage());
165 180
         }
166 181
         return responseBean;
167 182
     }
168
-    
183
+
169 184
     /**
170 185
      * 获取uuid
186
+     *
171 187
      * @return
172 188
      */
173 189
     private String getUUIDS() {
174
-        String uuid= UUID.randomUUID().toString().replace("-", "");
190
+        String uuid = UUID.randomUUID().toString().replace("-", "");
175 191
         return uuid;
176 192
     }
177
-    
193
+
178 194
     /**
179 195
      * 根据id删除对象
180
-     * @param id  实体ID
196
+     *
197
+     * @param id 实体ID
181 198
      */
182 199
     @ResponseBody
183
-    @RequestMapping(value="/admin/taDrainage/{id}", method= RequestMethod.DELETE)
184
-    public ResponseBean taDrainageDelete(@PathVariable Integer id, HttpServletRequest request){
200
+    @RequestMapping(value = "/admin/taDrainage/{id}", method = RequestMethod.DELETE)
201
+    public ResponseBean taDrainageDelete(@PathVariable Integer id, HttpServletRequest request) {
185 202
         ResponseBean responseBean = new ResponseBean();
186 203
         try {
187 204
 
@@ -193,24 +210,24 @@ public class TaDrainageController extends BaseController {
193 210
             }
194 211
 
195 212
             QueryWrapper<ExtendContent> queryWrapper = new QueryWrapper<>();
196
-            queryWrapper.eq("org_id",drainage.getOrgId());
197
-            queryWrapper.eq("content_type",CommConstant.EVENT_H5);
198
-            queryWrapper.eq("target_id",drainage.getDrainageId());
213
+            queryWrapper.eq("org_id", drainage.getOrgId());
214
+            queryWrapper.eq("content_type", CommConstant.EVENT_H5);
215
+            queryWrapper.eq("target_id", drainage.getDrainageId());
199 216
             List<ExtendContent> list = iExtendContentService.list(queryWrapper);
200
-            if (null != drainage.getStatus() && drainage.getStatus().equals(CommConstant.STATUS_NORMAL) && list.size() > 0){
217
+            if (null != drainage.getStatus() && drainage.getStatus().equals(CommConstant.STATUS_NORMAL) && list.size() > 0) {
201 218
                 responseBean.addError("删除项目会删除全部数据,不建议删除数据。可以点击下架按钮终止活动。");
202 219
                 return responseBean;
203 220
             }
204 221
 
205 222
             drainage.setStatus(-1);
206
-            if(iTaDrainageService.updateById(drainage)){
223
+            if (iTaDrainageService.updateById(drainage)) {
207 224
                 responseBean.addSuccess("success");
208
-            }else {
225
+            } else {
209 226
                 responseBean.addError("fail");
210 227
             }
211
-        }catch (Exception e){
228
+        } catch (Exception e) {
212 229
             e.printStackTrace();
213
-            logger.error("taDrainageDelete -=- {}",e.toString());
230
+            logger.error("taDrainageDelete -=- {}", e.toString());
214 231
             responseBean.addError(e.getMessage());
215 232
         }
216 233
         return responseBean;
@@ -218,30 +235,31 @@ public class TaDrainageController extends BaseController {
218 235
 
219 236
     /**
220 237
      * 修改对象
221
-     * @param id  实体ID
238
+     *
239
+     * @param id         实体ID
222 240
      * @param taDrainage 实体对象
223 241
      * @return
224 242
      */
225
-    @RequestMapping(value="/admin/taDrainage/{id}",method= RequestMethod.PUT)
243
+    @RequestMapping(value = "/admin/taDrainage/{id}", method = RequestMethod.PUT)
226 244
     public ResponseBean taDrainageUpdate(@PathVariable Integer id,
227
-                                        @RequestBody TaDrainage taDrainage){
245
+                                         @RequestBody TaDrainage taDrainage) {
228 246
         ResponseBean responseBean = new ResponseBean();
229 247
         try {
230 248
             taDrainage.setDrainageId(id);
231
-            if (!taDrainage.getIsMiniapp()){
249
+            if (!taDrainage.getIsMiniapp()) {
232 250
                 taDrainage.setShareImg("");
233 251
                 taDrainage.setH5Address("");
234 252
                 taDrainage.setShareTitle("");
235 253
                 taDrainage.setMiddleImg("");
236 254
             }
237
-            if (iTaDrainageService.updateById(taDrainage)){
255
+            if (iTaDrainageService.updateById(taDrainage)) {
238 256
                 responseBean.addSuccess(taDrainage);
239
-            }else {
257
+            } else {
240 258
                 responseBean.addError("fail");
241 259
             }
242
-        }catch (Exception e){
260
+        } catch (Exception e) {
243 261
             e.printStackTrace();
244
-            logger.error("taDrainageUpdate -=- {}",e.toString());
262
+            logger.error("taDrainageUpdate -=- {}", e.toString());
245 263
             responseBean.addError(e.getMessage());
246 264
         }
247 265
         return responseBean;
@@ -249,26 +267,27 @@ public class TaDrainageController extends BaseController {
249 267
 
250 268
     /**
251 269
      * 根据id查询对象
252
-     * @param id  实体ID
270
+     *
271
+     * @param id 实体ID
253 272
      */
254
-    @RequestMapping(value="/admin/taDrainage/{id}",method= RequestMethod.GET)
255
-    public ResponseBean taDrainageGet(@PathVariable Integer id,HttpServletRequest request){
273
+    @RequestMapping(value = "/admin/taDrainage/{id}", method = RequestMethod.GET)
274
+    public ResponseBean taDrainageGet(@PathVariable Integer id, HttpServletRequest request) {
256 275
         ResponseBean responseBean = new ResponseBean();
257 276
         try {
258 277
             TaDrainage taDrainage = iTaDrainageService.getById(id);
259 278
             QueryWrapper<TaThirdPartyMiniappConfig> queryWrapper = new QueryWrapper<>();
260
-            queryWrapper.eq("target_type",CommConstant.TARGET_TYPE_H5);
261
-            queryWrapper.eq("target_id",taDrainage.getDrainageId());
262
-            queryWrapper.eq("org_id",getOrgId(request));
279
+            queryWrapper.eq("target_type", CommConstant.TARGET_TYPE_H5);
280
+            queryWrapper.eq("target_id", taDrainage.getDrainageId());
281
+            queryWrapper.eq("org_id", getOrgId(request));
263 282
             TaThirdPartyMiniappConfig taThirdPartyMiniappConfig = iTaThirdPartyMiniappConfigService.getOne(queryWrapper);
264
-            if (null != taThirdPartyMiniappConfig){
283
+            if (null != taThirdPartyMiniappConfig) {
265 284
                 taDrainage.setAppid(taThirdPartyMiniappConfig.getAppid());
266 285
                 taDrainage.setAppSecret(taThirdPartyMiniappConfig.getAppSecret());
267 286
             }
268 287
             responseBean.addSuccess(taDrainage);
269
-        }catch (Exception e){
288
+        } catch (Exception e) {
270 289
             e.printStackTrace();
271
-            logger.error("taDrainageDelete -=- {}",e.toString());
290
+            logger.error("taDrainageDelete -=- {}", e.toString());
272 291
             responseBean.addError(e.getMessage());
273 292
         }
274 293
         return responseBean;
@@ -276,32 +295,33 @@ public class TaDrainageController extends BaseController {
276 295
 
277 296
     /**
278 297
      * 更改上架下架状态
279
-     * @param id  实体ID
298
+     *
299
+     * @param id         实体ID
280 300
      * @param taDrainage 实体对象
281 301
      * @return
282 302
      */
283
-    @RequestMapping(value="/admin/taDrainage/exchange/{id}",method= RequestMethod.PUT)
303
+    @RequestMapping(value = "/admin/taDrainage/exchange/{id}", method = RequestMethod.PUT)
284 304
     public ResponseBean exchangeDrainage(@PathVariable Integer id,
285
-                                         @RequestBody TaDrainage taDrainage){
305
+                                         @RequestBody TaDrainage taDrainage) {
286 306
         ResponseBean responseBean = new ResponseBean();
287 307
         try {
288 308
             taDrainage.setDrainageId(id);
289 309
             QueryWrapper<ExtendContent> queryWrapper = new QueryWrapper<>();
290
-            queryWrapper.eq("org_id",taDrainage.getOrgId());
291
-            queryWrapper.eq("content_type",CommConstant.EVENT_H5);
292
-            queryWrapper.eq("target_id",taDrainage.getDrainageId());
310
+            queryWrapper.eq("org_id", taDrainage.getOrgId());
311
+            queryWrapper.eq("content_type", CommConstant.EVENT_H5);
312
+            queryWrapper.eq("target_id", taDrainage.getDrainageId());
293 313
 
294 314
             queryWrapper.gt("status", CommConstant.STATUS_DELETE); // fix bug #6816
295 315
 
296 316
             List<ExtendContent> list = iExtendContentService.list(queryWrapper);
297
-            if (null != taDrainage.getStatus() && taDrainage.getStatus().equals(CommConstant.STATUS_NORMAL)){
317
+            if (null != taDrainage.getStatus() && taDrainage.getStatus().equals(CommConstant.STATUS_NORMAL)) {
298 318
                 taDrainage.setStatus(CommConstant.STATUS_UNACCALIMED);
299 319
                 //如果H5有被轮播图或开屏广告选中则轮播图和开屏广告都要下架
300 320
                 list.forEach(e -> {
301 321
                     e.setStatus(CommConstant.STATUS_UNACCALIMED);
302 322
                 });
303
-            }else{
304
-                if (DateUtils.dayToLocalDateime(taDrainage.getEndDate()).isBefore(LocalDateTime.now())){
323
+            } else {
324
+                if (DateUtils.dayToLocalDateime(taDrainage.getEndDate()).isBefore(LocalDateTime.now())) {
305 325
                     responseBean.addError("已过下架时间,无法上架");
306 326
                     return responseBean;
307 327
                 }
@@ -311,17 +331,17 @@ public class TaDrainageController extends BaseController {
311 331
                     e.setStatus(CommConstant.STATUS_NORMAL);
312 332
                 });
313 333
             }
314
-            if (list.size() > 0){
334
+            if (list.size() > 0) {
315 335
                 iExtendContentService.updateBatchById(list);
316 336
             }
317
-            if (iTaDrainageService.updateById(taDrainage)){
337
+            if (iTaDrainageService.updateById(taDrainage)) {
318 338
                 responseBean.addSuccess(taDrainage);
319
-            }else {
339
+            } else {
320 340
                 responseBean.addError("fail");
321 341
             }
322
-        }catch (Exception e){
342
+        } catch (Exception e) {
323 343
             e.printStackTrace();
324
-            logger.error("taDrainageUpdate -=- {}",e.toString());
344
+            logger.error("taDrainageUpdate -=- {}", e.toString());
325 345
             responseBean.addError(e.getMessage());
326 346
         }
327 347
         return responseBean;
@@ -329,16 +349,22 @@ public class TaDrainageController extends BaseController {
329 349
 
330 350
     /**
331 351
      * 微信端获取数据
332
-     * @param id  实体ID
352
+     *
353
+     * @param id 实体ID
333 354
      */
334
-    @RequestMapping(value="/wx/taDrainage/{id}",method= RequestMethod.GET)
335
-    public ResponseBean wxDrainageGet(@PathVariable Integer id){
355
+    @RequestMapping(value = "/wx/taDrainage/{id}", method = RequestMethod.GET)
356
+    @ReportCustomer(type = "h5")
357
+    public ResponseBean wxDrainageGet(@PathVariable Integer id,
358
+                                      @RequestParam(value = "qrCodeId", required = false) String qrCodeId,
359
+                                      @RequestParam(value = "channelId", required = false) String channelId,
360
+                                      @RequestParam(value = "sceneId", required = false) String sceneId,
361
+                                      HttpServletRequest request) {
336 362
         ResponseBean responseBean = new ResponseBean();
337 363
         try {
338 364
             responseBean.addSuccess(iTaDrainageService.getById(id));
339
-        }catch (Exception e){
365
+        } catch (Exception e) {
340 366
             e.printStackTrace();
341
-            logger.error("taDrainageDelete -=- {}",e.toString());
367
+            logger.error("taDrainageDelete -=- {}", e.toString());
342 368
             responseBean.addError(e.getMessage());
343 369
         }
344 370
         return responseBean;

+ 2
- 0
src/main/java/com/huiju/estateagents/entity/ExtendContent.java Ver fichero

@@ -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
      */

+ 3
- 0
src/main/java/com/huiju/estateagents/entity/TaBuilding.java Ver fichero

@@ -351,4 +351,7 @@ public class TaBuilding implements Serializable {
351 351
 
352 352
     @TableField(exist = false)
353 353
     private List<TaSalesBatch> salesBatch;
354
+
355
+    @TableField(exist = false)
356
+    private List<ExtendContent> extendContent;
354 357
 }

+ 8
- 4
src/main/java/com/huiju/estateagents/entity/TaChannel.java Ver fichero

@@ -1,15 +1,16 @@
1 1
 package com.huiju.estateagents.entity;
2 2
 
3
-import com.baomidou.mybatisplus.annotation.TableField;
4
-import com.baomidou.mybatisplus.annotation.TableName;
5 3
 import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableField;
6 5
 import com.baomidou.mybatisplus.annotation.TableId;
7
-import java.time.LocalDateTime;
8
-import java.io.Serializable;
6
+import com.baomidou.mybatisplus.annotation.TableName;
9 7
 import lombok.Data;
10 8
 import lombok.EqualsAndHashCode;
11 9
 import lombok.experimental.Accessors;
12 10
 
11
+import java.io.Serializable;
12
+import java.time.LocalDateTime;
13
+
13 14
 /**
14 15
  * <p>
15 16
  *  
@@ -70,6 +71,9 @@ public class TaChannel implements Serializable {
70 71
     @TableField(exist = false)
71 72
     private Integer inviteCount;
72 73
 
74
+    @TableField(exist = false)
75
+    private Integer customerNum;
76
+
73 77
     /**
74 78
      * 创建时间
75 79
      */

+ 39
- 1
src/main/java/com/huiju/estateagents/entity/TaCustomerFrom.java Ver fichero

@@ -1,6 +1,7 @@
1 1
 package com.huiju.estateagents.entity;
2 2
 
3 3
 import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableField;
4 5
 import com.baomidou.mybatisplus.annotation.TableId;
5 6
 import java.time.LocalDateTime;
6 7
 import java.io.Serializable;
@@ -18,7 +19,6 @@ import lombok.experimental.Accessors;
18 19
  */
19 20
 @Data
20 21
 @EqualsAndHashCode(callSuper = false)
21
-@Accessors(chain = true)
22 22
 public class TaCustomerFrom implements Serializable {
23 23
 
24 24
     private static final long serialVersionUID = 1L;
@@ -109,5 +109,43 @@ public class TaCustomerFrom implements Serializable {
109 109
      */
110 110
     private String remark;
111 111
 
112
+    /**
113
+     * 用户名
114
+     */
115
+    @TableField(exist = false)
116
+    private String userName;
117
+
118
+    /**
119
+     * 用户手机号码
120
+     */
121
+    @TableField(exist = false)
122
+    private String userTel;
123
+
124
+    /**
125
+     * 用户性别
126
+     */
127
+    @TableField(exist = false)
128
+    private Integer sex;
129
+
130
+    /**
131
+     * 归属城市
132
+     */
133
+    @TableField(exist = false)
134
+    private String city;
135
+
136
+    /**
137
+     * 用户注册时间
138
+     */
139
+    @TableField(exist = false)
140
+    private LocalDateTime registerTime;
112 141
 
142
+    /**
143
+     * 渠道 ID
144
+     */
145
+    private Integer channelId;
146
+
147
+    /**
148
+     * 推广码ID
149
+     */
150
+    private Integer qrCodeId;
113 151
 }

+ 2
- 0
src/main/java/com/huiju/estateagents/entity/TaMiniappQrcode.java Ver fichero

@@ -55,4 +55,6 @@ public class TaMiniappQrcode implements Serializable {
55 55
      */
56 56
     private String qrCode;
57 57
 
58
+    private Integer targetId;
59
+
58 60
 }

+ 10
- 0
src/main/java/com/huiju/estateagents/entity/TaPerson.java Ver fichero

@@ -330,4 +330,14 @@ public class TaPerson implements Serializable {
330 330
      */
331 331
     @TableField(exist = false)
332 332
     private String targetName;
333
+
334
+    /**
335
+     * 渠道 ID
336
+     */
337
+    private Integer channelId;
338
+
339
+    /**
340
+     * 推广码ID
341
+     */
342
+    private Integer qrCodeId;
333 343
 }

+ 16
- 0
src/main/java/com/huiju/estateagents/entity/TaPersonVisitRecord.java Ver fichero

@@ -202,4 +202,20 @@ public class TaPersonVisitRecord implements Serializable {
202 202
      */
203 203
     @TableField(exist = false)
204 204
     private String customerId;
205
+
206
+    /**
207
+     * 客户性别
208
+     */
209
+    @TableField(exist = false)
210
+    private Integer sex;
211
+
212
+    /**
213
+     * 客户归属地
214
+     */
215
+    @TableField(exist = false)
216
+    private String city;
217
+
218
+    private Integer qrCodeId;
219
+
220
+    private Integer channelId;
205 221
 }

+ 99
- 0
src/main/java/com/huiju/estateagents/entity/TaQrcode.java Ver fichero

@@ -0,0 +1,99 @@
1
+package com.huiju.estateagents.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableField;
5
+import com.baomidou.mybatisplus.annotation.TableId;
6
+import lombok.Data;
7
+import lombok.EqualsAndHashCode;
8
+import lombok.experimental.Accessors;
9
+
10
+import java.io.Serializable;
11
+import java.time.LocalDateTime;
12
+import java.util.List;
13
+
14
+/**
15
+ * <p>
16
+ * 二维码管理表
17
+ * </p>
18
+ *
19
+ * @author fxf
20
+ * @since 2020-05-20
21
+ */
22
+@Data
23
+@EqualsAndHashCode(callSuper = false)
24
+@Accessors(chain = true)
25
+public class TaQrcode implements Serializable {
26
+
27
+    private static final long serialVersionUID = 1L;
28
+
29
+    /**
30
+     * qr_code_id id
31
+     */
32
+    @TableId(value = "qr_code_id", type = IdType.AUTO)
33
+    private Integer qrCodeId;
34
+
35
+    /**
36
+     * org_id
37
+     */
38
+    private Integer orgId;
39
+
40
+    /**
41
+     * building_id 关联项目ID
42
+     */
43
+    private String buildingId;
44
+
45
+    /**
46
+     * channel_id 渠道ID
47
+     */
48
+    private Integer channelId;
49
+
50
+    /**
51
+     * target_type 二维码类型
52
+     */
53
+    private String targetType;
54
+
55
+    /**
56
+     * target_name 二维码内容
57
+     */
58
+    private String targetName;
59
+
60
+    /**
61
+     * target_id
62
+     */
63
+    private String targetId;
64
+
65
+    /**
66
+     * qr_code_url 二维码地址
67
+     */
68
+    private String qrCodeUrl;
69
+
70
+    /**
71
+     * status 状态
72
+     */
73
+    private Integer status;
74
+
75
+    /**
76
+     * create_date 创建时间
77
+     */
78
+    private LocalDateTime createDate;
79
+
80
+    /**
81
+     * create_user 创建人
82
+     */
83
+    private Integer createUser;
84
+
85
+    @TableField(exist = false)
86
+    private List<TaQrcode> qrcodeList;
87
+
88
+    /**
89
+     * 楼盘名称
90
+     */
91
+    @TableField(exist = false)
92
+    private String buildingName;
93
+
94
+    /**
95
+     * 渠道名称
96
+     */
97
+    @TableField(exist = false)
98
+    private String channelName;
99
+}

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

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

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

@@ -0,0 +1,45 @@
1
+package com.huiju.estateagents.excel.ActivityStatistics;
2
+
3
+import com.alibaba.excel.annotation.ExcelProperty;
4
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
5
+import lombok.Data;
6
+
7
+@Data
8
+public class ChannelAddRegistNum {
9
+    /**
10
+     * 姓名
11
+     */
12
+    @ColumnWidth(15)
13
+    @ExcelProperty(value = "姓名", index = 0)
14
+    private String nickName;
15
+
16
+    /**
17
+     * 电话
18
+     */
19
+    @ColumnWidth(15)
20
+    @ExcelProperty(value = "电话", index = 1)
21
+    private String phone;
22
+
23
+    /**
24
+     * 性别
25
+     */
26
+    @ColumnWidth(15)
27
+    @ExcelProperty(value = "性别", index = 2)
28
+    private String gender;
29
+
30
+    /**
31
+     * 归属地
32
+     */
33
+    @ColumnWidth(15)
34
+    @ExcelProperty(value = "归属地", index = 3)
35
+    private String province;
36
+
37
+    /**
38
+     * 分享者电话
39
+     */
40
+    @ColumnWidth(15)
41
+    @ExcelProperty(value = "注册时间", index = 4)
42
+    private String createDate;
43
+
44
+
45
+}

+ 79
- 0
src/main/java/com/huiju/estateagents/excel/ActivityStatistics/ChannelVisitNum.java Ver fichero

@@ -0,0 +1,79 @@
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 ChannelVisitNum {
9
+    /**
10
+     * 姓名
11
+     */
12
+    @ColumnWidth(15)
13
+    @ExcelProperty(value = "姓名", index = 0)
14
+    private String nickName;
15
+
16
+    /**
17
+     * 电话
18
+     */
19
+    @ColumnWidth(15)
20
+    @ExcelProperty(value = "电话", index = 1)
21
+    private String phone;
22
+
23
+    /**
24
+     * 性别
25
+     */
26
+    @ColumnWidth(15)
27
+    @ExcelProperty(value = "性别", index = 2)
28
+    private String gender;
29
+
30
+    /**
31
+     * 归属地
32
+     */
33
+    @ColumnWidth(15)
34
+    @ExcelProperty(value = "归属地", index = 3)
35
+    private String province;
36
+
37
+//    /**
38
+//     * 来源渠道
39
+//     */
40
+//    @ColumnWidth(15)
41
+//    @ExcelProperty(value = "来源渠道", index = 4)
42
+//    private String personFrom;
43
+//
44
+//    /**
45
+//     * 置业顾问
46
+//     */
47
+//    @ColumnWidth(15)
48
+//    @ExcelProperty(value = "置业顾问", index = 5)
49
+//    private String realtyConsultant;
50
+//
51
+//    /**
52
+//     * 置业顾问电话
53
+//     */
54
+//    @ColumnWidth(15)
55
+//    @ExcelProperty(value = "置业顾问电话", index = 6)
56
+//    private String realtyConsultantPhone;
57
+//
58
+//    /**
59
+//     * 分享者
60
+//     */
61
+//    @ColumnWidth(15)
62
+//    @ExcelProperty(value = "分享者", index = 7)
63
+//    private String sharePersonName;
64
+//
65
+//    /**
66
+//     * 分享者电话
67
+//     */
68
+//    @ColumnWidth(15)
69
+//    @ExcelProperty(value = "分享者电话", index = 8)
70
+//    private String sharePersonPhone;
71
+
72
+    /**
73
+     * 访问时间
74
+     */
75
+    @ColumnWidth(15)
76
+    @ExcelProperty(value = "访问时间", index = 4)
77
+    private String visitDate;
78
+
79
+}

+ 86
- 0
src/main/java/com/huiju/estateagents/excel/ActivityStatistics/ChannelVisitPersonNum.java Ver fichero

@@ -0,0 +1,86 @@
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 ChannelVisitPersonNum {
9
+    /**
10
+     * 姓名
11
+     */
12
+    @ColumnWidth(15)
13
+    @ExcelProperty(value = "姓名", index = 0)
14
+    private String nickName;
15
+
16
+    /**
17
+     * 电话
18
+     */
19
+    @ColumnWidth(15)
20
+    @ExcelProperty(value = "电话", index = 1)
21
+    private String phone;
22
+
23
+    /**
24
+     * 性别
25
+     */
26
+    @ColumnWidth(15)
27
+    @ExcelProperty(value = "性别", index = 2)
28
+    private String gender;
29
+
30
+    /**
31
+     * 归属地
32
+     */
33
+    @ColumnWidth(15)
34
+    @ExcelProperty(value = "归属地", index = 3)
35
+    private String province;
36
+
37
+//    /**
38
+//     * 来源渠道
39
+//     */
40
+//    @ColumnWidth(15)
41
+//    @ExcelProperty(value = "来源渠道", index = 4)
42
+//    private String personFrom;
43
+//
44
+//    /**
45
+//     * 置业顾问
46
+//     */
47
+//    @ColumnWidth(15)
48
+//    @ExcelProperty(value = "置业顾问", index = 5)
49
+//    private String realtyConsultant;
50
+//
51
+//    /**
52
+//     * 置业顾问电话
53
+//     */
54
+//    @ColumnWidth(15)
55
+//    @ExcelProperty(value = "置业顾问电话", index = 6)
56
+//    private String realtyConsultantPhone;
57
+//
58
+//    /**
59
+//     * 推广人
60
+//     */
61
+//    @ColumnWidth(15)
62
+//    @ExcelProperty(value = "推广人", index = 7)
63
+//    private String sharePersonName;
64
+//    /**
65
+//     * 分享者
66
+//     */
67
+//    @ColumnWidth(15)
68
+//    @ExcelProperty(value = "分享者", index = 7)
69
+//    private String sharePersonName;
70
+//
71
+//    /**
72
+//     * 分享者电话
73
+//     */
74
+//    @ColumnWidth(15)
75
+//    @ExcelProperty(value = "分享者电话", index = 8)
76
+//    private String sharePersonPhone;
77
+
78
+    /**
79
+     * 访问次数
80
+     */
81
+    @ColumnWidth(15)
82
+    @ExcelProperty(value = "访问次数", index = 4)
83
+    private String visitNum;
84
+
85
+
86
+}

+ 58
- 0
src/main/java/com/huiju/estateagents/excel/ActivityStatistics/TsChannelDaily.java Ver fichero

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

+ 45
- 0
src/main/java/com/huiju/estateagents/excel/QrCodeStatistics/QrCodeNewPersonNum.java Ver fichero

@@ -0,0 +1,45 @@
1
+package com.huiju.estateagents.excel.QrCodeStatistics;
2
+
3
+import com.alibaba.excel.annotation.ExcelProperty;
4
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
5
+import lombok.Data;
6
+
7
+import java.time.LocalDateTime;
8
+
9
+@Data
10
+public class QrCodeNewPersonNum {
11
+    /**
12
+     * 姓名
13
+     */
14
+    @ColumnWidth(15)
15
+    @ExcelProperty(value = "姓名", index = 0)
16
+    private String nickName;
17
+
18
+    /**
19
+     * 电话
20
+     */
21
+    @ColumnWidth(15)
22
+    @ExcelProperty(value = "电话", index = 1)
23
+    private String phone;
24
+
25
+    /**
26
+     * 性别
27
+     */
28
+    @ColumnWidth(15)
29
+    @ExcelProperty(value = "性别", index = 2)
30
+    private String gender;
31
+
32
+    /**
33
+     * 归属地
34
+     */
35
+    @ColumnWidth(15)
36
+    @ExcelProperty(value = "归属地", index = 3)
37
+    private String province;
38
+
39
+    /**
40
+     * 访问次数
41
+     */
42
+    @ColumnWidth(15)
43
+    @ExcelProperty(value = "注册时间", index = 4)
44
+    private String registerTime;
45
+}

+ 45
- 0
src/main/java/com/huiju/estateagents/excel/QrCodeStatistics/QrCodeVisitNum.java Ver fichero

@@ -0,0 +1,45 @@
1
+package com.huiju.estateagents.excel.QrCodeStatistics;
2
+
3
+import com.alibaba.excel.annotation.ExcelProperty;
4
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
5
+import lombok.Data;
6
+
7
+import java.time.LocalDateTime;
8
+
9
+@Data
10
+public class QrCodeVisitNum {
11
+    /**
12
+     * 姓名
13
+     */
14
+    @ColumnWidth(15)
15
+    @ExcelProperty(value = "姓名", index = 0)
16
+    private String nickName;
17
+
18
+    /**
19
+     * 电话
20
+     */
21
+    @ColumnWidth(15)
22
+    @ExcelProperty(value = "电话", index = 1)
23
+    private String phone;
24
+
25
+    /**
26
+     * 性别
27
+     */
28
+    @ColumnWidth(15)
29
+    @ExcelProperty(value = "性别", index = 2)
30
+    private String gender;
31
+
32
+    /**
33
+     * 归属地
34
+     */
35
+    @ColumnWidth(15)
36
+    @ExcelProperty(value = "归属地", index = 3)
37
+    private String province;
38
+
39
+    /**
40
+     * 访问次数
41
+     */
42
+    @ColumnWidth(15)
43
+    @ExcelProperty(value = "访问时间", index = 4)
44
+    private String visitTime;
45
+}

+ 44
- 0
src/main/java/com/huiju/estateagents/excel/QrCodeStatistics/QrCodeVisitPersonNum.java Ver fichero

@@ -0,0 +1,44 @@
1
+package com.huiju.estateagents.excel.QrCodeStatistics;
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 QrCodeVisitPersonNum {
9
+    /**
10
+     * 姓名
11
+     */
12
+    @ColumnWidth(15)
13
+    @ExcelProperty(value = "姓名", index = 0)
14
+    private String nickName;
15
+
16
+    /**
17
+     * 电话
18
+     */
19
+    @ColumnWidth(15)
20
+    @ExcelProperty(value = "电话", index = 1)
21
+    private String phone;
22
+
23
+    /**
24
+     * 性别
25
+     */
26
+    @ColumnWidth(15)
27
+    @ExcelProperty(value = "性别", index = 2)
28
+    private String gender;
29
+
30
+    /**
31
+     * 归属地
32
+     */
33
+    @ColumnWidth(15)
34
+    @ExcelProperty(value = "归属地", index = 3)
35
+    private String province;
36
+
37
+    /**
38
+     * 访问次数
39
+     */
40
+    @ColumnWidth(15)
41
+    @ExcelProperty(value = "访问次数", index = 4)
42
+    private String visitNum;
43
+
44
+}

+ 3
- 0
src/main/java/com/huiju/estateagents/interceptor/AccessInterceptor.java Ver fichero

@@ -17,6 +17,7 @@ import com.huiju.estateagents.service.ISysButtonInMenuService;
17 17
 import com.huiju.estateagents.service.ITaRoleButtonService;
18 18
 import com.huiju.estateagents.third.service.ITaThirdPartyMiniappConfigService;
19 19
 import io.jsonwebtoken.*;
20
+import lombok.extern.slf4j.Slf4j;
20 21
 import org.springframework.beans.factory.annotation.Autowired;
21 22
 import org.springframework.stereotype.Component;
22 23
 import org.springframework.web.servlet.HandlerInterceptor;
@@ -27,6 +28,7 @@ import javax.servlet.http.HttpServletResponse;
27 28
 import java.util.List;
28 29
 import java.util.Map;
29 30
 
31
+@Slf4j
30 32
 @Component
31 33
 public class AccessInterceptor implements HandlerInterceptor {
32 34
     
@@ -95,6 +97,7 @@ public class AccessInterceptor implements HandlerInterceptor {
95 97
 
96 98
     @Override
97 99
     public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object obj) throws Exception {
100
+        log.info("接口请求路径是{}",request.getRequestURI());
98 101
         //第三方权限校验
99 102
         String tokenHeader = request.getHeader("x-token");
100 103
         if (!StringUtils.isEmpty(tokenHeader)){

+ 33
- 0
src/main/java/com/huiju/estateagents/mapper/TaChannelMapper.java Ver fichero

@@ -3,9 +3,16 @@ 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;
7
+import com.huiju.estateagents.entity.TsActivityDaily;
8
+import com.huiju.estateagents.excel.ActivityStatistics.ChannelAddRegistNum;
9
+import com.huiju.estateagents.excel.ActivityStatistics.ChannelVisitNum;
10
+import com.huiju.estateagents.excel.ActivityStatistics.ChannelVisitPersonNum;
11
+import com.huiju.estateagents.excel.ActivityStatistics.TsChannelDaily;
6 12
 import org.apache.ibatis.annotations.Mapper;
7 13
 import org.apache.ibatis.annotations.Param;
8 14
 
15
+import java.time.LocalDate;
9 16
 import java.util.List;
10 17
 
11 18
 /**
@@ -39,4 +46,30 @@ public interface TaChannelMapper extends BaseMapper<TaChannel> {
39 46
     IPage<TaChannel> pageTaChannel(IPage<TaChannel> pg,@Param("orgId")Integer orgId,@Param("channelId")Integer channelId);
40 47
 
41 48
     List<TaChannel> recommendCount(@Param("orgId")Integer orgId,@Param("channelId")Integer channelId);
49
+
50
+    /**
51
+     * 渠道引进客户统计
52
+     * @param pg
53
+     * @param orgId
54
+     * @param startDate
55
+     * @param endDate
56
+     * @param channelType
57
+     * @param buildingId
58
+     * @return
59
+     */
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);
61
+
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);
63
+
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);
65
+
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);
42 75
 }

+ 9
- 1
src/main/java/com/huiju/estateagents/mapper/TaLiveActivityMapper.java Ver fichero

@@ -30,7 +30,15 @@ public interface TaLiveActivityMapper extends BaseMapper<TaLiveActivity> {
30 30
      */
31 31
     Boolean addVisitNum(@Param("id") String id);
32 32
 
33
-    IPage<TaLiveActivity> selectLiveListByCondition(IPage<TaLiveActivity> pg, @Param("liveActivityTitle") String liveActivityTitle, @Param("cityId") String cityId, @Param("buildingId") String buildingId, @Param("status") Integer status, @Param("orgId") Integer orgId,@Param("personBuildingList") List<TaPersonBuilding> personBuildingList, @Param("userId") Integer userId);
33
+    IPage<TaLiveActivity> selectLiveListByCondition(IPage<TaLiveActivity> pg,
34
+                                                    @Param("liveActivityTitle") String liveActivityTitle,
35
+                                                    @Param("cityId") String cityId,
36
+                                                    @Param("buildingId") String buildingId,
37
+                                                    @Param("status") Integer status,
38
+                                                    @Param("orgId") Integer orgId,
39
+                                                    @Param("personBuildingList") List<TaPersonBuilding> personBuildingList,
40
+                                                    @Param("userId") Integer userId,
41
+                                                    @Param("source") Integer source);
34 42
     /**
35 43
      * 批量更新直播活动状态
36 44
      *

+ 2
- 0
src/main/java/com/huiju/estateagents/mapper/TaMiniappMapper.java Ver fichero

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4
 import com.huiju.estateagents.entity.TaMiniapp;
5 5
 import com.huiju.estateagents.entity.TaMiniappTemplate;
6 6
 import org.apache.ibatis.annotations.Mapper;
7
+import org.springframework.stereotype.Component;
7 8
 
8 9
 import java.util.List;
9 10
 
@@ -16,6 +17,7 @@ import java.util.List;
16 17
  * @since 2019-09-11
17 18
  */
18 19
 @Mapper
20
+@Component
19 21
 public interface TaMiniappMapper extends BaseMapper<TaMiniapp> {
20 22
 
21 23
     List<TaMiniapp> getAllAvaliableMiniapps();

+ 1
- 0
src/main/java/com/huiju/estateagents/mapper/TaPersonBuildingMapper.java Ver fichero

@@ -26,4 +26,5 @@ public interface TaPersonBuildingMapper extends BaseMapper<TaPersonBuilding> {
26 26
     List<SalesExport> selectSalesList(@Param("orgId") Integer orgId,@Param("buildingId") String buildingId, @Param("startCreateDate")  String startCreateDate,@Param("endCreateDate") String endCreateDate, @Param("personBuildingList") List<TaPersonBuilding> taPersonBuildingList);
27 27
 
28 28
     List<TaBuilding> getBuildingsOf(@Param("personOrUser") String personOrUser);
29
+
29 30
 }

+ 92
- 0
src/main/java/com/huiju/estateagents/mapper/TaQrcodeMapper.java Ver fichero

@@ -0,0 +1,92 @@
1
+package com.huiju.estateagents.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.huiju.estateagents.bo.request.QrCodeStatisticResponseBO;
6
+import com.huiju.estateagents.entity.TaPersonBuilding;
7
+import com.huiju.estateagents.entity.TaPersonVisitRecord;
8
+import com.huiju.estateagents.entity.TaQrcode;
9
+import com.huiju.estateagents.excel.QrCodeStatistics.QrCodeNewPersonNum;
10
+import com.huiju.estateagents.excel.QrCodeStatistics.QrCodeVisitNum;
11
+import com.huiju.estateagents.excel.QrCodeStatistics.QrCodeVisitPersonNum;
12
+import org.apache.ibatis.annotations.Mapper;
13
+import org.apache.ibatis.annotations.Param;
14
+import org.springframework.stereotype.Component;
15
+
16
+import java.util.List;
17
+
18
+/**
19
+ * <p>
20
+ * 二维码管理表 Mapper 接口
21
+ * </p>
22
+ *
23
+ * @author fxf
24
+ * @since 2020-05-20
25
+ */
26
+@Mapper
27
+@Component
28
+public interface TaQrcodeMapper extends BaseMapper<TaQrcode> {
29
+
30
+    QrCodeStatisticResponseBO getStatisticData(@Param("orgId") Integer orgId);
31
+
32
+    IPage<TaQrcode> listQrCodeByCondition(IPage<TaQrcode> page,
33
+                                          @Param("targetType") String targetType,
34
+                                          @Param("targetName") String targetName,
35
+                                          @Param("channelId") Integer channelId,
36
+                                          @Param("buildingId") String buildingId,
37
+                                          @Param("userId") Integer userId,
38
+                                          @Param("orgId") Integer orgId,
39
+                                          @Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
40
+
41
+    /**
42
+     * 获取访问用户人数
43
+     *
44
+     * @param qrCodeId
45
+     * @param orgId
46
+     * @return
47
+     */
48
+    Integer getVisitPersons(@Param("qrCodeId") Integer qrCodeId,
49
+                            @Param("orgId") Integer orgId);
50
+
51
+    /**
52
+     * 获取访问次数
53
+     *
54
+     * @param qrCodeId
55
+     * @param orgId
56
+     * @return
57
+     */
58
+    Integer getVisitNum(@Param("qrCodeId") Integer qrCodeId,
59
+                        @Param("orgId") Integer orgId);
60
+
61
+    /**
62
+     * 获取新增用户数
63
+     *
64
+     * @param qrCodeId
65
+     * @param orgId
66
+     * @return
67
+     */
68
+    Integer getNewPersons(@Param("qrCodeId") Integer qrCodeId,
69
+                          @Param("orgId") Integer orgId);
70
+
71
+    IPage<TaPersonVisitRecord> getVisitPersonsRecord(IPage<TaPersonVisitRecord> page,
72
+                                                     @Param("qrCodeId") Integer qrCodeId,
73
+                                                     @Param("orgId") Integer orgId);
74
+
75
+    IPage<TaPersonVisitRecord> getVisitNumRecord(IPage<TaPersonVisitRecord> page,
76
+                                                 @Param("qrCodeId") Integer qrCodeId,
77
+                                                 @Param("orgId") Integer orgId);
78
+
79
+    IPage<TaPersonVisitRecord> getNewPersonsRecord(IPage<TaPersonVisitRecord> page,
80
+                                                   @Param("qrCodeId") Integer qrCodeId,
81
+                                                   @Param("orgId") Integer orgId);
82
+
83
+    List<QrCodeVisitPersonNum> getVisitPersonsRecordExport(@Param("qrCodeId") Integer qrCodeId,
84
+                                                           @Param("orgId") Integer orgId);
85
+
86
+
87
+    List<QrCodeVisitNum> getVisitNumRecordExport(@Param("qrCodeId") Integer qrCodeId,
88
+                                                 @Param("orgId") Integer orgId);
89
+
90
+    List<QrCodeNewPersonNum> getNewPersonsRecordExport(@Param("qrCodeId") Integer qrCodeId,
91
+                                                       @Param("orgId") Integer orgId);
92
+}

+ 83
- 27
src/main/java/com/huiju/estateagents/mapper/TaRecommendCustomerMapper.java Ver fichero

@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
9 9
 import com.huiju.estateagents.excel.*;
10 10
 import org.apache.ibatis.annotations.Mapper;
11 11
 import org.apache.ibatis.annotations.Param;
12
+import org.springframework.web.bind.annotation.RequestParam;
12 13
 
13 14
 import java.time.LocalDateTime;
14 15
 import java.util.List;
@@ -27,19 +28,23 @@ public interface TaRecommendCustomerMapper extends BaseMapper<TaRecommendCustome
27 28
 
28 29
     Integer getMyCutsomerNum(@Param("personId") String personId);
29 30
 
30
-    String getCustomerPersonId(@Param("customerId")String customerId);
31
+    String getCustomerPersonId(@Param("customerId") String customerId);
31 32
 
32
-    TaRecommendCustomer getCustomerDetail(@Param("customerId")String customerId,@Param("personId")String personId);
33
+    TaRecommendCustomer getCustomerDetail(@Param("customerId") String customerId, @Param("personId") String personId);
33 34
 
34
-    TaRecommendCustomer getCustomerById(@Param("customerId")String customerId);
35
+    TaRecommendCustomer getCustomerById(@Param("customerId") String customerId);
35 36
 
36
-    IPage<TaRecommendCustomer> getCustomerList(IPage<TaRecommendCustomer> page,@Param("building") String building, @Param("name") String name, @Param("tel") String tel, @Param("consultName") String consultName, @Param("consultTel") String consultTel,@Param("entryType") String entryType,@Param("verifyStatus") String verifyStatus,@Param("sex") Integer sex, @Param("orgId") Integer orgId,@Param("status")Integer status, @Param("personBuildingList") List<TaPersonBuilding> personBuildingList,@Param("sceneType") String sceneType, @Param("startCreateDate") String startCreateDate, @Param("endCreateDate") String endCreateDate, @Param("sharePersonName") String sharePersonName);
37
-    IPage<TaRecommendCustomer> getRecCustomerList(IPage<TaRecommendCustomer> page,@Param("building") String building, @Param("name") String name, @Param("tel") String tel, @Param("consultName") String consultName, @Param("consultTel") String consultTel,@Param("entryType") String entryType,@Param("verifyStatus") String verifyStatus,@Param("sex") Integer sex, @Param("orgId") Integer orgId, @Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
38
-    IPage<TaRecommendCustomer> getRepCustomerList(IPage<TaRecommendCustomer> page,@Param("building") String building, @Param("name") String name, @Param("tel") String tel, @Param("consultName") String consultName, @Param("consultTel") String consultTel,@Param("entryType") String entryType,@Param("verifyStatus") String verifyStatus,@Param("sex") Integer sex, @Param("orgId") Integer orgId, @Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
39
-    IPage<TaPerson> getIndependentAgents(IPage<TaPerson>page, @Param("name") String name, @Param("tel") String tel, @Param("channelId") String channelId, @Param("orgId") Integer orgId);
37
+    IPage<TaRecommendCustomer> getCustomerList(IPage<TaRecommendCustomer> page, @Param("building") String building, @Param("name") String name, @Param("tel") String tel, @Param("consultName") String consultName, @Param("consultTel") String consultTel, @Param("entryType") String entryType, @Param("verifyStatus") String verifyStatus, @Param("sex") Integer sex, @Param("orgId") Integer orgId, @Param("status") Integer status, @Param("personBuildingList") List<TaPersonBuilding> personBuildingList, @Param("sceneType") String sceneType, @Param("startCreateDate") String startCreateDate, @Param("endCreateDate") String endCreateDate, @Param("sharePersonName") String sharePersonName);
38
+
39
+    IPage<TaRecommendCustomer> getRecCustomerList(IPage<TaRecommendCustomer> page, @Param("building") String building, @Param("name") String name, @Param("tel") String tel, @Param("consultName") String consultName, @Param("consultTel") String consultTel, @Param("entryType") String entryType, @Param("verifyStatus") String verifyStatus, @Param("sex") Integer sex, @Param("orgId") Integer orgId, @Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
40
+
41
+    IPage<TaRecommendCustomer> getRepCustomerList(IPage<TaRecommendCustomer> page, @Param("building") String building, @Param("name") String name, @Param("tel") String tel, @Param("consultName") String consultName, @Param("consultTel") String consultTel, @Param("entryType") String entryType, @Param("verifyStatus") String verifyStatus, @Param("sex") Integer sex, @Param("orgId") Integer orgId, @Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
42
+
43
+    IPage<TaPerson> getIndependentAgents(IPage<TaPerson> page, @Param("name") String name, @Param("tel") String tel, @Param("channelId") String channelId, @Param("orgId") Integer orgId);
40 44
 
41 45
     /**
42 46
      * 公客
47
+     *
43 48
      * @param page
44 49
      * @param name
45 50
      * @param tel
@@ -67,34 +72,39 @@ public interface TaRecommendCustomerMapper extends BaseMapper<TaRecommendCustome
67 72
 
68 73
     /**
69 74
      * 导出数据 获取推荐用户数据
75
+     *
70 76
      * @param orgId
71 77
      * @return
72 78
      */
73
-    List<ExcelRecommendCustomer> getRecCustomerExport(@Param("orgId") Integer orgId, @Param("pageCode") Integer pageCode, @Param("pageSize") Integer pageSize,@Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
79
+    List<ExcelRecommendCustomer> getRecCustomerExport(@Param("orgId") Integer orgId, @Param("pageCode") Integer pageCode, @Param("pageSize") Integer pageSize, @Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
74 80
 
75 81
     /**
76 82
      * 导出数据 获取推荐用户数据 总数
83
+     *
77 84
      * @param orgId
78 85
      * @return
79 86
      */
80
-    Integer getRecCustomerExportCount(@Param("orgId") Integer orgId,@Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
87
+    Integer getRecCustomerExportCount(@Param("orgId") Integer orgId, @Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
81 88
 
82 89
     /**
83 90
      * 导出数据 获取报备客户数据 总数
91
+     *
84 92
      * @param orgId
85 93
      * @return
86 94
      */
87
-    Integer getRepCustomerReportCount(@Param("building") String building, @Param("name") String name, @Param("tel") String tel, @Param("consultName") String consultName, @Param("consultTel") String consultTel,@Param("entryType") String entryType,@Param("verifyStatus") String verifyStatus,@Param("sex") Integer sex,@Param("orgId")Integer orgId,@Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
95
+    Integer getRepCustomerReportCount(@Param("building") String building, @Param("name") String name, @Param("tel") String tel, @Param("consultName") String consultName, @Param("consultTel") String consultTel, @Param("entryType") String entryType, @Param("verifyStatus") String verifyStatus, @Param("sex") Integer sex, @Param("orgId") Integer orgId, @Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
88 96
 
89 97
     /**
90 98
      * 导出数据 获取报备客户数据
99
+     *
91 100
      * @param orgId
92 101
      * @return
93 102
      */
94
-    List<ReporRecommendCustomer> getRepCustomerReportExport(@Param("building") String building, @Param("name") String name, @Param("tel") String tel, @Param("consultName") String consultName, @Param("consultTel") String consultTel,@Param("entryType") String entryType,@Param("verifyStatus") String verifyStatus,@Param("sex") Integer sex, @Param("orgId") Integer orgId, @Param("pageCode") Integer pageCode, @Param("pageSize") Integer pageSize,@Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
103
+    List<ReporRecommendCustomer> getRepCustomerReportExport(@Param("building") String building, @Param("name") String name, @Param("tel") String tel, @Param("consultName") String consultName, @Param("consultTel") String consultTel, @Param("entryType") String entryType, @Param("verifyStatus") String verifyStatus, @Param("sex") Integer sex, @Param("orgId") Integer orgId, @Param("pageCode") Integer pageCode, @Param("pageSize") Integer pageSize, @Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
95 104
 
96 105
     /**
97 106
      * 导出数据 获取经纪人数据 总数
107
+     *
98 108
      * @param orgId
99 109
      * @return
100 110
      */
@@ -102,15 +112,17 @@ public interface TaRecommendCustomerMapper extends BaseMapper<TaRecommendCustome
102 112
 
103 113
     /**
104 114
      * 导出数据 获取经纪人数据
115
+     *
105 116
      * @param orgId
106 117
      * @param pageCode
107 118
      * @param pageSize
108 119
      * @return
109 120
      */
110
-    List<AgentsRecommendCustomer> getIndependentAgentsExport(@Param("name")String name, @Param("tel")String tel, @Param("channelId")String channelId, @Param("orgId") Integer orgId, @Param("pageCode") Integer pageCode, @Param("pageSize") Integer pageSize);
121
+    List<AgentsRecommendCustomer> getIndependentAgentsExport(@Param("name") String name, @Param("tel") String tel, @Param("channelId") String channelId, @Param("orgId") Integer orgId, @Param("pageCode") Integer pageCode, @Param("pageSize") Integer pageSize);
111 122
 
112 123
     /**
113 124
      * 导出数据 公客总数
125
+     *
114 126
      * @param name
115 127
      * @param tel
116 128
      * @param entryType
@@ -120,10 +132,11 @@ public interface TaRecommendCustomerMapper extends BaseMapper<TaRecommendCustome
120 132
      * @param consultTel
121 133
      * @return
122 134
      */
123
-    Integer getPublicCustomerExportListCount(@Param("name") String name, @Param("tel") String tel,@Param("entryType") String entryType,@Param("verifyStatus") String verifyStatus,@Param("sex") Integer sex, @Param("orgId") Integer orgId,@Param("consultTel")String consultTel);
135
+    Integer getPublicCustomerExportListCount(@Param("name") String name, @Param("tel") String tel, @Param("entryType") String entryType, @Param("verifyStatus") String verifyStatus, @Param("sex") Integer sex, @Param("orgId") Integer orgId, @Param("consultTel") String consultTel);
124 136
 
125 137
     /**
126 138
      * 导出数据 公客
139
+     *
127 140
      * @param name
128 141
      * @param tel
129 142
      * @param entryType
@@ -135,20 +148,23 @@ public interface TaRecommendCustomerMapper extends BaseMapper<TaRecommendCustome
135 148
      */
136 149
     List<PublicCustomerExport> getPublicCustomerExportList(@Param("pageCode") Integer pageCode,
137 150
                                                            @Param("pageSize") Integer pageSize,
138
-                                                           @Param("buildingId")String buildingId,
151
+                                                           @Param("buildingId") String buildingId,
139 152
                                                            @Param("name") String name,
140 153
                                                            @Param("tel") String tel,
141 154
                                                            @Param("entryType") String entryType,
142 155
                                                            @Param("verifyStatus") String verifyStatus,
143 156
                                                            @Param("sex") Integer sex,
144 157
                                                            @Param("orgId") Integer orgId,
145
-                                                           @Param("consultTel")String consultTel,
146
-                                                           @Param("sceneType")String sceneType,
158
+                                                           @Param("consultTel") String consultTel,
159
+                                                           @Param("sceneType") String sceneType,
147 160
                                                            @Param("personBuildingList") List<TaPersonBuilding> personBuildingList,
148
-                                                           @Param("belongStatus") Integer belongStatus);
161
+                                                           @Param("belongStatus") Integer belongStatus,
162
+                                                           @Param("startCreateDate") String startCreateDate,
163
+                                                           @Param("endCreateDate") String endCreateDate);
149 164
 
150 165
     /**
151 166
      * 导出数据 私客总数
167
+     *
152 168
      * @param buildingId
153 169
      * @param name
154 170
      * @param tel
@@ -161,10 +177,11 @@ public interface TaRecommendCustomerMapper extends BaseMapper<TaRecommendCustome
161 177
      * @param status
162 178
      * @return
163 179
      */
164
-    Integer getCustomerExportListCount(@Param("building") String buildingId, @Param("name") String name, @Param("tel") String tel, @Param("consultName") String consultName, @Param("consultTel") String consultTel,@Param("entryType") String entryType,@Param("verifyStatus") String verifyStatus,@Param("sex") Integer sex, @Param("orgId") Integer orgId,@Param("status")Integer status,@Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
180
+    Integer getCustomerExportListCount(@Param("building") String buildingId, @Param("name") String name, @Param("tel") String tel, @Param("consultName") String consultName, @Param("consultTel") String consultTel, @Param("entryType") String entryType, @Param("verifyStatus") String verifyStatus, @Param("sex") Integer sex, @Param("orgId") Integer orgId, @Param("status") Integer status, @Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
165 181
 
166 182
     /**
167 183
      * 导出数据 私客
184
+     *
168 185
      * @param pageCode
169 186
      * @param pageSize
170 187
      * @param buildingId
@@ -179,18 +196,35 @@ public interface TaRecommendCustomerMapper extends BaseMapper<TaRecommendCustome
179 196
      * @param status
180 197
      * @return
181 198
      */
182
-    List<PrivateCustomerExport> getCustomerExportList(@Param("pageCode") Integer pageCode, @Param("pageSize") Integer pageSize, @Param("building") String buildingId, @Param("name") String name, @Param("tel") String tel, @Param("consultName") String consultName, @Param("consultTel") String consultTel, @Param("entryType") String entryType, @Param("verifyStatus") String verifyStatus, @Param("sex") Integer sex, @Param("orgId") Integer orgId, @Param("status")Integer status,@Param("sceneType") String sceneType,@Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
183
-    
199
+    List<PrivateCustomerExport> getCustomerExportList(@Param("pageCode") Integer pageCode,
200
+                                                      @Param("pageSize") Integer pageSize,
201
+                                                      @Param("building") String buildingId,
202
+                                                      @Param("name") String name,
203
+                                                      @Param("tel") String tel,
204
+                                                      @Param("consultName") String consultName,
205
+                                                      @Param("consultTel") String consultTel,
206
+                                                      @Param("entryType") String entryType,
207
+                                                      @Param("verifyStatus") String verifyStatus,
208
+                                                      @Param("sex") Integer sex,
209
+                                                      @Param("orgId") Integer orgId,
210
+                                                      @Param("status") Integer status,
211
+                                                      @Param("sceneType") String sceneType,
212
+                                                      @Param("startCreateDate") String startCreateDate,
213
+                                                      @Param("endCreateDate") String endCreateDate,
214
+                                                      @Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
215
+
184 216
     /**
185 217
      * 获取我的客户的人数统计
218
+     *
186 219
      * @param personId
187 220
      * @param userId
188 221
      * @return
189 222
      */
190
-	Map<String, Object> getMyCustStatistics(@Param("personId") String personId,@Param("userId") Integer userId,@Param("orgId") Integer orgId);
191
-    
223
+    Map<String, Object> getMyCustStatistics(@Param("personId") String personId, @Param("userId") Integer userId, @Param("orgId") Integer orgId);
224
+
192 225
     /**
193 226
      * 获取我的跟进客户数据
227
+     *
194 228
      * @param page
195 229
      * @param personId
196 230
      * @param userId
@@ -205,19 +239,30 @@ public interface TaRecommendCustomerMapper extends BaseMapper<TaRecommendCustome
205 239
      * @param endArrivalDate
206 240
      * @return
207 241
      */
208
-    IPage<TaRecommendCustomer> getMyCustFollowOrClinch(IPage<TaRecommendCustomer> page, @Param("personId") String personId, @Param("userId") Integer userId, @Param("orgId") Integer orgId, @Param("type") String type, @Param("name") String name, @Param("phone") String phone, @Param("status") Integer status,@Param("startReportDate") String startReportDate,@Param("endReportDate") String endReportDate,@Param("startArrivalDate") String startArrivalDate,@Param("endArrivalDate") String endArrivalDate);
209
-    
242
+    IPage<TaRecommendCustomer> getMyCustFollowOrClinch(IPage<TaRecommendCustomer> page, @Param("personId") String personId, @Param("userId") Integer userId, @Param("orgId") Integer orgId, @Param("type") String type, @Param("name") String name, @Param("phone") String phone, @Param("status") Integer status, @Param("startReportDate") String startReportDate, @Param("endReportDate") String endReportDate, @Param("startArrivalDate") String startArrivalDate, @Param("endArrivalDate") String endArrivalDate);
243
+
210 244
     /**
211 245
      * 获取我的客户详情数据
246
+     *
212 247
      * @param customerId
213 248
      * @return
214 249
      */
215 250
     TaRecommendCustomer getMyCustDetailById(String customerId);
216 251
 
217
-    List<PersonIntention> getCustomerIntentions(@Param("personId")String personId,@Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
252
+    List<PersonIntention> getCustomerIntentions(@Param("personId") String personId, @Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
218 253
 
219
-    IPage<TaRecommendCustomer>getCustomersIRecommended(IPage<TaRecommendCustomer> page,@Param("customerId")String customerId,@Param("status")Integer status,@Param("orgId") Integer orgId,@Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
254
+    IPage<TaRecommendCustomer> getCustomersIRecommended(IPage<TaRecommendCustomer> page, @Param("customerId") String customerId, @Param("status") Integer status, @Param("orgId") Integer orgId, @Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
220 255
 
256
+    /**
257
+     * @param page
258
+     * @param orgId
259
+     * @param userId
260
+     * @param buildingId
261
+     * @param startDate
262
+     * @param endDate
263
+     * @param personId
264
+     * @return
265
+     */
221 266
     IPage<TaRecommendCustomer> getCustomerListOfConsultant(IPage<TaRecommendCustomer> page,
222 267
                                                            @Param("orgId") Integer orgId,
223 268
                                                            @Param("userId") String userId,
@@ -230,6 +275,7 @@ public interface TaRecommendCustomerMapper extends BaseMapper<TaRecommendCustome
230 275
      * 查询 person 对应 楼盘 的客户
231 276
      * 如果对应的楼盘没有客户, 则返回无楼盘的, 小程序级别的客户信息
232 277
      * 如果没有无小程序级别客户, 则返回最早的一条
278
+     *
233 279
      * @param orgId
234 280
      * @param personId
235 281
      * @param buildingId
@@ -239,12 +285,22 @@ public interface TaRecommendCustomerMapper extends BaseMapper<TaRecommendCustome
239 285
 
240 286
     /**
241 287
      * 获取置业福问下的客户
288
+     *
242 289
      * @param userId
243 290
      * @param personId
244 291
      * @param buildingId
245 292
      * @param orgId
246 293
      * @return
247 294
      */
248
-    List<TaRecommendCustomer> getConsultantCustomerList(@Param("userId") Integer userId,@Param("personId") String personId,@Param("buildingId") String buildingId,@Param("orgId") Integer orgId);
295
+    List<TaRecommendCustomer> getConsultantCustomerList(@Param("userId") Integer userId, @Param("personId") String personId, @Param("buildingId") String buildingId, @Param("orgId") Integer orgId);
249 296
 
297
+    /**
298
+     * 校验客户存在记录
299
+     * @param orgId
300
+     * @param personId
301
+     * @param consultBuildingIds
302
+     * @param buildingId
303
+     * @return
304
+     */
305
+    Map<String, Number> checkCustomerBy(@Param("orgId") Integer orgId, @Param("personId") String personId, @Param("consultBuildingIds") List<String> consultBuildingIds, @Param("buildingId") String buildingId);
250 306
 }

+ 15
- 0
src/main/java/com/huiju/estateagents/reportCustomerAop/ReportCustomer.java Ver fichero

@@ -0,0 +1,15 @@
1
+package com.huiju.estateagents.reportCustomerAop;
2
+
3
+import java.lang.annotation.Documented;
4
+import java.lang.annotation.ElementType;
5
+import java.lang.annotation.Retention;
6
+import java.lang.annotation.RetentionPolicy;
7
+import java.lang.annotation.Target;
8
+
9
+
10
+@Retention(RetentionPolicy.RUNTIME)
11
+@Target({ElementType.METHOD})
12
+@Documented
13
+public @interface ReportCustomer {
14
+    String type() default "" ;
15
+}

+ 171
- 0
src/main/java/com/huiju/estateagents/reportCustomerAop/ReportCustomerAspect.java Ver fichero

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

+ 169
- 0
src/main/java/com/huiju/estateagents/reportCustomerAop/ReportCustomerImpl.java Ver fichero

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

+ 2
- 1
src/main/java/com/huiju/estateagents/service/ITaLiveActivityService.java Ver fichero

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

+ 6
- 5
src/main/java/com/huiju/estateagents/service/ITaPersonService.java Ver fichero

@@ -4,6 +4,7 @@ import cn.binarywang.wx.miniapp.bean.WxMaUserInfo;
4 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.huiju.estateagents.base.ResponseBean;
6 6
 import com.huiju.estateagents.center.taUser.entity.TaUser;
7
+import com.huiju.estateagents.entity.TaCustomerFrom;
7 8
 import com.huiju.estateagents.entity.TaPerson;
8 9
 import com.baomidou.mybatisplus.extension.service.IService;
9 10
 import com.huiju.estateagents.entity.TaPersonBuilding;
@@ -115,9 +116,9 @@ public interface ITaPersonService extends IService<TaPerson> {
115 116
                    String openid,
116 117
                    String phone,
117 118
                    String buildingId,
118
-                   String sceneId,
119
-                   String targetType,
120
-                   String targetId,
121
-                   String targetName,
122
-                   String promoter) throws Exception;
119
+                   String promoter,
120
+                   String consultantPersonId,
121
+                   TaCustomerFrom customerFrom) throws Exception;
122
+
123
+    ResponseBean updateUserPhoto(String photoUrl, String openId);
123 124
 }

+ 36
- 0
src/main/java/com/huiju/estateagents/service/ITaQrcodeService.java Ver fichero

@@ -0,0 +1,36 @@
1
+package com.huiju.estateagents.service;
2
+
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.huiju.estateagents.base.ResponseBean;
5
+import com.huiju.estateagents.entity.TaPerson;
6
+import com.huiju.estateagents.entity.TaPersonBuilding;
7
+import com.huiju.estateagents.entity.TaQrcode;
8
+import com.baomidou.mybatisplus.extension.service.IService;
9
+import org.springframework.web.bind.annotation.RequestParam;
10
+
11
+import javax.servlet.http.HttpServletRequest;
12
+import javax.servlet.http.HttpServletResponse;
13
+import java.io.IOException;
14
+import java.util.List;
15
+
16
+/**
17
+ * <p>
18
+ * 二维码管理表 服务类
19
+ * </p>
20
+ *
21
+ * @author fxf
22
+ * @since 2020-05-20
23
+ */
24
+public interface ITaQrcodeService extends IService<TaQrcode> {
25
+
26
+    ResponseBean listQrCodeByCondition(Integer pageNum, Integer pageSize, String targetType, String targetName, Integer channelId,
27
+                                       String buildingId, Integer userId, Integer orgId, List<TaPersonBuilding> personBuildingList);
28
+
29
+    ResponseBean saveQrcode(TaQrcode taQrcode, Integer userId, Integer orgId);
30
+
31
+    ResponseBean getStatisticData(Integer qrCodeId, Integer orgId);
32
+
33
+    ResponseBean getStatisticRecord(Integer type, Integer pageNum, Integer pageSize, Integer qrCodeId, Integer orgId);
34
+
35
+    void getStatisticRecordExport(Integer type, Integer qrCodeId, Integer orgId, HttpServletResponse response) throws IOException;
36
+}

+ 14
- 3
src/main/java/com/huiju/estateagents/service/ITaRecommendCustomerService.java Ver fichero

@@ -4,9 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
4 4
 import com.baomidou.mybatisplus.extension.service.IService;
5 5
 import com.huiju.estateagents.base.ResponseBean;
6 6
 import com.huiju.estateagents.center.taUser.entity.TaUser;
7
-import com.huiju.estateagents.entity.TaPerson;
8
-import com.huiju.estateagents.entity.TaPersonBuilding;
9
-import com.huiju.estateagents.entity.TaRecommendCustomer;
7
+import com.huiju.estateagents.entity.*;
10 8
 import com.huiju.estateagents.excel.AgentsRecommendCustomer;
11 9
 import com.huiju.estateagents.excel.ExcelRecommendCustomer;
12 10
 import com.huiju.estateagents.excel.ReporRecommendCustomer;
@@ -177,4 +175,17 @@ public interface ITaRecommendCustomerService extends IService<TaRecommendCustome
177 175
      * @return
178 176
      */
179 177
     List<TaRecommendCustomer> getConsultantCustomerList(Integer userId, String personId, String buildingId, Integer orgId, List<TaPersonBuilding> taPersonBuildingListByUserId);
178
+
179
+    /**
180
+     * 生成新客户信息
181
+     * @param orgId
182
+     * @param person
183
+     * @param recommender
184
+     * @param consultant
185
+     * @param building
186
+     * @param from
187
+     * @return
188
+     * @throws Exception
189
+     */
190
+    List<TaRecommendCustomer> newCustomer(Integer orgId, TaPerson person, TaPerson recommender, TaPerson consultant, TaBuilding building, TaCustomerFrom from) throws Exception;
180 191
 }

+ 106
- 0
src/main/java/com/huiju/estateagents/service/TaChannelService.java Ver fichero

@@ -1,6 +1,16 @@
1 1
 package com.huiju.estateagents.service;
2
+
2 3
 import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.huiju.estateagents.base.ResponseBean;
3 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;
11
+
12
+import java.time.LocalDate;
13
+import java.util.List;
4 14
 
5 15
 /**
6 16
  * <p>
@@ -12,4 +22,100 @@ import com.huiju.estateagents.entity.TaChannel;
12 22
  */
13 23
 public interface TaChannelService extends IService<TaChannel> {
14 24
 
25
+    /**
26
+     * 渠道引进客户统计
27
+     * @param pageNum
28
+     * @param pageSize
29
+     * @param orgId
30
+     * @param startDate
31
+     * @param endDate
32
+     * @param channelType
33
+     * @param buildingId
34
+     * @return
35
+     */
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);
37
+
38
+    /**
39
+     * 获取注册用户列表
40
+     * @param pageNum
41
+     * @param pageSize
42
+     * @param orgId
43
+     * @param channelId
44
+     * @param targetId
45
+     * @param targetType
46
+     * @param buildingId
47
+     * @return
48
+     */
49
+    ResponseBean getNewuserList(Integer pageNum, Integer pageSize, Integer orgId, Integer channelId, String targetId, String targetType, String buildingId, LocalDate startDate, LocalDate endDate);
50
+
51
+    /**
52
+     * 获取渠道下的访问次数列表
53
+     * @param pageNum
54
+     * @param pageSize
55
+     * @param orgId
56
+     * @param channelId
57
+     * @param targetId
58
+     * @param targetType
59
+     * @param buildingId
60
+     * @return
61
+     */
62
+    ResponseBean getVisitNumList(Integer pageNum, Integer pageSize, Integer orgId, Integer channelId, String targetId, String targetType, String buildingId, LocalDate startDate, LocalDate endDate);
63
+
64
+    /**
65
+     * 获取渠道下的访问人数列表
66
+     * @param pageNum
67
+     * @param pageSize
68
+     * @param orgId
69
+     * @param channelId
70
+     * @param targetId
71
+     * @param targetType
72
+     * @param buildingId
73
+     * @return
74
+     */
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);
15 121
 }

+ 6
- 1
src/main/java/com/huiju/estateagents/service/impl/ExtendContentServiceImpl.java Ver fichero

@@ -174,7 +174,7 @@ public class ExtendContentServiceImpl extends ServiceImpl<ExtendContentMapper, E
174 174
 
175 175
     @Override
176 176
     public boolean advertistExistFlag(ExtendContent extendContent, Integer orgId) {
177
-        //一个城市只能有一个开屏广告
177
+        //一个城市、项目只能有一个开屏广告
178 178
         if (extendContent.getStatus() == 1 && CommConstant.OPEN_SCREEN.equals(extendContent.getShowType())){
179 179
             QueryWrapper<ExtendContent> taExtendContentQueryWrapper = new QueryWrapper<>();
180 180
             if (extendContent.getCityId() == null){
@@ -187,9 +187,14 @@ 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
             }
194
+//            taExtendContentQueryWrapper.eq(StringUtils.isNotBlank(String.valueOf(extendContent.getIsHaveActive())), "is_have_active", extendContent.getIsHaveActive());
195
+            if (null != extendContent.getIsHaveActive() && CommConstant.BANNER_BUILDING.equals(extendContent.getShowPosition())){
196
+                taExtendContentQueryWrapper.eq(StringUtils.isNotBlank(extendContent.getBuildingId()), "building_id", extendContent.getBuildingId());
197
+            }
193 198
             List<ExtendContent> extContentInfo = extendContentMapper.selectList(taExtendContentQueryWrapper);
194 199
             if (!Collections.isEmpty(extContentInfo)){
195 200
                 return false;

+ 13
- 3
src/main/java/com/huiju/estateagents/service/impl/MiniAppServiceImpl.java Ver fichero

@@ -335,15 +335,21 @@ public class MiniAppServiceImpl implements IMiniAppService {
335 335
         String scene = params.getString("scene");
336 336
         String page = StringUtils.ifNull(params.getString("page"), "");
337 337
         Integer width = params.getInteger("width");
338
-        if (null == width) width = 430;
338
+        if (null == width) {
339
+            width = 430;
340
+        }
339 341
 
340 342
         Boolean autoColor = params.getBoolean("auto_color");
341
-        if (null == autoColor) autoColor = false;
343
+        if (null == autoColor) {
344
+            autoColor = false;
345
+        }
342 346
 
343 347
         String lineColorStr = StringUtils.ifNull(params.getString("line_color"), "{\"r\":0,\"g\":0,\"b\":0}");
344 348
         WxMaCodeLineColor lineColor = JSONObject.parseObject(lineColorStr, WxMaCodeLineColor.class);
345 349
         Boolean isHyaline = params.getBoolean("is_hyaline");
346
-        if (null == isHyaline) isHyaline = true;
350
+        if (null == isHyaline) {
351
+            isHyaline = true;
352
+        }
347 353
 
348 354
         try {
349 355
 
@@ -352,6 +358,10 @@ public class MiniAppServiceImpl implements IMiniAppService {
352 358
             taQrcode.setCreateDate(LocalDateTime.now());
353 359
             taQrcode.setExpireDate(LocalDateTime.now().plusDays(7));
354 360
             taQrcode.setQrParams(paramsStr);
361
+            if (scene.indexOf("&qrCodeId=") > -1) {
362
+                String str = scene.substring(scene.indexOf("&qrCodeId=") + 10);
363
+                taQrcode.setTargetId(Integer.parseInt(str.substring(0, str.indexOf("&"))));
364
+            }
355 365
 
356 366
             boolean success = taMiniappQrcodeMapper.insert(taQrcode) > 0;
357 367
             if (!success) {

+ 15
- 1
src/main/java/com/huiju/estateagents/service/impl/TaBuildingServiceImpl.java Ver fichero

@@ -123,6 +123,9 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
123 123
     @Autowired
124 124
     private ITaRaiseInviteService iTaRaiseInviteService;
125 125
 
126
+    @Autowired
127
+    private IExtendContentService iExtendContentService;
128
+
126 129
     @Override
127 130
     public ResponseBean buildingList(Integer pageNum, Integer pageSize, String name, String code, LocalDateTime startDate, String buildingStatus, String marketStatus, Integer cityId, Integer isMain, Integer orgId, List<TaPersonBuilding> taPersonBuildingList) {
128 131
         Page<TaBuilding> page = new Page<>();
@@ -227,7 +230,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
227 230
     }
228 231
 
229 232
     @Override
230
-    public ResponseBean buildingAllSelectId(String id, TaPerson person, Integer orgId) {
233
+    public ResponseBean      buildingAllSelectId(String id, TaPerson person, Integer orgId) {
231 234
         // 查询基础信息
232 235
         QueryWrapper<TaBuilding> buildingtWrapper = new QueryWrapper<>();
233 236
         buildingtWrapper.lambda().gt(TaBuilding::getStatus, -1);
@@ -343,6 +346,17 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
343 346
         salesBatchQueryWrapper.lambda().eq(TaSalesBatch::getStatus, CommConstant.STATUS_NORMAL);
344 347
         List<TaSalesBatch> taSalesBatch = iTaSalesBatchService.list(salesBatchQueryWrapper);
345 348
 
349
+        // 查询关联项目的开屏广告
350
+        QueryWrapper<ExtendContent> taExtendContentQueryWrapper = new QueryWrapper<>();
351
+        taExtendContentQueryWrapper.eq("status", CommConstant.STATUS_NORMAL);
352
+        taExtendContentQueryWrapper.eq("building_id", id);
353
+        taExtendContentQueryWrapper.eq("org_id", orgId);
354
+        taExtendContentQueryWrapper.eq("show_type", CommConstant.OPEN_SCREEN);
355
+        taExtendContentQueryWrapper.eq("show_position", CommConstant.BANNER_BUILDING);
356
+        List<ExtendContent> taExtendContents = iExtendContentService.list(taExtendContentQueryWrapper);
357
+        building.setExtendContent(taExtendContents);
358
+
359
+
346 360
         List<TaSalesBatch> resultSalesBatchList = new ArrayList<>();
347 361
         taSalesBatch.stream().forEach(record -> {
348 362
             // 查询批次下认筹是否开启邀请制

+ 203
- 0
src/main/java/com/huiju/estateagents/service/impl/TaChannelServiceImpl.java Ver fichero

@@ -1,10 +1,25 @@
1 1
 package com.huiju.estateagents.service.impl;
2
+
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
2 5
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
6
+import com.huiju.estateagents.base.ResponseBean;
7
+import com.huiju.estateagents.common.StringUtils;
3 8
 import com.huiju.estateagents.entity.TaChannel;
9
+import com.huiju.estateagents.entity.TaPersonBuilding;
10
+import com.huiju.estateagents.entity.TsActivityDaily;
11
+import com.huiju.estateagents.excel.ActivityStatistics.ChannelAddRegistNum;
12
+import com.huiju.estateagents.excel.ActivityStatistics.ChannelVisitNum;
13
+import com.huiju.estateagents.excel.ActivityStatistics.ChannelVisitPersonNum;
14
+import com.huiju.estateagents.excel.ActivityStatistics.TsChannelDaily;
4 15
 import com.huiju.estateagents.mapper.TaChannelMapper;
5 16
 import com.huiju.estateagents.service.TaChannelService;
17
+import org.springframework.beans.factory.annotation.Autowired;
6 18
 import org.springframework.stereotype.Service;
7 19
 
20
+import java.time.LocalDate;
21
+import java.util.List;
22
+
8 23
 /**
9 24
  * <p>
10 25
  *   服务实现类
@@ -16,4 +31,192 @@ import org.springframework.stereotype.Service;
16 31
 @Service
17 32
 public class TaChannelServiceImpl extends ServiceImpl<TaChannelMapper, TaChannel> implements TaChannelService {
18 33
 
34
+    @Autowired
35
+    private TaChannelMapper taChannelMapper;
36
+
37
+    /**
38
+     * 渠道引进客户统计
39
+     *
40
+     * @param pageNum
41
+     * @param pageSize
42
+     * @param orgId
43
+     * @param startDate
44
+     * @param endDate
45
+     * @param channelType
46
+     * @param buildingId
47
+     * @return
48
+     */
49
+    @Override
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) {
51
+        IPage<TsActivityDaily> pg = new Page<>(pageNum, pageSize);
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);
63
+        List<TsActivityDaily> records = data.getRecords();
64
+        records.forEach(e -> {
65
+            List<ChannelVisitPersonNum> channelPersonNumListExport = taChannelMapper.getChannelPersonNumListExport(orgId, channelId, e.getTargetId(), e.getTargetType(), buildingId, startDate, endDate);
66
+            e.setVisitPersons(channelPersonNumListExport.size());
67
+        });
68
+        return ResponseBean.success(data);
69
+    }
70
+
71
+    /**
72
+     * 获取注册用户列表
73
+     *
74
+     * @param pageNum
75
+     * @param pageSize
76
+     * @param orgId
77
+     * @param channelId
78
+     * @param targetId
79
+     * @param targetType
80
+     * @param buildingId
81
+     * @return
82
+     */
83
+    @Override
84
+    public ResponseBean getNewuserList(Integer pageNum, Integer pageSize, Integer orgId, Integer channelId, String targetId, String targetType, String buildingId, LocalDate startDate, LocalDate endDate) {
85
+        IPage<ChannelAddRegistNum> iPage = new Page<>(pageNum, pageSize);
86
+        IPage<ChannelAddRegistNum> data = taChannelMapper.getChannelNewuserList(iPage, orgId, channelId, targetId,targetType, buildingId,startDate,endDate);
87
+        return ResponseBean.success(data);
88
+    }
89
+
90
+    /**
91
+     * 获取渠道下的访问次数列表
92
+     *
93
+     * @param pageNum
94
+     * @param pageSize
95
+     * @param orgId
96
+     * @param channelId
97
+     * @param targetId
98
+     * @param targetType
99
+     * @param buildingId
100
+     * @return
101
+     */
102
+    @Override
103
+    public ResponseBean getVisitNumList(Integer pageNum, Integer pageSize, Integer orgId, Integer channelId, String targetId, String targetType, String buildingId, LocalDate startDate, LocalDate endDate) {
104
+        IPage<ChannelVisitNum> iPage = new Page<>(pageNum, pageSize);
105
+        IPage<ChannelVisitNum> data = taChannelMapper.getChannelVisitNumList(iPage, orgId, channelId, targetId, targetType, buildingId,startDate,endDate);
106
+        return ResponseBean.success(data);
107
+    }
108
+
109
+    /**
110
+     * 获取渠道下的访问人数列表
111
+     *
112
+     * @param pageNum
113
+     * @param pageSize
114
+     * @param orgId
115
+     * @param channelId
116
+     * @param targetId
117
+     * @param targetType
118
+     * @param buildingId
119
+     * @return
120
+     */
121
+    @Override
122
+    public ResponseBean getPersonNumList(Integer pageNum, Integer pageSize, Integer orgId, Integer channelId, String targetId, String targetType, String buildingId, LocalDate startDate, LocalDate endDate) {
123
+        IPage<ChannelVisitPersonNum> iPage = new Page<>(pageNum, pageSize);
124
+        IPage<ChannelVisitPersonNum> data = taChannelMapper.getChannelPersonNumList(iPage, orgId, channelId, targetId, targetType, buildingId,startDate,endDate);
125
+        return ResponseBean.success(data);
126
+    }
127
+
128
+    /**
129
+     * 导出
130
+     *
131
+     * @param orgId
132
+     * @param startDate
133
+     * @param endDate
134
+     * @param channelType
135
+     * @param buildingId
136
+     * @param channelId
137
+     * @return
138
+     */
139
+    @Override
140
+    public List<TsChannelDaily> getChannelIntroductionListExport(Integer orgId, LocalDate startDate, LocalDate endDate, String channelType, String buildingId, Integer channelId, List<TaPersonBuilding> taPersonBuildings) {
141
+        List<TsChannelDaily> channelIntroductionListExport = taChannelMapper.getChannelIntroductionListExport(orgId, startDate, endDate, channelType, buildingId, channelId,taPersonBuildings);
142
+        channelIntroductionListExport.forEach(e -> {
143
+            List<ChannelVisitPersonNum> channelPersonNumListExport = taChannelMapper.getChannelPersonNumListExport(orgId, channelId, e.getTargetId(), e.getTargetType(), buildingId, startDate, endDate);
144
+            e.setVisitPersons(channelPersonNumListExport.size());
145
+
146
+            String message = "";
147
+            switch (e.getTargetType()){
148
+                case "building":
149
+                    message = "项目";
150
+                    break;
151
+                case "activity":
152
+                    message = "常规活动";
153
+                    break;
154
+                case "help":
155
+                    message = "助力活动";
156
+                    break;
157
+                case "group":
158
+                    message = "拼团活动";
159
+                    break;
160
+                case "h5":
161
+                    message = "H5活动";
162
+                    break;
163
+                case "live":
164
+                    message = "直播活动";
165
+                    break;
166
+                case "news":
167
+                    message = "资讯";
168
+                    break;
169
+                case "house":
170
+                    message = "在线选房";
171
+                    break;
172
+            }
173
+            e.setTargetType(message);
174
+        });
175
+        return channelIntroductionListExport;
176
+    }
177
+
178
+    /**
179
+     * 导出
180
+     *
181
+     * @param orgId
182
+     * @param channelId
183
+     * @param targetId
184
+     * @param targetType
185
+     * @param buildingId
186
+     * @return
187
+     */
188
+    @Override
189
+    public List<ChannelAddRegistNum> getNewuserListExport(Integer orgId, Integer channelId, String targetId, String targetType, String buildingId, LocalDate startDate, LocalDate endDate) {
190
+        return taChannelMapper.getChannelNewuserListExport(orgId, channelId, targetId,targetType, buildingId,startDate,endDate);
191
+    }
192
+
193
+    /**
194
+     * 导出
195
+     *
196
+     * @param orgId
197
+     * @param channelId
198
+     * @param targetId
199
+     * @param targetType
200
+     * @param buildingId
201
+     * @return
202
+     */
203
+    @Override
204
+    public List<ChannelVisitNum> getVisitNumListExport(Integer orgId, Integer channelId, String targetId, String targetType, String buildingId, LocalDate startDate, LocalDate endDate) {
205
+        return taChannelMapper.getChannelVisitNumListExport(orgId, channelId, targetId, targetType, buildingId,startDate,endDate);
206
+    }
207
+
208
+    /**
209
+     * 导出
210
+     *
211
+     * @param orgId
212
+     * @param channelId
213
+     * @param targetId
214
+     * @param targetType
215
+     * @param buildingId
216
+     * @return
217
+     */
218
+    @Override
219
+    public List<ChannelVisitPersonNum> getPersonNumListExport(Integer orgId, Integer channelId, String targetId, String targetType, String buildingId, LocalDate startDate, LocalDate endDate) {
220
+        return taChannelMapper.getChannelPersonNumListExport(orgId, channelId, targetId, targetType, buildingId,startDate,endDate);
221
+    }
19 222
 }

+ 5
- 5
src/main/java/com/huiju/estateagents/service/impl/TaLiveActivityServiceImpl.java Ver fichero

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

+ 71
- 100
src/main/java/com/huiju/estateagents/service/impl/TaPersonServiceImpl.java Ver fichero

@@ -1,5 +1,6 @@
1 1
 package com.huiju.estateagents.service.impl;
2 2
 
3
+import ch.qos.logback.core.pattern.util.RegularEscapeUtil;
3 4
 import cn.binarywang.wx.miniapp.bean.WxMaUserInfo;
4 5
 import com.alibaba.fastjson.JSONObject;
5 6
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -310,6 +311,9 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
310 311
             }
311 312
             //获取楼盘信息
312 313
             taBuilding = taBuildingMapper.selectById(buildingList.get(0).getBuildingId());
314
+            if (null == taBuilding) {
315
+                taBuilding = new TaBuilding();
316
+            }
313 317
         }
314 318
 
315 319
         Map<String, Object> result = new HashMap<>();
@@ -412,13 +416,17 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
412 416
         }
413 417
 
414 418
         TaPerson taPerson = taPersons.get(0);
419
+        QueryWrapper<TaUser> taUserQueryWrapper = new QueryWrapper<>();
420
+        taUserQueryWrapper.eq("user_id", taPerson.getUserId());
421
+        TaUser taUser = taUserMapper.selectOne(taUserQueryWrapper);
422
+
415 423
         Map<String, Object> result = new HashMap<>();
416 424
         result.put("id", taPerson.getPersonId());
417 425
         result.put("name", taPerson.getName());
418 426
         result.put("liked", false);
419 427
         result.put("unReadNum", 0);
420 428
         result.put("nickname", taPerson.getNickname());
421
-        result.put("avatar", taPerson.getAvatarurl());
429
+        result.put("avatar", taUser == null ? taPerson.getAvatarurl() : taUser.getPhoto());
422 430
         result.put("sex", taPerson.getSex());
423 431
         result.put("phone",StringUtils.ifNull(taPerson.getTel(),taPerson.getPhone()) );
424 432
         result.put("points", taPerson.getPoints());
@@ -547,7 +555,7 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
547 555
     @Override
548 556
     public TaPerson newPersonByOpenid(String openid,Integer orgId) {
549 557
         List<TaPerson> taPersons = getPersonsByOpenId(openid);
550
-        if (null == taPersons || taPersons.size() != 1) {
558
+        if (null == taPersons || taPersons.size() == 0) {
551 559
             TaPerson taPerson = new TaPerson();
552 560
             taPerson.setMiniOpenid(openid);
553 561
             taPerson.setNickname("匿名用户");
@@ -880,139 +888,84 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
880 888
      * @param openid
881 889
      * @param phone
882 890
      * @param buildingId
883
-     * @param sceneId
884
-     * @param targetType
885
-     * @param targetId
886
-     * @param targetName
887 891
      * @param promoter
892
+     * @param customerFrom
888 893
      * @throws Exception
889 894
      */
890 895
     @Override
891
-    public void authPhone(Integer orgId, String openid, String phone, String buildingId, String sceneId, String targetType, String targetId, String targetName, String promoter) throws Exception {
892
-        log.info("orgId={},openid={},phone={},buildingId={},sceneId={},targetType={},targetId={},targetName={},promoter={}",
893
-                orgId,openid,phone,buildingId,sceneId,targetType,targetId,targetName,promoter);
896
+    public void authPhone(Integer orgId,
897
+                          String openid,
898
+                          String phone,
899
+                          String buildingId,
900
+                          String promoter,
901
+                          String consultantPersonId,
902
+                          TaCustomerFrom customerFrom) throws Exception {
903
+        log.info("orgId={},openid={},phone={},buildingId={},promoter={}, customerFrom={}",
904
+                orgId,openid,phone,buildingId,promoter, JSONObject.toJSONString(customerFrom));
894 905
         //
895 906
         LocalDateTime now = LocalDateTime.now();
896 907
 
897
-        // 更新人员手机号
908
+        // 当前人员
898 909
         List<TaPerson> persons = getPersonsByOpenId(openid);
899 910
         if (null == persons || persons.size() != 1) {
900 911
             throw new Exception("当前人员 openid 异常");
901 912
         }
902 913
         TaPerson person = persons.get(0);
914
+        // 更新手机号
903 915
         person.setPhone(phone);
916
+        // 更新授权时间
904 917
         person.setAuthPhoneTime(now);
905 918
         if (StringUtils.isEmpty(person.getBuildingId())) {
919
+            // 更新楼盘
906 920
             person.setBuildingId(buildingId);
907 921
         }
908 922
         if (CommConstant.PERSON_ESTATE_DRIFT.equals(person.getPersonType())) {
923
+            // 更新人员身份
909 924
             person.setPersonType(CommConstant.PERSON_ESTATE_CUSTOMER);
910 925
         }
926
+        if (null != customerFrom.getChannelId() && null == person.getChannelId()) {
927
+            // 更新渠道
928
+            person.setChannelId(customerFrom.getChannelId());
929
+        }
930
+        if (null != customerFrom.getQrCodeId() && null == person.getQrCodeId()) {
931
+            // 更新推广码
932
+            person.setQrCodeId(customerFrom.getQrCodeId());
933
+        }
911 934
         updateById(person);
912 935
 
913
-        // 只要授权手机号, 就是客户
914
-        // 或者 依据手机号反更新推荐客户中 person_id
915
-        // 默认场景, 普通人推荐
916
-        TaRecommendCustomer customer = newOrFixCustomerBy(person, promoter, buildingId);
917
-
918
-        // 发放积分
919
-        applicationContext.publishEvent(new EventBus(person, EventBus.EventType.SignUpAgent, orgId));
920
-
921
-        //授权手机给推广人加积分
922
-        String sharePersonId = getSharePersonFrom(person);
923
-        if (validateSceneId(sceneId) && !StringUtils.isEmpty(sharePersonId)){
924
-            applicationContext.publishEvent(new EventBus(promoter != null ? promoter : sharePersonId, EventBus.EventType.SharePosterAll, orgId));
925
-        }
936
+        // 关联推荐客户
937
+        fixCustomerPersonId(person);
926 938
 
927 939
         // 客户来源
928
-        TaCustomerFrom customerFrom = new TaCustomerFrom();
929 940
         customerFrom.setPersonId(person.getPersonId());
930 941
         customerFrom.setPersonName(StringUtils.ifNull(person.getName(), person.getNickname()));
931
-        customerFrom.setCustomerId(customer.getCustomerId());
932
-        customerFrom.setTargetType(targetType);
933
-        customerFrom.setTargetId(targetId);
934
-        customerFrom.setTargetName(targetName);
935
-        customerFrom.setOrgId(orgId);
936
-        customerFrom.setSceneId(sceneId);
937
-        customerFrom.setIsOrgFirst(true);   // 授权手机号, 肯定是第一次
938
-        customerFrom.setIsProjectFirst(false);
939 942
         customerFrom.setCreateDate(now);
940 943
 
941 944
         // 推广人
942 945
         TaPerson recPerson = StringUtils.isEmpty(promoter) ? null : taPersonMapper.getById(promoter);
943
-        // 是否置业顾问
944
-        boolean isConsultant = null != recPerson && CommConstant.PERSON_REALTY_CONSULTANT.equals(recPerson.getPersonType());
945
-        // 推广人授权的楼盘
946
-        List<String> withBuildings = isConsultant ? taUserMapper.getBuildingIdsOf(recPerson.getUserId(), null) : null;
947 946
         // 推荐楼盘
948
-        TaBuilding recBuilding = StringUtils.isEmpty(buildingId) ? null : taBuildingMapper.selectById(buildingId);
949
-
950
-        // 传入的楼盘与推广人是否有关联关系
951
-        boolean isAssociated = null != withBuildings && withBuildings.contains(buildingId);
952
-
953
-        // 如果有推荐楼盘
954
-        if (null != recBuilding) {
955
-            customerFrom.setBuildingId(buildingId);
956
-            customerFrom.setBuildingName(recBuilding.getBuildingName());
957
-            customerFrom.setIsProjectFirst(true);
958
-
959
-            // 客户没楼盘 - 小程序级别公客, 则变成项目级别公客
960
-            if (StringUtils.isEmpty(customer.getBuildingId())) {
961
-                customer.setBuildingId(buildingId);
962
-
963
-                // 如果项目跟推广人是关联关系, 那么就是私客
964
-                if (isAssociated) {
965
-                    customer.setRealtyConsultant(recPerson.getUserId().toString());
966
-                }
967
-
968
-                taRecommendCustomerMapper.updateById(customer);
969
-            }
970
-        }
947
+        TaBuilding building = StringUtils.isEmpty(buildingId) ? null : taBuildingMapper.selectById(buildingId);
948
+        // 置业顾问
949
+        boolean isConsultant = null != recPerson && CommConstant.PERSON_REALTY_CONSULTANT.equals(recPerson.getPersonType());
950
+        TaPerson consultant = null != consultantPersonId ? getById(consultantPersonId) : (isConsultant ? recPerson : null);
971 951
 
972
-        // 推荐人不为空
973
-        if (null != recPerson) {
974
-            customerFrom.setSharePersonId(recPerson.getPersonId());
975
-            customerFrom.setSharePersonName(recPerson.getNickname());
976
-
977
-            // 如果没有关联关系
978
-            // 置业顾问推荐其他楼盘, 那么需要生成该置业的私客
979
-            if (isConsultant && !isAssociated) {
980
-                String consultantBuildingId = null != withBuildings ? withBuildings.get(0) : null;
981
-                if (!StringUtils.isEmpty(consultantBuildingId)) {
982
-                    TaBuilding onsultantBuilding = taBuildingMapper.selectById(consultantBuildingId);
983
-                    TaRecommendCustomer newCustomer = copyByPerosn(person, new TaRecommendCustomer());
984
-                    newCustomer.setBuildingId(onsultantBuilding.getBuildingId());
985
-                    newCustomer.setRealtyConsultant(recPerson.getUserId().toString());
986
-                    newCustomer.setRecommendPerson(recPerson.getPersonId());
987
-                    newCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
988
-                    newCustomer.setStatus(CommConstant.CUSTOMER_REPORT);
989
-                    newCustomer.setEntryType(CommConstant.ENTRY_INPUT);
990
-                    newCustomer.setCreateDate(now);
991
-                    newCustomer.setReportDate(now);
992
-                    taRecommendCustomerMapper.insert(newCustomer);
993
-
994
-                    TaCustomerFrom customerFrom2 = new TaCustomerFrom();
995
-                    customerFrom2.setPersonId(person.getPersonId());
996
-                    customerFrom2.setPersonName(StringUtils.ifNull(person.getName(), person.getNickname()));
997
-                    customerFrom2.setCustomerId(newCustomer.getCustomerId());
998
-                    customerFrom2.setBuildingId(onsultantBuilding.getBuildingId());
999
-                    customerFrom2.setBuildingName(onsultantBuilding.getBuildingName());
1000
-                    customerFrom2.setSharePersonId(recPerson.getPersonId());
1001
-                    customerFrom2.setSharePersonName(recPerson.getNickname());
1002
-                    customerFrom2.setTargetType(targetType);
1003
-                    customerFrom2.setTargetId(targetId);
1004
-                    customerFrom2.setTargetName(targetName);
1005
-                    customerFrom2.setOrgId(orgId);
1006
-                    customerFrom2.setSceneId(sceneId);
1007
-                    customerFrom2.setIsOrgFirst(true);
1008
-                    customerFrom2.setIsProjectFirst(true);
1009
-                    customerFrom2.setCreateDate(now);
1010
-                    taCustomerFromMapper.insert(customerFrom2);
952
+        try {
953
+            List<TaRecommendCustomer> customerList = iTaRecommendCustomerService.newCustomer(orgId, person, recPerson, consultant, building, customerFrom);
954
+            if (customerList.size() > 0) {
955
+                // 发放积分
956
+                applicationContext.publishEvent(new EventBus(person, EventBus.EventType.SignUpAgent, orgId));
957
+
958
+                //授权手机给推广人加积分
959
+                String sharePersonId = getSharePersonFrom(person);
960
+                // 2020年5月29日 不清楚加场景限制的原因, 与芳芳讨论 先取消这个限制
961
+//                if (validateSceneId(customerFrom.getSceneId()) && !StringUtils.isEmpty(sharePersonId)){
962
+                if (!StringUtils.isEmpty(promoter) || !StringUtils.isEmpty(sharePersonId)){
963
+                    applicationContext.publishEvent(new EventBus(promoter != null ? promoter : sharePersonId, EventBus.EventType.SharePosterAll, orgId));
1011 964
                 }
1012 965
             }
966
+        } catch (Exception e) {
967
+            throw e;
1013 968
         }
1014
-
1015
-        taCustomerFromMapper.insert(customerFrom);
1016 969
     }
1017 970
 
1018 971
     private TaRecommendCustomer newOrFixCustomerBy(TaPerson person, String promoter, String buildingId) {
@@ -1322,4 +1275,22 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
1322 1275
     }
1323 1276
 
1324 1277
 
1278
+    @Override
1279
+    public ResponseBean updateUserPhoto(String photoUrl, String openId) {
1280
+        ResponseBean responseBean = new ResponseBean();
1281
+
1282
+        List<TaPerson> taPersons = getPersonsByOpenId(openId);
1283
+        if (null == taPersons || taPersons.size() != 1) {
1284
+            return ResponseBean.error("验证当前人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
1285
+        }
1286
+
1287
+        TaPerson taPerson = taPersons.get(0);
1288
+        TaUser taUser = new TaUser();
1289
+        taUser.setUserId(taPerson.getUserId());
1290
+        taUser.setPhoto(photoUrl);
1291
+
1292
+        taUserMapper.updateById(taUser);
1293
+        responseBean.addSuccess("修改成功");
1294
+        return responseBean;
1295
+    }
1325 1296
 }

+ 242
- 0
src/main/java/com/huiju/estateagents/service/impl/TaQrcodeServiceImpl.java Ver fichero

@@ -0,0 +1,242 @@
1
+package com.huiju.estateagents.service.impl;
2
+
3
+import com.alibaba.excel.EasyExcel;
4
+import com.alibaba.fastjson.JSONObject;
5
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
6
+import com.baomidou.mybatisplus.core.metadata.IPage;
7
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
8
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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;
12
+import com.huiju.estateagents.common.CommConstant;
13
+import com.huiju.estateagents.common.WxQrCodeUtils;
14
+import com.huiju.estateagents.entity.TaMiniapp;
15
+import com.huiju.estateagents.entity.TaPersonBuilding;
16
+import com.huiju.estateagents.entity.TaPersonVisitRecord;
17
+import com.huiju.estateagents.entity.TaQrcode;
18
+import com.huiju.estateagents.excel.QrCodeStatistics.QrCodeNewPersonNum;
19
+import com.huiju.estateagents.excel.QrCodeStatistics.QrCodeVisitNum;
20
+import com.huiju.estateagents.excel.QrCodeStatistics.QrCodeVisitPersonNum;
21
+import com.huiju.estateagents.mapper.TaMiniappMapper;
22
+import com.huiju.estateagents.mapper.TaQrcodeMapper;
23
+import com.huiju.estateagents.service.IMiniAppService;
24
+import com.huiju.estateagents.service.ITaQrcodeService;
25
+import org.apache.commons.collections.CollectionUtils;
26
+import org.apache.commons.lang3.StringUtils;
27
+import org.slf4j.Logger;
28
+import org.slf4j.LoggerFactory;
29
+import org.springframework.beans.factory.annotation.Autowired;
30
+import org.springframework.stereotype.Service;
31
+
32
+import javax.servlet.http.HttpServletResponse;
33
+import java.io.IOException;
34
+import java.net.URLEncoder;
35
+import java.time.LocalDateTime;
36
+import java.util.List;
37
+
38
+/**
39
+ * <p>
40
+ * 二维码管理表 服务实现类
41
+ * </p>
42
+ *
43
+ * @author fxf
44
+ * @since 2020-05-20
45
+ */
46
+@Service
47
+public class TaQrcodeServiceImpl extends ServiceImpl<TaQrcodeMapper, TaQrcode> implements ITaQrcodeService {
48
+
49
+    private Logger logger = LoggerFactory.getLogger(TaQrcodeServiceImpl.class);
50
+
51
+    @Autowired
52
+    private TaQrcodeMapper taQrcodeMapper;
53
+
54
+    @Autowired
55
+    private TaMiniappMapper taMiniappMapper;
56
+
57
+    @Autowired
58
+    private IMiniAppService iMiniAppService;
59
+
60
+    @Autowired
61
+    private TaUserServiceImpl taUserService;
62
+
63
+    /**
64
+     * 条件查询二维码列表
65
+     *
66
+     * @param pageNum
67
+     * @param pageSize
68
+     * @param targetType
69
+     * @param targetName
70
+     * @param channelId
71
+     * @param buildingId
72
+     * @param orgId
73
+     * @return
74
+     */
75
+    @Override
76
+    public ResponseBean listQrCodeByCondition(Integer pageNum, Integer pageSize, String targetType, String targetName, Integer channelId,
77
+                                              String buildingId, Integer userId, Integer orgId, List<TaPersonBuilding> personBuildingList) {
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
+
85
+        IPage<TaQrcode> pg = new Page<>(pageNum, pageSize);
86
+        responseBean.addSuccess(taQrcodeMapper.listQrCodeByCondition(pg, targetType, targetName, channelId, buildingId, userId, orgId, personBuildingList));
87
+        return responseBean;
88
+    }
89
+
90
+    /**
91
+     * 保存二维码信息
92
+     *
93
+     * @param taQrcode
94
+     * @param userId
95
+     * @param orgId
96
+     * @return
97
+     */
98
+    @Override
99
+    public ResponseBean saveQrcode(TaQrcode taQrcode, Integer userId, Integer orgId) {
100
+        ResponseBean responseBean = new ResponseBean();
101
+
102
+        // 校验是否已有相同的数据
103
+        QueryWrapper<TaQrcode> qrcodeQueryWrapper = new QueryWrapper<>();
104
+        qrcodeQueryWrapper.eq("org_id", orgId);
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
+        }
115
+        qrcodeQueryWrapper.eq("target_type", taQrcode.getTargetType());
116
+        qrcodeQueryWrapper.eq("target_id", taQrcode.getTargetId());
117
+        qrcodeQueryWrapper.gt("status", CommConstant.STATUS_DELETE);
118
+        List<TaQrcode> taQrCodeCheckList = taQrcodeMapper.selectList(qrcodeQueryWrapper);
119
+        if (CollectionUtils.isNotEmpty(taQrCodeCheckList)) {
120
+            responseBean.addError("请勿重复提交");
121
+            return responseBean;
122
+        }
123
+
124
+        // 保存数据
125
+        taQrcode.setOrgId(orgId);
126
+        taQrcode.setCreateUser(userId);
127
+        taQrcode.setCreateDate(LocalDateTime.now());
128
+        taQrcode.setStatus(CommConstant.STATUS_NORMAL);
129
+        if (!save(taQrcode)) {
130
+            responseBean.addError("fail");
131
+            return responseBean;
132
+        }
133
+
134
+        // 获取appId
135
+        QueryWrapper<TaMiniapp> taMiniappQuery = new QueryWrapper<>();
136
+        taMiniappQuery.eq("org_id", orgId);
137
+        TaMiniapp taMiniapp = taMiniappMapper.selectOne(taMiniappQuery);
138
+
139
+        // 生成二维码
140
+        String paramsStr = WxQrCodeUtils.generateSceneAndPage(taQrcode.getTargetType(), "",
141
+                taQrcode.getTargetId(), taQrcode.getTargetType(), String.valueOf(taQrcode.getChannelId()), String.valueOf(taQrcode.getQrCodeId()), taQrcode.getBuildingId());
142
+        ResponseBean qrCodeResult = iMiniAppService.getQrCode(paramsStr, taMiniapp.getMiniappId());
143
+        if (qrCodeResult != null && ResponseBean.CODE_SUCCESS == qrCodeResult.getCode()) {
144
+            // 更新数据
145
+            taQrcode.setQrCodeUrl((String) qrCodeResult.getData());
146
+            if (updateById(taQrcode)) {
147
+                responseBean.addSuccess(taQrcode);
148
+                return responseBean;
149
+            }
150
+        }
151
+        removeById(taQrcode.getQrCodeId());
152
+        responseBean.addError("fail");
153
+        return responseBean;
154
+    }
155
+
156
+    /**
157
+     * 获取二维码统计
158
+     *
159
+     * @param qrCodeId
160
+     * @param orgId
161
+     * @return
162
+     */
163
+    @Override
164
+    public ResponseBean getStatisticData(Integer qrCodeId, Integer orgId) {
165
+        ResponseBean responseBean = new ResponseBean();
166
+
167
+        // 获取二维码信息
168
+        TaQrcode taQrcode = taQrcodeMapper.selectById(qrCodeId);
169
+        if (taQrcode == null) {
170
+            responseBean.addError("fail");
171
+            return responseBean;
172
+        }
173
+
174
+        // 查询访问总人数
175
+        Integer visitPersons = taQrcodeMapper.getVisitPersons(qrCodeId, orgId);
176
+
177
+        // 查询访问总次数
178
+        Integer visitNum = taQrcodeMapper.getVisitNum(qrCodeId, orgId);
179
+
180
+        // 查询新增用户数
181
+        Integer newPersons = taQrcodeMapper.getNewPersons(qrCodeId, orgId);
182
+
183
+        // 组装反参
184
+        JSONObject resultObj = new JSONObject();
185
+        resultObj.put("visitPersons", visitPersons);
186
+        resultObj.put("visitNum", visitNum);
187
+        resultObj.put("newPersons", newPersons);
188
+        resultObj.put("qrCodeInfo", taQrcode);
189
+        responseBean.addSuccess(resultObj);
190
+        return responseBean;
191
+    }
192
+
193
+    @Override
194
+    public ResponseBean getStatisticRecord(Integer type, Integer pageNum, Integer pageSize, Integer qrCodeId, Integer orgId) {
195
+        ResponseBean responseBean = new ResponseBean();
196
+        IPage<TaPersonVisitRecord> pg = new Page<>(pageNum, pageSize);
197
+        switch (type) {
198
+            case 1:
199
+                responseBean.addSuccess(taQrcodeMapper.getVisitPersonsRecord(pg, qrCodeId, orgId));
200
+                break;
201
+            case 2:
202
+                responseBean.addSuccess(taQrcodeMapper.getVisitNumRecord(pg, qrCodeId, orgId));
203
+                break;
204
+            case 3:
205
+                responseBean.addSuccess(taQrcodeMapper.getNewPersonsRecord(pg, qrCodeId, orgId));
206
+                break;
207
+            default:
208
+                responseBean.addError("fail");
209
+                break;
210
+        }
211
+        return responseBean;
212
+    }
213
+
214
+    @Override
215
+    public void getStatisticRecordExport(Integer type, Integer qrCodeId, Integer orgId, HttpServletResponse response) throws IOException {
216
+        response.setContentType("application/octet-stream");
217
+        response.setCharacterEncoding("utf-8");
218
+        String fileName;
219
+        switch (type) {
220
+            case 1:
221
+                List<QrCodeVisitPersonNum> records = taQrcodeMapper.getVisitPersonsRecordExport(qrCodeId, orgId);
222
+                fileName = URLEncoder.encode("访问人数", "UTF-8");
223
+                response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
224
+                EasyExcel.write(response.getOutputStream(), QrCodeVisitPersonNum.class).sheet("访问人数").doWrite(records);
225
+                break;
226
+            case 2:
227
+                List<QrCodeVisitNum> records2 = taQrcodeMapper.getVisitNumRecordExport(qrCodeId, orgId);
228
+                fileName = URLEncoder.encode("访问次数", "UTF-8");
229
+                response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
230
+                EasyExcel.write(response.getOutputStream(), QrCodeVisitNum.class).sheet("访问次数").doWrite(records2);
231
+                break;
232
+            case 3:
233
+                List<QrCodeNewPersonNum> records3 = taQrcodeMapper.getNewPersonsRecordExport(qrCodeId, orgId);
234
+                fileName = URLEncoder.encode("新增注册用户", "UTF-8");
235
+                response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
236
+                EasyExcel.write(response.getOutputStream(), QrCodeNewPersonNum.class).sheet("新增注册用户").doWrite(records3);
237
+                break;
238
+            default:
239
+                break;
240
+        }
241
+    }
242
+}

+ 213
- 0
src/main/java/com/huiju/estateagents/service/impl/TaRecommendCustomerServiceImpl.java Ver fichero

@@ -29,12 +29,17 @@ import org.apache.commons.collections.CollectionUtils;
29 29
 import org.slf4j.Logger;
30 30
 import org.slf4j.LoggerFactory;
31 31
 import org.springframework.beans.factory.annotation.Autowired;
32
+import org.springframework.cglib.beans.BeanCopier;
32 33
 import org.springframework.stereotype.Service;
33 34
 
34 35
 import java.time.LocalDateTime;
36
+import java.util.ArrayList;
35 37
 import java.util.HashMap;
36 38
 import java.util.List;
37 39
 import java.util.Map;
40
+import java.util.stream.Collector;
41
+import java.util.stream.Collectors;
42
+import java.util.stream.Stream;
38 43
 
39 44
 /**
40 45
  * <p>
@@ -168,6 +173,213 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
168 173
         return taRecommendCustomerMapper.getConsultantCustomerList(userId, personId, buildingId, orgId);
169 174
     }
170 175
 
176
+    @Override
177
+    public List<TaRecommendCustomer> newCustomer(Integer orgId, TaPerson person, TaPerson recommender, TaPerson consultant, TaBuilding building, TaCustomerFrom from) throws Exception {
178
+        logger.info("newCustomer 接收参数:orgId:{},person:{},recommender:{},consultant:{},building:{},from:{}",
179
+                orgId, JSONObject.toJSONString(person), JSONObject.toJSONString(recommender), JSONObject.toJSONString(consultant), JSONObject.toJSONString(building), JSONObject.toJSONString(from));
180
+
181
+        // 如果置业推荐了非自己绑定楼盘, 会生成 2 条客户记录
182
+        List<TaRecommendCustomer> result = new ArrayList<>();
183
+        List<TaBuilding> consultBuildings = null;
184
+        List<String> consultBuildingIds = null;
185
+        if (null != consultant) {
186
+            consultBuildings = taPersonBuildingMapper.getBuildingsOf(consultant.getUserId().toString());
187
+            if (null != consultBuildings && consultBuildings.size() > 0) {
188
+                consultBuildingIds = consultBuildings.stream().map(TaBuilding::getBuildingId).collect(Collectors.toList());
189
+            }
190
+        }
191
+
192
+        //
193
+        LocalDateTime now = LocalDateTime.now();
194
+        from.setOrgId(orgId);
195
+        from.setPersonId(person.getPersonId());
196
+        from.setPersonName(StringUtils.ifNull(person.getName(), person.getNickname()));
197
+        from.setCreateDate(now);
198
+
199
+        Map<String, Number> checkNum = taRecommendCustomerMapper.checkCustomerBy(orgId, person.getPersonId(), consultBuildingIds, null != building ? building.getBuildingId() : null);
200
+        // 是否存在小程序客户记录
201
+        boolean hasOrgCust = checkNum.get("orgNum").intValue() > 0;
202
+        // 是否存在置业绑定的楼盘客户记录
203
+        boolean hasConsultBuildingCust = checkNum.get("consultBuildingNum").intValue() > 0;
204
+        // 是否存在置业绑定的楼盘私客记录
205
+        boolean hasConsultCust = checkNum.get("consultNum").intValue() > 0;
206
+        // 是否存在当前内容楼盘的客户记录
207
+        boolean hasBuildingCust = checkNum.get("buildingNum").intValue() > 0;
208
+
209
+        // 置业与内容楼盘是否有关联关系
210
+        boolean builingAssociated = false;
211
+
212
+        logger.info("newCustomer checkCustomer查询结果:hasOrgCust:{},hasConsultBuildingCust:{},hasConsultCust:{},hasBuildingCust:{}",
213
+                hasOrgCust, hasConsultBuildingCust, hasConsultCust, hasBuildingCust);
214
+
215
+        // 职业顾问不插入客户表
216
+        boolean personIsConsultant = CommConstant.PERSON_REALTY_CONSULTANT.equals(person.getPersonType()) ? true : false;
217
+        if (personIsConsultant) {
218
+            return result;
219
+        }
220
+
221
+        // 置业项目
222
+        if (null != consultant && CollectionUtils.isNotEmpty(consultBuildings) && !hasConsultCust) {
223
+            TaBuilding taBuilding = null;
224
+            if (consultBuildingIds.contains(null != building ? building.getBuildingId() : null)) {
225
+                taBuilding = building;
226
+                builingAssociated = true;
227
+            } else {
228
+                taBuilding = consultBuildings.get(0);
229
+            }
230
+
231
+            if (hasConsultBuildingCust) {
232
+                // 如果是项目公客
233
+                QueryWrapper<TaRecommendCustomer> taRecommendCustomerQueryWrapper = new QueryWrapper<>();
234
+                taRecommendCustomerQueryWrapper.eq("building_id", taBuilding.getBuildingId());
235
+                taRecommendCustomerQueryWrapper.gt("status", CommConstant.STATUS_DELETE);
236
+                taRecommendCustomerQueryWrapper.orderByAsc("create_date");
237
+                taRecommendCustomerQueryWrapper.last("limit 1");
238
+                TaRecommendCustomer taRecommendCustomer = taRecommendCustomerMapper.selectOne(taRecommendCustomerQueryWrapper);
239
+
240
+                taRecommendCustomer = copyFromPerosn(person, taRecommendCustomer);
241
+                taRecommendCustomer.setRealtyConsultant(consultant.getUserId().toString());
242
+                taRecommendCustomerMapper.updateById(taRecommendCustomer);
243
+                result.add(taRecommendCustomer);
244
+            } else {
245
+                // 如果没有任何置业及置业楼盘相关的数据, 则插入新记录
246
+                TaRecommendCustomer customer = copyFromPerosn(person, new TaRecommendCustomer());
247
+                fillSomeFieldsOfCustomer(customer, recommender, now);
248
+                customer.setBuildingId(taBuilding.getBuildingId());
249
+                customer.setBuildingName(taBuilding.getBuildingName());
250
+                customer.setRealtyConsultant(consultant.getUserId().toString());
251
+                taRecommendCustomerMapper.insert(customer);
252
+                result.add(customer);
253
+
254
+                // 是否首次进入标识
255
+                Boolean isFirstOrg = hasOrgCust;
256
+
257
+                // 如果非小程序公客, 即首次进入
258
+                if (!isFirstOrg) {
259
+                    // 如果分享内容的楼盘跟置业楼盘一致
260
+                    if (builingAssociated || null  == building ) {
261
+                        isFirstOrg = true;
262
+                    }
263
+                } else {
264
+                    isFirstOrg = false;
265
+                }
266
+
267
+                TaCustomerFrom customerFrom = copyPropertiesFrom(from);
268
+                customerFrom.setCustomerId(customer.getCustomerId());
269
+                customerFrom.setSharePersonId(recommender.getPersonId());
270
+                customerFrom.setSharePersonName(StringUtils.ifNull(recommender.getName(), recommender.getNickname()));
271
+                customerFrom.setBuildingId(taBuilding.getBuildingId());
272
+                customerFrom.setBuildingName(taBuilding.getBuildingName());
273
+                customerFrom.setIsOrgFirst(isFirstOrg);
274
+                customerFrom.setIsProjectFirst(true);
275
+                customerFrom.setCreateDate(now);
276
+                taCustomerFromMapper.insert(customerFrom);
277
+
278
+                if (isFirstOrg) {
279
+                    hasOrgCust = true;
280
+                }
281
+            }
282
+        }
283
+
284
+        // 项目公客
285
+        if (null != building && !hasBuildingCust && !builingAssociated) {
286
+            // 校验客户是否已经是该项目公客
287
+//            QueryWrapper<TaRecommendCustomer> customerQueryWrapper = new QueryWrapper<>();
288
+//            customerQueryWrapper.eq("org_id", orgId);
289
+//            customerQueryWrapper.eq("person_id", person.getPersonId());
290
+//            customerQueryWrapper.eq("building_id", building.getBuildingId());
291
+//            customerQueryWrapper.gt("status", CommConstant.STATUS_DELETE);
292
+//            customerQueryWrapper.orderByAsc("create_date");
293
+//            customerQueryWrapper.last("limit 1");
294
+//            TaRecommendCustomer customerCheck = taRecommendCustomerMapper.selectOne(customerQueryWrapper);
295
+//            if(customerCheck == null){
296
+            TaRecommendCustomer customer = copyFromPerosn(person, new TaRecommendCustomer());
297
+            fillSomeFieldsOfCustomer(customer, recommender, now);
298
+            customer.setBuildingId(building.getBuildingId());
299
+            taRecommendCustomerMapper.insert(customer);
300
+            result.add(customer);
301
+
302
+            // 是否首次进入标识
303
+            Boolean isFirstOrg = hasOrgCust;
304
+
305
+            TaCustomerFrom customerFrom = copyPropertiesFrom(from);
306
+            customerFrom.setCustomerId(customer.getCustomerId());
307
+            customerFrom.setSharePersonId(null == recommender ? null : recommender.getPersonId());
308
+            customerFrom.setSharePersonName(null == recommender ? null : StringUtils.ifNull(recommender.getName(), recommender.getNickname()));
309
+            customerFrom.setBuildingId(building.getBuildingId());
310
+            customerFrom.setBuildingName(building.getBuildingName());
311
+            customerFrom.setIsOrgFirst(!isFirstOrg);
312
+            customerFrom.setIsProjectFirst(true);
313
+            customerFrom.setCreateDate(now);
314
+            taCustomerFromMapper.insert(customerFrom);
315
+//            }
316
+
317
+            // 如果非小程序公客, 即首次进入
318
+            if (!isFirstOrg) {
319
+                hasOrgCust = true;
320
+            }
321
+        }
322
+
323
+        // 小程序公客
324
+        if (!hasOrgCust && null == consultant) {
325
+            TaRecommendCustomer customer = copyFromPerosn(person, new TaRecommendCustomer());
326
+            fillSomeFieldsOfCustomer(customer, recommender, now);
327
+            taRecommendCustomerMapper.insert(customer);
328
+            result.add(customer);
329
+
330
+            TaCustomerFrom customerFrom = copyPropertiesFrom(from);
331
+            customerFrom.setCustomerId(customer.getCustomerId());
332
+            customerFrom.setSharePersonId(null == recommender ? null : recommender.getPersonId());
333
+            customerFrom.setSharePersonName(null == recommender ? null : StringUtils.ifNull(recommender.getName(), recommender.getNickname()));
334
+            customerFrom.setIsOrgFirst(true);
335
+            customerFrom.setIsProjectFirst(false);
336
+            customerFrom.setCreateDate(now);
337
+            taCustomerFromMapper.insert(customerFrom);
338
+        }
339
+
340
+        return result;
341
+    }
342
+
343
+    private void fillSomeFieldsOfCustomer(TaRecommendCustomer customer, TaPerson recommender, LocalDateTime now) {
344
+        customer.setVerifyStatus(CommConstant.VERIFY_AGREE);
345
+        customer.setStatus(CommConstant.CUSTOMER_REPORT);
346
+        customer.setEntryType(null == recommender ? CommConstant.ENTRY_VOLUNTEER : CommConstant.ENTRY_INPUT);
347
+        customer.setCreateDate(now);
348
+        customer.setReportDate(now);
349
+//        customer.setRecommendPerson(null == recommender ? null : recommender.getPersonId());
350
+    }
351
+
352
+    private TaRecommendCustomer copyFromPerosn(TaPerson person, TaRecommendCustomer cust) {
353
+        cust.setPersonId(person.getPersonId());
354
+        cust.setName(StringUtils.ifNull(person.getName(), person.getNickname()));
355
+        cust.setSex(null == person.getSex() ? str2Int(person.getGender()) : person.getSex());
356
+        cust.setPhone(StringUtils.ifNull(person.getPhone(), person.getTel()));
357
+        cust.setPicture(StringUtils.ifNull(person.getAvatarurl(), person.getPhoto()));
358
+        cust.setCountry(person.getCountry());
359
+        cust.setCity(person.getCity());
360
+        cust.setProvince(person.getProvince());
361
+        cust.setOrgId(person.getOrgId());
362
+
363
+        return cust;
364
+    }
365
+
366
+    private TaCustomerFrom copyPropertiesFrom(TaCustomerFrom from) {
367
+        BeanCopier copier = BeanCopier.create(TaCustomerFrom.class, TaCustomerFrom.class, false);
368
+        TaCustomerFrom to = new TaCustomerFrom();
369
+        copier.copy(from, to, null);
370
+        return to;
371
+    }
372
+
373
+    public void delPubCust(String personId, String buildingId) {
374
+        TaRecommendCustomer recommendCustomer = new TaRecommendCustomer();
375
+        recommendCustomer.setStatus(CommConstant.STATUS_DELETE);
376
+
377
+        QueryWrapper<TaRecommendCustomer> taRecommendCustomerQueryWrapper = new QueryWrapper<>();
378
+        taRecommendCustomerQueryWrapper.eq("building_id", buildingId);
379
+        taRecommendCustomerQueryWrapper.eq("person_id", personId);
380
+        taRecommendCustomerMapper.update(recommendCustomer, taRecommendCustomerQueryWrapper);
381
+    }
382
+
171 383
     @Override
172 384
     public ResponseBean getCustDetail(String id) {
173 385
         TaRecommendCustomer taRecommendCustomer = taRecommendCustomerMapper.selectById(id);
@@ -1108,4 +1320,5 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
1108 1320
         taCustomerFollowUpRecord.setCustomerSex(taRecommendCustomer.getSex());
1109 1321
         customerFollowUpRecordMapper.insert(taCustomerFollowUpRecord);
1110 1322
     }
1323
+
1111 1324
 }

+ 3
- 3
src/main/java/com/huiju/estateagents/statistic/controller/ActivityStatisticController.java Ver fichero

@@ -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 Ver fichero

@@ -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 Ver fichero

@@ -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
     }

+ 1
- 1
src/main/java/com/huiju/estateagents/third/controller/TaThirdPartyMiniappConfigController.java Ver fichero

@@ -165,7 +165,7 @@ public class TaThirdPartyMiniappConfigController extends BaseController {
165 165
     }
166 166
 
167 167
     /**
168
-     * 第三方生成二维码
168
+     * 第三方生成
169 169
      * @return
170 170
      */
171 171
     @PostMapping("/third/qrcode")

+ 6
- 6
src/main/resources/log/logback-spring.xml Ver fichero

@@ -22,9 +22,9 @@
22 22
             <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
23 23
         </encoder>
24 24
         <!--日志文件最大的大小-->
25
-<!--        <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">-->
26
-<!--            <MaxFileSize>10MB</MaxFileSize>-->
27
-<!--        </triggeringPolicy>-->
25
+        <!--        <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">-->
26
+        <!--            <MaxFileSize>10MB</MaxFileSize>-->
27
+        <!--        </triggeringPolicy>-->
28 28
     </appender>
29 29
 
30 30
     <!-- 按照每天生成日志文件 -->
@@ -40,9 +40,9 @@
40 40
             <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
41 41
         </encoder>
42 42
         <!--日志文件最大的大小-->
43
-<!--                <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">-->
44
-<!--                    <MaxFileSize>1024MB</MaxFileSize>-->
45
-<!--                </triggeringPolicy>-->
43
+        <!--                <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">-->
44
+        <!--                    <MaxFileSize>1024MB</MaxFileSize>-->
45
+        <!--                </triggeringPolicy>-->
46 46
     </appender>
47 47
 
48 48
     <!--myibatis log configure-->

+ 397
- 0
src/main/resources/mapper/TaChannelMapper.xml Ver fichero

@@ -33,11 +33,14 @@
33 33
         c.*,
34 34
         count(tp.person_id) AS brokerCount,
35 35
         (SELECT COUNT(p.recommend_agent ) from ta_person p WHERE cp.person_id = p.recommend_agent) AS inviteCount,
36
+        IFNULL(ts.customerNum,0) as customerNum,
36 37
         cp.person_id
37 38
         FROM
38 39
         ta_channel c
39 40
         LEFT JOIN ta_channel_person cp ON c.channel_id = cp.channel_id
40 41
         LEFT JOIN ta_person tp ON cp.person_id = tp.person_id 	AND tp.person_type = 'estate agent' 	AND cp.STATUS = 1
42
+        LEFT JOIN (
43
+        SELECT sum(new_customers) as customerNum,qr_code_id,channel_id,org_id from ts_channel_daily where channel_id is not null and org_id = #{orgId} GROUP BY channel_id) ts on c.channel_id = ts.channel_id
41 44
         <where>
42 45
             <if test="channelId != null and channelId != ''">
43 46
                 c.channel_id = #{channelId}
@@ -65,4 +68,398 @@
65 68
         GROUP BY c.channel_id
66 69
     </select>
67 70
 
71
+    <select id="getChannelIntroductionList" resultType="com.huiju.estateagents.entity.TsActivityDaily">
72
+        SELECT
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
89
+        FROM
90
+            ts_channel_daily
91
+        WHERE
92
+            channel_id = #{channelId}
93
+        AND org_id = #{orgId}
94
+        <if test="startDate != null and endDate != null">
95
+            AND statis_date BETWEEN #{startDate} AND #{endDate}
96
+        </if>
97
+        <if test="channelType != null and channelType != ''">
98
+            and target_type = #{channelType}
99
+        </if>
100
+        <if test="buildingId != null and buildingId != ''">
101
+            and building_id = #{buildingId}
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>
113
+    </select>
114
+    <select id="getChannelNewuserList"
115
+            resultType="com.huiju.estateagents.excel.ActivityStatistics.ChannelAddRegistNum">
116
+        SELECT
117
+        a.nickname, a.phone,
118
+        if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
119
+        a.province,
120
+        t.create_date
121
+        FROM ta_customer_from t
122
+        left join ta_person a on t.person_id = a.person_id
123
+<!--        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-->
124
+<!--        left join td_wx_dict b1 on b.scene_id = b1.scene_id-->
125
+<!--        left join ta_recommend_customer c on c.person_id = t.person_id and c.realty_consultant is not null-->
126
+<!--        LEFT JOIN ta_user d ON c.realty_consultant = d.user_id-->
127
+<!--        LEFT JOIN ta_person e ON t.share_person_id = e.person_id-->
128
+        WHERE t.org_id = #{orgId}
129
+        and t.is_org_first = 1
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' )
132
+        <if test="activityId != null and activityId != ''">
133
+            and t.target_id = #{activityId}
134
+        </if>
135
+        <if test="activityType != null and activityType != ''">
136
+            and t.target_type = #{activityType}
137
+        </if>
138
+        <if test="buildingId != null and buildingId != ''">
139
+            and t.building_id = #{buildingId}
140
+        </if>
141
+        <if test="channelId != null and channelId != ''">
142
+            and t.channel_id = #{channelId}
143
+        </if>
144
+        group by t.person_id order by t.create_date desc
145
+    </select>
146
+    <select id="getChannelVisitNumList" resultType="com.huiju.estateagents.excel.ActivityStatistics.ChannelVisitNum">
147
+        select
148
+        a.nickname, a.phone,
149
+        if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
150
+        a.province,
151
+        b1.scene_alias as personFrom,
152
+        GROUP_CONCAT(d.user_name) as realtyConsultant,
153
+        GROUP_CONCAT(d.phone) as realtyConsultantPhone,
154
+        e.nickname as sharePersonName,
155
+        e.phone as sharePersonPhone,
156
+        t.visit_time as visitDate
157
+        From (
158
+        SELECT
159
+        t.person_id, t.visit_time, t.share_person_id
160
+        FROM
161
+        ta_person_visit_record t
162
+        WHERE
163
+        t.`event` in ( 'detail', 'house_list' , 'poster')
164
+        AND t.event_type IN (
165
+        'activity',
166
+        'help',
167
+        'group',
168
+        'h5',
169
+        'news',
170
+        'building',
171
+        'live',
172
+        'house'
173
+        )
174
+        <if test="targetId != null and targetId != ''">
175
+            and t.target_id = #{targetId}
176
+        </if>
177
+        <if test="targetType != null and targetType != ''">
178
+            and (case when #{targetType} = 'activity' then t.target_type = 'dynamic'
179
+                        when #{targetType} = 'h5' then t.event_type = 'h5'
180
+                        when #{targetType} = 'news' then t.event_type = 'news'
181
+                        when #{targetType} = 'building' then t.event_type = 'building'
182
+                        when #{targetType} = 'house' then t.event_type = 'house'
183
+            else t.target_type = #{targetType}
184
+            end)
185
+        </if>
186
+        <if test="channelId != null and channelId != ''">
187
+            and t.channel_id = #{channelId}
188
+        </if>
189
+        <if test="buildingId != null and buildingId != ''">
190
+            and t.building_id = #{buildingId}
191
+        </if>
192
+        AND t.org_id = #{orgId}
193
+        AND DATE_FORMAT(t.visit_time, '%Y-%m-%d' )  >= DATE_FORMAT(#{startDate}, '%Y-%m-%d')
194
+        AND DATE_FORMAT(t.visit_time, '%Y-%m-%d' )  &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
195
+        ) t
196
+        left join ta_person a on t.person_id = a.person_id
197
+        left join ta_person_from_record b on a.person_id = b.person_id and b.org_id = #{orgId}
198
+        left join td_wx_dict b1 on b.scene_id = b1.scene_id
199
+        LEFT JOIN ta_recommend_customer c on c.person_id = t.person_id
200
+        left join ta_user d on c.realty_consultant = d.user_id
201
+        left join ta_person e on t.share_person_id = e.person_id
202
+        group by t.visit_time
203
+        order by t.visit_time desc
204
+    </select>
205
+    <select id="getChannelPersonNumList"
206
+            resultType="com.huiju.estateagents.excel.ActivityStatistics.ChannelVisitPersonNum">
207
+        select
208
+        a.nickname, a.phone,
209
+        if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
210
+        a.province,
211
+        b1.scene_alias as personFrom,
212
+        GROUP_CONCAT(d.user_name) as realtyConsultant,
213
+        GROUP_CONCAT(d.phone) as realtyConsultantPhone,
214
+        t.create_date as visitDate,
215
+        e.nickName as sharePersonName,
216
+        t.visitNum
217
+        from (
218
+        SELECT
219
+        t.visit_time AS create_date,
220
+        t.person_id,
221
+        count(*) as visitNum
222
+        FROM
223
+        ta_person_visit_record t
224
+        WHERE
225
+        t.`event` in ( 'detail', 'house_list' , 'poster')
226
+        AND t.event_type IN (
227
+        'activity',
228
+        'help',
229
+        'group',
230
+        'h5',
231
+        'news',
232
+        'building',
233
+        'live',
234
+        'house'
235
+        )
236
+        AND t.org_id = #{orgId}
237
+        AND DATE_FORMAT(t.visit_time, '%Y-%m-%d' ) >= DATE_FORMAT(#{startDate}, '%Y-%m-%d')
238
+        AND DATE_FORMAT(t.visit_time, '%Y-%m-%d' ) &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
239
+        <if test="targetId != null and targetId != ''">
240
+            and t.target_id = #{targetId}
241
+        </if>
242
+        <if test="targetType != null and targetType != ''">
243
+            and (case when #{targetType} = 'activity' then t.target_type = 'dynamic'
244
+            when #{targetType} = 'h5' then t.event_type = 'h5'
245
+            when #{targetType} = 'news' then t.event_type = 'news'
246
+            when #{targetType} = 'building' then t.event_type = 'building'
247
+            when #{targetType} = 'house' then t.event_type = 'house'
248
+            else t.target_type = #{targetType}
249
+            end)
250
+        </if>
251
+        <if test="buildingId != null and buildingId != ''">
252
+            and t.building_id = #{buildingId}
253
+        </if>
254
+        <if test="channelId != null and channelId != ''">
255
+            and t.channel_id = #{channelId}
256
+        </if>
257
+        GROUP BY
258
+        t.person_id ) as t
259
+        left join ta_person a on t.person_id = a.person_id
260
+        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
261
+        left join td_wx_dict b1 on b.scene_id = b1.scene_id
262
+        LEFT JOIN ta_recommend_customer c on c.person_id = t.person_id
263
+        left join ta_user d on c.realty_consultant = d.user_id
264
+        LEFT JOIN ta_person e ON e.person_id = b.share_person_id
265
+        group by t.person_id
266
+        order by t.create_date desc
267
+    </select>
268
+    <select id="getChannelIntroductionListExport"
269
+            resultType="com.huiju.estateagents.excel.ActivityStatistics.TsChannelDaily">
270
+        SELECT
271
+        serial_no,
272
+        statis_date,
273
+        org_id,
274
+        building_id,
275
+        building_name,
276
+        target_id,
277
+        target_type,
278
+        target_name,
279
+        sum( share_num ) AS share_num,
280
+        sum( share_persons ) AS share_persons,
281
+        sum( visit_num ) AS visit_num,
282
+        sum( visit_persons ) AS visit_persons,
283
+        sum( new_persons ) AS new_persons,
284
+        sum( new_customers ) AS new_customers,
285
+        qr_code_id,
286
+        channel_id
287
+        FROM
288
+        ts_channel_daily
289
+        WHERE
290
+        channel_id = #{channelId}
291
+        AND org_id = #{orgId}
292
+        <if test="startDate != null and endDate != null">
293
+            AND statis_date BETWEEN #{startDate} AND #{endDate}
294
+        </if>
295
+        <if test="channelType != null and channelType != ''">
296
+            and target_type = #{channelType}
297
+        </if>
298
+        <if test="buildingId != null and buildingId != ''">
299
+            and building_id = #{buildingId}
300
+        </if>
301
+        <if test="taPersonBuildings != null and taPersonBuildings.size > 0">
302
+            and building_id in
303
+            <foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
304
+                #{taPersonBuilding.buildingId}
305
+            </foreach>
306
+        </if>
307
+        GROUP BY   target_id, target_type
308
+    </select>
309
+    <select id="getChannelNewuserListExport"
310
+            resultType="com.huiju.estateagents.excel.ActivityStatistics.ChannelAddRegistNum">
311
+        SELECT
312
+        a.nickname, a.phone,
313
+        if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
314
+        a.province,
315
+        t.create_date
316
+        FROM ta_customer_from t
317
+        left join ta_person a on t.person_id = a.person_id
318
+        <!--        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-->
319
+        <!--        left join td_wx_dict b1 on b.scene_id = b1.scene_id-->
320
+        <!--        left join ta_recommend_customer c on c.person_id = t.person_id and c.realty_consultant is not null-->
321
+        <!--        LEFT JOIN ta_user d ON c.realty_consultant = d.user_id-->
322
+        <!--        LEFT JOIN ta_person e ON t.share_person_id = e.person_id-->
323
+        WHERE t.org_id = #{orgId}
324
+        and t.is_org_first = 1
325
+                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},
326
+                '%Y-%m-%d' )
327
+        <if test="activityId != null and activityId != ''">
328
+            and t.target_id = #{activityId}
329
+        </if>
330
+        <if test="activityType != null and activityType != ''">
331
+            and t.target_type = #{activityType}
332
+        </if>
333
+        <if test="buildingId != null and buildingId != ''">
334
+            and t.building_id = #{buildingId}
335
+        </if>
336
+        <if test="channelId != null and channelId != ''">
337
+            and t.channel_id = #{channelId}
338
+        </if>
339
+        group by t.person_id order by t.create_date desc
340
+    </select>
341
+    <select id="getChannelVisitNumListExport"
342
+            resultType="com.huiju.estateagents.excel.ActivityStatistics.ChannelVisitNum">
343
+        select
344
+        a.nickname, a.phone,
345
+        if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
346
+        a.province,
347
+        b1.scene_alias as personFrom,
348
+        GROUP_CONCAT(d.user_name) as realtyConsultant,
349
+        GROUP_CONCAT(d.phone) as realtyConsultantPhone,
350
+        e.nickname as sharePersonName,
351
+        e.phone as sharePersonPhone,
352
+        t.visit_time as visitDate
353
+        From (
354
+        SELECT
355
+        t.person_id, t.visit_time, t.share_person_id
356
+        FROM
357
+        ta_person_visit_record t
358
+        WHERE
359
+        t.`event` in ( 'detail', 'house_list', 'poster' )
360
+        AND t.event_type IN (
361
+        'activity',
362
+        'help',
363
+        'group',
364
+        'h5',
365
+        'news',
366
+        'building',
367
+        'live',
368
+        'house'
369
+        )
370
+        <if test="targetId != null and targetId != ''">
371
+            and t.target_id = #{targetId}
372
+        </if>
373
+        <if test="targetType != null and targetType != ''">
374
+            and (case when #{targetType} = 'activity' then t.target_type = 'dynamic'
375
+            when #{targetType} = 'h5' then t.event_type = 'h5'
376
+            when #{targetType} = 'news' then t.event_type = 'news'
377
+            when #{targetType} = 'building' then t.event_type = 'building'
378
+            when #{targetType} = 'house' then t.event_type = 'house'
379
+            else t.target_type = #{targetType}
380
+            end)
381
+        </if>
382
+        <if test="channelId != null and channelId != ''">
383
+            and t.channel_id = #{channelId}
384
+        </if>
385
+        <if test="buildingId != null and buildingId != ''">
386
+            and t.building_id = #{buildingId}
387
+        </if>
388
+        AND t.org_id = #{orgId}
389
+        AND DATE_FORMAT( t.visit_time, '%Y-%m-%d' ) >= DATE_FORMAT(#{startDate}, '%Y-%m-%d')
390
+        AND DATE_FORMAT( t.visit_time, '%Y-%m-%d' ) &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
391
+        ) t
392
+        left join ta_person a on t.person_id = a.person_id
393
+        left join ta_person_from_record b on a.person_id = b.person_id and b.org_id = #{orgId}
394
+        left join td_wx_dict b1 on b.scene_id = b1.scene_id
395
+        LEFT JOIN ta_recommend_customer c on c.person_id = t.person_id
396
+        left join ta_user d on c.realty_consultant = d.user_id
397
+        left join ta_person e on t.share_person_id = e.person_id
398
+        group by t.visit_time
399
+        order by t.visit_time desc
400
+    </select>
401
+    <select id="getChannelPersonNumListExport"
402
+            resultType="com.huiju.estateagents.excel.ActivityStatistics.ChannelVisitPersonNum">
403
+        select
404
+        a.nickname, a.phone,
405
+        if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
406
+        a.province,
407
+        b1.scene_alias as personFrom,
408
+        GROUP_CONCAT(d.user_name) as realtyConsultant,
409
+        GROUP_CONCAT(d.phone) as realtyConsultantPhone,
410
+        t.create_date as visitDate,
411
+        e.nickName as sharePersonName,
412
+        t.visitNum
413
+        from (
414
+        SELECT
415
+        t.visit_time AS create_date,
416
+        t.person_id,
417
+        count(*) as visitNum
418
+        FROM
419
+        ta_person_visit_record t
420
+        WHERE
421
+        t.`event` in ( 'detail', 'house_list', 'poster' )
422
+        AND t.event_type IN (
423
+        'activity',
424
+        'help',
425
+        'group',
426
+        'h5',
427
+        'news',
428
+        'building',
429
+        'live',
430
+        'house'
431
+        )
432
+        AND t.org_id = #{orgId}
433
+        AND DATE_FORMAT( t.visit_time, '%Y-%m-%d' ) >= DATE_FORMAT(#{startDate}, '%Y-%m-%d')
434
+        AND DATE_FORMAT( t.visit_time, '%Y-%m-%d' ) &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
435
+        <if test="targetId != null and targetId != ''">
436
+            and t.target_id = #{targetId}
437
+        </if>
438
+        <if test="targetType != null and targetType != ''">
439
+            and (case when #{targetType} = 'activity' then t.target_type = 'dynamic'
440
+            when #{targetType} = 'h5' then t.event_type = 'h5'
441
+            when #{targetType} = 'news' then t.event_type = 'news'
442
+            when #{targetType} = 'building' then t.event_type = 'building'
443
+            when #{targetType} = 'house' then t.event_type = 'house'
444
+            else t.target_type = #{targetType}
445
+            end)
446
+        </if>
447
+        <if test="buildingId != null and buildingId != ''">
448
+            and t.building_id = #{buildingId}
449
+        </if>
450
+        <if test="channelId != null and channelId != ''">
451
+            and t.channel_id = #{channelId}
452
+        </if>
453
+        GROUP BY
454
+        t.person_id ) as t
455
+        left join ta_person a on t.person_id = a.person_id
456
+        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
457
+        left join td_wx_dict b1 on b.scene_id = b1.scene_id
458
+        LEFT JOIN ta_recommend_customer c on c.person_id = t.person_id
459
+        left join ta_user d on c.realty_consultant = d.user_id
460
+        LEFT JOIN ta_person e ON e.person_id = b.share_person_id
461
+        group by t.person_id
462
+        order by t.create_date desc
463
+    </select>
464
+
68 465
 </mapper>

+ 41
- 24
src/main/resources/mapper/TaLiveActivityMapper.xml Ver fichero

@@ -22,31 +22,48 @@
22 22
     </update>
23 23
 
24 24
     <select id="selectLiveListByCondition" resultType="com.huiju.estateagents.entity.TaLiveActivity">
25
-     select a.building_name,b.name as city_name,c.user_name as createName,d.user_name as updateName, t.* From ta_live_activity t
26
-     left join ta_building a on t.building_id = a.building_id
27
-     LEFT JOIN td_city b on t.city_id = b.id
28
-     left join ta_user c on t.create_user = c.user_id
29
-     left join ta_user d on t.update_user = d.user_id
25
+     select
26
+        a.building_name,
27
+        b.name as city_name,
28
+        c.user_name as createName,
29
+        d.user_name as updateName,
30
+        t.*
31
+     From
32
+        ta_live_activity t
33
+         left join ta_building a on t.building_id = a.building_id
34
+         LEFT JOIN td_city b on t.city_id = b.id
35
+         left join ta_user c on t.create_user = c.user_id
36
+         left join ta_user d on t.update_user = d.user_id
30 37
      where t.org_id = #{orgId} and t.status != -1
31
-     <if test="status != null">
32
-         and t.status = #{status}
33
-     </if>
34
-     <if test="liveActivityTitle != null and liveActivityTitle != ''">
35
-         and t.live_Activity_Title like CONCAT('%', #{liveActivityTitle}, '%')
36
-     </if>
37
-     <if test="cityId != null and cityId != ''">
38
-         and t.city_id = #{cityId}
39
-     </if><if test="buildingId != null and buildingId != ''">
40
-         and t.building_id = #{buildingId}
41
-    </if>
42
-    <if test="personBuildingList != null and personBuildingList.size > 0">
43
-        AND (t.building_id in
44
-        <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
45
-            #{personBuilding.buildingId}
46
-        </foreach>
47
-        or t.create_user = #{userId})
48
-    </if>
49
-        order by t.weight desc
38
+         <if test="status != null">
39
+             and t.status = #{status}
40
+         </if>
41
+         <if test="liveActivityTitle != null and liveActivityTitle != ''">
42
+             and t.live_Activity_Title like CONCAT('%', #{liveActivityTitle}, '%')
43
+         </if>
44
+         <if test="cityId != null and cityId != ''">
45
+             and t.city_id = #{cityId}
46
+         </if>
47
+         <choose>
48
+             <when test = 'source == 2'>
49
+                 <if test="buildingId == null or buildingId == ''">
50
+                     and t.building_id is null
51
+                 </if>
52
+             </when>
53
+             <otherwise>
54
+                 <if test="buildingId != null and buildingId != ''">
55
+                     and t.building_id = #{buildingId}
56
+                 </if>
57
+             </otherwise>
58
+         </choose>
59
+        <if test="personBuildingList != null and personBuildingList.size > 0">
60
+            AND (t.building_id in
61
+            <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
62
+                #{personBuilding.buildingId}
63
+            </foreach>
64
+            or t.create_user = #{userId})
65
+        </if>
66
+            order by t.weight desc
50 67
     </select>
51 68
     <select id="getDetailById" resultType="com.huiju.estateagents.entity.TaLiveActivity">
52 69
         select t.*,a.live_plat_name as liveAppName From ta_live_activity t

+ 194
- 0
src/main/resources/mapper/TaQrcodeMapper.xml Ver fichero

@@ -0,0 +1,194 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.huiju.estateagents.mapper.TaQrcodeMapper">
4
+
5
+    <select id="listQrCodeByCondition" resultType="com.huiju.estateagents.entity.TaQrcode">
6
+    SELECT
7
+        t.*,
8
+        t2.building_name,
9
+        t3.channel_name
10
+    FROM
11
+        ta_qrcode t
12
+        LEFT JOIN ta_building t2 ON t.building_id = t2.building_id
13
+        LEFT JOIN ta_channel t3 ON t.channel_id = t3.channel_id
14
+    WHERE
15
+        t.`status` > - 1
16
+        AND t.org_id = #{orgId}
17
+        <if test = "buildingId != '' and buildingId != null">
18
+            AND t.building_id = #{buildingId}
19
+        </if>
20
+        <if test = "targetType != '' and targetType != null">
21
+            AND t.target_type = #{targetType}
22
+        </if>
23
+        <if test = "targetName != '' and targetName != null">
24
+            AND t.target_name like concat ('%',#{targetName},'%')
25
+        </if>
26
+        <if test = "channelId != null">
27
+            AND t.channel_id = #{channelId}
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>
39
+      ORDER BY
40
+        t.create_date DESC
41
+    </select>
42
+
43
+    <select id="getVisitPersons" resultType="java.lang.Integer">
44
+        SELECT
45
+            count( DISTINCT t.person_id )
46
+        FROM
47
+            ta_person_visit_record t
48
+        WHERE
49
+            t.org_id = #{orgId}
50
+            AND t.qr_code_id = #{qrCodeId}
51
+    </select>
52
+
53
+    <select id="getVisitNum" resultType="java.lang.Integer">
54
+        SELECT
55
+            count( * )
56
+        FROM
57
+            ta_person_visit_record t
58
+        WHERE
59
+            t.org_id = #{orgId}
60
+            AND t.qr_code_id = #{qrCodeId}
61
+    </select>
62
+
63
+    <select id="getNewPersons" resultType="java.lang.Integer">
64
+        SELECT
65
+            count( DISTINCT t.person_id )
66
+        FROM
67
+            ta_customer_from t
68
+        WHERE
69
+            t.org_id = #{orgId}
70
+            AND t.is_org_first =1
71
+            AND t.qr_code_id = #{qrCodeId}
72
+    </select>
73
+
74
+    <select id="getVisitPersonsRecord" resultType="com.huiju.estateagents.entity.TaPersonVisitRecord">
75
+        SELECT
76
+            t.*,
77
+            IFNULL(t2.`name`,t2.nickname) userName,
78
+            t2.phone userTel,
79
+            t2.gender sex,
80
+            t3.shortname city,
81
+            count(*) accessCount
82
+        FROM
83
+            ta_person_visit_record t
84
+            left join ta_person t2 on t.person_id = t2.person_id
85
+            LEFT JOIN td_city t3 ON t2.city = t3.id
86
+        WHERE
87
+            t.org_id = #{orgId}
88
+            AND t.qr_code_id = #{qrCodeId}
89
+        GROUP BY
90
+	        t.person_id
91
+	    ORDER BY
92
+		    t.visit_time DESC
93
+    </select>
94
+
95
+    <select id="getVisitPersonsRecordExport" resultType="com.huiju.estateagents.excel.QrCodeStatistics.QrCodeVisitPersonNum">
96
+        SELECT
97
+            IFNULL( t2.`name`, t2.nickname ) nickName,
98
+            t2.phone phone,
99
+            (case t2.gender when 1 then '男' when 2 then '女' else '未知' end)  gender,
100
+            t3.shortname province,
101
+            count( * ) visitNum
102
+        FROM
103
+            ta_person_visit_record t
104
+            LEFT JOIN ta_person t2 ON t.person_id = t2.person_id
105
+            LEFT JOIN td_city t3 ON t2.city = t3.id
106
+        WHERE
107
+            t.org_id = #{orgId}
108
+            AND t.qr_code_id = #{qrCodeId}
109
+        GROUP BY
110
+            t.person_id
111
+        ORDER BY
112
+		    t.visit_time DESC
113
+    </select>
114
+
115
+    <select id="getVisitNumRecord" resultType="com.huiju.estateagents.entity.TaPersonVisitRecord">
116
+        SELECT
117
+            t.*,
118
+            IFNULL( t2.`name`, t2.nickname ) userName,
119
+            t2.phone userTel,
120
+            t2.gender sex,
121
+            t3.shortname city
122
+        FROM
123
+            ta_person_visit_record t
124
+            LEFT JOIN ta_person t2 ON t.person_id = t2.person_id
125
+            LEFT JOIN td_city t3 ON t2.city = t3.id
126
+        WHERE
127
+            t.org_id = #{orgId}
128
+            AND t.qr_code_id = #{qrCodeId}
129
+        ORDER BY
130
+            t.visit_time desc
131
+    </select>
132
+
133
+    <select id="getVisitNumRecordExport" resultType="com.huiju.estateagents.excel.QrCodeStatistics.QrCodeVisitNum">
134
+        SELECT
135
+            IFNULL( t2.`name`, t2.nickname ) nickName,
136
+            t2.phone phone,
137
+             (case t2.gender when 1 then '男' when 2 then '女' else '未知' end) gender,
138
+            t3.shortname province,
139
+			t.visit_time visitTime
140
+        FROM
141
+            ta_person_visit_record t
142
+            LEFT JOIN ta_person t2 ON t.person_id = t2.person_id
143
+            LEFT JOIN td_city t3 ON t2.city = t3.id
144
+        WHERE
145
+            t.org_id = #{orgId}
146
+            AND t.qr_code_id = #{qrCodeId}
147
+        ORDER BY
148
+            t.visit_time desc
149
+    </select>
150
+
151
+    <select id="getNewPersonsRecord" resultType="com.huiju.estateagents.entity.TaCustomerFrom">
152
+        SELECT
153
+            t.*,
154
+            t2.`name` userName,
155
+            t2.phone userTel,
156
+            t2.sex,
157
+            t3.shortname city,
158
+            t2.create_date registerTime
159
+        FROM
160
+            ta_customer_from t
161
+            LEFT JOIN ta_recommend_customer t2 ON t.person_id = t2.person_id
162
+            LEFT JOIN td_city t3 ON t2.city = t3.id
163
+        WHERE
164
+            t.org_id = #{orgId}
165
+            AND t.is_org_first =1
166
+            AND t.qr_code_id = #{qrCodeId}
167
+        GROUP BY
168
+	        t.customer_id
169
+	    order by
170
+	        t2.create_date desc
171
+    </select>
172
+
173
+    <select id="getNewPersonsRecordExport" resultType="com.huiju.estateagents.excel.QrCodeStatistics.QrCodeNewPersonNum">
174
+        SELECT
175
+            t2.`name` nickName,
176
+            t2.phone,
177
+            (case t2.sex when 1 then '男' when 2 then '女' else '未知' end) gender,
178
+            t3.shortname province,
179
+            t2.create_date registerTime
180
+        FROM
181
+            ta_customer_from t
182
+            LEFT JOIN ta_recommend_customer t2 ON t.person_id = t2.person_id
183
+            LEFT JOIN td_city t3 ON t2.city = t3.id
184
+        WHERE
185
+            t.org_id = #{orgId}
186
+            AND t.is_org_first =1
187
+            AND t.qr_code_id = #{qrCodeId}
188
+        GROUP BY
189
+	        t.customer_id
190
+	    order by
191
+	        t2.create_date desc
192
+    </select>
193
+
194
+</mapper>

+ 130
- 42
src/main/resources/mapper/TaRecommendCustomerMapper.xml Ver fichero

@@ -3,32 +3,32 @@
3 3
 <mapper namespace="com.huiju.estateagents.mapper.TaRecommendCustomerMapper">
4 4
     <select id="getMyCutsomerNum" resultType="int">
5 5
         SELECT
6
-            count(*) AS total
6
+        count(*) AS total
7 7
         FROM
8
-            ta_recommend_customer t
8
+        ta_recommend_customer t
9 9
         WHERE
10
-            t.recommend_person = #{personId}
11
-            AND t.status &gt; -1
10
+        t.recommend_person = #{personId}
11
+        AND t.status &gt; -1
12 12
     </select>
13 13
     <select id="getCustomerPersonId" resultType="java.lang.String">
14 14
         SELECT
15
-	person_id
16
-FROM
17
-	ta_customer_person
18
-WHERE
19
-	customer_id = #{customerId}
15
+        person_id
16
+        FROM
17
+        ta_customer_person
18
+        WHERE
19
+        customer_id = #{customerId}
20 20
     </select>
21 21
 
22 22
     <select id="getCustomerDetail" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
23
-      SELECT
24
-	a.*,
25
-	(select c.visit_time FROM ta_person_visit_record c where c.person_id = #{personId} ORDER BY c.visit_time asc LIMIT 1) as visitTime,
26
-	(SELECT SUM(d.visit_duration) FROM ta_person_visit_record d WHERE d.person_id= #{personId}) as duration
27
-FROM
28
-	ta_recommend_customer a
29
-	LEFT JOIN ta_person_visit_record c ON a.person_id = c.person_id
30
-	where a.customer_id = #{customerId}
31
-	GROUP BY a.customer_id
23
+        SELECT
24
+        a.*,
25
+        (select c.visit_time FROM ta_person_visit_record c where c.person_id = #{personId} ORDER BY c.visit_time asc LIMIT 1) as visitTime,
26
+        (SELECT SUM(d.visit_duration) FROM ta_person_visit_record d WHERE d.person_id= #{personId}) as duration
27
+        FROM
28
+        ta_recommend_customer a
29
+        LEFT JOIN ta_person_visit_record c ON a.person_id = c.person_id
30
+        where a.customer_id = #{customerId}
31
+        GROUP BY a.customer_id
32 32
     </select>
33 33
 
34 34
     <select id="getRecCustomerList" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
@@ -86,16 +86,19 @@ FROM
86 86
         tc.channel_name as channelName
87 87
         FROM
88 88
         ta_person a
89
-        left join ta_channel_person tcp on a.person_id = tcp.person_id
89
+        left join ta_channel_person tcp on a.person_id = tcp.person_id and tcp.status = 1
90 90
         left join ta_channel tc on tc.channel_id = tcp.channel_id
91 91
         <where>
92 92
             a.person_type in ('estate agent', 'channel agent')
93 93
             and a.status >0
94 94
             <if test="name != null and name !=''">
95
-                and a.nickname = #{name}
95
+                and (a.nickname like concat('%', #{name}, '%') or  a.name like concat('%', #{name}, '%'))
96 96
             </if>
97 97
             <if test="tel != null and tel!=''">
98
-                and a.phone = #{tel}
98
+                and a.phone like concat('%', #{tel}, '%')
99
+            </if>
100
+            <if test="channelId != null and channelId != '' ">
101
+                and tc.channel_id = #{channelId}
99 102
             </if>
100 103
             <if test="orgId != null">
101 104
                 and a.org_id = #{orgId}
@@ -176,8 +179,8 @@ FROM
176 179
         <if test="orgId != null">
177 180
             and p.org_id = #{orgId}
178 181
         </if>
182
+        --         LEFT JOIN ta_person c on p.share_person_id = c.person_id
183
+        --         LEFT JOIN td_wx_dict w ON p.scene_id = w.scene_id
179 184
         LEFT JOIN td_wx_dict w ON p.scene_id = w.scene_id
180 185
         LEFT JOIN ta_person p2 ON a.person_id = p2.person_id
181 186
         LEFT JOIN ta_person c ON p2.recommend_person = c.person_id
@@ -240,13 +243,13 @@ FROM
240 243
         order by a.create_date desc
241 244
     </select>
242 245
     <select id="getCustomerById" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
243
-         SELECT
244
-	a.*,
245
-	b.name as consultantName
246
-FROM
247
-	ta_recommend_customer a
248
-	LEFT JOIN ta_person b ON a.realty_consultant = b.person_id
249
-	WHERE a.customer_id = #{customerId}
246
+        SELECT
247
+        a.*,
248
+        b.name as consultantName
249
+        FROM
250
+        ta_recommend_customer a
251
+        LEFT JOIN ta_person b ON a.realty_consultant = b.person_id
252
+        WHERE a.customer_id = #{customerId}
250 253
     </select>
251 254
 
252 255
     <select id="getPublicCustomerList" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
@@ -306,6 +309,9 @@ FROM
306 309
             <if test="belongStatus == 0">
307 310
                 and (t.building_id = ''  OR t.building_id is null )
308 311
             </if>
312
+            <if test="belongStatus == 1">
313
+                and t.building_id is not null
314
+            </if>
309 315
         </where>
310 316
         order by t.create_date desc
311 317
     </select>
@@ -487,10 +493,10 @@ FROM
487 493
 
488 494
     <select id="getIndependentAgentsExport" resultType="com.huiju.estateagents.excel.AgentsRecommendCustomer">
489 495
         SELECT
490
-        a.nickname as nickname,
496
+        ifnull( a.name, a.nickname) as nickname,
491 497
         a.phone as phone,
492 498
         if(a.gender = '1', '男', if(a.gender = '2', '女', '未知')) as gender,
493
-        if(ifnull(tc.channel_name, '') != '', '渠道经纪人', '独立经纪人') as personType,
499
+        '专业经纪人' as personType,
494 500
         tc.channel_name as channelName,
495 501
         (
496 502
         SELECT
@@ -507,12 +513,11 @@ FROM
507 513
         ta_recommend_customer tarc
508 514
         WHERE
509 515
         tarc.recommend_person = a.person_id
510
-        and tarc.status = 1
511 516
         and tarc.org_id = #{orgId}
512 517
         ) AS recommedCount
513 518
         FROM
514 519
         ta_person a
515
-        left join ta_channel_person tcp on a.person_id = tcp.person_id
520
+        left join ta_channel_person tcp on a.person_id = tcp.person_id and tcp.status = 1
516 521
         left join ta_channel tc on tc.channel_id = tcp.channel_id
517 522
         <where>
518 523
             ifnull(a.person_type, '') in ('channel agent', 'estate agent')
@@ -520,6 +525,15 @@ FROM
520 525
             <if test="orgId != null">
521 526
                 and a.org_id = #{orgId}
522 527
             </if>
528
+            <if test="name != null and name != ''">
529
+                and (a.nickname like concat('%', #{name}, '%') or  a.name like concat('%', #{name}, '%'))
530
+            </if>
531
+            <if test="tel != null and tel != null">
532
+                and a.phone like concat('%', #{tel}, '%')
533
+            </if>
534
+            <if test="channelId != null and channelId != ''">
535
+                and tc.channel_id = #{channelId}
536
+            </if>
523 537
 
524 538
         </where>
525 539
 
@@ -568,8 +582,8 @@ FROM
568 582
         IF( t.sex = 1, '男', IF ( t.sex = 2, '女', '未知' ) ) AS sex,
569 583
         t.create_date,
570 584
         concat( t.country, t.province ) AS province,
571
-        t.intention,
572
-        IF(t.building_id = null or t.building_id = '','否','是') AS belongStatus,
585
+        z.intention,
586
+        IF(t.building_id is null or t.building_id = '','否','是') AS belongStatus,
573 587
         IFNULL( t2.building_name, '暂无' ) AS buildingName,
574 588
         t5.scene_alias as sceneType,
575 589
         ifnull( t3.nickname, t3.NAME ) AS sharePersonName ,
@@ -584,6 +598,7 @@ FROM
584 598
         LEFT JOIN td_wx_dict t5 ON t4.scene_id = t5.scene_id
585 599
         LEFT JOIN (select sum(points_amount) as points,person_id from ta_points_records where org_id = #{orgId} GROUP BY
586 600
         person_id) t6 on t.person_id = t6.person_id
601
+        left join (select sum(ti.intention) as intention,ti.person_id From ta_person_intention_record ti where ti.org_id = #{orgId} group by ti.person_id) z on z.person_id = t.person_id
587 602
         WHERE
588 603
         t.`status` > 0
589 604
         AND t.verify_status = 1
@@ -607,6 +622,12 @@ FROM
607 622
         <if test="sex != null and sex !=''">
608 623
             and t.sex = #{sex}
609 624
         </if>
625
+        <if test="startCreateDate != null and startCreateDate !=''">
626
+            and t.create_Date >= #{startCreateDate}
627
+        </if>
628
+        <if test="endCreateDate != null and endCreateDate !=''">
629
+            and t.create_Date &lt;= #{endCreateDate}
630
+        </if>
610 631
         <if test="personBuildingList != null and personBuildingList.size > 0">
611 632
             AND t.building_id in
612 633
             <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
@@ -619,6 +640,10 @@ FROM
619 640
         <if test="belongStatus == 0">
620 641
             and (t.building_id = ''  OR t.building_id is null )
621 642
         </if>
643
+        <if test="belongStatus == 1">
644
+            and t.building_id is not null
645
+        </if>
646
+        order by t.create_date desc
622 647
     </select>
623 648
     <!--    limit #{pageCode}, #{pageSize}-->
624 649
 
@@ -663,6 +688,12 @@ FROM
663 688
             <if test="sex != null and sex !=''">
664 689
                 and a.sex = #{sex}
665 690
             </if>
691
+            <if test="startCreateDate != null and startCreateDate !=''">
692
+                and a.create_Date >= #{startCreateDate}
693
+            </if>
694
+            <if test="endCreateDate != null and endCreateDate !=''">
695
+                and a.create_Date &lt;= #{endCreateDate}
696
+            </if>
666 697
             <if test="personBuildingList != null and personBuildingList.size > 0">
667 698
                 AND a.building_id in
668 699
                 <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
@@ -704,9 +735,6 @@ FROM
704 735
         LEFT JOIN ta_person p2 ON a.person_id = p2.person_id
705 736
         LEFT JOIN ta_person c ON p2.recommend_person = c.person_id
706 737
         left join ta_building t on a.building_id = t.building_id
707 738
         left JOIN (select sum(points_amount) as points,person_id from ta_points_records where org_id = #{orgId} GROUP BY
708 739
         person_id) s on a.person_id = s.person_id
709 740
         left join (select sum(t.intention) as intention,t.person_id From ta_person_intention_record t where t.org_id =
@@ -746,6 +774,12 @@ FROM
746 774
             <if test="sex != null and sex !=''">
747 775
                 and a.sex = #{sex}
748 776
             </if>
777
+            <if test="startCreateDate != null and startCreateDate !=''">
778
+                and a.create_Date >= #{startCreateDate}
779
+            </if>
780
+            <if test="endCreateDate != null and endCreateDate !=''">
781
+                and a.create_Date &lt;= #{endCreateDate}
782
+            </if>
749 783
             <if test="personBuildingList != null and personBuildingList.size > 0">
750 784
                 AND a.building_id in
751 785
                 <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
@@ -816,9 +850,9 @@ FROM
816 850
 
817 851
     <select id="getMyCustDetailById" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
818 852
         SELECT
819
-            *
853
+        *
820 854
         FROM
821
-            ta_recommend_customer
855
+        ta_recommend_customer
822 856
         where customer_id = #{customerId}
823 857
     </select>
824 858
 
@@ -877,17 +911,66 @@ FROM
877 911
         order by s.report_date desc
878 912
     </select>
879 913
 
914
+    <select id="getCustomerByProjectOrOrg" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
915
+        SELECT
916
+        *
917
+        FROM
918
+        ta_recommend_customer t
919
+        WHERE
920
+        t.org_id = #{orgId}
921
+        AND t.person_id = #{personId}
922
+        ORDER BY
923
+        IF( t.building_id = #{buildingId}, 0, 1 ) ASC,
924
+        IF( ifnull( t.building_id, '' ) = '', 0, 1 ) ASC,
925
+        t.create_date ASC
926
+        LIMIT 1
927
+    </select>
928
+
880 929
     <select id="getConsultantCustomerList" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
881 930
         SELECT
882
-            *
931
+        *
883 932
         FROM
884
-            ta_recommend_customer t
933
+        ta_recommend_customer t
885 934
         WHERE
886
-            t.org_id = #{orgId}
887
-            AND t.STATUS > 0
888
-            AND t.verify_status = 1
889
-            AND t.realty_consultant IN ( #{userId}, #{personId})
935
+        t.org_id = #{orgId}
936
+        AND t.STATUS > 0
937
+        AND t.verify_status = 1
938
+        AND t.realty_consultant IN ( #{userId}, #{personId})
890 939
     </select>
891 940
 
941
+    <select id="checkCustomerBy" resultType="java.util.Map">
942
+        SELECT
943
+        count( 1 ) AS orgNum,
944
+
945
+        <!--   sum( IF ( t.building_id IN ( 'foo', 'bar' ), 1, 0 ) ) AS consultNum,     -->
946
+        <choose>
947
+            <when test="consultBuildingIds != null and consultBuildingIds.size > 0">
948
+                COALESCE(sum( IF ( t.building_id IN <foreach collection="consultBuildingIds" item="id" open="(" close=")" separator=",">#{id}</foreach>
949
+            </when>
950
+            <otherwise>
951
+                COALESCE(sum( IF ( t.building_id IN ('****')
952
+            </otherwise>
953
+        </choose>
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,
966
+
967
+        COALESCE(sum( IF ( t.building_id = #{buildingId}, 1, 0 ) ), 0) AS buildingNum
892 968
 
969
+        FROM
970
+        ta_recommend_customer t
971
+        WHERE
972
+        t.org_id = #{orgId}
973
+        AND t.person_id = #{personId}
974
+        AND t.status > -1
975
+    </select>
893 976
 </mapper>

+ 18
- 0
src/main/resources/mapper/statistic/TaActivityStaticMapper.xml Ver fichero

@@ -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

+ 21
- 12
src/main/resources/mapper/statistic/TsPersonFromStatisticMapper.xml Ver fichero

@@ -47,29 +47,36 @@
47 47
     </select>
48 48
     <select id="selectPersonFromGroupByData"
49 49
             resultType="com.huiju.estateagents.statistic.entity.TsPersonFromStatistic">
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
+
50 52
         SELECT
51
-        sum( tp.from_num ) AS from_num,
52
-        sum( tp.registered_num ) AS registered_num,
53
-        DATE_FORMAT( tp.create_date, '%Y-%m-%d' ) AS create_time,
54
-        tp.scene_type
55
-        FROM
56
-        ts_person_from_statistic tp
57
-        WHERE
58
-        tp.org_id = #{orgId}
53
+        DATE_FORMAT( DATE_SUB( now( ), INTERVAL rownum DAY ), '%Y-%m-%d' ) AS date
54
+        FROM sequence
55
+        WHERE rownum &lt; DATEDIFF(STR_TO_DATE( #{endDate}, '%Y-%m-%d' ), STR_TO_DATE( #{startDate}, '%Y-%m-%d' )) ) as date
56
+
57
+        left join (SELECT sum( tp.from_num ) AS from_num, sum( tp.registered_num ) AS registered_num, DATE_FORMAT( tp.create_date, '%Y-%m-%d' ) AS create_time, tp.scene_type
58
+        FROM ts_person_from_statistic tp
59
+        WHERE tp.org_id = #{orgId}
59 60
         <if test="startDate != null or endDate != null">
60 61
             AND  DATE_FORMAT( tp.create_date, '%Y-%m-%d' ) BETWEEN #{startDate} and #{endDate}
61 62
         </if>
62 63
         <if test="startDate == null or endDate == null">
63 64
             AND DATE_FORMAT( tp.create_date, '%Y-%m-%d' ) BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
64 65
         </if>
65
-        GROUP BY
66
-        DATE_FORMAT( tp.create_date, '%Y-%m-%d' ),
67
-        tp.scene_type
68
-        ORDER BY tp.create_date
66
+        GROUP BY DATE_FORMAT( tp.create_date, '%Y-%m-%d' ), tp.scene_type ORDER BY tp.create_date
67
+        ) as tp on date.date = tp.create_time
68
+
69 69
     </select>
70 70
     <select id="selectNewLinePersonFromGroupByData"
71 71
             resultType="com.huiju.estateagents.statistic.entity.TsPersonFromStatistic">
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 (
73
+
72 74
         SELECT
75
+        DATE_FORMAT( DATE_SUB( now( ), INTERVAL rownum DAY ), '%Y-%m-%d' ) AS date
76
+        FROM sequence
77
+        WHERE rownum &lt; DATEDIFF(STR_TO_DATE( #{endDate}, '%Y-%m-%d' ), STR_TO_DATE( #{startDate}, '%Y-%m-%d' )) ) as date
78
+
79
+        left join (SELECT
73 80
         sum( tp.from_num ) AS from_num,
74 81
         sum( tp.registered_num ) AS registered_num,
75 82
         DATE_FORMAT( tp.create_date, '%Y-%m-%d' ) AS create_time,
@@ -89,5 +96,7 @@
89 96
         GROUP BY
90 97
         DATE_FORMAT( tp.create_date, '%Y-%m-%d' )
91 98
         ORDER BY tp.create_date
99
+        ) as tp on date.date = tp.create_time
100
+        order by date.date
92 101
     </select>
93 102
 </mapper>

+ 1
- 1
src/main/resources/mapper/statistic/TsUserBehaviorStatisticMapper.xml Ver fichero

@@ -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