|
@@ -8,11 +8,15 @@ import com.huiju.estateagents.base.ResponseBean;
|
8
|
8
|
import com.huiju.estateagents.common.CommConstant;
|
9
|
9
|
import com.huiju.estateagents.common.JWTUtils;
|
10
|
10
|
import com.huiju.estateagents.common.StringUtils;
|
|
11
|
+import com.huiju.estateagents.entity.TaChannel;
|
|
12
|
+import com.huiju.estateagents.entity.TaChannelPerson;
|
11
|
13
|
import com.huiju.estateagents.entity.TaPerson;
|
12
|
14
|
import com.huiju.estateagents.entity.TaRecommendCustomer;
|
13
|
15
|
import com.huiju.estateagents.event.EventBus;
|
14
|
16
|
import com.huiju.estateagents.service.ITaPersonService;
|
15
|
17
|
import com.huiju.estateagents.service.ITaRecommendCustomerService;
|
|
18
|
+import com.huiju.estateagents.service.TaChannelPersonService;
|
|
19
|
+import com.huiju.estateagents.service.TaChannelService;
|
16
|
20
|
import org.springframework.beans.factory.annotation.Autowired;
|
17
|
21
|
import org.springframework.context.ApplicationContext;
|
18
|
22
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -21,6 +25,7 @@ import com.huiju.estateagents.base.BaseController;
|
21
|
25
|
|
22
|
26
|
import javax.annotation.Resource;
|
23
|
27
|
import javax.servlet.http.HttpServletRequest;
|
|
28
|
+import java.time.LocalDateTime;
|
24
|
29
|
import java.util.List;
|
25
|
30
|
|
26
|
31
|
/**
|
|
@@ -44,6 +49,12 @@ public class TaRecommendCustomerController extends BaseController {
|
44
|
49
|
@Resource
|
45
|
50
|
private ApplicationContext applicationContext;
|
46
|
51
|
|
|
52
|
+ @Autowired
|
|
53
|
+ private TaChannelService taChannelService;
|
|
54
|
+
|
|
55
|
+ @Autowired
|
|
56
|
+ private TaChannelPersonService taChannelPersonService;
|
|
57
|
+
|
47
|
58
|
/**
|
48
|
59
|
* 我的客户列表
|
49
|
60
|
* @param pageNumber
|
|
@@ -132,9 +143,61 @@ public class TaRecommendCustomerController extends BaseController {
|
132
|
143
|
}
|
133
|
144
|
|
134
|
145
|
@GetMapping("/wx/customer/myReport")
|
135
|
|
- public ResponseBean getCustomerIReport (@RequestParam(value ="personId") String personId,
|
|
146
|
+ public ResponseBean getCustomerIReport (HttpServletRequest request,
|
136
|
147
|
@RequestParam(value ="pageNumber",defaultValue = "1") Integer pageNumber,
|
137
|
148
|
@RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
|
|
149
|
+ String openid = JWTUtils.getSubject(request);
|
|
150
|
+ List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
|
|
151
|
+ if (null == taPersons || taPersons.size() != 1) {
|
|
152
|
+ return ResponseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
|
|
153
|
+ }
|
|
154
|
+ TaPerson person = taPersons.get(0);
|
|
155
|
+ try{
|
|
156
|
+ IPage<TaRecommendCustomer>pg = new Page<>(pageNumber,pageSize);
|
|
157
|
+ QueryWrapper<TaRecommendCustomer>queryWrapper = new QueryWrapper<>();
|
|
158
|
+ queryWrapper.eq("realty_consultant",person.getPersonId());
|
|
159
|
+ queryWrapper.eq("report_recommend_status",CommConstant.REPORTED);
|
|
160
|
+ queryWrapper.eq("status",CommConstant.CUSTOMER_REPORT);
|
|
161
|
+ queryWrapper.orderByDesc("create_date");
|
|
162
|
+ IPage<TaRecommendCustomer>result = taRecommendCustomerService.page(pg,queryWrapper);
|
|
163
|
+ return ResponseBean.success(result);
|
|
164
|
+ }catch (Exception e){
|
|
165
|
+ e.printStackTrace();
|
|
166
|
+ return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
|
|
167
|
+ }
|
|
168
|
+ }
|
|
169
|
+
|
|
170
|
+ @GetMapping("/wx/customer/myCustomer")
|
|
171
|
+ public ResponseBean getMyCustomer ( @RequestParam(value ="pageNumber",defaultValue = "1") Integer pageNumber,
|
|
172
|
+ @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
|
|
173
|
+ HttpServletRequest request){
|
|
174
|
+ String openid = JWTUtils.getSubject(request);
|
|
175
|
+ List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
|
|
176
|
+ if (null == taPersons || taPersons.size() != 1) {
|
|
177
|
+ return ResponseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
|
|
178
|
+ }
|
|
179
|
+ TaPerson person = taPersons.get(0);
|
|
180
|
+
|
|
181
|
+ try{
|
|
182
|
+ IPage<TaRecommendCustomer>pg = new Page<>(pageNumber,pageSize);
|
|
183
|
+ QueryWrapper<TaRecommendCustomer>queryWrapper = new QueryWrapper<>();
|
|
184
|
+ queryWrapper.eq("realty_consultant",person.getPersonId());
|
|
185
|
+ queryWrapper.eq("report_recommend_status",CommConstant.REPORTED);
|
|
186
|
+ queryWrapper.gt("status",CommConstant.CUSTOMER_REPORT);
|
|
187
|
+ queryWrapper.orderByDesc("create_date");
|
|
188
|
+ IPage<TaRecommendCustomer>result = taRecommendCustomerService.page(pg,queryWrapper);
|
|
189
|
+ return ResponseBean.success(result);
|
|
190
|
+ }catch (Exception e){
|
|
191
|
+ e.printStackTrace();
|
|
192
|
+ return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
|
|
193
|
+ }
|
|
194
|
+ }
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+ @GetMapping("/wx/customer/myInviteAgent")
|
|
198
|
+ public ResponseBean getMyInviteAgent (@RequestParam(value ="personId") String personId,
|
|
199
|
+ @RequestParam(value ="pageNumber",defaultValue = "1") Integer pageNumber,
|
|
200
|
+ @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
|
138
|
201
|
try{
|
139
|
202
|
IPage<TaRecommendCustomer>pg = new Page<>(pageNumber,pageSize);
|
140
|
203
|
QueryWrapper<TaRecommendCustomer>queryWrapper = new QueryWrapper<>();
|
|
@@ -149,6 +212,7 @@ public class TaRecommendCustomerController extends BaseController {
|
149
|
212
|
}
|
150
|
213
|
}
|
151
|
214
|
|
|
215
|
+
|
152
|
216
|
// 客户列表 公客/私客
|
153
|
217
|
@GetMapping("/admin/customer/recommend")
|
154
|
218
|
public ResponseBean getCustomerList (@RequestParam(value ="name",required = false) String name,
|
|
@@ -163,7 +227,7 @@ public class TaRecommendCustomerController extends BaseController {
|
163
|
227
|
@RequestParam(value = "sex",required = false)Integer sex,
|
164
|
228
|
@RequestParam(value = "customerType") String customerType){ // public 公 private 私
|
165
|
229
|
try{
|
166
|
|
- return ResponseBean.success(taRecommendCustomerService.getCustomerList(pageNumber,pageSize,buildingId,name,tel,consultName,consultTel,entryType,verifyStatus,sex, customerType));
|
|
230
|
+ return ResponseBean.success(taRecommendCustomerService.getCustomerList(pageNumber,pageSize,buildingId,name,tel,consultName,consultTel,entryType,verifyStatus,sex, customerType, null)); //getOrgId(request)
|
167
|
231
|
}catch (Exception e){
|
168
|
232
|
e.printStackTrace();
|
169
|
233
|
return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
|
|
@@ -173,7 +237,8 @@ public class TaRecommendCustomerController extends BaseController {
|
173
|
237
|
|
174
|
238
|
//推荐客户列表
|
175
|
239
|
@GetMapping("/admin/customer/recommend/recommender")
|
176
|
|
- public ResponseBean getRecCustomerList (@RequestParam(value ="name",required = false) String name,
|
|
240
|
+ public ResponseBean getRecCustomerList (HttpServletRequest request,
|
|
241
|
+ @RequestParam(value ="name",required = false) String name,
|
177
|
242
|
@RequestParam(value ="tel",required = false) String tel,
|
178
|
243
|
@RequestParam(value ="buildingId",required = false) String buildingId,
|
179
|
244
|
@RequestParam(value ="recommendName",required = false) String recommendName,
|
|
@@ -184,7 +249,7 @@ public class TaRecommendCustomerController extends BaseController {
|
184
|
249
|
@RequestParam(value ="verifyStatus",required = false) String verifyStatus,
|
185
|
250
|
@RequestParam(value = "sex",required = false)Integer sex){
|
186
|
251
|
try{
|
187
|
|
- return ResponseBean.success(taRecommendCustomerService.getRecCustomerList(pageNumber,pageSize,buildingId,name,tel,recommendName,recommendTel,entryType,verifyStatus,sex));
|
|
252
|
+ return ResponseBean.success(taRecommendCustomerService.getRecCustomerList(pageNumber,pageSize,buildingId,name,tel,recommendName,recommendTel,entryType,verifyStatus,sex, getOrgId(request)));
|
188
|
253
|
}catch (Exception e){
|
189
|
254
|
e.printStackTrace();
|
190
|
255
|
return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
|
|
@@ -205,7 +270,7 @@ public class TaRecommendCustomerController extends BaseController {
|
205
|
270
|
@RequestParam(value = "sex",required = false)Integer sex, HttpServletRequest request){
|
206
|
271
|
Integer orgid = getOrgId(request);
|
207
|
272
|
try{
|
208
|
|
- return ResponseBean.success(taRecommendCustomerService.getRepCustomerList(pageNumber,pageSize,buildingId,name,tel,consultName,consultTel,entryType,verifyStatus,sex,orgid));
|
|
273
|
+ return ResponseBean.success(taRecommendCustomerService.getRepCustomerList(pageNumber,pageSize,buildingId,name,tel,consultName,consultTel,entryType,verifyStatus,sex, orgid));
|
209
|
274
|
}catch (Exception e){
|
210
|
275
|
e.printStackTrace();
|
211
|
276
|
return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
|
|
@@ -222,12 +287,13 @@ public class TaRecommendCustomerController extends BaseController {
|
222
|
287
|
* @return
|
223
|
288
|
*/
|
224
|
289
|
@GetMapping("/admin/customer/agents")
|
225
|
|
- public ResponseBean getIndependentAgents (@RequestParam(value ="name",required = false) String name,
|
|
290
|
+ public ResponseBean getIndependentAgents (HttpServletRequest request,
|
|
291
|
+ @RequestParam(value ="name",required = false) String name,
|
226
|
292
|
@RequestParam(value ="tel",required = false) String tel,
|
227
|
293
|
@RequestParam(value ="pageNumber",defaultValue = "1") Integer pageNumber,
|
228
|
294
|
@RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
|
229
|
295
|
try{
|
230
|
|
- return ResponseBean.success(taRecommendCustomerService.getIndependentAgents(pageNumber,pageSize,name,tel, null));
|
|
296
|
+ return ResponseBean.success(taRecommendCustomerService.getIndependentAgents(pageNumber,pageSize,name,tel, getOrgId(request)));
|
231
|
297
|
}catch (Exception e){
|
232
|
298
|
e.printStackTrace();
|
233
|
299
|
return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
|
|
@@ -236,16 +302,35 @@ public class TaRecommendCustomerController extends BaseController {
|
236
|
302
|
|
237
|
303
|
|
238
|
304
|
@GetMapping("/admin/customer/recommend/{customerId}")
|
239
|
|
- public ResponseBean getCustomersIRecommended (@RequestParam int pageNumber, @RequestParam int pageSize, @PathVariable String customerId){
|
240
|
|
- String buildingId="";
|
|
305
|
+ public ResponseBean getCustomersIRecommended (@RequestParam int pageNumber, @RequestParam int pageSize, @PathVariable String customerId,HttpServletRequest request){
|
|
306
|
+ Integer orgId = getOrgId(request);
|
241
|
307
|
try{
|
242
|
|
- return ResponseBean.success(taRecommendCustomerService.getCustomersIRecommended(pageNumber,pageSize,customerId,buildingId));
|
|
308
|
+ return ResponseBean.success(taRecommendCustomerService.getCustomersIRecommended(pageNumber,pageSize,customerId,orgId));
|
243
|
309
|
}catch (Exception e){
|
244
|
310
|
e.printStackTrace();
|
245
|
311
|
return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
|
246
|
312
|
}
|
247
|
313
|
}
|
248
|
314
|
|
|
315
|
+ @GetMapping("/wx/customer/recommend/{customerId}")
|
|
316
|
+ public ResponseBean getWxCustomersIRecommended (@RequestParam int pageNumber, @RequestParam int pageSize,HttpServletRequest request){
|
|
317
|
+ Integer orgId =getOrgId(request);
|
|
318
|
+ String openid = JWTUtils.getSubject(request);
|
|
319
|
+ List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
|
|
320
|
+ if (null == taPersons || taPersons.size() != 1) {
|
|
321
|
+ return ResponseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
|
|
322
|
+ }
|
|
323
|
+ TaPerson person = taPersons.get(0);
|
|
324
|
+ try{
|
|
325
|
+ return ResponseBean.success(taRecommendCustomerService.getCustomersIRecommended(pageNumber,pageSize,person.getPersonId(),orgId));
|
|
326
|
+ }catch (Exception e){
|
|
327
|
+ e.printStackTrace();
|
|
328
|
+ return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
|
|
329
|
+ }
|
|
330
|
+ }
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
|
249
|
334
|
/**
|
250
|
335
|
* 修改对象
|
251
|
336
|
* @param taRecommendCustomer 实体对象
|
|
@@ -291,6 +376,29 @@ public class TaRecommendCustomerController extends BaseController {
|
291
|
376
|
return responseBean;
|
292
|
377
|
}
|
293
|
378
|
|
|
379
|
+ /**
|
|
380
|
+ * 修改对象
|
|
381
|
+ * @param taRecommendCustomer 实体对象
|
|
382
|
+ * @return
|
|
383
|
+ */
|
|
384
|
+ @RequestMapping(value="/wx/customer/recommend/edit/{id}",method= RequestMethod.PUT)
|
|
385
|
+ public ResponseBean taWxRecommendCustomerUpdate(@PathVariable String id,
|
|
386
|
+ @RequestBody TaRecommendCustomer taRecommendCustomer){
|
|
387
|
+ ResponseBean responseBean = new ResponseBean();
|
|
388
|
+ taRecommendCustomer.setCustomerId(id);
|
|
389
|
+ try {
|
|
390
|
+ if (taRecommendCustomerService.updateById(taRecommendCustomer)){
|
|
391
|
+ responseBean.addSuccess(taRecommendCustomer);
|
|
392
|
+ }else {
|
|
393
|
+ responseBean.addError("fail");
|
|
394
|
+ }
|
|
395
|
+ }catch (Exception e){
|
|
396
|
+ e.printStackTrace();
|
|
397
|
+ responseBean.addError(e.getMessage());
|
|
398
|
+ }
|
|
399
|
+ return responseBean;
|
|
400
|
+ }
|
|
401
|
+
|
294
|
402
|
@RequestMapping(value = "/wx/customer/recommend/get/{id}", method = RequestMethod.GET)
|
295
|
403
|
public ResponseBean getSingleCustomer(@PathVariable(value = "id") String customerId) {
|
296
|
404
|
ResponseBean responseBean = new ResponseBean();
|
|
@@ -330,11 +438,12 @@ public class TaRecommendCustomerController extends BaseController {
|
330
|
438
|
}
|
331
|
439
|
|
332
|
440
|
@GetMapping("/admin/customer/recommend/drift")
|
333
|
|
- public ResponseBean getDriftCustomerList (@RequestParam(value ="buildingId",defaultValue = "false") String buildingId,
|
|
441
|
+ public ResponseBean getDriftCustomerList (HttpServletRequest request,
|
|
442
|
+ @RequestParam(value ="buildingId",defaultValue = "false") String buildingId,
|
334
|
443
|
@RequestParam(value ="pageNumber",defaultValue = "1") Integer pageNumber,
|
335
|
444
|
@RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
|
336
|
445
|
try{
|
337
|
|
- return ResponseBean.success(taPersonService.getDriftCustomerList(pageNumber,pageSize,buildingId));
|
|
446
|
+ return ResponseBean.success(taPersonService.getDriftCustomerList(pageNumber,pageSize,buildingId, getOrgId(request)));
|
338
|
447
|
}catch (Exception e){
|
339
|
448
|
e.printStackTrace();
|
340
|
449
|
return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
|