Browse Source

新需求

魏超 5 years ago
parent
commit
64d80340d5

+ 6
- 0
src/main/java/com/huiju/estateagents/center/taUser/entity/TaUser.java View File

226
      */
226
      */
227
     @TableField(exist = false)
227
     @TableField(exist = false)
228
     private String consultantPersonId;
228
     private String consultantPersonId;
229
+
230
+    /**
231
+     * personId集合
232
+     */
233
+    @TableField(exist = false)
234
+    private List<TaPerson> personIds;
229
 }
235
 }

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

28
 import io.swagger.annotations.ApiImplicitParam;
28
 import io.swagger.annotations.ApiImplicitParam;
29
 import io.swagger.annotations.ApiImplicitParams;
29
 import io.swagger.annotations.ApiImplicitParams;
30
 import io.swagger.annotations.ApiOperation;
30
 import io.swagger.annotations.ApiOperation;
31
+import org.apache.commons.collections.CollectionUtils;
31
 import org.springframework.beans.factory.annotation.Autowired;
32
 import org.springframework.beans.factory.annotation.Autowired;
32
 import org.springframework.context.ApplicationContext;
33
 import org.springframework.context.ApplicationContext;
33
 import org.springframework.format.annotation.DateTimeFormat;
34
 import org.springframework.format.annotation.DateTimeFormat;
413
         }
414
         }
414
     }
415
     }
415
 
416
 
417
+    /**
418
+     * 批量分配置业顾问
419
+     */
420
+    @RequestMapping(value="/admin/customer/consultant/batchAssist",method= RequestMethod.POST)
421
+    public ResponseBean batchAssistConsultant (@RequestBody TaUser taUser, HttpServletRequest request){
422
+        if (CollectionUtils.isEmpty(taUser.getPersonIds())){
423
+            return ResponseBean.error("请至少选择一条数据", ResponseBean.ERROR_UNAVAILABLE);
424
+        }
425
+        try{
426
+            Integer orgId = getOrgId(request);
427
+            taRecommendCustomerService.batchConsultantAssist(taUser, orgId);
428
+            return ResponseBean.success("");
429
+        }catch (Exception e){
430
+            e.printStackTrace();
431
+            return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
432
+        }
433
+    }
434
+
416
     @GetMapping("/admin/customer/recommend/{customerId}")
435
     @GetMapping("/admin/customer/recommend/{customerId}")
417
     public ResponseBean getCustomersIRecommended (@RequestParam int pageNumber, @RequestParam int pageSize, @PathVariable String customerId,HttpServletRequest request){
436
     public ResponseBean getCustomersIRecommended (@RequestParam int pageNumber, @RequestParam int pageSize, @PathVariable String customerId,HttpServletRequest request){
418
         Integer orgId = getOrgId(request);
437
         Integer orgId = getOrgId(request);

+ 5
- 0
src/main/java/com/huiju/estateagents/entity/TaPerson.java View File

189
      */
189
      */
190
     private String idcard;
190
     private String idcard;
191
 
191
 
192
+    /**
193
+     * 授权手机号时间
194
+     */
195
+    private LocalDateTime authPhoneTime;
196
+
192
     /**
197
     /**
193
      * 访问记录
198
      * 访问记录
194
      */
199
      */

+ 34
- 0
src/main/java/com/huiju/estateagents/excel/PrivateCustomerExport.java View File

52
     @ExcelProperty(value = "项目名称", index = 5)
52
     @ExcelProperty(value = "项目名称", index = 5)
53
     private String buildingName;
53
     private String buildingName;
54
 
54
 
55
+    /**
56
+     * 用户注册时间
57
+     */
58
+    @ColumnWidth(15)
59
+    @ExcelProperty(value = "关注时间", index = 6)
60
+    private String createDate;
61
+
62
+    /**
63
+     * 国家
64
+     */
65
+    @ColumnWidth(15)
66
+    @ExcelProperty(value = "国家", index = 7)
67
+    private String country;
68
+
69
+    /**
70
+     * 省份
71
+     */
72
+    @ColumnWidth(15)
73
+    @ExcelProperty(value = "省份", index = 8)
74
+    private String province;
75
+
76
+    /**
77
+     * 来访方式
78
+     */
79
+    @ColumnWidth(15)
80
+    @ExcelProperty(value = "来访方式", index = 9)
81
+    private String sceneType;
82
+
83
+    /**
84
+     * 意向度
85
+     */
86
+    @ColumnWidth(15)
87
+    @ExcelProperty(value = "意向度", index = 10)
88
+    private String intention ;
55
 }
89
 }

+ 34
- 0
src/main/java/com/huiju/estateagents/excel/PublicCustomerExport.java View File

31
     @ExcelProperty(value = "性别", index = 2)
31
     @ExcelProperty(value = "性别", index = 2)
32
     private String sex;
32
     private String sex;
33
 
33
 
34
+    /**
35
+     * 关注时间
36
+     */
37
+    @ColumnWidth(15)
38
+    @ExcelProperty(value = "关注时间", index = 3)
39
+    private String createDate;
40
+
41
+    /**
42
+     * 国家
43
+     */
44
+    @ColumnWidth(15)
45
+    @ExcelProperty(value = "国家", index = 4)
46
+    private String country;
47
+
48
+    /**
49
+     * 省份
50
+     */
51
+    @ColumnWidth(15)
52
+    @ExcelProperty(value = "省份", index = 5)
53
+    private String province;
54
+
55
+    /**
56
+     * 来访方式
57
+     */
58
+    @ColumnWidth(15)
59
+    @ExcelProperty(value = "性别", index = 6)
60
+    private String sceneType;
61
+
62
+    /**
63
+     * 意向度
64
+     */
65
+    @ColumnWidth(15)
66
+    @ExcelProperty(value = "意向度", index = 7)
67
+    private String intention;
34
 }
68
 }

+ 1
- 0
src/main/java/com/huiju/estateagents/service/ITaRecommendCustomerService.java View File

58
 
58
 
59
     ResponseBean consultantAssist(TaUser taUser, String personId, Integer orgId);
59
     ResponseBean consultantAssist(TaUser taUser, String personId, Integer orgId);
60
 
60
 
61
+    ResponseBean batchConsultantAssist(TaUser taUser, Integer orgId);
61
     /**
62
     /**
62
      * 导出数据(推荐客户)
63
      * 导出数据(推荐客户)
63
      * @param orgId
64
      * @param orgId

+ 1
- 0
src/main/java/com/huiju/estateagents/service/impl/TaPersonServiceImpl.java View File

179
 
179
 
180
         UpdateWrapper<TaPerson> wrapper = new UpdateWrapper<>();
180
         UpdateWrapper<TaPerson> wrapper = new UpdateWrapper<>();
181
         wrapper.set("phone", phone);
181
         wrapper.set("phone", phone);
182
+        wrapper.set("auth_phone_time", LocalDateTime.now());
182
 
183
 
183
         if (CommConstant.PERSON_ESTATE_DRIFT.equals(person.getPersonType())) {
184
         if (CommConstant.PERSON_ESTATE_DRIFT.equals(person.getPersonType())) {
184
             wrapper.set("person_type",CommConstant.PERSON_ESTATE_CUSTOMER);
185
             wrapper.set("person_type",CommConstant.PERSON_ESTATE_CUSTOMER);

+ 11
- 0
src/main/java/com/huiju/estateagents/service/impl/TaRecommendCustomerServiceImpl.java View File

24
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
24
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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.springframework.beans.factory.annotation.Autowired;
28
 import org.springframework.beans.factory.annotation.Autowired;
28
 import org.springframework.stereotype.Service;
29
 import org.springframework.stereotype.Service;
29
 
30
 
751
         }
752
         }
752
     }
753
     }
753
 
754
 
755
+    @Override
756
+    public ResponseBean batchConsultantAssist(TaUser taUser, Integer orgId) {
757
+        if (CollectionUtils.isNotEmpty(taUser.getPersonIds())){
758
+            for (TaPerson taPerson : taUser.getPersonIds()){
759
+                consultantAssist(taUser, taPerson.getPersonId(), orgId);
760
+            }
761
+        }
762
+        return ResponseBean.success("操作成功");
763
+    }
764
+
754
     @Override
765
     @Override
755
     public ResponseBean consultantAssist(TaUser taUser, String personId, Integer orgId) {
766
     public ResponseBean consultantAssist(TaUser taUser, String personId, Integer orgId) {
756
         TaPerson taPerson = taPersonMapper.getById(personId);
767
         TaPerson taPerson = taPersonMapper.getById(personId);

+ 14
- 2
src/main/resources/mapper/TaRecommendCustomerMapper.xml View File

546
         SELECT
546
         SELECT
547
           b.nickname as nickname,
547
           b.nickname as nickname,
548
           b.phone as phone,
548
           b.phone as phone,
549
-          if(b.gender = 1, '男', if(b.gender = 2, '女', '未知')) as sex
549
+          if(b.gender = 1, '男', if(b.gender = 2, '女', '未知')) as sex,
550
+          b.create_date,
551
+          b.country,
552
+          b.province,
553
+          z.intention,
554
+          d.scene_alias as sceneType
550
         FROM
555
         FROM
551
         ta_person b
556
         ta_person b
552
         LEFT JOIN ta_person_from_record r ON b.person_id = r.person_id AND r.is_first_time = 1 and r.org_id = #{orgId}
557
         LEFT JOIN ta_person_from_record r ON b.person_id = r.person_id AND r.is_first_time = 1 and r.org_id = #{orgId}
558
+        left join (select sum(t.intention) as intention,t.person_id From ta_person_intention_record t where t.org_id = #{orgId} group by t.person_id) z on z.person_id = b.person_id
553
         left join td_wx_dict d on r.scene_id = d.scene_id
559
         left join td_wx_dict d on r.scene_id = d.scene_id
554
         <where>
560
         <where>
555
             b.status > 0
561
             b.status > 0
650
         WHEN b.tel IS NULL THEN
656
         WHEN b.tel IS NULL THEN
651
         d.phone ELSE b.tel
657
         d.phone ELSE b.tel
652
         END AS consultTel,
658
         END AS consultTel,
653
-        t.building_name
659
+        t.building_name,
660
+        z.intention,
661
+        a.create_date,
662
+        a.country,
663
+        a.province,
664
+        w.scene_alias as scene_type
654
         FROM
665
         FROM
655
         ta_recommend_customer a
666
         ta_recommend_customer a
656
         LEFT JOIN ta_person b ON a.realty_consultant = b.person_id
667
         LEFT JOIN ta_person b ON a.realty_consultant = b.person_id
659
         LEFT JOIN ta_person_from_record p ON a.person_id = p.person_id AND p.is_first_time = 1 and p.org_id = #{orgId}
670
         LEFT JOIN ta_person_from_record p ON a.person_id = p.person_id AND p.is_first_time = 1 and p.org_id = #{orgId}
660
         left join ta_building t on a.building_id = t.building_id
671
         left join ta_building t on a.building_id = t.building_id
661
         LEFT JOIN td_wx_dict w ON p.scene_id = w.scene_id
672
         LEFT JOIN td_wx_dict w ON p.scene_id = w.scene_id
673
+        left join (select sum(t.intention) as intention,t.person_id From ta_person_intention_record t where t.org_id = #{orgId} group by t.person_id) z on z.person_id = a.person_id
662
         <where>
674
         <where>
663
             a.status > 0
675
             a.status > 0
664
             and a.verify_status = 1
676
             and a.verify_status = 1