|
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
7
|
7
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
8
|
8
|
import com.huiju.estateagents.base.ResponseBean;
|
9
|
9
|
import com.huiju.estateagents.center.taUser.entity.TaUser;
|
|
10
|
+import com.huiju.estateagents.center.taUser.mapper.TaUserMapper;
|
10
|
11
|
import com.huiju.estateagents.center.taUser.service.ITaUserService;
|
11
|
12
|
import com.huiju.estateagents.common.CommConstant;
|
12
|
13
|
import com.huiju.estateagents.common.DateUtils;
|
|
@@ -84,6 +85,9 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
|
84
|
85
|
@Autowired
|
85
|
86
|
private TaDrainageMapper taDrainageMapper;
|
86
|
87
|
|
|
88
|
+ @Autowired
|
|
89
|
+ private TaUserMapper taUserMapper;
|
|
90
|
+
|
87
|
91
|
@Override
|
88
|
92
|
public ResponseBean getMyCustList(String openid, String keywords, int pageNumber, int pageSize) {
|
89
|
93
|
List<TaPerson> taPersons = getPersonsByOpenId(openid);
|
|
@@ -309,6 +313,31 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
|
309
|
313
|
// return ResponseBean.error(checkResult, ResponseBean.ERROR_MISSING_PARAMS);
|
310
|
314
|
// }
|
311
|
315
|
|
|
316
|
+ if (StringUtils.isEmpty(params.getString("realtyConsultant"))) {
|
|
317
|
+ return ResponseBean.error("置业顾问不能为空", ResponseBean.ERROR_ILLEGAL_PARAMS);
|
|
318
|
+ }
|
|
319
|
+
|
|
320
|
+ // 查找置业顾问对应的 TaPerson 及 TaUser
|
|
321
|
+ TaPerson consultantPerson = taPersonMapper.selectById(params.getString("realtyConsultant"));
|
|
322
|
+ TaUser consultantUser = null;
|
|
323
|
+ if (null == consultantPerson) {
|
|
324
|
+ consultantUser = taUserMapper.selectById(params.getString("realtyConsultant"));
|
|
325
|
+ if (null != consultantUser && null != consultantUser.getUserId() && consultantUser.getUserId() > 0) {
|
|
326
|
+ QueryWrapper<TaPerson> query = new QueryWrapper<>();
|
|
327
|
+ query.eq("org_id", consultantUser.getOrgId());
|
|
328
|
+ query.eq("user_id", consultantUser.getUserId());
|
|
329
|
+ query.last("limit 1");
|
|
330
|
+ consultantPerson = taPersonMapper.selectOne(query);
|
|
331
|
+ }
|
|
332
|
+ } else {
|
|
333
|
+ consultantUser = taUserMapper.selectById(params.getString("realtyConsultant"));
|
|
334
|
+ }
|
|
335
|
+
|
|
336
|
+ if (null == consultantUser || consultantUser.getStatus() != CommConstant.STATUS_NORMAL) {
|
|
337
|
+ return ResponseBean.error("置业顾问不存在或已被注销", ResponseBean.ERROR_UNAVAILABLE);
|
|
338
|
+ }
|
|
339
|
+
|
|
340
|
+
|
312
|
341
|
TaRecommendCustomer taRecommendCustomer = new TaRecommendCustomer();
|
313
|
342
|
taRecommendCustomer.setOrgId(orgId);
|
314
|
343
|
taRecommendCustomer.setName(taPerson.getNickname());
|
|
@@ -316,7 +345,7 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
|
316
|
345
|
taRecommendCustomer.setPhone(params.getString("phone"));
|
317
|
346
|
taRecommendCustomer.setSex(null == taPerson.getGender() ? null : ("1".equals(taPerson.getGender()) ? 1 : 2));
|
318
|
347
|
// taRecommendCustomer.setDescribe(params.getString("describe"));
|
319
|
|
- taRecommendCustomer.setRealtyConsultant(params.getString("realtyConsultant"));
|
|
348
|
+ taRecommendCustomer.setRealtyConsultant(consultantUser.getUserId().toString());
|
320
|
349
|
//如果没有传building_id的情况构造building_id
|
321
|
350
|
if (StringUtils.isEmpty(params.getString("buildingId")) && !StringUtils.isEmpty(params.getString("realtyConsultant"))){
|
322
|
351
|
QueryWrapper<TaPersonBuilding> taPersonBuildingQueryWrapper = new QueryWrapper<>();
|
|
@@ -377,14 +406,14 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
|
377
|
406
|
String conName = "";
|
378
|
407
|
TaPerson conPerson = taPersonMapper.selectById(result.get(0).getRealtyConsultant());
|
379
|
408
|
if (null != conPerson){
|
380
|
|
- if(params.getString("realtyConsultant").equals(conPerson.getPersonId())){
|
|
409
|
+ if(null != consultantPerson && consultantPerson.getPersonId().equals(conPerson.getPersonId())){
|
381
|
410
|
return ResponseBean.success("bound");
|
382
|
411
|
}
|
383
|
412
|
conName = conPerson.getName();
|
384
|
413
|
}else {
|
385
|
414
|
TaUser conUser = userService.getById(result.get(0).getRealtyConsultant());
|
386
|
415
|
if(null != conUser){
|
387
|
|
- if(params.getString("realtyConsultant").equals(conUser.getUserId().toString())){
|
|
416
|
+ if(consultantUser.getUserId().equals(conUser.getUserId())){
|
388
|
417
|
return ResponseBean.success("bound");
|
389
|
418
|
}
|
390
|
419
|
conName = conUser.getUserName();
|