顾绍勇 5 лет назад
Родитель
Сommit
47bceaa777

+ 0
- 1
src/main/java/com/huiju/estateagents/controller/TaRecommendCustomerController.java Просмотреть файл

@@ -458,7 +458,6 @@ public class TaRecommendCustomerController extends BaseController {
458 458
         try {
459 459
             Integer orgId = getOrgId(request);
460 460
             return taRecommendCustomerService.batchConsultantAssist(taUser, orgId);
461
-
462 461
         } catch (Exception e) {
463 462
             e.printStackTrace();
464 463
             return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);

+ 13
- 5
src/main/java/com/huiju/estateagents/service/impl/TaRecommendCustomerServiceImpl.java Просмотреть файл

@@ -1,5 +1,6 @@
1 1
 package com.huiju.estateagents.service.impl;
2 2
 
3
+import com.alibaba.fastjson.JSON;
3 4
 import com.alibaba.fastjson.JSONObject;
4 5
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5 6
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@@ -508,9 +509,9 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
508 509
                 }
509 510
             }
510 511
             TaRecommendCustomer oldRecomendCustomer = result.get(0);
511
-            if (!StringUtils.isEmpty(oldRecomendCustomer.getRealtyConsultant())){
512
+            if (!StringUtils.isEmpty(oldRecomendCustomer.getRealtyConsultant())) {
512 513
                 return ResponseBean.error("您在当前项目的置业顾问是:" + conName, ResponseBean.ERROR_ILLEGAL_PARAMS);
513
-            }else {
514
+            } else {
514 515
                 oldRecomendCustomer.setRealtyConsultant(consultantUser.getUserId().toString());
515 516
                 taRecommendCustomerMapper.updateById(oldRecomendCustomer);
516 517
                 if (null != customerFrom) {
@@ -839,12 +840,19 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
839 840
 
840 841
     @Override
841 842
     public ResponseBean batchConsultantAssist(TaUser taUser, Integer orgId) {
843
+        Integer failNum = 0;
842 844
         if (CollectionUtils.isNotEmpty(taUser.getCustomerIds())) {
843 845
             for (TaRecommendCustomer taRecommendCustomer : taUser.getCustomerIds()) {
844
-                consultantAssist(taUser, taRecommendCustomer.getCustomerId(), orgId);
846
+                ResponseBean responseBean = consultantAssist(taUser, taRecommendCustomer.getCustomerId(), orgId);
847
+                if (responseBean.getCode() != 1000) {
848
+                    failNum++;
849
+                }
845 850
             }
846 851
         }
847
-        return ResponseBean.success("操作成功");
852
+        JSONObject obj = new JSONObject();
853
+        obj.put("failNum", failNum);
854
+        obj.put("totalNum", taUser.getCustomerIds().size());
855
+        return ResponseBean.success(obj);
848 856
     }
849 857
 
850 858
     @Override
@@ -898,7 +906,7 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
898 906
         TaRecommendCustomer customerInfo2 = taRecommendCustomerMapper.selectOne(customerQueryWrapper2);
899 907
         if (customerInfo2 != null) {
900 908
             logger.info("客户已在当前项目私客中,可以继续分配给其他项目");
901
-            responseBean.addError("分配客户失败");
909
+            responseBean.addError("客户已在当前项目私客中,可以继续分配给其他项目");
902 910
             return responseBean;
903 911
         }
904 912