Browse Source

* bug fix

顾绍勇 5 years ago
parent
commit
47bceaa777

+ 0
- 1
src/main/java/com/huiju/estateagents/controller/TaRecommendCustomerController.java View File

458
         try {
458
         try {
459
             Integer orgId = getOrgId(request);
459
             Integer orgId = getOrgId(request);
460
             return taRecommendCustomerService.batchConsultantAssist(taUser, orgId);
460
             return taRecommendCustomerService.batchConsultantAssist(taUser, orgId);
461
-
462
         } catch (Exception e) {
461
         } catch (Exception e) {
463
             e.printStackTrace();
462
             e.printStackTrace();
464
             return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
463
             return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);

+ 13
- 5
src/main/java/com/huiju/estateagents/service/impl/TaRecommendCustomerServiceImpl.java View File

1
 package com.huiju.estateagents.service.impl;
1
 package com.huiju.estateagents.service.impl;
2
 
2
 
3
+import com.alibaba.fastjson.JSON;
3
 import com.alibaba.fastjson.JSONObject;
4
 import com.alibaba.fastjson.JSONObject;
4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
6
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
508
                 }
509
                 }
509
             }
510
             }
510
             TaRecommendCustomer oldRecomendCustomer = result.get(0);
511
             TaRecommendCustomer oldRecomendCustomer = result.get(0);
511
-            if (!StringUtils.isEmpty(oldRecomendCustomer.getRealtyConsultant())){
512
+            if (!StringUtils.isEmpty(oldRecomendCustomer.getRealtyConsultant())) {
512
                 return ResponseBean.error("您在当前项目的置业顾问是:" + conName, ResponseBean.ERROR_ILLEGAL_PARAMS);
513
                 return ResponseBean.error("您在当前项目的置业顾问是:" + conName, ResponseBean.ERROR_ILLEGAL_PARAMS);
513
-            }else {
514
+            } else {
514
                 oldRecomendCustomer.setRealtyConsultant(consultantUser.getUserId().toString());
515
                 oldRecomendCustomer.setRealtyConsultant(consultantUser.getUserId().toString());
515
                 taRecommendCustomerMapper.updateById(oldRecomendCustomer);
516
                 taRecommendCustomerMapper.updateById(oldRecomendCustomer);
516
                 if (null != customerFrom) {
517
                 if (null != customerFrom) {
839
 
840
 
840
     @Override
841
     @Override
841
     public ResponseBean batchConsultantAssist(TaUser taUser, Integer orgId) {
842
     public ResponseBean batchConsultantAssist(TaUser taUser, Integer orgId) {
843
+        Integer failNum = 0;
842
         if (CollectionUtils.isNotEmpty(taUser.getCustomerIds())) {
844
         if (CollectionUtils.isNotEmpty(taUser.getCustomerIds())) {
843
             for (TaRecommendCustomer taRecommendCustomer : taUser.getCustomerIds()) {
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
     @Override
858
     @Override
898
         TaRecommendCustomer customerInfo2 = taRecommendCustomerMapper.selectOne(customerQueryWrapper2);
906
         TaRecommendCustomer customerInfo2 = taRecommendCustomerMapper.selectOne(customerQueryWrapper2);
899
         if (customerInfo2 != null) {
907
         if (customerInfo2 != null) {
900
             logger.info("客户已在当前项目私客中,可以继续分配给其他项目");
908
             logger.info("客户已在当前项目私客中,可以继续分配给其他项目");
901
-            responseBean.addError("分配客户失败");
909
+            responseBean.addError("客户已在当前项目私客中,可以继续分配给其他项目");
902
             return responseBean;
910
             return responseBean;
903
         }
911
         }
904
 
912