|
@@ -1,6 +1,7 @@
|
1
|
1
|
package com.huiju.estateagents.center.taUser.service.impl;
|
2
|
2
|
|
3
|
3
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
4
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
4
|
5
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
5
|
6
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
6
|
7
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -19,6 +20,7 @@ import com.huiju.estateagents.common.StringUtils;
|
19
|
20
|
import com.huiju.estateagents.entity.*;
|
20
|
21
|
import com.huiju.estateagents.mapper.*;
|
21
|
22
|
import com.huiju.estateagents.service.ITaBuildingReportService;
|
|
23
|
+import com.huiju.estateagents.service.ITaPersonService;
|
22
|
24
|
import com.huiju.estateagents.service.ITdReportService;
|
23
|
25
|
import org.apache.commons.collections.CollectionUtils;
|
24
|
26
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -79,6 +81,9 @@ public class TaUserServiceImpl extends ServiceImpl<TaUserMapper, TaUser> impleme
|
79
|
81
|
|
80
|
82
|
@Autowired
|
81
|
83
|
private TaOrgCityMapper taOrgCityMapper;
|
|
84
|
+
|
|
85
|
+ @Autowired
|
|
86
|
+ private ITaPersonService iTaPersonService;
|
82
|
87
|
|
83
|
88
|
@Override
|
84
|
89
|
public IPage<Map<String,Object>> getPageList(IPage pg) {
|
|
@@ -455,4 +460,52 @@ public class TaUserServiceImpl extends ServiceImpl<TaUserMapper, TaUser> impleme
|
455
|
460
|
responseBean.addSuccess(taUser);
|
456
|
461
|
return responseBean;
|
457
|
462
|
}
|
|
463
|
+
|
|
464
|
+ @Override
|
|
465
|
+ public ResponseBean departureUser(Integer userId) {
|
|
466
|
+ ResponseBean responseBean = new ResponseBean();
|
|
467
|
+ TaUser user = this.getById(userId);
|
|
468
|
+ if (null == user) {
|
|
469
|
+ responseBean.addError("此员工不存在!");
|
|
470
|
+ return responseBean;
|
|
471
|
+ }
|
|
472
|
+
|
|
473
|
+ // 不是置业顾问
|
|
474
|
+ if (user.getIsConsultant() == false) {
|
|
475
|
+ // 设置员工离职
|
|
476
|
+ updateUserStatus(user);
|
|
477
|
+ return ResponseBean.success("操作成功!");
|
|
478
|
+ }
|
|
479
|
+ /**
|
|
480
|
+ * 是置业顾问
|
|
481
|
+ */
|
|
482
|
+
|
|
483
|
+ // 更改员工表的用户类型,清空关联关系user_id
|
|
484
|
+
|
|
485
|
+ // 设置员工离职
|
|
486
|
+ updateUserStatus(user);
|
|
487
|
+
|
|
488
|
+ QueryWrapper<TaPerson> taPersonQueryWrapper = new QueryWrapper<>();
|
|
489
|
+ taPersonQueryWrapper.eq("user_id", user.getUserId());
|
|
490
|
+ TaPerson taPerson = taPersonMapper.selectOne(taPersonQueryWrapper);
|
|
491
|
+ // 可能存在置业顾问没有绑定小程序端
|
|
492
|
+ if (null != taPerson) {
|
|
493
|
+ UpdateWrapper<TaPerson> personUpdateWrapper = new UpdateWrapper<>();
|
|
494
|
+ personUpdateWrapper.eq("person_id", taPerson.getPersonId());
|
|
495
|
+ personUpdateWrapper.set("person_type", CommConstant.PERSON_ESTATE_CUSTOMER);
|
|
496
|
+ personUpdateWrapper.set("user_id", null);
|
|
497
|
+ iTaPersonService.update(personUpdateWrapper);
|
|
498
|
+ }
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+ return ResponseBean.success("操作成功!");
|
|
502
|
+ }
|
|
503
|
+
|
|
504
|
+ private boolean updateUserStatus(TaUser user) {
|
|
505
|
+ user.setStatus(-1);
|
|
506
|
+ UpdateWrapper<TaUser> updateWrapper = new UpdateWrapper<>();
|
|
507
|
+ updateWrapper.eq("user_id", user.getUserId());
|
|
508
|
+ updateWrapper.set("status", -1);
|
|
509
|
+ return this.update(updateWrapper);
|
|
510
|
+ }
|
458
|
511
|
}
|