|
@@ -852,6 +852,8 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
|
852
|
852
|
logger.info("公客分配置业顾问 接收参数,taUser={},customerId={},orgId={}",
|
853
|
853
|
JSONObject.toJSONString(taUser), customerId, orgId);
|
854
|
854
|
|
|
855
|
+ ResponseBean responseBean = new ResponseBean();
|
|
856
|
+
|
855
|
857
|
// 1.校验置业顾问
|
856
|
858
|
QueryWrapper<TaUser> queryWrapper = new QueryWrapper();
|
857
|
859
|
queryWrapper.eq("user_id", taUser.getUserId());
|
|
@@ -862,7 +864,8 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
|
862
|
864
|
TaPersonBuilding taPersonBuilding = taPersonBuildingMapper.selectOne(taPersonBuildingQueryWrapper);
|
863
|
865
|
|
864
|
866
|
if (null == userInfo || CommConstant.STATUS_NORMAL != userInfo.getStatus()) {
|
865
|
|
- return ResponseBean.error("置业顾问不存在或已被注销", ResponseBean.ERROR_UNAVAILABLE);
|
|
867
|
+ responseBean.addError("置业顾问不存在或已被注销");
|
|
868
|
+ return responseBean;
|
866
|
869
|
}
|
867
|
870
|
|
868
|
871
|
// 2.根据customerId获取personId
|
|
@@ -872,14 +875,16 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
|
872
|
875
|
TaRecommendCustomer customerInfo = taRecommendCustomerMapper.selectOne(customerQueryWrapper);
|
873
|
876
|
if (customerInfo == null) {
|
874
|
877
|
logger.info("公客分配置业顾问 customerInfo为空");
|
875
|
|
- return ResponseBean.error("分配客户失败", ResponseBean.ERROR_UNAVAILABLE);
|
|
878
|
+ responseBean.addError("分配客户失败");
|
|
879
|
+ return responseBean;
|
876
|
880
|
}
|
877
|
881
|
|
878
|
882
|
// 3.判断是否有buildingId,有则直接更新数据
|
879
|
883
|
if (!StringUtils.isEmpty(customerInfo.getBuildingId())) {
|
880
|
884
|
logger.info("公客分配置业顾问 customer={}", JSONObject.toJSONString(customerInfo));
|
881
|
885
|
customerInfo.setRealtyConsultant(userInfo.getUserId().toString());
|
882
|
|
- return ResponseBean.success(taRecommendCustomerMapper.updateById(customerInfo));
|
|
886
|
+ responseBean.addSuccess(taRecommendCustomerMapper.updateById(customerInfo));
|
|
887
|
+ return responseBean;
|
883
|
888
|
}
|
884
|
889
|
|
885
|
890
|
// 4.校验公客是否已经是分配项目下的私客
|
|
@@ -892,15 +897,17 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
|
892
|
897
|
customerQueryWrapper2.isNotNull("realty_consultant");
|
893
|
898
|
TaRecommendCustomer customerInfo2 = taRecommendCustomerMapper.selectOne(customerQueryWrapper2);
|
894
|
899
|
if (customerInfo2 != null) {
|
895
|
|
- logger.info("公客分配置业顾问 customerInfo2为空");
|
896
|
|
- return ResponseBean.error("分配客户失败", ResponseBean.ERROR_UNAVAILABLE);
|
|
900
|
+ logger.info("客户已在当前项目私客中,可以继续分配给其他项目");
|
|
901
|
+ responseBean.addError("分配客户失败");
|
|
902
|
+ return responseBean;
|
897
|
903
|
}
|
898
|
904
|
|
899
|
905
|
// 5.无buildingId,新增一条私客数据
|
900
|
906
|
TaPerson taPerson = taPersonMapper.getById(customerInfo.getPersonId());
|
901
|
907
|
if (taPerson == null) {
|
902
|
908
|
logger.info("公客分配置业顾问 taPerson为空");
|
903
|
|
- return ResponseBean.error("分配客户失败", ResponseBean.ERROR_UNAVAILABLE);
|
|
909
|
+ responseBean.addError("分配客户失败");
|
|
910
|
+ return responseBean;
|
904
|
911
|
}
|
905
|
912
|
|
906
|
913
|
TaRecommendCustomer taRecommendCustomer = new TaRecommendCustomer();
|
|
@@ -925,9 +932,11 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
|
925
|
932
|
|
926
|
933
|
int row = taRecommendCustomerMapper.insert(taRecommendCustomer);
|
927
|
934
|
if (row < 1) {
|
928
|
|
- return ResponseBean.error("分配客户失败", ResponseBean.ERROR_UNAVAILABLE);
|
|
935
|
+ responseBean.addError("分配客户失败");
|
|
936
|
+ return responseBean;
|
929
|
937
|
}
|
930
|
|
- return ResponseBean.success(taRecommendCustomer);
|
|
938
|
+ responseBean.addSuccess(taRecommendCustomer);
|
|
939
|
+ return responseBean;
|
931
|
940
|
}
|
932
|
941
|
|
933
|
942
|
private List<TaRecommendCustomer> getCustomerByPhone(String phone, Integer orgId) {
|