傅行帆 5 gadus atpakaļ
vecāks
revīzija
af5be275a7

+ 3
- 2
src/main/java/com/huiju/estateagents/controller/TaRecommendCustomerController.java Parādīt failu

@@ -306,7 +306,8 @@ public class TaRecommendCustomerController extends BaseController {
306 306
                                          @RequestParam(value ="verifyStatus",required = false) String verifyStatus,
307 307
                                          @RequestParam(value = "sex",required = false)Integer sex,
308 308
                                          @RequestParam(value = "customerType") String customerType,// public 公  private 私
309
-                                         @RequestParam(value = "status",required = false) Integer status){
309
+                                         @RequestParam(value = "status",required = false) Integer status,
310
+                                         @RequestParam(value = "sceneType",required = false) String sceneType){
310 311
         try{
311 312
 
312 313
             // TODO 目前如果是公客,就取当前操作人员的 buildingId
@@ -320,7 +321,7 @@ public class TaRecommendCustomerController extends BaseController {
320 321
 //                TaPersonBuilding personBuilding = taPersonBuildingMapper.selectOne(queryWrapper);
321 322
 //                buildingId = personBuilding.getBuildingId();
322 323
 //            }
323
-            return ResponseBean.success(taRecommendCustomerService.getCustomerList(status,pageNumber,pageSize,buildingId,name,tel,consultName,consultTel,entryType,verifyStatus,sex, customerType, getOrgId(request),getTaPersonBuildingListByUserId(request)));
324
+            return ResponseBean.success(taRecommendCustomerService.getCustomerList(status,pageNumber,pageSize,buildingId,name,tel,consultName,consultTel,entryType,verifyStatus,sex, customerType, getOrgId(request),getTaPersonBuildingListByUserId(request),sceneType));
324 325
         }catch (Exception e){
325 326
             e.printStackTrace();
326 327
             return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);

+ 2
- 2
src/main/java/com/huiju/estateagents/mapper/TaRecommendCustomerMapper.java Parādīt failu

@@ -33,7 +33,7 @@ public interface TaRecommendCustomerMapper extends BaseMapper<TaRecommendCustome
33 33
 
34 34
     TaRecommendCustomer getCustomerById(@Param("customerId")String customerId);
35 35
 
36
-    IPage<TaRecommendCustomer> getCustomerList(IPage<TaRecommendCustomer> page,@Param("building") String building, @Param("name") String name, @Param("tel") String tel, @Param("consultName") String consultName, @Param("consultTel") String consultTel,@Param("entryType") String entryType,@Param("verifyStatus") String verifyStatus,@Param("sex") Integer sex, @Param("orgId") Integer orgId,@Param("status")Integer status, @Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
36
+    IPage<TaRecommendCustomer> getCustomerList(IPage<TaRecommendCustomer> page,@Param("building") String building, @Param("name") String name, @Param("tel") String tel, @Param("consultName") String consultName, @Param("consultTel") String consultTel,@Param("entryType") String entryType,@Param("verifyStatus") String verifyStatus,@Param("sex") Integer sex, @Param("orgId") Integer orgId,@Param("status")Integer status, @Param("personBuildingList") List<TaPersonBuilding> personBuildingList,@Param("sceneType") String sceneType);
37 37
     IPage<TaRecommendCustomer> getRecCustomerList(IPage<TaRecommendCustomer> page,@Param("building") String building, @Param("name") String name, @Param("tel") String tel, @Param("consultName") String consultName, @Param("consultTel") String consultTel,@Param("entryType") String entryType,@Param("verifyStatus") String verifyStatus,@Param("sex") Integer sex, @Param("orgId") Integer orgId, @Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
38 38
     IPage<TaRecommendCustomer> getRepCustomerList(IPage<TaRecommendCustomer> page,@Param("building") String building, @Param("name") String name, @Param("tel") String tel, @Param("consultName") String consultName, @Param("consultTel") String consultTel,@Param("entryType") String entryType,@Param("verifyStatus") String verifyStatus,@Param("sex") Integer sex, @Param("orgId") Integer orgId, @Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
39 39
     IPage<TaPerson> getIndependentAgents(IPage<TaPerson>page, @Param("name") String name, @Param("tel") String tel, @Param("orgId") Integer orgId);
@@ -48,7 +48,7 @@ public interface TaRecommendCustomerMapper extends BaseMapper<TaRecommendCustome
48 48
      * @param sex
49 49
      * @return
50 50
      */
51
-    IPage<TaPerson> getPublicCustomerList(IPage<TaPerson> page, @Param("name") String name, @Param("tel") String tel,@Param("entryType") String entryType,@Param("verifyStatus") String verifyStatus,@Param("sex") Integer sex, @Param("orgId") Integer orgId,@Param("consultTel")String consultTel);
51
+    IPage<TaPerson> getPublicCustomerList(IPage<TaPerson> page, @Param("name") String name, @Param("tel") String tel,@Param("entryType") String entryType,@Param("verifyStatus") String verifyStatus,@Param("sex") Integer sex, @Param("orgId") Integer orgId,@Param("consultTel")String consultTel,@Param("sceneType") String sceneType);
52 52
 
53 53
     /**
54 54
      * 导出数据 获取推荐用户数据

+ 1
- 1
src/main/java/com/huiju/estateagents/service/ITaRecommendCustomerService.java Parādīt failu

@@ -35,7 +35,7 @@ public interface ITaRecommendCustomerService extends IService<TaRecommendCustome
35 35
 
36 36
     IPage<TaRecommendCustomer> getUnSignedCustomerList(int pageNumber, int pageSize, String building,String personId);
37 37
 
38
-    IPage getCustomerList(Integer status,int pageNumber, int pageSize, String building,String name,String tel,String consultName,String consultTel,String entryType,String verifyStatus,Integer sex, String customerType, Integer orgId,List<TaPersonBuilding> taPersonBuildingList);
38
+    IPage getCustomerList(Integer status,int pageNumber, int pageSize, String building,String name,String tel,String consultName,String consultTel,String entryType,String verifyStatus,Integer sex, String customerType, Integer orgId,List<TaPersonBuilding> taPersonBuildingList,String sceneType);
39 39
 
40 40
     IPage<TaRecommendCustomer> getRecCustomerList(int pageNumber, int pageSize, String building,String name,String tel,String consultName,String consultTel,String entryType,String verifyStatus,Integer sex, Integer orgId,List<TaPersonBuilding> taPersonBuildingList);
41 41
 

+ 3
- 41
src/main/java/com/huiju/estateagents/service/impl/TaRecommendCustomerServiceImpl.java Parādīt failu

@@ -480,55 +480,17 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
480 480
     }
481 481
 
482 482
     @Override
483
-    public IPage getCustomerList(Integer status,int pageNumber, int pageSize,String building,String name,String tel,String consultName,String consultTel,String entryType,String verifyStatus,Integer sex, String customerType, Integer orgId,List<TaPersonBuilding> taPersonBuildingList){
483
+    public IPage getCustomerList(Integer status,int pageNumber, int pageSize,String building,String name,String tel,String consultName,String consultTel,String entryType,String verifyStatus,Integer sex, String customerType, Integer orgId,List<TaPersonBuilding> taPersonBuildingList,String sceneType){
484 484
 
485 485
         if (CommConstant.CUTOMER_TYPE_PUBLIC.equals(customerType)) {
486
-
487
-            /**
488
-             * <if test="buildingId != null">
489
-             *             ,(select tpp.name from ta_share_person_from tspf left join ta_person tpp on  tspf.share_person = tpp.person_id where tspf.building_id = #{buildingId} and tspf.is_first_time = 1) as sharePersonName
490
-             *         </if>
491
-             */
492
-
493
-            /**
494
-             * SELECT
495
-             *         b.*
496
-             *         FROM
497
-             *         ta_person b
498
-             *         <where>
499
-             *             b.status > 0
500
-             *             AND IFNULL(b.person_type, '') in ('estate agent', 'customer')
501
-             *             <if test="name != null and name !=''">
502
-             *                 and b.nickname like CONCAT('%',#{name}, '%')
503
-             *             </if>
504
-             *             <if test="tel != null and tel!=''">
505
-             *                 and b.phone like CONCAT('%',#{tel}, '%')
506
-             *             </if>
507
-             *             <if test="entryType != null and entryType !=''">
508
-             *                 and b.entry_type = #{entryType}
509
-             *             </if>
510
-             *             <if test="sex != null and sex !=''">
511
-             *                 and b.sex = #{sex}
512
-             *             </if>
513
-             *             <if test="orgId != null">
514
-             *                 and b.org_id = #{orgId}
515
-             *             </if>
516
-             *             <if test="consultTel != null and consultTel !=''">
517
-             *                 and b.tel like CONCAT('%',#{consultTel}, '%')
518
-             *             </if>
519
-             *             and NOT EXISTS ( select * from ta_recommend_customer a where a.recommend_person = b.person_id)
520
-             *         </where>
521
-             *         order by b.create_date desc
522
-             */
523
-
524 486
             // 公客
525 487
             IPage<TaPerson>page = new Page<>(pageNumber,pageSize);
526 488
             // 公客就不用 buildingId 进行查询
527
-            return taRecommendCustomerMapper.getPublicCustomerList(page,name, tel,  entryType, verifyStatus, sex, orgId,consultTel);
489
+            return taRecommendCustomerMapper.getPublicCustomerList(page,name, tel,  entryType, verifyStatus, sex, orgId,consultTel,sceneType);
528 490
         } else {
529 491
             // 私客
530 492
             IPage<TaRecommendCustomer>page = new Page<>(pageNumber,pageSize);
531
-            return taRecommendCustomerMapper.getCustomerList(page, building, name, tel, consultName, consultTel, entryType, verifyStatus, sex, orgId,status,taPersonBuildingList);
493
+            return taRecommendCustomerMapper.getCustomerList(page, building, name, tel, consultName, consultTel, entryType, verifyStatus, sex, orgId,status,taPersonBuildingList,sceneType);
532 494
         }
533 495
 
534 496
     }

+ 2
- 2
src/main/resources/mapper/TaPersonMapper.xml Parādīt failu

@@ -559,10 +559,10 @@ FROM
559 559
 
560 560
     <select id="selectDriftCustomerPageList" resultType="com.huiju.estateagents.entity.TaPerson">
561 561
         SELECT
562
-            DISTINCT(t.person_id) as id,t.* ,d.scene_type,d.scene_alias
562
+           t.* ,d.scene_type,d.scene_alias
563 563
         FROM
564 564
             ta_person t
565
-            LEFT JOIN ta_person_from_record r ON t.person_id = r.person_id
565
+            LEFT JOIN ta_person_from_record r ON t.person_id = r.person_id AND r.is_first_time = 1 and r.org_id = #{orgId}
566 566
             left join td_wx_dict d on r.scene_id = d.scene_id
567 567
         WHERE
568 568
             t.org_id = #{orgId}

+ 13
- 0
src/main/resources/mapper/TaRecommendCustomerMapper.xml Parādīt failu

@@ -171,6 +171,11 @@ FROM
171 171
         LEFT JOIN ta_person b ON a.realty_consultant = b.person_id
172 172
         LEFT JOIN ta_person c on a.recommend_person = c.person_id
173 173
         LEFT JOIN ta_user d on d.user_id = a.realty_consultant
174
+        LEFT JOIN ta_person_from_record p ON a.person_id = p.person_id AND p.is_first_time = 1
175
+        <if test="orgId != null">
176
+            and p.org_id =  #{orgId}
177
+        </if>
178
+        LEFT JOIN td_wx_dict w ON p.scene_id = w.scene_id
174 179
         <where>
175 180
             a.status > 0
176 181
             and a.verify_status = 1
@@ -212,6 +217,9 @@ FROM
212 217
                     #{personBuilding.buildingId}
213 218
                 </foreach>
214 219
             </if>
220
+            <if test="sceneType !=null and sceneType !=''">
221
+                and p.scene_type = #{sceneType}
222
+            </if>
215 223
         </where>
216 224
         order by a.create_date desc
217 225
     </select>
@@ -244,6 +252,8 @@ FROM
244 252
         ) AS sharePersonName
245 253
         FROM
246 254
         ta_person b
255
+        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}
256
+        left join td_wx_dict d on r.scene_id = d.scene_id
247 257
         <where>
248 258
             b.status > 0
249 259
             and b.org_id = #{orgId}
@@ -252,6 +262,9 @@ FROM
252 262
             <if test="name != null and name !=''">
253 263
                 and b.nickname like CONCAT('%',#{name}, '%')
254 264
             </if>
265
+            <if test="sceneType !=null and sceneType !=''">
266
+                and d.scene_type = #{sceneType}
267
+            </if>
255 268
             <if test="tel != null and tel!=''">
256 269
                 and b.phone like CONCAT('%',#{tel}, '%')
257 270
             </if>