From 9b031f73bb54f553421718c682cb2b9c6935ca42 Mon Sep 17 00:00:00 2001 From: yuan <1551130722@qq.com> Date: Thu, 5 Jul 2018 10:07:16 +0800 Subject: [PATCH 1/8] fix BD Commissions --- .../manage/bdprize/core/BDPrizeService.java | 2 + .../core/impls/BDPrizeServiceImpl.java | 9 +- .../impls/BDPrizeCalculatorDefaultImpl.java | 1 + .../manage/bdprize/web/BDPrizeController.java | 5 + .../FinancialBDPrizeRecordMapper.xml | 2 +- .../manage/mappers/system/ClientBDMapper.xml | 3 +- src/main/ui/static/config/bdprize/bdprize.js | 31 ++++- .../bd_commission_config_dialog.html | 126 +++++++++++------- .../templates/bd_prize_month_report.html | 4 +- .../bdprize/templates/bd_prize_root.html | 6 +- .../bdprize/templates/rate_config_dialog.html | 8 +- 11 files changed, 137 insertions(+), 60 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/bdprize/core/BDPrizeService.java b/src/main/java/au/com/royalpay/payment/manage/bdprize/core/BDPrizeService.java index 3277fd49e..253fdd539 100644 --- a/src/main/java/au/com/royalpay/payment/manage/bdprize/core/BDPrizeService.java +++ b/src/main/java/au/com/royalpay/payment/manage/bdprize/core/BDPrizeService.java @@ -38,4 +38,6 @@ public interface BDPrizeService { void insertOrUpdateCommissionConfig(String month, List config, JSONObject manager) throws ParseException; void deleteCommConfig(String config_id); + + void updateBdKpiConfig(List configs, JSONObject manager)throws ParseException; } diff --git a/src/main/java/au/com/royalpay/payment/manage/bdprize/core/impls/BDPrizeServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/bdprize/core/impls/BDPrizeServiceImpl.java index 7d3d47954..1e5f81f2b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/bdprize/core/impls/BDPrizeServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/bdprize/core/impls/BDPrizeServiceImpl.java @@ -418,5 +418,12 @@ public class BDPrizeServiceImpl implements BDPrizeService { return firLasDay; } - + @Override + public void updateBdKpiConfig(List configs, JSONObject manager) throws ParseException { + for (JSONObject config : configs){ + config.put("LAST_UPDATE_DATE", new Date()); + config.put("LAST_UPDATE_BY", manager.getString("display_name")); + financialBDConfigMapper.updateBDConfig(config); + } + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/bdprize/support/impls/BDPrizeCalculatorDefaultImpl.java b/src/main/java/au/com/royalpay/payment/manage/bdprize/support/impls/BDPrizeCalculatorDefaultImpl.java index 6980fa099..b9033b60d 100644 --- a/src/main/java/au/com/royalpay/payment/manage/bdprize/support/impls/BDPrizeCalculatorDefaultImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/bdprize/support/impls/BDPrizeCalculatorDefaultImpl.java @@ -81,6 +81,7 @@ public class BDPrizeCalculatorDefaultImpl implements BDPrizeCalculator { JSONObject bd = bdMap.get(resultItem.getKey()); int bdLevel = bd.getIntValue("bd_level"); log.put("bd_level", bdLevel); + log.put("kpi_amount", bd.getBigDecimal("kpi_amount")); log.put("bd_name", bd.getString("bd_name")); log.put("total_amount", 0); log.put("total_prize", 0); diff --git a/src/main/java/au/com/royalpay/payment/manage/bdprize/web/BDPrizeController.java b/src/main/java/au/com/royalpay/payment/manage/bdprize/web/BDPrizeController.java index bc5485c30..65c96b428 100644 --- a/src/main/java/au/com/royalpay/payment/manage/bdprize/web/BDPrizeController.java +++ b/src/main/java/au/com/royalpay/payment/manage/bdprize/web/BDPrizeController.java @@ -92,4 +92,9 @@ public class BDPrizeController { public List newCommissionConfig(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) throws ParseException { return bdPrizeService.listNeedConfigCommission(); } + + @ManagerMapping(value = "/commission/kpi/update/{month}",method = RequestMethod.POST, role = {ManagerRole.FINANCIAL_STAFF, ManagerRole.ADMIN}) + public void updatKpiConfig(@PathVariable String month , @RequestBody List info , @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) throws ParseException { + bdPrizeService.updateBdKpiConfig(info,manager); + } } diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/financial/FinancialBDPrizeRecordMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/financial/FinancialBDPrizeRecordMapper.xml index 63430d2be..24f56ef19 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/financial/FinancialBDPrizeRecordMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/financial/FinancialBDPrizeRecordMapper.xml @@ -8,7 +8,7 @@ - ~ - - - - -
- - % -
- - - - - - - - - - -
- - + + + +
+ + + + + + + + + + + + + + + + + +
Commission AmountCommission RateBD Type + +
+
+ + ~ + +
+
+
+ + % +
+
+ + + +
+
+ +
+
+ + + + + + + + + + + + + + +
BD NameKPI Amount
+ +
+
+ +
+
+ \ No newline at end of file diff --git a/src/main/ui/static/config/bdprize/templates/bd_prize_month_report.html b/src/main/ui/static/config/bdprize/templates/bd_prize_month_report.html index 7734b95f5..fb3cbaf97 100644 --- a/src/main/ui/static/config/bdprize/templates/bd_prize_month_report.html +++ b/src/main/ui/static/config/bdprize/templates/bd_prize_month_report.html @@ -79,6 +79,7 @@ BD Name + KPI BD Level Transaction Amount Total Commission @@ -90,9 +91,10 @@ {{log.bd_name}} + {{log.kpi_amount}} {{log.bd_name}} (Left Company) - + {{log.total_amount|currency:'AUD '}} (({{log.total_amount}}/{{log.kpi_amount}})|percentage) diff --git a/src/main/ui/static/config/bdprize/templates/bd_prize_root.html b/src/main/ui/static/config/bdprize/templates/bd_prize_root.html index 460135274..453417d77 100644 --- a/src/main/ui/static/config/bdprize/templates/bd_prize_root.html +++ b/src/main/ui/static/config/bdprize/templates/bd_prize_root.html @@ -36,15 +36,15 @@ diff --git a/src/main/ui/static/config/bdprize/templates/rate_config_dialog.html b/src/main/ui/static/config/bdprize/templates/rate_config_dialog.html index f35ca90d7..1366d6ca1 100644 --- a/src/main/ui/static/config/bdprize/templates/rate_config_dialog.html +++ b/src/main/ui/static/config/bdprize/templates/rate_config_dialog.html @@ -14,6 +14,12 @@ + +
+ + +
@@ -24,7 +30,7 @@ - + - +
{{rate.rate_from}}-{{rate.rate_to}}
From ac40e858da1b675888577506fd50268a2720f174 Mon Sep 17 00:00:00 2001 From: eason Date: Thu, 5 Jul 2018 19:23:14 +0800 Subject: [PATCH 2/8] fix bd commission --- .../core/impls/BDPrizeServiceImpl.java | 62 ++++++++++++++----- .../impls/BDPrizeCalculatorDefaultImpl.java | 47 ++++++++++++-- .../mappers/payment/TransactionMapper.java | 2 + .../mappers/payment/TransactionMapper.xml | 29 +++++++-- 4 files changed, 116 insertions(+), 24 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/bdprize/core/impls/BDPrizeServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/bdprize/core/impls/BDPrizeServiceImpl.java index 1e5f81f2b..d9f54108c 100644 --- a/src/main/java/au/com/royalpay/payment/manage/bdprize/core/impls/BDPrizeServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/bdprize/core/impls/BDPrizeServiceImpl.java @@ -78,7 +78,7 @@ public class BDPrizeServiceImpl implements BDPrizeService { private static BigDecimal percent = new BigDecimal(100); - private static String[] channels = new String[]{"Wechat", "Alipay", "Bestpay", "jd", "AlipayOnline"}; + private static String[] channels = new String[]{"Wechat", "Alipay", "Bestpay", "jd", "AlipayOnline","hf"}; @Override public void generateRecord() { @@ -133,10 +133,14 @@ public class BDPrizeServiceImpl implements BDPrizeService { } } //BD Leader Prize + //bd_type:1 销售总监 2 大客户经理 3悉尼分公司经理 4 COO 5 NGDepartment + //todo 10月开始悉尼分公司经理不享受悉尼销售组提成 List bdLeaders = managerMapper.listByRole(1, ManagerRole.BD_LEADER.getMask()); for (JSONObject leader : bdLeaders) { BigDecimal groupAmount = transactionMapper.TotalAmountForBDLeaderPrize(now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1,leader.getString("manager_id")); - JSONObject rateJson = financialBDCommissionConfigMapper.findCurrentCommissionRate(month, groupAmount.toString(), 1); + JSONObject bdConfig = financialBDConfigMapper.getBdConfig(leader.getString("manager_id")); + int bd_type = ("Sydney").equals(bdConfig.getString("city"))?2:1;//sydney leader 即悉尼大客户经理 + JSONObject rateJson = financialBDCommissionConfigMapper.findCurrentCommissionRate(month, groupAmount.toString(), bd_type); BigDecimal groupPrize = new BigDecimal(0); if (rateJson != null) { groupPrize = groupAmount.multiply(new BigDecimal(rateJson.getString("commission_rate")).divide(percent)).setScale(2, BigDecimal.ROUND_DOWN); @@ -212,28 +216,44 @@ public class BDPrizeServiceImpl implements BDPrizeService { DateTime monthDate = new DateTime(month); //bd manager commission - JSONObject cityPrizeLog = new JSONObject(); - cityPrizeLog.put("total_amount", cplTotalprize); - JSONObject cplRate = financialBDCommissionConfigMapper.findCurrentCommissionRate(month, cplTotalprize.toString(), 2); - if (cplRate == null) { - cityPrizeLog.put("total_prize", 0.00); +// JSONObject cityPrizeLog = new JSONObject(); +// cityPrizeLog.put("total_amount", cplTotalprize); +// JSONObject cplRate = financialBDCommissionConfigMapper.findCurrentCommissionRate(month, cplTotalprize.toString(), 2); +// if (cplRate == null) { +// cityPrizeLog.put("total_prize", 0.00); +// } else { +// BigDecimal _commission_rate = new BigDecimal(cplRate.getString("commission_rate")); +// BigDecimal _total_amount = new BigDecimal(cityPrizeLog.getString("total_amount")); +// BigDecimal total_prize = _total_amount.multiply(_commission_rate.divide(percent)).setScale(2, BigDecimal.ROUND_DOWN); +// cityPrizeLog.put("total_prize", total_prize); +// } +// report.put("cityPrizeLogs", cityPrizeLog); + + //bd_type=3 悉尼分公司经理 悉尼销售组和大客户组流水提成 + + JSONObject sydneyPrizeLog = new JSONObject(); + BigDecimal sydneyAmount = transactionMapper.TotalAmountForSydneyGMPrize(monthDate.getYear(), monthDate.getMonthOfYear()); + sydneyPrizeLog.put("total_amount",sydneyAmount); + JSONObject sydneyGMRate = financialBDCommissionConfigMapper.findCurrentCommissionRate(month, sydneyAmount.toString(), 3); + if (sydneyGMRate == null) { + sydneyPrizeLog.put("total_prize", 0.00); } else { - BigDecimal _commission_rate = new BigDecimal(cplRate.getString("commission_rate")); - BigDecimal _total_amount = new BigDecimal(cityPrizeLog.getString("total_amount")); - BigDecimal total_prize = _total_amount.multiply(_commission_rate.divide(percent)).setScale(2, BigDecimal.ROUND_DOWN); - cityPrizeLog.put("total_prize", total_prize); + BigDecimal sydney_commission_rate = new BigDecimal(sydneyGMRate.getString("commission_rate")); + BigDecimal total_prize = sydneyAmount.multiply(sydney_commission_rate.divide(percent)).setScale(2, BigDecimal.ROUND_DOWN); + sydneyPrizeLog.put("total_prize", total_prize); } - report.put("cityPrizeLogs", cityPrizeLog); + report.put("sydneyPrizeLog", sydneyPrizeLog); - //Director commission - JSONObject directPrizeLogs = new JSONObject(); + //COO & NJ commission JSONObject params = new JSONObject(); params.put("begin", TimeZoneUtils.beginDate(TimeZoneUtils.getFirstDay(monthDate.toString()))); params.put("end", TimeZoneUtils.getPerFirstDayOfMonth(TimeZoneUtils.getLastDay(monthDate.toString()))); BigDecimal totalprize = transactionAnalysisMapper.analysisTotalAmount(params); + + JSONObject directPrizeLogs = new JSONObject(); directPrizeLogs.put("total_amount", totalprize); - JSONObject rate = financialBDCommissionConfigMapper.findCurrentCommissionRate(month, totalprize.toString(), 3); + JSONObject rate = financialBDCommissionConfigMapper.findCurrentCommissionRate(month, totalprize.toString(), 4); if (rate == null) { directPrizeLogs.put("total_prize", 0.00); } else { @@ -243,6 +263,18 @@ public class BDPrizeServiceImpl implements BDPrizeService { directPrizeLogs.put("total_prize", total_prize); } report.put("directPrizeLogs", directPrizeLogs); + + JSONObject ngDepartmentPrizeLog = new JSONObject(); + ngDepartmentPrizeLog.put("total_amount", totalprize); + JSONObject ngRate = financialBDCommissionConfigMapper.findCurrentCommissionRate(month, totalprize.toString(), 5); + if (ngRate == null) { + ngDepartmentPrizeLog.put("total_prize", 0.00); + } else { + BigDecimal ng_commission_rate = new BigDecimal(ngRate.getString("commission_rate")); + BigDecimal ng_total_prize = totalprize.multiply(ng_commission_rate.divide(percent)).setScale(2, BigDecimal.ROUND_DOWN); + ngDepartmentPrizeLog.put("total_prize", ng_total_prize); + } + report.put("ngDepartmentPrizeLog", ngDepartmentPrizeLog); return report; } diff --git a/src/main/java/au/com/royalpay/payment/manage/bdprize/support/impls/BDPrizeCalculatorDefaultImpl.java b/src/main/java/au/com/royalpay/payment/manage/bdprize/support/impls/BDPrizeCalculatorDefaultImpl.java index b9033b60d..0ea9da667 100644 --- a/src/main/java/au/com/royalpay/payment/manage/bdprize/support/impls/BDPrizeCalculatorDefaultImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/bdprize/support/impls/BDPrizeCalculatorDefaultImpl.java @@ -46,16 +46,16 @@ public class BDPrizeCalculatorDefaultImpl implements BDPrizeCalculator { public BDPrizeCalculatorDefaultImpl rateConfig(List rateConfig) { for (JSONObject rateCfgItem : rateConfig) { int level = rateCfgItem.getIntValue("bd_level"); - int monthLevel = rateCfgItem.getIntValue("time_range"); + int kpiRange = rateCfgItem.getIntValue("kpi_range"); Map> rates = rateConfigMap.get(level); if (rates == null) { rates = new HashMap<>(); rateConfigMap.put(level, rates); } - List rate = rates.get(monthLevel); + List rate = rates.get(kpiRange); if (rate == null) { rate = new ArrayList<>(); - rates.put(monthLevel, rate); + rates.put(kpiRange, rate); } rate.add(rateCfgItem); } @@ -90,10 +90,12 @@ public class BDPrizeCalculatorDefaultImpl implements BDPrizeCalculator { for (Map.Entry detail : resultItem.getValue().entrySet()) { JSONObject detailItem = detail.getValue(); int clientId = detailItem.getIntValue("client_id"); - int months = detailItem.getIntValue("client_create_months"); - BigDecimal bdRate = getRate(bdLevel, months, detailItem.getIntValue("client_source"), detailItem.getBigDecimal("rate_value")); +// int months = detailItem.getIntValue("client_create_months"); BigDecimal totalTransaction = detailItem.getBigDecimal("total_transaction"); BigDecimal coefficient = detailItem.getBigDecimal("coefficient"); + BigDecimal realTransaction = totalTransaction.multiply(coefficient).setScale(2,BigDecimal.ROUND_DOWN); + int prizeLevel = getKpiPrizeLevel(realTransaction,log.getBigDecimal("kpi_amount")); + BigDecimal bdRate = getNewRate(bdLevel, prizeLevel, detailItem.getIntValue("client_source"), detailItem.getBigDecimal("rate_value")); BigDecimal prizeValue = totalTransaction.multiply(coefficient).multiply(bdRate).divide(BigDecimal.valueOf(100), 2, BigDecimal.ROUND_DOWN); BigDecimal donation = BigDecimal.ZERO; if (clientsWithBDAwayDeterminor.clientWithBDAway(clientId, month)) { @@ -209,4 +211,39 @@ public class BDPrizeCalculatorDefaultImpl implements BDPrizeCalculator { } throw new ServerErrorException("Prize Rate Config has no equalize:bdLevel=" + bdLevel + ",months=" + months + ",clientRate=" + clientRate.doubleValue()); } + + + private BigDecimal getNewRate(int bdLevel, int kpiRange, int clientSource, BigDecimal clientRate) { + BigDecimal prizeRate = BigDecimal.ZERO; + Map> rates = rateConfigMap.get(bdLevel); + List rate = rates.get(kpiRange); + for (JSONObject rateCfg : rate) { + if (rateCfg.getBigDecimal("rate_from").compareTo(clientRate) <= 0 && rateCfg.getBigDecimal("rate_to").compareTo(clientRate) >= 0) { + prizeRate= rateCfg.getBigDecimal("prize_rate"); + continue; + } + } + if (clientSource == 1) { + return prizeRate; + } else { + return prizeRate.divide(BigDecimal.valueOf(2),3,BigDecimal.ROUND_HALF_DOWN); + } + } + + private int getKpiPrizeLevel(BigDecimal transactionAmount,BigDecimal kpiAmount){ + BigDecimal rate = transactionAmount.divide(kpiAmount,2,BigDecimal.ROUND_HALF_DOWN); + if (rate.compareTo(BigDecimal.valueOf(0.5))<0){ + return 1; + } + if (rate.compareTo(BigDecimal.valueOf(0.8))<0){ + return 2; + } + if (rate.compareTo(BigDecimal.valueOf(1))<0){ + return 3; + } + if (rate.compareTo(BigDecimal.valueOf(1.2))<0){ + return 4; + } + return 5; + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.java index 5e153fda9..be48b0efc 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.java @@ -94,6 +94,8 @@ public interface TransactionMapper { List listTransactionsForBDPrize(@Param("year") int year, @Param("month") int month, @Param("channel") String channel); BigDecimal TotalAmountForBDLeaderPrize(@Param("year") int year, @Param("month") int month, @Param("bd_group") String bd_group); + BigDecimal TotalAmountForSydneyGMPrize(@Param("year") int year, @Param("month") int month); + List listTransactionsForCityPartnerCommission(@Param("year") int year, @Param("month") int month); diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml index ad74bfa4d..a6480b29e 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml @@ -495,10 +495,7 @@ INNER JOIN pmt_orders o ON o.order_id = t.order_id INNER JOIN sys_clients c ON c.client_id = o.client_id AND c.org_id = 1 WHERE year(o.create_time) = #{year} AND month(o.create_time) = #{month} AND t.channel != 'Settlement' - - and t.channel not in ('Alipay','Bestpay') - - + and t.channel = #{channel} GROUP BY o.client_id, trade_date @@ -528,6 +525,30 @@ where b.is_valid=1 and b.start_date<=now() and (b.end_date is null or b.end_date >= now()) AND c.bd_group=#{bd_group} or c.manager_id=#{bd_group}) + + - - - - - - - - - - - - - - - - -
Commission AmountCommission RateBD Type - -
-
- - ~ - -
-
-
- - % -
-
- - - -
-
-
@@ -54,7 +54,7 @@
BD Total Commission: ${{report.AlipayReport.total_prize}}
-
BD Taotal Send: ${{report.AlipayReport.total_send_prize}}
+
BD Total Send: ${{report.AlipayReport.total_send_prize}}
BD Total Fund: ${{report.AlipayReport.total_donation}}
@@ -65,9 +65,9 @@
-
BD Taotal Commission: ${{report.BestpayReport.total_prize}}
-
BD Taotal Send: ${{report.BestpayReport.total_send_prize}}
-
BD Taotal Fund: ${{report.BestpayReport.total_donation}}
+
BD Total Commission: ${{report.BestpayReport.total_prize}}
+
BD Total Send: ${{report.BestpayReport.total_send_prize}}
+
BD Total Fund: ${{report.BestpayReport.total_donation}}
@@ -94,7 +94,7 @@
{{log.kpi_amount}} {{log.bd_name}} (Left Company) {{log.total_amount|currency:'AUD '}} (({{log.total_amount}}/{{log.kpi_amount}})|percentage){{log.total_amount|currency:'AUD '}} @@ -112,7 +112,7 @@
-
BD Manager Commission
+
Manager Commission
@@ -154,7 +154,7 @@ -->
-
Director Commission
+
COO Commission
@@ -166,6 +166,32 @@
+
+
Sydney GM Commission
+
+
+
+ Transaction Amount: +
+
+ Total Commission: +
+
+
+
+
+
NJ Department Commission
+
+
+
+ Transaction Amount: +
+
+ Total Commission: +
+
+
+
diff --git a/src/main/ui/static/config/bdprize/templates/bd_prize_root.html b/src/main/ui/static/config/bdprize/templates/bd_prize_root.html index 453417d77..406bb2f56 100644 --- a/src/main/ui/static/config/bdprize/templates/bd_prize_root.html +++ b/src/main/ui/static/config/bdprize/templates/bd_prize_root.html @@ -59,49 +59,48 @@
- - - - - + + + + - - - - - - - - - - + + + + + + + - + - - + - + ng-bind="(bd_rate_configs|filter:{kpi_range:range.kpi_range,bd_level:level,rate_from:0.6})[0].prize_rate+'%'"> + ng-bind="(bd_rate_configs|filter:{kpi_range:range.kpi_range,bd_level:level,rate_from:0.8})[0].prize_rate+'%'">
BD Level费率费率Junior BDIntermediate BDSenior BDKPIJunior BDIntermediate BDSenior BD
商户开通时长1-3个月4-6个月>=7个月1-3个月4-6个月>=7个月1-3个月4-6个月>=7个月费率0.6-0.790.8-2.00.6-0.790.8-2.00.6-0.790.8-2.0

补充说明

    -
  • 商户费率变更,提成比随之变更
  • -
  • 商户开通时长从商户开通时间起算
  • -
  • 后台系统自主申请商户,提成按照前三个月0.05%,后期0.01%发放,自主申请商户在详情列表中的Client Source标注为Apply
  • -
  • 调岗人员移交的商户,移交后6个月内移交人员和接收人员平分提成,应在商户BD配置里进行设置,分配比例请关注详情列表中的Coefficient,正常情况下应当为1
  • -
  • 离职人员移交的商户,接收人员享受一半提成,另一半作为BD福利基金,离职转交商户在详情列表中用红色标注
  • -
  • BD提成按月发放
  • -
  • 每月发放总额的80%,剩余20%于每年年底,即12月25日圣诞节前发放
  • +
  • 按月度发放
  • +
  • 每月发放总提成额度的 80%,剩余 20%按照“年度考评分数比例”于每年年底即 12 月 25 日圣诞前发放
  • 提前离职者,20%提成不予发放
  • +
  • 年度考评(根据销管中心每月考评表打分制进行统计)按照考评分数对应比例发放 20%的占比部分,扣下部分如果第二年考评超出一定评分 110%可以补发;同样,如果年度考评分数超过 100 分按照同比例发放
  • +
  • 商户开通后连续 1 个月未产生流水的,上交主管,由主管重新分配
  • +
  • 连续 2 个月不产生流水的商户,由销管部统一收回,重新分配
  • +
  • 分配后的商户流水客户专员只能占一半
  • +
  • 离职及调岗人员商户统一上交销管中心,由销管中心 leader 及跨境事业部总监相互协商及相互监督,按照公平公正的原则, 做出分配方案,并由总监确认后统一分配。调岗人员移交的商户,在移交后 1 个月内移交人员和接收人员平分该商家产生的提成,移交人员需配合接收人员做好商户对接和短期内的商户维护; + 离职人员交接的商户提成,接收人员享受一半的提成,另一半作为跨境客服专员福利会基金
  • +
  • 被客户投诉情况严重者,此商户由销管中心无条件收回重新分配
  • +
  • 活动执行未传达到位且出现舞弊、徇私、懒惰等行为的,商户上交由销管中心统一分配
  • +
  • 后期维护不及时,连续一个月不跟踪者,此商户上交销管中心,统一重新分配
  • +
  • 以上分配,销管中心 leader 和跨境支付事业部商量好之后需做好方案后经 COO 审批方可执行
diff --git a/src/main/ui/static/config/bdprize/templates/rate_config_dialog.html b/src/main/ui/static/config/bdprize/templates/rate_config_dialog.html index 1366d6ca1..cacbab082 100644 --- a/src/main/ui/static/config/bdprize/templates/rate_config_dialog.html +++ b/src/main/ui/static/config/bdprize/templates/rate_config_dialog.html @@ -9,29 +9,29 @@ -
+
- - + +
- + - - + + - + diff --git a/src/main/ui/static/config/bdprize/templates/rate_config_dialog.html b/src/main/ui/static/config/bdprize/templates/rate_config_dialog.html index cacbab082..397bc2ec9 100644 --- a/src/main/ui/static/config/bdprize/templates/rate_config_dialog.html +++ b/src/main/ui/static/config/bdprize/templates/rate_config_dialog.html @@ -25,7 +25,7 @@
Client RateKPI BD Rate
{{rate.rate_from}}-{{rate.rate_to}}
From 0e5e7270dc3d1f82e99fac24a0d3ebaa8c928dff Mon Sep 17 00:00:00 2001 From: yuan <1551130722@qq.com> Date: Fri, 6 Jul 2018 14:07:23 +0800 Subject: [PATCH 4/8] fix BD Commissions --- .../manage/bdprize/core/BDPrizeService.java | 2 +- .../core/impls/BDPrizeServiceImpl.java | 14 ++++++++--- .../manage/bdprize/web/BDPrizeController.java | 6 ++--- src/main/ui/static/config/bdprize/bdprize.js | 25 +++++++++++++------ .../bd_commission_config_dialog.html | 25 +++++++++++-------- .../bdprize/templates/bd_prize_root.html | 24 +++++++++++++++--- .../bdprize/templates/rate_config_dialog.html | 2 +- 7 files changed, 67 insertions(+), 31 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/bdprize/core/BDPrizeService.java b/src/main/java/au/com/royalpay/payment/manage/bdprize/core/BDPrizeService.java index 253fdd539..ad7970323 100644 --- a/src/main/java/au/com/royalpay/payment/manage/bdprize/core/BDPrizeService.java +++ b/src/main/java/au/com/royalpay/payment/manage/bdprize/core/BDPrizeService.java @@ -12,7 +12,7 @@ import com.alibaba.fastjson.JSONObject; * Created by yixian on 2017-02-07. */ public interface BDPrizeService { - void generateRecord(); + void generateRecord(String month); @Transactional void recordGenerateProcess(Calendar now); diff --git a/src/main/java/au/com/royalpay/payment/manage/bdprize/core/impls/BDPrizeServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/bdprize/core/impls/BDPrizeServiceImpl.java index d9f54108c..317283c6a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/bdprize/core/impls/BDPrizeServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/bdprize/core/impls/BDPrizeServiceImpl.java @@ -81,7 +81,7 @@ public class BDPrizeServiceImpl implements BDPrizeService { private static String[] channels = new String[]{"Wechat", "Alipay", "Bestpay", "jd", "AlipayOnline","hf"}; @Override - public void generateRecord() { + public void generateRecord(String month) { if (backupSystem) { throw new ServerErrorException("Updating System,wait for a moment"); } @@ -89,9 +89,15 @@ public class BDPrizeServiceImpl implements BDPrizeService { throw new ServerErrorException("Processing task, wait for a moment"); } try { - final Calendar now = Calendar.getInstance(); - DateUtils.truncate(now, Calendar.MONTH); - now.add(Calendar.MONTH, -1); + SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM"); + Date date = null; + try { + date = sdf.parse(month); + } catch (ParseException e) { + e.printStackTrace(); + } + Calendar now = Calendar.getInstance(); + now.setTime(date); recordGenerateProcess(now); } finally { diff --git a/src/main/java/au/com/royalpay/payment/manage/bdprize/web/BDPrizeController.java b/src/main/java/au/com/royalpay/payment/manage/bdprize/web/BDPrizeController.java index 65c96b428..e3e75e552 100644 --- a/src/main/java/au/com/royalpay/payment/manage/bdprize/web/BDPrizeController.java +++ b/src/main/java/au/com/royalpay/payment/manage/bdprize/web/BDPrizeController.java @@ -29,9 +29,9 @@ public class BDPrizeController { @Resource private BDPrizeService bdPrizeService; - @ManagerMapping(value = "/generate_record", method = RequestMethod.POST, role = {ManagerRole.FINANCIAL_STAFF, ManagerRole.ADMIN}) - public void generateRecord() { - bdPrizeService.generateRecord(); + @ManagerMapping(value = "/generate_record/{month}", method = RequestMethod.POST, role = {ManagerRole.FINANCIAL_STAFF, ManagerRole.ADMIN}) + public void generateRecord(@PathVariable String month) { + bdPrizeService.generateRecord(month); } @ManagerMapping(value = "/records", method = RequestMethod.GET, role = {ManagerRole.FINANCIAL_STAFF, ManagerRole.BD_USER}) diff --git a/src/main/ui/static/config/bdprize/bdprize.js b/src/main/ui/static/config/bdprize/bdprize.js index d1b163ae6..f19249c91 100644 --- a/src/main/ui/static/config/bdprize/bdprize.js +++ b/src/main/ui/static/config/bdprize/bdprize.js @@ -39,11 +39,12 @@ define(['angular', '../../analysis/bd/analysis-bd'], function (angular) { }) }]); - app.controller('bdPrizeRootCtrl', ['$scope', '$http', '$uibModal', 'commonDialog', function ($scope, $http, $uibModal, commonDialog) { + app.controller('bdPrizeRootCtrl', ['$scope', '$http', '$uibModal', 'commonDialog','$filter', function ($scope, $http, $uibModal, commonDialog,$filter) { $scope.params = {year: new Date().getFullYear()}; + $scope.generate = {}; $scope.availableYears = [new Date().getFullYear() - 1, new Date().getFullYear()]; - $scope.kpiRanges = [{value: 1, label: '0-0.5'}, {value: 2, label: '0.5-0.8'}, {value: 3, label: '0.8-1'}, - {value: 4, label: '1-1.2'}, {value: 5, label: '>=1.2'}]; + $scope.kpiRanges = [{value: 1, label: '0-50%'}, {value: 2, label: '50%~80%'}, {value: 3, label: '80%~100%'}, + {value: 4, label: '100%-120%'}, {value: 5, label: '>=120%'}]; $scope.initMonth = function (year) { $scope.params.year = year; $scope.months = []; @@ -74,11 +75,20 @@ define(['angular', '../../analysis/bd/analysis-bd'], function (angular) { }; $scope.getYearReports(new Date().getFullYear()); $scope.generateReport = function () { + $scope.generate.status = {}; + if (!$scope.generate.month) { + commonDialog.alert({ + type: 'error', title: 'Error', content: 'Select a month first!' + }); + return; + } commonDialog.confirm({ title: 'Warning', content: 'This operation will clear the result of last month generated before. Are you sure?' }).then(function () { - $http.post('/sys/bd_prize/generate_record', null, {timeout: 60000}).then(function () { + var params = {month: $filter('date')($scope.generate.month, 'yyyy-MM')}; + $http.post('/sys/bd_prize/generate_record/'+params.month, null, {timeout: 60000}).then(function () { + $scope.generate.status = null; commonDialog.alert({title: 'Success', content: 'Generate Finished', type: 'success'}); $scope.getYearReports($scope.params.year); }, function (resp) { @@ -108,8 +118,7 @@ define(['angular', '../../analysis/bd/analysis-bd'], function (angular) { rates: function () { return angular.copy($scope.bd_rate_configs); } - }, - size:'lg' + } }).result.then(function () { $scope.loadRateConfigs(); }) @@ -139,8 +148,8 @@ define(['angular', '../../analysis/bd/analysis-bd'], function (angular) { value: 3, label: '>=7 Months' }]; - $scope.kpiRanges = [{value: 1, label: '0-0.5'}, {value: 2, label: '0.5-0.8'}, {value: 3, label: '0.8-1'}, - {value: 4, label: '1-1.2'}, {value: 5, label: '>=1.2'}]; + $scope.kpiRanges = [{value: 1, label: '0-50%'}, {value: 2, label: '50%~80%'}, {value: 3, label: '80%~100%'}, + {value: 4, label: '100%-120%'}, {value: 5, label: '>=120%'}]; $scope.clientRate = [{value: 0.6, label: '0.6-0.79'}, {value: 0.8, label: '0.8-2.0'}]; $scope.filter = {bd_level: 1,rate_from:0.6}; $scope.rates = rates; diff --git a/src/main/ui/static/config/bdprize/templates/bd_commission_config_dialog.html b/src/main/ui/static/config/bdprize/templates/bd_commission_config_dialog.html index b3b547119..e61375c00 100644 --- a/src/main/ui/static/config/bdprize/templates/bd_commission_config_dialog.html +++ b/src/main/ui/static/config/bdprize/templates/bd_commission_config_dialog.html @@ -1,3 +1,8 @@ + @@ -57,12 +62,12 @@
-
+
-

跨境事业部总监提成制度

+
跨境事业部总监提成制度
-
    +
    • 享受墨尔本和悉尼两地部门流水总和提成
    • 完成当月指标低于 51%,提成按照 0.005%提取
    • 完成当月指标高于 80%,提成按照 0.008%提取
    • @@ -72,16 +77,16 @@
-

大客户部门 Manager 提成考核指标

+
大客户部门 Manager 提成考核指标
-
    +
    • 完成月度指标,当月部门提成为该部门总流水的 0.01%
    • 未完成月度指标,当月部门提成为该部门总流水的 0.005%;
-

悉尼分公司总经理

+
悉尼分公司总经理
    @@ -90,20 +95,20 @@
-

南京分公司技术部提成

+
南京分公司技术部提成
-
    +
    • 完成月度指标,当月提成为公司总流水的 0.01%
    • 未完成月度指标,当月提成为公司总流水的 0.005%
    • 【发放原则:季度一发放;分配原则由总经理 Leo Huang 制定。】
-

COO考核及提成政策

+
COO考核及提成政策
-
    +
    • 需完成董事会下达的指标任务
    • 按照公司总流水进行提取(包含合伙人)
    • 每月商户数量递增不得少于 100 家
    • diff --git a/src/main/ui/static/config/bdprize/templates/bd_prize_root.html b/src/main/ui/static/config/bdprize/templates/bd_prize_root.html index 406bb2f56..23183fd11 100644 --- a/src/main/ui/static/config/bdprize/templates/bd_prize_root.html +++ b/src/main/ui/static/config/bdprize/templates/bd_prize_root.html @@ -9,9 +9,25 @@
      - - - +
      +
      +
      +
      + +
      + + + + +
      +
      +
      + +
      @@ -59,7 +75,7 @@
BD LevelKPIKPI完成度 Junior BD Intermediate BD Senior BD
- + From 9d39e2cad67e4ca5b1d8a45980dc9749dad3c42d Mon Sep 17 00:00:00 2001 From: eason Date: Fri, 6 Jul 2018 16:02:59 +0800 Subject: [PATCH 5/8] fix --- .../bdprize/support/impls/BDPrizeCalculatorDefaultImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/au/com/royalpay/payment/manage/bdprize/support/impls/BDPrizeCalculatorDefaultImpl.java b/src/main/java/au/com/royalpay/payment/manage/bdprize/support/impls/BDPrizeCalculatorDefaultImpl.java index 0ea9da667..cf130a9d3 100644 --- a/src/main/java/au/com/royalpay/payment/manage/bdprize/support/impls/BDPrizeCalculatorDefaultImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/bdprize/support/impls/BDPrizeCalculatorDefaultImpl.java @@ -231,6 +231,9 @@ public class BDPrizeCalculatorDefaultImpl implements BDPrizeCalculator { } private int getKpiPrizeLevel(BigDecimal transactionAmount,BigDecimal kpiAmount){ + if (kpiAmount.equals(BigDecimal.ZERO)){//未设置kpi金额的按照最小完成度来计算 + return 1; + } BigDecimal rate = transactionAmount.divide(kpiAmount,2,BigDecimal.ROUND_HALF_DOWN); if (rate.compareTo(BigDecimal.valueOf(0.5))<0){ return 1; From 0a13bcd8765e7272ad26a53ccb1bd04340cfdd95 Mon Sep 17 00:00:00 2001 From: yuan <1551130722@qq.com> Date: Mon, 9 Jul 2018 10:36:16 +0800 Subject: [PATCH 6/8] fix BD Commissions --- .../bdprize/core/impls/BDPrizeServiceImpl.java | 2 +- .../support/impls/BDPrizeCalculatorDefaultImpl.java | 13 ++++++++++--- .../financial/FinancialBDPrizeLogMapper.java | 2 +- .../manage/mappers/payment/TransactionMapper.xml | 2 +- src/main/ui/static/config/bdprize/bdprize.js | 7 ++++--- .../bdprize/templates/bd_prize_month_report.html | 5 ++++- 6 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/bdprize/core/impls/BDPrizeServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/bdprize/core/impls/BDPrizeServiceImpl.java index 317283c6a..c52dac881 100644 --- a/src/main/java/au/com/royalpay/payment/manage/bdprize/core/impls/BDPrizeServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/bdprize/core/impls/BDPrizeServiceImpl.java @@ -145,7 +145,7 @@ public class BDPrizeServiceImpl implements BDPrizeService { for (JSONObject leader : bdLeaders) { BigDecimal groupAmount = transactionMapper.TotalAmountForBDLeaderPrize(now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1,leader.getString("manager_id")); JSONObject bdConfig = financialBDConfigMapper.getBdConfig(leader.getString("manager_id")); - int bd_type = ("Sydney").equals(bdConfig.getString("city"))?2:1;//sydney leader 即悉尼大客户经理 + int bd_type = bdConfig ==null?2:("Sydney").equals(bdConfig.getString("city"))?2:1;//sydney leader 即悉尼大客户经理 JSONObject rateJson = financialBDCommissionConfigMapper.findCurrentCommissionRate(month, groupAmount.toString(), bd_type); BigDecimal groupPrize = new BigDecimal(0); if (rateJson != null) { diff --git a/src/main/java/au/com/royalpay/payment/manage/bdprize/support/impls/BDPrizeCalculatorDefaultImpl.java b/src/main/java/au/com/royalpay/payment/manage/bdprize/support/impls/BDPrizeCalculatorDefaultImpl.java index cf130a9d3..7107827b1 100644 --- a/src/main/java/au/com/royalpay/payment/manage/bdprize/support/impls/BDPrizeCalculatorDefaultImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/bdprize/support/impls/BDPrizeCalculatorDefaultImpl.java @@ -86,15 +86,22 @@ public class BDPrizeCalculatorDefaultImpl implements BDPrizeCalculator { log.put("total_amount", 0); log.put("total_prize", 0); log.put("total_donation", 0); + BigDecimal totalAmount = log.getBigDecimal("total_amount"); List details = new ArrayList<>(); + for (Map.Entry detail : resultItem.getValue().entrySet()) { + JSONObject detailItem = detail.getValue(); + BigDecimal totalTransaction = detailItem.getBigDecimal("total_transaction"); + BigDecimal coefficient = detailItem.getBigDecimal("coefficient"); + BigDecimal realTransaction = totalTransaction.multiply(coefficient).setScale(2,BigDecimal.ROUND_DOWN); + totalAmount = totalAmount.add(realTransaction); + } for (Map.Entry detail : resultItem.getValue().entrySet()) { JSONObject detailItem = detail.getValue(); int clientId = detailItem.getIntValue("client_id"); // int months = detailItem.getIntValue("client_create_months"); BigDecimal totalTransaction = detailItem.getBigDecimal("total_transaction"); BigDecimal coefficient = detailItem.getBigDecimal("coefficient"); - BigDecimal realTransaction = totalTransaction.multiply(coefficient).setScale(2,BigDecimal.ROUND_DOWN); - int prizeLevel = getKpiPrizeLevel(realTransaction,log.getBigDecimal("kpi_amount")); + int prizeLevel = getKpiPrizeLevel(totalAmount,log.getBigDecimal("kpi_amount")); BigDecimal bdRate = getNewRate(bdLevel, prizeLevel, detailItem.getIntValue("client_source"), detailItem.getBigDecimal("rate_value")); BigDecimal prizeValue = totalTransaction.multiply(coefficient).multiply(bdRate).divide(BigDecimal.valueOf(100), 2, BigDecimal.ROUND_DOWN); BigDecimal donation = BigDecimal.ZERO; @@ -231,7 +238,7 @@ public class BDPrizeCalculatorDefaultImpl implements BDPrizeCalculator { } private int getKpiPrizeLevel(BigDecimal transactionAmount,BigDecimal kpiAmount){ - if (kpiAmount.equals(BigDecimal.ZERO)){//未设置kpi金额的按照最小完成度来计算 + if (kpiAmount.compareTo(BigDecimal.ZERO)==0){//未设置kpi金额的按照最小完成度来计算 return 1; } BigDecimal rate = transactionAmount.divide(kpiAmount,2,BigDecimal.ROUND_HALF_DOWN); diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/financial/FinancialBDPrizeLogMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/financial/FinancialBDPrizeLogMapper.java index adb0bc5a1..cbd0e1005 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/financial/FinancialBDPrizeLogMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/financial/FinancialBDPrizeLogMapper.java @@ -19,7 +19,7 @@ public interface FinancialBDPrizeLogMapper { @AutoSql(type = SqlType.INSERT) void save(JSONObject log); - @Select("SELECT fbpl.prize_log_id,fbpl.record_id,fbpl.manager_id,fbpl.bd_name,fbpl.bd_level,SUM(fbpl.total_amount) total_amount, " + + @Select("SELECT fbpl.prize_log_id,fbpl.record_id,fbpl.manager_id,fbpl.bd_name,fbpl.kpi_amount,fbpl.bd_level,SUM(fbpl.total_amount) total_amount, " + "SUM(fbpl.total_prize) total_prize,SUM(fbpl.total_donation) total_donation, SUM(fbpl.send_prize) send_prize, " + "SUM(fbpl.hold_prize) hold_prize,fbpl.last_punish,fbpl.prize_type,sysm.is_valid FROM financial_bd_prize_log fbpl, " + "sys_managers sysm " + diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml index a6480b29e..0d527bf43 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml @@ -504,7 +504,7 @@ - + From b2533ca3497160cf350d2fb357a29ef5d3e95313 Mon Sep 17 00:00:00 2001 From: yuan <1551130722@qq.com> Date: Mon, 9 Jul 2018 17:28:39 +0800 Subject: [PATCH 7/8] fix BD Commissions --- .../templates/bd_prize_month_report.html | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/ui/static/config/bdprize/templates/bd_prize_month_report.html b/src/main/ui/static/config/bdprize/templates/bd_prize_month_report.html index 77f9b9955..c8ccb0cef 100644 --- a/src/main/ui/static/config/bdprize/templates/bd_prize_month_report.html +++ b/src/main/ui/static/config/bdprize/templates/bd_prize_month_report.html @@ -156,19 +156,6 @@ --> -
-
COO Commission
-
-
-
- Transaction Amount: -
-
- Total Commission: -
-
-
-
Sydney GM Commission
@@ -194,6 +181,19 @@
+ +
+
COO Commission
+
+
+
+ Transaction Amount: +
+
+ Total Commission: +
+
+
From af744d6efb90d1f27cf47f75a3f0fcb06409cced Mon Sep 17 00:00:00 2001 From: eason Date: Wed, 11 Jul 2018 09:20:54 +0800 Subject: [PATCH 8/8] fix --- src/db/modify.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/db/modify.sql b/src/db/modify.sql index e608d4d25..109a4b181 100644 --- a/src/db/modify.sql +++ b/src/db/modify.sql @@ -614,5 +614,5 @@ ADD COLUMN `status` tinyint(2) NULL DEFAULT 0 COMMENT '0:未处理,1:处理 alter table sys_clients add column hfindustry varchar(10) DEFAULT NULL COMMENT 'HF行业'; alter table financial_bd_prize_rate_config add column `kpi_range` smallint(6) NOT NULL; -alter table financial_bd_config add column `kpi_amount` decimal(15,2) NOT NULL; +alter table financial_bd_config add column `kpi_amount` decimal(15,2) DEFAULT NULL; alter table financial_bd_prize_log add column `kpi_amount` decimal(15,2) DEFAULT NULL; \ No newline at end of file
KPIKPI完成度 BD Rate
{{log.bd_name}}{{log.kpi_amount}} {{log.bd_name}} (Left Company) + {{log.kpi_amount}} + 0.00 + {{log.total_amount|currency:'AUD '}}