顾绍勇 vor 5 Jahren
Ursprung
Commit
b0a770b869

+ 1
- 1
src/main/java/com/huiju/estateagents/controller/TaRecommendCustomerController.java Datei anzeigen

@@ -671,7 +671,6 @@ public class TaRecommendCustomerController extends BaseController {
671 671
                     if (null != realtyConsultant) {
672 672
                         List<TaBuilding> taBuildings = taPersonBuildingMapper.getBuildingsOf(realtyConsultant);
673 673
                         taRecommendCustomer.setRealtyConsultant(realtyConsultant);
674
-                        taRecommendCustomer.setCreateDate(LocalDateTime.now());
675 674
                         if (taBuildings != null && taBuildings.size() > 0) {
676 675
                             TaBuilding taBuilding = taBuildings.get(0);
677 676
                             taRecommendCustomer.setBuildingId(taBuilding.getBuildingId());
@@ -680,6 +679,7 @@ public class TaRecommendCustomerController extends BaseController {
680 679
                     }
681 680
                 }
682 681
 
682
+                taRecommendCustomer.setVerifyDate(LocalDateTime.now());
683 683
                 if (taRecommendCustomerService.updateById(taRecommendCustomer)) {
684 684
 
685 685
                     // 审核通过增加积分

+ 2
- 0
src/main/java/com/huiju/estateagents/entity/TaRecommendCustomer.java Datei anzeigen

@@ -149,6 +149,8 @@ public class TaRecommendCustomer implements Serializable {
149 149
 
150 150
     private LocalDateTime arrivalDate;
151 151
 
152
+    private LocalDateTime verifyDate;
153
+
152 154
     @DateTimeFormat("yyyy年MM月dd日")
153 155
     private LocalDateTime createDate;
154 156
 

+ 1
- 1
src/main/java/com/huiju/estateagents/service/ITaRecommendCustomerService.java Datei anzeigen

@@ -57,7 +57,7 @@ public interface ITaRecommendCustomerService extends IService<TaRecommendCustome
57 57
 
58 58
     TaRecommendCustomer newByPerson(TaPerson person);
59 59
 
60
-    ResponseBean consultantAssist(TaUser taUser, String personId, Integer orgId);
60
+    ResponseBean consultantAssist(TaUser taUser, String customerId, Integer orgId);
61 61
 
62 62
     ResponseBean batchConsultantAssist(TaUser taUser, Integer orgId);
63 63
 

+ 25
- 10
src/main/java/com/huiju/estateagents/service/impl/TaRecommendCustomerServiceImpl.java Datei anzeigen

@@ -160,7 +160,7 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
160 160
      */
161 161
     @Override
162 162
     public List<TaRecommendCustomer> getConsultantCustomerList(Integer userId, String personId, String buildingId, Integer orgId, List<TaPersonBuilding> taPersonBuildingListByUserId) {
163
-        return taRecommendCustomerMapper.getConsultantCustomerList(userId,personId,buildingId,orgId);
163
+        return taRecommendCustomerMapper.getConsultantCustomerList(userId, personId, buildingId, orgId);
164 164
     }
165 165
 
166 166
     @Override
@@ -833,11 +833,9 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
833 833
     }
834 834
 
835 835
     @Override
836
-    public ResponseBean consultantAssist(TaUser taUser, String personId, Integer orgId) {
837
-        TaPerson taPerson = taPersonMapper.getById(personId);
838
-
839
-        TaPerson recommendPerson = taPersonMapper.selectById(personId);
836
+    public ResponseBean consultantAssist(TaUser taUser, String customerId, Integer orgId) {
840 837
 
838
+        // 1.校验置业顾问
841 839
         QueryWrapper<TaUser> queryWrapper = new QueryWrapper();
842 840
         queryWrapper.eq("user_id", taUser.getUserId());
843 841
         TaUser userInfo = taUserMapper.selectOne(queryWrapper);
@@ -846,10 +844,29 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
846 844
         taPersonBuildingQueryWrapper.eq("user_id", taUser.getUserId());
847 845
         TaPersonBuilding taPersonBuilding = taPersonBuildingMapper.selectOne(taPersonBuildingQueryWrapper);
848 846
 
849
-        if (null == userInfo || userInfo.getStatus() != CommConstant.STATUS_NORMAL) {
847
+        if (null == userInfo || CommConstant.STATUS_NORMAL != userInfo.getStatus() ) {
850 848
             return ResponseBean.error("置业顾问不存在或已被注销", ResponseBean.ERROR_UNAVAILABLE);
851 849
         }
852 850
 
851
+        // 2.根据customerId获取personId
852
+        TaRecommendCustomer recommendCustomerInfo = taRecommendCustomerMapper.selectById(customerId);
853
+        if(recommendCustomerInfo == null){
854
+            return ResponseBean.error("分配客户失败",ResponseBean.ERROR_UNAVAILABLE);
855
+        }
856
+
857
+        // 3.判断是否有buildingId,有则直接更新数据
858
+        if(!StringUtils.isEmpty(recommendCustomerInfo.getBuildingId()) && StringUtils.isEmpty(recommendCustomerInfo.getRealtyConsultant())){
859
+            log.error("公客添加置业顾问 customer:" + JSONObject.toJSONString(recommendCustomerInfo));
860
+            recommendCustomerInfo.setRealtyConsultant(userInfo.getUserId().toString());
861
+            return ResponseBean.success(taRecommendCustomerMapper.updateById(recommendCustomerInfo));
862
+        }
863
+
864
+        // 4.无buildingId,新增一条私客数据
865
+        TaPerson taPerson = taPersonMapper.getById(recommendCustomerInfo.getPersonId());
866
+        if(taPerson == null){
867
+            return ResponseBean.error("分配客户失败",ResponseBean.ERROR_UNAVAILABLE);
868
+        }
869
+
853 870
         TaRecommendCustomer taRecommendCustomer = new TaRecommendCustomer();
854 871
         taRecommendCustomer.setOrgId(orgId);
855 872
         taRecommendCustomer.setName(taPerson.getNickname());
@@ -867,16 +884,14 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
867 884
         taRecommendCustomer.setEntryType(CommConstant.ENTRY_VERIFY);
868 885
         taRecommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
869 886
         taRecommendCustomer.setStatus(CommConstant.CUSTOMER_REPORT);
870
-        taRecommendCustomer.setPersonId(personId);
871
-        taRecommendCustomer.setRecommendPerson(recommendPerson == null ? "" : recommendPerson.getRecommendPerson());
887
+        taRecommendCustomer.setPersonId(taPerson.getPersonId());
888
+        taRecommendCustomer.setRecommendPerson(taPerson.getRecommendPerson());
872 889
 
873 890
         int row = taRecommendCustomerMapper.insert(taRecommendCustomer);
874 891
         if (row < 1) {
875 892
             return ResponseBean.error("分配客户失败", ResponseBean.ERROR_UNAVAILABLE);
876 893
         }
877
-
878 894
         return ResponseBean.success(taRecommendCustomer);
879
-
880 895
     }
881 896
 
882 897
     private List<TaRecommendCustomer> getCustomerByPhone(String phone, Integer orgId) {

+ 1
- 0
src/main/resources/mapper/TaRecommendCustomerMapper.xml Datei anzeigen

@@ -631,6 +631,7 @@ FROM
631 631
         <if test="belongStatus == 0">
632 632
             and (t.building_id = ''  OR t.building_id is null )
633 633
         </if>
634
+        order by t.create_date desc
634 635
     </select>
635 636
     <!--    limit #{pageCode}, #{pageSize}-->
636 637