张延森 il y a 5 ans
Parent
révision
79834906ee
21 fichiers modifiés avec 862 ajouts et 514 suppressions
  1. 5
    0
      src/main/java/com/huiju/estateagents/bo/request/ActivityStatisticResponseBO.java
  2. 25
    19
      src/main/java/com/huiju/estateagents/center/taUser/controller/TaUserController.java
  3. 3
    0
      src/main/java/com/huiju/estateagents/center/taUser/entity/TaUser.java
  4. 18
    3
      src/main/java/com/huiju/estateagents/center/taUser/service/impl/TaUserServiceImpl.java
  5. 13
    13
      src/main/java/com/huiju/estateagents/controller/MiniAppController.java
  6. 11
    4
      src/main/java/com/huiju/estateagents/controller/TaPersonController.java
  7. 307
    228
      src/main/java/com/huiju/estateagents/controller/TaRecommendCustomerController.java
  8. 4
    4
      src/main/java/com/huiju/estateagents/entity/TaPerson.java
  9. 23
    5
      src/main/java/com/huiju/estateagents/entity/TaRecommendCustomer.java
  10. 14
    7
      src/main/java/com/huiju/estateagents/excel/PublicCustomerExport.java
  11. 2
    0
      src/main/java/com/huiju/estateagents/mapper/TaPersonMapper.java
  12. 41
    4
      src/main/java/com/huiju/estateagents/mapper/TaRecommendCustomerMapper.java
  13. 45
    22
      src/main/java/com/huiju/estateagents/service/ITaRecommendCustomerService.java
  14. 65
    0
      src/main/java/com/huiju/estateagents/service/impl/TaPersonServiceImpl.java
  15. 23
    8
      src/main/java/com/huiju/estateagents/service/impl/TaRecommendCustomerServiceImpl.java
  16. 12
    6
      src/main/resources/mapper/ActivityManageMapper.xml
  17. 4
    3
      src/main/resources/mapper/TaChannelMapper.xml
  18. 7
    1
      src/main/resources/mapper/TaPersonMapper.xml
  19. 226
    182
      src/main/resources/mapper/TaRecommendCustomerMapper.xml
  20. 11
    2
      src/main/resources/mapper/TaUserMapper.xml
  21. 3
    3
      src/main/resources/mapper/statistic/TaActivityStaticMapper.xml

+ 5
- 0
src/main/java/com/huiju/estateagents/bo/request/ActivityStatisticResponseBO.java Voir le fichier

@@ -41,4 +41,9 @@ public class ActivityStatisticResponseBO {
41 41
      */
42 42
     private Integer newCustomers;
43 43
 
44
+    /**
45
+     * 活动名称
46
+     */
47
+    private String activityName;
48
+
44 49
 }

+ 25
- 19
src/main/java/com/huiju/estateagents/center/taUser/controller/TaUserController.java Voir le fichier

@@ -2,33 +2,23 @@ package com.huiju.estateagents.center.taUser.controller;
2 2
 
3 3
 import com.alibaba.fastjson.JSONObject;
4 4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
6 5
 import com.baomidou.mybatisplus.core.metadata.IPage;
7 6
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
8 7
 import com.huiju.estateagents.base.BaseController;
9 8
 import com.huiju.estateagents.base.ResponseBean;
10 9
 import com.huiju.estateagents.center.sysUser.entity.SysToken;
11
-import com.huiju.estateagents.center.sysUser.entity.SysUser;
12 10
 import com.huiju.estateagents.center.sysUser.service.ISysTokenService;
13 11
 import com.huiju.estateagents.center.taUser.entity.TaTagUser;
14 12
 import com.huiju.estateagents.center.taUser.entity.TaTags;
15 13
 import com.huiju.estateagents.center.taUser.entity.TaUser;
16 14
 import com.huiju.estateagents.center.taUser.entity.TaUserRole;
17
-import com.huiju.estateagents.center.taUser.service.ITaTagUserService;
18
-import com.huiju.estateagents.center.taUser.service.ITaUserAuthButtonService;
19
-import com.huiju.estateagents.center.taUser.service.ITaUserAuthMenuService;
20
-import com.huiju.estateagents.center.taUser.service.ITaUserRoleService;
21
-import com.huiju.estateagents.center.taUser.service.ITaUserService;
15
+import com.huiju.estateagents.center.taUser.service.*;
22 16
 import com.huiju.estateagents.common.CommConstant;
23 17
 import com.huiju.estateagents.common.JWTUtils;
24 18
 import com.huiju.estateagents.common.MD5Utils;
25
-import com.huiju.estateagents.common.StringUtils;
26
-import com.huiju.estateagents.entity.SysButtonInMenu;
27
-import com.huiju.estateagents.entity.SysMenu;
28
-import com.huiju.estateagents.entity.TaPerson;
29
-import com.huiju.estateagents.entity.TaPersonBuilding;
30
-import com.huiju.estateagents.entity.TaRole;
19
+import com.huiju.estateagents.entity.*;
31 20
 import com.huiju.estateagents.mapper.TaRoleMapper;
21
+import com.huiju.estateagents.service.ITaMiniappService;
32 22
 import com.huiju.estateagents.service.ITaPersonBuildingService;
33 23
 import com.huiju.estateagents.service.ITaPersonService;
34 24
 import com.huiju.estateagents.service.ITaRoleService;
@@ -38,7 +28,6 @@ import org.springframework.beans.factory.annotation.Autowired;
38 28
 import org.springframework.web.bind.annotation.*;
39 29
 
40 30
 import javax.servlet.http.HttpServletRequest;
41
-import java.time.LocalDateTime;
42 31
 import java.util.ArrayList;
43 32
 import java.util.HashMap;
44 33
 import java.util.List;
@@ -88,6 +77,9 @@ public class TaUserController extends BaseController {
88 77
     @Autowired
89 78
     private ITaPersonService iTaPersonService;
90 79
 
80
+    @Autowired
81
+    private ITaMiniappService iTaMiniappService;
82
+
91 83
     /**
92 84
      * 分页查询列表
93 85
      * @param pageNum
@@ -294,10 +286,15 @@ public class TaUserController extends BaseController {
294 286
             List<TaRole> roles = iTaRoleService.getRolesByUser(taUser.getUserId());
295 287
             ResponseBean authMenu = iTaUserAuthMenuService.getMenuByUserId(null, null, taUser.getUserId().toString(),taUser.getOrgId());
296 288
             ResponseBean authButton = iTaUserAuthButtonService.getButtonByUserId(null, null, taUser.getUserId().toString());
289
+            QueryWrapper<TaMiniapp> taMiniappQueryWrapper = new QueryWrapper<>();
290
+            taMiniappQueryWrapper.eq("org_id", getOrgId(request));
291
+            TaMiniapp taMiniapp = iTaMiniappService.getOne(taMiniappQueryWrapper);
292
+
297 293
             taUser.setMenus((List<SysMenu>) authMenu.getData());
298 294
             taUser.setButtons((List<SysButtonInMenu>) authButton.getData());
299 295
             taUser.setRoles(roles);
300 296
             taUser.setLoginPassword("");
297
+            taUser.setMiniAppName(taMiniapp.getName());
301 298
 
302 299
             //获取所有菜单
303 300
             List<SysMenu> allMenus = (List<SysMenu>) iTaUserAuthMenuService.getAllMenu(null, null,taUser.getOrgId(), roles).getData();
@@ -338,9 +335,9 @@ public class TaUserController extends BaseController {
338 335
         if (taUser == null) {
339 336
             return ResponseBean.error("用户名或密码错误", ResponseBean.ERROR_ILLEGAL_PARAMS);
340 337
         }
341
-    
338
+
342 339
         if (!taUser.getStatus().equals(CommConstant.STATUS_NORMAL) ) {
343
-            return ResponseBean.error("当前后台服务已到期,请联系相关管理人员", ResponseBean.ERROR_UNAVAILABLE);
340
+            return ResponseBean.error("该账号已经停用,请联系管理员", ResponseBean.ERROR_UNAVAILABLE);
344 341
         }
345 342
 
346 343
         List<TaRole> roles = iTaRoleService.getRolesByUser(taUser.getUserId());
@@ -361,7 +358,7 @@ public class TaUserController extends BaseController {
361 358
         Map<String, Object> result = new HashMap<>();
362 359
         result.put("token", token);
363 360
         result.put("user", taUser);
364
-    
361
+
365 362
         return ResponseBean.success(result);
366 363
     }
367 364
     
@@ -388,6 +385,7 @@ public class TaUserController extends BaseController {
388 385
                                    @RequestParam(value ="phone",required = false) String phone,
389 386
                                    @RequestParam(value ="status",required = false) Integer status,
390 387
                                    @RequestParam(value ="isConsultant",required = false) Integer isConsultant,
388
+                                   @RequestParam(value ="miniStatus",required = false) Integer miniStatus,
391 389
                                    @RequestParam(value ="buildingId",required = false) String buildingId,
392 390
                                    HttpServletRequest request){
393 391
         ResponseBean responseBean = new ResponseBean();
@@ -405,6 +403,7 @@ public class TaUserController extends BaseController {
405 403
             }else if (null != isConsultant && isConsultant == 0){
406 404
                 taUser.setIsConsultant(false);
407 405
             }
406
+            taUser.setMiniStatus(miniStatus);
408 407
 
409 408
             IPage<TaUser> result = iTaUserService.seleUserList(pg,taUser,getTaPersonBuildingListByUserId(request));
410 409
             List<TaUser> taUserList = result.getRecords();
@@ -412,8 +411,8 @@ public class TaUserController extends BaseController {
412 411
                 List<TaTags> taTagsList = iTaUserService.getTagsList(e);
413 412
                 e.setTaTagsList(taTagsList);
414 413
 
415
-                Integer person = iTaPersonService.judgeBindStatusByCondition(e.getUserId(), getOrgId(request), e.getPhone());
416
-                e.setMiniStatus(0 == person ? 0 : 1);
414
+//                Integer person = iTaPersonService.judgeBindStatusByCondition(e.getUserId(), getOrgId(request), e.getPhone());
415
+//                e.setMiniStatus(0 == person ? 0 : 1);
417 416
             });
418 417
             result.setRecords(taUserList);
419 418
             responseBean.addSuccess(result);
@@ -459,6 +458,13 @@ public class TaUserController extends BaseController {
459 458
             if (taPersonBuildingList.size() > 0){
460 459
                 if (taUser.getIsConsultant()){
461 460
                     taUser.setBuildingId(taPersonBuildingList.get(0).getBuildingId());
461
+                    QueryWrapper<TaPerson> taPersonQueryWrapper = new QueryWrapper<>();
462
+                    taPersonQueryWrapper.eq("user_id",id);
463
+                    taPersonQueryWrapper.eq("org_id",taUser.getOrgId());
464
+                    TaPerson taPerson = iTaPersonService.getOne(taPersonQueryWrapper);
465
+                    if (null != taPerson){
466
+                        taUser.setConsultantPersonId(taPerson.getPersonId());
467
+                    }
462 468
                 }else {
463 469
                     List<String> buildings = new ArrayList<>();
464 470
                     taPersonBuildingList.forEach(e -> {

+ 3
- 0
src/main/java/com/huiju/estateagents/center/taUser/entity/TaUser.java Voir le fichier

@@ -232,4 +232,7 @@ public class TaUser implements Serializable {
232 232
      */
233 233
     @TableField(exist = false)
234 234
     private List<TaPerson> personIds;
235
+
236
+    @TableField(exist = false)
237
+    private String miniAppName;
235 238
 }

+ 18
- 3
src/main/java/com/huiju/estateagents/center/taUser/service/impl/TaUserServiceImpl.java Voir le fichier

@@ -4,7 +4,6 @@ import cn.binarywang.wx.miniapp.api.WxMaService;
4 4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5 5
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
6 6
 import com.baomidou.mybatisplus.core.metadata.IPage;
7
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
8 7
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
9 8
 import com.huiju.estateagents.base.ResponseBean;
10 9
 import com.huiju.estateagents.center.taUser.entity.TaTagUser;
@@ -25,13 +24,11 @@ import com.huiju.estateagents.entity.*;
25 24
 import com.huiju.estateagents.mapper.*;
26 25
 import com.huiju.estateagents.service.*;
27 26
 import org.apache.commons.collections.CollectionUtils;
28
-import org.apache.commons.collections.map.HashedMap;
29 27
 import org.springframework.beans.factory.annotation.Autowired;
30 28
 import org.springframework.stereotype.Service;
31 29
 
32 30
 import java.time.LocalDateTime;
33 31
 import java.util.ArrayList;
34
-import java.util.Iterator;
35 32
 import java.util.List;
36 33
 import java.util.Map;
37 34
 import java.util.stream.Collectors;
@@ -356,9 +353,27 @@ public class TaUserServiceImpl extends ServiceImpl<TaUserMapper, TaUser> impleme
356 353
             throw new Exception("未找到有效的用户信息");
357 354
         }
358 355
 
356
+        //停用
357
+        if (!isOn){
358
+            //查看是否置业顾问
359
+            if (taUser.getIsConsultant()){
360
+//                taUser.setIsConsultant(false);
361
+//                taUserMapper.updateById(taUser);
362
+                //小程序端调整为普通客户
363
+                QueryWrapper<TaPerson> taPersonQueryWrapper = new QueryWrapper<>();
364
+                taPersonQueryWrapper.eq("user_id",id);
365
+                taPersonQueryWrapper.eq("org_id",taUser.getOrgId());
366
+                TaPerson taPerson = taPersonMapper.selectOne(taPersonQueryWrapper);
367
+                if (null != taPerson){
368
+                    taPersonMapper.cancelConsulatant(taPerson.getPersonId());
369
+                }
370
+            }
371
+        }
372
+
359 373
         Integer status = isOn ? CommConstant.STATUS_NORMAL : CommConstant.STATUS_CLOSED;
360 374
         TaUser user = new TaUser();
361 375
         user.setStatus(status);
376
+        user.setWeight(taUser.getWeight());
362 377
 
363 378
         QueryWrapper<TaUser> taUserQueryWrapper = new QueryWrapper<>();
364 379
         if (CommConstant.LOGIN_TYPE_ADMIN.equals(plat)) {

+ 13
- 13
src/main/java/com/huiju/estateagents/controller/MiniAppController.java Voir le fichier

@@ -251,19 +251,19 @@ public class MiniAppController extends BaseController {
251 251
             taPerson.setMiniappId(appid);
252 252
             taPersonService.updateById(taPerson);
253 253
 
254
-            // 增加积分线程
255
-            ExecutorService threadPool = Executors.newCachedThreadPool();
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)) {
259
-                    // 校验是否点击过此人的分享
260
-                    boolean checkPoint = checkSharePersonFrom(from, taPerson.getPersonId(), targetId, orgId);
261
-                    if (checkPoint) {
262
-                        // 添加积分
263
-                        applicationContext.publishEvent(new EventBus(recommender, EventBus.EventType.SharePosterAll, orgId));
264
-                    }
265
-                }
266
-            });
254
+            // 增加积分线程 --- 3.5.23版本授权手机分享者增加积分,单纯分享不增加积分
255
+//            ExecutorService threadPool = Executors.newCachedThreadPool();
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)) {
259
+//                    // 校验是否点击过此人的分享
260
+//                    boolean checkPoint = checkSharePersonFrom(from, taPerson.getPersonId(), targetId, orgId);
261
+//                    if (checkPoint) {
262
+//                        // 添加积分
263
+//                        applicationContext.publishEvent(new EventBus(recommender, EventBus.EventType.SharePosterAll, orgId));
264
+//                    }
265
+//                }
266
+//            });
267 267
 
268 268
             if (StringUtils.isNotBlank(from) && StringUtils.isNotBlank(recommender) && StringUtils.isNotBlank(targetId)) {
269 269
                 TaSharePersonFrom taSharePersonFrom = new TaSharePersonFrom();

+ 11
- 4
src/main/java/com/huiju/estateagents/controller/TaPersonController.java Voir le fichier

@@ -159,11 +159,18 @@ public class TaPersonController extends BaseController {
159 159
             return ResponseBean.error("您已经成为置业顾问",ResponseBean.ERROR_UNAVAILABLE);
160 160
         }
161 161
         QueryWrapper<TaUser>queryWrapper = new QueryWrapper<>();
162
-        queryWrapper.eq("phone",person.getPhone());
162
+        queryWrapper.eq("phone",person.getTel()).or().eq("phone",person.getPhone());
163 163
         queryWrapper.eq("org_id",orgId);
164 164
         queryWrapper.eq("status",CommConstant.STATUS_NORMAL);
165 165
         queryWrapper.eq("is_consultant",true);
166 166
         List<TaUser> users = taUserService.list(queryWrapper);
167
+
168
+        TaChannelPerson taChannelPerson = new TaChannelPerson();
169
+        taChannelPerson.setStatus(CommConstant.STATUS_DELETE);
170
+        QueryWrapper<TaChannelPerson> taChannelPersonQueryWrapper = new QueryWrapper<>();
171
+        taChannelPersonQueryWrapper.eq("person_id", person.getPersonId());
172
+        taChannelPersonService.update(taChannelPerson, taChannelPersonQueryWrapper);
173
+
167 174
         if(users.size()>0){
168 175
             TaUser user = users.get(0);
169 176
             person.setPersonType(CommConstant.PERSON_REALTY_CONSULTANT);
@@ -208,13 +215,13 @@ public class TaPersonController extends BaseController {
208 215
         if(StringUtils.isEmpty(channelCode)){
209 216
             person.setPersonType(CommConstant.PERSON_ESTATE_AGENT);
210 217
         }else {
211
-            person.setPersonType(CommConstant.PERSON_ESTATE_CHANNEL);
218
+            person.setPersonType(CommConstant.PERSON_ESTATE_AGENT);
212 219
             QueryWrapper<TaChannel> queryWrapper = new QueryWrapper();
213 220
             queryWrapper.eq("channel_code",channelCode);
214 221
             queryWrapper.eq("org_id",orgId);
215 222
             TaChannel channel = taChannelService.getOne(queryWrapper);
216 223
             if (null == channel){
217
-                return ResponseBean.error("渠道码不存在",ResponseBean.ERROR_UNAVAILABLE);
224
+                return ResponseBean.error("验证码有误,请确认后重新输入",ResponseBean.ERROR_UNAVAILABLE);
218 225
             }
219 226
             QueryWrapper<TaChannelPerson>taChannelPersonQueryWrapper = new QueryWrapper<>();
220 227
             taChannelPersonQueryWrapper.eq("person_id",person.getPersonId());
@@ -568,7 +575,7 @@ public class TaPersonController extends BaseController {
568 575
         }
569 576
         if (!StringUtils.isEmpty(phone)){
570 577
             person.setTel(phone);
571
-            person.setPhone(phone);
578
+//            person.setPhone(phone);
572 579
             if(person.getPersonType().equals(CommConstant.PERSON_REALTY_CONSULTANT)){
573 580
                 TaUser user = taUserService.getById(person.getUserId());
574 581
                 user.setPhone(phone);

+ 307
- 228
src/main/java/com/huiju/estateagents/controller/TaRecommendCustomerController.java Voir le fichier

@@ -84,6 +84,7 @@ public class TaRecommendCustomerController extends BaseController {
84 84
 
85 85
     /**
86 86
      * 我的客户列表
87
+     *
87 88
      * @param pageNumber
88 89
      * @param pageSize
89 90
      * @param keywords
@@ -93,9 +94,9 @@ public class TaRecommendCustomerController extends BaseController {
93 94
     @GetMapping("/wx/customer/list")
94 95
     @ApiOperation(value = "查询我的客户列表", notes = "查询我的客户列表")
95 96
     @ApiImplicitParams({
96
-            @ApiImplicitParam(dataTypeClass = Integer.class, name = "pageNumber", paramType = "query",value = "第几页"),
97
-            @ApiImplicitParam(dataTypeClass = Integer.class, name = "pageSize", paramType = "query",value = "一页多少行"),
98
-            @ApiImplicitParam(dataTypeClass = String.class, name = "keywords", paramType = "query",value = "搜索关键字,目前仅支持姓名")
97
+            @ApiImplicitParam(dataTypeClass = Integer.class, name = "pageNumber", paramType = "query", value = "第几页"),
98
+            @ApiImplicitParam(dataTypeClass = Integer.class, name = "pageSize", paramType = "query", value = "一页多少行"),
99
+            @ApiImplicitParam(dataTypeClass = String.class, name = "keywords", paramType = "query", value = "搜索关键字,目前仅支持姓名")
99 100
     })
100 101
     public ResponseBean getMyCustList(@RequestParam int pageNumber, @RequestParam int pageSize, String keywords, HttpServletRequest request) {
101 102
         if (pageNumber < 0 || pageSize < 0) {
@@ -108,6 +109,7 @@ public class TaRecommendCustomerController extends BaseController {
108 109
 
109 110
     /**
110 111
      * 我的客户列表
112
+     *
111 113
      * @param pageNumber
112 114
      * @param pageSize
113 115
      * @param keywords
@@ -117,9 +119,9 @@ public class TaRecommendCustomerController extends BaseController {
117 119
     @GetMapping("/admin/customer/list/{userId}")
118 120
     @ApiOperation(value = "查询我的客户列表", notes = "查询我的客户列表")
119 121
     @ApiImplicitParams({
120
-            @ApiImplicitParam(dataTypeClass = Integer.class, name = "pageNumber", paramType = "query",value = "第几页"),
121
-            @ApiImplicitParam(dataTypeClass = Integer.class, name = "pageSize", paramType = "query",value = "一页多少行"),
122
-            @ApiImplicitParam(dataTypeClass = String.class, name = "keywords", paramType = "query",value = "搜索关键字,目前仅支持姓名")
122
+            @ApiImplicitParam(dataTypeClass = Integer.class, name = "pageNumber", paramType = "query", value = "第几页"),
123
+            @ApiImplicitParam(dataTypeClass = Integer.class, name = "pageSize", paramType = "query", value = "一页多少行"),
124
+            @ApiImplicitParam(dataTypeClass = String.class, name = "keywords", paramType = "query", value = "搜索关键字,目前仅支持姓名")
123 125
     })
124 126
     public ResponseBean getAdminMyCustList(@RequestParam int pageNumber,
125 127
                                            @RequestParam int pageSize,
@@ -145,13 +147,14 @@ public class TaRecommendCustomerController extends BaseController {
145 147
 
146 148
     /**
147 149
      * 客户详情
150
+     *
148 151
      * @param id
149 152
      * @return
150 153
      */
151 154
     @GetMapping("/wx/customer/{id}")
152 155
     @ApiOperation(value = "查询客户详情", notes = "查询客户详情")
153 156
     @ApiImplicitParams({
154
-            @ApiImplicitParam(dataTypeClass = String.class, name = "id", paramType = "path",value = "搜索关键字,目前仅支持姓名")
157
+            @ApiImplicitParam(dataTypeClass = String.class, name = "id", paramType = "path", value = "搜索关键字,目前仅支持姓名")
155 158
     })
156 159
     public ResponseBean getCustDetail(@PathVariable String id) {
157 160
         if (null == id || "".equals(id.trim())) {
@@ -163,13 +166,14 @@ public class TaRecommendCustomerController extends BaseController {
163 166
 
164 167
     /**
165 168
      * 客户编辑
169
+     *
166 170
      * @param paramStr
167 171
      * @return
168 172
      */
169 173
     @PostMapping("/wx/customer/edit")
170 174
     @ApiOperation(value = "客户编辑", notes = "客户编辑")
171 175
     @ApiImplicitParams({
172
-            @ApiImplicitParam(dataTypeClass = String.class, name = "id", paramType = "path",value = "搜索关键字,目前仅支持姓名")
176
+            @ApiImplicitParam(dataTypeClass = String.class, name = "id", paramType = "path", value = "搜索关键字,目前仅支持姓名")
173 177
     })
174 178
     public ResponseBean updateCust(@RequestBody String paramStr) {
175 179
         return taRecommendCustomerService.updateCustByJSON(paramStr);
@@ -177,6 +181,7 @@ public class TaRecommendCustomerController extends BaseController {
177 181
 
178 182
     /**
179 183
      * 推荐客户
184
+     *
180 185
      * @param paramStr
181 186
      * @param request
182 187
      * @return
@@ -185,11 +190,12 @@ public class TaRecommendCustomerController extends BaseController {
185 190
     public ResponseBean recommendCust(@RequestBody String paramStr, HttpServletRequest request) {
186 191
         String openid = getOpenId(request);
187 192
         Integer orgId = getOrgId(request);
188
-        return taRecommendCustomerService.recommendCust(paramStr, openid,orgId);
193
+        return taRecommendCustomerService.recommendCust(paramStr, openid, orgId);
189 194
     }
190 195
 
191 196
     /**
192 197
      * 报备客户
198
+     *
193 199
      * @param paramStr
194 200
      * @param request
195 201
      * @return
@@ -198,57 +204,57 @@ public class TaRecommendCustomerController extends BaseController {
198 204
     public ResponseBean reportCust(@RequestBody String paramStr, HttpServletRequest request) {
199 205
         String openid = getOpenId(request);
200 206
         Integer orgId = getOrgId(request);
201
-        return taRecommendCustomerService.reportCust(paramStr, openid,orgId);
207
+        return taRecommendCustomerService.reportCust(paramStr, openid, orgId);
202 208
     }
203 209
 
204 210
     @PostMapping("/wx/customer/recommend")
205
-    public ResponseBean getUnSignedCustomerList ( @RequestParam(value ="pageNumber",defaultValue = "1") Integer pageNumber,
206
-                                                  @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
207
-                                                  @RequestParam(value ="buildingId") String buildingId,
208
-                                                  HttpServletRequest request){
211
+    public ResponseBean getUnSignedCustomerList(@RequestParam(value = "pageNumber", defaultValue = "1") Integer pageNumber,
212
+                                                @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
213
+                                                @RequestParam(value = "buildingId") String buildingId,
214
+                                                HttpServletRequest request) {
209 215
         String openid = getOpenId(request);
210 216
         List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
211 217
         if (null == taPersons || taPersons.size() != 1) {
212 218
             return ResponseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
213 219
         }
214 220
         TaPerson person = taPersons.get(0);
215
-        try{
216
-            return ResponseBean.success(taRecommendCustomerService.getUnSignedCustomerList(pageNumber,pageSize,buildingId,person.getPersonId()));
217
-        }catch (Exception e){
221
+        try {
222
+            return ResponseBean.success(taRecommendCustomerService.getUnSignedCustomerList(pageNumber, pageSize, buildingId, person.getPersonId()));
223
+        } catch (Exception e) {
218 224
             e.printStackTrace();
219
-            return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
225
+            return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
220 226
         }
221 227
     }
222 228
 
223 229
     @GetMapping("/wx/customer/myReport")
224
-    public ResponseBean getCustomerIReport (HttpServletRequest request,
225
-                                         @RequestParam(value ="pageNumber",defaultValue = "1") Integer pageNumber,
226
-                                         @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
230
+    public ResponseBean getCustomerIReport(HttpServletRequest request,
231
+                                           @RequestParam(value = "pageNumber", defaultValue = "1") Integer pageNumber,
232
+                                           @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
227 233
         String openid = getOpenId(request);
228 234
         List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
229 235
         if (null == taPersons || taPersons.size() != 1) {
230 236
             return ResponseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
231 237
         }
232 238
         TaPerson person = taPersons.get(0);
233
-        try{
234
-            IPage<TaRecommendCustomer>pg = new Page<>(pageNumber,pageSize);
235
-            QueryWrapper<TaRecommendCustomer>queryWrapper = new QueryWrapper<>();
236
-            queryWrapper.eq("realty_consultant",person.getPersonId());
237
-            queryWrapper.eq("report_recommend_status",CommConstant.REPORTED);
238
-            queryWrapper.eq("status",CommConstant.CUSTOMER_REPORT);
239
+        try {
240
+            IPage<TaRecommendCustomer> pg = new Page<>(pageNumber, pageSize);
241
+            QueryWrapper<TaRecommendCustomer> queryWrapper = new QueryWrapper<>();
242
+            queryWrapper.eq("realty_consultant", person.getPersonId());
243
+            queryWrapper.eq("report_recommend_status", CommConstant.REPORTED);
244
+            queryWrapper.eq("status", CommConstant.CUSTOMER_REPORT);
239 245
             queryWrapper.orderByDesc("create_date");
240
-            IPage<TaRecommendCustomer>result = taRecommendCustomerService.page(pg,queryWrapper);
246
+            IPage<TaRecommendCustomer> result = taRecommendCustomerService.page(pg, queryWrapper);
241 247
             return ResponseBean.success(result);
242
-        }catch (Exception e){
248
+        } catch (Exception e) {
243 249
             e.printStackTrace();
244
-            return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
250
+            return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
245 251
         }
246 252
     }
247 253
 
248 254
     @GetMapping("/wx/customer/myCustomer")
249
-    public ResponseBean getMyCustomer (     @RequestParam(value ="pageNumber",defaultValue = "1") Integer pageNumber,
250
-                                            @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
251
-                                            HttpServletRequest request){
255
+    public ResponseBean getMyCustomer(@RequestParam(value = "pageNumber", defaultValue = "1") Integer pageNumber,
256
+                                      @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
257
+                                      HttpServletRequest request) {
252 258
         String openid = getOpenId(request);
253 259
         List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
254 260
         if (null == taPersons || taPersons.size() != 1) {
@@ -256,65 +262,88 @@ public class TaRecommendCustomerController extends BaseController {
256 262
         }
257 263
         TaPerson person = taPersons.get(0);
258 264
 
259
-        try{
260
-            IPage<TaRecommendCustomer>pg = new Page<>(pageNumber,pageSize);
261
-            QueryWrapper<TaRecommendCustomer>queryWrapper = new QueryWrapper<>();
265
+        try {
266
+            IPage<TaRecommendCustomer> pg = new Page<>(pageNumber, pageSize);
267
+            QueryWrapper<TaRecommendCustomer> queryWrapper = new QueryWrapper<>();
262 268
 
263 269
             // 2020-4-1 yansen realty_consultant 可能是 person_id, 可能是 user_id
264 270
 //            queryWrapper.eq("realty_consultant",person.getPersonId());
265 271
             queryWrapper.eq("org_id", person.getOrgId());   // 主要是为了走索引
266
-            queryWrapper.nested(query -> query.eq("realty_consultant",person.getPersonId()).or().eq("realty_consultant", person.getUserId()));
267
-           // queryWrapper.eq("report_recommend_status",CommConstant.REPORTED);
268
-            queryWrapper.gt("status",CommConstant.STATUS_UNACCALIMED);
272
+            queryWrapper.nested(query -> query.eq("realty_consultant", person.getPersonId()).or().eq("realty_consultant", person.getUserId()));
273
+            // queryWrapper.eq("report_recommend_status",CommConstant.REPORTED);
274
+            queryWrapper.gt("status", CommConstant.STATUS_UNACCALIMED);
269 275
             queryWrapper.orderByDesc("create_date");
270
-            IPage<TaRecommendCustomer>result = taRecommendCustomerService.page(pg,queryWrapper);
276
+            IPage<TaRecommendCustomer> result = taRecommendCustomerService.page(pg, queryWrapper);
271 277
             return ResponseBean.success(result);
272
-        }catch (Exception e){
278
+        } catch (Exception e) {
273 279
             e.printStackTrace();
274
-            return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
280
+            return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
275 281
         }
276 282
     }
277 283
 
278 284
 
279 285
     @GetMapping("/wx/customer/myInviteAgent")
280
-    public ResponseBean getMyInviteAgent (@RequestParam(value ="personId") String personId,
281
-                                       @RequestParam(value ="pageNumber",defaultValue = "1") Integer pageNumber,
282
-                                       @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
283
-        try{
284
-            IPage<TaRecommendCustomer>pg = new Page<>(pageNumber,pageSize);
285
-            QueryWrapper<TaRecommendCustomer>queryWrapper = new QueryWrapper<>();
286
-            queryWrapper.eq("realty_consultant",personId);
287
-            queryWrapper.eq("report_recommend_status",CommConstant.REPORTED);
286
+    public ResponseBean getMyInviteAgent(@RequestParam(value = "personId") String personId,
287
+                                         @RequestParam(value = "pageNumber", defaultValue = "1") Integer pageNumber,
288
+                                         @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
289
+        try {
290
+            IPage<TaRecommendCustomer> pg = new Page<>(pageNumber, pageSize);
291
+            QueryWrapper<TaRecommendCustomer> queryWrapper = new QueryWrapper<>();
292
+            queryWrapper.eq("realty_consultant", personId);
293
+            queryWrapper.eq("report_recommend_status", CommConstant.REPORTED);
288 294
             queryWrapper.orderByDesc("create_date");
289
-            IPage<TaRecommendCustomer>result = taRecommendCustomerService.page(pg,queryWrapper);
295
+            IPage<TaRecommendCustomer> result = taRecommendCustomerService.page(pg, queryWrapper);
290 296
             return ResponseBean.success(result);
291
-        }catch (Exception e){
297
+        } catch (Exception e) {
292 298
             e.printStackTrace();
293
-            return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
299
+            return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
294 300
         }
295 301
     }
296 302
 
297 303
 
298
-    // 客户列表 公客/私客
304
+    /**
305
+     * 客户列表 公客/私客
306
+     *
307
+     * @param request
308
+     * @param name
309
+     * @param tel
310
+     * @param buildingId
311
+     * @param consultName
312
+     * @param consultTel
313
+     * @param pageNumber
314
+     * @param pageSize
315
+     * @param entryType
316
+     * @param verifyStatus
317
+     * @param sex
318
+     * @param customerType
319
+     * @param status
320
+     * @param sceneType
321
+     * @param startCreateDate
322
+     * @param endCreateDate
323
+     * @param belongStatus    是否归属项目 1是 0否
324
+     * @param sharePersonName
325
+     * @return
326
+     */
299 327
     @GetMapping("/admin/customer/recommend")
300
-    public ResponseBean getCustomerList (HttpServletRequest request,
301
-                                         @RequestParam(value ="name",required = false) String name,
302
-                                         @RequestParam(value ="tel",required = false) String tel,
303
-                                         @RequestParam(value ="buildingId",required = false) String buildingId,
304
-                                         @RequestParam(value ="consultName",required = false) String consultName,
305
-                                         @RequestParam(value ="consultTel",required = false) String consultTel,
306
-                                         @RequestParam(value ="pageNumber",defaultValue = "1") Integer pageNumber,
307
-                                         @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
308
-                                         @RequestParam(value ="entryType",required = false) String entryType,
309
-                                         @RequestParam(value ="verifyStatus",required = false) String verifyStatus,
310
-                                         @RequestParam(value = "sex",required = false)Integer sex,
311
-                                         @RequestParam(value = "customerType") String customerType,// public 公  private 私
312
-                                         @RequestParam(value = "status",required = false) Integer status,
313
-                                         @RequestParam(value = "sceneType",required = false) String sceneType,
314
-                                         @RequestParam(value = "startCreateDate",required = false) String startCreateDate,
315
-                                         @RequestParam(value = "endCreateDate",required = false) String endCreateDate,
316
-                                         @RequestParam(value = "sharePersonName",required = false) String sharePersonName){
317
-        try{
328
+    public ResponseBean getCustomerList(HttpServletRequest request,
329
+                                        @RequestParam(value = "name", required = false) String name,
330
+                                        @RequestParam(value = "tel", required = false) String tel,
331
+                                        @RequestParam(value = "buildingId", required = false) String buildingId,
332
+                                        @RequestParam(value = "consultName", required = false) String consultName,
333
+                                        @RequestParam(value = "consultTel", required = false) String consultTel,
334
+                                        @RequestParam(value = "pageNumber", defaultValue = "1") Integer pageNumber,
335
+                                        @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
336
+                                        @RequestParam(value = "entryType", required = false) String entryType,
337
+                                        @RequestParam(value = "verifyStatus", required = false) String verifyStatus,
338
+                                        @RequestParam(value = "sex", required = false) Integer sex,
339
+                                        @RequestParam(value = "customerType") String customerType,// public 公  private 私
340
+                                        @RequestParam(value = "status", required = false) Integer status,
341
+                                        @RequestParam(value = "sceneType", required = false) String sceneType,
342
+                                        @RequestParam(value = "startCreateDate", required = false) String startCreateDate,
343
+                                        @RequestParam(value = "endCreateDate", required = false) String endCreateDate,
344
+                                        @RequestParam(value = "belongStatus", required = false) Integer belongStatus,
345
+                                        @RequestParam(value = "sharePersonName", required = false) String sharePersonName) {
346
+        try {
318 347
 
319 348
             // TODO 目前如果是公客,就取当前操作人员的 buildingId
320 349
 //            if ("public".equals(customerType)) {
@@ -327,59 +356,62 @@ public class TaRecommendCustomerController extends BaseController {
327 356
 //                TaPersonBuilding personBuilding = taPersonBuildingMapper.selectOne(queryWrapper);
328 357
 //                buildingId = personBuilding.getBuildingId();
329 358
 //            }
330
-            return ResponseBean.success(taRecommendCustomerService.getCustomerList(status,pageNumber,pageSize,buildingId,name,tel,consultName,consultTel,entryType,verifyStatus,sex, customerType, getOrgId(request),getTaPersonBuildingListByUserId(request),sceneType, startCreateDate, endCreateDate, sharePersonName));
331
-        }catch (Exception e){
359
+            return ResponseBean.success(taRecommendCustomerService.getCustomerList(status, pageNumber, pageSize, buildingId, name, tel, consultName,
360
+                    consultTel, entryType, verifyStatus, sex, customerType, getOrgId(request), getTaPersonBuildingListByUserId(request), sceneType,
361
+                    startCreateDate, endCreateDate, sharePersonName, belongStatus));
362
+        } catch (Exception e) {
332 363
             e.printStackTrace();
333
-            return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
364
+            return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
334 365
         }
335 366
     }
336 367
 
337 368
 
338 369
     //推荐客户列表
339 370
     @GetMapping("/admin/customer/recommend/recommender")
340
-    public ResponseBean getRecCustomerList (HttpServletRequest request,
341
-                                         @RequestParam(value ="name",required = false) String name,
342
-                                         @RequestParam(value ="tel",required = false) String tel,
343
-                                         @RequestParam(value ="buildingId",required = false) String buildingId,
344
-                                         @RequestParam(value ="consultName",required = false) String consultName,
345
-                                         @RequestParam(value ="consultTel",required = false) String consultTel,
346
-                                         @RequestParam(value ="pageNumber",defaultValue = "1") Integer pageNumber,
347
-                                         @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
348
-                                         @RequestParam(value ="entryType",required = false) String entryType,
349
-                                         @RequestParam(value ="verifyStatus",required = false) String verifyStatus,
350
-                                         @RequestParam(value = "sex",required = false)Integer sex){
351
-        try{
352
-            return ResponseBean.success(taRecommendCustomerService.getRecCustomerList(pageNumber,pageSize,buildingId,name,tel,consultName,consultTel,entryType,verifyStatus,sex, getOrgId(request),getTaPersonBuildingListByUserId(request)));
353
-        }catch (Exception e){
371
+    public ResponseBean getRecCustomerList(HttpServletRequest request,
372
+                                           @RequestParam(value = "name", required = false) String name,
373
+                                           @RequestParam(value = "tel", required = false) String tel,
374
+                                           @RequestParam(value = "buildingId", required = false) String buildingId,
375
+                                           @RequestParam(value = "consultName", required = false) String consultName,
376
+                                           @RequestParam(value = "consultTel", required = false) String consultTel,
377
+                                           @RequestParam(value = "pageNumber", defaultValue = "1") Integer pageNumber,
378
+                                           @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
379
+                                           @RequestParam(value = "entryType", required = false) String entryType,
380
+                                           @RequestParam(value = "verifyStatus", required = false) String verifyStatus,
381
+                                           @RequestParam(value = "sex", required = false) Integer sex) {
382
+        try {
383
+            return ResponseBean.success(taRecommendCustomerService.getRecCustomerList(pageNumber, pageSize, buildingId, name, tel, consultName, consultTel, entryType, verifyStatus, sex, getOrgId(request), getTaPersonBuildingListByUserId(request)));
384
+        } catch (Exception e) {
354 385
             e.printStackTrace();
355
-            return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
386
+            return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
356 387
         }
357 388
     }
358 389
 
359 390
     //报备客户列表
360 391
     @GetMapping("/admin/customer/recommend/report")
361
-    public ResponseBean getRepCustomerList (@RequestParam(value ="name",required = false) String name,
362
-                                         @RequestParam(value ="tel",required = false) String tel,
363
-                                         @RequestParam(value ="buildingId",required = false) String buildingId,
364
-                                         @RequestParam(value ="consultName",required = false) String consultName,
365
-                                         @RequestParam(value ="consultTel",required = false) String consultTel,
366
-                                         @RequestParam(value ="pageNumber",defaultValue = "1") Integer pageNumber,
367
-                                         @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
368
-                                         @RequestParam(value ="entryType",required = false) String entryType,
369
-                                         @RequestParam(value ="verifyStatus",required = false) String verifyStatus,
370
-                                         @RequestParam(value = "sex",required = false)Integer sex, HttpServletRequest request){
392
+    public ResponseBean getRepCustomerList(@RequestParam(value = "name", required = false) String name,
393
+                                           @RequestParam(value = "tel", required = false) String tel,
394
+                                           @RequestParam(value = "buildingId", required = false) String buildingId,
395
+                                           @RequestParam(value = "consultName", required = false) String consultName,
396
+                                           @RequestParam(value = "consultTel", required = false) String consultTel,
397
+                                           @RequestParam(value = "pageNumber", defaultValue = "1") Integer pageNumber,
398
+                                           @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
399
+                                           @RequestParam(value = "entryType", required = false) String entryType,
400
+                                           @RequestParam(value = "verifyStatus", required = false) String verifyStatus,
401
+                                           @RequestParam(value = "sex", required = false) Integer sex, HttpServletRequest request) {
371 402
         Integer orgid = getOrgId(request);
372
-        try{
373
-            return ResponseBean.success(taRecommendCustomerService.getRepCustomerList(pageNumber,pageSize,buildingId,name,tel,consultName,consultTel,entryType,verifyStatus,sex, orgid,getTaPersonBuildingListByUserId(request)));
374
-        }catch (Exception e){
403
+        try {
404
+            return ResponseBean.success(taRecommendCustomerService.getRepCustomerList(pageNumber, pageSize, buildingId, name, tel, consultName, consultTel, entryType, verifyStatus, sex, orgid, getTaPersonBuildingListByUserId(request)));
405
+        } catch (Exception e) {
375 406
             e.printStackTrace();
376
-            return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
407
+            return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
377 408
         }
378 409
     }
379 410
 
380 411
 
381 412
     /**
382 413
      * 经纪人列表
414
+     *
383 415
      * @param name
384 416
      * @param tel
385 417
      * @param pageNumber
@@ -387,121 +419,124 @@ public class TaRecommendCustomerController extends BaseController {
387 419
      * @return
388 420
      */
389 421
     @GetMapping("/admin/customer/agents")
390
-    public ResponseBean getIndependentAgents (HttpServletRequest request,
391
-                                              @RequestParam(value ="name",required = false) String name,
392
-                                            @RequestParam(value ="tel",required = false) String tel,
393
-                                            @RequestParam(value ="pageNumber",defaultValue = "1") Integer pageNumber,
394
-                                            @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
395
-        try{
396
-            return ResponseBean.success(taRecommendCustomerService.getIndependentAgents(pageNumber,pageSize,name,tel, getOrgId(request)));
397
-        }catch (Exception e){
422
+    public ResponseBean getIndependentAgents(HttpServletRequest request,
423
+                                             @RequestParam(value = "name", required = false) String name,
424
+                                             @RequestParam(value = "tel", required = false) String tel,
425
+                                             @RequestParam(value = "channelId", required = false) String channelId,
426
+                                             @RequestParam(value = "pageNumber", defaultValue = "1") Integer pageNumber,
427
+                                             @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
428
+        try {
429
+            return ResponseBean.success(taRecommendCustomerService.getIndependentAgents(pageNumber, pageSize, name, tel, channelId, getOrgId(request)));
430
+        } catch (Exception e) {
398 431
             e.printStackTrace();
399
-            return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
432
+            return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
400 433
         }
401 434
     }
402 435
 
403 436
     /**
404 437
      * 分配置业顾问
405 438
      */
406
-    @RequestMapping(value="/admin/customer/consultant/assist/{personId}",method= RequestMethod.POST)
407
-    public ResponseBean assistConsultant (@RequestBody TaUser taUser, @PathVariable String personId, HttpServletRequest request){
408
-        try{
439
+    @RequestMapping(value = "/admin/customer/consultant/assist/{personId}", method = RequestMethod.POST)
440
+    public ResponseBean assistConsultant(@RequestBody TaUser taUser, @PathVariable String personId, HttpServletRequest request) {
441
+        try {
409 442
             Integer orgId = getOrgId(request);
410 443
             taRecommendCustomerService.consultantAssist(taUser, personId, orgId);
411 444
             return ResponseBean.success("");
412
-        }catch (Exception e){
445
+        } catch (Exception e) {
413 446
             e.printStackTrace();
414
-            return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
447
+            return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
415 448
         }
416 449
     }
417 450
 
418 451
     /**
419 452
      * 批量分配置业顾问
420 453
      */
421
-    @RequestMapping(value="/admin/customer/consultant/batchAssist",method= RequestMethod.POST)
422
-    public ResponseBean batchAssistConsultant (@RequestBody TaUser taUser, HttpServletRequest request){
423
-        if (CollectionUtils.isEmpty(taUser.getPersonIds())){
454
+    @RequestMapping(value = "/admin/customer/consultant/batchAssist", method = RequestMethod.POST)
455
+    public ResponseBean batchAssistConsultant(@RequestBody TaUser taUser, HttpServletRequest request) {
456
+        if (CollectionUtils.isEmpty(taUser.getPersonIds())) {
424 457
             return ResponseBean.error("请至少选择一条数据", ResponseBean.ERROR_UNAVAILABLE);
425 458
         }
426
-        try{
459
+        try {
427 460
             Integer orgId = getOrgId(request);
428 461
             taRecommendCustomerService.batchConsultantAssist(taUser, orgId);
429 462
             return ResponseBean.success("");
430
-        }catch (Exception e){
463
+        } catch (Exception e) {
431 464
             e.printStackTrace();
432
-            return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
465
+            return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
433 466
         }
434 467
     }
435 468
 
436 469
     @GetMapping("/admin/customer/recommend/{customerId}")
437
-    public ResponseBean getCustomersIRecommended (@RequestParam int pageNumber, @RequestParam int pageSize, @PathVariable String customerId,HttpServletRequest request){
470
+    public ResponseBean getCustomersIRecommended(@RequestParam int pageNumber, @RequestParam int pageSize, @PathVariable String customerId, HttpServletRequest request) {
438 471
         Integer orgId = getOrgId(request);
439
-        try{
440
-            return ResponseBean.success(taRecommendCustomerService.getCustomersIRecommended(pageNumber,pageSize,customerId,orgId,getTaPersonBuildingListByUserId(request)));
441
-        }catch (Exception e){
472
+        try {
473
+            return ResponseBean.success(taRecommendCustomerService.getCustomersIRecommended(pageNumber, pageSize, customerId, orgId, getTaPersonBuildingListByUserId(request)));
474
+        } catch (Exception e) {
442 475
             e.printStackTrace();
443
-            return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
476
+            return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
444 477
         }
445 478
     }
446 479
 
447 480
     @GetMapping("/wx/customer/recommend/mine")
448
-    public ResponseBean getWxCustomersIRecommended (@RequestParam int pageNumber, @RequestParam int pageSize,HttpServletRequest request){
449
-        Integer orgId =getOrgId(request);
481
+    public ResponseBean getWxCustomersIRecommended(@RequestParam int pageNumber, @RequestParam int pageSize, HttpServletRequest request) {
482
+        Integer orgId = getOrgId(request);
450 483
         String openid = getOpenId(request);
451 484
         List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
452 485
         if (null == taPersons || taPersons.size() != 1) {
453 486
             return ResponseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
454 487
         }
455 488
         TaPerson person = taPersons.get(0);
456
-        try{
457
-            return ResponseBean.success(taRecommendCustomerService.getCustomersIRecommended(pageNumber,pageSize,person.getPersonId(),orgId,null));
458
-        }catch (Exception e){
489
+        try {
490
+            return ResponseBean.success(taRecommendCustomerService.getCustomersIRecommended(pageNumber, pageSize, person.getPersonId(), orgId, null));
491
+        } catch (Exception e) {
459 492
             e.printStackTrace();
460
-            return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
493
+            return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
461 494
         }
462 495
     }
463 496
 
464 497
 
465
-
466
-        /**
498
+    /**
467 499
      * 修改对象
500
+     *
468 501
      * @param taRecommendCustomer 实体对象
469 502
      * @return
470 503
      */
471
-    @RequestMapping(value="/wx/customer/recommend/edit/{customerId}",method= RequestMethod.PUT)
504
+    @RequestMapping(value = "/wx/customer/recommend/edit/{customerId}", method = RequestMethod.PUT)
472 505
     public ResponseBean taRecommendCustomerUpdateWx(@PathVariable String customerId,
473
-                                        @RequestBody TaRecommendCustomer taRecommendCustomer){
506
+                                                    @RequestBody TaRecommendCustomer taRecommendCustomer) {
474 507
         ResponseBean responseBean = new ResponseBean();
475 508
         taRecommendCustomer.setCustomerId(customerId);
476 509
         try {
477
-            if (taRecommendCustomerService.updateById(taRecommendCustomer)){
510
+            if (taRecommendCustomerService.updateById(taRecommendCustomer)) {
478 511
                 responseBean.addSuccess(taRecommendCustomer);
479
-            }else {
512
+            } else {
480 513
                 responseBean.addError("fail");
481 514
             }
482
-        }catch (Exception e){
515
+        } catch (Exception e) {
483 516
             e.printStackTrace();
484 517
             responseBean.addError(e.getMessage());
485 518
         }
486 519
         return responseBean;
487 520
     }
521
+
488 522
     /**
489 523
      * 修改对象
524
+     *
490 525
      * @param taRecommendCustomer 实体对象
491 526
      * @return
492 527
      */
493
-    @RequestMapping(value="/admin/customer/recommend/edit/{id}",method= RequestMethod.PUT)
528
+    @RequestMapping(value = "/admin/customer/recommend/edit/{id}", method = RequestMethod.PUT)
494 529
     public ResponseBean taRecommendCustomerUpdate(@PathVariable String id,
495
-                                                  @RequestBody TaRecommendCustomer taRecommendCustomer){
530
+                                                  @RequestBody TaRecommendCustomer taRecommendCustomer) {
496 531
         ResponseBean responseBean = new ResponseBean();
497 532
         taRecommendCustomer.setCustomerId(id);
498 533
         try {
499
-            if (taRecommendCustomerService.updateById(taRecommendCustomer)){
534
+            if (taRecommendCustomerService.updateById(taRecommendCustomer)) {
500 535
                 responseBean.addSuccess(taRecommendCustomer);
501
-            }else {
536
+            } else {
502 537
                 responseBean.addError("fail");
503 538
             }
504
-        }catch (Exception e){
539
+        } catch (Exception e) {
505 540
             e.printStackTrace();
506 541
             responseBean.addError(e.getMessage());
507 542
         }
@@ -536,7 +571,7 @@ public class TaRecommendCustomerController extends BaseController {
536 571
         ResponseBean responseBean = new ResponseBean();
537 572
         try {
538 573
             responseBean.addSuccess(taRecommendCustomerService.getById(customerId));
539
-        }catch (Exception e){
574
+        } catch (Exception e) {
540 575
             e.printStackTrace();
541 576
             responseBean.addError(e.getMessage());
542 577
         }
@@ -549,7 +584,7 @@ public class TaRecommendCustomerController extends BaseController {
549 584
         ResponseBean responseBean = new ResponseBean();
550 585
         try {
551 586
             responseBean.addSuccess(taRecommendCustomerService.getCustomerById(customerId));
552
-        }catch (Exception e){
587
+        } catch (Exception e) {
553 588
             e.printStackTrace();
554 589
             responseBean.addError(e.getMessage());
555 590
         }
@@ -559,14 +594,14 @@ public class TaRecommendCustomerController extends BaseController {
559 594
 
560 595
     @GetMapping(value = "/admin/customer/recommend/get/{id}")
561 596
     public ResponseBean getCustomerDetail(@PathVariable String id,
562
-                                          @RequestParam(value ="pageNumber",defaultValue = "1") Integer pageNumber,
563
-                                          @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
564
-                                          @RequestParam(value ="buildingId",required = false) String buildingId,
597
+                                          @RequestParam(value = "pageNumber", defaultValue = "1") Integer pageNumber,
598
+                                          @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
599
+                                          @RequestParam(value = "buildingId", required = false) String buildingId,
565 600
                                           HttpServletRequest request) {
566 601
         ResponseBean responseBean = new ResponseBean();
567 602
         try {
568
-            responseBean.addSuccess(taRecommendCustomerService.getCustomerDetail(id,pageNumber,pageSize,getTaPersonBuildingListByUserId(request),buildingId));
569
-        }catch (Exception e){
603
+            responseBean.addSuccess(taRecommendCustomerService.getCustomerDetail(id, pageNumber, pageSize, getTaPersonBuildingListByUserId(request), buildingId));
604
+        } catch (Exception e) {
570 605
             e.printStackTrace();
571 606
             responseBean.addError(e.getMessage());
572 607
         }
@@ -575,13 +610,13 @@ public class TaRecommendCustomerController extends BaseController {
575 610
 
576 611
     @GetMapping(value = "/admin/customer/recommend/public/get/{id}")
577 612
     public ResponseBean getPublicCustomerDetail(@PathVariable String id,
578
-                                                @RequestParam(value ="pageNumber",defaultValue = "1") Integer pageNumber,
579
-                                                @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
580
-                                                @RequestParam(value ="buildingId",required = false) String buildingId,HttpServletRequest request) {
613
+                                                @RequestParam(value = "pageNumber", defaultValue = "1") Integer pageNumber,
614
+                                                @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
615
+                                                @RequestParam(value = "buildingId", required = false) String buildingId, HttpServletRequest request) {
581 616
         ResponseBean responseBean = new ResponseBean();
582 617
         try {
583
-            responseBean.addSuccess(taRecommendCustomerService.getPublicCustomerDetail(id,pageNumber,pageSize,getTaPersonBuildingListByUserId(request),buildingId));
584
-        }catch (Exception e){
618
+            responseBean.addSuccess(taRecommendCustomerService.getPublicCustomerDetail(id, pageNumber, pageSize, getTaPersonBuildingListByUserId(request), buildingId));
619
+        } catch (Exception e) {
585 620
             e.printStackTrace();
586 621
             responseBean.addError(e.getMessage());
587 622
         }
@@ -589,29 +624,30 @@ public class TaRecommendCustomerController extends BaseController {
589 624
     }
590 625
 
591 626
     @GetMapping("/admin/customer/recommend/drift")
592
-    public ResponseBean getDriftCustomerList (HttpServletRequest request,
593
-                                              @RequestParam(value ="buildingId",defaultValue = "") String buildingId,
594
-                                              @RequestParam(value ="sceneType",defaultValue = "") String sceneType,
595
-                                         @RequestParam(value ="pageNumber",defaultValue = "1") Integer pageNumber,
596
-                                         @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
597
-        try{
598
-            return ResponseBean.success(taPersonService.getDriftCustomerList(pageNumber,pageSize,buildingId, getOrgId(request),sceneType));
599
-        }catch (Exception e){
627
+    public ResponseBean getDriftCustomerList(HttpServletRequest request,
628
+                                             @RequestParam(value = "buildingId", defaultValue = "") String buildingId,
629
+                                             @RequestParam(value = "sceneType", defaultValue = "") String sceneType,
630
+                                             @RequestParam(value = "pageNumber", defaultValue = "1") Integer pageNumber,
631
+                                             @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
632
+        try {
633
+            return ResponseBean.success(taPersonService.getDriftCustomerList(pageNumber, pageSize, buildingId, getOrgId(request), sceneType));
634
+        } catch (Exception e) {
600 635
             e.printStackTrace();
601
-            return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
636
+            return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
602 637
         }
603 638
     }
604 639
 
605 640
     /**
606 641
      * 修改对象
642
+     *
607 643
      * @return
608 644
      */
609
-    @RequestMapping(value="/admin/customer/recommend/verify/{id}",method= RequestMethod.PUT)
645
+    @RequestMapping(value = "/admin/customer/recommend/verify/{id}", method = RequestMethod.PUT)
610 646
     public ResponseBean taRecommendCustomerVerify(@PathVariable String id,
611 647
                                                   @RequestParam Integer verifyStatus,
612 648
                                                   @RequestParam(required = false) String verifyRemark,
613 649
                                                   @RequestParam(required = false) String realtyConsultant,
614
-                                                  HttpServletRequest request){
650
+                                                  HttpServletRequest request) {
615 651
         if (null == verifyStatus) {
616 652
             return ResponseBean.error("审核结果非法", ResponseBean.ERROR_ILLEGAL_PARAMS);
617 653
         }
@@ -619,9 +655,9 @@ public class TaRecommendCustomerController extends BaseController {
619 655
         ResponseBean responseBean = new ResponseBean();
620 656
         try {
621 657
             TaRecommendCustomer taRecommendCustomer = taRecommendCustomerService.getById(id);
622
-            if(null == taRecommendCustomer.getVerifyStatus() || 0 == taRecommendCustomer.getVerifyStatus().intValue()){ // taRecommendCustomer.getVerifyStatus().equals(CommConstant.VERIFY_READY)
658
+            if (null == taRecommendCustomer.getVerifyStatus() || 0 == taRecommendCustomer.getVerifyStatus().intValue()) { // taRecommendCustomer.getVerifyStatus().equals(CommConstant.VERIFY_READY)
623 659
                 taRecommendCustomer.setVerifyStatus(verifyStatus);
624
-                if(!StringUtils.isEmpty(verifyRemark)){
660
+                if (!StringUtils.isEmpty(verifyRemark)) {
625 661
                     taRecommendCustomer.setVerifyRemark(verifyRemark);
626 662
 //                    if(CommConstant.CUSTOMER_REPORT.equals(taRecommendCustomer.getReportRecommendStatus())){
627 663
 //                        taRecommendCustomer.setRealtyConsultant(taRecommendCustomer.getRecommendPerson());
@@ -644,7 +680,7 @@ public class TaRecommendCustomerController extends BaseController {
644 680
                     }
645 681
                 }
646 682
 
647
-                if (taRecommendCustomerService.updateById(taRecommendCustomer)){
683
+                if (taRecommendCustomerService.updateById(taRecommendCustomer)) {
648 684
 
649 685
                     // 审核通过增加积分
650 686
                     if (CommConstant.VERIFY_AGREE == verifyStatus) {
@@ -652,14 +688,14 @@ public class TaRecommendCustomerController extends BaseController {
652 688
                     }
653 689
 
654 690
                     responseBean.addSuccess(taRecommendCustomer);
655
-                }else {
691
+                } else {
656 692
                     responseBean.addError("fail");
657 693
                 }
658 694
             } else {
659 695
                 responseBean.addSuccess("客户已审核");
660 696
             }
661 697
 
662
-        }catch (Exception e){
698
+        } catch (Exception e) {
663 699
             e.printStackTrace();
664 700
             responseBean.addError(e.getMessage());
665 701
         }
@@ -676,7 +712,7 @@ public class TaRecommendCustomerController extends BaseController {
676 712
         response.setCharacterEncoding("utf-8");
677 713
         response.setHeader("Content-disposition", "attachment;filename=推荐客户.xlsx");
678 714
 
679
-        Integer count = taRecommendCustomerService.getRecCustomerExportCount(getOrgId(request),getTaPersonBuildingListByUserId(request));
715
+        Integer count = taRecommendCustomerService.getRecCustomerExportCount(getOrgId(request), getTaPersonBuildingListByUserId(request));
680 716
 
681 717
         Integer pageCode = 0;
682 718
         Integer pageSize = 100;
@@ -687,10 +723,10 @@ public class TaRecommendCustomerController extends BaseController {
687 723
         // 设置 sheet, 同一个sheet只需要设置一次
688 724
         WriteSheet writeSheet = EasyExcel.writerSheet("推荐客户").build();
689 725
         do {
690
-            List<ExcelRecommendCustomer> recCustomerExport = taRecommendCustomerService.getRecCustomerExport(getOrgId(request), pageCode * pageSize, pageSize,getTaPersonBuildingListByUserId(request));
726
+            List<ExcelRecommendCustomer> recCustomerExport = taRecommendCustomerService.getRecCustomerExport(getOrgId(request), pageCode * pageSize, pageSize, getTaPersonBuildingListByUserId(request));
691 727
             excelWriter.write(recCustomerExport, writeSheet);
692 728
 
693
-            pageCode ++;
729
+            pageCode++;
694 730
         } while (pageCode <= pageCount);
695 731
 
696 732
         /// finish 会帮忙关闭流
@@ -705,20 +741,20 @@ public class TaRecommendCustomerController extends BaseController {
705 741
     @GetMapping("/admin/customer/recommend/report/export")
706 742
     public void reportExport(HttpServletRequest request,
707 743
                              HttpServletResponse response,
708
-                             @RequestParam(value ="name",required = false) String name,
709
-                             @RequestParam(value ="tel",required = false) String tel,
710
-                             @RequestParam(value ="buildingId",required = false) String buildingId,
711
-                             @RequestParam(value ="consultName",required = false) String consultName,
712
-                             @RequestParam(value ="consultTel",required = false) String consultTel,
713
-                             @RequestParam(value ="entryType",required = false) String entryType,
714
-                             @RequestParam(value ="verifyStatus",required = false) String verifyStatus,
715
-                             @RequestParam(value = "sex",required = false)Integer sex) throws IOException {
744
+                             @RequestParam(value = "name", required = false) String name,
745
+                             @RequestParam(value = "tel", required = false) String tel,
746
+                             @RequestParam(value = "buildingId", required = false) String buildingId,
747
+                             @RequestParam(value = "consultName", required = false) String consultName,
748
+                             @RequestParam(value = "consultTel", required = false) String consultTel,
749
+                             @RequestParam(value = "entryType", required = false) String entryType,
750
+                             @RequestParam(value = "verifyStatus", required = false) String verifyStatus,
751
+                             @RequestParam(value = "sex", required = false) Integer sex) throws IOException {
716 752
 //        response.setContentType("application/vnd.ms-excel");
717 753
         response.setContentType("application/octet-stream");
718 754
         response.setCharacterEncoding("utf-8");
719 755
         response.setHeader("Content-disposition", "attachment;filename=报备客户.xlsx");
720 756
 
721
-        Integer count = taRecommendCustomerService.getRepCustomerReportCount(buildingId,name,tel,consultName,consultTel,entryType,verifyStatus,sex,getOrgId(request),getTaPersonBuildingListByUserId(request));
757
+        Integer count = taRecommendCustomerService.getRepCustomerReportCount(buildingId, name, tel, consultName, consultTel, entryType, verifyStatus, sex, getOrgId(request), getTaPersonBuildingListByUserId(request));
722 758
 
723 759
         Integer pageCode = 0;
724 760
         Integer pageSize = 100;
@@ -730,10 +766,10 @@ public class TaRecommendCustomerController extends BaseController {
730 766
         WriteSheet writeSheet = EasyExcel.writerSheet("报备客户").build();
731 767
         List<ReporRecommendCustomer> recCustomerExport = null;
732 768
         do {
733
-            recCustomerExport = taRecommendCustomerService.getRepCustomerReportExport(buildingId, name, tel, consultName, consultTel, entryType, verifyStatus, sex, getOrgId(request), pageCode * pageSize, pageSize,getTaPersonBuildingListByUserId(request));
769
+            recCustomerExport = taRecommendCustomerService.getRepCustomerReportExport(buildingId, name, tel, consultName, consultTel, entryType, verifyStatus, sex, getOrgId(request), pageCode * pageSize, pageSize, getTaPersonBuildingListByUserId(request));
734 770
             excelWriter.write(recCustomerExport, writeSheet);
735 771
 
736
-            pageCode ++;
772
+            pageCode++;
737 773
         } while (pageCode <= pageCount);
738 774
 
739 775
         /// finish 会帮忙关闭流
@@ -745,7 +781,10 @@ public class TaRecommendCustomerController extends BaseController {
745 781
      * 导出数据(经纪人)
746 782
      */
747 783
     @GetMapping("/admin/customer/recommend/agents/export")
748
-    public void agentsExport(HttpServletRequest request, HttpServletResponse response) throws IOException {
784
+    public void agentsExport(@RequestParam(value = "name", required = false) String name,
785
+                             @RequestParam(value = "tel", required = false) String tel,
786
+                             @RequestParam(value = "channelId", required = false) String channelId,
787
+                             HttpServletRequest request, HttpServletResponse response) throws IOException {
749 788
 //        response.setContentType("application/vnd.ms-excel");
750 789
         response.setContentType("application/octet-stream");
751 790
         response.setCharacterEncoding("utf-8");
@@ -763,10 +802,10 @@ public class TaRecommendCustomerController extends BaseController {
763 802
         WriteSheet writeSheet = EasyExcel.writerSheet("经纪人").build();
764 803
         List<AgentsRecommendCustomer> recCustomerExport = null;
765 804
         do {
766
-            recCustomerExport = taRecommendCustomerService.getIndependentAgentsExport(getOrgId(request), pageCode * pageSize, pageSize);
805
+            recCustomerExport = taRecommendCustomerService.getIndependentAgentsExport(name, tel, channelId, getOrgId(request), pageCode * pageSize, pageSize);
767 806
             excelWriter.write(recCustomerExport, writeSheet);
768 807
 
769
-            pageCode ++;
808
+            pageCode++;
770 809
         } while (pageCode <= pageCount);
771 810
 
772 811
         /// finish 会帮忙关闭流
@@ -775,11 +814,11 @@ public class TaRecommendCustomerController extends BaseController {
775 814
     }
776 815
 
777 816
 
778
-
779 817
     // 客户列表 公客/私客
780 818
 
781 819
     /**
782 820
      * 导出数据 客户列表 公客/私客
821
+     *
783 822
      * @param request
784 823
      * @param response
785 824
      * @param name
@@ -792,22 +831,24 @@ public class TaRecommendCustomerController extends BaseController {
792 831
      * @param sex
793 832
      * @param customerType
794 833
      * @param status
834
+     * @param belongStatus 是否归属项目 1是  0否
795 835
      * @throws IOException
796 836
      */
797 837
     @GetMapping("/admin/customer/recommend/export")
798
-    public void getCustomerExportList (HttpServletRequest request,
799
-                                         HttpServletResponse response,
800
-                                         @RequestParam(value ="name",required = false) String name,
801
-                                         @RequestParam(value ="tel",required = false) String tel,
802
-                                         @RequestParam(value ="buildingId",required = false) String buildingId,
803
-                                         @RequestParam(value ="consultName",required = false) String consultName,
804
-                                         @RequestParam(value ="consultTel",required = false) String consultTel,
805
-                                         @RequestParam(value ="entryType",required = false) String entryType,
806
-                                         @RequestParam(value ="verifyStatus",required = false) String verifyStatus,
807
-                                         @RequestParam(value = "sex",required = false)Integer sex,
808
-                                         @RequestParam(value = "customerType") String customerType,
809
-                                         @RequestParam(value = "status",required = false) Integer status,
810
-                                       @RequestParam(value = "sceneType",required = false) String sceneType) throws IOException { // public 公  private 私
838
+    public void getCustomerExportList(HttpServletRequest request,
839
+                                      HttpServletResponse response,
840
+                                      @RequestParam(value = "name", required = false) String name,
841
+                                      @RequestParam(value = "tel", required = false) String tel,
842
+                                      @RequestParam(value = "buildingId", required = false) String buildingId,
843
+                                      @RequestParam(value = "consultName", required = false) String consultName,
844
+                                      @RequestParam(value = "consultTel", required = false) String consultTel,
845
+                                      @RequestParam(value = "entryType", required = false) String entryType,
846
+                                      @RequestParam(value = "verifyStatus", required = false) String verifyStatus,
847
+                                      @RequestParam(value = "sex", required = false) Integer sex,
848
+                                      @RequestParam(value = "customerType") String customerType,
849
+                                      @RequestParam(value = "status", required = false) Integer status,
850
+                                      @RequestParam(value = "sceneType", required = false) String sceneType,
851
+                                      @RequestParam(value = "belongStatus", required = false) Integer belongStatus) throws IOException { // public 公  private 私
811 852
 
812 853
         //        response.setContentType("application/vnd.ms-excel");
813 854
         response.setContentType("application/octet-stream");
@@ -835,8 +876,8 @@ public class TaRecommendCustomerController extends BaseController {
835 876
 //            pageCount = count % pageSize == 0 ? count / pageSize : (count / pageSize) + 1;
836 877
 //            List<PublicCustomerExport> publicList = null;
837 878
 //            do {
838
-                List<PublicCustomerExport> publicList = taRecommendCustomerMapper.getPublicCustomerExportList(pageCode * pageSize, pageSize, buildingId, name, tel,  entryType, verifyStatus, sex, orgId,consultTel,sceneType,getTaPersonBuildingListByUserId(request));
839
-                excelWriter.write(publicList, writeSheet);
879
+            List<PublicCustomerExport> publicList = taRecommendCustomerMapper.getPublicCustomerExportList(pageCode * pageSize, pageSize, buildingId, name, tel, entryType, verifyStatus, sex, orgId, consultTel, sceneType, getTaPersonBuildingListByUserId(request), belongStatus);
880
+            excelWriter.write(publicList, writeSheet);
840 881
 
841 882
 //                pageCode ++;
842 883
 //            } while (pageCode <= pageCount);
@@ -857,8 +898,8 @@ public class TaRecommendCustomerController extends BaseController {
857 898
 //            pageCount = count % pageSize == 0 ? count / pageSize : (count / pageSize) + 1;
858 899
 //            List<PrivateCustomerExport> privateList = null;
859 900
 //            do {
860
-                List<PrivateCustomerExport> privateList = taRecommendCustomerMapper.getCustomerExportList(pageCode *  pageSize, pageSize, buildingId, name, tel, consultName, consultTel, entryType, verifyStatus, sex, orgId,status,sceneType,getTaPersonBuildingListByUserId(request));
861
-                excelWriter.write(privateList, writeSheet);
901
+            List<PrivateCustomerExport> privateList = taRecommendCustomerMapper.getCustomerExportList(pageCode * pageSize, pageSize, buildingId, name, tel, consultName, consultTel, entryType, verifyStatus, sex, orgId, status, sceneType, getTaPersonBuildingListByUserId(request));
902
+            excelWriter.write(privateList, writeSheet);
862 903
 
863 904
 //                pageCode ++;
864 905
 //            } while (pageCode <= pageCount);
@@ -869,9 +910,10 @@ public class TaRecommendCustomerController extends BaseController {
869 910
 
870 911
 
871 912
     }
872
-    
913
+
873 914
     /**
874 915
      * 查询判客工具下的我的客户人数集合
916
+     *
875 917
      * @param request
876 918
      * @return
877 919
      */
@@ -881,44 +923,47 @@ public class TaRecommendCustomerController extends BaseController {
881 923
         String openid = getOpenId(request);
882 924
         return taRecommendCustomerService.getMyCustStatistics(openid);
883 925
     }
884
-    
926
+
885 927
     /**
886 928
      * 分页查询判客工具下的我的客户跟进人集合
887
-     *  根据type区分  follow 跟进  clinch 成交
929
+     * 根据type区分  follow 跟进  clinch 成交
930
+     *
888 931
      * @param request
889 932
      * @return
890 933
      */
891 934
     @GetMapping("/wx/inventory/customer/statistics/{type}")
892 935
     @ApiOperation(value = "查询我的客户人数统计", notes = "查询我的客户人数统计")
893 936
     public ResponseBean getMyCustFollows(@PathVariable(value = "type") String type,
894
-                                         @RequestParam(value = "pageNumber",defaultValue = "0") Integer pageNumber,
895
-                                         @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
896
-                                         @RequestParam(value = "name",required = false) String name,
897
-                                         @RequestParam(value = "phone",required = false) String phone,
898
-                                         @RequestParam(value = "status",required = false) Integer status,
899
-                                         @RequestParam(value = "startReportDate",required = false) String startReportDate,
900
-                                         @RequestParam(value = "endReportDate",required = false) String endReportDate,
901
-                                         @RequestParam(value = "startArrivalDate",required = false) String startArrivalDate,
902
-                                         @RequestParam(value = "endArrivalDate",required = false) String endArrivalDate,
937
+                                         @RequestParam(value = "pageNumber", defaultValue = "0") Integer pageNumber,
938
+                                         @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
939
+                                         @RequestParam(value = "name", required = false) String name,
940
+                                         @RequestParam(value = "phone", required = false) String phone,
941
+                                         @RequestParam(value = "status", required = false) Integer status,
942
+                                         @RequestParam(value = "startReportDate", required = false) String startReportDate,
943
+                                         @RequestParam(value = "endReportDate", required = false) String endReportDate,
944
+                                         @RequestParam(value = "startArrivalDate", required = false) String startArrivalDate,
945
+                                         @RequestParam(value = "endArrivalDate", required = false) String endArrivalDate,
903 946
                                          HttpServletRequest request) {
904 947
         String openid = getOpenId(request);
905
-        return taRecommendCustomerService.getMyCustFollowOrClinch(pageNumber,pageSize,openid,type,name,phone,status,startReportDate,endReportDate,startArrivalDate,endArrivalDate);
948
+        return taRecommendCustomerService.getMyCustFollowOrClinch(pageNumber, pageSize, openid, type, name, phone, status, startReportDate, endReportDate, startArrivalDate, endArrivalDate);
906 949
     }
907
-    
950
+
908 951
     /**
909 952
      * 查询盘客工具下我的客户详情
953
+     *
910 954
      * @param request
911 955
      * @return
912 956
      */
913 957
     @GetMapping("/wx/inventory/customer/{customerId}")
914 958
     @ApiOperation(value = "查询客户详情", notes = "查询客户详情")
915
-    public ResponseBean getMyCustDetail(@PathVariable(value = "customerId") String customerId,HttpServletRequest request) {
959
+    public ResponseBean getMyCustDetail(@PathVariable(value = "customerId") String customerId, HttpServletRequest request) {
916 960
         String openid = getOpenId(request);
917
-        return taRecommendCustomerService.getMyCustDetail(customerId,openid);
961
+        return taRecommendCustomerService.getMyCustDetail(customerId, openid);
918 962
     }
919
-    
963
+
920 964
     /**
921 965
      * 查询盘客工具下编辑基本信息
966
+     *
922 967
      * @param request
923 968
      * @return
924 969
      */
@@ -928,6 +973,40 @@ public class TaRecommendCustomerController extends BaseController {
928 973
                                            @RequestBody TaRecommendCustomer taRecommendCustomer, HttpServletRequest request) {
929 974
         String openid = getOpenId(request);
930 975
         taRecommendCustomer.setCustomerId(customerId);
931
-        return taRecommendCustomerService.updateMyCust(taRecommendCustomer,openid);
976
+        return taRecommendCustomerService.updateMyCust(taRecommendCustomer, openid);
977
+    }
978
+
979
+    /**
980
+     * 校验此职业顾问下有没有私客存在
981
+     * @return
982
+     */
983
+    @GetMapping("/admin/consultant/customer/list")
984
+    public ResponseBean consultantCustomerList(@RequestParam(value = "userId") Integer userId,
985
+                                               @RequestParam(value = "personId") String personId,
986
+                                               @RequestParam(value = "buildingId") String buildingId,
987
+                                               HttpServletRequest request){
988
+        Integer orgId = getOrgId(request);
989
+        try{
990
+            List<TaRecommendCustomer> list = taRecommendCustomerService.getConsultantCustomerList(userId,personId,buildingId,orgId,getTaPersonBuildingListByUserId(request));
991
+            return ResponseBean.success(list);
992
+        }catch (Exception e){
993
+            e.printStackTrace();
994
+            return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
995
+        }
996
+    }
997
+
998
+    /**
999
+     * 迁移私客到新的置业顾问
1000
+     * @return
1001
+     */
1002
+    @PutMapping("/admin/consultant/customer/move")
1003
+    public ResponseBean moveConsultantCustomer(@RequestBody List<TaRecommendCustomer> list,HttpServletRequest request){
1004
+        try{
1005
+            taRecommendCustomerService.updateBatchById(list);
1006
+            return ResponseBean.success(list);
1007
+        }catch (Exception e){
1008
+            e.printStackTrace();
1009
+            return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
1010
+        }
932 1011
     }
933 1012
 }

+ 4
- 4
src/main/java/com/huiju/estateagents/entity/TaPerson.java Voir le fichier

@@ -1,9 +1,5 @@
1 1
 package com.huiju.estateagents.entity;
2 2
 
3
-import java.time.LocalDateTime;
4
-import java.io.Serializable;
5
-import java.util.List;
6
-
7 3
 import com.baomidou.mybatisplus.annotation.IdType;
8 4
 import com.baomidou.mybatisplus.annotation.TableField;
9 5
 import com.baomidou.mybatisplus.annotation.TableId;
@@ -12,6 +8,10 @@ import lombok.Data;
12 8
 import lombok.EqualsAndHashCode;
13 9
 import lombok.experimental.Accessors;
14 10
 
11
+import java.io.Serializable;
12
+import java.time.LocalDateTime;
13
+import java.util.List;
14
+
15 15
 /**
16 16
  * <p>
17 17
  * 人员表

+ 23
- 5
src/main/java/com/huiju/estateagents/entity/TaRecommendCustomer.java Voir le fichier

@@ -1,10 +1,5 @@
1 1
 package com.huiju.estateagents.entity;
2 2
 
3
-import java.time.LocalDateTime;
4
-import java.io.Serializable;
5
-import java.util.List;
6
-import java.util.Map;
7
-
8 3
 import com.alibaba.excel.annotation.ExcelProperty;
9 4
 import com.alibaba.excel.annotation.format.DateTimeFormat;
10 5
 import com.baomidou.mybatisplus.annotation.IdType;
@@ -16,6 +11,11 @@ import lombok.Data;
16 11
 import lombok.EqualsAndHashCode;
17 12
 import lombok.experimental.Accessors;
18 13
 
14
+import java.io.Serializable;
15
+import java.time.LocalDateTime;
16
+import java.util.List;
17
+import java.util.Map;
18
+
19 19
 /**
20 20
  * <p>
21 21
  * 推荐客户表
@@ -199,9 +199,27 @@ public class TaRecommendCustomer implements Serializable {
199 199
     @TableField(exist = false)
200 200
     private String avatarurl;
201 201
 
202
+    /**
203
+     * 所属项目
204
+     */
205
+    @TableField(exist = false)
206
+    private String buildingName;
207
+
202 208
     /**
203 209
      * 来源类型
204 210
      */
205 211
     @TableField(exist = false)
206 212
     private String personFrom;
213
+
214
+    /**
215
+     * 迁移人的名称
216
+     */
217
+    @TableField(exist = false)
218
+    private String moveUserName;
219
+
220
+    /**
221
+     * 迁移人的userId
222
+     */
223
+    @TableField(exist = false)
224
+    private String moveUserId;
207 225
 }

+ 14
- 7
src/main/java/com/huiju/estateagents/excel/PublicCustomerExport.java Voir le fichier

@@ -28,7 +28,7 @@ public class PublicCustomerExport {
28 28
      * 性别
29 29
      */
30 30
     @ColumnWidth(15)
31
-    @ExcelProperty(value = "性别", index = 7)
31
+    @ExcelProperty(value = "性别", index = 8)
32 32
     private String sex;
33 33
 
34 34
     /**
@@ -42,7 +42,7 @@ public class PublicCustomerExport {
42 42
      * 归属地
43 43
      */
44 44
     @ColumnWidth(15)
45
-    @ExcelProperty(value = "归属地", index = 4)
45
+    @ExcelProperty(value = "归属地", index = 5)
46 46
     private String province;
47 47
 
48 48
 //    /**
@@ -56,34 +56,41 @@ public class PublicCustomerExport {
56 56
      * 来访方式
57 57
      */
58 58
     @ColumnWidth(15)
59
-    @ExcelProperty(value = "来访方式(场景渠道)", index = 5)
59
+    @ExcelProperty(value = "来访方式(场景渠道)", index = 6)
60 60
     private String sceneType;
61 61
 
62 62
     /**
63 63
      * 意向度
64 64
      */
65 65
     @ColumnWidth(15)
66
-    @ExcelProperty(value = "意向度(意向值)", index = 6)
66
+    @ExcelProperty(value = "意向度(意向值)", index = 7)
67 67
     private String intention;
68 68
 
69 69
     /**
70 70
      * 项目名称
71 71
      */
72 72
     @ColumnWidth(15)
73
-    @ExcelProperty(value = "项目名称", index = 3)
73
+    @ExcelProperty(value = "项目名称", index = 4)
74 74
     private String buildingName;
75 75
 
76
+    /**
77
+     * 项目名称
78
+     */
79
+    @ColumnWidth(15)
80
+    @ExcelProperty(value = "是否归属项目", index = 3)
81
+    private String belongStatus;
82
+
76 83
     /**
77 84
      * 意向度
78 85
      */
79 86
     @ColumnWidth(15)
80
-    @ExcelProperty(value = "推广人员", index = 8)
87
+    @ExcelProperty(value = "推广人员", index = 9)
81 88
     private String sharePersonName ;
82 89
 
83 90
     /**
84 91
      * 意向度
85 92
      */
86 93
     @ColumnWidth(15)
87
-    @ExcelProperty(value = "积分值", index = 9)
94
+    @ExcelProperty(value = "积分值", index = 10)
88 95
     private String points ;
89 96
 }

+ 2
- 0
src/main/java/com/huiju/estateagents/mapper/TaPersonMapper.java Voir le fichier

@@ -256,4 +256,6 @@ public interface TaPersonMapper extends BaseMapper<TaPerson> {
256 256
     Integer selectTodayRecentlyCount(@Param("orgId") Integer orgId, @Param("nowDate") LocalDateTime nowDate);
257 257
 
258 258
     List<Map<String, Object>> selectCityPerson(@Param("orgId") Integer orgId);
259
+
260
+    Integer cancelConsulatant(@Param("personId") String personId);
259 261
 }

+ 41
- 4
src/main/java/com/huiju/estateagents/mapper/TaRecommendCustomerMapper.java Voir le fichier

@@ -36,7 +36,7 @@ public interface TaRecommendCustomerMapper extends BaseMapper<TaRecommendCustome
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 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 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("orgId") Integer orgId);
39
+    IPage<TaPerson> getIndependentAgents(IPage<TaPerson>page, @Param("name") String name, @Param("tel") String tel, @Param("channelId") String channelId, @Param("orgId") Integer orgId);
40 40
 
41 41
     /**
42 42
      * 公客
@@ -49,7 +49,21 @@ public interface TaRecommendCustomerMapper extends BaseMapper<TaRecommendCustome
49 49
      * @param personBuildingList
50 50
      * @return
51 51
      */
52
-    IPage<TaPerson> getPublicCustomerList(IPage<TaPerson> page, @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, @Param("sceneType") String sceneType,@Param("personBuildingList") List<TaPersonBuilding> personBuildingList,@Param("buildingId") String buildingId, @Param("startCreateDate") String startCreateDate, @Param("endCreateDate") String endCreateDate, @Param("sharePersonName") String sharePersonName);
52
+    IPage<TaPerson> getPublicCustomerList(IPage<TaPerson> page,
53
+                                          @Param("name") String name,
54
+                                          @Param("tel") String tel,
55
+                                          @Param("entryType") String entryType,
56
+                                          @Param("verifyStatus") String verifyStatus,
57
+                                          @Param("sex") Integer sex,
58
+                                          @Param("orgId") Integer orgId,
59
+                                          @Param("consultTel") String consultTel,
60
+                                          @Param("sceneType") String sceneType,
61
+                                          @Param("personBuildingList") List<TaPersonBuilding> personBuildingList,
62
+                                          @Param("buildingId") String buildingId,
63
+                                          @Param("startCreateDate") String startCreateDate,
64
+                                          @Param("endCreateDate") String endCreateDate,
65
+                                          @Param("sharePersonName") String sharePersonName,
66
+                                          @Param("belongStatus") Integer belongStatus);
53 67
 
54 68
     /**
55 69
      * 导出数据 获取推荐用户数据
@@ -93,7 +107,7 @@ public interface TaRecommendCustomerMapper extends BaseMapper<TaRecommendCustome
93 107
      * @param pageSize
94 108
      * @return
95 109
      */
96
-    List<AgentsRecommendCustomer> getIndependentAgentsExport(@Param("orgId") Integer orgId, @Param("pageCode") Integer pageCode, @Param("pageSize") Integer pageSize);
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);
97 111
 
98 112
     /**
99 113
      * 导出数据 公客总数
@@ -119,7 +133,19 @@ public interface TaRecommendCustomerMapper extends BaseMapper<TaRecommendCustome
119 133
      * @param consultTel
120 134
      * @return
121 135
      */
122
-    List<PublicCustomerExport> getPublicCustomerExportList(@Param("pageCode") Integer pageCode, @Param("pageSize") Integer pageSize, @Param("buildingId")String buildingId, @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, @Param("sceneType")String sceneType,@Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
136
+    List<PublicCustomerExport> getPublicCustomerExportList(@Param("pageCode") Integer pageCode,
137
+                                                           @Param("pageSize") Integer pageSize,
138
+                                                           @Param("buildingId")String buildingId,
139
+                                                           @Param("name") String name,
140
+                                                           @Param("tel") String tel,
141
+                                                           @Param("entryType") String entryType,
142
+                                                           @Param("verifyStatus") String verifyStatus,
143
+                                                           @Param("sex") Integer sex,
144
+                                                           @Param("orgId") Integer orgId,
145
+                                                           @Param("consultTel")String consultTel,
146
+                                                           @Param("sceneType")String sceneType,
147
+                                                           @Param("personBuildingList") List<TaPersonBuilding> personBuildingList,
148
+                                                           @Param("belongStatus") Integer belongStatus);
123 149
 
124 150
     /**
125 151
      * 导出数据 私客总数
@@ -210,4 +236,15 @@ public interface TaRecommendCustomerMapper extends BaseMapper<TaRecommendCustome
210 236
      * @return
211 237
      */
212 238
     TaRecommendCustomer getCustomerByProjectOrOrg(@Param("orgId") Integer orgId, @Param("personId") String personId, @Param("buildingId") String buildingId);
239
+
240
+    /**
241
+     * 获取置业福问下的客户
242
+     * @param userId
243
+     * @param personId
244
+     * @param buildingId
245
+     * @param orgId
246
+     * @return
247
+     */
248
+    List<TaRecommendCustomer> getConsultantCustomerList(@Param("userId") Integer userId,@Param("personId") String personId,@Param("buildingId") String buildingId,@Param("orgId") Integer orgId);
249
+
213 250
 }

+ 45
- 22
src/main/java/com/huiju/estateagents/service/ITaRecommendCustomerService.java Voir le fichier

@@ -1,18 +1,16 @@
1 1
 package com.huiju.estateagents.service;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.baomidou.mybatisplus.extension.service.IService;
4 5
 import com.huiju.estateagents.base.ResponseBean;
5 6
 import com.huiju.estateagents.center.taUser.entity.TaUser;
6 7
 import com.huiju.estateagents.entity.TaPerson;
7 8
 import com.huiju.estateagents.entity.TaPersonBuilding;
8 9
 import com.huiju.estateagents.entity.TaRecommendCustomer;
9
-import com.baomidou.mybatisplus.extension.service.IService;
10 10
 import com.huiju.estateagents.excel.AgentsRecommendCustomer;
11 11
 import com.huiju.estateagents.excel.ExcelRecommendCustomer;
12 12
 import com.huiju.estateagents.excel.ReporRecommendCustomer;
13
-import io.swagger.models.auth.In;
14 13
 
15
-import java.time.LocalDateTime;
16 14
 import java.util.List;
17 15
 
18 16
 /**
@@ -31,66 +29,75 @@ public interface ITaRecommendCustomerService extends IService<TaRecommendCustome
31 29
 
32 30
     ResponseBean updateCustByJSON(String paramStr);
33 31
 
34
-    ResponseBean recommendCust(String paramStr, String openid,Integer orgId);
32
+    ResponseBean recommendCust(String paramStr, String openid, Integer orgId);
35 33
 
36
-    ResponseBean reportCust(String paramStr, String openid,Integer orgId);
34
+    ResponseBean reportCust(String paramStr, String openid, Integer orgId);
37 35
 
38
-    IPage<TaRecommendCustomer> getUnSignedCustomerList(int pageNumber, int pageSize, String building,String personId);
36
+    IPage<TaRecommendCustomer> getUnSignedCustomerList(int pageNumber, int pageSize, String building, String personId);
39 37
 
40
-    IPage getCustomerList(Integer status,int pageNumber, int pageSize, String building,String name,String tel,String consultName,String consultTel,String entryType,String verifyStatus,Integer sex, String customerType, Integer orgId,List<TaPersonBuilding> taPersonBuildingList,String sceneType, String startCreateDate, String endCreateDate, String sharePersonName);
38
+    IPage getCustomerList(Integer status, int pageNumber, int pageSize, String building, String name, String tel, String consultName,
39
+                          String consultTel, String entryType, String verifyStatus, Integer sex, String customerType, Integer orgId,
40
+                          List<TaPersonBuilding> taPersonBuildingList, String sceneType, String startCreateDate, String endCreateDate,
41
+                          String sharePersonName, Integer belongStatus);
41 42
 
42
-    IPage<TaRecommendCustomer> getRecCustomerList(int pageNumber, int pageSize, String building,String name,String tel,String consultName,String consultTel,String entryType,String verifyStatus,Integer sex, Integer orgId,List<TaPersonBuilding> taPersonBuildingList);
43
+    IPage<TaRecommendCustomer> getRecCustomerList(int pageNumber, int pageSize, String building, String name, String tel, String consultName, String consultTel, String entryType, String verifyStatus, Integer sex, Integer orgId, List<TaPersonBuilding> taPersonBuildingList);
43 44
 
44
-    IPage<TaRecommendCustomer> getRepCustomerList(int pageNumber, int pageSize,String building,String name,String tel,String consultName,String consultTel,String entryType,String verifyStatus,Integer sex, Integer orgId,List<TaPersonBuilding> taPersonBuildingList);
45
+    IPage<TaRecommendCustomer> getRepCustomerList(int pageNumber, int pageSize, String building, String name, String tel, String consultName, String consultTel, String entryType, String verifyStatus, Integer sex, Integer orgId, List<TaPersonBuilding> taPersonBuildingList);
45 46
 
46
-    IPage<TaPerson> getIndependentAgents(int pageNumber, int pageSize,String name,String tel, Integer orgId);
47
+    IPage<TaPerson> getIndependentAgents(int pageNumber, int pageSize, String name, String tel, String channelId, Integer orgId);
47 48
 
48 49
 
49
-    TaRecommendCustomer getCustomerDetail(String customerId,int pageNumber, int pageSize,List<TaPersonBuilding> taPersonBuildingList,String buildingId);
50
+    TaRecommendCustomer getCustomerDetail(String customerId, int pageNumber, int pageSize, List<TaPersonBuilding> taPersonBuildingList, String buildingId);
50 51
 
51
-    TaPerson getPublicCustomerDetail(String personId,int pageNumber, int pageSize,List<TaPersonBuilding> taPersonBuildingList,String buildingId);
52
+    TaPerson getPublicCustomerDetail(String personId, int pageNumber, int pageSize, List<TaPersonBuilding> taPersonBuildingList, String buildingId);
52 53
 
53 54
     TaRecommendCustomer getCustomerById(String customerId);
54 55
 
55
-    IPage<TaRecommendCustomer>getCustomersIRecommended(int pageNumber, int pageSize,String customerId,Integer orgId,List<TaPersonBuilding> taPersonBuildingList);
56
+    IPage<TaRecommendCustomer> getCustomersIRecommended(int pageNumber, int pageSize, String customerId, Integer orgId, List<TaPersonBuilding> taPersonBuildingList);
56 57
 
57 58
     TaRecommendCustomer newByPerson(TaPerson person);
58 59
 
59 60
     ResponseBean consultantAssist(TaUser taUser, String personId, Integer orgId);
60 61
 
61 62
     ResponseBean batchConsultantAssist(TaUser taUser, Integer orgId);
63
+
62 64
     /**
63 65
      * 导出数据(推荐客户)
66
+     *
64 67
      * @param orgId
65 68
      * @return
66 69
      */
67
-    List<ExcelRecommendCustomer> getRecCustomerExport(Integer orgId, Integer pageCode, Integer pageSize,List<TaPersonBuilding> taPersonBuildingList);
70
+    List<ExcelRecommendCustomer> getRecCustomerExport(Integer orgId, Integer pageCode, Integer pageSize, List<TaPersonBuilding> taPersonBuildingList);
68 71
 
69 72
     /**
70 73
      * 导出数据(推荐客户) 总数
74
+     *
71 75
      * @param orgId
72 76
      * @return
73 77
      */
74
-    Integer getRecCustomerExportCount(Integer orgId,List<TaPersonBuilding> taPersonBuildingList);
78
+    Integer getRecCustomerExportCount(Integer orgId, List<TaPersonBuilding> taPersonBuildingList);
75 79
 
76 80
     /**
77 81
      * 导出数据(报备客户) 总数
82
+     *
78 83
      * @param orgId
79 84
      * @return
80 85
      */
81
-    Integer getRepCustomerReportCount(String building, String name, String tel, String consultName, String consultTel, String entryType, String verifyStatus, Integer sex, Integer orgId,List<TaPersonBuilding> taPersonBuildingList);
86
+    Integer getRepCustomerReportCount(String building, String name, String tel, String consultName, String consultTel, String entryType, String verifyStatus, Integer sex, Integer orgId, List<TaPersonBuilding> taPersonBuildingList);
82 87
 
83 88
     /**
84 89
      * 导出数据(报备客户)
90
+     *
85 91
      * @param orgId
86 92
      * @param pageCode
87 93
      * @param pageSize
88 94
      * @return
89 95
      */
90
-    List<ReporRecommendCustomer> getRepCustomerReportExport(String building, String name, String tel, String consultName, String consultTel, String entryType, String verifyStatus, Integer sex, Integer orgId, Integer pageCode, Integer pageSize,List<TaPersonBuilding> taPersonBuildingList);
96
+    List<ReporRecommendCustomer> getRepCustomerReportExport(String building, String name, String tel, String consultName, String consultTel, String entryType, String verifyStatus, Integer sex, Integer orgId, Integer pageCode, Integer pageSize, List<TaPersonBuilding> taPersonBuildingList);
91 97
 
92 98
     /**
93 99
      * 导出数据(经纪人) 总数
100
+     *
94 101
      * @param orgId
95 102
      * @return
96 103
      */
@@ -98,22 +105,25 @@ public interface ITaRecommendCustomerService extends IService<TaRecommendCustome
98 105
 
99 106
     /**
100 107
      * 导出数据(经纪人)
108
+     *
101 109
      * @param orgId
102 110
      * @param pageCode
103 111
      * @param pageSize
104 112
      * @return
105 113
      */
106
-    List<AgentsRecommendCustomer> getIndependentAgentsExport(Integer orgId, Integer pageCode, Integer pageSize);
107
-    
114
+    List<AgentsRecommendCustomer> getIndependentAgentsExport(String name, String tel, String channelId, Integer orgId, Integer pageCode, Integer pageSize);
115
+
108 116
     /**
109 117
      * 查询我的客户人数集合
118
+     *
110 119
      * @param openid
111 120
      * @return
112 121
      */
113 122
     ResponseBean getMyCustStatistics(String openid);
114
-    
123
+
115 124
     /**
116 125
      * 分页查询我的跟进客户集合
126
+     *
117 127
      * @param pageNumber
118 128
      * @param pageSize
119 129
      * @param openid
@@ -127,17 +137,19 @@ public interface ITaRecommendCustomerService extends IService<TaRecommendCustome
127 137
      * @return
128 138
      */
129 139
     ResponseBean getMyCustFollowOrClinch(Integer pageNumber, Integer pageSize, String openid, String type, String name, String phone, Integer status, String startReportDate, String endReportDate, String startArrivalDate, String endArrivalDate);
130
-    
140
+
131 141
     /**
132 142
      * 获取盘客工具下我的客户详情
143
+     *
133 144
      * @param customerId
134 145
      * @param openid
135 146
      * @return
136 147
      */
137 148
     ResponseBean getMyCustDetail(String customerId, String openid);
138
-    
149
+
139 150
     /**
140 151
      * 更新我的客户基本信息
152
+     *
141 153
      * @param taRecommendCustomer
142 154
      * @param openid
143 155
      * @return
@@ -146,6 +158,7 @@ public interface ITaRecommendCustomerService extends IService<TaRecommendCustome
146 158
 
147 159
     /**
148 160
      * 查询置业顾问的 归属客户
161
+     *
149 162
      * @param openid
150 163
      * @param keywords
151 164
      * @param pageNumber
@@ -154,4 +167,14 @@ public interface ITaRecommendCustomerService extends IService<TaRecommendCustome
154 167
      */
155 168
     ResponseBean getAdminMyCustList(String openid, String keywords, int pageNumber, int pageSize);
156 169
 
170
+    /**
171
+     * 获取置业顾问下
172
+     * @param userId
173
+     * @param personId
174
+     * @param buildingId
175
+     * @param orgId
176
+     * @param taPersonBuildingListByUserId
177
+     * @return
178
+     */
179
+    List<TaRecommendCustomer> getConsultantCustomerList(Integer userId, String personId, String buildingId, Integer orgId, List<TaPersonBuilding> taPersonBuildingListByUserId);
157 180
 }

+ 65
- 0
src/main/java/com/huiju/estateagents/service/impl/TaPersonServiceImpl.java Voir le fichier

@@ -73,6 +73,12 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
73 73
     @Autowired
74 74
     private TaSaveMapper taSaveMapper;
75 75
 
76
+    @Autowired
77
+    private TaChannelPersonMapper taChannelPersonMapper;
78
+
79
+    @Autowired
80
+    private TaChannelMapper taChannelMapper;
81
+
76 82
     @Autowired
77 83
     private TaBuildingMapper taBuildingMapper;
78 84
 
@@ -100,6 +106,8 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
100 106
     @Autowired
101 107
     private TaShareContentService taShareContentService;
102 108
 
109
+    @Autowired
110
+    private TaSharePersonFromServiceImpl taSharePersonFromService;
103 111
 
104 112
     @Resource
105 113
     private ApplicationContext applicationContext;
@@ -436,6 +444,18 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
436 444
         result.put("personType",taPerson.getPersonType());
437 445
         result.put("userId", taPerson.getUserId());
438 446
 
447
+        //经纪人所属渠道
448
+        QueryWrapper<TaChannelPerson> taChannelPersonQueryWrapper = new QueryWrapper<>();
449
+        taChannelPersonQueryWrapper.eq("person_id", taPerson.getPersonId());
450
+        TaChannelPerson taChannelPerson = taChannelPersonMapper.selectOne(taChannelPersonQueryWrapper);
451
+
452
+        if (taChannelPerson != null){
453
+            QueryWrapper<TaChannel> taChannelQueryWrapper = new QueryWrapper<>();
454
+            taChannelQueryWrapper.eq("channel_id", taChannelPerson.getChannelId());
455
+            TaChannel taChannel = taChannelMapper.selectOne(taChannelQueryWrapper);
456
+            result.put("channelName", taChannel.getChannelName());
457
+        }
458
+
439 459
         return ResponseBean.success(result);
440 460
     }
441 461
 
@@ -1030,6 +1050,51 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
1030 1050
         return customer;
1031 1051
     }
1032 1052
 
1053
+    private String getSharePersonFrom(TaPerson person){
1054
+        QueryWrapper<TaSharePersonFrom> taSharePersonFromQueryWrapper = new QueryWrapper<>();
1055
+        taSharePersonFromQueryWrapper.eq("person_id", person.getPersonId());
1056
+        taSharePersonFromQueryWrapper.eq("is_first_time", CommConstant.STATUS_NORMAL);
1057
+        taSharePersonFromQueryWrapper.eq("status", 1);
1058
+        List<TaSharePersonFrom> taSharePersonFroms = taSharePersonFromService.list(taSharePersonFromQueryWrapper);
1059
+        if (CollectionUtils.isEmpty(taSharePersonFroms)){
1060
+            return null;
1061
+        }
1062
+
1063
+        TaSharePersonFrom taSharePersonFrom = taSharePersonFroms.get(0);
1064
+        if (CommConstant.PERSON_REALTY_CONSULTANT.equals(taSharePersonFrom.getSharePersonType())){
1065
+            QueryWrapper<TaPerson> taPersonQueryWrapper = new QueryWrapper<>();
1066
+            taPersonQueryWrapper.eq("user_id" , taSharePersonFrom.getSharePerson());
1067
+            taPersonQueryWrapper.eq("status" , CommConstant.STATUS_NORMAL);
1068
+            TaPerson taPerson = taPersonMapper.selectOne(taPersonQueryWrapper);
1069
+            return taPerson.getPersonId();
1070
+        }
1071
+        return taSharePersonFrom.getSharePerson();
1072
+    }
1073
+
1074
+    public boolean validateSceneId(String sceneId){
1075
+        if ("1047".equals(sceneId) || "1048".equals(sceneId) || "1007".equals(sceneId)){
1076
+            return true;
1077
+        }
1078
+        return false;
1079
+    }
1080
+
1081
+    private void fixCustomerPersonId(TaPerson person) {
1082
+        // 先更新之前的数据, 有一种可能的情况, 客户是推荐的,之前未进入过小程序
1083
+        // 后面所有的查询就可以不需要 phone , 改用 person_id 了
1084
+        QueryWrapper<TaRecommendCustomer> q1 = new QueryWrapper<>();
1085
+        q1.eq("org_id", person.getOrgId());
1086
+        q1.eq("phone", person.getPhone());
1087
+        q1.isNull("person_id");
1088
+        List<TaRecommendCustomer> customers = taRecommendCustomerMapper.selectList(q1);
1089
+        if (null != customers) {
1090
+            for (int i = 0; i < customers.size(); i++) {
1091
+                TaRecommendCustomer cust = customers.get(i);
1092
+                cust = copyByPerosn(person, cust);
1093
+                taRecommendCustomerMapper.updateById(cust);
1094
+            }
1095
+        }
1096
+    }
1097
+
1033 1098
     /**
1034 1099
      * 此处逻辑按照复杂流程处理
1035 1100
      * 除了新增客户外,还有修正原有数据的目的

+ 23
- 8
src/main/java/com/huiju/estateagents/service/impl/TaRecommendCustomerServiceImpl.java Voir le fichier

@@ -148,6 +148,21 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
148 148
         return ResponseBean.success(result);
149 149
     }
150 150
 
151
+    /**
152
+     * 获取置业顾问下
153
+     *
154
+     * @param userId
155
+     * @param personId
156
+     * @param buildingId
157
+     * @param orgId
158
+     * @param taPersonBuildingListByUserId
159
+     * @return
160
+     */
161
+    @Override
162
+    public List<TaRecommendCustomer> getConsultantCustomerList(Integer userId, String personId, String buildingId, Integer orgId, List<TaPersonBuilding> taPersonBuildingListByUserId) {
163
+        return taRecommendCustomerMapper.getConsultantCustomerList(userId,personId,buildingId,orgId);
164
+    }
165
+
151 166
     @Override
152 167
     public ResponseBean getCustDetail(String id) {
153 168
         TaRecommendCustomer taRecommendCustomer = taRecommendCustomerMapper.selectById(id);
@@ -418,7 +433,7 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
418 433
         // 首次报备的客户, 写入客户来源表
419 434
         TaCustomerFrom customerFrom = null;
420 435
         if (!StringUtils.isEmpty(taRecommendCustomer.getBuildingId())) {
421
-            Map<String, Number> counter = taCustomerFromMapper.countPerson(taRecommendCustomer.getOrgId(), taRecommendCustomer.getBuildingId() ,taRecommendCustomer.getPersonId());
436
+            Map<String, Number> counter = taCustomerFromMapper.countPerson(taRecommendCustomer.getOrgId(), taRecommendCustomer.getBuildingId(), taRecommendCustomer.getPersonId());
422 437
             boolean orgFirst = counter.get("orgCount").longValue() < 1;
423 438
             boolean projectFirst = counter.get("projectCount").longValue() < 1;
424 439
             if (projectFirst) {
@@ -435,7 +450,7 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
435 450
                 queryWrapper.eq("person_id", taRecommendCustomer.getPersonId());
436 451
                 queryWrapper.eq("org_id", taRecommendCustomer.getOrgId());
437 452
                 queryWrapper.eq("building_id", taRecommendCustomer.getBuildingId());
438
-                if (taCustomerFromMapper.selectList(queryWrapper).size() < 1){
453
+                if (taCustomerFromMapper.selectList(queryWrapper).size() < 1) {
439 454
                     customerFrom.setIsProjectFirst(true);
440 455
                 }
441 456
                 customerFrom.setCreateDate(LocalDateTime.now());
@@ -543,13 +558,13 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
543 558
     }
544 559
 
545 560
     @Override
546
-    public IPage getCustomerList(Integer status, int pageNumber, int pageSize, String building, String name, String tel, String consultName, String consultTel, String entryType, String verifyStatus, Integer sex, String customerType, Integer orgId, List<TaPersonBuilding> taPersonBuildingList, String sceneType, String startCreateDate, String endCreateDate, String sharePersonName) {
561
+    public IPage getCustomerList(Integer status, int pageNumber, int pageSize, String building, String name, String tel, String consultName, String consultTel, String entryType, String verifyStatus, Integer sex, String customerType, Integer orgId, List<TaPersonBuilding> taPersonBuildingList, String sceneType, String startCreateDate, String endCreateDate, String sharePersonName, Integer belongStatus) {
547 562
 
548 563
         if (CommConstant.CUTOMER_TYPE_PUBLIC.equals(customerType)) {
549 564
             // 公客
550 565
             IPage<TaPerson> page = new Page<>(pageNumber, pageSize);
551 566
             // 公客就不用 buildingId 进行查询
552
-            return taRecommendCustomerMapper.getPublicCustomerList(page, name, tel, entryType, verifyStatus, sex, orgId, consultTel, sceneType, taPersonBuildingList, building, startCreateDate, endCreateDate, sharePersonName);
567
+            return taRecommendCustomerMapper.getPublicCustomerList(page, name, tel, entryType, verifyStatus, sex, orgId, consultTel, sceneType, taPersonBuildingList, building, startCreateDate, endCreateDate, sharePersonName, belongStatus);
553 568
         } else {
554 569
             // 私客
555 570
             IPage<TaRecommendCustomer> page = new Page<>(pageNumber, pageSize);
@@ -559,9 +574,9 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
559 574
     }
560 575
 
561 576
     @Override
562
-    public IPage<TaPerson> getIndependentAgents(int pageNumber, int pageSize, String name, String tel, Integer orgId) {
577
+    public IPage<TaPerson> getIndependentAgents(int pageNumber, int pageSize, String name, String tel, String channelId, Integer orgId) {
563 578
         IPage<TaPerson> page = new Page<>(pageNumber, pageSize);
564
-        return taRecommendCustomerMapper.getIndependentAgents(page, name, tel, orgId);
579
+        return taRecommendCustomerMapper.getIndependentAgents(page, name, tel, channelId, orgId);
565 580
     }
566 581
 
567 582
     @Override
@@ -916,8 +931,8 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
916 931
     }
917 932
 
918 933
     @Override
919
-    public List<AgentsRecommendCustomer> getIndependentAgentsExport(Integer orgId, Integer pageCode, Integer pageSize) {
920
-        return taRecommendCustomerMapper.getIndependentAgentsExport(orgId, pageCode, pageSize);
934
+    public List<AgentsRecommendCustomer> getIndependentAgentsExport(String name, String tel, String channelId, Integer orgId, Integer pageCode, Integer pageSize) {
935
+        return taRecommendCustomerMapper.getIndependentAgentsExport(name, tel, channelId, orgId, pageCode, pageSize);
921 936
     }
922 937
 
923 938
     /**

+ 12
- 6
src/main/resources/mapper/ActivityManageMapper.xml Voir le fichier

@@ -80,7 +80,8 @@
80 80
         AND g.`status` > 0
81 81
         AND g.is_first_time = 1
82 82
         AND h.phone is not null
83
-        ) as new_customers
83
+        ) as new_customers,
84
+        a.activityName
84 85
 
85 86
         from (
86 87
             <if test=" type == 'activity' ">
@@ -90,7 +91,8 @@
90 91
                     s.building_name,
91 92
                     t.dynamic_id AS target_id,
92 93
                     t.title AS target_name,
93
-                    'activity' AS target_type
94
+                    'activity' AS target_type,
95
+                    t.title as activityName
94 96
                 FROM
95 97
                     ta_building_dynamic t
96 98
                 LEFT JOIN ta_building s ON s.building_id = t.building_id
@@ -106,7 +108,8 @@
106 108
                     s.building_name,
107 109
                     t.drainage_id AS target_id,
108 110
                     t.`name` AS target_name,
109
-                    'h5' AS target_type
111
+                    'h5' AS target_type,
112
+                    t.name as activityName
110 113
                 FROM
111 114
                   ta_drainage t
112 115
                 LEFT JOIN ta_building s ON s.building_id = t.building_id
@@ -122,7 +125,8 @@
122 125
                     s.building_name,
123 126
                     t.help_activity_id AS target_id,
124 127
                     t.title AS target_name,
125
-                    'help' AS target_type
128
+                    'help' AS target_type,
129
+                    t.title as activityName
126 130
                 FROM
127 131
                     ta_help_activity t
128 132
                 LEFT JOIN ta_building s ON s.building_id = t.building_id
@@ -138,7 +142,8 @@
138 142
                     s.building_name,
139 143
                     t.group_activity_id AS target_id,
140 144
                     t.activity_name AS target_name,
141
-                    'group' AS target_type
145
+                    'group' AS target_type,
146
+                    t.activity_name as activityName
142 147
                 FROM
143 148
                     ta_share_activity t
144 149
                 LEFT JOIN ta_building s ON s.building_id = t.building_id
@@ -154,7 +159,8 @@
154 159
                     s.building_name,
155 160
                     t.live_activity_id AS target_id,
156 161
                     t.live_activity_title AS target_name,
157
-                    'live' AS target_type
162
+                    'live' AS target_type,
163
+                    t.live_activity_title as activityName
158 164
                 FROM
159 165
                     ta_live_activity t
160 166
                 LEFT JOIN ta_building s ON s.building_id = t.building_id

+ 4
- 3
src/main/resources/mapper/TaChannelMapper.xml Voir le fichier

@@ -31,14 +31,15 @@
31 31
     <select id="pageTaChannel" resultType="com.huiju.estateagents.entity.TaChannel">
32 32
         SELECT
33 33
         c.*,
34
-        COUNT(cp.person_id) AS brokerCount,
35
-        COUNT(rc.person_id) AS recommendCount,
34
+        count(tp.person_id) AS brokerCount,
35
+        COUNT(rc.recommend_person) AS recommendCount,
36 36
         (SELECT COUNT(p.recommend_agent ) from ta_person p WHERE cp.person_id = p.recommend_agent) AS inviteCount,
37 37
         cp.person_id
38 38
         FROM
39 39
         ta_channel c
40 40
         LEFT JOIN ta_channel_person cp ON c.channel_id = cp.channel_id
41
-        LEFT JOIN ta_recommend_customer rc ON cp.person_id = rc.person_id AND rc.`status` = 1
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 ta_recommend_customer rc ON cp.person_id = rc.recommend_person and rc.verify_status = 1 and rc.`status` = 1
42 43
         <where>
43 44
             <if test="channelId != null and channelId != ''">
44 45
                 c.channel_id = #{channelId}

+ 7
- 1
src/main/resources/mapper/TaPersonMapper.xml Voir le fichier

@@ -520,7 +520,7 @@ FROM
520 520
         p.*,
521 521
         COUNT(rc.person_id) AS recommendCount
522 522
         from ta_channel_person tch
523
-        left join  ta_person p on  tch.person_id = p.person_id
523
+        left join  ta_person p on  tch.person_id = p.person_id and p.person_type = 'estate agent'
524 524
         LEFT JOIN ta_recommend_customer rc ON p.person_id = rc.person_id
525 525
         <where>
526 526
         <if test="name !=null and name !=''">
@@ -719,4 +719,10 @@ FROM
719 719
             </if>
720 720
         </trim>
721 721
     </insert>
722
+
723
+    <update id="cancelConsulatant">
724
+        UPDATE ta_person
725
+        SET  person_type = 'customer', user_id = null
726
+        WHERE person_id = #{personId}
727
+    </update>
722 728
 </mapper>

+ 226
- 182
src/main/resources/mapper/TaRecommendCustomerMapper.xml Voir le fichier

@@ -40,62 +40,65 @@ FROM
40 40
         FROM
41 41
         ta_recommend_customer a
42 42
         LEFT JOIN ta_person c on a.recommend_person = c.person_id
43
-	<where>
44
-        a.status > 0
45
-        and a.report_recommend_status = 2
46
-        <if test="orgId != null">
47
-            and a.org_id = #{orgId}
48
-        </if>
49
-        <if test="building != null and building !=''">
50
-            and a.building_id = #{building}
51
-        </if>
52
-        <if test="name != null and name !=''">
53
-            and a.name like CONCAT('%',#{name}, '%')
54
-        </if>
55
-        <if test="tel != null and tel!=''">
56
-            and a.phone like CONCAT('%',#{tel}, '%')
57
-        </if>
58
-        <if test="consultName != null and consultName !=''">
59
-            and c.nickname like CONCAT('%',#{consultName}, '%')
60
-        </if>
61
-        <if test="consultTel != null and consultTel !=''">
62
-            and c.phone like CONCAT('%',#{consultTel}, '%')
63
-        </if>
64
-        <if test="entryType != null and entryType !=''">
65
-            and a.entry_type = #{entryType}
66
-        </if>
67
-        <if test="verifyStatus != null and verifyStatus !=''">
68
-            and a.verify_status = #{verifyStatus}
69
-        </if>
70
-        <if test="sex != null and sex !=''">
71
-            and a.sex = #{sex}
72
-        </if>
73
-        <if test="personBuildingList != null and personBuildingList.size > 0">
74
-            AND a.building_id in
75
-            <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
76
-                #{personBuilding.buildingId}
77
-            </foreach>
78
-        </if>
79
-    </where>
43
+        <where>
44
+            a.status > 0
45
+            and a.report_recommend_status = 2
46
+            <if test="orgId != null">
47
+                and a.org_id = #{orgId}
48
+            </if>
49
+            <if test="building != null and building !=''">
50
+                and a.building_id = #{building}
51
+            </if>
52
+            <if test="name != null and name !=''">
53
+                and a.name like CONCAT('%',#{name}, '%')
54
+            </if>
55
+            <if test="tel != null and tel!=''">
56
+                and a.phone like CONCAT('%',#{tel}, '%')
57
+            </if>
58
+            <if test="consultName != null and consultName !=''">
59
+                and c.nickname like CONCAT('%',#{consultName}, '%')
60
+            </if>
61
+            <if test="consultTel != null and consultTel !=''">
62
+                and c.phone like CONCAT('%',#{consultTel}, '%')
63
+            </if>
64
+            <if test="entryType != null and entryType !=''">
65
+                and a.entry_type = #{entryType}
66
+            </if>
67
+            <if test="verifyStatus != null and verifyStatus !=''">
68
+                and a.verify_status = #{verifyStatus}
69
+            </if>
70
+            <if test="sex != null and sex !=''">
71
+                and a.sex = #{sex}
72
+            </if>
73
+            <if test="personBuildingList != null and personBuildingList.size > 0">
74
+                AND a.building_id in
75
+                <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
76
+                    #{personBuilding.buildingId}
77
+                </foreach>
78
+            </if>
79
+        </where>
80 80
         order by a.create_date desc
81 81
     </select>
82 82
 
83 83
     <select id="getIndependentAgents" resultType="com.huiju.estateagents.entity.TaPerson">
84 84
         SELECT
85
-            a.*,
86
-            tc.channel_name as channelName
85
+        a.*,
86
+        tc.channel_name as channelName
87 87
         FROM
88
-            ta_person a
89
-            left join ta_channel_person tcp on a.person_id = tcp.person_id
90
-            left join ta_channel tc on tc.channel_id = tcp.channel_id
88
+        ta_person a
89
+        left join ta_channel_person tcp on a.person_id = tcp.person_id and tcp.status = 1
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}, '%')
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}
@@ -104,7 +107,7 @@ FROM
104 107
         </where>
105 108
 
106 109
         ORDER BY
107
-            create_date DESC
110
+        create_date DESC
108 111
     </select>
109 112
 
110 113
     <select id="getRepCustomerList" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
@@ -161,6 +164,7 @@ FROM
161 164
     <select id="getCustomerList" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
162 165
         SELECT
163 166
         a.*,
167
+        IFNULL( t2.building_name, '暂无' ) AS buildingName,
164 168
         a.customer_id as customerId,
165 169
         IFNULL(b.name,d.user_name) as consultantName,
166 170
         IFNULL(b.tel,d.phone) as consultTel,
@@ -173,10 +177,14 @@ FROM
173 177
         LEFT JOIN ta_user d on d.user_id = a.realty_consultant
174 178
         LEFT JOIN ta_person_from_record p ON a.person_id = p.person_id AND p.is_first_time = 1
175 179
         <if test="orgId != null">
176
-            and p.org_id =  #{orgId}
180
+            and p.org_id = #{orgId}
177 181
         </if>
178
-        LEFT JOIN ta_person c on p.share_person_id = c.person_id
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
185
+        LEFT JOIN ta_person p2 ON a.person_id = p2.person_id
186
+        LEFT JOIN ta_person c ON p2.recommend_person = c.person_id
187
+        LEFT JOIN ta_building t2 ON a.building_id = t2.building_id
180 188
         <where>
181 189
             a.status > 0
182 190
             and a.verify_status = 1
@@ -216,10 +224,11 @@ FROM
216 224
                 and a.create_Date >= #{startCreateDate}
217 225
             </if>
218 226
             <if test="endCreateDate != null and endCreateDate !=''">
219
-                and a.create_Date  &lt;= #{endCreateDate}
227
+                and a.create_Date &lt;= #{endCreateDate}
220 228
             </if>
221 229
             <if test="sharePersonName != null and sharePersonName !=''">
222
-                and (c.nickName like CONCAT('%',#{sharePersonName}, '%') or c.name like CONCAT('%',#{sharePersonName}, '%'))
230
+                and (c.nickName like CONCAT('%',#{sharePersonName}, '%') or c.name like CONCAT('%',#{sharePersonName},
231
+                '%'))
223 232
             </if>
224 233
             <if test="personBuildingList != null and personBuildingList.size > 0">
225 234
                 AND a.building_id in
@@ -243,60 +252,65 @@ FROM
243 252
 	WHERE a.customer_id = #{customerId}
244 253
     </select>
245 254
 
246
-    <select id="getPublicCustomerList" resultType="com.huiju.estateagents.entity.TaPerson">
255
+    <select id="getPublicCustomerList" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
247 256
         SELECT
248
-        b.*,
249
-        ifnull(c.nickname, c.name)  AS sharePersonName
257
+        t.*,
258
+        IFNULL( t2.building_name, '暂无' ) AS buildingName,
259
+        ifnull( t3.nickname, t3.NAME ) AS sharePersonName
250 260
         FROM
251
-        ta_person b
252
-        LEFT JOIN ta_person_from_record r ON r.share_person_id = b.person_id AND r.is_first_time = 1 and r.org_id = #{orgId}
253
-        LEFT JOIN td_wx_dict d ON r.scene_id = d.scene_id
254
-        LEFT JOIN ta_person c on b.recommend_person = c.person_id AND c.org_id = #{orgId}
261
+        ta_recommend_customer t
262
+        LEFT JOIN ta_building t2 ON t.building_id = t2.building_id
263
+        LEFT JOIN ta_person t6 ON t.person_id = t6.person_id
264
+        LEFT JOIN ta_person t3 ON t6.recommend_person = t3.person_id
265
+        LEFT JOIN ta_person_from_record t4 ON t.person_id = t4.person_id AND t4.is_first_time = 1 AND t4.org_id = #{orgId}
266
+        LEFT JOIN td_wx_dict t5 ON t4.scene_id = t5.scene_id
255 267
         <where>
256
-            b.status > 0
257
-            and b.org_id = #{orgId}
258
-            AND IFNULL(b.person_type, '') in ('estate agent', 'customer')
259
-            AND b.person_id not IN ( SELECT c.person_id FROM ta_recommend_customer c WHERE c.org_id = #{orgId} AND person_id is not null AND person_id != ''  )
260
-            <if test="name != null and name !=''">
261
-                and b.nickname like CONCAT('%',#{name}, '%')
268
+            t.`status` > 0
269
+            AND t.verify_status = 1
270
+            AND ( t.realty_consultant IS NULL OR t.realty_consultant = '' )
271
+            AND t.org_id = #{orgId}
272
+            <if test="buildingId != null and buildingId !=''">
273
+                and t.building_id = #{buildingId}
262 274
             </if>
263
-            <if test="sceneType !=null and sceneType !=''">
264
-                and d.scene_type = #{sceneType}
275
+            <if test="name != null and name !=''">
276
+                and t.name like CONCAT('%',#{name}, '%')
265 277
             </if>
266 278
             <if test="tel != null and tel!=''">
267
-                and b.phone like CONCAT('%',#{tel}, '%')
279
+                and t.phone like CONCAT('%',#{tel}, '%')
268 280
             </if>
269 281
             <if test="entryType != null and entryType !=''">
270
-                and b.entry_type = #{entryType}
282
+                and t.entry_type = #{entryType}
283
+            </if>
284
+            <if test="verifyStatus != null and verifyStatus !=''">
285
+                and t.verify_status = #{verifyStatus}
271 286
             </if>
272 287
             <if test="sex != null and sex !=''">
273
-                and b.sex = #{sex}
288
+                and t.sex = #{sex}
274 289
             </if>
275 290
             <if test="startCreateDate != null and startCreateDate !=''">
276
-                and b.create_Date >= #{startCreateDate}
291
+                and t.create_Date >= #{startCreateDate}
277 292
             </if>
278 293
             <if test="endCreateDate != null and endCreateDate !=''">
279
-                and b.create_Date  &lt;= #{endCreateDate}
280
-            </if>
281
-            <if test="consultTel != null and consultTel !=''">
282
-                and b.tel like CONCAT('%',#{consultTel}, '%')
283
-            </if>
284
-            <if test="buildingId != null and buildingId !=''">
285
-                AND b.building_id = #{buildingId}
294
+                and t.create_Date &lt;= #{endCreateDate}
286 295
             </if>
287 296
             <if test="sharePersonName != null and sharePersonName !=''">
288
-                and (c.nickName like CONCAT('%',#{sharePersonName}, '%') or c.name like CONCAT('%',#{sharePersonName}, '%'))
297
+                and (t3.nickName like CONCAT('%',#{sharePersonName}, '%') or t3.name like CONCAT('%',#{sharePersonName},
298
+                '%'))
289 299
             </if>
290
-<!--            and NOT EXISTS ( select * from ta_recommend_customer a where a.org_id = #{orgId} and a.recommend_person = b.person_id)-->
291 300
             <if test="personBuildingList != null and personBuildingList.size > 0">
292
-                AND b.building_id in
301
+                AND t.building_id in
293 302
                 <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
294 303
                     #{personBuilding.buildingId}
295 304
                 </foreach>
296 305
             </if>
306
+            <if test="sceneType !=null and sceneType !=''">
307
+                and t4.scene_type = #{sceneType}
308
+            </if>
309
+            <if test="belongStatus == 0">
310
+                and (t.building_id = ''  OR t.building_id is null )
311
+            </if>
297 312
         </where>
298
-        group by b.person_id
299
-        order by b.create_date desc
313
+        order by t.create_date desc
300 314
     </select>
301 315
 
302 316
     <select id="getRecCustomerExport" resultType="com.huiju.estateagents.excel.ExcelRecommendCustomer">
@@ -308,7 +322,8 @@ FROM
308 322
         if(a.sex = 1, '男',if(a.sex = 2, '女', '未知')) as sex,
309 323
         c.nickname as recommend,
310 324
         c.phone as recommendTel,
311
-        if(a.verify_status = 0, '待审核', if(a.verify_status = 1, '已通过', if(a.verify_status = 2, '未通过', ''))) as verifyStatusName
325
+        if(a.verify_status = 0, '待审核', if(a.verify_status = 1, '已通过', if(a.verify_status = 2, '未通过', ''))) as
326
+        verifyStatusName
312 327
         FROM
313 328
         ta_recommend_customer a
314 329
         LEFT JOIN ta_person c on a.recommend_person = c.person_id
@@ -398,7 +413,7 @@ FROM
398 413
         order by a.create_date desc
399 414
     </select>
400 415
 
401
-    <select id="getRepCustomerReportExport" resultType="com.huiju.estateagents.excel.ReporRecommendCustomer" >
416
+    <select id="getRepCustomerReportExport" resultType="com.huiju.estateagents.excel.ReporRecommendCustomer">
402 417
         SELECT
403 418
         a.name as name,
404 419
         a.phone as phone,
@@ -454,7 +469,7 @@ FROM
454 469
     </select>
455 470
 
456 471
 
457
-    <select id="getIndependentAgentsCount"  resultType="java.lang.Integer">
472
+    <select id="getIndependentAgentsCount" resultType="java.lang.Integer">
458 473
         SELECT
459 474
         count(*)
460 475
         FROM
@@ -478,25 +493,25 @@ FROM
478 493
         a.nickname as nickname,
479 494
         a.phone as phone,
480 495
         if(a.gender = '1', '男', if(a.gender = '2', '女', '未知')) as gender,
481
-        if(ifnull(tc.channel_name, '') != '', '渠道经纪人', '独立经纪人') as personType,
482
-        tc.channel_name  as channelName,
496
+        '专业经纪人' as personType,
497
+        tc.channel_name as channelName,
483 498
         (
484
-            SELECT
485
-              count( 1 )
486
-            FROM
487
-              ta_person tp
488
-            WHERE
489
-              tp.recommend_agent = a.person_id
499
+        SELECT
500
+        count( 1 )
501
+        FROM
502
+        ta_person tp
503
+        WHERE
504
+        tp.recommend_agent = a.person_id
490 505
         ) AS agentCount,
491 506
         (
492
-            SELECT
493
-              count( 1 )
494
-            FROM
495
-              ta_recommend_customer tarc
496
-            WHERE
497
-              tarc.recommend_person = a.person_id
498
-              and tarc.status = 1
499
-              and tarc.org_id = #{orgId}
507
+        SELECT
508
+        count( 1 )
509
+        FROM
510
+        ta_recommend_customer tarc
511
+        WHERE
512
+        tarc.recommend_person = a.person_id
513
+        and tarc.status = 1
514
+        and tarc.org_id = #{orgId}
500 515
         ) AS recommedCount
501 516
         FROM
502 517
         ta_person a
@@ -508,6 +523,15 @@ FROM
508 523
             <if test="orgId != null">
509 524
                 and a.org_id = #{orgId}
510 525
             </if>
526
+            <if test="name != null and name != ''">
527
+                and a.nickname like concat('%', #{name}, '%')
528
+            </if>
529
+            <if test="tel != null and tel != null">
530
+                and a.phone like concat('%', #{tel}, '%')
531
+            </if>
532
+            <if test="channelId != null and channelId != ''">
533
+                and tc.channel_id = #{channelId}
534
+            </if>
511 535
 
512 536
         </where>
513 537
 
@@ -543,74 +567,76 @@ FROM
543 567
             <if test="consultTel != null and consultTel !=''">
544 568
                 and b.tel like CONCAT('%',#{consultTel}, '%')
545 569
             </if>
546
-            and NOT EXISTS ( select * from ta_recommend_customer a where a.org_id = #{orgId} and a.recommend_person = b.person_id)
570
+            and NOT EXISTS ( select * from ta_recommend_customer a where a.org_id = #{orgId} and a.recommend_person =
571
+            b.person_id)
547 572
         </where>
548 573
         order by b.create_date desc
549 574
     </select>
550 575
 
551 576
     <select id="getPublicCustomerExportList" resultType="com.huiju.estateagents.excel.PublicCustomerExport">
552 577
         SELECT
553
-          b.nickname as nickname,
554
-          b.phone as phone,
555
-          if(b.gender = 1, '男', if(b.gender = 2, '女', '未知')) as sex,
556
-          b.create_date,
557
-          concat(b.country, b.province) as province,
558
-          z.intention,
559
-          d.scene_alias as sceneType,
560
-          t.building_name,
561
-          ifnull( c.nickname, c.NAME ) AS sharePersonName ,
562
-          s.points
578
+        t.NAME AS nickname,
579
+        t.phone,
580
+        IF( t.sex = 1, '男', IF ( t.sex = 2, '女', '未知' ) ) AS sex,
581
+        t.create_date,
582
+        concat( t.country, t.province ) AS province,
583
+        t.intention,
584
+        IF(t.building_id = null or t.building_id = '','否','是') AS belongStatus,
585
+        IFNULL( t2.building_name, '暂无' ) AS buildingName,
586
+        t5.scene_alias as sceneType,
587
+        ifnull( t3.nickname, t3.NAME ) AS sharePersonName ,
588
+        t6.points
563 589
         FROM
564
-        ta_person b
565
-        LEFT JOIN ta_person_from_record r ON b.person_id = r.person_id AND r.is_first_time = 1 and r.org_id = #{orgId}
566
-        left join ta_building t on b.building_id = t.building_id
567
-        LEFT JOIN ta_person c ON b.recommend_person = c.person_id AND c.org_id = #{orgId}
568
-        left JOIN (select sum(points_amount) as points,person_id from ta_points_records where org_id = #{orgId} GROUP BY person_id) s on b.person_id = s.person_id
569
-        left join (select sum(t.intention) as intention,t.person_id From ta_person_intention_record t where t.org_id = #{orgId} group by t.person_id) z on z.person_id = b.person_id
570
-        left join td_wx_dict d on r.scene_id = d.scene_id
571
-        <where>
572
-            b.status > 0
573
-            AND IFNULL(b.person_type, '') in ('estate agent', 'customer')
574
-            <if test="name != null and name !=''">
575
-                and b.nickname like CONCAT('%',#{name}, '%')
576
-            </if>
577
-            <if test="buildingId != null and buildingId !=''">
578
-                AND b.building_id = #{buildingId}
579
-            </if>
580
-            <if test="personBuildingList != null and personBuildingList.size > 0">
581
-                AND b.building_id in
582
-                <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
583
-                    #{personBuilding.buildingId}
584
-                </foreach>
585
-            </if>
586
-            <if test="tel != null and tel!=''">
587
-                and b.phone like CONCAT('%',#{tel}, '%')
588
-            </if>
589
-            <if test="sceneType !=null and sceneType !=''">
590
-                and d.scene_type = #{sceneType}
591
-            </if>
592
-            <if test="entryType != null and entryType !=''">
593
-                and b.entry_type = #{entryType}
594
-            </if>
595
-            <if test="sex != null and sex !=''">
596
-                and b.sex = #{sex}
597
-            </if>
598
-            <if test="orgId != null">
599
-                and b.org_id = #{orgId}
600
-            </if>
601
-            <if test="consultTel != null and consultTel !=''">
602
-                and b.tel like CONCAT('%',#{consultTel}, '%')
603
-            </if>
604
-<!--            and NOT EXISTS ( select * from ta_recommend_customer a where a.org_id = #{orgId} and a.recommend_person = b.person_id)-->
605
-            AND b.person_id not IN ( SELECT c.person_id FROM ta_recommend_customer c WHERE c.org_id = #{orgId} AND person_id is not null AND person_id != ''  )
606
-        </where>
607
-        order by b.create_date desc
590
+        ta_recommend_customer t
591
+        LEFT JOIN ta_building t2 ON t.building_id = t2.building_id
592
+        LEFT JOIN ta_person t7 ON t.person_id = t7.person_id
593
+        LEFT JOIN ta_person t3 ON t7.recommend_person = t3.person_id
594
+        LEFT JOIN ta_person_from_record t4 ON t.person_id = t4.person_id AND t4.is_first_time = 1 AND t4.org_id =
595
+        #{orgId}
596
+        LEFT JOIN td_wx_dict t5 ON t4.scene_id = t5.scene_id
597
+        LEFT JOIN (select sum(points_amount) as points,person_id from ta_points_records where org_id = #{orgId} GROUP BY
598
+        person_id) t6 on t.person_id = t6.person_id
599
+        WHERE
600
+        t.`status` > 0
601
+        AND t.verify_status = 1
602
+        AND ( t.realty_consultant IS NULL OR t.realty_consultant = '' )
603
+        AND t.org_id = #{orgId}
604
+        <if test="buildingId != null and buildingId !=''">
605
+            and t.building_id = #{buildingId}
606
+        </if>
607
+        <if test="name != null and name !=''">
608
+            and t.name like CONCAT('%',#{name}, '%')
609
+        </if>
610
+        <if test="tel != null and tel!=''">
611
+            and t.phone like CONCAT('%',#{tel}, '%')
612
+        </if>
613
+        <if test="entryType != null and entryType !=''">
614
+            and t.entry_type = #{entryType}
615
+        </if>
616
+        <if test="verifyStatus != null and verifyStatus !=''">
617
+            and t.verify_status = #{verifyStatus}
618
+        </if>
619
+        <if test="sex != null and sex !=''">
620
+            and t.sex = #{sex}
621
+        </if>
622
+        <if test="personBuildingList != null and personBuildingList.size > 0">
623
+            AND t.building_id in
624
+            <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
625
+                #{personBuilding.buildingId}
626
+            </foreach>
627
+        </if>
628
+        <if test="sceneType !=null and sceneType !=''">
629
+            and t4.scene_type = #{sceneType}
630
+        </if>
631
+        <if test="belongStatus == 0">
632
+            and (t.building_id = ''  OR t.building_id is null )
633
+        </if>
608 634
     </select>
609
-<!--    limit #{pageCode}, #{pageSize}-->
635
+    <!--    limit #{pageCode}, #{pageSize}-->
610 636
 
611
-    <select id="getCustomerExportListCount" resultType="Integer" >
637
+    <select id="getCustomerExportListCount" resultType="Integer">
612 638
         SELECT
613
-            count(1)
639
+        count(1)
614 640
         FROM
615 641
         ta_recommend_customer a
616 642
         LEFT JOIN ta_person b ON a.realty_consultant = b.person_id
@@ -686,11 +712,17 @@ FROM
686 712
         LEFT JOIN ta_person b ON a.realty_consultant = b.person_id
687 713
         LEFT JOIN ta_user d on d.user_id = a.realty_consultant
688 714
         LEFT JOIN ta_person_from_record p ON a.person_id = p.person_id AND p.is_first_time = 1 and p.org_id = #{orgId}
689
-        LEFT JOIN ta_person c ON p.share_person_id = c.person_id
690
-        left join ta_building t on a.building_id = t.building_id
691 715
         LEFT JOIN td_wx_dict w ON p.scene_id = w.scene_id
692
-        left JOIN (select sum(points_amount) as points,person_id from ta_points_records where org_id = #{orgId} GROUP BY person_id) s on a.person_id = s.person_id
693
-        left join (select sum(t.intention) as intention,t.person_id From ta_person_intention_record t where t.org_id = #{orgId} group by t.person_id) z on z.person_id = a.person_id
716
+        LEFT JOIN ta_person p2 ON a.person_id = p2.person_id
717
+        LEFT JOIN ta_person c ON p2.recommend_person = c.person_id
718
+        left join ta_building t on a.building_id = t.building_id
719
+        --         LEFT JOIN ta_person c ON p.share_person_id = c.person_id
720
+        --         left join ta_building t on a.building_id = t.building_id
721
+        --         LEFT JOIN td_wx_dict w ON p.scene_id = w.scene_id
722
+        left JOIN (select sum(points_amount) as points,person_id from ta_points_records where org_id = #{orgId} GROUP BY
723
+        person_id) s on a.person_id = s.person_id
724
+        left join (select sum(t.intention) as intention,t.person_id From ta_person_intention_record t where t.org_id =
725
+        #{orgId} group by t.person_id) z on z.person_id = a.person_id
694 726
         <where>
695 727
             a.status > 0
696 728
             and a.verify_status = 1
@@ -739,16 +771,16 @@ FROM
739 771
         group by a.customer_id,a.building_id
740 772
         order by a.create_date desc
741 773
     </select>
742
-<!--    limit #{pageCode}, #{pageSize}-->
774
+    <!--    limit #{pageCode}, #{pageSize}-->
743 775
 
744 776
     <select id="getMyCustStatistics" resultType="java.util.Map">
745 777
         SELECT
746
-            sum( IF ( STATUS = 4 AND verify_status = 1, 1, 0 ) ) AS clinchSum,
747
-            sum( IF ( STATUS != 4 AND verify_status = 1, 1, 0 ) ) AS followSum
778
+        sum( IF ( STATUS = 4 AND verify_status = 1, 1, 0 ) ) AS clinchSum,
779
+        sum( IF ( STATUS != 4 AND verify_status = 1, 1, 0 ) ) AS followSum
748 780
         FROM
749
-            ta_recommend_customer
781
+        ta_recommend_customer
750 782
         WHERE
751
-            org_id = #{orgId}
783
+        org_id = #{orgId}
752 784
         AND ( realty_consultant = #{personId}
753 785
         <if test="userId != null and userId != ''">
754 786
             OR realty_consultant = #{userId}
@@ -758,15 +790,15 @@ FROM
758 790
 
759 791
     <select id="getMyCustFollowOrClinch" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
760 792
         SELECT
761
-            *
793
+        *
762 794
         FROM
763
-            ta_recommend_customer
795
+        ta_recommend_customer
764 796
         WHERE
765
-            org_id = #{orgId}
797
+        org_id = #{orgId}
766 798
         AND ( realty_consultant = #{personId} OR realty_consultant = #{userId} )
767 799
         <if test="type == 'follow'">
768
-          AND STATUS != 4
769
-          AND verify_status = 1
800
+            AND STATUS != 4
801
+            AND verify_status = 1
770 802
             <if test="name != null and name !=''">
771 803
                 and (`name` like CONCAT('%',#{name}, '%') or phone like CONCAT('%',#{name}, '%'))
772 804
             </if>
@@ -790,7 +822,7 @@ FROM
790 822
             </if>
791 823
         </if>
792 824
         <if test="type == 'clinch'">
793
-          AND STATUS = 4
825
+            AND STATUS = 4
794 826
         </if>
795 827
     </select>
796 828
 
@@ -804,14 +836,14 @@ FROM
804 836
 
805 837
     <select id="getCustomerIntentions" resultType="com.huiju.estateagents.entity.PersonIntention">
806 838
         SELECT
807
-            SUM( a.intention ) AS intention,
808
-            a.building_id,
809
-            b.building_name
839
+        SUM( a.intention ) AS intention,
840
+        a.building_id,
841
+        b.building_name
810 842
         FROM
811
-            ta_person_intention_record a
812
-            left join ta_building b on a.building_id = b.building_id
843
+        ta_person_intention_record a
844
+        left join ta_building b on a.building_id = b.building_id
813 845
         WHERE
814
-           a.person_id = #{personId}
846
+        a.person_id = #{personId}
815 847
         <if test="personBuildingList != null and personBuildingList.size > 0">
816 848
             AND a.building_id in
817 849
             <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
@@ -819,9 +851,9 @@ FROM
819 851
             </foreach>
820 852
         </if>
821 853
         GROUP BY
822
-            a.building_id
854
+        a.building_id
823 855
         ORDER BY
824
-            intention DESC
856
+        intention DESC
825 857
     </select>
826 858
 
827 859
     <select id="getCustomersIRecommended" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
@@ -851,7 +883,7 @@ FROM
851 883
             and s.create_date BETWEEN #{startDate} and #{endDate}
852 884
         </if>
853 885
         <if test="buildingId != null and buildingId !=''">
854
-        and s.building_id = #{buildingId}
886
+            and s.building_id = #{buildingId}
855 887
         </if>
856 888
         and s.status &gt; 0
857 889
         order by s.report_date desc
@@ -869,6 +901,18 @@ FROM
869 901
             IF( t.building_id = #{buildingId}, 0, 1 ) ASC,
870 902
             IF( ifnull( t.building_id, '' ) = '', 0, 1 ) ASC,
871 903
             t.create_date ASC
872
-        LIMIT 1;
904
+        LIMIT 1
905
+    </select>
906
+
907
+    <select id="getConsultantCustomerList" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
908
+        SELECT
909
+            *
910
+        FROM
911
+            ta_recommend_customer t
912
+        WHERE
913
+            t.org_id = #{orgId}
914
+            AND t.STATUS > 0
915
+            AND t.verify_status = 1
916
+            AND t.realty_consultant IN ( #{userId}, #{personId})
873 917
     </select>
874 918
 </mapper>

+ 11
- 2
src/main/resources/mapper/TaUserMapper.xml Voir le fichier

@@ -62,10 +62,13 @@
62 62
     <select id="seleUserList" resultType="com.huiju.estateagents.center.taUser.entity.TaUser">
63 63
         SELECT
64 64
             t.*,
65
-            b.building_id
65
+            b.building_id,
66
+            d.person_id as consultant_person_id,
67
+            if(d.person_id is not null,1,0) as mini_status
66 68
         FROM
67 69
             ta_user t
68 70
             LEFT JOIN ta_person_building b ON t.user_id = b.user_id
71
+            LEFT JOIN ta_person d on t.user_id = d.user_id
69 72
         WHERE
70 73
             t.org_id = #{taUser.orgId} AND (t.is_admin != 1 or t.is_admin is null)
71 74
             <if test="taUser.userName != null and taUser.userName != ''">
@@ -77,9 +80,15 @@
77 80
             <if test="taUser.status != null and taUser.status != ''">
78 81
                 and t.status = #{taUser.status}
79 82
             </if>
80
-            <if test="taUser.isConsultant != null and taUser.isConsultant != '' or taUser.isConsultant ==0">
83
+            <if test="taUser.isConsultant == 0">
81 84
                 and t.is_consultant = #{taUser.isConsultant}
82 85
             </if>
86
+            <if test="taUser.miniStatus == 0">
87
+                and d.person_id is null
88
+            </if>
89
+            <if test="taUser.miniStatus != null and taUser.miniStatus != '' and taUser.miniStatus == 1">
90
+                and d.person_id is not null
91
+            </if>
83 92
             <if test="taUser.buildingId != null and taUser.buildingId != ''">
84 93
                 and b.building_id = #{taUser.buildingId}
85 94
             </if>

+ 3
- 3
src/main/resources/mapper/statistic/TaActivityStaticMapper.xml Voir le fichier

@@ -681,7 +681,7 @@
681 681
             and t.building_id = #{buildingId}
682 682
         </if>
683 683
         <if test="targetType != null and targetType != ''">
684
-            and (case when #{targetType} = 'activity' then t.target_type = 'dynamic' else t.target_type = #{targetType}
684
+            and (case when #{targetType} = 'activity' then t.target_type = 'dynamic' when #{targetType} = 'h5' then t.event_type = 'h5' else t.target_type = #{targetType}
685 685
             end)
686 686
         </if>
687 687
         <if test="startDate != null">
@@ -715,7 +715,7 @@
715 715
             and t.building_id = #{buildingId}
716 716
         </if>
717 717
         <if test="targetType != null and targetType != ''">
718
-            and (case when #{targetType} = 'activity' then t.target_type = 'dynamic' else t.target_type = #{targetType}
718
+            and (case when #{targetType} = 'activity' then t.target_type = 'dynamic' when #{targetType} = 'h5' then t.event_type = 'h5' else t.target_type = #{targetType}
719 719
             end)
720 720
         </if>
721 721
         <if test="startDate != null">
@@ -1447,9 +1447,9 @@
1447 1447
         person.person_id
1448 1448
         from (
1449 1449
         SELECT t.*, f.nickname, f.phone, f.person_type
1450
+        LEFT JOIN ta_share_activity b ON t.be_share = b.share_id
1450 1451
         FROM ta_share_count t
1451 1452
         LEFT JOIN ta_help_activity a ON t.be_share = a.help_activity_id
1452
-        LEFT JOIN ta_share_activity b ON t.be_share = b.share_id
1453 1453
         LEFT JOIN ta_live_activity c ON t.be_share = c.live_activity_id
1454 1454
         LEFT JOIN ta_drainage d ON t.be_share = d.drainage_id
1455 1455
         LEFT JOIN ta_building_dynamic e ON t.be_share = e.dynamic_id