Sfoglia il codice sorgente

Merge branch 'dev' of http://git.ycjcjy.com/zhiyuxing/estateagents into dev

傅行帆 5 anni fa
parent
commit
f89d7e3a5d

+ 41
- 14
src/main/java/com/huiju/estateagents/service/impl/TaPersonServiceImpl.java Vedi File

@@ -885,6 +885,7 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
885 885
             person.setPersonType(CommConstant.PERSON_ESTATE_CUSTOMER);
886 886
         }
887 887
         updateById(person);
888
+        fixCustomerPersonId(person);
888 889
 
889 890
         // 2. 发放积分
890 891
         applicationContext.publishEvent(new EventBus(person, EventBus.EventType.SignUpAgent, orgId));
@@ -928,6 +929,29 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
928 929
 
929 930
         // 没有置业, 也没楼盘
930 931
         if (recPerson == null || taBuilding == null) {
932
+            TaCustomerFrom customerFrom = new TaCustomerFrom();
933
+            customerFrom.setPersonId(person.getPersonId());
934
+            customerFrom.setPersonName(StringUtils.ifNull(person.getName(), person.getNickname()));
935
+            customerFrom.setTargetType(targetType);
936
+            customerFrom.setTargetId(targetId);
937
+            customerFrom.setTargetName(targetName);
938
+            customerFrom.setOrgId(orgId);
939
+            customerFrom.setSceneId(sceneId);
940
+            customerFrom.setIsOrgFirst(true);   // 授权手机号, 肯定是第一次
941
+            customerFrom.setIsProjectFirst(false);
942
+            customerFrom.setCreateDate(now);
943
+            taCustomerFromMapper.insert(customerFrom);
944
+
945
+
946
+            TaRecommendCustomer customer = copyByPerosn(person, new TaRecommendCustomer());
947
+            customer.setVerifyStatus(CommConstant.VERIFY_READY);
948
+            customer.setStatus(CommConstant.CUSTOMER_REPORT);
949
+            customer.setEntryType(CommConstant.ENTRY_INPUT);
950
+            customer.setCreateDate(now);
951
+            customer.setReportDate(now);
952
+            customer.setRecommendPerson(promoter);
953
+            taRecommendCustomerMapper.insert(customer);
954
+
931 955
             return ;
932 956
         }
933 957
 
@@ -980,20 +1004,7 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
980 1004
         taCustomerFromMapper.insert(customerFrom);
981 1005
     }
982 1006
 
983
-    /**
984
-     * 此处逻辑按照复杂流程处理
985
-     * 除了新增客户外,还有修正原有数据的目的
986
-     * @param person
987
-     * @param taUser
988
-     * @param building
989
-     * @param withBuildings
990
-     * @param isAssociated
991
-     * @param now
992
-     * @return
993
-     * @throws Exception
994
-     */
995
-    private List<TaRecommendCustomer> mergeCustomerByPhone(TaPerson person, TaUser taUser, TaBuilding building, List<TaBuilding> withBuildings, boolean isAssociated, LocalDateTime now) throws Exception {
996
-
1007
+    private void fixCustomerPersonId(TaPerson person) {
997 1008
         // 先更新之前的数据, 有一种可能的情况, 客户是推荐的,之前未进入过小程序
998 1009
         // 后面所有的查询就可以不需要 phone , 改用 person_id 了
999 1010
         QueryWrapper<TaRecommendCustomer> q1 = new QueryWrapper<>();
@@ -1008,6 +1019,22 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
1008 1019
                 taRecommendCustomerMapper.updateById(cust);
1009 1020
             }
1010 1021
         }
1022
+    }
1023
+
1024
+
1025
+    /**
1026
+     * 此处逻辑按照复杂流程处理
1027
+     * 除了新增客户外,还有修正原有数据的目的
1028
+     * @param person
1029
+     * @param taUser
1030
+     * @param building
1031
+     * @param withBuildings
1032
+     * @param isAssociated
1033
+     * @param now
1034
+     * @return
1035
+     * @throws Exception
1036
+     */
1037
+    private List<TaRecommendCustomer> mergeCustomerByPhone(TaPerson person, TaUser taUser, TaBuilding building, List<TaBuilding> withBuildings, boolean isAssociated, LocalDateTime now) throws Exception {
1011 1038
 
1012 1039
         /**
1013 1040
          * 新增客户流程