Browse Source

私客 公客

魏熙美 5 years ago
parent
commit
c7be9dbfc1

+ 6
- 1
src/main/java/com/huiju/estateagents/common/CommConstant.java View File

24
     public final static String PERSON_ESTATE_CUSTOMER = "customer";
24
     public final static String PERSON_ESTATE_CUSTOMER = "customer";
25
 
25
 
26
     /**
26
     /**
27
-     * 人员类型: 客户
27
+     * 人员类型: 渠道经纪人
28
      */
28
      */
29
     public final static String PERSON_ESTATE_CHANNEL = "channel agent";
29
     public final static String PERSON_ESTATE_CHANNEL = "channel agent";
30
 
30
 
363
     public static final Integer NOT_PUBLISH = 0;
363
     public static final Integer NOT_PUBLISH = 0;
364
     // ------- 政策发布状态 end -------
364
     // ------- 政策发布状态 end -------
365
 
365
 
366
+    // 公客
367
+    public static final String CUTOMER_TYPE_PUBLIC = "public";
368
+    // 私客
369
+    public static final String CUTOMER_TYPE_PRIVATE = "private";
370
+
366
 }
371
 }

+ 13
- 5
src/main/java/com/huiju/estateagents/controller/TaRecommendCustomerController.java View File

147
         }
147
         }
148
     }
148
     }
149
 
149
 
150
-    // 客户列表
150
+    // 客户列表 公客/私客
151
     @GetMapping("/admin/customer/recommend")
151
     @GetMapping("/admin/customer/recommend")
152
     public ResponseBean getCustomerList (@RequestParam(value ="name",required = false) String name,
152
     public ResponseBean getCustomerList (@RequestParam(value ="name",required = false) String name,
153
                                          @RequestParam(value ="tel",required = false) String tel,
153
                                          @RequestParam(value ="tel",required = false) String tel,
158
                                          @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
158
                                          @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
159
                                          @RequestParam(value ="entryType",required = false) String entryType,
159
                                          @RequestParam(value ="entryType",required = false) String entryType,
160
                                          @RequestParam(value ="verifyStatus",required = false) String verifyStatus,
160
                                          @RequestParam(value ="verifyStatus",required = false) String verifyStatus,
161
-                                         @RequestParam(value = "sex",required = false)Integer sex){
161
+                                         @RequestParam(value = "sex",required = false)Integer sex,
162
+                                         @RequestParam(value = "customerType") String customerType){ // public 公  private 私
162
         try{
163
         try{
163
-            return ResponseBean.success(taRecommendCustomerService.getCustomerList(pageNumber,pageSize,buildingId,name,tel,consultName,consultTel,entryType,verifyStatus,sex));
164
+            return ResponseBean.success(taRecommendCustomerService.getCustomerList(pageNumber,pageSize,buildingId,name,tel,consultName,consultTel,entryType,verifyStatus,sex, customerType));
164
         }catch (Exception e){
165
         }catch (Exception e){
165
             e.printStackTrace();
166
             e.printStackTrace();
166
             return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
167
             return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
211
     }
212
     }
212
 
213
 
213
 
214
 
214
-    //独立经纪人列表
215
+    /**
216
+     * 经纪人列表
217
+     * @param name
218
+     * @param tel
219
+     * @param pageNumber
220
+     * @param pageSize
221
+     * @return
222
+     */
215
     @GetMapping("/admin/customer/agents")
223
     @GetMapping("/admin/customer/agents")
216
     public ResponseBean getIndependentAgents (@RequestParam(value ="name",required = false) String name,
224
     public ResponseBean getIndependentAgents (@RequestParam(value ="name",required = false) String name,
217
                                             @RequestParam(value ="tel",required = false) String tel,
225
                                             @RequestParam(value ="tel",required = false) String tel,
218
                                             @RequestParam(value ="pageNumber",defaultValue = "1") Integer pageNumber,
226
                                             @RequestParam(value ="pageNumber",defaultValue = "1") Integer pageNumber,
219
                                             @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
227
                                             @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
220
         try{
228
         try{
221
-            return ResponseBean.success(taRecommendCustomerService.getIndependentAgents(pageNumber,pageSize,name,tel));
229
+            return ResponseBean.success(taRecommendCustomerService.getIndependentAgents(pageNumber,pageSize,name,tel, null));
222
         }catch (Exception e){
230
         }catch (Exception e){
223
             e.printStackTrace();
231
             e.printStackTrace();
224
             return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
232
             return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);

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

246
 
246
 
247
     @TableField(exist = false)
247
     @TableField(exist = false)
248
     private TaOrg org;
248
     private TaOrg org;
249
+
250
+    /**
251
+     * 渠道名称
252
+     */
253
+    @TableField(exist = false)
254
+    private String channelName;
249
 }
255
 }

+ 13
- 1
src/main/java/com/huiju/estateagents/mapper/TaRecommendCustomerMapper.java View File

29
     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);
29
     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);
30
     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);
30
     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);
31
     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);
31
     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);
32
-    IPage<TaPerson> getIndependentAgents(IPage<TaPerson>page, @Param("name") String name, @Param("tel") String tel);
32
+    IPage<TaPerson> getIndependentAgents(IPage<TaPerson>page, @Param("name") String name, @Param("tel") String tel, @Param("orgId") Integer orgId);
33
+
34
+    /**
35
+     * 公客
36
+     * @param page
37
+     * @param name
38
+     * @param tel
39
+     * @param entryType
40
+     * @param verifyStatus
41
+     * @param sex
42
+     * @return
43
+     */
44
+    IPage<TaRecommendCustomer> getPublicCustomerList(IPage<TaPerson> page, @Param("name") String name, @Param("tel") String tel,@Param("entryType") String entryType,@Param("verifyStatus") String verifyStatus,@Param("sex") Integer sex);
33
 }
45
 }

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

28
 
28
 
29
     IPage<TaRecommendCustomer> getUnSignedCustomerList(int pageNumber, int pageSize, String building,String personId);
29
     IPage<TaRecommendCustomer> getUnSignedCustomerList(int pageNumber, int pageSize, String building,String personId);
30
 
30
 
31
-    IPage<TaRecommendCustomer> getCustomerList(int pageNumber, int pageSize, String building,String name,String tel,String consultName,String consultTel,String entryType,String verifyStatus,Integer sex);
31
+    IPage<TaRecommendCustomer> getCustomerList(int pageNumber, int pageSize, String building,String name,String tel,String consultName,String consultTel,String entryType,String verifyStatus,Integer sex, String customerType);
32
 
32
 
33
     IPage<TaRecommendCustomer> getRecCustomerList(int pageNumber, int pageSize, String building,String name,String tel,String consultName,String consultTel,String entryType,String verifyStatus,Integer sex);
33
     IPage<TaRecommendCustomer> getRecCustomerList(int pageNumber, int pageSize, String building,String name,String tel,String consultName,String consultTel,String entryType,String verifyStatus,Integer sex);
34
 
34
 
35
     IPage<TaRecommendCustomer> getRepCustomerList(int pageNumber, int pageSize, String building,String name,String tel,String consultName,String consultTel,String entryType,String verifyStatus,Integer sex);
35
     IPage<TaRecommendCustomer> getRepCustomerList(int pageNumber, int pageSize, String building,String name,String tel,String consultName,String consultTel,String entryType,String verifyStatus,Integer sex);
36
 
36
 
37
-    IPage<TaPerson> getIndependentAgents(int pageNumber, int pageSize,String name,String tel);
37
+    IPage<TaPerson> getIndependentAgents(int pageNumber, int pageSize,String name,String tel, Integer orgId);
38
 
38
 
39
 
39
 
40
     TaRecommendCustomer getCustomerDetail(String customerId);
40
     TaRecommendCustomer getCustomerDetail(String customerId);

+ 15
- 5
src/main/java/com/huiju/estateagents/service/impl/TaRecommendCustomerServiceImpl.java View File

330
     }
330
     }
331
 
331
 
332
     @Override
332
     @Override
333
-    public IPage<TaRecommendCustomer> getCustomerList(int pageNumber, int pageSize,String building,String name,String tel,String consultName,String consultTel,String entryType,String verifyStatus,Integer sex){
334
-        IPage<TaRecommendCustomer>page = new Page<>(pageNumber,pageSize);
335
-        return taRecommendCustomerMapper.getCustomerList(page,building,name,tel,consultName,consultTel,entryType,verifyStatus,sex);
333
+    public IPage<TaRecommendCustomer> getCustomerList(int pageNumber, int pageSize,String building,String name,String tel,String consultName,String consultTel,String entryType,String verifyStatus,Integer sex, String customerType){
334
+
335
+        IPage<TaRecommendCustomer> customerList = null;
336
+        if (CommConstant.CUTOMER_TYPE_PUBLIC.equals(customerType)) {
337
+            // 公客
338
+            IPage<TaPerson>page = new Page<>(pageNumber,pageSize);
339
+            return taRecommendCustomerMapper.getPublicCustomerList(page, name, tel,  entryType, verifyStatus, sex);
340
+        } else {
341
+            // 私客
342
+            IPage<TaRecommendCustomer>page = new Page<>(pageNumber,pageSize);
343
+            return taRecommendCustomerMapper.getCustomerList(page, building, name, tel, consultName, consultTel, entryType, verifyStatus, sex);
344
+        }
345
+
336
     }
346
     }
337
 
347
 
338
     @Override
348
     @Override
339
-    public IPage<TaPerson> getIndependentAgents(int pageNumber, int pageSize,String name,String tel){
349
+    public IPage<TaPerson> getIndependentAgents(int pageNumber, int pageSize,String name,String tel, Integer orgId){
340
         IPage<TaPerson>page = new Page<>(pageNumber,pageSize);
350
         IPage<TaPerson>page = new Page<>(pageNumber,pageSize);
341
-        return taRecommendCustomerMapper.getIndependentAgents(page,name,tel);
351
+        return taRecommendCustomerMapper.getIndependentAgents(page,name,tel, orgId);
342
     }
352
     }
343
 
353
 
344
     @Override
354
     @Override

+ 47
- 15
src/main/resources/mapper/TaRecommendCustomerMapper.xml View File

73
 
73
 
74
     <select id="getIndependentAgents" resultType="com.huiju.estateagents.entity.TaPerson">
74
     <select id="getIndependentAgents" resultType="com.huiju.estateagents.entity.TaPerson">
75
         SELECT
75
         SELECT
76
-	a.*
77
-FROM
78
-	ta_person a
79
-<where>
80
-    a.person_type = 'estate agent'
81
-    and a.status >0
82
-    <if test="name != null and name !=''">
83
-        and a.nickname = #{name}
84
-    </if>
85
-    <if test="tel != null and tel!=''">
86
-        and a.phone = #{tel}
87
-    </if>
76
+            a.*,
77
+            tc.channel_name as channelName
78
+        FROM
79
+            ta_person a
80
+            left join ta_channel_person tcp on a.person_id = tcp.person_id
81
+            left join ta_channel tc on tc.channel_id = tcp.channel_id
82
+        <where>
83
+            a.person_type = 'estate agent'
84
+            and a.status >0
85
+            <if test="name != null and name !=''">
86
+                and a.nickname = #{name}
87
+            </if>
88
+            <if test="tel != null and tel!=''">
89
+                and a.phone = #{tel}
90
+            </if>
91
+            <if test="orgId != null">
92
+                and a.org_id = #{orgId}
93
+            </if>
88
 
94
 
89
-</where>
95
+        </where>
90
 
96
 
91
-ORDER BY
92
-	create_date DESC
97
+        ORDER BY
98
+            create_date DESC
93
     </select>
99
     </select>
94
 
100
 
95
     <select id="getRepCustomerList" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
101
     <select id="getRepCustomerList" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
145
         LEFT JOIN ta_person c on a.recommend_person = c.person_id
151
         LEFT JOIN ta_person c on a.recommend_person = c.person_id
146
         <where>
152
         <where>
147
             a.status > 0
153
             a.status > 0
154
+            and realty_consultant is not null
148
             <if test="building != null and building !=''">
155
             <if test="building != null and building !=''">
149
                 and a.building_id = #{building}
156
                 and a.building_id = #{building}
150
             </if>
157
             </if>
181
 	LEFT JOIN ta_person b ON a.realty_consultant = b.person_id
188
 	LEFT JOIN ta_person b ON a.realty_consultant = b.person_id
182
 	WHERE a.customer_id = #{customerId}
189
 	WHERE a.customer_id = #{customerId}
183
     </select>
190
     </select>
191
+
192
+    <select id="getPublicCustomerList" resultType="com.huiju.estateagents.entity.TaPerson">
193
+        SELECT
194
+        b.*
195
+        FROM
196
+        ta_person b
197
+        <where>
198
+            b.status > 0
199
+            AND IFNULL(b.person_type, '') in ('estate agent', 'customer')
200
+            <if test="name != null and name !=''">
201
+                and b.nickname = #{name}
202
+            </if>
203
+            <if test="tel != null and tel!=''">
204
+                and b.phone = #{tel}
205
+            </if>
206
+            <if test="entryType != null and entryType !=''">
207
+                and b.entry_type = #{entryType}
208
+            </if>
209
+            <if test="sex != null and sex !=''">
210
+                and b.sex = #{sex}
211
+            </if>
212
+            and NOT EXISTS ( select * from ta_recommend_customer a where a.recommend_person = b.person_id)
213
+        </where>
214
+        order by b.create_date desc
215
+    </select>
184
 </mapper>
216
 </mapper>