commit
a425a03f91
@ -0,0 +1,145 @@
|
|||||||
|
package au.com.royalpay.payment.manage.citypartner.beans;
|
||||||
|
|
||||||
|
import au.com.royalpay.payment.tools.CommonConsts;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by yixian on 2017-03-08.
|
||||||
|
*/
|
||||||
|
public class AgentCommissionAnalysis {
|
||||||
|
private int orgId;
|
||||||
|
private int year;
|
||||||
|
private int month;
|
||||||
|
private BigDecimal rate;
|
||||||
|
private String channel;
|
||||||
|
private Map<Integer, List<JSONObject>> clientAnalysis = new HashMap<>();
|
||||||
|
private BigDecimal totalGrossAmount = BigDecimal.ZERO;
|
||||||
|
private BigDecimal totalAgentCharge = BigDecimal.ZERO;
|
||||||
|
private BigDecimal totalAgentNetCharge = BigDecimal.ZERO;
|
||||||
|
private BigDecimal totalOrgCharge = BigDecimal.ZERO;
|
||||||
|
private BigDecimal totalOrgNetCharge = BigDecimal.ZERO;
|
||||||
|
private JSONObject org;
|
||||||
|
private JSONObject parentOrg;
|
||||||
|
|
||||||
|
public AgentCommissionAnalysis(int orgId, int year, int month, BigDecimal rate,String channel,JSONObject org,JSONObject parentOrg) {
|
||||||
|
this.orgId = orgId;
|
||||||
|
this.year = year;
|
||||||
|
this.month = month;
|
||||||
|
this.rate = rate;
|
||||||
|
this.channel = channel;
|
||||||
|
this.org = org;
|
||||||
|
this.parentOrg = parentOrg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AgentCommissionAnalysis attachAnalysis(JSONObject dayAnalysis,String channel) {
|
||||||
|
int clientId = dayAnalysis.getIntValue("client_id");
|
||||||
|
List<JSONObject> clientTrades = clientAnalysis.get(clientId);
|
||||||
|
if (clientTrades == null) {
|
||||||
|
clientTrades = new ArrayList<>();
|
||||||
|
clientAnalysis.put(clientId, clientTrades);
|
||||||
|
}
|
||||||
|
Date tradeDate = dayAnalysis.getDate("trade_date");
|
||||||
|
BigDecimal grossAmount = dayAnalysis.getBigDecimal("total");
|
||||||
|
BigDecimal dayRate = dayAnalysis.getBigDecimal(channel+"_rate_value");
|
||||||
|
BigDecimal agentCharge = grossAmount.multiply(dayRate.divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP));
|
||||||
|
BigDecimal orgCharge = BigDecimal.ZERO;
|
||||||
|
BigDecimal orgNetCharge = BigDecimal.ZERO;
|
||||||
|
switch (channel){
|
||||||
|
case "alipay":
|
||||||
|
orgCharge = grossAmount.multiply(org.getBigDecimal("alipay_rate_value").divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP));
|
||||||
|
orgNetCharge = orgCharge.subtract(grossAmount.multiply(parentOrg.getBigDecimal("alipay_rate_value").divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP)));
|
||||||
|
break;
|
||||||
|
case "wechat":
|
||||||
|
orgCharge = grossAmount.multiply(org.getBigDecimal("wechat_rate_value").divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP));
|
||||||
|
orgNetCharge = orgCharge.subtract(grossAmount.multiply(parentOrg.getBigDecimal("wechat_rate_value").divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP)));
|
||||||
|
break;
|
||||||
|
case "jd":
|
||||||
|
orgCharge = grossAmount.multiply(org.getBigDecimal("jd_rate_value").divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP));
|
||||||
|
orgNetCharge = orgCharge.subtract(grossAmount.multiply(parentOrg.getBigDecimal("jd_rate_value").divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP)));
|
||||||
|
break;
|
||||||
|
case "alipayonline":
|
||||||
|
orgCharge = grossAmount.multiply(org.getBigDecimal("alipayonline_rate_value").divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP));
|
||||||
|
orgNetCharge = orgCharge.subtract(grossAmount.multiply(parentOrg.getBigDecimal("alipayonline_rate_value").divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP)));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
totalGrossAmount = totalGrossAmount.add(grossAmount);
|
||||||
|
totalAgentCharge = totalAgentCharge.add(agentCharge);
|
||||||
|
totalAgentNetCharge = totalAgentNetCharge.add(orgNetCharge);
|
||||||
|
totalOrgCharge = totalOrgCharge.add(orgCharge);
|
||||||
|
totalOrgNetCharge = totalOrgNetCharge.add(orgNetCharge);
|
||||||
|
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(grossAmount);
|
||||||
|
item.put("gross_amount", gross);
|
||||||
|
BigDecimal totalCharge = item.getBigDecimal("total_charge").add(agentCharge);
|
||||||
|
item.put("total_charge", totalCharge);
|
||||||
|
BigDecimal totalOrgCharge = item.getBigDecimal("org_charge").add(orgCharge);
|
||||||
|
item.put("org_charge", totalOrgCharge);
|
||||||
|
BigDecimal totalRoyalpayClearingCharge = item.getBigDecimal("org_net_charge").add(orgNetCharge);
|
||||||
|
item.put("org_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", grossAmount);
|
||||||
|
item.put("total_charge", agentCharge);
|
||||||
|
item.put("org_charge", orgCharge);
|
||||||
|
item.put("channel",channel);
|
||||||
|
item.put("org_net_charge",orgNetCharge);
|
||||||
|
clientTrades.add(item);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JSONObject totalCommission() {
|
||||||
|
JSONObject result = new JSONObject();
|
||||||
|
result.put("org_id", orgId);
|
||||||
|
result.put("year", year);
|
||||||
|
result.put("month", month);
|
||||||
|
result.put("create_time", new Date());
|
||||||
|
result.put("org_rate", rate);
|
||||||
|
result.put("gross_amount", totalGrossAmount);
|
||||||
|
result.put("total_charge", totalAgentCharge);
|
||||||
|
result.put("org_charge", totalOrgCharge);
|
||||||
|
result.put("org_net_charge",totalOrgNetCharge);
|
||||||
|
result.put("channel",channel);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<JSONObject> getCommissionDetails(String recordId) {
|
||||||
|
List<JSONObject> list = new ArrayList<>();
|
||||||
|
for (Map.Entry<Integer, List<JSONObject>> entry : clientAnalysis.entrySet()) {
|
||||||
|
int clientId = entry.getKey();
|
||||||
|
for (JSONObject item : entry.getValue()) {
|
||||||
|
item.put("client_id", clientId);
|
||||||
|
item.put("record_id", recordId);
|
||||||
|
list.add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
package au.com.royalpay.payment.manage.mappers.financial;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
||||||
|
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
|
||||||
|
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
|
||||||
|
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by yixian on 2017-03-08.
|
||||||
|
*/
|
||||||
|
@AutoMapper(tablename = "financial_agent_commission_detail", pkName = "detail_id")
|
||||||
|
public interface FinancialAgentCommissionDetailMapper {
|
||||||
|
@AutoSql(type = SqlType.DELETE)
|
||||||
|
void clearData(@Param("year") int year, @Param("month") int month);
|
||||||
|
|
||||||
|
@AutoSql(type = SqlType.INSERT)
|
||||||
|
void save(JSONObject detail);
|
||||||
|
|
||||||
|
List<JSONObject> listDetails(@Param("record_id") String recordId);
|
||||||
|
|
||||||
|
List<JSONObject> listDetailsByRecordIds(List<String> recordId);
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
package au.com.royalpay.payment.manage.mappers.financial;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
||||||
|
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
|
||||||
|
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
|
||||||
|
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by yixian on 2017-03-08.
|
||||||
|
*/
|
||||||
|
@AutoMapper(tablename = "financial_agent_commission", pkName = "record_id")
|
||||||
|
public interface FinancialAgentCommissionMapper {
|
||||||
|
@AutoSql(type = SqlType.INSERT)
|
||||||
|
void save(JSONObject commissionAnalysis);
|
||||||
|
|
||||||
|
@AutoSql(type = SqlType.DELETE)
|
||||||
|
void clearData(@Param("year") int year, @Param("month") int month);
|
||||||
|
|
||||||
|
List<Integer> listAvailableMonths(@Param("year") int year);
|
||||||
|
|
||||||
|
List<JSONObject> find(@Param("year") int year, @Param("month") int month, @Param("org_id") String orgId);
|
||||||
|
|
||||||
|
List<JSONObject> list(@Param("year") int year, @Param("month") int month);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
|
<mapper namespace="au.com.royalpay.payment.manage.mappers.financial.FinancialAgentCommissionDetailMapper">
|
||||||
|
|
||||||
|
<select id="listDetailsByRecordIds" resultType="com.alibaba.fastjson.JSONObject">
|
||||||
|
SELECT
|
||||||
|
d.*,
|
||||||
|
c.client_moniker
|
||||||
|
FROM financial_agent_commission_detail d
|
||||||
|
INNER JOIN sys_clients c ON c.client_id = d.client_id
|
||||||
|
WHERE d.record_id in
|
||||||
|
<foreach collection="list" item="item" open="(" close=")" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
ORDER BY c.client_moniker ASC
|
||||||
|
</select>
|
||||||
|
</mapper>
|
@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
|
<mapper namespace="au.com.royalpay.payment.manage.mappers.financial.FinancialAgentCommissionMapper">
|
||||||
|
<select id="listAvailableMonths" resultType="java.lang.Integer">
|
||||||
|
SELECT DISTINCT `month`
|
||||||
|
FROM financial_agent_commission
|
||||||
|
WHERE `year` = #{year}
|
||||||
|
ORDER BY `month` ASC
|
||||||
|
</select>
|
||||||
|
<select id="find" resultType="com.alibaba.fastjson.JSONObject">
|
||||||
|
SELECT
|
||||||
|
c.*,
|
||||||
|
o.name `name`
|
||||||
|
FROM financial_agent_commission c
|
||||||
|
INNER JOIN sys_org o ON o.org_id = c.org_id and o.parent_org_id is null
|
||||||
|
WHERE c.year = #{year} AND c.month = #{month} and c.org_id=#{org_id}
|
||||||
|
</select>
|
||||||
|
<select id="list" resultType="com.alibaba.fastjson.JSONObject">
|
||||||
|
SELECT
|
||||||
|
c.*,
|
||||||
|
o.name
|
||||||
|
FROM financial_agent_commission c
|
||||||
|
INNER JOIN sys_org o ON o.org_id = c.org_id and o.parent_org_id is null
|
||||||
|
WHERE c.year = #{year} AND c.month = #{month}
|
||||||
|
</select>
|
||||||
|
</mapper>
|
@ -0,0 +1,108 @@
|
|||||||
|
/**
|
||||||
|
* Created by yixian on 2017-03-08.
|
||||||
|
*/
|
||||||
|
define(['angular','../../agent/commission/commission'], function (angular) {
|
||||||
|
'use strict';
|
||||||
|
var app = angular.module('agentCommission', ['ui.router']);
|
||||||
|
app.config(['$stateProvider', function ($stateProvider) {
|
||||||
|
$stateProvider.state('analysis_agent', {
|
||||||
|
url: '/analysis_agent',
|
||||||
|
templateUrl: '/static/agent/commission/templates/agent_commission_root.html',
|
||||||
|
controller: 'agentCommissionRootCtrl'
|
||||||
|
}).state('analysis_agent.agentcommission', {
|
||||||
|
url:'/agentcommission',
|
||||||
|
template:'<div ui-view></div>',
|
||||||
|
controller:['$scope',function ($scope) {
|
||||||
|
}]
|
||||||
|
}).state('analysis_agent.agentcommission.month', {
|
||||||
|
url: '/months/{monthStr}',
|
||||||
|
templateUrl: '/static/agent/commission/templates/agent_commission_month.html',
|
||||||
|
controller: 'agentCommissionMonthViewCtrl',
|
||||||
|
resolve: {
|
||||||
|
monthData: ['$http', '$stateParams', function ($http, $stateParams) {
|
||||||
|
return $http.get('/sys/citypartner_prizes/agent/months/' + $stateParams.monthStr);
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}).state('analysis_agent.agentcommission.month.agentdetail', {
|
||||||
|
url: '/orgs/{orgId}',
|
||||||
|
templateUrl: '/static/agent/commission/templates/agent_commission_detail.html',
|
||||||
|
controller: 'agentCommissionagentDetailCtrl',
|
||||||
|
resolve: {
|
||||||
|
detail: ['$http', '$stateParams', function ($http, $stateParams) {
|
||||||
|
return $http.get('/sys/citypartner_prizes/agent/months/' + $stateParams.monthStr + '/orgs/' + $stateParams.orgId);
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}]);
|
||||||
|
|
||||||
|
app.controller('agentCommissionRootCtrl', ['$scope', '$http', '$filter', '$state', 'commonDialog',
|
||||||
|
function ($scope, $http, $filter, $state, commonDialog) {
|
||||||
|
$scope.generate = {};
|
||||||
|
$scope.generateAgentCommission = function () {
|
||||||
|
$scope.generate.status = {};
|
||||||
|
if (!$scope.generate.month) {
|
||||||
|
commonDialog.alert({
|
||||||
|
type: 'error', title: 'Error', content: 'Select a month first!'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
commonDialog.confirm({
|
||||||
|
title: 'Confirm',
|
||||||
|
content: 'This operation will clear the data generated before, Are you sure?'
|
||||||
|
}).then(function () {
|
||||||
|
var params = {month: $filter('date')($scope.generate.month, 'yyyy-MM')};
|
||||||
|
$http.post('/sys/citypartner_prizes/agent/generate', params).then(function () {
|
||||||
|
$state.go('analysis_agent.agentcommission.month', {monthStr: params.month})
|
||||||
|
$scope.generate.status = null;
|
||||||
|
}, function (resp) {
|
||||||
|
commonDialog.alert({type: 'error', title: 'Error', content: resp.data.message});
|
||||||
|
})
|
||||||
|
})
|
||||||
|
};
|
||||||
|
$scope.params = {year: new Date()};
|
||||||
|
$scope.months = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
|
||||||
|
$scope.loadAvailableMonths = function () {
|
||||||
|
$http.get('/sys/citypartner_prizes/agent/months', {params: {year: $scope.params.year.getFullYear()}}).then(function (resp) {
|
||||||
|
$scope.availableMonths = resp.data;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.loadAvailableMonths();
|
||||||
|
$scope.hasReport = function (mon) {
|
||||||
|
var has = false;
|
||||||
|
angular.forEach($scope.availableMonths, function (m) {
|
||||||
|
if (mon == m.month) {
|
||||||
|
has = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return has;
|
||||||
|
};
|
||||||
|
$scope.gotoMonth = function (mon) {
|
||||||
|
var monthStr = $scope.params.year.getFullYear() + '-' + (('0' + mon).substr(-2));
|
||||||
|
$state.go('analysis_agent.agentcommission.month', {monthStr: monthStr})
|
||||||
|
};
|
||||||
|
}]);
|
||||||
|
app.controller('agentCommissionMonthViewCtrl', ['$scope', 'monthData', function ($scope, monthData) {
|
||||||
|
$scope.monthData = monthData.data;
|
||||||
|
$scope.ctrl = {};
|
||||||
|
$scope.active = function (log) {
|
||||||
|
if($scope.ctrl.activeLog && $scope.ctrl.activeLog.org_id==log.org_id){
|
||||||
|
$scope.ctrl.activeLog=null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$scope.ctrl.activeLog=log;
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
app.controller('agentCommissionagentDetailCtrl', ['$scope', 'detail', function ($scope, detail) {
|
||||||
|
$scope.detail = detail.data;
|
||||||
|
$scope.ctrl = {};
|
||||||
|
$scope.active = function (log) {
|
||||||
|
if($scope.ctrl.activeLog && $scope.ctrl.activeLog.client_moniker==log.client_moniker){
|
||||||
|
$scope.ctrl.activeLog=null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$scope.ctrl.activeLog=log;
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
return app;
|
||||||
|
});
|
@ -0,0 +1,186 @@
|
|||||||
|
<style type="text/css">
|
||||||
|
|
||||||
|
.nowrap > div {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
<div ui-view>
|
||||||
|
<div class="box box-warning" ng-if="detail">
|
||||||
|
<div class="box-header">Analysis</div>
|
||||||
|
<div class="box-body nowrap">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-3 col-sm-3">
|
||||||
|
City Partner:<span ng-bind="detail.name"></span>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-3 col-sm-3">
|
||||||
|
Month:<span ng-bind="detail.monthstr"></span>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-3 col-sm-3 nowrap">
|
||||||
|
Total Transaction:{{detail.total_transaction}}
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-3 col-sm-3 nowrap">
|
||||||
|
Total Charge:{{detail.total_charge}}
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-3 col-sm-3 nowrap">
|
||||||
|
RoyalPay Charge:{{detail.royalPay_charge}}
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-3 col-sm-3 nowrap">
|
||||||
|
Org Net Charge:{{detail.org_net_charge}}
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-6 col-sm-6 nowrap">
|
||||||
|
City Partner Charge:{{detail.city_partner_charge}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xs-3 ng-scope"
|
||||||
|
ng-if="detail.Alipay_gross_amount|| detail.Alipay_total_charge || detail.Alipay_royalpay_charge|| detail.Alipay_org_charge">
|
||||||
|
<div class="info-box" style="background: lightcyan">
|
||||||
|
<div class="info-box-icon" style=" background: bottom;">
|
||||||
|
<img uib-tooltip="Alipay" src="/static/images/alipay_sign_lg.png">
|
||||||
|
</div>
|
||||||
|
<div class="info-box-content">
|
||||||
|
<h5 class="ng-binding">Total Transaction:<span
|
||||||
|
ng-bind="detail.Alipay_gross_amount|currency:'AUD'"></span></h5>
|
||||||
|
<h5 class="ng-binding">Total Charge:<span
|
||||||
|
ng-bind="detail.Alipay_total_charge|currency:'AUD'"></span></h5>
|
||||||
|
<h5 class="ng-binding">RoyalPay Charge:<span
|
||||||
|
ng-bind="detail.Alipay_royalpay_charge|currency:'AUD'"></span></h5>
|
||||||
|
<h5 class="ng-binding">Org Net Charge:<span
|
||||||
|
ng-bind="detail.Alipay_org_net_charge|currency:'AUD'"></span></h5>
|
||||||
|
<h5 class="ng-binding">City Partner Charge:<span
|
||||||
|
ng-bind="detail.Alipay_org_charge|currency:'AUD'"></span></h5>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xs-3 ng-scope"
|
||||||
|
ng-if="detail.Bestpay_gross_amount|| detail.Bestpay_total_charge || detail.Bestpay_royalpay_charge|| detail.Bestpay_org_charge">
|
||||||
|
<div class="info-box" style="background: lightcyan">
|
||||||
|
<div class="info-box-icon" style=" background: bottom;">
|
||||||
|
<img uib-tooltip="Bestpay" src="/static/images/bestpay_sign_lg.png">
|
||||||
|
</div>
|
||||||
|
<div class="info-box-content">
|
||||||
|
<h5 class="ng-binding">Total Transaction:<span
|
||||||
|
ng-bind="detail.Bestpay_gross_amount|currency:'AUD'"></span></h5>
|
||||||
|
<h5 class="ng-binding">Total Charge:<span
|
||||||
|
ng-bind="detail.Bestpay_total_charge|currency:'AUD'"></span></h5>
|
||||||
|
<h5 class="ng-binding">RoyalPay Charge:<span
|
||||||
|
ng-bind="detail.Bestpay_royalpay_charge|currency:'AUD'"></span></h5>
|
||||||
|
<h5 class="ng-binding">Org Net Charge:<span
|
||||||
|
ng-bind="detail.Bestpay_org_net_charge|currency:'AUD'"></span></h5>
|
||||||
|
<h5 class="ng-binding">City Partner Charge:<span
|
||||||
|
ng-bind="detail.Bestpay_org_charge|currency:'AUD'"></span></h5>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xs-3 ng-scope"
|
||||||
|
ng-if="detail.Wechat_gross_amount|| detail.Wechat_total_charge || detail.Wechat_royalpay_charge|| detail.Wechat_org_charge">
|
||||||
|
<div class="info-box" style="background: lightcyan">
|
||||||
|
<div class="info-box-icon" style=" background: bottom;">
|
||||||
|
<img uib-tooltip="Wechat" src="/static/images/wechatpay_sign_lg.png">
|
||||||
|
</div>
|
||||||
|
<div class="info-box-content">
|
||||||
|
<h5 class="ng-binding"> Total Transaction:<span
|
||||||
|
ng-bind="detail.Wechat_gross_amount|currency:'AUD'"></span></h5>
|
||||||
|
<h5 class="ng-binding"> Total Charge:<span
|
||||||
|
ng-bind="detail.Wechat_total_charge|currency:'AUD'"></span></h5>
|
||||||
|
<h5 class="ng-binding"> RoyalPay Charge:<span
|
||||||
|
ng-bind="detail.Wechat_royalpay_charge|currency:'AUD'"></span></h5>
|
||||||
|
<h5 class="ng-binding">Org Net Charge:<span
|
||||||
|
ng-bind="detail.Wechat_org_net_charge|currency:'AUD'"></span></h5>
|
||||||
|
<h5 class="ng-binding">City Partner Charge:<span
|
||||||
|
ng-bind="detail.Wechat_org_charge|currency:'AUD'"></span></h5>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xs-3 ng-scope"
|
||||||
|
ng-if="detail.jd_gross_amount|| detail.jd_total_charge || detail.jd_royalpay_charge|| detail.jd_org_charge">
|
||||||
|
<div class="info-box" style="background: lightcyan">
|
||||||
|
<div class="info-box-icon" style=" background: bottom;">
|
||||||
|
<img uib-tooltip="jd" src="/static/images/jd_sign_lg.png">
|
||||||
|
</div>
|
||||||
|
<div class="info-box-content">
|
||||||
|
<h5 class="ng-binding"> Total Transaction:<span
|
||||||
|
ng-bind="detail.jd_gross_amount|currency:'AUD'"></span></h5>
|
||||||
|
<h5 class="ng-binding"> Total Charge:<span
|
||||||
|
ng-bind="detail.jd_total_charge|currency:'AUD'"></span></h5>
|
||||||
|
<h5 class="ng-binding"> RoyalPay Charge:<span
|
||||||
|
ng-bind="detail.jd_royalpay_charge|currency:'AUD'"></span></h5>
|
||||||
|
<h5 class="ng-binding">Org Net Charge:<span
|
||||||
|
ng-bind="detail.jd_org_net_charge|currency:'AUD'"></span></h5>
|
||||||
|
<h5 class="ng-binding">City Partner Charge:<span
|
||||||
|
ng-bind="detail.jd_org_charge|currency:'AUD'"></span></h5>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="box box-default" ng-if="detail">
|
||||||
|
<div class="box-body table-responsive">
|
||||||
|
<table class="table table-bordered table-hover table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Client Moniker</th>
|
||||||
|
<th>Transaction</th>
|
||||||
|
<th>Total Charge</th>
|
||||||
|
<th>RoyalPay Charge</th>
|
||||||
|
<th>Org Net Charge</th>
|
||||||
|
<th>City Partner Charge</th>
|
||||||
|
<th>Details</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr ng-repeat-start="log in detail.partner_client_infos">
|
||||||
|
<td ng-bind="log.client_moniker"></td>
|
||||||
|
<td ng-bind="log.gross_amount|currency:'AUD'"></td>
|
||||||
|
<td ng-bind="log.total_charge|currency:'AUD'"></td>
|
||||||
|
<td ng-bind="log.royalpay_charge|currency:'AUD'"></td>
|
||||||
|
<td ng-bind="log.org_net_charge|currency:'AUD'"></td>
|
||||||
|
<td ng-bind="log.org_charge|currency:'AUD'"></td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<a role="button" ng-click="active(log)">
|
||||||
|
<i class="fa fa-list-ul"></i>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr ng-repeat-end ng-if="log.client_moniker==ctrl.activeLog.client_moniker">
|
||||||
|
<td colspan="6">
|
||||||
|
<table class="table table-bordered table-hover table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Order Date Range</th>
|
||||||
|
<th>Client Rate</th>
|
||||||
|
<th>Transaction Amount</th>
|
||||||
|
<th>Total Charge</th>
|
||||||
|
<th>RoyalPay Charge</th>
|
||||||
|
<th>Org Net Charge</th>
|
||||||
|
<th>City Partner Charge</th>
|
||||||
|
<th>channel</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr ng-repeat="detail in log.channel_detail">
|
||||||
|
<td>
|
||||||
|
{{detail.date_from|date:'dd/MMM/yyyy'}}~{{detail.date_to|date:'dd/MMM/yyyy'}}
|
||||||
|
</td>
|
||||||
|
<td ng-bind="detail.client_rate"></td>
|
||||||
|
<td ng-bind="detail.gross_amount"></td>
|
||||||
|
<td ng-bind="detail.total_charge"></td>
|
||||||
|
<td ng-bind="detail.royalpay_charge"></td>
|
||||||
|
<td ng-bind="detail.org_net_charge"></td>
|
||||||
|
<td ng-bind="detail.org_charge"></td>
|
||||||
|
<td ng-bind="detail.channel"></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -0,0 +1,89 @@
|
|||||||
|
<div ui-view>
|
||||||
|
<div class="box box-warning">
|
||||||
|
<div class="box-header">Analysis</div>
|
||||||
|
<div class="box-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-6 col-sm-3">
|
||||||
|
Month:<span ng-bind="monthData.monthstr"></span>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-6 col-sm-3">
|
||||||
|
Total Charge:<span ng-bind="monthData.agent_total_charge|currency:'AUD'"></span>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-6 col-sm-3">
|
||||||
|
Gross Amount:<span ng-bind="monthData.gross_amount|currency:'AUD'"></span>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-6 col-sm-3">
|
||||||
|
RoyalPay Charge:<span ng-bind="monthData.royalpay_charge|currency:'AUD'"></span>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-6 col-sm-3">
|
||||||
|
Org Net Charge:<span ng-bind="monthData.org_net_charge|currency:'AUD'"></span>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-6 col-sm-3">
|
||||||
|
Org Charge:<span ng-bind="monthData.org_charge|currency:'AUD'"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="box box-default">
|
||||||
|
<div class="box-header">Details</div>
|
||||||
|
<div class="box-body table-responsive">
|
||||||
|
<table class="table table-bordered table-hover table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>City Partner Name</th>
|
||||||
|
<th>Transaction Amount</th>
|
||||||
|
<th>Total Charge</th>
|
||||||
|
<th>RoyalPay Charge</th>
|
||||||
|
<th>Net Charge</th>
|
||||||
|
<th>Details</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr ng-repeat-start="log in monthData.partner_info_list">
|
||||||
|
<td ng-bind="log.org_name"></td>
|
||||||
|
<td ng-bind="log.gross_amount|currency:'AUD'"></td>
|
||||||
|
<td ng-bind="log.org_charge|currency:'AUD'"></td>
|
||||||
|
<td ng-bind="log.royalpay_charge|currency:'AUD'"></td>
|
||||||
|
<td ng-bind="log.org_net_charge|currency:'AUD'"></td>
|
||||||
|
<td>
|
||||||
|
<a ui-sref=".agentdetail({orgId:log.org_id})">
|
||||||
|
<i class="fa fa-search"></i>
|
||||||
|
</a>
|
||||||
|
<a role="button" ng-click="active(log)">
|
||||||
|
<i class="fa fa-list-ul"></i>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr ng-repeat-end ng-if="log.org_id==ctrl.activeLog.org_id">
|
||||||
|
<td colspan="6">
|
||||||
|
<table class="table table-bordered table-hover table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Keep Rate</th>
|
||||||
|
<th>Transaction Amount</th>
|
||||||
|
<th>Total Charge</th>
|
||||||
|
<th>RoyalPay Charge</th>
|
||||||
|
<th>Org Net Charge</th>
|
||||||
|
<th>City Partner Charge</th>
|
||||||
|
<th>channel</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr ng-repeat = "detail in log.channel_detail" >
|
||||||
|
<td ng-bind="detail.org_rate"></td>
|
||||||
|
<td ng-bind="detail.gross_amount"></td>
|
||||||
|
<td ng-bind="detail.total_charge"></td>
|
||||||
|
<td ng-bind="detail.royalpay_charge"></td>
|
||||||
|
<td ng-bind="detail.org_net_charge"></td>
|
||||||
|
<td ng-bind="detail.org_charge"></td>
|
||||||
|
<td ng-bind="detail.channel"></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -0,0 +1,33 @@
|
|||||||
|
<section class="content">
|
||||||
|
<div class="box box-warning">
|
||||||
|
<div class="box-header">
|
||||||
|
<input type="text" class="hidden" uib-datepicker-popup="yyyy" ng-model="params.year" is-open="ctrl.viewyear"
|
||||||
|
datepicker-options="{minMode: 'year'}" ng-change="loadAvailableMonths()"
|
||||||
|
placeholder="Select Year">
|
||||||
|
<span ng-bind="params.year.getFullYear()" ng-click="ctrl.viewyear=true"></span>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-3 col-sm-6 col-xs-12" ng-repeat="mon in availableMonths">
|
||||||
|
<div class="info-box">
|
||||||
|
<div class="info-box-icon bg-aqua" ng-bind="mon.month" ng-click="gotoMonth(mon.monthstr)" role="button">
|
||||||
|
</div>
|
||||||
|
<div class="info-box-content">
|
||||||
|
<!--<div class="info-box-text text-bold text-red" ng-bind="r.charge_date"></div>-->
|
||||||
|
<div>
|
||||||
|
<div class="info-box-number-right">
|
||||||
|
<span class="text-bold">Total Charge:</span>
|
||||||
|
<span class="text-green" ng-bind="mon.total_charge|currency:'AUD'"></span>
|
||||||
|
</div>
|
||||||
|
<div class="info-box-number-right">
|
||||||
|
<span class="text-bold">Org Charge:</span>
|
||||||
|
<span class="text-green" ng-bind="mon.org_charge|currency:'AUD'"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div ui-view></div>
|
||||||
|
</section>
|
@ -0,0 +1,33 @@
|
|||||||
|
package au.com.royalpay.payment.manage.citypartner.core.impls;
|
||||||
|
|
||||||
|
import au.com.royalpay.payment.manage.citypartner.core.CityPartnerPrizeService;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.ActiveProfiles;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by wangning on 09/01/2018.
|
||||||
|
*/
|
||||||
|
@SpringBootTest
|
||||||
|
@ActiveProfiles({"local","alipay","wechat","jd","bestpay"})
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
public class CityPartnerPrizeServiceImplTest {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CityPartnerPrizeService cityPartnerPrizeService;
|
||||||
|
@Test
|
||||||
|
public void generateAgent() throws Exception {
|
||||||
|
cityPartnerPrizeService.generateAgent("2017-06",9);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void generate() throws Exception {
|
||||||
|
cityPartnerPrizeService.generate("2017-06");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in new issue