Browse Source

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 years ago
parent
commit
0e8ca0cf5e

+ 5
- 11
src/main/java/com/huiju/estateagents/center/taUser/controller/TaUserController.java View File

2
 
2
 
3
 import com.alibaba.fastjson.JSONObject;
3
 import com.alibaba.fastjson.JSONObject;
4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
6
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
 import com.baomidou.mybatisplus.core.metadata.IPage;
7
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
8
 import com.huiju.estateagents.base.BaseController;
7
 import com.huiju.estateagents.base.BaseController;
9
 import com.huiju.estateagents.base.ResponseBean;
8
 import com.huiju.estateagents.base.ResponseBean;
10
 import com.huiju.estateagents.center.sysUser.entity.SysToken;
9
 import com.huiju.estateagents.center.sysUser.entity.SysToken;
11
-import com.huiju.estateagents.center.sysUser.entity.SysUser;
12
 import com.huiju.estateagents.center.sysUser.service.ISysTokenService;
10
 import com.huiju.estateagents.center.sysUser.service.ISysTokenService;
13
 import com.huiju.estateagents.center.taUser.entity.TaTagUser;
11
 import com.huiju.estateagents.center.taUser.entity.TaTagUser;
14
 import com.huiju.estateagents.center.taUser.entity.TaTags;
12
 import com.huiju.estateagents.center.taUser.entity.TaTags;
15
 import com.huiju.estateagents.center.taUser.entity.TaUser;
13
 import com.huiju.estateagents.center.taUser.entity.TaUser;
16
 import com.huiju.estateagents.center.taUser.entity.TaUserRole;
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
 import com.huiju.estateagents.common.CommConstant;
16
 import com.huiju.estateagents.common.CommConstant;
23
 import com.huiju.estateagents.common.JWTUtils;
17
 import com.huiju.estateagents.common.JWTUtils;
24
 import com.huiju.estateagents.common.MD5Utils;
18
 import com.huiju.estateagents.common.MD5Utils;
25
-import com.huiju.estateagents.common.StringUtils;
26
 import com.huiju.estateagents.entity.SysButtonInMenu;
19
 import com.huiju.estateagents.entity.SysButtonInMenu;
27
 import com.huiju.estateagents.entity.SysMenu;
20
 import com.huiju.estateagents.entity.SysMenu;
28
 import com.huiju.estateagents.entity.TaMiniapp;
21
 import com.huiju.estateagents.entity.TaMiniapp;
40
 import org.springframework.web.bind.annotation.*;
33
 import org.springframework.web.bind.annotation.*;
41
 
34
 
42
 import javax.servlet.http.HttpServletRequest;
35
 import javax.servlet.http.HttpServletRequest;
43
-import java.time.LocalDateTime;
44
 import java.util.ArrayList;
36
 import java.util.ArrayList;
45
 import java.util.HashMap;
37
 import java.util.HashMap;
46
 import java.util.List;
38
 import java.util.List;
398
                                    @RequestParam(value ="phone",required = false) String phone,
390
                                    @RequestParam(value ="phone",required = false) String phone,
399
                                    @RequestParam(value ="status",required = false) Integer status,
391
                                    @RequestParam(value ="status",required = false) Integer status,
400
                                    @RequestParam(value ="isConsultant",required = false) Integer isConsultant,
392
                                    @RequestParam(value ="isConsultant",required = false) Integer isConsultant,
393
+                                   @RequestParam(value ="miniStatus",required = false) Integer miniStatus,
401
                                    @RequestParam(value ="buildingId",required = false) String buildingId,
394
                                    @RequestParam(value ="buildingId",required = false) String buildingId,
402
                                    HttpServletRequest request){
395
                                    HttpServletRequest request){
403
         ResponseBean responseBean = new ResponseBean();
396
         ResponseBean responseBean = new ResponseBean();
415
             }else if (null != isConsultant && isConsultant == 0){
408
             }else if (null != isConsultant && isConsultant == 0){
416
                 taUser.setIsConsultant(false);
409
                 taUser.setIsConsultant(false);
417
             }
410
             }
411
+            taUser.setMiniStatus(miniStatus);
418
 
412
 
419
             IPage<TaUser> result = iTaUserService.seleUserList(pg,taUser,getTaPersonBuildingListByUserId(request));
413
             IPage<TaUser> result = iTaUserService.seleUserList(pg,taUser,getTaPersonBuildingListByUserId(request));
420
             List<TaUser> taUserList = result.getRecords();
414
             List<TaUser> taUserList = result.getRecords();
422
                 List<TaTags> taTagsList = iTaUserService.getTagsList(e);
416
                 List<TaTags> taTagsList = iTaUserService.getTagsList(e);
423
                 e.setTaTagsList(taTagsList);
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
             result.setRecords(taUserList);
422
             result.setRecords(taUserList);
429
             responseBean.addSuccess(result);
423
             responseBean.addSuccess(result);

+ 0
- 3
src/main/java/com/huiju/estateagents/center/taUser/service/impl/TaUserServiceImpl.java View File

4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
5
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
6
 import com.baomidou.mybatisplus.core.metadata.IPage;
6
 import com.baomidou.mybatisplus.core.metadata.IPage;
7
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
8
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
9
 import com.huiju.estateagents.base.ResponseBean;
8
 import com.huiju.estateagents.base.ResponseBean;
10
 import com.huiju.estateagents.center.taUser.entity.TaTagUser;
9
 import com.huiju.estateagents.center.taUser.entity.TaTagUser;
25
 import com.huiju.estateagents.mapper.*;
24
 import com.huiju.estateagents.mapper.*;
26
 import com.huiju.estateagents.service.*;
25
 import com.huiju.estateagents.service.*;
27
 import org.apache.commons.collections.CollectionUtils;
26
 import org.apache.commons.collections.CollectionUtils;
28
-import org.apache.commons.collections.map.HashedMap;
29
 import org.springframework.beans.factory.annotation.Autowired;
27
 import org.springframework.beans.factory.annotation.Autowired;
30
 import org.springframework.stereotype.Service;
28
 import org.springframework.stereotype.Service;
31
 
29
 
32
 import java.time.LocalDateTime;
30
 import java.time.LocalDateTime;
33
 import java.util.ArrayList;
31
 import java.util.ArrayList;
34
-import java.util.Iterator;
35
 import java.util.List;
32
 import java.util.List;
36
 import java.util.Map;
33
 import java.util.Map;
37
 import java.util.stream.Collectors;
34
 import java.util.stream.Collectors;

+ 286
- 226
src/main/java/com/huiju/estateagents/controller/TaRecommendCustomerController.java View File

84
 
84
 
85
     /**
85
     /**
86
      * 我的客户列表
86
      * 我的客户列表
87
+     *
87
      * @param pageNumber
88
      * @param pageNumber
88
      * @param pageSize
89
      * @param pageSize
89
      * @param keywords
90
      * @param keywords
93
     @GetMapping("/wx/customer/list")
94
     @GetMapping("/wx/customer/list")
94
     @ApiOperation(value = "查询我的客户列表", notes = "查询我的客户列表")
95
     @ApiOperation(value = "查询我的客户列表", notes = "查询我的客户列表")
95
     @ApiImplicitParams({
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
     public ResponseBean getMyCustList(@RequestParam int pageNumber, @RequestParam int pageSize, String keywords, HttpServletRequest request) {
101
     public ResponseBean getMyCustList(@RequestParam int pageNumber, @RequestParam int pageSize, String keywords, HttpServletRequest request) {
101
         if (pageNumber < 0 || pageSize < 0) {
102
         if (pageNumber < 0 || pageSize < 0) {
108
 
109
 
109
     /**
110
     /**
110
      * 我的客户列表
111
      * 我的客户列表
112
+     *
111
      * @param pageNumber
113
      * @param pageNumber
112
      * @param pageSize
114
      * @param pageSize
113
      * @param keywords
115
      * @param keywords
117
     @GetMapping("/admin/customer/list/{userId}")
119
     @GetMapping("/admin/customer/list/{userId}")
118
     @ApiOperation(value = "查询我的客户列表", notes = "查询我的客户列表")
120
     @ApiOperation(value = "查询我的客户列表", notes = "查询我的客户列表")
119
     @ApiImplicitParams({
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
     public ResponseBean getAdminMyCustList(@RequestParam int pageNumber,
126
     public ResponseBean getAdminMyCustList(@RequestParam int pageNumber,
125
                                            @RequestParam int pageSize,
127
                                            @RequestParam int pageSize,
145
 
147
 
146
     /**
148
     /**
147
      * 客户详情
149
      * 客户详情
150
+     *
148
      * @param id
151
      * @param id
149
      * @return
152
      * @return
150
      */
153
      */
151
     @GetMapping("/wx/customer/{id}")
154
     @GetMapping("/wx/customer/{id}")
152
     @ApiOperation(value = "查询客户详情", notes = "查询客户详情")
155
     @ApiOperation(value = "查询客户详情", notes = "查询客户详情")
153
     @ApiImplicitParams({
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
     public ResponseBean getCustDetail(@PathVariable String id) {
159
     public ResponseBean getCustDetail(@PathVariable String id) {
157
         if (null == id || "".equals(id.trim())) {
160
         if (null == id || "".equals(id.trim())) {
163
 
166
 
164
     /**
167
     /**
165
      * 客户编辑
168
      * 客户编辑
169
+     *
166
      * @param paramStr
170
      * @param paramStr
167
      * @return
171
      * @return
168
      */
172
      */
169
     @PostMapping("/wx/customer/edit")
173
     @PostMapping("/wx/customer/edit")
170
     @ApiOperation(value = "客户编辑", notes = "客户编辑")
174
     @ApiOperation(value = "客户编辑", notes = "客户编辑")
171
     @ApiImplicitParams({
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
     public ResponseBean updateCust(@RequestBody String paramStr) {
178
     public ResponseBean updateCust(@RequestBody String paramStr) {
175
         return taRecommendCustomerService.updateCustByJSON(paramStr);
179
         return taRecommendCustomerService.updateCustByJSON(paramStr);
177
 
181
 
178
     /**
182
     /**
179
      * 推荐客户
183
      * 推荐客户
184
+     *
180
      * @param paramStr
185
      * @param paramStr
181
      * @param request
186
      * @param request
182
      * @return
187
      * @return
185
     public ResponseBean recommendCust(@RequestBody String paramStr, HttpServletRequest request) {
190
     public ResponseBean recommendCust(@RequestBody String paramStr, HttpServletRequest request) {
186
         String openid = getOpenId(request);
191
         String openid = getOpenId(request);
187
         Integer orgId = getOrgId(request);
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
      * @param paramStr
199
      * @param paramStr
194
      * @param request
200
      * @param request
195
      * @return
201
      * @return
198
     public ResponseBean reportCust(@RequestBody String paramStr, HttpServletRequest request) {
204
     public ResponseBean reportCust(@RequestBody String paramStr, HttpServletRequest request) {
199
         String openid = getOpenId(request);
205
         String openid = getOpenId(request);
200
         Integer orgId = getOrgId(request);
206
         Integer orgId = getOrgId(request);
201
-        return taRecommendCustomerService.reportCust(paramStr, openid,orgId);
207
+        return taRecommendCustomerService.reportCust(paramStr, openid, orgId);
202
     }
208
     }
203
 
209
 
204
     @PostMapping("/wx/customer/recommend")
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
         String openid = getOpenId(request);
215
         String openid = getOpenId(request);
210
         List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
216
         List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
211
         if (null == taPersons || taPersons.size() != 1) {
217
         if (null == taPersons || taPersons.size() != 1) {
212
             return ResponseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
218
             return ResponseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
213
         }
219
         }
214
         TaPerson person = taPersons.get(0);
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
             e.printStackTrace();
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
     @GetMapping("/wx/customer/myReport")
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
         String openid = getOpenId(request);
233
         String openid = getOpenId(request);
228
         List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
234
         List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
229
         if (null == taPersons || taPersons.size() != 1) {
235
         if (null == taPersons || taPersons.size() != 1) {
230
             return ResponseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
236
             return ResponseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
231
         }
237
         }
232
         TaPerson person = taPersons.get(0);
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
             queryWrapper.orderByDesc("create_date");
245
             queryWrapper.orderByDesc("create_date");
240
-            IPage<TaRecommendCustomer>result = taRecommendCustomerService.page(pg,queryWrapper);
246
+            IPage<TaRecommendCustomer> result = taRecommendCustomerService.page(pg, queryWrapper);
241
             return ResponseBean.success(result);
247
             return ResponseBean.success(result);
242
-        }catch (Exception e){
248
+        } catch (Exception e) {
243
             e.printStackTrace();
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
     @GetMapping("/wx/customer/myCustomer")
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
         String openid = getOpenId(request);
258
         String openid = getOpenId(request);
253
         List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
259
         List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
254
         if (null == taPersons || taPersons.size() != 1) {
260
         if (null == taPersons || taPersons.size() != 1) {
256
         }
262
         }
257
         TaPerson person = taPersons.get(0);
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
             // 2020-4-1 yansen realty_consultant 可能是 person_id, 可能是 user_id
269
             // 2020-4-1 yansen realty_consultant 可能是 person_id, 可能是 user_id
264
 //            queryWrapper.eq("realty_consultant",person.getPersonId());
270
 //            queryWrapper.eq("realty_consultant",person.getPersonId());
265
             queryWrapper.eq("org_id", person.getOrgId());   // 主要是为了走索引
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
             queryWrapper.orderByDesc("create_date");
275
             queryWrapper.orderByDesc("create_date");
270
-            IPage<TaRecommendCustomer>result = taRecommendCustomerService.page(pg,queryWrapper);
276
+            IPage<TaRecommendCustomer> result = taRecommendCustomerService.page(pg, queryWrapper);
271
             return ResponseBean.success(result);
277
             return ResponseBean.success(result);
272
-        }catch (Exception e){
278
+        } catch (Exception e) {
273
             e.printStackTrace();
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
     @GetMapping("/wx/customer/myInviteAgent")
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
             queryWrapper.orderByDesc("create_date");
294
             queryWrapper.orderByDesc("create_date");
289
-            IPage<TaRecommendCustomer>result = taRecommendCustomerService.page(pg,queryWrapper);
295
+            IPage<TaRecommendCustomer> result = taRecommendCustomerService.page(pg, queryWrapper);
290
             return ResponseBean.success(result);
296
             return ResponseBean.success(result);
291
-        }catch (Exception e){
297
+        } catch (Exception e) {
292
             e.printStackTrace();
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
     @GetMapping("/admin/customer/recommend")
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
             // TODO 目前如果是公客,就取当前操作人员的 buildingId
348
             // TODO 目前如果是公客,就取当前操作人员的 buildingId
320
 //            if ("public".equals(customerType)) {
349
 //            if ("public".equals(customerType)) {
327
 //                TaPersonBuilding personBuilding = taPersonBuildingMapper.selectOne(queryWrapper);
356
 //                TaPersonBuilding personBuilding = taPersonBuildingMapper.selectOne(queryWrapper);
328
 //                buildingId = personBuilding.getBuildingId();
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
             e.printStackTrace();
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
     @GetMapping("/admin/customer/recommend/recommender")
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
             e.printStackTrace();
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
     @GetMapping("/admin/customer/recommend/report")
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
         Integer orgid = getOrgId(request);
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
             e.printStackTrace();
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
      * @param name
415
      * @param name
384
      * @param tel
416
      * @param tel
385
      * @param pageNumber
417
      * @param pageNumber
387
      * @return
419
      * @return
388
      */
420
      */
389
     @GetMapping("/admin/customer/agents")
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
             e.printStackTrace();
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
             Integer orgId = getOrgId(request);
441
             Integer orgId = getOrgId(request);
410
             taRecommendCustomerService.consultantAssist(taUser, personId, orgId);
442
             taRecommendCustomerService.consultantAssist(taUser, personId, orgId);
411
             return ResponseBean.success("");
443
             return ResponseBean.success("");
412
-        }catch (Exception e){
444
+        } catch (Exception e) {
413
             e.printStackTrace();
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
             return ResponseBean.error("请至少选择一条数据", ResponseBean.ERROR_UNAVAILABLE);
456
             return ResponseBean.error("请至少选择一条数据", ResponseBean.ERROR_UNAVAILABLE);
425
         }
457
         }
426
-        try{
458
+        try {
427
             Integer orgId = getOrgId(request);
459
             Integer orgId = getOrgId(request);
428
             taRecommendCustomerService.batchConsultantAssist(taUser, orgId);
460
             taRecommendCustomerService.batchConsultantAssist(taUser, orgId);
429
             return ResponseBean.success("");
461
             return ResponseBean.success("");
430
-        }catch (Exception e){
462
+        } catch (Exception e) {
431
             e.printStackTrace();
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
     @GetMapping("/admin/customer/recommend/{customerId}")
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
         Integer orgId = getOrgId(request);
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
             e.printStackTrace();
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
     @GetMapping("/wx/customer/recommend/mine")
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
         String openid = getOpenId(request);
482
         String openid = getOpenId(request);
451
         List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
483
         List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
452
         if (null == taPersons || taPersons.size() != 1) {
484
         if (null == taPersons || taPersons.size() != 1) {
453
             return ResponseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
485
             return ResponseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
454
         }
486
         }
455
         TaPerson person = taPersons.get(0);
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
             e.printStackTrace();
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
      * @param taRecommendCustomer 实体对象
500
      * @param taRecommendCustomer 实体对象
469
      * @return
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
     public ResponseBean taRecommendCustomerUpdateWx(@PathVariable String customerId,
504
     public ResponseBean taRecommendCustomerUpdateWx(@PathVariable String customerId,
473
-                                        @RequestBody TaRecommendCustomer taRecommendCustomer){
505
+                                                    @RequestBody TaRecommendCustomer taRecommendCustomer) {
474
         ResponseBean responseBean = new ResponseBean();
506
         ResponseBean responseBean = new ResponseBean();
475
         taRecommendCustomer.setCustomerId(customerId);
507
         taRecommendCustomer.setCustomerId(customerId);
476
         try {
508
         try {
477
-            if (taRecommendCustomerService.updateById(taRecommendCustomer)){
509
+            if (taRecommendCustomerService.updateById(taRecommendCustomer)) {
478
                 responseBean.addSuccess(taRecommendCustomer);
510
                 responseBean.addSuccess(taRecommendCustomer);
479
-            }else {
511
+            } else {
480
                 responseBean.addError("fail");
512
                 responseBean.addError("fail");
481
             }
513
             }
482
-        }catch (Exception e){
514
+        } catch (Exception e) {
483
             e.printStackTrace();
515
             e.printStackTrace();
484
             responseBean.addError(e.getMessage());
516
             responseBean.addError(e.getMessage());
485
         }
517
         }
486
         return responseBean;
518
         return responseBean;
487
     }
519
     }
520
+
488
     /**
521
     /**
489
      * 修改对象
522
      * 修改对象
523
+     *
490
      * @param taRecommendCustomer 实体对象
524
      * @param taRecommendCustomer 实体对象
491
      * @return
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
     public ResponseBean taRecommendCustomerUpdate(@PathVariable String id,
528
     public ResponseBean taRecommendCustomerUpdate(@PathVariable String id,
495
-                                                  @RequestBody TaRecommendCustomer taRecommendCustomer){
529
+                                                  @RequestBody TaRecommendCustomer taRecommendCustomer) {
496
         ResponseBean responseBean = new ResponseBean();
530
         ResponseBean responseBean = new ResponseBean();
497
         taRecommendCustomer.setCustomerId(id);
531
         taRecommendCustomer.setCustomerId(id);
498
         try {
532
         try {
499
-            if (taRecommendCustomerService.updateById(taRecommendCustomer)){
533
+            if (taRecommendCustomerService.updateById(taRecommendCustomer)) {
500
                 responseBean.addSuccess(taRecommendCustomer);
534
                 responseBean.addSuccess(taRecommendCustomer);
501
-            }else {
535
+            } else {
502
                 responseBean.addError("fail");
536
                 responseBean.addError("fail");
503
             }
537
             }
504
-        }catch (Exception e){
538
+        } catch (Exception e) {
505
             e.printStackTrace();
539
             e.printStackTrace();
506
             responseBean.addError(e.getMessage());
540
             responseBean.addError(e.getMessage());
507
         }
541
         }
536
         ResponseBean responseBean = new ResponseBean();
570
         ResponseBean responseBean = new ResponseBean();
537
         try {
571
         try {
538
             responseBean.addSuccess(taRecommendCustomerService.getById(customerId));
572
             responseBean.addSuccess(taRecommendCustomerService.getById(customerId));
539
-        }catch (Exception e){
573
+        } catch (Exception e) {
540
             e.printStackTrace();
574
             e.printStackTrace();
541
             responseBean.addError(e.getMessage());
575
             responseBean.addError(e.getMessage());
542
         }
576
         }
549
         ResponseBean responseBean = new ResponseBean();
583
         ResponseBean responseBean = new ResponseBean();
550
         try {
584
         try {
551
             responseBean.addSuccess(taRecommendCustomerService.getCustomerById(customerId));
585
             responseBean.addSuccess(taRecommendCustomerService.getCustomerById(customerId));
552
-        }catch (Exception e){
586
+        } catch (Exception e) {
553
             e.printStackTrace();
587
             e.printStackTrace();
554
             responseBean.addError(e.getMessage());
588
             responseBean.addError(e.getMessage());
555
         }
589
         }
559
 
593
 
560
     @GetMapping(value = "/admin/customer/recommend/get/{id}")
594
     @GetMapping(value = "/admin/customer/recommend/get/{id}")
561
     public ResponseBean getCustomerDetail(@PathVariable String id,
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
                                           HttpServletRequest request) {
599
                                           HttpServletRequest request) {
566
         ResponseBean responseBean = new ResponseBean();
600
         ResponseBean responseBean = new ResponseBean();
567
         try {
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
             e.printStackTrace();
604
             e.printStackTrace();
571
             responseBean.addError(e.getMessage());
605
             responseBean.addError(e.getMessage());
572
         }
606
         }
575
 
609
 
576
     @GetMapping(value = "/admin/customer/recommend/public/get/{id}")
610
     @GetMapping(value = "/admin/customer/recommend/public/get/{id}")
577
     public ResponseBean getPublicCustomerDetail(@PathVariable String id,
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
         ResponseBean responseBean = new ResponseBean();
615
         ResponseBean responseBean = new ResponseBean();
582
         try {
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
             e.printStackTrace();
619
             e.printStackTrace();
586
             responseBean.addError(e.getMessage());
620
             responseBean.addError(e.getMessage());
587
         }
621
         }
589
     }
623
     }
590
 
624
 
591
     @GetMapping("/admin/customer/recommend/drift")
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
             e.printStackTrace();
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
      * @return
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
     public ResponseBean taRecommendCustomerVerify(@PathVariable String id,
645
     public ResponseBean taRecommendCustomerVerify(@PathVariable String id,
611
                                                   @RequestParam Integer verifyStatus,
646
                                                   @RequestParam Integer verifyStatus,
612
                                                   @RequestParam(required = false) String verifyRemark,
647
                                                   @RequestParam(required = false) String verifyRemark,
613
                                                   @RequestParam(required = false) String realtyConsultant,
648
                                                   @RequestParam(required = false) String realtyConsultant,
614
-                                                  HttpServletRequest request){
649
+                                                  HttpServletRequest request) {
615
         if (null == verifyStatus) {
650
         if (null == verifyStatus) {
616
             return ResponseBean.error("审核结果非法", ResponseBean.ERROR_ILLEGAL_PARAMS);
651
             return ResponseBean.error("审核结果非法", ResponseBean.ERROR_ILLEGAL_PARAMS);
617
         }
652
         }
619
         ResponseBean responseBean = new ResponseBean();
654
         ResponseBean responseBean = new ResponseBean();
620
         try {
655
         try {
621
             TaRecommendCustomer taRecommendCustomer = taRecommendCustomerService.getById(id);
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
                 taRecommendCustomer.setVerifyStatus(verifyStatus);
658
                 taRecommendCustomer.setVerifyStatus(verifyStatus);
624
-                if(!StringUtils.isEmpty(verifyRemark)){
659
+                if (!StringUtils.isEmpty(verifyRemark)) {
625
                     taRecommendCustomer.setVerifyRemark(verifyRemark);
660
                     taRecommendCustomer.setVerifyRemark(verifyRemark);
626
 //                    if(CommConstant.CUSTOMER_REPORT.equals(taRecommendCustomer.getReportRecommendStatus())){
661
 //                    if(CommConstant.CUSTOMER_REPORT.equals(taRecommendCustomer.getReportRecommendStatus())){
627
 //                        taRecommendCustomer.setRealtyConsultant(taRecommendCustomer.getRecommendPerson());
662
 //                        taRecommendCustomer.setRealtyConsultant(taRecommendCustomer.getRecommendPerson());
644
                     }
679
                     }
645
                 }
680
                 }
646
 
681
 
647
-                if (taRecommendCustomerService.updateById(taRecommendCustomer)){
682
+                if (taRecommendCustomerService.updateById(taRecommendCustomer)) {
648
 
683
 
649
                     // 审核通过增加积分
684
                     // 审核通过增加积分
650
                     if (CommConstant.VERIFY_AGREE == verifyStatus) {
685
                     if (CommConstant.VERIFY_AGREE == verifyStatus) {
652
                     }
687
                     }
653
 
688
 
654
                     responseBean.addSuccess(taRecommendCustomer);
689
                     responseBean.addSuccess(taRecommendCustomer);
655
-                }else {
690
+                } else {
656
                     responseBean.addError("fail");
691
                     responseBean.addError("fail");
657
                 }
692
                 }
658
             } else {
693
             } else {
659
                 responseBean.addSuccess("客户已审核");
694
                 responseBean.addSuccess("客户已审核");
660
             }
695
             }
661
 
696
 
662
-        }catch (Exception e){
697
+        } catch (Exception e) {
663
             e.printStackTrace();
698
             e.printStackTrace();
664
             responseBean.addError(e.getMessage());
699
             responseBean.addError(e.getMessage());
665
         }
700
         }
676
         response.setCharacterEncoding("utf-8");
711
         response.setCharacterEncoding("utf-8");
677
         response.setHeader("Content-disposition", "attachment;filename=推荐客户.xlsx");
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
         Integer pageCode = 0;
716
         Integer pageCode = 0;
682
         Integer pageSize = 100;
717
         Integer pageSize = 100;
687
         // 设置 sheet, 同一个sheet只需要设置一次
722
         // 设置 sheet, 同一个sheet只需要设置一次
688
         WriteSheet writeSheet = EasyExcel.writerSheet("推荐客户").build();
723
         WriteSheet writeSheet = EasyExcel.writerSheet("推荐客户").build();
689
         do {
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
             excelWriter.write(recCustomerExport, writeSheet);
726
             excelWriter.write(recCustomerExport, writeSheet);
692
 
727
 
693
-            pageCode ++;
728
+            pageCode++;
694
         } while (pageCode <= pageCount);
729
         } while (pageCode <= pageCount);
695
 
730
 
696
         /// finish 会帮忙关闭流
731
         /// finish 会帮忙关闭流
705
     @GetMapping("/admin/customer/recommend/report/export")
740
     @GetMapping("/admin/customer/recommend/report/export")
706
     public void reportExport(HttpServletRequest request,
741
     public void reportExport(HttpServletRequest request,
707
                              HttpServletResponse response,
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
 //        response.setContentType("application/vnd.ms-excel");
751
 //        response.setContentType("application/vnd.ms-excel");
717
         response.setContentType("application/octet-stream");
752
         response.setContentType("application/octet-stream");
718
         response.setCharacterEncoding("utf-8");
753
         response.setCharacterEncoding("utf-8");
719
         response.setHeader("Content-disposition", "attachment;filename=报备客户.xlsx");
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
         Integer pageCode = 0;
758
         Integer pageCode = 0;
724
         Integer pageSize = 100;
759
         Integer pageSize = 100;
730
         WriteSheet writeSheet = EasyExcel.writerSheet("报备客户").build();
765
         WriteSheet writeSheet = EasyExcel.writerSheet("报备客户").build();
731
         List<ReporRecommendCustomer> recCustomerExport = null;
766
         List<ReporRecommendCustomer> recCustomerExport = null;
732
         do {
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
             excelWriter.write(recCustomerExport, writeSheet);
769
             excelWriter.write(recCustomerExport, writeSheet);
735
 
770
 
736
-            pageCode ++;
771
+            pageCode++;
737
         } while (pageCode <= pageCount);
772
         } while (pageCode <= pageCount);
738
 
773
 
739
         /// finish 会帮忙关闭流
774
         /// finish 会帮忙关闭流
766
             recCustomerExport = taRecommendCustomerService.getIndependentAgentsExport(getOrgId(request), pageCode * pageSize, pageSize);
801
             recCustomerExport = taRecommendCustomerService.getIndependentAgentsExport(getOrgId(request), pageCode * pageSize, pageSize);
767
             excelWriter.write(recCustomerExport, writeSheet);
802
             excelWriter.write(recCustomerExport, writeSheet);
768
 
803
 
769
-            pageCode ++;
804
+            pageCode++;
770
         } while (pageCode <= pageCount);
805
         } while (pageCode <= pageCount);
771
 
806
 
772
         /// finish 会帮忙关闭流
807
         /// finish 会帮忙关闭流
775
     }
810
     }
776
 
811
 
777
 
812
 
778
-
779
     // 客户列表 公客/私客
813
     // 客户列表 公客/私客
780
 
814
 
781
     /**
815
     /**
782
      * 导出数据 客户列表 公客/私客
816
      * 导出数据 客户列表 公客/私客
817
+     *
783
      * @param request
818
      * @param request
784
      * @param response
819
      * @param response
785
      * @param name
820
      * @param name
792
      * @param sex
827
      * @param sex
793
      * @param customerType
828
      * @param customerType
794
      * @param status
829
      * @param status
830
+     * @param belongStatus 是否归属项目 1是  0否
795
      * @throws IOException
831
      * @throws IOException
796
      */
832
      */
797
     @GetMapping("/admin/customer/recommend/export")
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
         //        response.setContentType("application/vnd.ms-excel");
849
         //        response.setContentType("application/vnd.ms-excel");
813
         response.setContentType("application/octet-stream");
850
         response.setContentType("application/octet-stream");
835
 //            pageCount = count % pageSize == 0 ? count / pageSize : (count / pageSize) + 1;
872
 //            pageCount = count % pageSize == 0 ? count / pageSize : (count / pageSize) + 1;
836
 //            List<PublicCustomerExport> publicList = null;
873
 //            List<PublicCustomerExport> publicList = null;
837
 //            do {
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
 //                pageCode ++;
878
 //                pageCode ++;
842
 //            } while (pageCode <= pageCount);
879
 //            } while (pageCode <= pageCount);
857
 //            pageCount = count % pageSize == 0 ? count / pageSize : (count / pageSize) + 1;
894
 //            pageCount = count % pageSize == 0 ? count / pageSize : (count / pageSize) + 1;
858
 //            List<PrivateCustomerExport> privateList = null;
895
 //            List<PrivateCustomerExport> privateList = null;
859
 //            do {
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
 //                pageCode ++;
900
 //                pageCode ++;
864
 //            } while (pageCode <= pageCount);
901
 //            } while (pageCode <= pageCount);
869
 
906
 
870
 
907
 
871
     }
908
     }
872
-    
909
+
873
     /**
910
     /**
874
      * 查询判客工具下的我的客户人数集合
911
      * 查询判客工具下的我的客户人数集合
912
+     *
875
      * @param request
913
      * @param request
876
      * @return
914
      * @return
877
      */
915
      */
881
         String openid = getOpenId(request);
919
         String openid = getOpenId(request);
882
         return taRecommendCustomerService.getMyCustStatistics(openid);
920
         return taRecommendCustomerService.getMyCustStatistics(openid);
883
     }
921
     }
884
-    
922
+
885
     /**
923
     /**
886
      * 分页查询判客工具下的我的客户跟进人集合
924
      * 分页查询判客工具下的我的客户跟进人集合
887
-     *  根据type区分  follow 跟进  clinch 成交
925
+     * 根据type区分  follow 跟进  clinch 成交
926
+     *
888
      * @param request
927
      * @param request
889
      * @return
928
      * @return
890
      */
929
      */
891
     @GetMapping("/wx/inventory/customer/statistics/{type}")
930
     @GetMapping("/wx/inventory/customer/statistics/{type}")
892
     @ApiOperation(value = "查询我的客户人数统计", notes = "查询我的客户人数统计")
931
     @ApiOperation(value = "查询我的客户人数统计", notes = "查询我的客户人数统计")
893
     public ResponseBean getMyCustFollows(@PathVariable(value = "type") String type,
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
                                          HttpServletRequest request) {
942
                                          HttpServletRequest request) {
904
         String openid = getOpenId(request);
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
      * @param request
950
      * @param request
911
      * @return
951
      * @return
912
      */
952
      */
913
     @GetMapping("/wx/inventory/customer/{customerId}")
953
     @GetMapping("/wx/inventory/customer/{customerId}")
914
     @ApiOperation(value = "查询客户详情", notes = "查询客户详情")
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
         String openid = getOpenId(request);
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
      * @param request
963
      * @param request
923
      * @return
964
      * @return
924
      */
965
      */
928
                                            @RequestBody TaRecommendCustomer taRecommendCustomer, HttpServletRequest request) {
969
                                            @RequestBody TaRecommendCustomer taRecommendCustomer, HttpServletRequest request) {
929
         String openid = getOpenId(request);
970
         String openid = getOpenId(request);
930
         taRecommendCustomer.setCustomerId(customerId);
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 View File

199
     @TableField(exist = false)
199
     @TableField(exist = false)
200
     private String avatarurl;
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 View File

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

+ 38
- 2
src/main/java/com/huiju/estateagents/mapper/TaRecommendCustomerMapper.java View File

49
      * @param personBuildingList
49
      * @param personBuildingList
50
      * @return
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
      * @param consultTel
133
      * @param consultTel
120
      * @return
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
                                                            @Param("startDate") LocalDateTime startDate,
225
                                                            @Param("startDate") LocalDateTime startDate,
200
                                                            @Param("endDate") LocalDateTime endDate,
226
                                                            @Param("endDate") LocalDateTime endDate,
201
                                                            @Param("personId") String personId);
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 View File

1
 package com.huiju.estateagents.service;
1
 package com.huiju.estateagents.service;
2
 
2
 
3
 import com.baomidou.mybatisplus.core.metadata.IPage;
3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.baomidou.mybatisplus.extension.service.IService;
4
 import com.huiju.estateagents.base.ResponseBean;
5
 import com.huiju.estateagents.base.ResponseBean;
5
 import com.huiju.estateagents.center.taUser.entity.TaUser;
6
 import com.huiju.estateagents.center.taUser.entity.TaUser;
6
 import com.huiju.estateagents.entity.TaPerson;
7
 import com.huiju.estateagents.entity.TaPerson;
7
 import com.huiju.estateagents.entity.TaPersonBuilding;
8
 import com.huiju.estateagents.entity.TaPersonBuilding;
8
 import com.huiju.estateagents.entity.TaRecommendCustomer;
9
 import com.huiju.estateagents.entity.TaRecommendCustomer;
9
-import com.baomidou.mybatisplus.extension.service.IService;
10
 import com.huiju.estateagents.excel.AgentsRecommendCustomer;
10
 import com.huiju.estateagents.excel.AgentsRecommendCustomer;
11
 import com.huiju.estateagents.excel.ExcelRecommendCustomer;
11
 import com.huiju.estateagents.excel.ExcelRecommendCustomer;
12
 import com.huiju.estateagents.excel.ReporRecommendCustomer;
12
 import com.huiju.estateagents.excel.ReporRecommendCustomer;
13
-import io.swagger.models.auth.In;
14
 
13
 
15
-import java.time.LocalDateTime;
16
 import java.util.List;
14
 import java.util.List;
17
 
15
 
18
 /**
16
 /**
31
 
29
 
32
     ResponseBean updateCustByJSON(String paramStr);
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
     TaRecommendCustomer getCustomerById(String customerId);
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
     TaRecommendCustomer newByPerson(TaPerson person);
58
     TaRecommendCustomer newByPerson(TaPerson person);
58
 
59
 
59
     ResponseBean consultantAssist(TaUser taUser, String personId, Integer orgId);
60
     ResponseBean consultantAssist(TaUser taUser, String personId, Integer orgId);
60
 
61
 
61
     ResponseBean batchConsultantAssist(TaUser taUser, Integer orgId);
62
     ResponseBean batchConsultantAssist(TaUser taUser, Integer orgId);
63
+
62
     /**
64
     /**
63
      * 导出数据(推荐客户)
65
      * 导出数据(推荐客户)
66
+     *
64
      * @param orgId
67
      * @param orgId
65
      * @return
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
      * @param orgId
75
      * @param orgId
72
      * @return
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
      * @param orgId
83
      * @param orgId
79
      * @return
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
      * @param orgId
91
      * @param orgId
86
      * @param pageCode
92
      * @param pageCode
87
      * @param pageSize
93
      * @param pageSize
88
      * @return
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
      * @param orgId
101
      * @param orgId
95
      * @return
102
      * @return
96
      */
103
      */
98
 
105
 
99
     /**
106
     /**
100
      * 导出数据(经纪人)
107
      * 导出数据(经纪人)
108
+     *
101
      * @param orgId
109
      * @param orgId
102
      * @param pageCode
110
      * @param pageCode
103
      * @param pageSize
111
      * @param pageSize
104
      * @return
112
      * @return
105
      */
113
      */
106
     List<AgentsRecommendCustomer> getIndependentAgentsExport(Integer orgId, Integer pageCode, Integer pageSize);
114
     List<AgentsRecommendCustomer> getIndependentAgentsExport(Integer orgId, Integer pageCode, Integer pageSize);
107
-    
115
+
108
     /**
116
     /**
109
      * 查询我的客户人数集合
117
      * 查询我的客户人数集合
118
+     *
110
      * @param openid
119
      * @param openid
111
      * @return
120
      * @return
112
      */
121
      */
113
     ResponseBean getMyCustStatistics(String openid);
122
     ResponseBean getMyCustStatistics(String openid);
114
-    
123
+
115
     /**
124
     /**
116
      * 分页查询我的跟进客户集合
125
      * 分页查询我的跟进客户集合
126
+     *
117
      * @param pageNumber
127
      * @param pageNumber
118
      * @param pageSize
128
      * @param pageSize
119
      * @param openid
129
      * @param openid
127
      * @return
137
      * @return
128
      */
138
      */
129
     ResponseBean getMyCustFollowOrClinch(Integer pageNumber, Integer pageSize, String openid, String type, String name, String phone, Integer status, String startReportDate, String endReportDate, String startArrivalDate, String endArrivalDate);
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
      * @param customerId
144
      * @param customerId
134
      * @param openid
145
      * @param openid
135
      * @return
146
      * @return
136
      */
147
      */
137
     ResponseBean getMyCustDetail(String customerId, String openid);
148
     ResponseBean getMyCustDetail(String customerId, String openid);
138
-    
149
+
139
     /**
150
     /**
140
      * 更新我的客户基本信息
151
      * 更新我的客户基本信息
152
+     *
141
      * @param taRecommendCustomer
153
      * @param taRecommendCustomer
142
      * @param openid
154
      * @param openid
143
      * @return
155
      * @return
146
 
158
 
147
     /**
159
     /**
148
      * 查询置业顾问的 归属客户
160
      * 查询置业顾问的 归属客户
161
+     *
149
      * @param openid
162
      * @param openid
150
      * @param keywords
163
      * @param keywords
151
      * @param pageNumber
164
      * @param pageNumber
154
      */
167
      */
155
     ResponseBean getAdminMyCustList(String openid, String keywords, int pageNumber, int pageSize);
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 View File

148
         return ResponseBean.success(result);
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
     @Override
166
     @Override
152
     public ResponseBean getCustDetail(String id) {
167
     public ResponseBean getCustDetail(String id) {
153
         TaRecommendCustomer taRecommendCustomer = taRecommendCustomerMapper.selectById(id);
168
         TaRecommendCustomer taRecommendCustomer = taRecommendCustomerMapper.selectById(id);
418
         // 首次报备的客户, 写入客户来源表
433
         // 首次报备的客户, 写入客户来源表
419
         TaCustomerFrom customerFrom = null;
434
         TaCustomerFrom customerFrom = null;
420
         if (!StringUtils.isEmpty(taRecommendCustomer.getBuildingId())) {
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
             boolean orgFirst = counter.get("orgCount").longValue() < 1;
437
             boolean orgFirst = counter.get("orgCount").longValue() < 1;
423
             boolean projectFirst = counter.get("projectCount").longValue() < 1;
438
             boolean projectFirst = counter.get("projectCount").longValue() < 1;
424
             if (projectFirst) {
439
             if (projectFirst) {
435
                 queryWrapper.eq("person_id", taRecommendCustomer.getPersonId());
450
                 queryWrapper.eq("person_id", taRecommendCustomer.getPersonId());
436
                 queryWrapper.eq("org_id", taRecommendCustomer.getOrgId());
451
                 queryWrapper.eq("org_id", taRecommendCustomer.getOrgId());
437
                 queryWrapper.eq("building_id", taRecommendCustomer.getBuildingId());
452
                 queryWrapper.eq("building_id", taRecommendCustomer.getBuildingId());
438
-                if (taCustomerFromMapper.selectList(queryWrapper).size() < 1){
453
+                if (taCustomerFromMapper.selectList(queryWrapper).size() < 1) {
439
                     customerFrom.setIsProjectFirst(true);
454
                     customerFrom.setIsProjectFirst(true);
440
                 }
455
                 }
441
                 customerFrom.setCreateDate(LocalDateTime.now());
456
                 customerFrom.setCreateDate(LocalDateTime.now());
543
     }
558
     }
544
 
559
 
545
     @Override
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
         if (CommConstant.CUTOMER_TYPE_PUBLIC.equals(customerType)) {
563
         if (CommConstant.CUTOMER_TYPE_PUBLIC.equals(customerType)) {
549
             // 公客
564
             // 公客
550
             IPage<TaPerson> page = new Page<>(pageNumber, pageSize);
565
             IPage<TaPerson> page = new Page<>(pageNumber, pageSize);
551
             // 公客就不用 buildingId 进行查询
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
         } else {
568
         } else {
554
             // 私客
569
             // 私客
555
             IPage<TaRecommendCustomer> page = new Page<>(pageNumber, pageSize);
570
             IPage<TaRecommendCustomer> page = new Page<>(pageNumber, pageSize);

+ 198
- 175
src/main/resources/mapper/TaRecommendCustomerMapper.xml View File

40
         FROM
40
         FROM
41
         ta_recommend_customer a
41
         ta_recommend_customer a
42
         LEFT JOIN ta_person c on a.recommend_person = c.person_id
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
         order by a.create_date desc
80
         order by a.create_date desc
81
     </select>
81
     </select>
82
 
82
 
83
     <select id="getIndependentAgents" resultType="com.huiju.estateagents.entity.TaPerson">
83
     <select id="getIndependentAgents" resultType="com.huiju.estateagents.entity.TaPerson">
84
         SELECT
84
         SELECT
85
-            a.*,
86
-            tc.channel_name as channelName
85
+        a.*,
86
+        tc.channel_name as channelName
87
         FROM
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
         <where>
91
         <where>
92
             a.person_type in ('estate agent', 'channel agent')
92
             a.person_type in ('estate agent', 'channel agent')
93
             and a.status >0
93
             and a.status >0
104
         </where>
104
         </where>
105
 
105
 
106
         ORDER BY
106
         ORDER BY
107
-            create_date DESC
107
+        create_date DESC
108
     </select>
108
     </select>
109
 
109
 
110
     <select id="getRepCustomerList" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
110
     <select id="getRepCustomerList" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
161
     <select id="getCustomerList" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
161
     <select id="getCustomerList" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
162
         SELECT
162
         SELECT
163
         a.*,
163
         a.*,
164
+        IFNULL( t2.building_name, '暂无' ) AS buildingName,
164
         a.customer_id as customerId,
165
         a.customer_id as customerId,
165
         IFNULL(b.name,d.user_name) as consultantName,
166
         IFNULL(b.name,d.user_name) as consultantName,
166
         IFNULL(b.tel,d.phone) as consultTel,
167
         IFNULL(b.tel,d.phone) as consultTel,
173
         LEFT JOIN ta_user d on d.user_id = a.realty_consultant
174
         LEFT JOIN ta_user d on d.user_id = a.realty_consultant
174
         LEFT JOIN ta_person_from_record p ON a.person_id = p.person_id AND p.is_first_time = 1
175
         LEFT JOIN ta_person_from_record p ON a.person_id = p.person_id AND p.is_first_time = 1
175
         <if test="orgId != null">
176
         <if test="orgId != null">
176
-            and p.org_id =  #{orgId}
177
+            and p.org_id = #{orgId}
177
         </if>
178
         </if>
178
         LEFT JOIN ta_person c on p.share_person_id = c.person_id
179
         LEFT JOIN ta_person c on p.share_person_id = c.person_id
179
         LEFT JOIN td_wx_dict w ON p.scene_id = w.scene_id
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
         <where>
182
         <where>
181
             a.status > 0
183
             a.status > 0
182
             and a.verify_status = 1
184
             and a.verify_status = 1
216
                 and a.create_Date >= #{startCreateDate}
218
                 and a.create_Date >= #{startCreateDate}
217
             </if>
219
             </if>
218
             <if test="endCreateDate != null and endCreateDate !=''">
220
             <if test="endCreateDate != null and endCreateDate !=''">
219
-                and a.create_Date  &lt;= #{endCreateDate}
221
+                and a.create_Date &lt;= #{endCreateDate}
220
             </if>
222
             </if>
221
             <if test="sharePersonName != null and sharePersonName !=''">
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
             </if>
226
             </if>
224
             <if test="personBuildingList != null and personBuildingList.size > 0">
227
             <if test="personBuildingList != null and personBuildingList.size > 0">
225
                 AND a.building_id in
228
                 AND a.building_id in
243
 	WHERE a.customer_id = #{customerId}
246
 	WHERE a.customer_id = #{customerId}
244
     </select>
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
         SELECT
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
         FROM
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
         <where>
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
             </if>
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
             </if>
270
             </if>
266
             <if test="tel != null and tel!=''">
271
             <if test="tel != null and tel!=''">
267
-                and b.phone like CONCAT('%',#{tel}, '%')
272
+                and t.phone like CONCAT('%',#{tel}, '%')
268
             </if>
273
             </if>
269
             <if test="entryType != null and entryType !=''">
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
             </if>
279
             </if>
272
             <if test="sex != null and sex !=''">
280
             <if test="sex != null and sex !=''">
273
-                and b.sex = #{sex}
281
+                and t.sex = #{sex}
274
             </if>
282
             </if>
275
             <if test="startCreateDate != null and startCreateDate !=''">
283
             <if test="startCreateDate != null and startCreateDate !=''">
276
-                and b.create_Date >= #{startCreateDate}
284
+                and t.create_Date >= #{startCreateDate}
277
             </if>
285
             </if>
278
             <if test="endCreateDate != null and endCreateDate !=''">
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
             </if>
288
             </if>
287
             <if test="sharePersonName != null and sharePersonName !=''">
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
             </if>
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
             <if test="personBuildingList != null and personBuildingList.size > 0">
293
             <if test="personBuildingList != null and personBuildingList.size > 0">
292
-                AND b.building_id in
294
+                AND t.building_id in
293
                 <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
295
                 <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
294
                     #{personBuilding.buildingId}
296
                     #{personBuilding.buildingId}
295
                 </foreach>
297
                 </foreach>
296
             </if>
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
         </where>
305
         </where>
298
-        group by b.person_id
299
-        order by b.create_date desc
306
+        order by t.create_date desc
300
     </select>
307
     </select>
301
 
308
 
302
     <select id="getRecCustomerExport" resultType="com.huiju.estateagents.excel.ExcelRecommendCustomer">
309
     <select id="getRecCustomerExport" resultType="com.huiju.estateagents.excel.ExcelRecommendCustomer">
308
         if(a.sex = 1, '男',if(a.sex = 2, '女', '未知')) as sex,
315
         if(a.sex = 1, '男',if(a.sex = 2, '女', '未知')) as sex,
309
         c.nickname as recommend,
316
         c.nickname as recommend,
310
         c.phone as recommendTel,
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
         FROM
320
         FROM
313
         ta_recommend_customer a
321
         ta_recommend_customer a
314
         LEFT JOIN ta_person c on a.recommend_person = c.person_id
322
         LEFT JOIN ta_person c on a.recommend_person = c.person_id
398
         order by a.create_date desc
406
         order by a.create_date desc
399
     </select>
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
         SELECT
410
         SELECT
403
         a.name as name,
411
         a.name as name,
404
         a.phone as phone,
412
         a.phone as phone,
454
     </select>
462
     </select>
455
 
463
 
456
 
464
 
457
-    <select id="getIndependentAgentsCount"  resultType="java.lang.Integer">
465
+    <select id="getIndependentAgentsCount" resultType="java.lang.Integer">
458
         SELECT
466
         SELECT
459
         count(*)
467
         count(*)
460
         FROM
468
         FROM
479
         a.phone as phone,
487
         a.phone as phone,
480
         if(a.gender = '1', '男', if(a.gender = '2', '女', '未知')) as gender,
488
         if(a.gender = '1', '男', if(a.gender = '2', '女', '未知')) as gender,
481
         if(ifnull(tc.channel_name, '') != '', '渠道经纪人', '独立经纪人') as personType,
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
         ) AS agentCount,
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
         ) AS recommedCount
508
         ) AS recommedCount
501
         FROM
509
         FROM
502
         ta_person a
510
         ta_person a
543
             <if test="consultTel != null and consultTel !=''">
551
             <if test="consultTel != null and consultTel !=''">
544
                 and b.tel like CONCAT('%',#{consultTel}, '%')
552
                 and b.tel like CONCAT('%',#{consultTel}, '%')
545
             </if>
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
         </where>
556
         </where>
548
         order by b.create_date desc
557
         order by b.create_date desc
549
     </select>
558
     </select>
550
 
559
 
551
     <select id="getPublicCustomerExportList" resultType="com.huiju.estateagents.excel.PublicCustomerExport">
560
     <select id="getPublicCustomerExportList" resultType="com.huiju.estateagents.excel.PublicCustomerExport">
552
         SELECT
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
         FROM
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
     </select>
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
         SELECT
621
         SELECT
613
-            count(1)
622
+        count(1)
614
         FROM
623
         FROM
615
         ta_recommend_customer a
624
         ta_recommend_customer a
616
         LEFT JOIN ta_person b ON a.realty_consultant = b.person_id
625
         LEFT JOIN ta_person b ON a.realty_consultant = b.person_id
689
         LEFT JOIN ta_person c ON p.share_person_id = c.person_id
698
         LEFT JOIN ta_person c ON p.share_person_id = c.person_id
690
         left join ta_building t on a.building_id = t.building_id
699
         left join ta_building t on a.building_id = t.building_id
691
         LEFT JOIN td_wx_dict w ON p.scene_id = w.scene_id
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
         <where>
705
         <where>
695
             a.status > 0
706
             a.status > 0
696
             and a.verify_status = 1
707
             and a.verify_status = 1
739
         group by a.customer_id,a.building_id
750
         group by a.customer_id,a.building_id
740
         order by a.create_date desc
751
         order by a.create_date desc
741
     </select>
752
     </select>
742
-<!--    limit #{pageCode}, #{pageSize}-->
753
+    <!--    limit #{pageCode}, #{pageSize}-->
743
 
754
 
744
     <select id="getMyCustStatistics" resultType="java.util.Map">
755
     <select id="getMyCustStatistics" resultType="java.util.Map">
745
         SELECT
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
         FROM
759
         FROM
749
-            ta_recommend_customer
760
+        ta_recommend_customer
750
         WHERE
761
         WHERE
751
-            org_id = #{orgId}
762
+        org_id = #{orgId}
752
         AND ( realty_consultant = #{personId}
763
         AND ( realty_consultant = #{personId}
753
         <if test="userId != null and userId != ''">
764
         <if test="userId != null and userId != ''">
754
             OR realty_consultant = #{userId}
765
             OR realty_consultant = #{userId}
758
 
769
 
759
     <select id="getMyCustFollowOrClinch" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
770
     <select id="getMyCustFollowOrClinch" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
760
         SELECT
771
         SELECT
761
-            *
772
+        *
762
         FROM
773
         FROM
763
-            ta_recommend_customer
774
+        ta_recommend_customer
764
         WHERE
775
         WHERE
765
-            org_id = #{orgId}
776
+        org_id = #{orgId}
766
         AND ( realty_consultant = #{personId} OR realty_consultant = #{userId} )
777
         AND ( realty_consultant = #{personId} OR realty_consultant = #{userId} )
767
         <if test="type == 'follow'">
778
         <if test="type == 'follow'">
768
-          AND STATUS != 4
769
-          AND verify_status = 1
779
+            AND STATUS != 4
780
+            AND verify_status = 1
770
             <if test="name != null and name !=''">
781
             <if test="name != null and name !=''">
771
                 and (`name` like CONCAT('%',#{name}, '%') or phone like CONCAT('%',#{name}, '%'))
782
                 and (`name` like CONCAT('%',#{name}, '%') or phone like CONCAT('%',#{name}, '%'))
772
             </if>
783
             </if>
790
             </if>
801
             </if>
791
         </if>
802
         </if>
792
         <if test="type == 'clinch'">
803
         <if test="type == 'clinch'">
793
-          AND STATUS = 4
804
+            AND STATUS = 4
794
         </if>
805
         </if>
795
     </select>
806
     </select>
796
 
807
 
804
 
815
 
805
     <select id="getCustomerIntentions" resultType="com.huiju.estateagents.entity.PersonIntention">
816
     <select id="getCustomerIntentions" resultType="com.huiju.estateagents.entity.PersonIntention">
806
         SELECT
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
         FROM
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
         WHERE
824
         WHERE
814
-           a.person_id = #{personId}
825
+        a.person_id = #{personId}
815
         <if test="personBuildingList != null and personBuildingList.size > 0">
826
         <if test="personBuildingList != null and personBuildingList.size > 0">
816
             AND a.building_id in
827
             AND a.building_id in
817
             <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
828
             <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
819
             </foreach>
830
             </foreach>
820
         </if>
831
         </if>
821
         GROUP BY
832
         GROUP BY
822
-            a.building_id
833
+        a.building_id
823
         ORDER BY
834
         ORDER BY
824
-            intention DESC
835
+        intention DESC
825
     </select>
836
     </select>
826
 
837
 
827
     <select id="getCustomersIRecommended" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
838
     <select id="getCustomersIRecommended" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
851
             and s.create_date BETWEEN #{startDate} and #{endDate}
862
             and s.create_date BETWEEN #{startDate} and #{endDate}
852
         </if>
863
         </if>
853
         <if test="buildingId != null and buildingId !=''">
864
         <if test="buildingId != null and buildingId !=''">
854
-        and s.building_id = #{buildingId}
865
+            and s.building_id = #{buildingId}
855
         </if>
866
         </if>
856
         and s.status &gt; 0
867
         and s.status &gt; 0
857
         order by s.report_date desc
868
         order by s.report_date desc
858
     </select>
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
 </mapper>
884
 </mapper>

+ 11
- 2
src/main/resources/mapper/TaUserMapper.xml View File

62
     <select id="seleUserList" resultType="com.huiju.estateagents.center.taUser.entity.TaUser">
62
     <select id="seleUserList" resultType="com.huiju.estateagents.center.taUser.entity.TaUser">
63
         SELECT
63
         SELECT
64
             t.*,
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
         FROM
68
         FROM
67
             ta_user t
69
             ta_user t
68
             LEFT JOIN ta_person_building b ON t.user_id = b.user_id
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
         WHERE
72
         WHERE
70
             t.org_id = #{taUser.orgId} AND (t.is_admin != 1 or t.is_admin is null)
73
             t.org_id = #{taUser.orgId} AND (t.is_admin != 1 or t.is_admin is null)
71
             <if test="taUser.userName != null and taUser.userName != ''">
74
             <if test="taUser.userName != null and taUser.userName != ''">
77
             <if test="taUser.status != null and taUser.status != ''">
80
             <if test="taUser.status != null and taUser.status != ''">
78
                 and t.status = #{taUser.status}
81
                 and t.status = #{taUser.status}
79
             </if>
82
             </if>
80
-            <if test="taUser.isConsultant != null and taUser.isConsultant != '' or taUser.isConsultant ==0">
83
+            <if test="taUser.isConsultant == 0">
81
                 and t.is_consultant = #{taUser.isConsultant}
84
                 and t.is_consultant = #{taUser.isConsultant}
82
             </if>
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
             <if test="taUser.buildingId != null and taUser.buildingId != ''">
92
             <if test="taUser.buildingId != null and taUser.buildingId != ''">
84
                 and b.building_id = #{taUser.buildingId}
93
                 and b.building_id = #{taUser.buildingId}
85
             </if>
94
             </if>