增加sub_merchant_id修改列表

master
yuan 7 years ago
parent 2e44dd4214
commit 1ff7c46bc3

@ -0,0 +1,19 @@
package au.com.royalpay.payment.manage.mappers.log;
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@AutoMapper(tablename = "log_client_sub_merchant_id", pkName = "id")
public interface LogClientSubMerchantIdMapper {
@AutoSql(type = SqlType.INSERT)
void save(JSONObject log);
@AutoSql(type = SqlType.SELECT)
List<JSONObject> listLogsByClientId(@Param("client_id") int client_id);
}

@ -286,4 +286,6 @@ public interface ClientManager {
void clearCacheSubMerchantIdApplices(String clientMoniker);
JSONObject getCheckClientInfo(int client_id,String account_id, String channel);
List<JSONObject> getClientSubMerchantIdLogs(String clientMoniker,JSONObject manager);
}

@ -14,6 +14,7 @@ import au.com.royalpay.payment.manage.appclient.beans.AppClientBean;
import au.com.royalpay.payment.manage.device.core.DeviceManager;
import au.com.royalpay.payment.manage.mappers.financial.FinancialBDConfigMapper;
import au.com.royalpay.payment.manage.mappers.log.ClientsOperationLogMapper;
import au.com.royalpay.payment.manage.mappers.log.LogClientSubMerchantIdMapper;
import au.com.royalpay.payment.manage.mappers.log.LogSettleMailMapper;
import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper;
import au.com.royalpay.payment.manage.mappers.redpack.ActClientInvitationCodeMapper;
@ -225,6 +226,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
private MessageSource messageSource;
@Resource
private ClientsOperationLogMapper clientsOperationLogMapper;
@Resource
private LogClientSubMerchantIdMapper logClientSubMerchantIdMapper;
@Resource
private ClientInfoCacheSupport clientInfoCacheSupport;
@ -278,6 +282,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
client.put("show_all_permission", true);
int role = manager != null ? manager.getIntValue("role") : 0;
if (manager != null) {
if(ManagerRole.OPERATOR.hasRole(role)){
List<JSONObject> log = logClientSubMerchantIdMapper.listLogsByClientId(client.getInteger("client_id"));
client.put("sub_merchant_id_log", log.size()>0?true:false);
}
if (ManagerRole.BD_USER.hasRole(role)) {
int checkBDPermission = clientBDMapper.checkBDPermission(client.getIntValue("client_id"), manager.getString("manager_id"));
client.put("show_all_permission", checkBDPermission > 0);
@ -581,16 +589,35 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
WeChatPayConfig.Merchant availableMerchant = mpPaymentApi.determineMerchant(subMerchantId);
update.put("merchant_id", availableMerchant == null ? null : availableMerchant.getMerchantId());
update.put("sub_merchant_id", subMerchantId);
try{
recordSubMerchantLog(client,subMerchantInfo,manager);
}catch(Exception e){
logger.error("记录log_client_sub_merchant_id失败",e);
}
clientMapper.update(update);
List<JSONObject> children = clientMapper.listChildClients(clientId);
for (JSONObject child : children) {
if (Objects.equals(child.getString("sub_merchant_id"), originSubMerchantId)) {
update.put("client_id", child.getIntValue("client_id"));
try{
recordSubMerchantLog(child,subMerchantInfo,manager);
}catch(Exception e){
logger.error("记录log_client_sub_merchant_id失败",e);
}
clientMapper.update(update);
}
}
clientInfoCacheSupport.clearClientCache(clientId);
}
private void recordSubMerchantLog(JSONObject client,JSONObject subMerchantInfo,JSONObject manager){
JSONObject log = new JSONObject();
log.put("sub_merchant_id_after",subMerchantInfo.getString("sub_merchant_id"));
log.put("operator",manager.getString("display_name"));
log.put("create_time",new Date());
log.put("client_id",client.getIntValue("client_id"));
log.put("sub_merchant_id_before",client.getString("sub_merchant_id"));
logClientSubMerchantIdMapper.save(log);
}
@Override
public void auditClient(JSONObject manager, String clientMoniker, int pass) {
@ -3340,4 +3367,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
return sourceStr;
}
@Override
public List<JSONObject> getClientSubMerchantIdLogs(String clientMoniker, JSONObject manager) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
return logClientSubMerchantIdMapper.listLogsByClientId(client.getInteger("client_id"));
}
}

@ -526,4 +526,9 @@ public class PartnerManageController {
return clientManager.listMerchantIds(clientMoniker,manager);
}
@ManagerMapping(value = "/{clientMoniker}/get_sub_merchant_id_logs",method = RequestMethod.GET,role = {ManagerRole.OPERATOR})
public List<JSONObject> getClientSubMerchantIdLogs(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return clientManager.getClientSubMerchantIdLogs(clientMoniker,manager);
}
}

@ -1049,7 +1049,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}
}
}]);
app.controller('partnerPaymentInfoCtrl', ['$scope', '$http', '$state', 'commonDialog', function ($scope, $http, $state, commonDialog) {
app.controller('partnerPaymentInfoCtrl', ['$scope', '$http', '$state', 'commonDialog','$uibModal', function ($scope, $http, $state, commonDialog,$uibModal) {
$scope.loadPartnerPaymentInfo = function () {
$http.get('/sys/partners/' + $scope.partner.client_moniker).then(function (resp) {
$scope.paymentInfo = resp.data;
@ -1068,6 +1068,21 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.reloadQRCode();
$scope.loadPartnerPaymentInfo();
$scope.showSubMerchantLogs = function () {
$uibModal.open({
templateUrl: '/static/payment/partner/templates/client_sub_merchant_id_log.html',
controller: 'clientSubMerchantIdLogCtrl',
size: 'lg',
resolve: {
logs: ['$http', function ($http) {
return $http.get('/sys/partners/'+$scope.partner.client_moniker+'/get_sub_merchant_id_logs');
}]
}
}).result.then(function () {
$scope.loadSubClients();
});
};
$scope.saveMaxOrderAmount = function (limit) {
if (limit != null && isNaN(limit)) {
commonDialog.alert({title: 'Error', content: 'Your input is not a number!', type: 'error'});
@ -1366,6 +1381,9 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
};
}]);
app.controller('clientSubMerchantIdLogCtrl', ['$scope', '$http', 'logs', function ($scope, $http, logs) {
$scope.logs = logs.data;
}]);
app.controller('partnerSubCtrl', ['$scope', '$http', '$uibModal', function ($scope, $http, $uibModal) {
$scope.newSubClient = function () {
$uibModal.open({

@ -0,0 +1,41 @@
<section class="content-header">
<h1>Sub Merchant Id Logs</h1>
<ol class="breadcrumb">
<li>
<i class="fa fa-users"></i> Configuration
</li>
<li class="active">logs</li>
</ol>
</section>
<section class="content">
<div class="box-solid">
<div class="box box-warning">
<div class="box-body">
<div class="row">
<div class="col-sm-12">
<div class="col-sm-12 table-responsive">
<table class="table table-striped table-bordered table-hover" ng-if="logs.length>0">
<thead>
<tr>
<th>Sub Merchant Id Before</th>
<th>Sub Merchant Id After</th>
<th>Operator</th>
<th>Create Time</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="log in logs">
<td ng-bind="log.sub_merchant_id_before"></td>
<td ng-bind="log.sub_merchant_id_after"></td>
<td ng-bind="log.operator"></td>
<td ng-bind="log.create_time"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</section>

@ -12,6 +12,16 @@
<a role="button" ng-click="ctrl.editSubMerchant=true" ng-if="'011'|withRole"><i class="fa fa-edit"></i></a>
<i class="fa fa-clock-o text-danger" title="Using temp Sub Merchant ID" ng-if="paymentInfo.temp_sub_merchant"></i>
&nbsp;&nbsp;<span class="small" ng-if="('10'|withRole) &&paymentInfo.sub_merchant_id&&paymentInfo.merchant_id"><b>Merchant ID</b>:{{paymentInfo.merchant_id | choose_merchant_id}}</span>
&nbsp;&nbsp;
<span class="small"
ng-if="('10'|withRole) &&paymentInfo.sub_merchant_id&&paymentInfo.sub_merchant_id_log">
<a class="text-primary" role="button" title="modify logs"
ng-click="showSubMerchantLogs(sub_merchant_id_logs)">
<span class="pull-right-container">
<span class="label label-primary">logs</span>
</span>
</a>
</span>
</p>
<div class="input-group" ng-if="ctrl.editSubMerchant">
<input type="text" class="form-control" ng-model="paymentInfo.sub_merchant_id"

Loading…
Cancel
Save