浏览代码

* bug fix

顾绍勇 5 年前
父节点
当前提交
e89d4fb52a

+ 3
- 4
src/main/java/com/huiju/estateagents/controller/TaRecommendCustomerController.java 查看文件

440
     public ResponseBean assistConsultant(@RequestBody TaUser taUser, @PathVariable String personId, HttpServletRequest request) {
440
     public ResponseBean assistConsultant(@RequestBody TaUser taUser, @PathVariable String personId, HttpServletRequest request) {
441
         try {
441
         try {
442
             Integer orgId = getOrgId(request);
442
             Integer orgId = getOrgId(request);
443
-            taRecommendCustomerService.consultantAssist(taUser, personId, orgId);
444
-            return ResponseBean.success("");
443
+            return taRecommendCustomerService.consultantAssist(taUser, personId, orgId);
445
         } catch (Exception e) {
444
         } catch (Exception e) {
446
             e.printStackTrace();
445
             e.printStackTrace();
447
             return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
446
             return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
458
         }
457
         }
459
         try {
458
         try {
460
             Integer orgId = getOrgId(request);
459
             Integer orgId = getOrgId(request);
461
-            taRecommendCustomerService.batchConsultantAssist(taUser, orgId);
462
-            return ResponseBean.success("");
460
+            return taRecommendCustomerService.batchConsultantAssist(taUser, orgId);
461
+
463
         } catch (Exception e) {
462
         } catch (Exception e) {
464
             e.printStackTrace();
463
             e.printStackTrace();
465
             return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
464
             return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);

+ 17
- 8
src/main/java/com/huiju/estateagents/service/impl/TaRecommendCustomerServiceImpl.java 查看文件

852
         logger.info("公客分配置业顾问 接收参数,taUser={},customerId={},orgId={}",
852
         logger.info("公客分配置业顾问 接收参数,taUser={},customerId={},orgId={}",
853
                 JSONObject.toJSONString(taUser), customerId, orgId);
853
                 JSONObject.toJSONString(taUser), customerId, orgId);
854
 
854
 
855
+        ResponseBean responseBean = new ResponseBean();
856
+
855
         // 1.校验置业顾问
857
         // 1.校验置业顾问
856
         QueryWrapper<TaUser> queryWrapper = new QueryWrapper();
858
         QueryWrapper<TaUser> queryWrapper = new QueryWrapper();
857
         queryWrapper.eq("user_id", taUser.getUserId());
859
         queryWrapper.eq("user_id", taUser.getUserId());
862
         TaPersonBuilding taPersonBuilding = taPersonBuildingMapper.selectOne(taPersonBuildingQueryWrapper);
864
         TaPersonBuilding taPersonBuilding = taPersonBuildingMapper.selectOne(taPersonBuildingQueryWrapper);
863
 
865
 
864
         if (null == userInfo || CommConstant.STATUS_NORMAL != userInfo.getStatus()) {
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
         // 2.根据customerId获取personId
871
         // 2.根据customerId获取personId
872
         TaRecommendCustomer customerInfo = taRecommendCustomerMapper.selectOne(customerQueryWrapper);
875
         TaRecommendCustomer customerInfo = taRecommendCustomerMapper.selectOne(customerQueryWrapper);
873
         if (customerInfo == null) {
876
         if (customerInfo == null) {
874
             logger.info("公客分配置业顾问 customerInfo为空");
877
             logger.info("公客分配置业顾问 customerInfo为空");
875
-            return ResponseBean.error("分配客户失败", ResponseBean.ERROR_UNAVAILABLE);
878
+            responseBean.addError("分配客户失败");
879
+            return responseBean;
876
         }
880
         }
877
 
881
 
878
         // 3.判断是否有buildingId,有则直接更新数据
882
         // 3.判断是否有buildingId,有则直接更新数据
879
         if (!StringUtils.isEmpty(customerInfo.getBuildingId())) {
883
         if (!StringUtils.isEmpty(customerInfo.getBuildingId())) {
880
             logger.info("公客分配置业顾问 customer={}", JSONObject.toJSONString(customerInfo));
884
             logger.info("公客分配置业顾问 customer={}", JSONObject.toJSONString(customerInfo));
881
             customerInfo.setRealtyConsultant(userInfo.getUserId().toString());
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
         // 4.校验公客是否已经是分配项目下的私客
890
         // 4.校验公客是否已经是分配项目下的私客
892
         customerQueryWrapper2.isNotNull("realty_consultant");
897
         customerQueryWrapper2.isNotNull("realty_consultant");
893
         TaRecommendCustomer customerInfo2 = taRecommendCustomerMapper.selectOne(customerQueryWrapper2);
898
         TaRecommendCustomer customerInfo2 = taRecommendCustomerMapper.selectOne(customerQueryWrapper2);
894
         if (customerInfo2 != null) {
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
         // 5.无buildingId,新增一条私客数据
905
         // 5.无buildingId,新增一条私客数据
900
         TaPerson taPerson = taPersonMapper.getById(customerInfo.getPersonId());
906
         TaPerson taPerson = taPersonMapper.getById(customerInfo.getPersonId());
901
         if (taPerson == null) {
907
         if (taPerson == null) {
902
             logger.info("公客分配置业顾问 taPerson为空");
908
             logger.info("公客分配置业顾问 taPerson为空");
903
-            return ResponseBean.error("分配客户失败", ResponseBean.ERROR_UNAVAILABLE);
909
+            responseBean.addError("分配客户失败");
910
+            return responseBean;
904
         }
911
         }
905
 
912
 
906
         TaRecommendCustomer taRecommendCustomer = new TaRecommendCustomer();
913
         TaRecommendCustomer taRecommendCustomer = new TaRecommendCustomer();
925
 
932
 
926
         int row = taRecommendCustomerMapper.insert(taRecommendCustomer);
933
         int row = taRecommendCustomerMapper.insert(taRecommendCustomer);
927
         if (row < 1) {
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
     private List<TaRecommendCustomer> getCustomerByPhone(String phone, Integer orgId) {
942
     private List<TaRecommendCustomer> getCustomerByPhone(String phone, Integer orgId) {