소스 검색

* bug fix

顾绍勇 5 년 전
부모
커밋
682d484cbc

+ 6
- 0
src/main/java/com/huiju/estateagents/center/taUser/entity/TaUser.java 파일 보기

233
     @TableField(exist = false)
233
     @TableField(exist = false)
234
     private List<TaPerson> personIds;
234
     private List<TaPerson> personIds;
235
 
235
 
236
+    /**
237
+     * customerId集合
238
+     */
239
+    @TableField(exist = false)
240
+    private List<TaRecommendCustomer> customerIds;
241
+
236
     @TableField(exist = false)
242
     @TableField(exist = false)
237
     private String miniAppName;
243
     private String miniAppName;
238
 }
244
 }

+ 1
- 1
src/main/java/com/huiju/estateagents/controller/TaRecommendCustomerController.java 파일 보기

453
      */
453
      */
454
     @RequestMapping(value = "/admin/customer/consultant/batchAssist", method = RequestMethod.POST)
454
     @RequestMapping(value = "/admin/customer/consultant/batchAssist", method = RequestMethod.POST)
455
     public ResponseBean batchAssistConsultant(@RequestBody TaUser taUser, HttpServletRequest request) {
455
     public ResponseBean batchAssistConsultant(@RequestBody TaUser taUser, HttpServletRequest request) {
456
-        if (CollectionUtils.isEmpty(taUser.getPersonIds())) {
456
+        if (CollectionUtils.isEmpty(taUser.getCustomerIds())) {
457
             return ResponseBean.error("请至少选择一条数据", ResponseBean.ERROR_UNAVAILABLE);
457
             return ResponseBean.error("请至少选择一条数据", ResponseBean.ERROR_UNAVAILABLE);
458
         }
458
         }
459
         try {
459
         try {

+ 40
- 15
src/main/java/com/huiju/estateagents/service/impl/TaRecommendCustomerServiceImpl.java 파일 보기

25
 import com.huiju.estateagents.statistic.entity.TaCustomerFollowUpRecord;
25
 import com.huiju.estateagents.statistic.entity.TaCustomerFollowUpRecord;
26
 import com.huiju.estateagents.statistic.mapper.TaCustomerFollowUpRecordMapper;
26
 import com.huiju.estateagents.statistic.mapper.TaCustomerFollowUpRecordMapper;
27
 import org.apache.commons.collections.CollectionUtils;
27
 import org.apache.commons.collections.CollectionUtils;
28
+import org.slf4j.Logger;
29
+import org.slf4j.LoggerFactory;
28
 import org.springframework.beans.factory.annotation.Autowired;
30
 import org.springframework.beans.factory.annotation.Autowired;
29
 import org.springframework.stereotype.Service;
31
 import org.springframework.stereotype.Service;
30
 
32
 
44
 @Service
46
 @Service
45
 public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCustomerMapper, TaRecommendCustomer> implements ITaRecommendCustomerService {
47
 public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCustomerMapper, TaRecommendCustomer> implements ITaRecommendCustomerService {
46
 
48
 
49
+    private Logger logger = LoggerFactory.getLogger(TaRecommendCustomerServiceImpl.class);
50
+
47
     @Autowired
51
     @Autowired
48
     TaPersonMapper taPersonMapper;
52
     TaPersonMapper taPersonMapper;
49
 
53
 
835
 
839
 
836
     @Override
840
     @Override
837
     public ResponseBean batchConsultantAssist(TaUser taUser, Integer orgId) {
841
     public ResponseBean batchConsultantAssist(TaUser taUser, Integer orgId) {
838
-        if (CollectionUtils.isNotEmpty(taUser.getPersonIds())) {
839
-            for (TaPerson taPerson : taUser.getPersonIds()) {
840
-                consultantAssist(taUser, taPerson.getPersonId(), orgId);
842
+        if (CollectionUtils.isNotEmpty(taUser.getCustomerIds())) {
843
+            for (TaRecommendCustomer taRecommendCustomer : taUser.getCustomerIds()) {
844
+                consultantAssist(taUser, taRecommendCustomer.getCustomerId(), orgId);
841
             }
845
             }
842
         }
846
         }
843
         return ResponseBean.success("操作成功");
847
         return ResponseBean.success("操作成功");
845
 
849
 
846
     @Override
850
     @Override
847
     public ResponseBean consultantAssist(TaUser taUser, String customerId, Integer orgId) {
851
     public ResponseBean consultantAssist(TaUser taUser, String customerId, Integer orgId) {
852
+        logger.info("公客分配置业顾问 接收参数,taUser={},customerId={},orgId={}",
853
+                JSONObject.toJSONString(taUser), customerId, orgId);
848
 
854
 
849
         // 1.校验置业顾问
855
         // 1.校验置业顾问
850
         QueryWrapper<TaUser> queryWrapper = new QueryWrapper();
856
         QueryWrapper<TaUser> queryWrapper = new QueryWrapper();
855
         taPersonBuildingQueryWrapper.eq("user_id", taUser.getUserId());
861
         taPersonBuildingQueryWrapper.eq("user_id", taUser.getUserId());
856
         TaPersonBuilding taPersonBuilding = taPersonBuildingMapper.selectOne(taPersonBuildingQueryWrapper);
862
         TaPersonBuilding taPersonBuilding = taPersonBuildingMapper.selectOne(taPersonBuildingQueryWrapper);
857
 
863
 
858
-        if (null == userInfo || CommConstant.STATUS_NORMAL != userInfo.getStatus() ) {
864
+        if (null == userInfo || CommConstant.STATUS_NORMAL != userInfo.getStatus()) {
859
             return ResponseBean.error("置业顾问不存在或已被注销", ResponseBean.ERROR_UNAVAILABLE);
865
             return ResponseBean.error("置业顾问不存在或已被注销", ResponseBean.ERROR_UNAVAILABLE);
860
         }
866
         }
861
 
867
 
862
         // 2.根据customerId获取personId
868
         // 2.根据customerId获取personId
863
-        TaRecommendCustomer recommendCustomerInfo = taRecommendCustomerMapper.selectById(customerId);
864
-        if(recommendCustomerInfo == null){
865
-            return ResponseBean.error("分配客户失败",ResponseBean.ERROR_UNAVAILABLE);
869
+        QueryWrapper<TaRecommendCustomer> customerQueryWrapper = new QueryWrapper<>();
870
+        customerQueryWrapper.eq("customer_id", customerId);
871
+        customerQueryWrapper.isNull("realty_consultant");
872
+        TaRecommendCustomer customerInfo = taRecommendCustomerMapper.selectOne(customerQueryWrapper);
873
+        if (customerInfo == null) {
874
+            logger.info("公客分配置业顾问 customerInfo为空");
875
+            return ResponseBean.error("分配客户失败", ResponseBean.ERROR_UNAVAILABLE);
866
         }
876
         }
867
 
877
 
868
         // 3.判断是否有buildingId,有则直接更新数据
878
         // 3.判断是否有buildingId,有则直接更新数据
869
-        if(!StringUtils.isEmpty(recommendCustomerInfo.getBuildingId()) && StringUtils.isEmpty(recommendCustomerInfo.getRealtyConsultant())){
870
-            log.error("公客添加置业顾问 customer:" + JSONObject.toJSONString(recommendCustomerInfo));
871
-            recommendCustomerInfo.setRealtyConsultant(userInfo.getUserId().toString());
872
-            return ResponseBean.success(taRecommendCustomerMapper.updateById(recommendCustomerInfo));
879
+        if (!StringUtils.isEmpty(customerInfo.getBuildingId())) {
880
+            logger.info("公客分配置业顾问 customer={}", JSONObject.toJSONString(customerInfo));
881
+            customerInfo.setRealtyConsultant(userInfo.getUserId().toString());
882
+            return ResponseBean.success(taRecommendCustomerMapper.updateById(customerInfo));
883
+        }
884
+
885
+        // 4.校验公客是否已经是分配项目下的私客
886
+        QueryWrapper<TaRecommendCustomer> customerQueryWrapper2 = new QueryWrapper<>();
887
+        customerQueryWrapper2.eq("org_id", orgId);
888
+        customerQueryWrapper2.eq("person_id", customerInfo.getPersonId());
889
+        customerQueryWrapper2.eq("building_id", taPersonBuilding.getBuildingId());
890
+        customerQueryWrapper2.eq("status", CommConstant.CUSTOMER_REPORT);
891
+        customerQueryWrapper2.eq("verify_status", CommConstant.VERIFY_AGREE);
892
+        customerQueryWrapper2.isNotNull("realty_consultant");
893
+        TaRecommendCustomer customerInfo2 = taRecommendCustomerMapper.selectOne(customerQueryWrapper2);
894
+        if (customerInfo2 != null) {
895
+            logger.info("公客分配置业顾问 customerInfo2为空");
896
+            return ResponseBean.error("分配客户失败", ResponseBean.ERROR_UNAVAILABLE);
873
         }
897
         }
874
 
898
 
875
-        // 4.无buildingId,新增一条私客数据
876
-        TaPerson taPerson = taPersonMapper.getById(recommendCustomerInfo.getPersonId());
877
-        if(taPerson == null){
878
-            return ResponseBean.error("分配客户失败",ResponseBean.ERROR_UNAVAILABLE);
899
+        // 5.无buildingId,新增一条私客数据
900
+        TaPerson taPerson = taPersonMapper.getById(customerInfo.getPersonId());
901
+        if (taPerson == null) {
902
+            logger.info("公客分配置业顾问 taPerson为空");
903
+            return ResponseBean.error("分配客户失败", ResponseBean.ERROR_UNAVAILABLE);
879
         }
904
         }
880
 
905
 
881
         TaRecommendCustomer taRecommendCustomer = new TaRecommendCustomer();
906
         TaRecommendCustomer taRecommendCustomer = new TaRecommendCustomer();