张延森 před 2 roky
rodič
revize
e7bca49be5
25 změnil soubory, kde provedl 337 přidání a 28 odebrání
  1. 8
    4
      src/main/java/com/yunzhi/marketing/base/BaseController.java
  2. 13
    3
      src/main/java/com/yunzhi/marketing/borker/controller/BkAgreementController.java
  3. 62
    0
      src/main/java/com/yunzhi/marketing/borker/controller/BorkerController.java
  4. 1
    1
      src/main/java/com/yunzhi/marketing/borker/entity/BkAccountRecord.java
  5. 6
    0
      src/main/java/com/yunzhi/marketing/borker/entity/BkAgreement.java
  6. 4
    0
      src/main/java/com/yunzhi/marketing/borker/mapper/BkBankCardMapper.java
  7. 5
    0
      src/main/java/com/yunzhi/marketing/borker/service/IBkBankCardService.java
  8. 31
    0
      src/main/java/com/yunzhi/marketing/borker/service/impl/BkBankCardServiceImpl.java
  9. 64
    0
      src/main/java/com/yunzhi/marketing/borker/vo/BorkerVO.java
  10. 5
    0
      src/main/java/com/yunzhi/marketing/common/CommConstant.java
  11. 4
    0
      src/main/java/com/yunzhi/marketing/common/DateUtils.java
  12. 11
    0
      src/main/java/com/yunzhi/marketing/controller/MiniAppController.java
  13. 19
    4
      src/main/java/com/yunzhi/marketing/controller/TaBuildingController.java
  14. 3
    0
      src/main/java/com/yunzhi/marketing/entity/TaBuilding.java
  15. 18
    0
      src/main/java/com/yunzhi/marketing/entity/TaPerson.java
  16. 1
    0
      src/main/java/com/yunzhi/marketing/mapper/TaBuildingMapper.java
  17. 1
    0
      src/main/java/com/yunzhi/marketing/service/ITaBuildingService.java
  18. 2
    0
      src/main/java/com/yunzhi/marketing/service/impl/TaBuildingServiceImpl.java
  19. 38
    15
      src/main/java/com/yunzhi/marketing/service/impl/TaRecommendCustomerServiceImpl.java
  20. 3
    0
      src/main/java/com/yunzhi/marketing/xlk/entity/ChannelCustomer.java
  21. 2
    0
      src/main/java/com/yunzhi/marketing/xlk/mapper/ChannelCustomerMapper.java
  22. 11
    0
      src/main/resources/mapper/BkBankCardMapper.xml
  23. 3
    0
      src/main/resources/mapper/TaBuildingMapper.xml
  24. 1
    1
      src/main/resources/mapper/TaMiniappThemeMapper.xml
  25. 21
    0
      src/main/resources/mapper/xlk/ChannelCustomerMapper.xml

+ 8
- 4
src/main/java/com/yunzhi/marketing/base/BaseController.java Zobrazit soubor

@@ -10,6 +10,7 @@ import com.yunzhi.marketing.entity.TaBuilding;
10 10
 import com.yunzhi.marketing.entity.TaPersonBuilding;
11 11
 import com.yunzhi.marketing.service.ITaBuildingService;
12 12
 import com.yunzhi.marketing.service.ITaPersonBuildingService;
13
+import com.yunzhi.marketing.service.ITaPersonService;
13 14
 import com.yunzhi.marketing.xlk.entity.Institution;
14 15
 import com.yunzhi.marketing.xlk.service.IInstitutionService;
15 16
 import org.springframework.beans.factory.annotation.Autowired;
@@ -26,16 +27,19 @@ import java.util.stream.Collectors;
26 27
  */
27 28
 public class BaseController {
28 29
     @Autowired
29
-    private ITaUserService taUserService;
30
+    protected ITaUserService taUserService;
30 31
 
31 32
     @Autowired
32
-    private ITaPersonBuildingService taPersonBuildingService;
33
+    protected ITaPersonBuildingService taPersonBuildingService;
33 34
 
34 35
     @Autowired
35
-    private ITaBuildingService taBuildingService;
36
+    protected ITaBuildingService taBuildingService;
36 37
 
37 38
     @Autowired
38
-    public IInstitutionService iInstitutionService;
39
+    protected IInstitutionService iInstitutionService;
40
+
41
+    @Autowired
42
+    protected ITaPersonService iTaPersonService;
39 43
 
40 44
     /**
41 45
      * 获取orgId

+ 13
- 3
src/main/java/com/yunzhi/marketing/borker/controller/BkAgreementController.java Zobrazit soubor

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.yunzhi.marketing.base.BaseController;
7 7
 import com.yunzhi.marketing.base.ResponseBean;
8 8
 import com.yunzhi.marketing.common.CommConstant;
9
+import com.yunzhi.marketing.common.StringUtils;
9 10
 import io.swagger.annotations.Api;
10 11
 import io.swagger.annotations.ApiOperation;
11 12
 import io.swagger.annotations.ApiParam;
@@ -54,11 +55,13 @@ public class BkAgreementController extends BaseController {
54 55
     public ResponseBean bkAgreementList(@ApiParam("客户端") @PathVariable String client,
55 56
                                         @ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
56 57
                                         @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
57
-                                        HttpServletRequest request) throws Exception{
58
+                                        @ApiParam("楼盘ID") @RequestParam(value ="buildingId", required = false) String buildingId,
59
+                                        HttpServletRequest request) throws Exception {
58 60
 
59 61
         IPage<BkAgreement> pg = new Page<>(pageNum, pageSize);
60 62
         QueryWrapper<BkAgreement> queryWrapper = new QueryWrapper<>();
61 63
         queryWrapper.eq("org_id", getOrgId(request));
64
+        queryWrapper.eq(!StringUtils.isEmpty(buildingId), "building_id", buildingId);
62 65
         queryWrapper.gt("status", CommConstant.STATUS_DELETE);
63 66
         queryWrapper.orderByDesc("create_date");
64 67
 
@@ -76,12 +79,16 @@ public class BkAgreementController extends BaseController {
76 79
     public ResponseBean bkAgreementAdd(@ApiParam("保存内容") @RequestBody BkAgreement bkAgreement,
77 80
                                        HttpServletRequest request) throws Exception {
78 81
 
82
+        if (StringUtils.isEmpty(bkAgreement.getBuildingId())) {
83
+            return ResponseBean.error("未绑定楼盘", ResponseBean.ERROR_UNAVAILABLE);
84
+        }
85
+
79 86
         bkAgreement.setOrgId(getOrgId(request).toString());
80 87
         bkAgreement.setInstitutionId(CommConstant.ROOT_INSTITUTION);
81 88
 
82 89
         if (iBkAgreementService.save(bkAgreement)){
83 90
             return ResponseBean.success(bkAgreement);
84
-        }else {
91
+        } else {
85 92
             return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
86 93
         }
87 94
     }
@@ -121,8 +128,11 @@ public class BkAgreementController extends BaseController {
121 128
     @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
122 129
     public ResponseBean bkAgreementUpdate(@ApiParam("对象ID") @PathVariable String id,
123 130
                                           @ApiParam("更新内容") @RequestBody BkAgreement bkAgreement,
124
-                                          HttpServletRequest request) throws Exception{
131
+                                          HttpServletRequest request) throws Exception {
125 132
 
133
+        if (StringUtils.isEmpty(bkAgreement.getBuildingId())) {
134
+            return ResponseBean.error("未绑定楼盘", ResponseBean.ERROR_UNAVAILABLE);
135
+        }
126 136
 
127 137
         BkAgreement origin = iBkAgreementService.getById(id);
128 138
         if (null == bkAgreement || CommConstant.STATUS_DELETE.equals(bkAgreement)) {

+ 62
- 0
src/main/java/com/yunzhi/marketing/borker/controller/BorkerController.java Zobrazit soubor

@@ -0,0 +1,62 @@
1
+package com.yunzhi.marketing.borker.controller;
2
+
3
+import com.yunzhi.marketing.base.BaseController;
4
+import com.yunzhi.marketing.base.ResponseBean;
5
+import com.yunzhi.marketing.borker.entity.BkBankCard;
6
+import com.yunzhi.marketing.borker.service.IBkBankCardService;
7
+import com.yunzhi.marketing.borker.vo.BorkerVO;
8
+import com.yunzhi.marketing.common.CommConstant;
9
+import com.yunzhi.marketing.common.StringUtils;
10
+import com.yunzhi.marketing.entity.TaPerson;
11
+import io.swagger.annotations.Api;
12
+import io.swagger.annotations.ApiOperation;
13
+import io.swagger.annotations.ApiParam;
14
+import org.springframework.beans.BeanUtils;
15
+import org.springframework.beans.factory.annotation.Autowired;
16
+import org.springframework.web.bind.annotation.RequestBody;
17
+import org.springframework.web.bind.annotation.RequestMapping;
18
+import org.springframework.web.bind.annotation.RequestMethod;
19
+import org.springframework.web.bind.annotation.RestController;
20
+
21
+import javax.servlet.http.HttpServletRequest;
22
+
23
+
24
+@Api(tags = "全民经纪人(新联康)")
25
+@RestController
26
+@RequestMapping("/api")
27
+public class BorkerController  extends BaseController {
28
+
29
+    @Autowired
30
+    IBkBankCardService iBkBankCardService;
31
+
32
+
33
+    @RequestMapping(value="/wx/bindBorker",method= RequestMethod.PUT)
34
+    @ApiOperation(value="成为经纪人", notes = "成为经纪人", httpMethod = "PUT", response = ResponseBean.class)
35
+    public ResponseBean bindBorker(@ApiParam("经纪人信息") @RequestBody BorkerVO borkerVO,
36
+                                   HttpServletRequest request) throws Exception {
37
+        String personId = getPersonId(request);
38
+
39
+        borkerVO.setPersonId(personId);
40
+        borkerVO.setPersonType(CommConstant.PERSON_BORKER);
41
+
42
+        TaPerson taPerson = new TaPerson();
43
+
44
+        BeanUtils.copyProperties(borkerVO, taPerson, "bankCardList");
45
+        taPerson.setTotalCommission(null);
46
+        taPerson.setSettledCommission(null);
47
+        taPerson.setUnsettledCommission(null);
48
+
49
+        // 更新数据
50
+        if (!iTaPersonService.updateById(taPerson)) {
51
+
52
+            // 如果是有人推荐的, 那么需要给予推荐人一定的奖励
53
+            if (!StringUtils.isEmpty(borkerVO.getRecommendAgent())) {
54
+                // TODO
55
+            }
56
+
57
+            return ResponseBean.error("操作失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
58
+        }
59
+
60
+        return ResponseBean.success(borkerVO);
61
+    }
62
+}

+ 1
- 1
src/main/java/com/yunzhi/marketing/borker/entity/BkAccountRecord.java Zobrazit soubor

@@ -40,7 +40,7 @@ public class BkAccountRecord implements Serializable {
40 40
     private String buildingId;
41 41
 
42 42
     @ApiModelProperty(value = "楼盘名称")
43
-    private String builidngName;
43
+    private String buildingName;
44 44
 
45 45
     @ApiModelProperty(value = "佣金;单位分")
46 46
     private Integer charges;

+ 6
- 0
src/main/java/com/yunzhi/marketing/borker/entity/BkAgreement.java Zobrazit soubor

@@ -30,6 +30,12 @@ public class BkAgreement implements Serializable {
30 30
     @TableId(value = "rule_id", type = IdType.UUID)
31 31
     private String ruleId;
32 32
 
33
+    @ApiModelProperty(value = "楼盘ID")
34
+    private String buildingId;
35
+
36
+    @ApiModelProperty(value = "楼盘名称")
37
+    private String buildingName;
38
+
33 39
     @ApiModelProperty(value = "规则内容")
34 40
     private String content;
35 41
 

+ 4
- 0
src/main/java/com/yunzhi/marketing/borker/mapper/BkBankCardMapper.java Zobrazit soubor

@@ -3,6 +3,9 @@ package com.yunzhi.marketing.borker.mapper;
3 3
 import com.yunzhi.marketing.borker.entity.BkBankCard;
4 4
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 5
 import org.apache.ibatis.annotations.Mapper;
6
+import org.apache.ibatis.annotations.Param;
7
+
8
+import java.util.List;
6 9
 
7 10
 /**
8 11
  * <p>
@@ -15,4 +18,5 @@ import org.apache.ibatis.annotations.Mapper;
15 18
 @Mapper
16 19
 public interface BkBankCardMapper extends BaseMapper<BkBankCard> {
17 20
 
21
+    List<BkBankCard> getListByBorker(@Param("personId") String personId);
18 22
 }

+ 5
- 0
src/main/java/com/yunzhi/marketing/borker/service/IBkBankCardService.java Zobrazit soubor

@@ -3,6 +3,8 @@ package com.yunzhi.marketing.borker.service;
3 3
 import com.yunzhi.marketing.borker.entity.BkBankCard;
4 4
 import com.baomidou.mybatisplus.extension.service.IService;
5 5
 
6
+import java.util.List;
7
+
6 8
 /**
7 9
  * <p>
8 10
  * 经纪人银行卡信息 服务类
@@ -13,4 +15,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
13 15
  */
14 16
 public interface IBkBankCardService extends IService<BkBankCard> {
15 17
 
18
+    List<BkBankCard> getListByBorker(String personId);
19
+
20
+    boolean mergeList(String personId, List<BkBankCard> bankCardList);
16 21
 }

+ 31
- 0
src/main/java/com/yunzhi/marketing/borker/service/impl/BkBankCardServiceImpl.java Zobrazit soubor

@@ -4,8 +4,13 @@ import com.yunzhi.marketing.borker.entity.BkBankCard;
4 4
 import com.yunzhi.marketing.borker.mapper.BkBankCardMapper;
5 5
 import com.yunzhi.marketing.borker.service.IBkBankCardService;
6 6
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
+import com.yunzhi.marketing.common.CommConstant;
8
+import com.yunzhi.marketing.common.DateUtils;
7 9
 import org.springframework.stereotype.Service;
8 10
 
11
+import java.util.HashMap;
12
+import java.util.List;
13
+
9 14
 /**
10 15
  * <p>
11 16
  * 经纪人银行卡信息 服务实现类
@@ -17,4 +22,30 @@ import org.springframework.stereotype.Service;
17 22
 @Service
18 23
 public class BkBankCardServiceImpl extends ServiceImpl<BkBankCardMapper, BkBankCard> implements IBkBankCardService {
19 24
 
25
+    @Override
26
+    public List<BkBankCard> getListByBorker(String personId) {
27
+        return baseMapper.getListByBorker(personId);
28
+    }
29
+
30
+    @Override
31
+    public boolean mergeList(String personId, List<BkBankCard> bankCardList) {
32
+        // 先删除已有的
33
+        removeByMap(new HashMap<String, Object>(){{
34
+            put("person_id", personId);
35
+        }});
36
+
37
+        // 挨个处理下
38
+        for (BkBankCard item : bankCardList) {
39
+            item.setPersonId(personId);
40
+            if (null == item.getStatus()) {
41
+                item.setStatus(CommConstant.STATUS_NORMAL);
42
+            }
43
+            if (null == item.getCreateDate()) {
44
+                item.setCreateDate(DateUtils.now());
45
+            }
46
+        }
47
+
48
+        // 再插入新的
49
+        return saveBatch(bankCardList);
50
+    }
20 51
 }

+ 64
- 0
src/main/java/com/yunzhi/marketing/borker/vo/BorkerVO.java Zobrazit soubor

@@ -0,0 +1,64 @@
1
+package com.yunzhi.marketing.borker.vo;
2
+
3
+import com.baomidou.mybatisplus.annotation.TableField;
4
+import com.yunzhi.marketing.borker.entity.BkBankCard;
5
+import io.swagger.annotations.ApiModel;
6
+import io.swagger.annotations.ApiModelProperty;
7
+import lombok.Data;
8
+import lombok.EqualsAndHashCode;
9
+import lombok.experimental.Accessors;
10
+
11
+import java.util.List;
12
+
13
+@Data
14
+@EqualsAndHashCode(callSuper = false)
15
+@Accessors(chain = true)
16
+@ApiModel(value="BorkerVO", description="全民经纪人")
17
+public class BorkerVO {
18
+
19
+    @ApiModelProperty("人员ID")
20
+    private String personId;
21
+
22
+    @ApiModelProperty("人员类型")
23
+    private String personType;
24
+
25
+    @ApiModelProperty("头像")
26
+    private String avatarurl;
27
+
28
+    @ApiModelProperty("姓名")
29
+    private String name;
30
+
31
+    @ApiModelProperty("昵称")
32
+    private String nickname;
33
+
34
+    @ApiModelProperty("电话")
35
+    private String phone;
36
+
37
+    @ApiModelProperty("性别")
38
+    private Integer sex;
39
+
40
+    @ApiModelProperty("身份证号")
41
+    private String idNo;
42
+
43
+    @ApiModelProperty("身份证正面")
44
+    private String idcardImg;
45
+
46
+    @ApiModelProperty("身份证反面")
47
+    private String idcardImg2;
48
+
49
+    @ApiModelProperty("推荐人(上家)")
50
+    private String recommendAgent;
51
+
52
+    @ApiModelProperty("总佣金")
53
+    private Integer totalCommission;
54
+
55
+    @ApiModelProperty("已结算佣金")
56
+    private Integer settledCommission;
57
+
58
+    @ApiModelProperty("待结算佣金")
59
+    private Integer unsettledCommission;
60
+
61
+    @TableField(exist = false)
62
+    @ApiModelProperty("银行卡列表")
63
+    List<BkBankCard> bankCardList;
64
+}

+ 5
- 0
src/main/java/com/yunzhi/marketing/common/CommConstant.java Zobrazit soubor

@@ -33,6 +33,11 @@ public class CommConstant {
33 33
      */
34 34
     public final static String PERSON_ESTATE_DRIFT = "drift";
35 35
 
36
+    /**
37
+     * 人员类型: 全民经纪人(新联家)
38
+     */
39
+    public final static String PERSON_BORKER = "borker";
40
+
36 41
     /**
37 42
      * 状态: 正常
38 43
      */

+ 4
- 0
src/main/java/com/yunzhi/marketing/common/DateUtils.java Zobrazit soubor

@@ -114,4 +114,8 @@ public class DateUtils {
114 114
         DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
115 115
         return LocalDateTime.parse(target, df);
116 116
     }
117
+
118
+    public static LocalDateTime now() {
119
+        return LocalDateTime.now(ZoneId.of("Asia/Shanghai"));
120
+    }
117 121
 }

+ 11
- 0
src/main/java/com/yunzhi/marketing/controller/MiniAppController.java Zobrazit soubor

@@ -7,6 +7,8 @@ import com.alibaba.fastjson.JSONObject;
7 7
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
8 8
 import com.yunzhi.marketing.base.BaseController;
9 9
 import com.yunzhi.marketing.base.ResponseBean;
10
+import com.yunzhi.marketing.borker.entity.BkBankCard;
11
+import com.yunzhi.marketing.borker.service.IBkBankCardService;
10 12
 import com.yunzhi.marketing.center.sysUser.service.ISysTokenService;
11 13
 import com.yunzhi.marketing.center.taUser.entity.TaUser;
12 14
 import com.yunzhi.marketing.center.taUser.service.ITaUserService;
@@ -117,6 +119,9 @@ public class MiniAppController extends BaseController {
117 119
     @Autowired
118 120
     public ISysOrgParamsService iSysOrgParamsService;
119 121
 
122
+    @Autowired
123
+    public IBkBankCardService iBkBankCardService;
124
+
120 125
     /**
121 126
      * 验证接入
122 127
      */
@@ -398,6 +403,12 @@ public class MiniAppController extends BaseController {
398 403
             TdCity tdCity = iTdCityService.getLocationCity(location, orgId, taPerson.getPersonId());
399 404
             result.put("city", tdCity);
400 405
 
406
+            // 如果是新联康全民经纪人
407
+            if (CommConstant.PERSON_BORKER.equals(taPerson.getPersonType())) {
408
+                List<BkBankCard> bankCardList = iBkBankCardService.getListByBorker(taPerson.getPersonId());
409
+                result.put("bankCardList", bankCardList);
410
+            }
411
+
401 412
             return ResponseBean.success(result);
402 413
         } catch (WxErrorException e) {
403 414
             System.err.println(e.getError());

+ 19
- 4
src/main/java/com/yunzhi/marketing/controller/TaBuildingController.java Zobrazit soubor

@@ -18,10 +18,7 @@ import com.yunzhi.marketing.service.ITaPersonBuildingService;
18 18
 import com.yunzhi.marketing.service.ITaPersonService;
19 19
 import com.yunzhi.marketing.service.ITaSaveService;
20 20
 import com.yunzhi.marketing.xlk.service.ISceneLogService;
21
-import io.swagger.annotations.Api;
22
-import io.swagger.annotations.ApiImplicitParam;
23
-import io.swagger.annotations.ApiImplicitParams;
24
-import io.swagger.annotations.ApiOperation;
21
+import io.swagger.annotations.*;
25 22
 import org.springframework.beans.factory.annotation.Autowired;
26 23
 import org.springframework.format.annotation.DateTimeFormat;
27 24
 import org.springframework.web.bind.annotation.*;
@@ -348,6 +345,7 @@ public class TaBuildingController extends BaseController {
348 345
 //            @RequestParam(required = false) Integer maxPrice, // 最高价格
349 346
 //            @RequestParam(required = false) Double minBuildingArea, // 最小面积
350 347
 //            @RequestParam(required = false) Double maxBuildingArea, // 最大面积
348
+            @RequestParam(required = false) Boolean isBorker,   // 是否开启全民经纪人
351 349
             HttpServletRequest request
352 350
     ) {
353 351
         Integer orgId = getOrgId(request);
@@ -384,6 +382,7 @@ public class TaBuildingController extends BaseController {
384 382
                 isRecentOpening,
385 383
                 isCommerce,
386 384
                 marketStatus,
385
+                isBorker,
387 386
                 orderBy);
388 387
     }
389 388
 
@@ -534,5 +533,21 @@ public class TaBuildingController extends BaseController {
534 533
         }
535 534
         return responseBean;
536 535
     }
536
+
537
+    @ApiOperation(value = "admin - 开启全民经纪人", notes = "admin - 开启全民经纪人")
538
+    @PutMapping(value = "/admin/marketing/{id}/borker")
539
+    public  ResponseBean switchBorker(@ApiParam("楼盘ID") @PathVariable String id,
540
+                                      @ApiParam(value = "是否开启", allowableValues = "true,false") @RequestParam Boolean on,
541
+                                      HttpServletRequest request) throws Exception {
542
+        TaBuilding taBuilding = taBuildingService.getById(id);
543
+        if (taBuilding == null || CommConstant.STATUS_DELETE.equals(taBuilding.getStatus())) {
544
+            return ResponseBean.error("未找到楼盘", ResponseBean.ERROR_ILLEGAL_PARAMS);
545
+        }
546
+
547
+        taBuilding.setIsBorker(on);
548
+        taBuildingService.updateById(taBuilding);
549
+        return ResponseBean.success("success");
550
+    }
551
+
537 552
 }
538 553
 

+ 3
- 0
src/main/java/com/yunzhi/marketing/entity/TaBuilding.java Zobrazit soubor

@@ -384,6 +384,9 @@ public class TaBuilding implements Serializable {
384 384
     /** 是否文旅商办 */
385 385
     private Integer isRecentOpening ;
386 386
 
387
+    // 是否开启全民经纪人
388
+    private Boolean isBorker;
389
+
387 390
     /**
388 391
      * 项目亮点封面
389 392
      */

+ 18
- 0
src/main/java/com/yunzhi/marketing/entity/TaPerson.java Zobrazit soubor

@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
4 4
 import com.baomidou.mybatisplus.annotation.TableField;
5 5
 import com.baomidou.mybatisplus.annotation.TableId;
6 6
 import com.baomidou.mybatisplus.core.metadata.IPage;
7
+import io.swagger.annotations.ApiModel;
8
+import io.swagger.annotations.ApiModelProperty;
7 9
 import lombok.Data;
8 10
 import lombok.EqualsAndHashCode;
9 11
 import lombok.experimental.Accessors;
@@ -23,6 +25,7 @@ import java.util.List;
23 25
 @Data
24 26
 @EqualsAndHashCode(callSuper = false)
25 27
 @Accessors(chain = true)
28
+@ApiModel(value="TaPerson对象", description="用户表")
26 29
 public class TaPerson implements Serializable {
27 30
 
28 31
     private static final long serialVersionUID = 1L;
@@ -362,4 +365,19 @@ public class TaPerson implements Serializable {
362 365
      */
363 366
     @TableField(exist = false)
364 367
     private String description;
368
+
369
+    @ApiModelProperty("身份证正面")
370
+    private String idcardImg;
371
+
372
+    @ApiModelProperty("身份证反面")
373
+    private String idcardImg2;
374
+
375
+    @ApiModelProperty("总佣金")
376
+    private Integer totalCommission;
377
+
378
+    @ApiModelProperty("已结算佣金")
379
+    private Integer settledCommission;
380
+
381
+    @ApiModelProperty("待结算佣金")
382
+    private Integer unsettledCommission;
365 383
 }

+ 1
- 0
src/main/java/com/yunzhi/marketing/mapper/TaBuildingMapper.java Zobrazit soubor

@@ -86,6 +86,7 @@ public interface TaBuildingMapper extends BaseMapper<TaBuilding> {
86 86
                                          @Param("isRecentOpening") Boolean isRecentOpening,
87 87
                                          @Param("isCommerce") Boolean isCommerce,
88 88
                                          @Param("marketStatus") String marketStatus,
89
+                                         @Param("isBorker") Boolean isBorker,
89 90
                                          @Param("orderBy") String orderBy,
90 91
                                          @Param("buildingAreaLisr") List<String> buildingAreaLisr);
91 92
 

+ 1
- 0
src/main/java/com/yunzhi/marketing/service/ITaBuildingService.java Zobrazit soubor

@@ -137,6 +137,7 @@ public interface ITaBuildingService extends IService<TaBuilding> {
137 137
             Boolean isRecentOpening,
138 138
             Boolean isCommerce,
139 139
             String marketStatus,
140
+            Boolean isBorker,
140 141
             String orderBy);
141 142
 
142 143
     /**

+ 2
- 0
src/main/java/com/yunzhi/marketing/service/impl/TaBuildingServiceImpl.java Zobrazit soubor

@@ -872,6 +872,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
872 872
             Boolean isRecentOpening,
873 873
             Boolean isCommerce,
874 874
             String marketStatus,
875
+            Boolean isBorker,
875 876
             String orderBy) {
876 877
         IPage<TaBuilding> page = new Page<>(pageNum, pageSize);
877 878
 
@@ -932,6 +933,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
932 933
                 isRecentOpening,
933 934
                 isCommerce,
934 935
                 marketStatus,
936
+                isBorker,
935 937
                 orderBy,
936 938
                 buildingAreaLisr);
937 939
 

+ 38
- 15
src/main/java/com/yunzhi/marketing/service/impl/TaRecommendCustomerServiceImpl.java Zobrazit soubor

@@ -646,31 +646,53 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
646 646
     @Override
647 647
     public ResponseBean averageReportCust(AverageReportDTO averageReportDTO) {
648 648
 
649
+        String buildingId = averageReportDTO.getBuildingId();
650
+        String phone = averageReportDTO.getPhone();
651
+
649 652
         // 当前人员
650
-//        TaPerson person = taPersonMapper.getById(averageReportDTO.getPersonId());
653
+        TaPerson person = taPersonMapper.getById(averageReportDTO.getPersonId());
651 654
 
652 655
         // 查询报备客户
653 656
         TaPerson reportPerson = taPersonMapper.getByPhone(averageReportDTO.getPhone());
654 657
 
655 658
         // 先查看在ta_recommend_customer 手机号是否存在
656 659
         LambdaQueryWrapper<TaRecommendCustomer> queryWrapper = new LambdaQueryWrapper<>();
657
-        queryWrapper.eq(TaRecommendCustomer::getPhone,averageReportDTO.getPhone());
658
-        queryWrapper.eq(TaRecommendCustomer::getBuildingId,averageReportDTO.getBuildingId());
660
+        queryWrapper.eq(TaRecommendCustomer::getPhone, phone);
661
+        queryWrapper.eq(TaRecommendCustomer::getBuildingId, buildingId);
659 662
         queryWrapper.isNull(TaRecommendCustomer::getRecommendPerson);
660 663
         List<TaRecommendCustomer> taRecommendCustomers = taRecommendCustomerMapper.selectList(queryWrapper);
661 664
         if (taRecommendCustomers.size() > 0) {
662 665
             return ResponseBean.error("已存在的客户报备失败", ResponseBean.ERROR_UNAVAILABLE);
663 666
         }
664 667
 
665
-        // 查询是否在渠道推荐表中
666
-        LambdaQueryWrapper<ChannelCustomer> channelCustomerLambdaQueryWrapper = new LambdaQueryWrapper<>();
667
-        channelCustomerLambdaQueryWrapper.eq(ChannelCustomer::getBuildingId,averageReportDTO.getBuildingId());
668
-        channelCustomerLambdaQueryWrapper.eq(ChannelCustomer::getPhone,averageReportDTO.getPhone());
669
-        channelCustomerLambdaQueryWrapper.ne(ChannelCustomer::getStatus,"3");
670
-        List<ChannelCustomer> channelCustomers = channelCustomerMapper.selectList(channelCustomerLambdaQueryWrapper);
671
-        List<ChannelCustomer> passCustomer = channelCustomers.stream().filter(e -> "2".equals(e.getStatus())).collect(Collectors.toList());
672
-        if (passCustomer.size() > 0) {
673
-            return ResponseBean.error("此用户已经被报备", ResponseBean.ERROR_UNAVAILABLE);
668
+
669
+        // 如果是全民经纪人
670
+        if (CommConstant.PERSON_BORKER.equals(person.getPersonType())) {
671
+            TaBuilding taBuilding = taBuildingMapper.selectById(buildingId);
672
+            if (null == taBuilding || CommConstant.STATUS_DELETE.equals(taBuilding.getStatus())) {
673
+                return ResponseBean.error("推荐楼盘不存在", ResponseBean.ERROR_ILLEGAL_PARAMS);
674
+            }
675
+
676
+            if (null == taBuilding.getIsBorker() || !taBuilding.getIsBorker()) {
677
+                return ResponseBean.error("推荐楼盘未开启经纪人推荐", ResponseBean.ERROR_ILLEGAL_PARAMS);
678
+            }
679
+
680
+            // 查询在保护期的人员
681
+            List<ChannelCustomer> list = channelCustomerMapper.getRecommendedOrExpired(buildingId, phone);
682
+            if (null != list && list.size() > 0) {
683
+                return ResponseBean.error("此用户已经被报备", ResponseBean.ERROR_ILLEGAL_PARAMS);
684
+            }
685
+        } else {
686
+            // 查询是否在渠道推荐表中
687
+            LambdaQueryWrapper<ChannelCustomer> channelCustomerLambdaQueryWrapper = new LambdaQueryWrapper<>();
688
+            channelCustomerLambdaQueryWrapper.eq(ChannelCustomer::getBuildingId, buildingId);
689
+            channelCustomerLambdaQueryWrapper.eq(ChannelCustomer::getPhone, phone);
690
+            channelCustomerLambdaQueryWrapper.ne(ChannelCustomer::getStatus,"3");
691
+            List<ChannelCustomer> channelCustomers = channelCustomerMapper.selectList(channelCustomerLambdaQueryWrapper);
692
+            List<ChannelCustomer> passCustomer = channelCustomers.stream().filter(e -> "2".equals(e.getStatus())).collect(Collectors.toList());
693
+            if (passCustomer.size() > 0) {
694
+                return ResponseBean.error("此用户已经被报备", ResponseBean.ERROR_UNAVAILABLE);
695
+            }
674 696
         }
675 697
 
676 698
         // 入渠道推荐客户表
@@ -679,17 +701,18 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
679 701
             channelCustomer.setPersonId(reportPerson.getPersonId());
680 702
         }
681 703
 
682
-        channelCustomer.setBuildingId(averageReportDTO.getBuildingId());
704
+        channelCustomer.setBuildingId(buildingId);
683 705
         channelCustomer.setName(averageReportDTO.getName());
684 706
         channelCustomer.setPicture(averageReportDTO.getPicture());
685
-        channelCustomer.setPhone(averageReportDTO.getPhone());
707
+        channelCustomer.setPhone(phone);
686 708
         channelCustomer.setSex(averageReportDTO.getSex());
687 709
         channelCustomer.setRecommendPerson(averageReportDTO.getPersonId());
710
+        channelCustomer.setRecommendPersonType(person.getPersonType());
688 711
         channelCustomer.setCreateDate(LocalDateTime.now());
689 712
         channelCustomer.setStatus("1");
690 713
         channelCustomer.setRealtyConsultant(averageReportDTO.getRealtyConsultant());
691 714
         channelCustomer.setOrgId(averageReportDTO.getOrgId());
692
-        channelCustomer.setInstitutionId(getInstitutionId(averageReportDTO.getBuildingId()));
715
+        channelCustomer.setInstitutionId(getInstitutionId(buildingId));
693 716
         channelCustomerMapper.insert(channelCustomer);
694 717
         return ResponseBean.success(channelCustomer);
695 718
     }

+ 3
- 0
src/main/java/com/yunzhi/marketing/xlk/entity/ChannelCustomer.java Zobrazit soubor

@@ -102,6 +102,9 @@ public class ChannelCustomer implements Serializable {
102 102
      */
103 103
     private String recommendPerson;
104 104
 
105
+    // 推荐人身份类型
106
+    private String recommendPersonType;
107
+
105 108
     /**
106 109
      * 状态 1是审核中 2是审核通过 3是审核不通过
107 110
      */

+ 2
- 0
src/main/java/com/yunzhi/marketing/xlk/mapper/ChannelCustomerMapper.java Zobrazit soubor

@@ -58,4 +58,6 @@ public interface ChannelCustomerMapper extends BaseMapper<ChannelCustomer> {
58 58
     List<CustomerDetailVO> getSuccessCustomerDetail(@Param("params") StatisticsDTO statisticsDTo);
59 59
 
60 60
     ChannelCustomer getMoreInfoById(String id);
61
+
62
+    List<ChannelCustomer> getRecommendedOrExpired(@Param("buildingId") String buildingId,@Param("phone") String phone);
61 63
 }

+ 11
- 0
src/main/resources/mapper/BkBankCardMapper.xml Zobrazit soubor

@@ -2,4 +2,15 @@
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3
 <mapper namespace="com.yunzhi.marketing.borker.mapper.BkBankCardMapper">
4 4
 
5
+    <select id="getListByBorker" resultType="com.yunzhi.marketing.borker.entity.BkBankCard">
6
+        SELECT
7
+            *
8
+        FROM
9
+            bk_bank_card t
10
+        WHERE
11
+            t.person_id = #{personId}
12
+          AND t.`status` &gt; -1
13
+        ORDER BY
14
+            t.create_date DESC
15
+    </select>
5 16
 </mapper>

+ 3
- 0
src/main/resources/mapper/TaBuildingMapper.xml Zobrazit soubor

@@ -135,6 +135,9 @@
135 135
                 <if test="isCommerce != null and isCommerce">
136 136
                     AND is_commerce = 1
137 137
                 </if>
138
+                <if test="isBorker != null and isBorker">
139
+                    AND is_borker = 1
140
+                </if>
138 141
                 <if test="isRecentOpening != null and isRecentOpening">
139 142
                     AND is_recent_opening = 1
140 143
                 </if>

src/main/resources/mapper/TaMiniappTheme.xml → src/main/resources/mapper/TaMiniappThemeMapper.xml Zobrazit soubor

@@ -1,5 +1,5 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
-<mapper namespace="com.yunzhi.marketing.entity.TaMiniappTheme">
3
+<mapper namespace="com.yunzhi.marketing.mapper.TaMiniappThemeMapper">
4 4
 
5 5
 </mapper>

+ 21
- 0
src/main/resources/mapper/xlk/ChannelCustomerMapper.xml Zobrazit soubor

@@ -193,4 +193,25 @@
193 193
         WHERE
194 194
             t.channel_customer_id = #{id}
195 195
     </select>
196
+    <select id="getRecommendedOrExpired" resultType="com.yunzhi.marketing.xlk.entity.ChannelCustomer">
197
+        SELECT
198
+            t.*
199
+        FROM
200
+            xlk_channel_customer t
201
+        LEFT JOIN xlk_building_channel s ON t.building_id = s.building_id
202
+            AND s.channel_id IS NOT NULL
203
+            AND t.channel_id = s.channel_id
204
+        LEFT JOIN bk_agreement m ON t.building_id = s.building_id
205
+            AND s.channel_id IS NULL
206
+        WHERE
207
+            t.building_id = #{buildingId}
208
+            AND t.phone = #{phone}
209
+            AND (
210
+                t.`status` = 2
211
+                OR (
212
+                    t.`status` = 1
213
+                    AND IFNULL( s.expiration_date, IFNULL( m.expiration_days, 0 ) ) &lt;= TIMESTAMPDIFF( DAY, t.create_date, now( ) )
214
+                )
215
+            )
216
+    </select>
196 217
 </mapper>