Ver código fonte

agent type, new column for user ,personBuilding

胡轶钦 5 anos atrás
pai
commit
4d31fdf2d8

+ 21
- 1
src/main/java/com/huiju/estateagents/center/taUser/entity/TaUser.java Ver arquivo

@@ -84,9 +84,29 @@ public class TaUser implements Serializable {
84 84
     /**
85 85
      * 公司名称
86 86
      */
87
-    @TableField(exist = false)
88 87
     private String orgName;
89 88
 
89
+    /**
90
+     * 部门
91
+     */
92
+    private String department;
93
+
94
+    /**
95
+     * 职位
96
+     */
97
+    private String position;
98
+
99
+    /**
100
+     * 邮箱
101
+     */
102
+    private String email;
103
+
104
+    /**
105
+     * 身份证号
106
+     */
107
+    private String idNo;
108
+
109
+
90 110
     /**
91 111
      * 公司水印
92 112
      */

+ 140
- 4
src/main/java/com/huiju/estateagents/controller/TaRecommendCustomerController.java Ver arquivo

@@ -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,
@@ -237,16 +301,88 @@ public class TaRecommendCustomerController extends BaseController {
237 301
 
238 302
 
239 303
     @GetMapping("/admin/customer/recommend/{customerId}")
240
-    public ResponseBean getCustomersIRecommended (@RequestParam int pageNumber, @RequestParam int pageSize, @PathVariable String customerId){
241
-        String buildingId="";
304
+    public ResponseBean getCustomersIRecommended (@RequestParam int pageNumber, @RequestParam int pageSize, @PathVariable String customerId,HttpServletRequest request){
305
+        Integer orgId = getOrgId(request);
306
+        try{
307
+            return ResponseBean.success(taRecommendCustomerService.getCustomersIRecommended(pageNumber,pageSize,customerId,orgId));
308
+        }catch (Exception e){
309
+            e.printStackTrace();
310
+            return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
311
+        }
312
+    }
313
+
314
+    @GetMapping("/wx/customer/recommend/{customerId}")
315
+    public ResponseBean getWxCustomersIRecommended (@RequestParam int pageNumber, @RequestParam int pageSize,HttpServletRequest request){
316
+        Integer orgId =getOrgId(request);
317
+        String openid = JWTUtils.getSubject(request);
318
+        List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
319
+        if (null == taPersons || taPersons.size() != 1) {
320
+            return ResponseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
321
+        }
322
+        TaPerson person = taPersons.get(0);
242 323
         try{
243
-            return ResponseBean.success(taRecommendCustomerService.getCustomersIRecommended(pageNumber,pageSize,customerId,buildingId));
324
+            return ResponseBean.success(taRecommendCustomerService.getCustomersIRecommended(pageNumber,pageSize,person.getPersonId(),orgId));
244 325
         }catch (Exception e){
245 326
             e.printStackTrace();
246 327
             return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
247 328
         }
248 329
     }
249 330
 
331
+    /**
332
+     * 修改对象
333
+     * @param channelCode 渠道码
334
+     * @return
335
+     */
336
+    @RequestMapping(value="/wx/customer/recommend/beComeChannel/{channelCode}",method= RequestMethod.PUT)
337
+    public ResponseBean taRecommendAgentBecomeChannel(@PathVariable String channelCode,HttpServletRequest request,@RequestParam("personType")String personType){
338
+        ResponseBean responseBean = new ResponseBean();
339
+        String openid = JWTUtils.getSubject(request);
340
+        List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
341
+        if (null == taPersons || taPersons.size() != 1) {
342
+            return ResponseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
343
+        }
344
+        TaPerson person = taPersons.get(0);
345
+        try {
346
+            if(CommConstant.PERSON_ESTATE_CHANNEL.equals(personType)){
347
+                QueryWrapper<TaChannel>channelQueryWrapper = new QueryWrapper<>();
348
+                channelQueryWrapper.eq("channel_code",channelCode);
349
+                QueryWrapper<TaChannelPerson>channelPersonQueryWrapper = new QueryWrapper<>();
350
+                TaChannel channel = taChannelService.getOne(channelQueryWrapper);
351
+                channelPersonQueryWrapper.eq("person_id",person.getPersonId());
352
+                channelPersonQueryWrapper.eq("channel_id",channel.getChannelId());
353
+                Integer count = taChannelPersonService.count(channelPersonQueryWrapper);
354
+                if(count >0){
355
+                    return ResponseBean.error("您已绑定过渠道",ResponseBean.ERROR_UNAVAILABLE);
356
+                }
357
+                TaChannelPerson channelPerson = new TaChannelPerson();
358
+                channelPerson.setCreateDate(LocalDateTime.now());
359
+                channelPerson.setPersonId(person.getPersonId());
360
+                channelPerson.setChannelId(channel.getChannelId());
361
+                taChannelPersonService.save(channelPerson);
362
+            }else {
363
+                QueryWrapper<TaChannelPerson>channelPersonQueryWrapper = new QueryWrapper<>();
364
+                channelPersonQueryWrapper.eq("person_id",person.getPersonId());
365
+                List<TaChannelPerson> taChannelPerson = taChannelPersonService.list(channelPersonQueryWrapper);
366
+                if (taChannelPerson.size()>0){
367
+                    for(int i=0;i<taChannelPerson.size();i++){
368
+                        taChannelPerson.get(i).setStatus(CommConstant.STATUS_DELETE);
369
+                    }
370
+                    taChannelPersonService.updateBatchById(taChannelPerson);
371
+                }
372
+            }
373
+            person.setPersonType(personType);
374
+            if (taPersonService.updateById(person)){
375
+                responseBean.addSuccess(person);
376
+            }else {
377
+                responseBean.addError("fail");
378
+            }
379
+        }catch (Exception e){
380
+            e.printStackTrace();
381
+            responseBean.addError(e.getMessage());
382
+        }
383
+        return responseBean;
384
+    }
385
+
250 386
         /**
251 387
      * 修改对象
252 388
      * @param taRecommendCustomer 实体对象

+ 2
- 0
src/main/java/com/huiju/estateagents/entity/TaChannelPerson.java Ver arquivo

@@ -38,5 +38,7 @@ public class TaChannelPerson implements Serializable {
38 38
      */
39 39
     private LocalDateTime createDate;
40 40
 
41
+    private Integer status;
42
+
41 43
 
42 44
 }

+ 5
- 0
src/main/java/com/huiju/estateagents/entity/TaPersonBuilding.java Ver arquivo

@@ -41,5 +41,10 @@ public class TaPersonBuilding implements Serializable {
41 41
      */
42 42
     private LocalDateTime createDate;
43 43
 
44
+    /**
45
+     * 用户ID
46
+     */
47
+    private Integer userId;
48
+
44 49
 
45 50
 }

+ 1
- 1
src/main/java/com/huiju/estateagents/service/ITaRecommendCustomerService.java Ver arquivo

@@ -41,7 +41,7 @@ public interface ITaRecommendCustomerService extends IService<TaRecommendCustome
41 41
 
42 42
     TaRecommendCustomer getCustomerById(String customerId);
43 43
 
44
-    IPage<TaRecommendCustomer>getCustomersIRecommended(int pageNumber, int pageSize,String customerId,String building);
44
+    IPage<TaRecommendCustomer>getCustomersIRecommended(int pageNumber, int pageSize,String customerId,Integer orgId);
45 45
 
46 46
     TaRecommendCustomer newByPerson(TaPerson person);
47 47
 }

+ 1
- 1
src/main/java/com/huiju/estateagents/service/impl/TaRecommendCustomerServiceImpl.java Ver arquivo

@@ -389,7 +389,7 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
389 389
     }
390 390
 
391 391
     @Override
392
-    public IPage<TaRecommendCustomer>getCustomersIRecommended(int pageNumber, int pageSize,String customerId,String building){
392
+    public IPage<TaRecommendCustomer>getCustomersIRecommended(int pageNumber, int pageSize,String customerId,Integer orgId){
393 393
         QueryWrapper<TaRecommendCustomer>queryWrapper = new QueryWrapper<>();
394 394
         // todo
395 395
         // 此处可能不是 person_id 而是 recommend_person