master
wangning 7 years ago
parent 113d2bcc84
commit 9df05a5ee1

@ -21,8 +21,6 @@ public interface CityPartnerPrizeService {
void generateReferrer(String month);
void generateAgent(String month);
List<JSONObject> listReferrerAvailableMonths(String year);
JSONObject getReferrerPrizeInfo(String monthStr);
@ -31,5 +29,15 @@ public interface CityPartnerPrizeService {
List<JSONObject> getReferrerPrizeInfoList(String monthStr);
void generateAgent(String month,int orgId);
List<JSONObject> listAgentAvailableMonths(String year);
JSONObject getAgentPrizeInfo(String monthStr);
JSONObject getAgentPrizeDetail(String monthStr, String orgId);
List<JSONObject> getAgentPrizeInfoList(String monthStr);
}

@ -1,25 +1,5 @@
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.List;
import java.util.Map;
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;
@ -36,6 +16,26 @@ 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.
*/
@ -339,7 +339,19 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
}
@Override
public void generateAgent(String monthStr) {
@Transactional
public void generateAgent(String monthStr,int orgId) {
JSONObject org = orgMapper.findOne(orgId);
if (org == null) {
// shall never happen
throw new ServerErrorException("Organization Id not exists:" + orgId);
}
JSONObject parnetOrg = orgMapper.findOne(org.getIntValue("parent_org_id"));
if (parnetOrg == null) {
// shall never happen
throw new ServerErrorException("Organization Parent Id not exists:" + org.getIntValue("parent_org_id"));
}
Date mon = checkMonth(monthStr);
Calendar monthCal = Calendar.getInstance();
monthCal.setTime(mon);
@ -348,30 +360,13 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
financialAgentCommissionDetailMapper.clearData(year, month);
financialAgentCommissionMapper.clearData(year, month);
JSONObject sysConfig = sysConfigManager.getSysConfig();
BigDecimal alipayChargeRate = new BigDecimal("0.6");
BigDecimal wechatChargeRate = new BigDecimal("0.6");
BigDecimal jdChargeRate = new BigDecimal("0.9");
BigDecimal alipayonlineChargeRate = new BigDecimal("2.0");
if (sysConfig.getBigDecimal("Alipay_charge_rate") != null) {
alipayChargeRate = sysConfig.getBigDecimal("Alipay_charge_rate");
}
if (sysConfig.getBigDecimal("Wechat_charge_rate") != null) {
wechatChargeRate = sysConfig.getBigDecimal("Wechat_charge_rate");
}
if (sysConfig.getBigDecimal("jd_charge_rate") != null) {
jdChargeRate = sysConfig.getBigDecimal("jd_charge_rate");
}
if (sysConfig.getBigDecimal("alipayonline_charge_rate") != null) {
alipayonlineChargeRate = sysConfig.getBigDecimal("alipayonline_charge_rate");
}
HashMap<String, String> channelMap = new HashMap<>();
channelMap.put("Alipay", "Alipay");
channelMap.put("Wechat", "Wechat");
channelMap.put("Bestpay", "Bestpay");
channelMap.put("jd","jd");
channelMap.put("AlipayOnline","AlipayOnline");
List<JSONObject> transactionAnalysis = transactionMapper.listTransactionsForAgentCommission(year, month);
List<JSONObject> transactionAnalysis = transactionMapper.listTransactionsForAgentCommission(year, month,org.getIntValue("parent_org_id"));
Map<String, AgentCommissionAnalysis> results = new HashMap<>();
for (JSONObject analysisDay : transactionAnalysis) {
String key = analysisDay.getString("channel");
@ -379,18 +374,6 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
if (!channelMap.containsKey(key)) {
continue;
}
int orgId = analysisDay.getIntValue("org_id");
JSONObject org = orgMapper.findOne(orgId);
if (org == null) {
// shall never happen
throw new ServerErrorException("Organization Id not exists:" + orgId);
}
JSONObject parnetOrg = orgMapper.findOne(org.getIntValue("parent_org_id"));
if (parnetOrg == null) {
// shall never happen
throw new ServerErrorException("Organization Parent Id not exists:" + org.getIntValue("parent_org_id"));
}
channel = channel.toLowerCase();
AgentCommissionAnalysis agentCommissionAnalysis = results.get(orgId + channel);
if (agentCommissionAnalysis == null) {
@ -526,4 +509,111 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
}
}
@Override
public List<JSONObject> listAgentAvailableMonths(String year) {
int yearNum = checkValidYear(year);
List<Integer> months = financialAgentCommissionMapper.listAvailableMonths(yearNum);
List<JSONObject> monthObjs = new ArrayList<>();
for (Integer mon : months) {
JSONObject item = new JSONObject();
item.put("month", mon);
item.put("monthstr", year + "-" + StringUtils.substring("00" + mon, -2));
JSONObject chargeInfo = getReferrerPrizeInfo(item.getString("monthstr"));
item.put("org_charge", chargeInfo.getString("org_charge"));
item.put("gross_amount", chargeInfo.getString("gross_amount"));
monthObjs.add(item);
}
return monthObjs;
}
@Override
public JSONObject getAgentPrizeInfo(String monthStr) {
Date monthDate = parseMonth(monthStr);
Calendar monthCal = Calendar.getInstance();
monthCal.setTime(monthDate);
int year = monthCal.get(Calendar.YEAR);
int month = monthCal.get(Calendar.MONTH) + 1;
JSONObject sum = new JSONObject();
sum.put("gross_amount", 0);
sum.put("org_charge", 0);
List<JSONObject> referrerPrizes = financialAgentCommissionMapper.list(year, month);
for (JSONObject prize : referrerPrizes) {
plusKey(sum, prize, "gross_amount");
plusKey(sum, prize, "org_charge");
prize.put("monthstr", monthStr);
}
sum.put("referrer", referrerPrizes);
sum.put("monthstr", monthStr);
return sum;
}
@Override
public JSONObject getAgentPrizeDetail(String monthStr, String orgId) {
Date monthDate = parseMonth(monthStr);
Calendar monthCal = Calendar.getInstance();
monthCal.setTime(monthDate);
int year = monthCal.get(Calendar.YEAR);
int month = monthCal.get(Calendar.MONTH) + 1;
JSONObject result = new JSONObject();
List<JSONObject> total = financialAgentCommissionMapper.find(year, month, orgId);
if (CollectionUtils.isEmpty(total)) {
return null;
}
List<String> recordIds = new ArrayList<>();
for (JSONObject jsonObject : total) {
result.put("name", jsonObject.getString("name"));
recordIds.add(jsonObject.getString("record_id"));
}
List<JSONObject> details = financialAgentCommissionDetailMapper.listDetailsByRecordIds(recordIds);
Map<String, List<JSONObject>> detailMap = new HashMap<>();
for (JSONObject detail : details) {
String key = detail.getString("client_id");
if (detailMap.containsKey(key)) {
detailMap.get(key).add(detail);
} else {
List<JSONObject> tmpList = new ArrayList<>();
tmpList.add(detail);
detailMap.put(key, tmpList);
}
}
List<JSONObject> partnerClientInfos = new ArrayList<>();
BigDecimal resultGrossAmount = BigDecimal.ZERO;
BigDecimal resultOrgCharge = BigDecimal.ZERO;
for (Map.Entry<String, List<JSONObject>> entry : detailMap.entrySet()) {
JSONObject sumResult = new JSONObject();
BigDecimal grossAmount = BigDecimal.ZERO;
BigDecimal orgCharge = BigDecimal.ZERO;
String clientMoniker = "";
for (JSONObject jsonObject : entry.getValue()) {
grossAmount = grossAmount.add(jsonObject.getBigDecimal("gross_amount"));
orgCharge = orgCharge.add(jsonObject.getBigDecimal("org_charge"));
clientMoniker = jsonObject.getString("client_moniker");
}
resultGrossAmount = resultGrossAmount.add(grossAmount);
resultOrgCharge = resultOrgCharge.add(orgCharge);
sumResult.put("gross_amount", grossAmount);
sumResult.put("org_charge", orgCharge);
sumResult.put("client_moniker", clientMoniker);
partnerClientInfos.add(sumResult);
}
result.put("partner_client_infos", partnerClientInfos);
result.put("monthstr", monthStr);
result.put("gross_amount", resultGrossAmount);
result.put("org_charge", resultOrgCharge);
return result;
}
@Override
public List<JSONObject> getAgentPrizeInfoList(String monthStr) {
Date monthDate = parseMonth(monthStr);
Calendar monthCal = Calendar.getInstance();
monthCal.setTime(monthDate);
int year = monthCal.get(Calendar.YEAR);
int month = monthCal.get(Calendar.MONTH) + 1;
return financialAgentCommissionMapper.list(year, month);
}
}

@ -2,17 +2,27 @@ package au.com.royalpay.payment.manage.citypartner.web;
import au.com.royalpay.payment.manage.citypartner.core.CityPartnerPrizeService;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
/**
* Created by yixian on 2017-03-08.
*/
@ -107,6 +117,7 @@ public class CityPartnerPrizeController {
String month = param.getString("month");
cityPartnerPrizeService.generateReferrer(month);
}
@ManagerMapping("/referrer/months/{monthStr}/orgs/{orgId}")
public JSONObject getreferrerPrizeDetail(@PathVariable String monthStr, @PathVariable String orgId) {
return cityPartnerPrizeService.getReferrerPrizeDetail(monthStr, orgId);
@ -160,4 +171,64 @@ public class CityPartnerPrizeController {
result.put("partner_info_list",partnerInfos);
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);
}
@RequestMapping("/agent/months")
public List<JSONObject> listAgentAvailableMonths(@RequestParam String year) {
return cityPartnerPrizeService.listAgentAvailableMonths(year);
}
@RequestMapping(value = "/agent/months/{monthStr}")
public JSONObject getAgentPrizeInfo(@PathVariable String monthStr) {
List<JSONObject> partnerPrizeInfos = cityPartnerPrizeService.getAgentPrizeInfoList(monthStr);
Map<String, List<JSONObject>> partenerPrizeMap = new HashMap<>();
for (JSONObject partnerPrizeInfo : partnerPrizeInfos) {
String key = partnerPrizeInfo.getString("org_id");
if (partenerPrizeMap.containsKey(key)) {
partenerPrizeMap.get(key).add(partnerPrizeInfo);
} else {
List<JSONObject> tmpList = new ArrayList<>();
tmpList.add(partnerPrizeInfo);
partenerPrizeMap.put(key, tmpList);
}
}
JSONObject result = new JSONObject();
List<JSONObject> partnerInfos = new ArrayList<>(partenerPrizeMap.size());
BigDecimal resultGrossAmount = BigDecimal.ZERO;
BigDecimal resultOrgCharge = BigDecimal.ZERO;
for (Map.Entry<String, List<JSONObject>> entry : partenerPrizeMap.entrySet()) {
JSONObject sumResult = new JSONObject();
BigDecimal grossAmount = BigDecimal.ZERO;
BigDecimal orgCharge = BigDecimal.ZERO;
String cityPartnerName = "";
int org_id = 0;
for (JSONObject jsonObject : entry.getValue()) {
grossAmount = grossAmount.add(jsonObject.getBigDecimal("gross_amount"));
orgCharge = orgCharge.add(jsonObject.getBigDecimal("org_charge"));
org_id = jsonObject.getIntValue("org_id");
cityPartnerName = jsonObject.getString("name");
}
sumResult.put("gross_amount", grossAmount);
sumResult.put("org_charge", orgCharge);
sumResult.put("org_name", cityPartnerName);
sumResult.put("org_id", org_id);
sumResult.put("channel_detail", entry.getValue());
resultGrossAmount = resultGrossAmount.add(grossAmount);
resultOrgCharge = resultOrgCharge.add(orgCharge);
partnerInfos.add(sumResult);
}
result.put("monthstr", monthStr);
result.put("gross_amount",resultGrossAmount);
result.put("org_charge",resultOrgCharge);
result.put("partner_info_list",partnerInfos);
return result;
}
}

@ -96,7 +96,7 @@ public interface TransactionMapper {
List<JSONObject> listTransactionsForReferrerCommission(@Param("year") int year, @Param("month") int month);
List<JSONObject> listTransactionsForAgentCommission(@Param("year") int year, @Param("month") int month);
List<JSONObject> listTransactionsForAgentCommission(@Param("year") int year, @Param("month") int month,@Param("parent_org_id") int parent_org_id);
BigDecimal checkBalance(@Param("end") Date endDate);

@ -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.type=1
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.type=1
WHERE c.year = #{year} AND c.month = #{month}
</select>
</mapper>

@ -515,7 +515,6 @@
sum(if(t.transaction_type = 'Credit', t.clearing_amount, -t.clearing_amount))
total,
t.client_id client_id,
so.org_id org_id,
c.approve_time client_create_time,
c.source client_source,
date(t.transaction_time) trade_date,
@ -549,7 +548,7 @@
FROM pmt_transactions t
INNER JOIN sys_clients c ON c.client_id = t.client_id
INNER JOIN sys_org so
ON c.org_id = so.org_id AND so.is_valid = 1 AND so.type = 0 AND so.parent_org_id is not null
ON c.org_id = so.org_id AND so.is_valid = 1 AND so.type = 0 AND so.parent_org_id = #{parent_org_id}
WHERE year(t.transaction_time) = #{year} AND month(t.transaction_time) = #{month} AND t.channel != 'Settlement'
GROUP BY t.client_id, trade_date, channel
ORDER BY c.org_id ASC, t.client_id ASC, trade_date ASC

@ -326,6 +326,13 @@ margin-bottom: 10%;"/>
<i class="fa fa-users"></i> <span>周末费率减半活动</span>
</a>
</li>
<li class="header nav-header" ng-if="('1000000000000'|withRole)|| currentUser.org_id==null">机构|Agent</li>
<li ui-sref-active="active" ng-if="('1000000000000'|withRole)|| currentUser.org_id==null">
<a ui-sref="analysis_agent" ui-sref-opts="{reload:true}">
<i class="fa fa-hand-peace-o"></i> <span>机构数据分析|Agent Analysis</span>
</a>
</li>
<li class="header nav-header" ng-if="('1011110'|withRole)|| currentUser.org_id==null">数据分析|Analysis</li>

@ -0,0 +1,104 @@
/**
* 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/agentcommission',
templateUrl: '/static/agent/commission/templates/agent_commission_root.html',
controller: 'agentCommissionRootCtrl'
}).state('analysis_agent.agentcommission.month', {
url: '/analysis_agent/agentcommission/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: '/analysis_agent/agentcommission/{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,185 @@
<style type="text/css">
.nowrap > div {
white-space: nowrap;
}
</style>
<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">
Net Charge:{{detail.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">Net Charge:<span
ng-bind="detail.Alipay_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">Net Charge:<span
ng-bind="detail.Bestpay_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">Net Charge:<span
ng-bind="detail.Wechat_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">Net Charge:<span
ng-bind="detail.jd_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>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.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>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.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>

@ -0,0 +1,88 @@
<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.total_charge|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">
Net Charge:<span ng-bind="monthData.net_charge|currency:'AUD'"></span>
</div>
<div class="col-xs-6 col-sm-3">
City Partner 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>City Partner 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.total_charge|currency:'AUD'"></td>
<td ng-bind="log.royalpay_charge|currency:'AUD'"></td>
<td ng-bind="log.net_charge|currency:'AUD'"></td>
<td ng-bind="log.org_charge|currency:'AUD'"></td>
<td>
<a ui-sref=".orgdetail({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>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.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,60 @@
<!--<section class="content-header">-->
<!--<h1>City Partner Commissions</h1>-->
<!--<ol class="breadcrumb">-->
<!--<li><i class="fa fa-users"></i> Analysis</li>-->
<!--<li class="active">City Partner Commissions</li>-->
<!--</ol>-->
<!--</section>-->
<section class="content">
<div class="box box-default">
<div class="box-body">
<div class="form-inline">
<div class="form-group">
<input type="text" class="form-control" uib-datepicker-popup="yyyy-MM" ng-model="generate.month"
is-open="ctrl.genmonth" datepicker-options="{minMode: 'month'}"
ng-click="ctrl.genmonth=true" placeholder="Select Month"/>
</div>
<button class="btn btn-primary" ng-click="generateOrgCommission()" ng-disabled="!generate.month">
Generate
</button>
<loadingbar ng-if="generate.status"></loadingbar>
</div>
</div>
</div>
<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">RoyalPay Charge:</span>
<span class="text-green" ng-bind="mon.royalpay_charge|currency:'AUD'"></span>
</div>
<div class="info-box-number-right">
<span class="text-bold">City Partner 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>

@ -21,7 +21,7 @@ public class CityPartnerPrizeServiceImplTest {
private CityPartnerPrizeService cityPartnerPrizeService;
@Test
public void generateAgent() throws Exception {
cityPartnerPrizeService.generateAgent("2017-06");
cityPartnerPrizeService.generateAgent("2017-06",9);
}
}
Loading…
Cancel
Save