张延森 vor 2 Jahren
Ursprung
Commit
9312d7c9a0

+ 3
- 0
src/main/java/com/yunzhi/marketing/broker/vo/BrokerSummery.java Datei anzeigen

@@ -41,4 +41,7 @@ public class BrokerSummery {
41 41
 
42 42
     @ApiModelProperty("总佣金")
43 43
     private Integer totalCommission;
44
+
45
+    @ApiModelProperty("总推荐金额")
46
+    private Integer referralFee;
44 47
 }

+ 14
- 3
src/main/java/com/yunzhi/marketing/xlk/service/impl/ChannelCustomerServiceImpl.java Datei anzeigen

@@ -218,6 +218,7 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
218 218
                     changeNotice.setCustomerName(customer.getName());
219 219
                     changeNotice.setNoticeType(CommConstant.NOTICE_TYPE_STATUS_CHANGE);
220 220
                     changeNotice.setContent("状态 到访");
221
+                    bkNoticeMapper.insert(changeNotice);
221 222
                 }
222 223
             }
223 224
             customerVisit.setRealtyConsultant(params.getRealtyConsultant());
@@ -422,6 +423,7 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
422 423
                 changeNotice.setCustomerName(customer.getName());
423 424
                 changeNotice.setNoticeType(CommConstant.NOTICE_TYPE_STATUS_CHANGE);
424 425
                 changeNotice.setContent("状态 认筹");
426
+                bkNoticeMapper.insert(changeNotice);
425 427
             }
426 428
         }
427 429
 
@@ -656,9 +658,14 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
656 658
         return i == null ? 0 : i;
657 659
     }
658 660
 
659
-    private void processCommission(MarkingSignatoryCustomerDTO params, ChannelCustomer customer, TaPerson recommendPerson, String bizType, TaBuilding taBuilding) {
661
+    private void processCommission(MarkingSignatoryCustomerDTO params, ChannelCustomer customer, TaPerson recommendPerson, String bizType, TaBuilding taBuilding) throws Exception {
660 662
         if (null == recommendPerson) return;
661 663
 
664
+        // 校验数据, 总佣金 - 已结 < 当前结算
665
+        if (intIfNvl(params.getTotalCommission()) - intIfNvl(params.getSettledCommission()) < intIfNvl(params.getCurrentCommission())) {
666
+            throw new Exception("结算佣金填写错误");
667
+        }
668
+
662 669
         // 为了防止数据有改动, 比如更新操作
663 670
         // 那么需要把原来的值减掉,再使用新的值
664 671
         Integer totalCommission = intIfNvl(recommendPerson.getTotalCommission()) -
@@ -699,7 +706,8 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
699 706
         }
700 707
 
701 708
         // 生成成交喜报
702
-        BkNotice bkNotice = bkNoticeMapper.getByPerson(CommConstant.NOTICE_TYPE_DEAL, recommendPerson.getName(), customer.getCustomerId());
709
+        BkNotice bkNotice = bkNoticeMapper.getByPerson(CommConstant.NOTICE_TYPE_DEAL, recommendPerson.getPersonId(), customer.getCustomerId());
710
+        String content = String.format("佣金 %.2f 元", (float) intIfNvl(params.getTotalCommission()) / 100 );
703 711
         if (null == bkNotice) {
704 712
             bkNotice = new BkNotice();
705 713
             bkNotice.setOrgId(taBuilding.getOrgId().toString());
@@ -712,8 +720,11 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
712 720
             bkNotice.setCustomerName(customer.getName());
713 721
             // 佣金消息
714 722
             bkNotice.setNoticeType(CommConstant.NOTICE_TYPE_DEAL);
715
-            bkNotice.setContent(String.format("佣金 %.2f 元", (float) intIfNvl(params.getTotalCommission()) / 100 ));
723
+            bkNotice.setContent(content);
716 724
             bkNoticeMapper.insert(bkNotice);
725
+        } else {
726
+            bkNotice.setContent(content);
727
+            bkNoticeMapper.updateById(bkNotice);
717 728
         }
718 729
     }
719 730
 

+ 1
- 1
src/main/resources/mapper/BkAccountRecordMapper.xml Datei anzeigen

@@ -21,7 +21,7 @@
21 21
             bk_account_record t
22 22
         WHERE
23 23
             t.channel_customer_id = #{channelCustomerId}
24
-            AND t.charge_code != #{chargeCode}
24
+            AND t.charge_code = #{chargeCode}
25 25
             AND t.`status` &gt; -1
26 26
     </select>
27 27
 </mapper>

+ 6
- 2
src/main/resources/mapper/TaPersonMapper.xml Datei anzeigen

@@ -759,7 +759,9 @@ FROM
759 759
                     ta_person a
760 760
                 WHERE
761 761
                     a.person_type = #{personType}
762
-                  AND a.`status` > - 1
762
+                  AND a.`status` &gt; - 1
763
+                GROUP BY
764
+                    a.recommend_person
763 765
             ) m ON m.recommend_agent = t.person_id
764 766
         WHERE t.person_type = #{personType}
765 767
           AND t.`status` &gt; -1
@@ -799,7 +801,9 @@ FROM
799 801
                     ta_person a
800 802
                 WHERE
801 803
                     a.person_type = #{personType}
802
-                  AND a.`status` > - 1
804
+                  AND a.`status` &gt; - 1
805
+                GROUP BY
806
+                    a.recommend_person
803 807
             ) m ON m.recommend_agent = t.person_id
804 808
         WHERE
805 809
             t.person_id = #{personId}