소스 검색

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

# Conflicts:
#	src/main/java/com/huiju/estateagents/center/taUser/controller/TaUserController.java
魏超 5 년 전
부모
커밋
0e8ca0cf5e

+ 5
- 11
src/main/java/com/huiju/estateagents/center/taUser/controller/TaUserController.java 파일 보기

@@ -2,27 +2,20 @@ 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 19
 import com.huiju.estateagents.entity.SysButtonInMenu;
27 20
 import com.huiju.estateagents.entity.SysMenu;
28 21
 import com.huiju.estateagents.entity.TaMiniapp;
@@ -40,7 +33,6 @@ import org.springframework.beans.factory.annotation.Autowired;
40 33
 import org.springframework.web.bind.annotation.*;
41 34
 
42 35
 import javax.servlet.http.HttpServletRequest;
43
-import java.time.LocalDateTime;
44 36
 import java.util.ArrayList;
45 37
 import java.util.HashMap;
46 38
 import java.util.List;
@@ -398,6 +390,7 @@ public class TaUserController extends BaseController {
398 390
                                    @RequestParam(value ="phone",required = false) String phone,
399 391
                                    @RequestParam(value ="status",required = false) Integer status,
400 392
                                    @RequestParam(value ="isConsultant",required = false) Integer isConsultant,
393
+                                   @RequestParam(value ="miniStatus",required = false) Integer miniStatus,
401 394
                                    @RequestParam(value ="buildingId",required = false) String buildingId,
402 395
                                    HttpServletRequest request){
403 396
         ResponseBean responseBean = new ResponseBean();
@@ -415,6 +408,7 @@ public class TaUserController extends BaseController {
415 408
             }else if (null != isConsultant && isConsultant == 0){
416 409
                 taUser.setIsConsultant(false);
417 410
             }
411
+            taUser.setMiniStatus(miniStatus);
418 412
 
419 413
             IPage<TaUser> result = iTaUserService.seleUserList(pg,taUser,getTaPersonBuildingListByUserId(request));
420 414
             List<TaUser> taUserList = result.getRecords();
@@ -422,8 +416,8 @@ public class TaUserController extends BaseController {
422 416
                 List<TaTags> taTagsList = iTaUserService.getTagsList(e);
423 417
                 e.setTaTagsList(taTagsList);
424 418
 
425
-                Integer person = iTaPersonService.judgeBindStatusByCondition(e.getUserId(), getOrgId(request), e.getPhone());
426
-                e.setMiniStatus(0 == person ? 0 : 1);
419
+//                Integer person = iTaPersonService.judgeBindStatusByCondition(e.getUserId(), getOrgId(request), e.getPhone());
420
+//                e.setMiniStatus(0 == person ? 0 : 1);
427 421
             });
428 422
             result.setRecords(taUserList);
429 423
             responseBean.addSuccess(result);

+ 0
- 3
src/main/java/com/huiju/estateagents/center/taUser/service/impl/TaUserServiceImpl.java 파일 보기

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

+ 286
- 226
src/main/java/com/huiju/estateagents/controller/TaRecommendCustomerController.java 파일 보기

@@ -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,123 @@ 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 = "pageNumber", defaultValue = "1") Integer pageNumber,
426
+                                             @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
427
+        try {
428
+            return ResponseBean.success(taRecommendCustomerService.getIndependentAgents(pageNumber, pageSize, name, tel, getOrgId(request)));
429
+        } catch (Exception e) {
398 430
             e.printStackTrace();
399
-            return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
431
+            return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
400 432
         }
401 433
     }
402 434
 
403 435
     /**
404 436
      * 分配置业顾问
405 437
      */
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{
438
+    @RequestMapping(value = "/admin/customer/consultant/assist/{personId}", method = RequestMethod.POST)
439
+    public ResponseBean assistConsultant(@RequestBody TaUser taUser, @PathVariable String personId, HttpServletRequest request) {
440
+        try {
409 441
             Integer orgId = getOrgId(request);
410 442
             taRecommendCustomerService.consultantAssist(taUser, personId, orgId);
411 443
             return ResponseBean.success("");
412
-        }catch (Exception e){
444
+        } catch (Exception e) {
413 445
             e.printStackTrace();
414
-            return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
446
+            return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
415 447
         }
416 448
     }
417 449
 
418 450
     /**
419 451
      * 批量分配置业顾问
420 452
      */
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())){
453
+    @RequestMapping(value = "/admin/customer/consultant/batchAssist", method = RequestMethod.POST)
454
+    public ResponseBean batchAssistConsultant(@RequestBody TaUser taUser, HttpServletRequest request) {
455
+        if (CollectionUtils.isEmpty(taUser.getPersonIds())) {
424 456
             return ResponseBean.error("请至少选择一条数据", ResponseBean.ERROR_UNAVAILABLE);
425 457
         }
426
-        try{
458
+        try {
427 459
             Integer orgId = getOrgId(request);
428 460
             taRecommendCustomerService.batchConsultantAssist(taUser, orgId);
429 461
             return ResponseBean.success("");
430
-        }catch (Exception e){
462
+        } catch (Exception e) {
431 463
             e.printStackTrace();
432
-            return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
464
+            return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
433 465
         }
434 466
     }
435 467
 
436 468
     @GetMapping("/admin/customer/recommend/{customerId}")
437
-    public ResponseBean getCustomersIRecommended (@RequestParam int pageNumber, @RequestParam int pageSize, @PathVariable String customerId,HttpServletRequest request){
469
+    public ResponseBean getCustomersIRecommended(@RequestParam int pageNumber, @RequestParam int pageSize, @PathVariable String customerId, HttpServletRequest request) {
438 470
         Integer orgId = getOrgId(request);
439
-        try{
440
-            return ResponseBean.success(taRecommendCustomerService.getCustomersIRecommended(pageNumber,pageSize,customerId,orgId,getTaPersonBuildingListByUserId(request)));
441
-        }catch (Exception e){
471
+        try {
472
+            return ResponseBean.success(taRecommendCustomerService.getCustomersIRecommended(pageNumber, pageSize, customerId, orgId, getTaPersonBuildingListByUserId(request)));
473
+        } catch (Exception e) {
442 474
             e.printStackTrace();
443
-            return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
475
+            return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
444 476
         }
445 477
     }
446 478
 
447 479
     @GetMapping("/wx/customer/recommend/mine")
448
-    public ResponseBean getWxCustomersIRecommended (@RequestParam int pageNumber, @RequestParam int pageSize,HttpServletRequest request){
449
-        Integer orgId =getOrgId(request);
480
+    public ResponseBean getWxCustomersIRecommended(@RequestParam int pageNumber, @RequestParam int pageSize, HttpServletRequest request) {
481
+        Integer orgId = getOrgId(request);
450 482
         String openid = getOpenId(request);
451 483
         List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
452 484
         if (null == taPersons || taPersons.size() != 1) {
453 485
             return ResponseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
454 486
         }
455 487
         TaPerson person = taPersons.get(0);
456
-        try{
457
-            return ResponseBean.success(taRecommendCustomerService.getCustomersIRecommended(pageNumber,pageSize,person.getPersonId(),orgId,null));
458
-        }catch (Exception e){
488
+        try {
489
+            return ResponseBean.success(taRecommendCustomerService.getCustomersIRecommended(pageNumber, pageSize, person.getPersonId(), orgId, null));
490
+        } catch (Exception e) {
459 491
             e.printStackTrace();
460
-            return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
492
+            return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
461 493
         }
462 494
     }
463 495
 
464 496
 
465
-
466
-        /**
497
+    /**
467 498
      * 修改对象
499
+     *
468 500
      * @param taRecommendCustomer 实体对象
469 501
      * @return
470 502
      */
471
-    @RequestMapping(value="/wx/customer/recommend/edit/{customerId}",method= RequestMethod.PUT)
503
+    @RequestMapping(value = "/wx/customer/recommend/edit/{customerId}", method = RequestMethod.PUT)
472 504
     public ResponseBean taRecommendCustomerUpdateWx(@PathVariable String customerId,
473
-                                        @RequestBody TaRecommendCustomer taRecommendCustomer){
505
+                                                    @RequestBody TaRecommendCustomer taRecommendCustomer) {
474 506
         ResponseBean responseBean = new ResponseBean();
475 507
         taRecommendCustomer.setCustomerId(customerId);
476 508
         try {
477
-            if (taRecommendCustomerService.updateById(taRecommendCustomer)){
509
+            if (taRecommendCustomerService.updateById(taRecommendCustomer)) {
478 510
                 responseBean.addSuccess(taRecommendCustomer);
479
-            }else {
511
+            } else {
480 512
                 responseBean.addError("fail");
481 513
             }
482
-        }catch (Exception e){
514
+        } catch (Exception e) {
483 515
             e.printStackTrace();
484 516
             responseBean.addError(e.getMessage());
485 517
         }
486 518
         return responseBean;
487 519
     }
520
+
488 521
     /**
489 522
      * 修改对象
523
+     *
490 524
      * @param taRecommendCustomer 实体对象
491 525
      * @return
492 526
      */
493
-    @RequestMapping(value="/admin/customer/recommend/edit/{id}",method= RequestMethod.PUT)
527
+    @RequestMapping(value = "/admin/customer/recommend/edit/{id}", method = RequestMethod.PUT)
494 528
     public ResponseBean taRecommendCustomerUpdate(@PathVariable String id,
495
-                                                  @RequestBody TaRecommendCustomer taRecommendCustomer){
529
+                                                  @RequestBody TaRecommendCustomer taRecommendCustomer) {
496 530
         ResponseBean responseBean = new ResponseBean();
497 531
         taRecommendCustomer.setCustomerId(id);
498 532
         try {
499
-            if (taRecommendCustomerService.updateById(taRecommendCustomer)){
533
+            if (taRecommendCustomerService.updateById(taRecommendCustomer)) {
500 534
                 responseBean.addSuccess(taRecommendCustomer);
501
-            }else {
535
+            } else {
502 536
                 responseBean.addError("fail");
503 537
             }
504
-        }catch (Exception e){
538
+        } catch (Exception e) {
505 539
             e.printStackTrace();
506 540
             responseBean.addError(e.getMessage());
507 541
         }
@@ -536,7 +570,7 @@ public class TaRecommendCustomerController extends BaseController {
536 570
         ResponseBean responseBean = new ResponseBean();
537 571
         try {
538 572
             responseBean.addSuccess(taRecommendCustomerService.getById(customerId));
539
-        }catch (Exception e){
573
+        } catch (Exception e) {
540 574
             e.printStackTrace();
541 575
             responseBean.addError(e.getMessage());
542 576
         }
@@ -549,7 +583,7 @@ public class TaRecommendCustomerController extends BaseController {
549 583
         ResponseBean responseBean = new ResponseBean();
550 584
         try {
551 585
             responseBean.addSuccess(taRecommendCustomerService.getCustomerById(customerId));
552
-        }catch (Exception e){
586
+        } catch (Exception e) {
553 587
             e.printStackTrace();
554 588
             responseBean.addError(e.getMessage());
555 589
         }
@@ -559,14 +593,14 @@ public class TaRecommendCustomerController extends BaseController {
559 593
 
560 594
     @GetMapping(value = "/admin/customer/recommend/get/{id}")
561 595
     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,
596
+                                          @RequestParam(value = "pageNumber", defaultValue = "1") Integer pageNumber,
597
+                                          @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
598
+                                          @RequestParam(value = "buildingId", required = false) String buildingId,
565 599
                                           HttpServletRequest request) {
566 600
         ResponseBean responseBean = new ResponseBean();
567 601
         try {
568
-            responseBean.addSuccess(taRecommendCustomerService.getCustomerDetail(id,pageNumber,pageSize,getTaPersonBuildingListByUserId(request),buildingId));
569
-        }catch (Exception e){
602
+            responseBean.addSuccess(taRecommendCustomerService.getCustomerDetail(id, pageNumber, pageSize, getTaPersonBuildingListByUserId(request), buildingId));
603
+        } catch (Exception e) {
570 604
             e.printStackTrace();
571 605
             responseBean.addError(e.getMessage());
572 606
         }
@@ -575,13 +609,13 @@ public class TaRecommendCustomerController extends BaseController {
575 609
 
576 610
     @GetMapping(value = "/admin/customer/recommend/public/get/{id}")
577 611
     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) {
612
+                                                @RequestParam(value = "pageNumber", defaultValue = "1") Integer pageNumber,
613
+                                                @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
614
+                                                @RequestParam(value = "buildingId", required = false) String buildingId, HttpServletRequest request) {
581 615
         ResponseBean responseBean = new ResponseBean();
582 616
         try {
583
-            responseBean.addSuccess(taRecommendCustomerService.getPublicCustomerDetail(id,pageNumber,pageSize,getTaPersonBuildingListByUserId(request),buildingId));
584
-        }catch (Exception e){
617
+            responseBean.addSuccess(taRecommendCustomerService.getPublicCustomerDetail(id, pageNumber, pageSize, getTaPersonBuildingListByUserId(request), buildingId));
618
+        } catch (Exception e) {
585 619
             e.printStackTrace();
586 620
             responseBean.addError(e.getMessage());
587 621
         }
@@ -589,29 +623,30 @@ public class TaRecommendCustomerController extends BaseController {
589 623
     }
590 624
 
591 625
     @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){
626
+    public ResponseBean getDriftCustomerList(HttpServletRequest request,
627
+                                             @RequestParam(value = "buildingId", defaultValue = "") String buildingId,
628
+                                             @RequestParam(value = "sceneType", defaultValue = "") String sceneType,
629
+                                             @RequestParam(value = "pageNumber", defaultValue = "1") Integer pageNumber,
630
+                                             @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
631
+        try {
632
+            return ResponseBean.success(taPersonService.getDriftCustomerList(pageNumber, pageSize, buildingId, getOrgId(request), sceneType));
633
+        } catch (Exception e) {
600 634
             e.printStackTrace();
601
-            return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
635
+            return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
602 636
         }
603 637
     }
604 638
 
605 639
     /**
606 640
      * 修改对象
641
+     *
607 642
      * @return
608 643
      */
609
-    @RequestMapping(value="/admin/customer/recommend/verify/{id}",method= RequestMethod.PUT)
644
+    @RequestMapping(value = "/admin/customer/recommend/verify/{id}", method = RequestMethod.PUT)
610 645
     public ResponseBean taRecommendCustomerVerify(@PathVariable String id,
611 646
                                                   @RequestParam Integer verifyStatus,
612 647
                                                   @RequestParam(required = false) String verifyRemark,
613 648
                                                   @RequestParam(required = false) String realtyConsultant,
614
-                                                  HttpServletRequest request){
649
+                                                  HttpServletRequest request) {
615 650
         if (null == verifyStatus) {
616 651
             return ResponseBean.error("审核结果非法", ResponseBean.ERROR_ILLEGAL_PARAMS);
617 652
         }
@@ -619,9 +654,9 @@ public class TaRecommendCustomerController extends BaseController {
619 654
         ResponseBean responseBean = new ResponseBean();
620 655
         try {
621 656
             TaRecommendCustomer taRecommendCustomer = taRecommendCustomerService.getById(id);
622
-            if(null == taRecommendCustomer.getVerifyStatus() || 0 == taRecommendCustomer.getVerifyStatus().intValue()){ // taRecommendCustomer.getVerifyStatus().equals(CommConstant.VERIFY_READY)
657
+            if (null == taRecommendCustomer.getVerifyStatus() || 0 == taRecommendCustomer.getVerifyStatus().intValue()) { // taRecommendCustomer.getVerifyStatus().equals(CommConstant.VERIFY_READY)
623 658
                 taRecommendCustomer.setVerifyStatus(verifyStatus);
624
-                if(!StringUtils.isEmpty(verifyRemark)){
659
+                if (!StringUtils.isEmpty(verifyRemark)) {
625 660
                     taRecommendCustomer.setVerifyRemark(verifyRemark);
626 661
 //                    if(CommConstant.CUSTOMER_REPORT.equals(taRecommendCustomer.getReportRecommendStatus())){
627 662
 //                        taRecommendCustomer.setRealtyConsultant(taRecommendCustomer.getRecommendPerson());
@@ -644,7 +679,7 @@ public class TaRecommendCustomerController extends BaseController {
644 679
                     }
645 680
                 }
646 681
 
647
-                if (taRecommendCustomerService.updateById(taRecommendCustomer)){
682
+                if (taRecommendCustomerService.updateById(taRecommendCustomer)) {
648 683
 
649 684
                     // 审核通过增加积分
650 685
                     if (CommConstant.VERIFY_AGREE == verifyStatus) {
@@ -652,14 +687,14 @@ public class TaRecommendCustomerController extends BaseController {
652 687
                     }
653 688
 
654 689
                     responseBean.addSuccess(taRecommendCustomer);
655
-                }else {
690
+                } else {
656 691
                     responseBean.addError("fail");
657 692
                 }
658 693
             } else {
659 694
                 responseBean.addSuccess("客户已审核");
660 695
             }
661 696
 
662
-        }catch (Exception e){
697
+        } catch (Exception e) {
663 698
             e.printStackTrace();
664 699
             responseBean.addError(e.getMessage());
665 700
         }
@@ -676,7 +711,7 @@ public class TaRecommendCustomerController extends BaseController {
676 711
         response.setCharacterEncoding("utf-8");
677 712
         response.setHeader("Content-disposition", "attachment;filename=推荐客户.xlsx");
678 713
 
679
-        Integer count = taRecommendCustomerService.getRecCustomerExportCount(getOrgId(request),getTaPersonBuildingListByUserId(request));
714
+        Integer count = taRecommendCustomerService.getRecCustomerExportCount(getOrgId(request), getTaPersonBuildingListByUserId(request));
680 715
 
681 716
         Integer pageCode = 0;
682 717
         Integer pageSize = 100;
@@ -687,10 +722,10 @@ public class TaRecommendCustomerController extends BaseController {
687 722
         // 设置 sheet, 同一个sheet只需要设置一次
688 723
         WriteSheet writeSheet = EasyExcel.writerSheet("推荐客户").build();
689 724
         do {
690
-            List<ExcelRecommendCustomer> recCustomerExport = taRecommendCustomerService.getRecCustomerExport(getOrgId(request), pageCode * pageSize, pageSize,getTaPersonBuildingListByUserId(request));
725
+            List<ExcelRecommendCustomer> recCustomerExport = taRecommendCustomerService.getRecCustomerExport(getOrgId(request), pageCode * pageSize, pageSize, getTaPersonBuildingListByUserId(request));
691 726
             excelWriter.write(recCustomerExport, writeSheet);
692 727
 
693
-            pageCode ++;
728
+            pageCode++;
694 729
         } while (pageCode <= pageCount);
695 730
 
696 731
         /// finish 会帮忙关闭流
@@ -705,20 +740,20 @@ public class TaRecommendCustomerController extends BaseController {
705 740
     @GetMapping("/admin/customer/recommend/report/export")
706 741
     public void reportExport(HttpServletRequest request,
707 742
                              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 {
743
+                             @RequestParam(value = "name", required = false) String name,
744
+                             @RequestParam(value = "tel", required = false) String tel,
745
+                             @RequestParam(value = "buildingId", required = false) String buildingId,
746
+                             @RequestParam(value = "consultName", required = false) String consultName,
747
+                             @RequestParam(value = "consultTel", required = false) String consultTel,
748
+                             @RequestParam(value = "entryType", required = false) String entryType,
749
+                             @RequestParam(value = "verifyStatus", required = false) String verifyStatus,
750
+                             @RequestParam(value = "sex", required = false) Integer sex) throws IOException {
716 751
 //        response.setContentType("application/vnd.ms-excel");
717 752
         response.setContentType("application/octet-stream");
718 753
         response.setCharacterEncoding("utf-8");
719 754
         response.setHeader("Content-disposition", "attachment;filename=报备客户.xlsx");
720 755
 
721
-        Integer count = taRecommendCustomerService.getRepCustomerReportCount(buildingId,name,tel,consultName,consultTel,entryType,verifyStatus,sex,getOrgId(request),getTaPersonBuildingListByUserId(request));
756
+        Integer count = taRecommendCustomerService.getRepCustomerReportCount(buildingId, name, tel, consultName, consultTel, entryType, verifyStatus, sex, getOrgId(request), getTaPersonBuildingListByUserId(request));
722 757
 
723 758
         Integer pageCode = 0;
724 759
         Integer pageSize = 100;
@@ -730,10 +765,10 @@ public class TaRecommendCustomerController extends BaseController {
730 765
         WriteSheet writeSheet = EasyExcel.writerSheet("报备客户").build();
731 766
         List<ReporRecommendCustomer> recCustomerExport = null;
732 767
         do {
733
-            recCustomerExport = taRecommendCustomerService.getRepCustomerReportExport(buildingId, name, tel, consultName, consultTel, entryType, verifyStatus, sex, getOrgId(request), pageCode * pageSize, pageSize,getTaPersonBuildingListByUserId(request));
768
+            recCustomerExport = taRecommendCustomerService.getRepCustomerReportExport(buildingId, name, tel, consultName, consultTel, entryType, verifyStatus, sex, getOrgId(request), pageCode * pageSize, pageSize, getTaPersonBuildingListByUserId(request));
734 769
             excelWriter.write(recCustomerExport, writeSheet);
735 770
 
736
-            pageCode ++;
771
+            pageCode++;
737 772
         } while (pageCode <= pageCount);
738 773
 
739 774
         /// finish 会帮忙关闭流
@@ -766,7 +801,7 @@ public class TaRecommendCustomerController extends BaseController {
766 801
             recCustomerExport = taRecommendCustomerService.getIndependentAgentsExport(getOrgId(request), pageCode * pageSize, pageSize);
767 802
             excelWriter.write(recCustomerExport, writeSheet);
768 803
 
769
-            pageCode ++;
804
+            pageCode++;
770 805
         } while (pageCode <= pageCount);
771 806
 
772 807
         /// finish 会帮忙关闭流
@@ -775,11 +810,11 @@ public class TaRecommendCustomerController extends BaseController {
775 810
     }
776 811
 
777 812
 
778
-
779 813
     // 客户列表 公客/私客
780 814
 
781 815
     /**
782 816
      * 导出数据 客户列表 公客/私客
817
+     *
783 818
      * @param request
784 819
      * @param response
785 820
      * @param name
@@ -792,22 +827,24 @@ public class TaRecommendCustomerController extends BaseController {
792 827
      * @param sex
793 828
      * @param customerType
794 829
      * @param status
830
+     * @param belongStatus 是否归属项目 1是  0否
795 831
      * @throws IOException
796 832
      */
797 833
     @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 私
834
+    public void getCustomerExportList(HttpServletRequest request,
835
+                                      HttpServletResponse response,
836
+                                      @RequestParam(value = "name", required = false) String name,
837
+                                      @RequestParam(value = "tel", required = false) String tel,
838
+                                      @RequestParam(value = "buildingId", required = false) String buildingId,
839
+                                      @RequestParam(value = "consultName", required = false) String consultName,
840
+                                      @RequestParam(value = "consultTel", required = false) String consultTel,
841
+                                      @RequestParam(value = "entryType", required = false) String entryType,
842
+                                      @RequestParam(value = "verifyStatus", required = false) String verifyStatus,
843
+                                      @RequestParam(value = "sex", required = false) Integer sex,
844
+                                      @RequestParam(value = "customerType") String customerType,
845
+                                      @RequestParam(value = "status", required = false) Integer status,
846
+                                      @RequestParam(value = "sceneType", required = false) String sceneType,
847
+                                      @RequestParam(value = "belongStatus", required = false) Integer belongStatus) throws IOException { // public 公  private 私
811 848
 
812 849
         //        response.setContentType("application/vnd.ms-excel");
813 850
         response.setContentType("application/octet-stream");
@@ -835,8 +872,8 @@ public class TaRecommendCustomerController extends BaseController {
835 872
 //            pageCount = count % pageSize == 0 ? count / pageSize : (count / pageSize) + 1;
836 873
 //            List<PublicCustomerExport> publicList = null;
837 874
 //            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);
875
+            List<PublicCustomerExport> publicList = taRecommendCustomerMapper.getPublicCustomerExportList(pageCode * pageSize, pageSize, buildingId, name, tel, entryType, verifyStatus, sex, orgId, consultTel, sceneType, getTaPersonBuildingListByUserId(request), belongStatus);
876
+            excelWriter.write(publicList, writeSheet);
840 877
 
841 878
 //                pageCode ++;
842 879
 //            } while (pageCode <= pageCount);
@@ -857,8 +894,8 @@ public class TaRecommendCustomerController extends BaseController {
857 894
 //            pageCount = count % pageSize == 0 ? count / pageSize : (count / pageSize) + 1;
858 895
 //            List<PrivateCustomerExport> privateList = null;
859 896
 //            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);
897
+            List<PrivateCustomerExport> privateList = taRecommendCustomerMapper.getCustomerExportList(pageCode * pageSize, pageSize, buildingId, name, tel, consultName, consultTel, entryType, verifyStatus, sex, orgId, status, sceneType, getTaPersonBuildingListByUserId(request));
898
+            excelWriter.write(privateList, writeSheet);
862 899
 
863 900
 //                pageCode ++;
864 901
 //            } while (pageCode <= pageCount);
@@ -869,9 +906,10 @@ public class TaRecommendCustomerController extends BaseController {
869 906
 
870 907
 
871 908
     }
872
-    
909
+
873 910
     /**
874 911
      * 查询判客工具下的我的客户人数集合
912
+     *
875 913
      * @param request
876 914
      * @return
877 915
      */
@@ -881,44 +919,47 @@ public class TaRecommendCustomerController extends BaseController {
881 919
         String openid = getOpenId(request);
882 920
         return taRecommendCustomerService.getMyCustStatistics(openid);
883 921
     }
884
-    
922
+
885 923
     /**
886 924
      * 分页查询判客工具下的我的客户跟进人集合
887
-     *  根据type区分  follow 跟进  clinch 成交
925
+     * 根据type区分  follow 跟进  clinch 成交
926
+     *
888 927
      * @param request
889 928
      * @return
890 929
      */
891 930
     @GetMapping("/wx/inventory/customer/statistics/{type}")
892 931
     @ApiOperation(value = "查询我的客户人数统计", notes = "查询我的客户人数统计")
893 932
     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,
933
+                                         @RequestParam(value = "pageNumber", defaultValue = "0") Integer pageNumber,
934
+                                         @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
935
+                                         @RequestParam(value = "name", required = false) String name,
936
+                                         @RequestParam(value = "phone", required = false) String phone,
937
+                                         @RequestParam(value = "status", required = false) Integer status,
938
+                                         @RequestParam(value = "startReportDate", required = false) String startReportDate,
939
+                                         @RequestParam(value = "endReportDate", required = false) String endReportDate,
940
+                                         @RequestParam(value = "startArrivalDate", required = false) String startArrivalDate,
941
+                                         @RequestParam(value = "endArrivalDate", required = false) String endArrivalDate,
903 942
                                          HttpServletRequest request) {
904 943
         String openid = getOpenId(request);
905
-        return taRecommendCustomerService.getMyCustFollowOrClinch(pageNumber,pageSize,openid,type,name,phone,status,startReportDate,endReportDate,startArrivalDate,endArrivalDate);
944
+        return taRecommendCustomerService.getMyCustFollowOrClinch(pageNumber, pageSize, openid, type, name, phone, status, startReportDate, endReportDate, startArrivalDate, endArrivalDate);
906 945
     }
907
-    
946
+
908 947
     /**
909 948
      * 查询盘客工具下我的客户详情
949
+     *
910 950
      * @param request
911 951
      * @return
912 952
      */
913 953
     @GetMapping("/wx/inventory/customer/{customerId}")
914 954
     @ApiOperation(value = "查询客户详情", notes = "查询客户详情")
915
-    public ResponseBean getMyCustDetail(@PathVariable(value = "customerId") String customerId,HttpServletRequest request) {
955
+    public ResponseBean getMyCustDetail(@PathVariable(value = "customerId") String customerId, HttpServletRequest request) {
916 956
         String openid = getOpenId(request);
917
-        return taRecommendCustomerService.getMyCustDetail(customerId,openid);
957
+        return taRecommendCustomerService.getMyCustDetail(customerId, openid);
918 958
     }
919
-    
959
+
920 960
     /**
921 961
      * 查询盘客工具下编辑基本信息
962
+     *
922 963
      * @param request
923 964
      * @return
924 965
      */
@@ -928,6 +969,25 @@ public class TaRecommendCustomerController extends BaseController {
928 969
                                            @RequestBody TaRecommendCustomer taRecommendCustomer, HttpServletRequest request) {
929 970
         String openid = getOpenId(request);
930 971
         taRecommendCustomer.setCustomerId(customerId);
931
-        return taRecommendCustomerService.updateMyCust(taRecommendCustomer,openid);
972
+        return taRecommendCustomerService.updateMyCust(taRecommendCustomer, openid);
973
+    }
974
+
975
+    /**
976
+     * 校验此职业顾问下有没有私客存在
977
+     * @return
978
+     */
979
+    @GetMapping("/admin/consultant/customer/list")
980
+    public ResponseBean consultantCustomerList(@RequestParam(value = "userId") Integer userId,
981
+                                               @RequestParam(value = "personId") String personId,
982
+                                               @RequestParam(value = "buildingId") String buildingId,
983
+                                               HttpServletRequest request){
984
+        Integer orgId = getOrgId(request);
985
+        try{
986
+            List<TaRecommendCustomer> list = taRecommendCustomerService.getConsultantCustomerList(userId,personId,buildingId,orgId,getTaPersonBuildingListByUserId(request));
987
+            return ResponseBean.success(list);
988
+        }catch (Exception e){
989
+            e.printStackTrace();
990
+            return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
991
+        }
932 992
     }
933 993
 }

+ 6
- 0
src/main/java/com/huiju/estateagents/entity/TaRecommendCustomer.java 파일 보기

@@ -199,6 +199,12 @@ 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
      */

+ 14
- 7
src/main/java/com/huiju/estateagents/excel/PublicCustomerExport.java 파일 보기

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

+ 38
- 2
src/main/java/com/huiju/estateagents/mapper/TaRecommendCustomerMapper.java 파일 보기

@@ -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
      * 导出数据 获取推荐用户数据
@@ -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
      * 导出数据 私客总数
@@ -199,4 +225,14 @@ public interface TaRecommendCustomerMapper extends BaseMapper<TaRecommendCustome
199 225
                                                            @Param("startDate") LocalDateTime startDate,
200 226
                                                            @Param("endDate") LocalDateTime endDate,
201 227
                                                            @Param("personId") String personId);
228
+
229
+    /**
230
+     * 获取置业福问下的客户
231
+     * @param userId
232
+     * @param personId
233
+     * @param buildingId
234
+     * @param orgId
235
+     * @return
236
+     */
237
+    List<TaRecommendCustomer> getConsultantCustomerList(@Param("userId") Integer userId,@Param("personId") String personId,@Param("buildingId") String buildingId,@Param("orgId") Integer orgId);
202 238
 }

+ 44
- 21
src/main/java/com/huiju/estateagents/service/ITaRecommendCustomerService.java 파일 보기

@@ -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, 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 114
     List<AgentsRecommendCustomer> getIndependentAgentsExport(Integer orgId, Integer pageCode, Integer pageSize);
107
-    
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
 }

+ 19
- 4
src/main/java/com/huiju/estateagents/service/impl/TaRecommendCustomerServiceImpl.java 파일 보기

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

+ 198
- 175
src/main/resources/mapper/TaRecommendCustomerMapper.xml 파일 보기

@@ -40,54 +40,54 @@ 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
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
@@ -104,7 +104,7 @@ FROM
104 104
         </where>
105 105
 
106 106
         ORDER BY
107
-            create_date DESC
107
+        create_date DESC
108 108
     </select>
109 109
 
110 110
     <select id="getRepCustomerList" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
@@ -161,6 +161,7 @@ FROM
161 161
     <select id="getCustomerList" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
162 162
         SELECT
163 163
         a.*,
164
+        IFNULL( t2.building_name, '暂无' ) AS buildingName,
164 165
         a.customer_id as customerId,
165 166
         IFNULL(b.name,d.user_name) as consultantName,
166 167
         IFNULL(b.tel,d.phone) as consultTel,
@@ -173,10 +174,11 @@ FROM
173 174
         LEFT JOIN ta_user d on d.user_id = a.realty_consultant
174 175
         LEFT JOIN ta_person_from_record p ON a.person_id = p.person_id AND p.is_first_time = 1
175 176
         <if test="orgId != null">
176
-            and p.org_id =  #{orgId}
177
+            and p.org_id = #{orgId}
177 178
         </if>
178 179
         LEFT JOIN ta_person c on p.share_person_id = c.person_id
179 180
         LEFT JOIN td_wx_dict w ON p.scene_id = w.scene_id
181
+        LEFT JOIN ta_building t2 ON a.building_id = t2.building_id
180 182
         <where>
181 183
             a.status > 0
182 184
             and a.verify_status = 1
@@ -216,10 +218,11 @@ FROM
216 218
                 and a.create_Date >= #{startCreateDate}
217 219
             </if>
218 220
             <if test="endCreateDate != null and endCreateDate !=''">
219
-                and a.create_Date  &lt;= #{endCreateDate}
221
+                and a.create_Date &lt;= #{endCreateDate}
220 222
             </if>
221 223
             <if test="sharePersonName != null and sharePersonName !=''">
222
-                and (c.nickName like CONCAT('%',#{sharePersonName}, '%') or c.name like CONCAT('%',#{sharePersonName}, '%'))
224
+                and (c.nickName like CONCAT('%',#{sharePersonName}, '%') or c.name like CONCAT('%',#{sharePersonName},
225
+                '%'))
223 226
             </if>
224 227
             <if test="personBuildingList != null and personBuildingList.size > 0">
225 228
                 AND a.building_id in
@@ -243,60 +246,64 @@ FROM
243 246
 	WHERE a.customer_id = #{customerId}
244 247
     </select>
245 248
 
246
-    <select id="getPublicCustomerList" resultType="com.huiju.estateagents.entity.TaPerson">
249
+    <select id="getPublicCustomerList" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
247 250
         SELECT
248
-        b.*,
249
-        ifnull(c.nickname, c.name)  AS sharePersonName
251
+        t.*,
252
+        IFNULL( t2.building_name, '暂无' ) AS buildingName,
253
+        ifnull( t3.nickname, t3.NAME ) AS sharePersonName
250 254
         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}
255
+        ta_recommend_customer t
256
+        LEFT JOIN ta_building t2 ON t.building_id = t2.building_id
257
+        LEFT JOIN ta_person t3 ON t.recommend_person = t3.person_id
258
+        LEFT JOIN ta_person_from_record t4 ON t.person_id = t4.person_id AND t4.is_first_time = 1 AND t4.org_id = 84
259
+        LEFT JOIN td_wx_dict t5 ON t4.scene_id = t5.scene_id
255 260
         <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}, '%')
261
+            t.`status` > 0
262
+            AND t.verify_status = 1
263
+            AND ( t.realty_consultant IS NULL OR t.realty_consultant = '' )
264
+            AND t.org_id = #{orgId}
265
+            <if test="buildingId != null and buildingId !=''">
266
+                and t.building_id = #{buildingId}
262 267
             </if>
263
-            <if test="sceneType !=null and sceneType !=''">
264
-                and d.scene_type = #{sceneType}
268
+            <if test="name != null and name !=''">
269
+                and t.name like CONCAT('%',#{name}, '%')
265 270
             </if>
266 271
             <if test="tel != null and tel!=''">
267
-                and b.phone like CONCAT('%',#{tel}, '%')
272
+                and t.phone like CONCAT('%',#{tel}, '%')
268 273
             </if>
269 274
             <if test="entryType != null and entryType !=''">
270
-                and b.entry_type = #{entryType}
275
+                and t.entry_type = #{entryType}
276
+            </if>
277
+            <if test="verifyStatus != null and verifyStatus !=''">
278
+                and t.verify_status = #{verifyStatus}
271 279
             </if>
272 280
             <if test="sex != null and sex !=''">
273
-                and b.sex = #{sex}
281
+                and t.sex = #{sex}
274 282
             </if>
275 283
             <if test="startCreateDate != null and startCreateDate !=''">
276
-                and b.create_Date >= #{startCreateDate}
284
+                and t.create_Date >= #{startCreateDate}
277 285
             </if>
278 286
             <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}
287
+                and t.create_Date &lt;= #{endCreateDate}
286 288
             </if>
287 289
             <if test="sharePersonName != null and sharePersonName !=''">
288
-                and (c.nickName like CONCAT('%',#{sharePersonName}, '%') or c.name like CONCAT('%',#{sharePersonName}, '%'))
290
+                and (t3.nickName like CONCAT('%',#{sharePersonName}, '%') or t3.name like CONCAT('%',#{sharePersonName},
291
+                '%'))
289 292
             </if>
290
-<!--            and NOT EXISTS ( select * from ta_recommend_customer a where a.org_id = #{orgId} and a.recommend_person = b.person_id)-->
291 293
             <if test="personBuildingList != null and personBuildingList.size > 0">
292
-                AND b.building_id in
294
+                AND t.building_id in
293 295
                 <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
294 296
                     #{personBuilding.buildingId}
295 297
                 </foreach>
296 298
             </if>
299
+            <if test="sceneType !=null and sceneType !=''">
300
+                and t4.scene_type = #{sceneType}
301
+            </if>
302
+            <if test="belongStatus == 0">
303
+                and (t.building_id = ''  OR t.building_id is null )
304
+            </if>
297 305
         </where>
298
-        group by b.person_id
299
-        order by b.create_date desc
306
+        order by t.create_date desc
300 307
     </select>
301 308
 
302 309
     <select id="getRecCustomerExport" resultType="com.huiju.estateagents.excel.ExcelRecommendCustomer">
@@ -308,7 +315,8 @@ FROM
308 315
         if(a.sex = 1, '男',if(a.sex = 2, '女', '未知')) as sex,
309 316
         c.nickname as recommend,
310 317
         c.phone as recommendTel,
311
-        if(a.verify_status = 0, '待审核', if(a.verify_status = 1, '已通过', if(a.verify_status = 2, '未通过', ''))) as verifyStatusName
318
+        if(a.verify_status = 0, '待审核', if(a.verify_status = 1, '已通过', if(a.verify_status = 2, '未通过', ''))) as
319
+        verifyStatusName
312 320
         FROM
313 321
         ta_recommend_customer a
314 322
         LEFT JOIN ta_person c on a.recommend_person = c.person_id
@@ -398,7 +406,7 @@ FROM
398 406
         order by a.create_date desc
399 407
     </select>
400 408
 
401
-    <select id="getRepCustomerReportExport" resultType="com.huiju.estateagents.excel.ReporRecommendCustomer" >
409
+    <select id="getRepCustomerReportExport" resultType="com.huiju.estateagents.excel.ReporRecommendCustomer">
402 410
         SELECT
403 411
         a.name as name,
404 412
         a.phone as phone,
@@ -454,7 +462,7 @@ FROM
454 462
     </select>
455 463
 
456 464
 
457
-    <select id="getIndependentAgentsCount"  resultType="java.lang.Integer">
465
+    <select id="getIndependentAgentsCount" resultType="java.lang.Integer">
458 466
         SELECT
459 467
         count(*)
460 468
         FROM
@@ -479,24 +487,24 @@ FROM
479 487
         a.phone as phone,
480 488
         if(a.gender = '1', '男', if(a.gender = '2', '女', '未知')) as gender,
481 489
         if(ifnull(tc.channel_name, '') != '', '渠道经纪人', '独立经纪人') as personType,
482
-        tc.channel_name  as channelName,
490
+        tc.channel_name as channelName,
483 491
         (
484
-            SELECT
485
-              count( 1 )
486
-            FROM
487
-              ta_person tp
488
-            WHERE
489
-              tp.recommend_agent = a.person_id
492
+        SELECT
493
+        count( 1 )
494
+        FROM
495
+        ta_person tp
496
+        WHERE
497
+        tp.recommend_agent = a.person_id
490 498
         ) AS agentCount,
491 499
         (
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}
500
+        SELECT
501
+        count( 1 )
502
+        FROM
503
+        ta_recommend_customer tarc
504
+        WHERE
505
+        tarc.recommend_person = a.person_id
506
+        and tarc.status = 1
507
+        and tarc.org_id = #{orgId}
500 508
         ) AS recommedCount
501 509
         FROM
502 510
         ta_person a
@@ -543,74 +551,75 @@ FROM
543 551
             <if test="consultTel != null and consultTel !=''">
544 552
                 and b.tel like CONCAT('%',#{consultTel}, '%')
545 553
             </if>
546
-            and NOT EXISTS ( select * from ta_recommend_customer a where a.org_id = #{orgId} and a.recommend_person = b.person_id)
554
+            and NOT EXISTS ( select * from ta_recommend_customer a where a.org_id = #{orgId} and a.recommend_person =
555
+            b.person_id)
547 556
         </where>
548 557
         order by b.create_date desc
549 558
     </select>
550 559
 
551 560
     <select id="getPublicCustomerExportList" resultType="com.huiju.estateagents.excel.PublicCustomerExport">
552 561
         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
562
+        t.NAME AS nickname,
563
+        t.phone,
564
+        IF( t.sex = 1, '男', IF ( t.sex = 2, '女', '未知' ) ) AS sex,
565
+        t.create_date,
566
+        concat( t.country, t.province ) AS province,
567
+        t.intention,
568
+        IF(t.building_id = null or t.building_id = '','否','是') AS belongStatus,
569
+        IFNULL( t2.building_name, '暂无' ) AS buildingName,
570
+        t5.scene_alias as sceneType,
571
+        ifnull( t3.nickname, t3.NAME ) AS sharePersonName ,
572
+        t6.points
563 573
         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
574
+        ta_recommend_customer t
575
+        LEFT JOIN ta_building t2 ON t.building_id = t2.building_id
576
+        LEFT JOIN ta_person t3 ON t.recommend_person = t3.person_id
577
+        LEFT JOIN ta_person_from_record t4 ON t.person_id = t4.person_id AND t4.is_first_time = 1 AND t4.org_id =
578
+        #{orgId}
579
+        LEFT JOIN td_wx_dict t5 ON t4.scene_id = t5.scene_id
580
+        LEFT JOIN (select sum(points_amount) as points,person_id from ta_points_records where org_id = #{orgId} GROUP BY
581
+        person_id) t6 on t.person_id = t6.person_id
582
+        WHERE
583
+        t.`status` > 0
584
+        AND t.verify_status = 1
585
+        AND ( t.realty_consultant IS NULL OR t.realty_consultant = '' )
586
+        AND t.org_id = #{orgId}
587
+        <if test="buildingId != null and buildingId !=''">
588
+            and t.building_id = #{buildingId}
589
+        </if>
590
+        <if test="name != null and name !=''">
591
+            and t.name like CONCAT('%',#{name}, '%')
592
+        </if>
593
+        <if test="tel != null and tel!=''">
594
+            and t.phone like CONCAT('%',#{tel}, '%')
595
+        </if>
596
+        <if test="entryType != null and entryType !=''">
597
+            and t.entry_type = #{entryType}
598
+        </if>
599
+        <if test="verifyStatus != null and verifyStatus !=''">
600
+            and t.verify_status = #{verifyStatus}
601
+        </if>
602
+        <if test="sex != null and sex !=''">
603
+            and t.sex = #{sex}
604
+        </if>
605
+        <if test="personBuildingList != null and personBuildingList.size > 0">
606
+            AND t.building_id in
607
+            <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
608
+                #{personBuilding.buildingId}
609
+            </foreach>
610
+        </if>
611
+        <if test="sceneType !=null and sceneType !=''">
612
+            and t4.scene_type = #{sceneType}
613
+        </if>
614
+        <if test="belongStatus == 0">
615
+            and (t.building_id = ''  OR t.building_id is null )
616
+        </if>
608 617
     </select>
609
-<!--    limit #{pageCode}, #{pageSize}-->
618
+    <!--    limit #{pageCode}, #{pageSize}-->
610 619
 
611
-    <select id="getCustomerExportListCount" resultType="Integer" >
620
+    <select id="getCustomerExportListCount" resultType="Integer">
612 621
         SELECT
613
-            count(1)
622
+        count(1)
614 623
         FROM
615 624
         ta_recommend_customer a
616 625
         LEFT JOIN ta_person b ON a.realty_consultant = b.person_id
@@ -689,8 +698,10 @@ FROM
689 698
         LEFT JOIN ta_person c ON p.share_person_id = c.person_id
690 699
         left join ta_building t on a.building_id = t.building_id
691 700
         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
701
+        left JOIN (select sum(points_amount) as points,person_id from ta_points_records where org_id = #{orgId} GROUP BY
702
+        person_id) s on a.person_id = s.person_id
703
+        left join (select sum(t.intention) as intention,t.person_id From ta_person_intention_record t where t.org_id =
704
+        #{orgId} group by t.person_id) z on z.person_id = a.person_id
694 705
         <where>
695 706
             a.status > 0
696 707
             and a.verify_status = 1
@@ -739,16 +750,16 @@ FROM
739 750
         group by a.customer_id,a.building_id
740 751
         order by a.create_date desc
741 752
     </select>
742
-<!--    limit #{pageCode}, #{pageSize}-->
753
+    <!--    limit #{pageCode}, #{pageSize}-->
743 754
 
744 755
     <select id="getMyCustStatistics" resultType="java.util.Map">
745 756
         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
757
+        sum( IF ( STATUS = 4 AND verify_status = 1, 1, 0 ) ) AS clinchSum,
758
+        sum( IF ( STATUS != 4 AND verify_status = 1, 1, 0 ) ) AS followSum
748 759
         FROM
749
-            ta_recommend_customer
760
+        ta_recommend_customer
750 761
         WHERE
751
-            org_id = #{orgId}
762
+        org_id = #{orgId}
752 763
         AND ( realty_consultant = #{personId}
753 764
         <if test="userId != null and userId != ''">
754 765
             OR realty_consultant = #{userId}
@@ -758,15 +769,15 @@ FROM
758 769
 
759 770
     <select id="getMyCustFollowOrClinch" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
760 771
         SELECT
761
-            *
772
+        *
762 773
         FROM
763
-            ta_recommend_customer
774
+        ta_recommend_customer
764 775
         WHERE
765
-            org_id = #{orgId}
776
+        org_id = #{orgId}
766 777
         AND ( realty_consultant = #{personId} OR realty_consultant = #{userId} )
767 778
         <if test="type == 'follow'">
768
-          AND STATUS != 4
769
-          AND verify_status = 1
779
+            AND STATUS != 4
780
+            AND verify_status = 1
770 781
             <if test="name != null and name !=''">
771 782
                 and (`name` like CONCAT('%',#{name}, '%') or phone like CONCAT('%',#{name}, '%'))
772 783
             </if>
@@ -790,7 +801,7 @@ FROM
790 801
             </if>
791 802
         </if>
792 803
         <if test="type == 'clinch'">
793
-          AND STATUS = 4
804
+            AND STATUS = 4
794 805
         </if>
795 806
     </select>
796 807
 
@@ -804,14 +815,14 @@ FROM
804 815
 
805 816
     <select id="getCustomerIntentions" resultType="com.huiju.estateagents.entity.PersonIntention">
806 817
         SELECT
807
-            SUM( a.intention ) AS intention,
808
-            a.building_id,
809
-            b.building_name
818
+        SUM( a.intention ) AS intention,
819
+        a.building_id,
820
+        b.building_name
810 821
         FROM
811
-            ta_person_intention_record a
812
-            left join ta_building b on a.building_id = b.building_id
822
+        ta_person_intention_record a
823
+        left join ta_building b on a.building_id = b.building_id
813 824
         WHERE
814
-           a.person_id = #{personId}
825
+        a.person_id = #{personId}
815 826
         <if test="personBuildingList != null and personBuildingList.size > 0">
816 827
             AND a.building_id in
817 828
             <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
@@ -819,9 +830,9 @@ FROM
819 830
             </foreach>
820 831
         </if>
821 832
         GROUP BY
822
-            a.building_id
833
+        a.building_id
823 834
         ORDER BY
824
-            intention DESC
835
+        intention DESC
825 836
     </select>
826 837
 
827 838
     <select id="getCustomersIRecommended" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
@@ -851,11 +862,23 @@ FROM
851 862
             and s.create_date BETWEEN #{startDate} and #{endDate}
852 863
         </if>
853 864
         <if test="buildingId != null and buildingId !=''">
854
-        and s.building_id = #{buildingId}
865
+            and s.building_id = #{buildingId}
855 866
         </if>
856 867
         and s.status &gt; 0
857 868
         order by s.report_date desc
858 869
     </select>
859 870
 
871
+    <select id="getConsultantCustomerList" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
872
+        SELECT
873
+            *
874
+        FROM
875
+            ta_recommend_customer t
876
+        WHERE
877
+            t.org_id = #{orgId}
878
+            AND t.STATUS > 0
879
+            AND t.verify_status = 1
880
+            AND t.realty_consultant IN ( #{userId}, #{personId})
881
+    </select>
882
+
860 883
 
861 884
 </mapper>

+ 11
- 2
src/main/resources/mapper/TaUserMapper.xml 파일 보기

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