wangning 7 years ago
parent fb1f4f95b2
commit b46745ed55

@ -518,7 +518,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
JSONObject item = new JSONObject(); JSONObject item = new JSONObject();
item.put("month", mon); item.put("month", mon);
item.put("monthstr", year + "-" + StringUtils.substring("00" + mon, -2)); item.put("monthstr", year + "-" + StringUtils.substring("00" + mon, -2));
JSONObject chargeInfo = getReferrerPrizeInfo(item.getString("monthstr")); JSONObject chargeInfo = getAgentPrizeInfo(item.getString("monthstr"));
item.put("org_charge", chargeInfo.getString("org_charge")); item.put("org_charge", chargeInfo.getString("org_charge"));
item.put("gross_amount", chargeInfo.getString("gross_amount")); item.put("gross_amount", chargeInfo.getString("gross_amount"));
monthObjs.add(item); monthObjs.add(item);

@ -122,10 +122,12 @@ public class CityPartnerPrizeController {
public JSONObject getreferrerPrizeDetail(@PathVariable String monthStr, @PathVariable String orgId) { public JSONObject getreferrerPrizeDetail(@PathVariable String monthStr, @PathVariable String orgId) {
return cityPartnerPrizeService.getReferrerPrizeDetail(monthStr, orgId); return cityPartnerPrizeService.getReferrerPrizeDetail(monthStr, orgId);
} }
@RequestMapping("/referrer/months") @RequestMapping("/referrer/months")
public List<JSONObject> listReferrerAvailableMonths(@RequestParam String year) { public List<JSONObject> listReferrerAvailableMonths(@RequestParam String year) {
return cityPartnerPrizeService.listReferrerAvailableMonths(year); return cityPartnerPrizeService.listReferrerAvailableMonths(year);
} }
@RequestMapping(value = "/referrer/months/{monthStr}") @RequestMapping(value = "/referrer/months/{monthStr}")
public JSONObject getReferrerPrizeInfo(@PathVariable String monthStr) { public JSONObject getReferrerPrizeInfo(@PathVariable String monthStr) {
List<JSONObject> partnerPrizeInfos = cityPartnerPrizeService.getReferrerPrizeInfoList(monthStr); List<JSONObject> partnerPrizeInfos = cityPartnerPrizeService.getReferrerPrizeInfoList(monthStr);
@ -182,10 +184,12 @@ public class CityPartnerPrizeController {
public JSONObject getAgentPrizeDetail(@PathVariable String monthStr, @PathVariable String orgId) { public JSONObject getAgentPrizeDetail(@PathVariable String monthStr, @PathVariable String orgId) {
return cityPartnerPrizeService.getAgentPrizeDetail(monthStr, orgId); return cityPartnerPrizeService.getAgentPrizeDetail(monthStr, orgId);
} }
@RequestMapping("/agent/months") @RequestMapping("/agent/months")
public List<JSONObject> listAgentAvailableMonths(@RequestParam String year) { public List<JSONObject> listAgentAvailableMonths(@RequestParam String year) {
return cityPartnerPrizeService.listAgentAvailableMonths(year); return cityPartnerPrizeService.listAgentAvailableMonths(year);
} }
@RequestMapping(value = "/agent/months/{monthStr}") @RequestMapping(value = "/agent/months/{monthStr}")
public JSONObject getAgentPrizeInfo(@PathVariable String monthStr) { public JSONObject getAgentPrizeInfo(@PathVariable String monthStr) {
List<JSONObject> partnerPrizeInfos = cityPartnerPrizeService.getAgentPrizeInfoList(monthStr); List<JSONObject> partnerPrizeInfos = cityPartnerPrizeService.getAgentPrizeInfoList(monthStr);
@ -200,35 +204,69 @@ public class CityPartnerPrizeController {
partenerPrizeMap.put(key, tmpList); partenerPrizeMap.put(key, tmpList);
} }
} }
BigDecimal royalpay_charge = BigDecimal.ZERO;
List<JSONObject> partnerPrizeList = cityPartnerPrizeService.getCityPartnerPrizeInfoList(monthStr);
Map<Integer, JSONObject> countPartnerPrizeMap = new HashMap<>();
for (JSONObject p : partnerPrizeList) {
royalpay_charge = royalpay_charge.add(p.getBigDecimal("royalpay_charge"));
Integer key = p.getInteger("org_id");
JSONObject partnerTmp = countPartnerPrizeMap.get(key);
if (partnerTmp == null) {
JSONObject partner = new JSONObject();
partner.put("royalpay_charge", p.getBigDecimal("royalpay_charge"));
countPartnerPrizeMap.put(key, partner);
} else {
partnerTmp.put("royalpay_charge", partnerTmp.getBigDecimal("royalpay_charge").add(p.getBigDecimal("royalpay_charge")));
}
}
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
List<JSONObject> partnerInfos = new ArrayList<>(partenerPrizeMap.size()); List<JSONObject> partnerInfos = new ArrayList<>(partenerPrizeMap.size());
BigDecimal resultGrossAmount = BigDecimal.ZERO; BigDecimal resultGrossAmount = BigDecimal.ZERO;
BigDecimal resultOrgCharge = BigDecimal.ZERO; BigDecimal resultOrgCharge = BigDecimal.ZERO;
BigDecimal resultAgentCharge = BigDecimal.ZERO;
BigDecimal resultOrgNetCharge = BigDecimal.ZERO;
for (Map.Entry<String, List<JSONObject>> entry : partenerPrizeMap.entrySet()) { for (Map.Entry<String, List<JSONObject>> entry : partenerPrizeMap.entrySet()) {
JSONObject sumResult = new JSONObject(); JSONObject sumResult = new JSONObject();
BigDecimal grossAmount = BigDecimal.ZERO; BigDecimal grossAmount = BigDecimal.ZERO;
BigDecimal orgCharge = BigDecimal.ZERO; BigDecimal orgCharge = BigDecimal.ZERO;
BigDecimal agentCharge = BigDecimal.ZERO;
BigDecimal orgNetCharge = BigDecimal.ZERO;
String cityPartnerName = ""; String cityPartnerName = "";
int org_id = 0; int org_id = 0;
for (JSONObject jsonObject : entry.getValue()) { for (JSONObject jsonObject : entry.getValue()) {
grossAmount = grossAmount.add(jsonObject.getBigDecimal("gross_amount")); grossAmount = grossAmount.add(jsonObject.getBigDecimal("gross_amount"));
orgCharge = orgCharge.add(jsonObject.getBigDecimal("org_charge")); orgCharge = orgCharge.add(jsonObject.getBigDecimal("org_charge"));
agentCharge = agentCharge.add(jsonObject.getBigDecimal("total_charge"));
orgNetCharge = orgNetCharge.add(jsonObject.getBigDecimal("org_net_charge"));
org_id = jsonObject.getIntValue("org_id"); org_id = jsonObject.getIntValue("org_id");
cityPartnerName = jsonObject.getString("name"); cityPartnerName = jsonObject.getString("name");
} }
sumResult.put("gross_amount", grossAmount); sumResult.put("gross_amount", grossAmount);
sumResult.put("org_charge", orgCharge); sumResult.put("org_charge", orgCharge);
sumResult.put("org_net_charge",orgNetCharge);
sumResult.put("org_name", cityPartnerName); sumResult.put("org_name", cityPartnerName);
sumResult.put("org_id", org_id); sumResult.put("org_id", org_id);
sumResult.put("channel_detail", entry.getValue()); sumResult.put("channel_detail", entry.getValue());
sumResult.put("royalpay_charge",countPartnerPrizeMap.get(org_id)==null?0:countPartnerPrizeMap.get(org_id).getBigDecimal("royalpay_charge"));
resultGrossAmount = resultGrossAmount.add(grossAmount); resultGrossAmount = resultGrossAmount.add(grossAmount);
resultOrgCharge = resultOrgCharge.add(orgCharge); resultOrgCharge = resultOrgCharge.add(orgCharge);
resultAgentCharge = resultAgentCharge.add(agentCharge);
resultOrgNetCharge = resultOrgNetCharge.add(orgNetCharge);
partnerInfos.add(sumResult); partnerInfos.add(sumResult);
} }
result.put("royalpay_charge", royalpay_charge);
result.put("monthstr", monthStr); result.put("monthstr", monthStr);
result.put("gross_amount", resultGrossAmount); result.put("gross_amount", resultGrossAmount);
result.put("agent_total_charge", resultAgentCharge);
result.put("org_charge", resultOrgCharge); result.put("org_charge", resultOrgCharge);
result.put("org_net_charge", resultOrgNetCharge);
result.put("partner_info_list", partnerInfos); result.put("partner_info_list", partnerInfos);
return result; return result;
} }
} }

@ -12,7 +12,7 @@
c.*, c.*,
o.name `name` o.name `name`
FROM financial_agent_commission c FROM financial_agent_commission c
INNER JOIN sys_org o ON o.org_id = c.org_id and o.type=1 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} WHERE c.year = #{year} AND c.month = #{month} and c.org_id=#{org_id}
</select> </select>
<select id="list" resultType="com.alibaba.fastjson.JSONObject"> <select id="list" resultType="com.alibaba.fastjson.JSONObject">
@ -20,7 +20,7 @@
c.*, c.*,
o.name o.name
FROM financial_agent_commission c FROM financial_agent_commission c
INNER JOIN sys_org o ON o.org_id = c.org_id and o.type=1 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} WHERE c.year = #{year} AND c.month = #{month}
</select> </select>
</mapper> </mapper>

@ -6,10 +6,14 @@ define(['angular','../../agent/commission/commission'], function (angular) {
var app = angular.module('agentCommission', ['ui.router']); var app = angular.module('agentCommission', ['ui.router']);
app.config(['$stateProvider', function ($stateProvider) { app.config(['$stateProvider', function ($stateProvider) {
$stateProvider.state('analysis_agent', { $stateProvider.state('analysis_agent', {
url: '/analysis_agent/agentcommission', url: '/analysis_agent',
templateUrl: '/static/agent/commission/templates/agent_commission_root.html', templateUrl: '/static/agent/commission/templates/agent_commission_root.html',
controller: 'agentCommissionRootCtrl' controller: 'agentCommissionRootCtrl'
}).state('analysis_agent.agentcommission', { }).state('analysis_agent.agentcommission', {
url:'/agentcommission',
template:'<div ui-view></div>',
controller:['$scope',function ($scope) {
}]
}).state('analysis_agent.agentcommission.month', { }).state('analysis_agent.agentcommission.month', {
url: '/months/{monthStr}', url: '/months/{monthStr}',
templateUrl: '/static/agent/commission/templates/agent_commission_month.html', templateUrl: '/static/agent/commission/templates/agent_commission_month.html',
@ -20,7 +24,7 @@ define(['angular','../../agent/commission/commission'], function (angular) {
}] }]
} }
}).state('analysis_agent.agentcommission.month.agentdetail', { }).state('analysis_agent.agentcommission.month.agentdetail', {
url: '/{orgId}', url: '/orgs/{orgId}',
templateUrl: '/static/agent/commission/templates/agent_commission_detail.html', templateUrl: '/static/agent/commission/templates/agent_commission_detail.html',
controller: 'agentCommissionagentDetailCtrl', controller: 'agentCommissionagentDetailCtrl',
resolve: { resolve: {
@ -34,8 +38,7 @@ define(['angular','../../agent/commission/commission'], function (angular) {
app.controller('agentCommissionRootCtrl', ['$scope', '$http', '$filter', '$state', 'commonDialog', app.controller('agentCommissionRootCtrl', ['$scope', '$http', '$filter', '$state', 'commonDialog',
function ($scope, $http, $filter, $state, commonDialog) { function ($scope, $http, $filter, $state, commonDialog) {
$scope.generate = {}; $scope.generate = {};
$scope.generateagentCommission = function () { $scope.generateAgentCommission = function () {
alert(1);
$scope.generate.status = {}; $scope.generate.status = {};
if (!$scope.generate.month) { if (!$scope.generate.month) {
commonDialog.alert({ commonDialog.alert({

@ -5,7 +5,7 @@
} }
</style> </style>
<div ui-view>
<div class="box box-warning" ng-if="detail"> <div class="box box-warning" ng-if="detail">
<div class="box-header">Analysis</div> <div class="box-header">Analysis</div>
<div class="box-body nowrap"> <div class="box-body nowrap">
@ -183,3 +183,4 @@
</table> </table>
</div> </div>
</div> </div>
</div>

@ -7,16 +7,16 @@
Month:<span ng-bind="monthData.monthstr"></span> Month:<span ng-bind="monthData.monthstr"></span>
</div> </div>
<div class="col-xs-6 col-sm-3"> <div class="col-xs-6 col-sm-3">
Total Charge:<span ng-bind="monthData.total_charge|currency:'AUD'"></span> Total Charge:<span ng-bind="monthData.agent_total_charge|currency:'AUD'"></span>
</div> </div>
<div class="col-xs-6 col-sm-3"> <div class="col-xs-6 col-sm-3">
RoyalPay Charge:<span ng-bind="monthData.royalpay_charge|currency:'AUD'"></span> RoyalPay Charge:<span ng-bind="monthData.royalpay_charge|currency:'AUD'"></span>
</div> </div>
<div class="col-xs-6 col-sm-3"> <div class="col-xs-6 col-sm-3">
Net Charge:<span ng-bind="monthData.net_charge|currency:'AUD'"></span> Net Charge:<span ng-bind="monthData.org_net_charge|currency:'AUD'"></span>
</div> </div>
<div class="col-xs-6 col-sm-3"> <div class="col-xs-6 col-sm-3">
City Partner Charge:<span ng-bind="monthData.org_charge|currency:'AUD'"></span> Org Charge:<span ng-bind="monthData.org_charge|currency:'AUD'"></span>
</div> </div>
</div> </div>
</div> </div>
@ -32,7 +32,6 @@
<th>Total Charge</th> <th>Total Charge</th>
<th>RoyalPay Charge</th> <th>RoyalPay Charge</th>
<th>Net Charge</th> <th>Net Charge</th>
<th>City Partner Charge</th>
<th>Details</th> <th>Details</th>
</tr> </tr>
</thead> </thead>
@ -40,12 +39,11 @@
<tr ng-repeat-start="log in monthData.partner_info_list"> <tr ng-repeat-start="log in monthData.partner_info_list">
<td ng-bind="log.org_name"></td> <td ng-bind="log.org_name"></td>
<td ng-bind="log.gross_amount|currency:'AUD'"></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 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> <td>
<a ui-sref=".orgdetail({orgId:log.org_id})"> <a ui-sref=".agentdetail({orgId:log.org_id})">
<i class="fa fa-search"></i> <i class="fa fa-search"></i>
</a> </a>
<a role="button" ng-click="active(log)"> <a role="button" ng-click="active(log)">

@ -15,7 +15,7 @@
ng-click="ctrl.genmonth=true" placeholder="Select Month"/> ng-click="ctrl.genmonth=true" placeholder="Select Month"/>
</div> </div>
<button class="btn btn-primary" ng-click="generateOrgCommission()" ng-disabled="!generate.month"> <button class="btn btn-primary" ng-click="generateAgentCommission()" ng-disabled="!generate.month">
Generate Generate
</button> </button>
<loadingbar ng-if="generate.status"></loadingbar> <loadingbar ng-if="generate.status"></loadingbar>
@ -39,14 +39,10 @@
<div> <div>
<div class="info-box-number-right"> <div class="info-box-number-right">
<span class="text-bold">Total Charge:</span> <span class="text-bold">Total Charge:</span>
<span class="text-green" ng-bind="mon.total_charge|currency:'AUD'"></span> <span class="text-green" ng-bind="mon.gross_amount|currency:'AUD'"></span>
</div> </div>
<div class="info-box-number-right"> <div class="info-box-number-right">
<span class="text-bold">RoyalPay Charge:</span> <span class="text-bold">Org 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> <span class="text-green" ng-bind="mon.org_charge|currency:'AUD'"></span>
</div> </div>
</div> </div>

Loading…
Cancel
Save