add 三级商户子商户相互退款

master
luoyang 6 years ago
parent 36a7c7f335
commit a72c3f83e2

@ -243,6 +243,8 @@ public interface ClientManager {
void changePaymentSuccessPage(JSONObject manager, String clientMoniker, String paysuccess_version);
void switchChildEachRefund(JSONObject manager, String clientMoniker, boolean childEachRefund);
void changePaymentPage(JSONObject account, String paypad_version);
void changeManualSettle(JSONObject account , int client_id, boolean manual_settle,String operator_id,int type,String operation);

@ -16,6 +16,7 @@ import au.com.royalpay.payment.channels.yeepay.runtime.YeePayClient;
import au.com.royalpay.payment.core.PaymentChannelApi;
import au.com.royalpay.payment.core.exceptions.EmailException;
import au.com.royalpay.payment.core.exceptions.InvalidShortIdException;
import au.com.royalpay.payment.core.mappers.SysClientMapper;
import au.com.royalpay.payment.core.utils.OrderExpiryRuleResolver;
import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper;
import au.com.royalpay.payment.manage.appclient.beans.AppClientBean;
@ -271,6 +272,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Resource
private FinancialSurchargeAccountDetailMapper financialSurchargeAccountDetailMapper;
@Resource
private SysClientMapper sysClientMapper;
@Resource
private Locker locker;
@ -414,6 +417,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
client.put("client_pay_type",client.getString("client_pay_type").split(","));
client.put("client_pay_desc",client.getString("client_pay_desc").split(","));
}
if (StringUtils.isNotBlank(client.getString("parent_client_id"))
&& sysClientMapper.childClientId(client.getIntValue("client_id")).size() > 0) {
client.put("level2_client", 1);
}
return client;
}
@ -3216,6 +3223,19 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
clientMapper.update(client);
}
@Override
public void switchChildEachRefund(JSONObject manager, String clientMoniker, boolean childEachRefund) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
JSONObject clientConfig = clientConfigMapper.find(client.getIntValue("client_id"));
clientConfig.put("child_each_refund", childEachRefund);
clientConfigMapper.update(clientConfig);
clientInfoCacheSupport.clearClientCache(client.getIntValue("client_id"));
}
@Override
public void changePaymentPage(JSONObject account, String paypad_version) {
int clientId = account.getIntValue("client_id");

@ -275,6 +275,11 @@ public class PartnerManageController {
clientManager.switchPermission(manager, clientMoniker, "sub_manage", pass.getBooleanValue("allow"));
}
@ManagerMapping(value = "/{clientMoniker}/child_each_refund", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR})
public void switchChildEachRefund(@PathVariable String clientMoniker, @RequestBody JSONObject pass, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.switchChildEachRefund(manager, clientMoniker, pass.getBooleanValue("allow"));
}
@ManagerMapping(value = "/{clientMoniker}/channels/{channel}/permission", method = RequestMethod.PUT, role = {ManagerRole.SERVANT, ManagerRole.DEVELOPER})
public void switchChannelPermission(@PathVariable String clientMoniker, @PathVariable String channel, @RequestBody JSONObject pass, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.switchChannelPermission(manager, clientMoniker, channel, pass.getBooleanValue("allow"));

@ -2183,6 +2183,11 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}]);
app.controller('partnerSubCtrl', ['$scope', '$http', '$uibModal', function ($scope, $http, $uibModal) {
$scope.toShow = false;
$scope.init = {
child_each_refund : false,
sub_manage : false
}
$scope.newSubClient = function () {
$uibModal.open({
templateUrl: '/static/payment/partner/templates/add_sub_partner_dialog.html',
@ -2221,7 +2226,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.init.sub_manage = true;
return;
}
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/sub_manage', {allow: $scope.paymentInfo.sub_manage}).then(function () {
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/sub_manage', {allow: $scope.partner.sub_manage}).then(function () {
//$scope.loadPartnerPaymentInfo();
}, function (resp) {
commonDialog.alert({
@ -2232,6 +2237,25 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
})
};
$scope.switchChildEachRefund = function () {
if (!$scope.partner) {
return;
}
if (!$scope.init.child_each_refund) {
$scope.init.child_each_refund = true;
return;
}
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/child_each_refund', {allow: $scope.partner.child_each_refund}).then(function () {
$scope.loadPartnerPaymentInfo();
}, function (resp) {
commonDialog.alert({
title: 'Failed to change Sub Partners Manage status',
content: resp.data.message,
type: 'error'
})
})
};
$scope.showClient = function (sub_client) {
if ($scope.sub_client_id == sub_client.client_id) {
return;

@ -48,23 +48,35 @@
}
</style>
<div class="panel panel-default" ng-if="'111'|withRole">
<div class="panel-body pull-right" ng-if="('10'|withRole) && partner.parent_client_id==null">
<div class="panel-body">
Sub Partners Manage <input type="checkbox" ng-model="paymentInfo.sub_manage" bs-switch switch-change="switchSubManage()">
</div>
<a>开启后,父商户具有帮子商户新建账户、退款等管理权限</a>
</div>
<div class="panel panel-default" ng-if="('111'|withRole)">
<div class="panel-heading">配置子商户权限</div>
<div class="panel-body">
<div class="form-horizontal">
<div class="panel-body" style="margin-bottom: 10px">
<button class="btn btn-primary" type="button" ng-click="newSubClient()">
<i class="fa fa-plus"></i> New Sub Partner
</button>
</div>
<div class="form-group" style="margin-left: 0;" ng-if="('10'|withRole) && partner.level2_client">
<label class="col-sm-4">允许子商户退款同级商户</label>
<div class="col-sm-6">
<input type="checkbox" ng-model="partner.child_each_refund" bs-switch
switch-change="switchChildEachRefund()">
</div>
</div>
<div class="form-group" style="margin-left: 0;margin-bottom: 0;" ng-if="('10'|withRole) && partner.parent_client_id==null">
<label class="col-sm-4">Sub Partners Manage </label>
<div class="col-sm-6">
<input type="checkbox" ng-model="partner.sub_manage" bs-switch
switch-change="switchSubManage()">
<p class="text-info"><i class="fa fa-info"></i> 开启后,父商户具有帮子商户新建账户、退款等管理权限</p>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12 table-responsive">
<table class="table table-bordered table-striped table-hover">

Loading…
Cancel
Save