|
@@ -160,7 +160,7 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
|
160
|
160
|
*/
|
161
|
161
|
@Override
|
162
|
162
|
public List<TaRecommendCustomer> getConsultantCustomerList(Integer userId, String personId, String buildingId, Integer orgId, List<TaPersonBuilding> taPersonBuildingListByUserId) {
|
163
|
|
- return taRecommendCustomerMapper.getConsultantCustomerList(userId,personId,buildingId,orgId);
|
|
163
|
+ return taRecommendCustomerMapper.getConsultantCustomerList(userId, personId, buildingId, orgId);
|
164
|
164
|
}
|
165
|
165
|
|
166
|
166
|
@Override
|
|
@@ -833,11 +833,9 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
|
833
|
833
|
}
|
834
|
834
|
|
835
|
835
|
@Override
|
836
|
|
- public ResponseBean consultantAssist(TaUser taUser, String personId, Integer orgId) {
|
837
|
|
- TaPerson taPerson = taPersonMapper.getById(personId);
|
838
|
|
-
|
839
|
|
- TaPerson recommendPerson = taPersonMapper.selectById(personId);
|
|
836
|
+ public ResponseBean consultantAssist(TaUser taUser, String customerId, Integer orgId) {
|
840
|
837
|
|
|
838
|
+ // 1.校验置业顾问
|
841
|
839
|
QueryWrapper<TaUser> queryWrapper = new QueryWrapper();
|
842
|
840
|
queryWrapper.eq("user_id", taUser.getUserId());
|
843
|
841
|
TaUser userInfo = taUserMapper.selectOne(queryWrapper);
|
|
@@ -846,10 +844,29 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
|
846
|
844
|
taPersonBuildingQueryWrapper.eq("user_id", taUser.getUserId());
|
847
|
845
|
TaPersonBuilding taPersonBuilding = taPersonBuildingMapper.selectOne(taPersonBuildingQueryWrapper);
|
848
|
846
|
|
849
|
|
- if (null == userInfo || userInfo.getStatus() != CommConstant.STATUS_NORMAL) {
|
|
847
|
+ if (null == userInfo || CommConstant.STATUS_NORMAL != userInfo.getStatus() ) {
|
850
|
848
|
return ResponseBean.error("置业顾问不存在或已被注销", ResponseBean.ERROR_UNAVAILABLE);
|
851
|
849
|
}
|
852
|
850
|
|
|
851
|
+ // 2.根据customerId获取personId
|
|
852
|
+ TaRecommendCustomer recommendCustomerInfo = taRecommendCustomerMapper.selectById(customerId);
|
|
853
|
+ if(recommendCustomerInfo == null){
|
|
854
|
+ return ResponseBean.error("分配客户失败",ResponseBean.ERROR_UNAVAILABLE);
|
|
855
|
+ }
|
|
856
|
+
|
|
857
|
+ // 3.判断是否有buildingId,有则直接更新数据
|
|
858
|
+ if(!StringUtils.isEmpty(recommendCustomerInfo.getBuildingId()) && StringUtils.isEmpty(recommendCustomerInfo.getRealtyConsultant())){
|
|
859
|
+ log.error("公客添加置业顾问 customer:" + JSONObject.toJSONString(recommendCustomerInfo));
|
|
860
|
+ recommendCustomerInfo.setRealtyConsultant(userInfo.getUserId().toString());
|
|
861
|
+ return ResponseBean.success(taRecommendCustomerMapper.updateById(recommendCustomerInfo));
|
|
862
|
+ }
|
|
863
|
+
|
|
864
|
+ // 4.无buildingId,新增一条私客数据
|
|
865
|
+ TaPerson taPerson = taPersonMapper.getById(recommendCustomerInfo.getPersonId());
|
|
866
|
+ if(taPerson == null){
|
|
867
|
+ return ResponseBean.error("分配客户失败",ResponseBean.ERROR_UNAVAILABLE);
|
|
868
|
+ }
|
|
869
|
+
|
853
|
870
|
TaRecommendCustomer taRecommendCustomer = new TaRecommendCustomer();
|
854
|
871
|
taRecommendCustomer.setOrgId(orgId);
|
855
|
872
|
taRecommendCustomer.setName(taPerson.getNickname());
|
|
@@ -867,16 +884,14 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
|
867
|
884
|
taRecommendCustomer.setEntryType(CommConstant.ENTRY_VERIFY);
|
868
|
885
|
taRecommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
|
869
|
886
|
taRecommendCustomer.setStatus(CommConstant.CUSTOMER_REPORT);
|
870
|
|
- taRecommendCustomer.setPersonId(personId);
|
871
|
|
- taRecommendCustomer.setRecommendPerson(recommendPerson == null ? "" : recommendPerson.getRecommendPerson());
|
|
887
|
+ taRecommendCustomer.setPersonId(taPerson.getPersonId());
|
|
888
|
+ taRecommendCustomer.setRecommendPerson(taPerson.getRecommendPerson());
|
872
|
889
|
|
873
|
890
|
int row = taRecommendCustomerMapper.insert(taRecommendCustomer);
|
874
|
891
|
if (row < 1) {
|
875
|
892
|
return ResponseBean.error("分配客户失败", ResponseBean.ERROR_UNAVAILABLE);
|
876
|
893
|
}
|
877
|
|
-
|
878
|
894
|
return ResponseBean.success(taRecommendCustomer);
|
879
|
|
-
|
880
|
895
|
}
|
881
|
896
|
|
882
|
897
|
private List<TaRecommendCustomer> getCustomerByPhone(String phone, Integer orgId) {
|