diff --git a/src/db/modify.sql b/src/db/modify.sql index 79ba69618..41c6cf7c8 100644 --- a/src/db/modify.sql +++ b/src/db/modify.sql @@ -181,3 +181,7 @@ CREATE TABLE `financial_agent_commission_detail` ( `org_net_charge` decimal(12,2) DEFAULT NULL COMMENT '净值', PRIMARY KEY (`detail_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC; + + +alter table financial_partner_commission add column commission_type smallint(1) DEFAULT 1 COMMENT '提成类型 1:渠道计算法 2:总交易额比例 3:收益比例'; +alter table financial_partner_commission_detail add column commission_type smallint(1) DEFAULT 1 COMMENT '提成类型 1:渠道计算法 2:总交易额比例 3:收益比例'; diff --git a/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/CityPartnerCommissionAnalysis.java b/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/CityPartnerCommissionAnalysis.java index 932b55ec3..b026765bc 100644 --- a/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/CityPartnerCommissionAnalysis.java +++ b/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/CityPartnerCommissionAnalysis.java @@ -1,6 +1,8 @@ package au.com.royalpay.payment.manage.citypartner.beans; import au.com.royalpay.payment.tools.CommonConsts; +import au.com.royalpay.payment.tools.exceptions.ServerErrorException; + import com.alibaba.fastjson.JSONObject; import java.math.BigDecimal; @@ -18,7 +20,9 @@ public class CityPartnerCommissionAnalysis { private BigDecimal jdChargeRate; private BigDecimal alipayonlineChargeRate; private BigDecimal rate; + private BigDecimal orgRate; private String channel; + private int commissionType; private Map> clientAnalysis = new HashMap<>(); private BigDecimal totalGrossAmount = BigDecimal.ZERO; private BigDecimal totalChargeSum = BigDecimal.ZERO; @@ -26,19 +30,34 @@ public class CityPartnerCommissionAnalysis { private BigDecimal totalOrgChargeSum = BigDecimal.ZERO; private BigDecimal totalnetCharge = BigDecimal.ZERO; - public CityPartnerCommissionAnalysis(int orgId, int year, int month, BigDecimal rate,String channel,BigDecimal alipayChargeRate,BigDecimal wechatChargeRate,BigDecimal jdChargeRate,BigDecimal alipayonlineChargeRate) { + public CityPartnerCommissionAnalysis(int orgId, int year, int month, BigDecimal rate, String channel, BigDecimal alipayChargeRate, + BigDecimal wechatChargeRate, BigDecimal jdChargeRate, BigDecimal alipayonlineChargeRate, BigDecimal orgRate,int commissionType) { this.orgId = orgId; this.year = year; this.month = month; this.rate = rate; this.channel = channel; + this.commissionType = commissionType; this.alipayChargeRate = alipayChargeRate; this.wechatChargeRate = wechatChargeRate; this.jdChargeRate = jdChargeRate; this.alipayonlineChargeRate = alipayonlineChargeRate; + this.orgRate = orgRate; } - public CityPartnerCommissionAnalysis attachAnalysis(JSONObject dayAnalysis,String channel) { + public CityPartnerCommissionAnalysis calculator(JSONObject dayAnalysis, String channel, int type) { + switch (type) { + case 1: + return attachAnalysis(dayAnalysis, channel); + case 3: + return attachNetCommissionAnalysis(dayAnalysis, channel); + default: + throw new ServerErrorException("unkonw calculate type"); + } + + } + + public CityPartnerCommissionAnalysis attachAnalysis(JSONObject dayAnalysis, String channel) { int clientId = dayAnalysis.getIntValue("client_id"); List clientTrades = clientAnalysis.get(clientId); if (clientTrades == null) { @@ -47,31 +66,13 @@ public class CityPartnerCommissionAnalysis { } Date tradeDate = dayAnalysis.getDate("trade_date"); BigDecimal total = dayAnalysis.getBigDecimal("total"); - BigDecimal dayRate = dayAnalysis.getBigDecimal(channel+"_rate_value"); + BigDecimal dayRate = dayAnalysis.getBigDecimal(channel + "_rate_value"); BigDecimal dayCharge = total.multiply(dayRate).divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP); BigDecimal royalpayCharge = total.multiply(rate).divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP); - BigDecimal thirdPartyPaymentCharge = BigDecimal.ZERO; - switch (channel){ - case "alipay": - thirdPartyPaymentCharge = total.multiply(alipayChargeRate).divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP); - break; - case "wechat": - thirdPartyPaymentCharge = total.multiply(wechatChargeRate).divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP); - break; - case "jd": - thirdPartyPaymentCharge = total.multiply(jdChargeRate).divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP); - break; - case "alipayonline": - thirdPartyPaymentCharge = total.multiply(alipayonlineChargeRate).divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP); - break; - default: - break; - } - - BigDecimal netCharge = royalpayCharge.subtract(thirdPartyPaymentCharge); - + BigDecimal thirdPartyPaymentCharge = getThirdPartyCharge(channel, total); + BigDecimal netCharge = royalpayCharge.subtract(thirdPartyPaymentCharge); BigDecimal orgCharge = dayCharge.subtract(royalpayCharge); @@ -113,8 +114,9 @@ public class CityPartnerCommissionAnalysis { item.put("total_charge", dayCharge); item.put("royalpay_charge", royalpayCharge); item.put("org_charge", orgCharge); - item.put("channel",channel); - item.put("net_charge",netCharge); + item.put("channel", channel); + item.put("net_charge", netCharge); + item.put("commission_type",commissionType); clientTrades.add(item); return this; } @@ -130,8 +132,9 @@ public class CityPartnerCommissionAnalysis { result.put("total_charge", totalChargeSum); result.put("royalpay_charge", totalRoyalPayCharge); result.put("org_charge", totalOrgChargeSum); - result.put("net_charge",totalnetCharge); - result.put("channel",channel); + result.put("net_charge", totalnetCharge); + result.put("channel", channel); + result.put("commission_type",commissionType); return result; } @@ -147,4 +150,87 @@ public class CityPartnerCommissionAnalysis { } return list; } + + public CityPartnerCommissionAnalysis attachNetCommissionAnalysis(JSONObject dayAnalysis, String channel) { + int clientId = dayAnalysis.getIntValue("client_id"); + List clientTrades = clientAnalysis.get(clientId); + if (clientTrades == null) { + clientTrades = new ArrayList<>(); + clientAnalysis.put(clientId, clientTrades); + } + Date tradeDate = dayAnalysis.getDate("trade_date"); + BigDecimal total = dayAnalysis.getBigDecimal("total"); + BigDecimal dayRate = dayAnalysis.getBigDecimal(channel + "_rate_value"); + BigDecimal dayCharge = total.multiply(dayRate).divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP); + + BigDecimal royalpayCharge = total.multiply(rate).divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP); + + BigDecimal thirdPartyPaymentCharge = getThirdPartyCharge(channel, total); + BigDecimal netCharge = royalpayCharge.subtract(thirdPartyPaymentCharge); + BigDecimal orgCharge = netCharge.multiply(orgRate).divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP); + totalGrossAmount = totalGrossAmount.add(total); + totalChargeSum = totalChargeSum.add(dayCharge); + totalRoyalPayCharge = totalRoyalPayCharge.add(royalpayCharge); + totalOrgChargeSum = totalOrgChargeSum.add(orgCharge); + totalnetCharge = totalnetCharge.add(netCharge); + if (!clientTrades.isEmpty()) { + JSONObject item = clientTrades.get(clientTrades.size() - 1); + BigDecimal rate = item.getBigDecimal("client_rate"); + if (rate.compareTo(dayRate) == 0) { + BigDecimal gross = item.getBigDecimal("gross_amount").add(total); + item.put("gross_amount", gross); + BigDecimal totalCharge = item.getBigDecimal("total_charge").add(dayCharge); + item.put("total_charge", totalCharge); + BigDecimal totalRoyalCharge = item.getBigDecimal("royalpay_charge").add(royalpayCharge); + item.put("royalpay_charge", totalRoyalCharge); + BigDecimal totalOrgCharge = item.getBigDecimal("org_charge").add(orgCharge); + item.put("org_charge", totalOrgCharge); + BigDecimal totalRoyalpayClearingCharge = item.getBigDecimal("net_charge").add(netCharge); + item.put("net_charge", totalRoyalpayClearingCharge); + Date from = item.getDate("date_from"); + Date to = item.getDate("date_to"); + from = from.before(tradeDate) ? from : tradeDate; + to = to.after(tradeDate) ? to : tradeDate; + item.put("date_from", from); + item.put("date_to", to); + return this; + } + } + JSONObject item = new JSONObject(); + item.put("year", year); + item.put("month", month); + item.put("date_from", tradeDate); + item.put("date_to", tradeDate); + item.put("client_rate", dayRate); + item.put("gross_amount", total); + item.put("total_charge", dayCharge); + item.put("royalpay_charge", royalpayCharge); + item.put("org_charge", orgCharge); + item.put("channel", channel); + item.put("net_charge", netCharge); + clientTrades.add(item); + return this; + } + + private BigDecimal getThirdPartyCharge(String channel, BigDecimal total) { + BigDecimal thirdPartyPaymentCharge = BigDecimal.ZERO; + switch (channel) { + case "alipay": + thirdPartyPaymentCharge = total.multiply(alipayChargeRate).divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP); + break; + case "wechat": + thirdPartyPaymentCharge = total.multiply(wechatChargeRate).divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP); + break; + case "jd": + thirdPartyPaymentCharge = total.multiply(jdChargeRate).divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP); + break; + case "alipayonline": + thirdPartyPaymentCharge = total.multiply(alipayonlineChargeRate).divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP); + break; + default: + break; + } + return thirdPartyPaymentCharge; + } + } diff --git a/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/ReferrerCommissionAnalysis.java b/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/ReferrerCommissionAnalysis.java index 8aa123851..f3c71e8b6 100644 --- a/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/ReferrerCommissionAnalysis.java +++ b/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/ReferrerCommissionAnalysis.java @@ -36,7 +36,6 @@ public class ReferrerCommissionAnalysis { BigDecimal total = dayAnalysis.getBigDecimal("total"); BigDecimal orgCharge = total.multiply(referrerRate).divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP); Date tradeDate = dayAnalysis.getDate("trade_date"); - BigDecimal dayRate = dayAnalysis.getBigDecimal("rate_value"); totalGrossAmount = totalGrossAmount.add(total); totalOrgChargeSum = totalOrgChargeSum.add(orgCharge); diff --git a/src/main/java/au/com/royalpay/payment/manage/citypartner/core/impls/CityPartnerPrizeServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/citypartner/core/impls/CityPartnerPrizeServiceImpl.java index 494ed175d..71f147ec8 100644 --- a/src/main/java/au/com/royalpay/payment/manage/citypartner/core/impls/CityPartnerPrizeServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/citypartner/core/impls/CityPartnerPrizeServiceImpl.java @@ -1,5 +1,27 @@ package au.com.royalpay.payment.manage.citypartner.core.impls; +import java.math.BigDecimal; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.annotation.Resource; + +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.time.DateUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.alibaba.fastjson.JSONObject; + import au.com.royalpay.payment.manage.citypartner.beans.AgentCommissionAnalysis; import au.com.royalpay.payment.manage.citypartner.beans.CityPartnerCommissionAnalysis; import au.com.royalpay.payment.manage.citypartner.beans.ReferrerCommissionAnalysis; @@ -16,26 +38,6 @@ import au.com.royalpay.payment.tools.env.SysConfigManager; import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.ServerErrorException; -import com.alibaba.fastjson.JSONObject; - -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.time.DateUtils; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.math.BigDecimal; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; - /** * Created by yixian on 2017-03-08. */ @@ -195,6 +197,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { BigDecimal netCharge = BigDecimal.ZERO; BigDecimal orgCharge = BigDecimal.ZERO; String clientMoniker = ""; + int type = 1; for (JSONObject jsonObject : entry.getValue()) { grossAmount = grossAmount.add(jsonObject.getBigDecimal("gross_amount")); totalCharge = totalCharge.add(jsonObject.getBigDecimal("total_charge")); @@ -204,6 +207,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { netCharge = netCharge.add(jsonObject.getBigDecimal("net_charge")); } clientMoniker = jsonObject.getString("client_moniker"); + type = jsonObject.getIntValue("type"); } resultGrossAmount = resultGrossAmount.add(grossAmount); resultTotalCharge = resultTotalCharge.add(totalCharge); @@ -217,6 +221,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { sumResult.put("net_charge", netCharge); sumResult.put("client_moniker", clientMoniker); sumResult.put("channel_detail", entry.getValue()); + sumResult.put("type",type); partnerClientInfos.add(sumResult); } result.put("partner_client_infos", partnerClientInfos); @@ -242,8 +247,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { int year = monthCal.get(Calendar.YEAR); int month = monthCal.get(Calendar.MONTH) + 1; - financialPartnerCommissionDetailMapper.clearData(year, month); - financialPartnerCommissionMapper.clearData(year, month); + JSONObject sysConfig = sysConfigManager.getSysConfig(); BigDecimal alipayChargeRate = new BigDecimal("0.6"); BigDecimal wechatChargeRate = new BigDecimal("0.6"); @@ -267,29 +271,36 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { channelMap.put("Bestpay", "Bestpay"); channelMap.put("jd", "jd"); channelMap.put("AlipayOnline", "AlipayOnline"); + Set orgIds = new HashSet<>(); List transactionAnalysis = transactionMapper.listTransactionsForCityPartnerCommission(year, month); Map results = new HashMap<>(); for (JSONObject analysisDay : transactionAnalysis) { - String key = analysisDay.getString("channel"); - String channel = analysisDay.getString("channel"); - if (!channelMap.containsKey(key)) { - continue; - } int orgId = analysisDay.getIntValue("org_id"); - JSONObject org = orgMapper.findOne(orgId); + if(org.getIntValue("parent_org_id")>0){ + orgIds.add(orgId); + } if (org == null) { // shall never happen throw new ServerErrorException("Organization Id not exists:" + orgId); } + financialPartnerCommissionDetailMapper.clearData(year, month,org.getIntValue("commission_type")); + financialPartnerCommissionMapper.clearData(year, month,org.getIntValue("commission_type")); + + + String key = analysisDay.getString("channel"); + String channel = analysisDay.getString("channel"); + if (!channelMap.containsKey(key)) { + continue; + } channel = channel.toLowerCase(); CityPartnerCommissionAnalysis orgAnalysis = results.get(orgId + channel); if (orgAnalysis == null) { orgAnalysis = new CityPartnerCommissionAnalysis(orgId, year, month, org.getBigDecimal(channel + "_rate_value"), key, alipayChargeRate, - wechatChargeRate, jdChargeRate, alipayonlineChargeRate); + wechatChargeRate, jdChargeRate, alipayonlineChargeRate,org.getBigDecimal("rate_value"),org.getIntValue("commission_type")); results.put(orgId + channel, orgAnalysis); } - orgAnalysis.attachAnalysis(analysisDay, channel); + orgAnalysis.calculator(analysisDay, channel,org.getIntValue("commission_type")); } for (CityPartnerCommissionAnalysis commission : results.values()) { @@ -301,7 +312,12 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { financialPartnerCommissionDetailMapper.save(detail); } } - + Runnable task = ()->{ + orgIds.forEach((p)->{ + generateAgent(monthStr,p); + }); + }; + new Thread(task).start(); } @Override @@ -521,6 +537,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { JSONObject chargeInfo = getAgentPrizeInfo(item.getString("monthstr")); item.put("org_charge", chargeInfo.getString("org_charge")); item.put("gross_amount", chargeInfo.getString("gross_amount")); + item.put("total_charge", chargeInfo.getString("total_charge")); monthObjs.add(item); } return monthObjs; @@ -536,10 +553,12 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { JSONObject sum = new JSONObject(); sum.put("gross_amount", 0); sum.put("org_charge", 0); + sum.put("total_charge",0); List referrerPrizes = financialAgentCommissionMapper.list(year, month); for (JSONObject prize : referrerPrizes) { plusKey(sum, prize, "gross_amount"); plusKey(sum, prize, "org_charge"); + plusKey(sum, prize, "total_charge"); prize.put("monthstr", monthStr); } sum.put("referrer", referrerPrizes); diff --git a/src/main/java/au/com/royalpay/payment/manage/citypartner/web/CityPartnerPrizeController.java b/src/main/java/au/com/royalpay/payment/manage/citypartner/web/CityPartnerPrizeController.java index 5951e19d0..3e53c6041 100644 --- a/src/main/java/au/com/royalpay/payment/manage/citypartner/web/CityPartnerPrizeController.java +++ b/src/main/java/au/com/royalpay/payment/manage/citypartner/web/CityPartnerPrizeController.java @@ -73,6 +73,7 @@ public class CityPartnerPrizeController { BigDecimal netCharge = BigDecimal.ZERO; String cityPartnerName = ""; int org_id = 0; + int type = 1; for (JSONObject jsonObject : entry.getValue()) { grossAmount = grossAmount.add(jsonObject.getBigDecimal("gross_amount")); totalCharge = totalCharge.add(jsonObject.getBigDecimal("total_charge")); @@ -83,6 +84,7 @@ public class CityPartnerPrizeController { } org_id = jsonObject.getIntValue("org_id"); cityPartnerName = jsonObject.getString("name"); + type = jsonObject.getIntValue("commission_type"); } sumResult.put("gross_amount", grossAmount); sumResult.put("total_charge", totalCharge); @@ -91,6 +93,7 @@ public class CityPartnerPrizeController { sumResult.put("org_name", cityPartnerName); sumResult.put("org_id", org_id); sumResult.put("net_charge", netCharge); + sumResult.put("type",type); sumResult.put("channel_detail", entry.getValue()); resultTotalCharge = resultTotalCharge.add(totalCharge); resultRoyalpayCharge = resultRoyalpayCharge.add(royalpayCharge); @@ -174,12 +177,6 @@ public class CityPartnerPrizeController { return result; } - @RequestMapping(value = "/agent/generate", method = RequestMethod.POST) - public void generateAgent(@RequestBody JSONObject param, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject managerInfo) { - String month = param.getString("month"); - cityPartnerPrizeService.generateAgent(month, managerInfo.getIntValue("org_id")); - } - @ManagerMapping("/agent/months/{monthStr}/orgs/{orgId}") public JSONObject getAgentPrizeDetail(@PathVariable String monthStr, @PathVariable String orgId) { return cityPartnerPrizeService.getAgentPrizeDetail(monthStr, orgId); diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/financial/FinancialPartnerCommissionDetailMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/financial/FinancialPartnerCommissionDetailMapper.java index 7dece311e..3efb8de35 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/financial/FinancialPartnerCommissionDetailMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/financial/FinancialPartnerCommissionDetailMapper.java @@ -14,7 +14,7 @@ import java.util.List; @AutoMapper(tablename = "financial_partner_commission_detail", pkName = "detail_id") public interface FinancialPartnerCommissionDetailMapper { @AutoSql(type = SqlType.DELETE) - void clearData(@Param("year") int year, @Param("month") int month); + void clearData(@Param("year") int year, @Param("month") int month,@Param("commission_type") int commission_type); @AutoSql(type = SqlType.INSERT) void save(JSONObject detail); diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/financial/FinancialPartnerCommissionMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/financial/FinancialPartnerCommissionMapper.java index 720b8b371..cd44243f5 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/financial/FinancialPartnerCommissionMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/financial/FinancialPartnerCommissionMapper.java @@ -14,7 +14,7 @@ import java.util.List; @AutoMapper(tablename = "financial_partner_commission", pkName = "record_id") public interface FinancialPartnerCommissionMapper { @AutoSql(type = SqlType.DELETE) - void clearData(@Param("year") int year, @Param("month") int month); + void clearData(@Param("year") int year, @Param("month") int month,@Param("commission_type") int commission_type); @AutoSql(type = SqlType.INSERT) void save(JSONObject commissionAnalysis); diff --git a/src/main/ui/manage.html b/src/main/ui/manage.html index 5aaf5297b..2952052ec 100644 --- a/src/main/ui/manage.html +++ b/src/main/ui/manage.html @@ -326,8 +326,8 @@ margin-bottom: 10%;"/> 周末费率减半活动 - -
  • +
  • +
  • 机构数据分析|Agent Analysis diff --git a/src/main/ui/static/agent/commission/templates/agent_commission_month.html b/src/main/ui/static/agent/commission/templates/agent_commission_month.html index bf11e1e19..d96820aac 100644 --- a/src/main/ui/static/agent/commission/templates/agent_commission_month.html +++ b/src/main/ui/static/agent/commission/templates/agent_commission_month.html @@ -9,6 +9,9 @@
    Total Charge:
    +
    + Gross Amount: +
    RoyalPay Charge:
    diff --git a/src/main/ui/static/agent/commission/templates/agent_commission_root.html b/src/main/ui/static/agent/commission/templates/agent_commission_root.html index d1ae058f7..22fcff5cd 100644 --- a/src/main/ui/static/agent/commission/templates/agent_commission_root.html +++ b/src/main/ui/static/agent/commission/templates/agent_commission_root.html @@ -1,27 +1,4 @@ - - - - - - -
    -
    -
    -
    -
    - - -
    - - -
    -
    -
    Total Charge: - +
    Org Charge: diff --git a/src/main/ui/static/config/orgcommission/orgcommission.js b/src/main/ui/static/config/orgcommission/orgcommission.js index fe1eda92c..3171ff7a7 100644 --- a/src/main/ui/static/config/orgcommission/orgcommission.js +++ b/src/main/ui/static/config/orgcommission/orgcommission.js @@ -1,6 +1,21 @@ /** * Created by yixian on 2017-03-08. */ +var commissionTypeMap = [{ + "label": 1, + "value": "渠道计算法" +}, + { + "label": 2, + "value": "总交易额比例" + }, + { + "label": 3, + "value": "收益比例" + } +]; + + define(['angular','../../analysis/org/analysis-org'], function (angular) { 'use strict'; var app = angular.module('orgcommission', ['ui.router']); @@ -78,9 +93,11 @@ define(['angular','../../analysis/org/analysis-org'], function (angular) { $state.go('analysis_org.orgcommission.month', {monthStr: monthStr}) }; }]); - app.controller('orgCommissionMonthViewCtrl', ['$scope', 'monthData', function ($scope, monthData) { + app.controller('orgCommissionMonthViewCtrl', ['$scope', 'monthData','$filter', function ($scope, monthData) { $scope.monthData = monthData.data; $scope.ctrl = {}; + $scope.commissionTypeMap = commissionTypeMap; + $scope.active = function (log) { if($scope.ctrl.activeLog && $scope.ctrl.activeLog.org_id==log.org_id){ $scope.ctrl.activeLog=null; @@ -100,5 +117,23 @@ define(['angular','../../analysis/org/analysis-org'], function (angular) { $scope.ctrl.activeLog=log; } }]); + + + app.filter('commission_type_filter', function () { + return function (sectorValue) { + var sectorLabel = ''; + angular.forEach(commissionTypeMap, function (sector) { + if (sector.label == sectorValue) { + sectorLabel = sector.value; + } + }); + return sectorLabel; + } + }); + + return app; + + + }); \ No newline at end of file diff --git a/src/main/ui/static/config/orgcommission/templates/org_commission_month.html b/src/main/ui/static/config/orgcommission/templates/org_commission_month.html index fede91cc7..3c5675ffc 100644 --- a/src/main/ui/static/config/orgcommission/templates/org_commission_month.html +++ b/src/main/ui/static/config/orgcommission/templates/org_commission_month.html @@ -33,6 +33,7 @@ RoyalPay Charge Net Charge City Partner Charge + Type Details @@ -44,6 +45,7 @@ + diff --git a/src/test/java/au/com/royalpay/payment/manage/citypartner/core/impls/CityPartnerPrizeServiceImplTest.java b/src/test/java/au/com/royalpay/payment/manage/citypartner/core/impls/CityPartnerPrizeServiceImplTest.java index 67dce5ea6..7851d03dc 100644 --- a/src/test/java/au/com/royalpay/payment/manage/citypartner/core/impls/CityPartnerPrizeServiceImplTest.java +++ b/src/test/java/au/com/royalpay/payment/manage/citypartner/core/impls/CityPartnerPrizeServiceImplTest.java @@ -17,6 +17,7 @@ import javax.annotation.Resource; @ActiveProfiles({"local","alipay","wechat","jd","bestpay"}) @RunWith(SpringRunner.class) public class CityPartnerPrizeServiceImplTest { + @Resource private CityPartnerPrizeService cityPartnerPrizeService; @Test @@ -24,4 +25,9 @@ public class CityPartnerPrizeServiceImplTest { cityPartnerPrizeService.generateAgent("2017-06",9); } + @Test + public void generate() throws Exception { + cityPartnerPrizeService.generate("2017-06"); + } + } \ No newline at end of file