|
@@ -750,6 +750,55 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
|
750
|
750
|
}
|
751
|
751
|
}
|
752
|
752
|
|
|
753
|
+ @Override
|
|
754
|
+ public ResponseBean consultantAssist(TaUser taUser, String personId, Integer orgId) {
|
|
755
|
+ TaPerson taPerson = taPersonMapper.getById(personId);
|
|
756
|
+
|
|
757
|
+ QueryWrapper<TaPerson> taPersonQueryWrapper = new QueryWrapper();
|
|
758
|
+ taPersonQueryWrapper.eq("user_id", taUser.getUserId());
|
|
759
|
+ TaPerson recommendPerson = taPersonMapper.selectOne(taPersonQueryWrapper);
|
|
760
|
+
|
|
761
|
+ QueryWrapper<TaUser> queryWrapper = new QueryWrapper();
|
|
762
|
+ queryWrapper.eq("user_id", taUser.getUserId());
|
|
763
|
+ TaUser userInfo = taUserMapper.selectOne(queryWrapper);
|
|
764
|
+
|
|
765
|
+ QueryWrapper<TaPersonBuilding> taPersonBuildingQueryWrapper = new QueryWrapper();
|
|
766
|
+ taPersonBuildingQueryWrapper.eq("user_id", taUser.getUserId());
|
|
767
|
+ TaPersonBuilding taPersonBuilding = taPersonBuildingMapper.selectOne(taPersonBuildingQueryWrapper);
|
|
768
|
+
|
|
769
|
+ if (null == userInfo || userInfo.getStatus() != CommConstant.STATUS_NORMAL) {
|
|
770
|
+ return ResponseBean.error("置业顾问不存在或已被注销", ResponseBean.ERROR_UNAVAILABLE);
|
|
771
|
+ }
|
|
772
|
+
|
|
773
|
+ TaRecommendCustomer taRecommendCustomer = new TaRecommendCustomer();
|
|
774
|
+ taRecommendCustomer.setOrgId(orgId);
|
|
775
|
+ taRecommendCustomer.setName(taPerson.getNickname());
|
|
776
|
+ taRecommendCustomer.setPicture(taPerson.getAvatarurl());
|
|
777
|
+ taRecommendCustomer.setPhone(taPerson.getPhone());
|
|
778
|
+ taRecommendCustomer.setSex(null == taPerson.getGender() ? null : ("1".equals(taPerson.getGender()) ? 1 : 2));
|
|
779
|
+ taRecommendCustomer.setRealtyConsultant(userInfo.getUserId().toString());
|
|
780
|
+ taRecommendCustomer.setBuildingId(taPersonBuilding.getBuildingId());
|
|
781
|
+ TaBuilding building = taBuildingMapper.selectById(taPersonBuilding.getBuildingId());
|
|
782
|
+ taRecommendCustomer.setIntention(building.getBuildingName());
|
|
783
|
+ taRecommendCustomer.setReportRecommendStatus(CommConstant.VERIFY_AGREE);
|
|
784
|
+ taRecommendCustomer.setCreateDate(LocalDateTime.now());
|
|
785
|
+ taRecommendCustomer.setReportDate(LocalDateTime.now());
|
|
786
|
+ taRecommendCustomer.setPersonId(taPerson.getPersonId());
|
|
787
|
+ taRecommendCustomer.setEntryType(CommConstant.ENTRY_VERIFY);
|
|
788
|
+ taRecommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
|
|
789
|
+ taRecommendCustomer.setStatus(CommConstant.CUSTOMER_REPORT);
|
|
790
|
+ taRecommendCustomer.setPersonId(personId);
|
|
791
|
+ taRecommendCustomer.setRecommendPerson(recommendPerson == null ? taUser.getUserId().toString() : recommendPerson.getPersonId());
|
|
792
|
+
|
|
793
|
+ int row = taRecommendCustomerMapper.insert(taRecommendCustomer);
|
|
794
|
+ if (row < 1) {
|
|
795
|
+ return ResponseBean.error("分配客户失败", ResponseBean.ERROR_UNAVAILABLE);
|
|
796
|
+ }
|
|
797
|
+
|
|
798
|
+ return ResponseBean.success(taRecommendCustomer);
|
|
799
|
+
|
|
800
|
+ }
|
|
801
|
+
|
753
|
802
|
private List<TaRecommendCustomer> getCustomerByPhone(String phone) {
|
754
|
803
|
QueryWrapper<TaRecommendCustomer> queryWrapper = new QueryWrapper<>();
|
755
|
804
|
queryWrapper.eq("phone", phone);
|