张延森 2 년 전
부모
커밋
a84b88c5e4

+ 18
- 3
src/main/java/com/yunzhi/marketing/broker/entity/BkNotice.java 파일 보기

@@ -27,14 +27,29 @@ public class BkNotice implements Serializable {
27 27
     private static final long serialVersionUID = 1L;
28 28
 
29 29
     @ApiModelProperty(value = "公告ID")
30
-    @TableId(value = "notice_id", type = IdType.INPUT)
31
-    private String noticeId;
30
+    @TableId(value = "notice_id", type = IdType.AUTO)
31
+    private Integer noticeId;
32
+
33
+    @ApiModelProperty(value = "消息类型")
34
+    private String noticeType;
32 35
 
33 36
     @ApiModelProperty(value = "楼盘ID")
34 37
     private String buildingId;
35 38
 
36 39
     @ApiModelProperty(value = "楼盘名称")
37
-    private String builidngName;
40
+    private String buildingName;
41
+
42
+    @ApiModelProperty(value = "经纪人ID")
43
+    private String personId;
44
+
45
+    @ApiModelProperty(value = "经纪人名称")
46
+    private String personName;
47
+
48
+    @ApiModelProperty(value = "客户ID")
49
+    private String customerId;
50
+
51
+    @ApiModelProperty(value = "客户名称")
52
+    private String customerName;
38 53
 
39 54
     @ApiModelProperty(value = "公告内容")
40 55
     private String content;

+ 4
- 0
src/main/java/com/yunzhi/marketing/broker/mapper/BkNoticeMapper.java 파일 보기

@@ -3,6 +3,7 @@ package com.yunzhi.marketing.broker.mapper;
3 3
 import com.yunzhi.marketing.broker.entity.BkNotice;
4 4
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 5
 import org.apache.ibatis.annotations.Mapper;
6
+import org.apache.ibatis.annotations.Param;
6 7
 
7 8
 /**
8 9
  * <p>
@@ -15,4 +16,7 @@ import org.apache.ibatis.annotations.Mapper;
15 16
 @Mapper
16 17
 public interface BkNoticeMapper extends BaseMapper<BkNotice> {
17 18
 
19
+    BkNotice getByPerson(@Param("noticeType") String noticeType,
20
+                         @Param("personId") String personId,
21
+                         @Param("customerId") String customerId);
18 22
 }

+ 7
- 2
src/main/java/com/yunzhi/marketing/common/CommConstant.java 파일 보기

@@ -958,8 +958,8 @@ public class CommConstant {
958 958
      * 课程授权人员类型
959 959
      */
960 960
     public static final String CURRICULUM_TYPE_AGENT = "1";
961
-    public static final String CURRICULUM_TYPE_COUSULTANT = "2";
962
-    public static final String CURRICULUM_TYPE_COUSULTANT_AND_AGENT = "3";
961
+    public static final String CURRICULUM_TYPE_CONSULTANT = "2";
962
+    public static final String CURRICULUM_TYPE_CONSULTANT_AND_AGENT = "3";
963 963
 
964 964
     /**
965 965
      * 渠道报备客户审核结果
@@ -971,5 +971,10 @@ public class CommConstant {
971 971
      * 根机构ID
972 972
      */
973 973
     public static final String ROOT_INSTITUTION = "1"; // 原来是 01 估计是个 bug
974
+
975
+    /** 成交喜报 **/
976
+    public static final String NOTICE_TYPE_DEAL = "deal";
977
+    /** 客户状态变成 **/
978
+    public static final String NOTICE_TYPE_STATUS_CHANGE = "status-change";
974 979
 }
975 980
 

+ 2
- 2
src/main/java/com/yunzhi/marketing/xlk/controller/CurriculumController.java 파일 보기

@@ -298,9 +298,9 @@ public class CurriculumController extends BaseController {
298 298
         }
299 299
 
300 300
         switch (requireRole) {
301
-            case CommConstant.CURRICULUM_TYPE_COUSULTANT_AND_AGENT:
301
+            case CommConstant.CURRICULUM_TYPE_CONSULTANT_AND_AGENT:
302 302
                 return CommConstant.PERSON_ESTATE_CHANNEL.equals(personType) || CommConstant.PERSON_REALTY_CONSULTANT.equals(personType);
303
-            case CommConstant.CURRICULUM_TYPE_COUSULTANT:
303
+            case CommConstant.CURRICULUM_TYPE_CONSULTANT:
304 304
                 return CommConstant.PERSON_REALTY_CONSULTANT.equals(personType);
305 305
             case CommConstant.CURRICULUM_TYPE_AGENT:
306 306
                 return CommConstant.PERSON_ESTATE_CHANNEL.equals(personType);

+ 52
- 0
src/main/java/com/yunzhi/marketing/xlk/service/impl/ChannelCustomerServiceImpl.java 파일 보기

@@ -8,9 +8,11 @@ import com.yunzhi.marketing.base.ResponseBean;
8 8
 import com.yunzhi.marketing.broker.entity.BkAccountRecord;
9 9
 import com.yunzhi.marketing.broker.entity.BkAgentRule;
10 10
 import com.yunzhi.marketing.broker.entity.BkInviteRecord;
11
+import com.yunzhi.marketing.broker.entity.BkNotice;
11 12
 import com.yunzhi.marketing.broker.mapper.BkAccountRecordMapper;
12 13
 import com.yunzhi.marketing.broker.mapper.BkAgentRuleMapper;
13 14
 import com.yunzhi.marketing.broker.mapper.BkInviteRecordMapper;
15
+import com.yunzhi.marketing.broker.mapper.BkNoticeMapper;
14 16
 import com.yunzhi.marketing.center.taUser.entity.TaUser;
15 17
 import com.yunzhi.marketing.center.taUser.mapper.TaUserMapper;
16 18
 import com.yunzhi.marketing.common.CommConstant;
@@ -81,6 +83,9 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
81 83
     @Autowired
82 84
     private BkAccountRecordMapper bkAccountRecordMapper;
83 85
 
86
+    @Autowired
87
+    private BkNoticeMapper bkNoticeMapper;
88
+
84 89
     /**
85 90
      * 审核
86 91
      *
@@ -632,6 +637,39 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
632 637
             bkAccountRecord.setCreateDate(LocalDateTime.now());
633 638
             bkAccountRecordMapper.insert(bkAccountRecord);
634 639
         }
640
+
641
+        // 生成节点变更通知
642
+        BkNotice changeNotice = new BkNotice();
643
+        changeNotice.setOrgId(taBuilding.getOrgId().toString());
644
+        changeNotice.setInstitutionId(taBuilding.getInstitutionId());
645
+        changeNotice.setBuildingId(taBuilding.getBuildingId());
646
+        changeNotice.setBuildingName(taBuilding.getBuildingName());
647
+        changeNotice.setPersonId(recommendPerson.getPersonId());
648
+        changeNotice.setPersonName(StringUtils.ifNull(recommendPerson.getName(), recommendPerson.getNickname()));
649
+        changeNotice.setCustomerId(customer.getCustomerId());
650
+        changeNotice.setCustomerName(customer.getName());
651
+        changeNotice.setNoticeType(CommConstant.NOTICE_TYPE_STATUS_CHANGE);
652
+        changeNotice.setContent(String.format("状态 %s", getStatusDesc(bizType)));
653
+        bkNoticeMapper.insert(changeNotice);
654
+
655
+
656
+        // 生成成交喜报
657
+        BkNotice bkNotice = bkNoticeMapper.getByPerson(CommConstant.NOTICE_TYPE_DEAL, recommendPerson.getName(), customer.getCustomerId());
658
+        if (null == bkNotice) {
659
+            bkNotice = new BkNotice();
660
+            bkNotice.setOrgId(taBuilding.getOrgId().toString());
661
+            bkNotice.setInstitutionId(taBuilding.getInstitutionId());
662
+            bkNotice.setBuildingId(taBuilding.getBuildingId());
663
+            bkNotice.setBuildingName(taBuilding.getBuildingName());
664
+            bkNotice.setPersonId(recommendPerson.getPersonId());
665
+            bkNotice.setPersonName(StringUtils.ifNull(recommendPerson.getName(), recommendPerson.getNickname()));
666
+            bkNotice.setCustomerId(customer.getCustomerId());
667
+            bkNotice.setCustomerName(customer.getName());
668
+            // 佣金消息
669
+            bkNotice.setNoticeType(CommConstant.NOTICE_TYPE_DEAL);
670
+            bkNotice.setContent(String.format("佣金 %d", params.getTotalCommission()));
671
+            bkNoticeMapper.insert(bkNotice);
672
+        }
635 673
     }
636 674
 
637 675
     /**
@@ -660,5 +698,19 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
660 698
 
661 699
         bkInviteRecord.setReferralFee(agentRule.getReferralFee());
662 700
         bkInviteRecordMapper.updateById(bkInviteRecord);
701
+
702
+    }
703
+
704
+    private String getStatusDesc(String bizType) {
705
+        switch (bizType) {
706
+            case "commission":
707
+                return "结佣";
708
+            case "signatory":
709
+                return "签约";
710
+            case "all-payment":
711
+                return "全款到账";
712
+            default:
713
+                return "未知";
714
+        }
663 715
     }
664 716
 }

+ 3
- 3
src/main/java/com/yunzhi/marketing/xlk/service/impl/CurriculumServiceImpl.java 파일 보기

@@ -44,11 +44,11 @@ public class CurriculumServiceImpl extends ServiceImpl<CurriculumMapper, Curricu
44 44
     public IPage<Curriculum> getWxList(IPage<Curriculum> pg, String name, TaPerson person) {
45 45
         List<String> roleList = new ArrayList<>();
46 46
         if (CommConstant.PERSON_REALTY_CONSULTANT.equals(person.getPersonType())) {
47
-            roleList.add(CommConstant.CURRICULUM_TYPE_COUSULTANT);
48
-            roleList.add(CommConstant.CURRICULUM_TYPE_COUSULTANT_AND_AGENT);
47
+            roleList.add(CommConstant.CURRICULUM_TYPE_CONSULTANT);
48
+            roleList.add(CommConstant.CURRICULUM_TYPE_CONSULTANT_AND_AGENT);
49 49
         } else if (CommConstant.PERSON_ESTATE_CHANNEL.equals(person.getPersonType())) {
50 50
             roleList.add(CommConstant.CURRICULUM_TYPE_AGENT);
51
-            roleList.add(CommConstant.CURRICULUM_TYPE_COUSULTANT_AND_AGENT);
51
+            roleList.add(CommConstant.CURRICULUM_TYPE_CONSULTANT_AND_AGENT);
52 52
         } else {
53 53
             roleList.add("*");
54 54
         }

+ 10
- 0
src/main/resources/mapper/BkNoticeMapper.xml 파일 보기

@@ -2,4 +2,14 @@
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.broker.mapper.BkNoticeMapper">
4 4
 
5
+    <select id="getByPerson" resultType="com.yunzhi.marketing.broker.entity.BkNotice">
6
+        SELECT
7
+            *
8
+        FROM
9
+            bk_notice t
10
+        WHERE
11
+            t.notice_type = #{noticeType}
12
+          AND t.person_id = #{personId}
13
+          AND t.customer_id = #{customerId}
14
+    </select>
5 15
 </mapper>