add client permission page

master
wangning 6 years ago
parent 9d50f0c687
commit 6c752a3e0b

@ -1,10 +1,8 @@
package au.com.royalpay.payment.manage.management.sysconfig.web; package au.com.royalpay.payment.manage.management.sysconfig.web;
import au.com.royalpay.payment.manage.management.sysconfig.beans.PermissionClientVO; import au.com.royalpay.payment.manage.management.sysconfig.beans.PermissionClientVO;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping; import au.com.royalpay.payment.manage.system.core.PermissionClientModulesService;
import au.com.royalpay.payment.manage.system.core.PermissionClientMoudulesService;
import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
@ -24,20 +22,20 @@ import javax.annotation.Resource;
* Created by yixian on 2017-02-28. * Created by yixian on 2017-02-28.
*/ */
@RestController @RestController
@ManagerMapping(role = ManagerRole.ADMIN, value = "/sys/permission") @RequestMapping( value = "/sys/permission")
public class SysPermissionClientController { public class SysPermissionClientController {
@Resource @Resource
private PermissionClientMoudulesService permissionClientMoudulesService; private PermissionClientModulesService permissionClientModulesService;
@RequestMapping(value = "/list", method = RequestMethod.GET) @RequestMapping(value = "/list", method = RequestMethod.GET)
public List<JSONObject> list(@RequestParam String client_moniker) { public List<JSONObject> list(@RequestParam String client_moniker) {
return permissionClientMoudulesService.listByClientMoniker(client_moniker); return permissionClientModulesService.listByClientMoniker(client_moniker);
} }
@RequestMapping(value = "/{id}", method = RequestMethod.POST) @RequestMapping(value = "/{id}", method = RequestMethod.POST)
public void modify(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager, @PathVariable Long id, @RequestBody PermissionClientVO permissionClientVO) { public void modify(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager, @PathVariable Long id, @RequestBody PermissionClientVO permissionClientVO) {
permissionClientMoudulesService.switchValid(id,permissionClientVO.getIsValid(),loginManager); permissionClientModulesService.switchValid(id,permissionClientVO.getIsValid(),loginManager);
} }
} }

@ -13,8 +13,8 @@ import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
/** /**
* Created by yixian on 2017-02-28. * Created by yixian on 2017-02-28.
*/ */
@AutoMapper(tablename = "sys_permission_client_moudules", pkName = "id") @AutoMapper(tablename = "sys_permission_client_modules", pkName = "id")
public interface SysPermissionClientMoudulesMapper { public interface SysPermissionClientModulesMapper {
@AutoSql(type = SqlType.INSERT) @AutoSql(type = SqlType.INSERT)
void save(JSONObject module); void save(JSONObject module);

@ -9,7 +9,7 @@ import java.util.List;
* @author kira * @author kira
* @date 2018/7/4 * @date 2018/7/4
*/ */
public interface PermissionClientMoudulesService { public interface PermissionClientModulesService {
void save(JSONObject record); void save(JSONObject record);

@ -10,8 +10,8 @@ import java.util.Date;
* @author kira * @author kira
* @date 2018/7/4 * @date 2018/7/4
*/ */
@Document(collection = "permission_client_moudule_log") @Document(collection = "permission_client_module_log")
public class PermissionClientMouduleLog { public class PermissionClientModuleLog {
private long id; private long id;
private int clientId; private int clientId;

@ -1,8 +1,8 @@
package au.com.royalpay.payment.manage.system.core.impl; package au.com.royalpay.payment.manage.system.core.impl;
import au.com.royalpay.payment.manage.mappers.system.SysPermissionClientMoudulesMapper; import au.com.royalpay.payment.manage.mappers.system.SysPermissionClientModulesMapper;
import au.com.royalpay.payment.manage.system.core.PermissionClientMoudulesService; import au.com.royalpay.payment.manage.system.core.PermissionClientModulesService;
import au.com.royalpay.payment.manage.system.core.beans.PermissionClientMouduleLog; import au.com.royalpay.payment.manage.system.core.beans.PermissionClientModuleLog;
import au.com.royalpay.payment.tools.exceptions.NotFoundException; import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.utils.id.IdUtil; import au.com.royalpay.payment.tools.utils.id.IdUtil;
@ -25,10 +25,10 @@ import javax.annotation.Resource;
* @date 2018/7/4 * @date 2018/7/4
*/ */
@Service @Service
public class PermissionClientMoudulesServiceImpl implements PermissionClientMoudulesService { public class PermissionClientModulesServiceImpl implements PermissionClientModulesService {
@Resource @Resource
private SysPermissionClientMoudulesMapper permissionClientMoudulesMapper; private SysPermissionClientModulesMapper permissionClientModulesMapper;
@Resource @Resource
private MongoTemplate mongoTemplate; private MongoTemplate mongoTemplate;
@ -37,37 +37,37 @@ public class PermissionClientMoudulesServiceImpl implements PermissionClientMoud
@Override @Override
public void save(JSONObject record) { public void save(JSONObject record) {
record.put("id",IdUtil.getId()); record.put("id",IdUtil.getId());
permissionClientMoudulesMapper.save(record); permissionClientModulesMapper.save(record);
} }
@Override @Override
public List<JSONObject> listByClientId(int clientId) { public List<JSONObject> listByClientId(int clientId) {
return permissionClientMoudulesMapper.listByClientId(clientId); return permissionClientModulesMapper.listByClientId(clientId);
} }
@Override @Override
@Cacheable(value = ":system:client_permission:", key = "#moniker") @Cacheable(value = ":system:client_permission:", key = "#clientMoniker")
public List<JSONObject> listByClientMoniker(String clientMoniker) { public List<JSONObject> listByClientMoniker(String clientMoniker) {
return permissionClientMoudulesMapper.listByClientMoniker(clientMoniker); return permissionClientModulesMapper.listByClientMoniker(clientMoniker);
} }
@Override @Override
public void switchValid(Long id, boolean isValid, JSONObject account) { public void switchValid(Long id, boolean isValid, JSONObject account) {
JSONObject record = permissionClientMoudulesMapper.find(id); JSONObject record = permissionClientModulesMapper.find(id);
if (record == null) { if (record == null) {
throw new NotFoundException("Permission Client Moudule Not Found id:" + id); throw new NotFoundException("Permission Client Module Not Found id:" + id);
} }
JSONObject updateRecord = new JSONObject(); JSONObject updateRecord = new JSONObject();
updateRecord.put("is_valid", isValid); updateRecord.put("is_valid", isValid);
updateRecord.put("id", record.getLong("id"));
saveMongoLog(account,record,updateRecord,(isValid?"打开":"关闭")+"模块 id:"+record.getString("module_id")); saveMongoLog(account,record,updateRecord,(isValid?"打开":"关闭")+"模块 id:"+record.getString("module_id"));
permissionClientMoudulesMapper.update(updateRecord); updateRecord.put("id", record.getLong("id"));
permissionClientModulesMapper.update(updateRecord);
} }
private void saveMongoLog(JSONObject account, JSONObject oldRecord, JSONObject modifyData, String business) { private void saveMongoLog(JSONObject account, JSONObject oldRecord, JSONObject modifyData, String business) {
modifyData.remove("id"); modifyData.remove("id");
PermissionClientMouduleLog mongoRecord = new PermissionClientMouduleLog(); PermissionClientModuleLog mongoRecord = new PermissionClientModuleLog();
mongoRecord.setBusiness(business); mongoRecord.setBusiness(business);
mongoRecord.setClientId(oldRecord.getIntValue("client_id")); mongoRecord.setClientId(oldRecord.getIntValue("client_id"));
mongoRecord.setClientMoniker(oldRecord.getString("client_moniker")); mongoRecord.setClientMoniker(oldRecord.getString("client_moniker"));

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?> <?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" > <!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.system.SysPermissionClientMoudulesMapper"> <mapper namespace="au.com.royalpay.payment.manage.mappers.system.SysPermissionClientModulesMapper">
<sql id="joinModule"> <sql id="joinModule">
SELECT SELECT
f.*, f.*,

@ -2970,22 +2970,26 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}) })
} }
}]); }]);
app.controller('permissionClientCtrl', ['$scope', '$http', '$uibModal', '$state', '$filter', 'commonDialog','clientMoniker', function ($scope, $http, $uibModal, $state, $filter, commonDialog,clientMoniker) { app.controller('permissionClientCtrl', ['$scope', '$http', '$uibModal', '$state', '$filter', 'commonDialog', function ($scope, $http, $uibModal, $state, $filter, commonDialog) {
$scope.partner = {client_moniker:clientMoniker}; $scope.clientPermission = {client_moniker:$scope.partner.client_moniker};
$scope.loadPermissionList = function () { $scope.loadPermissionList = function () {
$http.get('/sys/permission/list',partner).then(function (resp) { var params = angular.copy($scope.clientPermission);
$http.get('/sys/permission/list',{params:params}).then(function (resp) {
$scope.permissionList = resp.data; $scope.permissionList = resp.data;
}, function (resp) { }, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
}); });
}; };
$scope.switchValid = function (id,valid) { $scope.loadPermissionList(1);
$scope.partner.isValid = valid; $scope.switchValid = function (permission) {
$http.post('/sys/permission/'+id,$scope.partner).then(function (resp) { $scope.clientPermission.isValid = permission.is_valid;
var params = angular.copy($scope.clientPermission);
$http.post('/sys/permission/'+permission.id,params).then(function (resp) {
},function (resp) { },function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
}) })
}; };
}]); }]);

@ -253,8 +253,8 @@
<li ui-sref-active="active" ng-if="('10'|withRole)"> <li ui-sref-active="active" ng-if="('10'|withRole)">
<a ui-sref=".sub_merchant_applicaitons">Wechat Merchant Id Applicaitons</a> <a ui-sref=".sub_merchant_applicaitons">Wechat Merchant Id Applicaitons</a>
</li> </li>
<li ui-sref-active="active" ng-if="('10'|withRole)"> <li ui-sref-active="active">
<a ui-sref=".permission_client">Wechat Merchant Id Applicaitons</a> <a ui-sref=".permission_client">Permissions</a>
</li> </li>
</ul> </ul>
<div class="tab-content" ui-view> <div class="tab-content" ui-view>

@ -1,229 +1,23 @@
<div class="row margin-bottom">
<div class="col-sm-12">
<div class="form-horizontal">
<div class="form-group col-xs-12">
<label class="col-xs-4 col-sm-2">
<select class="form-control" ng-model="params.textType">
<option value="all">ALL</option>
<option value="client_moniker">Partner Code</option>
<option value="client_name">Partner Name</option>
<option value="sys_trans_id">Platform Transaction ID</option>
<option value="channel">Channel</option>
<option value="order_id">Order ID</option>
<option value="remark">Remark</option>
</select>
</label>
<div class="col-sm-4 col-xs-8">
<input class="form-control" placeholder="Keyword" ng-enter="loadTradeLogs(1)"
ng-model="params.searchText">
</div>
</div>
<div class="form-group col-xs-12">
<label class="control-label col-xs-4 col-sm-2">Status</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':params.status=='ALL'}"
ng-click="params.status='ALL';loadTradeLogs(1)">All</a> |
<a role="button" ng-class="{'bg-primary':params.status=='PAID'}"
ng-click="params.status='PAID';loadTradeLogs(1)">Payment Success</a> |
<a role="button" ng-class="{'bg-primary':params.status=='ALL_REFUNDED'}"
ng-click="params.status='ALL_REFUNDED';loadTradeLogs(1)">All Refund</a> |
<a role="button" ng-class="{'bg-primary':params.status=='PARTIAL_REFUNDED'}"
ng-click="params.status='PARTIAL_REFUNDED';loadTradeLogs(1)">Partial Refund</a> |
<a role="button" ng-class="{'bg-primary':params.status=='FULL_REFUNDED'}"
ng-click="params.status='FULL_REFUNDED';loadTradeLogs(1)">Full Refund</a>
</p>
</div>
</div>
<div class="form-group col-xs-12">
<label class="control-label col-xs-4 col-sm-2">Gateway</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':params.gateway==null}"
ng-click="params.gateway=null;loadTradeLogs(1)">All</a> |
<a role="button" ng-class="{'bg-primary':gatewaySelected([0,1])}"
ng-click="params.gateway=[0,1];loadTradeLogs(1)">Retail In-Store</a> |
<a role="button" ng-class="{'bg-primary':gatewaySelected([5,6])}"
ng-click="params.gateway=[5,6];loadTradeLogs(1)">Retail API</a> |
<a role="button" ng-class="{'bg-primary':gatewaySelected([2,7])}"
ng-click="params.gateway=[2,7];loadTradeLogs(1)">QR Code</a> |
<a role="button" ng-class="{'bg-primary':gatewaySelected([3])}"
ng-click="params.gateway=[3];loadTradeLogs(1)">Online API</a> |
<a role="button" ng-class="{'bg-primary':gatewaySelected([4])}"
ng-click="params.gateway=[4];loadTradeLogs(1)">WeChat HTML5</a> |
<a role="button" ng-class="{'bg-primary':gatewaySelected([8])}"
ng-click="params.gateway=[8];loadTradeLogs(1)">Mobile H5</a> |
<a role="button" ng-class="{'bg-primary':gatewaySelected([9])}"
ng-click="params.gateway=[9];loadTradeLogs(1)">Third Party Gateway</a> |
<a role="button" ng-class="{'bg-primary':gatewaySelected([10])}"
ng-click="params.gateway=[10];loadTradeLogs(1)">APP</a> |
<a role="button" ng-class="{'bg-primary':gatewaySelected([11])}"
ng-click="params.gateway=[11];loadTradeLogs(1)">Share Code</a> |
<a role="button" ng-class="{'bg-primary':gatewaySelected([12])}"
ng-click="params.gateway=[12];loadTradeLogs(1)">MiniProgram</a> |
<a role="button" ng-class="{'bg-primary':gatewaySelected([13])}"
ng-click="params.gateway=[13];loadTradeLogs(1)">Native QR Code</a> |
<a role="button" ng-class="{'bg-primary':gatewaySelected([14])}"
ng-click="params.gateway=[14];loadTradeLogs(1)">Share Link</a>
</p>
</div>
</div>
<div class="form-group col-xs-12">
<label class="control-label col-xs-4 col-sm-2">Channel</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':params.channel=='ALL'}"
ng-click="params.channel='ALL';loadTradeLogs(1)">All</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='WECHAT'}"
ng-click="params.channel='WECHAT';loadTradeLogs(1)">Wechat Pay</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='ALIPAY'}"
ng-click="params.channel='ALIPAY';loadTradeLogs(1)">Alipay</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='ALIPAYONLINE'}"
ng-click="params.channel='ALIPAYONLINE';loadTradeLogs(1)">AlipayOnline</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='BESTPAY'}"
ng-click="params.channel='BESTPAY';loadTradeLogs(1)">BestPay</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='JD'}"
ng-click="params.channel='JD';loadTradeLogs(1)">JDpay</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='HF'}"
ng-click="params.channel='HF';loadTradeLogs(1)">HFpay</a>
</p>
</div>
</div>
<div class="form-group col-xs-12">
<label class="control-label col-xs-4 col-sm-2">Date Range</label>
<div class="col-sm-10 col-xs-8">
<div class="form-control-static form-inline">
<div style="display: inline-block">
<input class="form-control" id="date-from-input" ng-model="params.datefrom"
uib-datepicker-popup size="10" placeholder="From"
is-open="dateBegin.open" ng-click="dateBegin.open=true"
datepicker-options="{maxDate:params.dateto||today}">
</div>
~
<div style="display: inline-block">
<input class="form-control" id="date-to-input" ng-model="params.dateto"
uib-datepicker-popup size="10" placeholder="To"
is-open="dateTo.open" ng-click="dateTo.open=true"
datepicker-options="{minDate:params.datefrom,maxDate:today}">
</div>
<div class="btn-group">
<a role="button" class="btn btn-default btn-sm"
ng-click="chooseToday()">Today</a>
</div>
<div class="btn-group">
<a role="button" class="btn btn-default btn-sm"
ng-click="chooseYesterday()">Yesterday</a>
</div>
<div class="btn-group">
<a role="button" class="btn btn-default btn-sm"
ng-click="chooseLast7Days()">Last 7
Days</a>
</div>
<div class="btn-group">
<a role="button" class="btn btn-default btn-sm" ng-click="thisMonth()">This
Month</a>
</div>
<div class="btn-group">
<a role="button" class="btn btn-default btn-sm" ng-click="lastMonth()">Last
Month</a>
</div>
</div>
</div>
</div>
<div class="form-group col-xs-12" ng-if="partner.has_children">
<label class="control-label col-xs-4 col-sm-2">Sub Partner</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':isAll}" ng-click="chooseClient('all')">All</a>
<label ng-repeat="sub in clients">
|&nbsp;<a role="button" ng-class="{'bg-primary':sub.client_id==chooseClientId}"
ng-click="chooseClient(sub.client_id)">{{sub.short_name}}</a>&nbsp;
</label>
</p>
</div>
</div>
<button class="btn btn-success" type="button" ng-click="loadTradeLogs(1)">
<i class="fa fa-search"></i> Search
</button>
</div>
</div>
</div>
<div class="row"> <div class="row">
<div class="col-sm-12"> <div class="col-sm-12">
<h3 class="box-title" style="display: inherit">Orders <h3 class="box-title" style="display: inherit">Permissions</h3>
<span class="small" ng-if="tradeLogs.length">(Found {{pagination.totalCount}} orders and {{analysis.order_count}} transactions worth of {{analysis.paid_fee|currency:'AUD'}})</span>
<span style="float: right;font-size: 14px;">Pre Authorization:<i class="fa fa-stop" aria-hidden="true" style="color: #fff2a5"></i></span>
</h3>
<div class="table-responsive col-sm-12"> <div class="table-responsive col-sm-12">
<table class="table table-bordered table-hover table-striped"> <table class="table table-bordered table-hover table-striped">
<thead> <thead>
<tr> <tr>
<th>Module Name</th>
<th>Client Order ID</th>
<th>Order ID</th>
<th>Amount</th>
<th>Input Amount</th>
<th>AUD Amount</th>
<th>Exchange Rate</th>
<th>Status</th>
<th>Create Time</th>
<th>Gateway</th>
<th>Operation</th> <th>Operation</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr ng-repeat="trade in tradeLogs" ng-class="{warning:trade.clearing_status==2}"> <tr ng-repeat="permission in permissionList">
<td ng-bind="trade.client_order_id||'NOT PROVIDED'"></td> <td ng-bind="permission.module_id"></td>
<td>
<img src="/static/images/wechatpay_sign.png" uib-tooltip="Znyoo" ng-if="trade.channel=='Znyoo'"/>
<img src="/static/images/wechatpay_sign.png" uib-tooltip="WechatPay" ng-if="trade.channel=='Wechat'"/>
<img src="/static/images/bestpay_sign.png" uib-tooltip="BestPay" ng-if="trade.channel=='Bestpay'"/>
<img src="/static/images/alipay_sign.png" uib-tooltip="Alipay" ng-if="trade.channel=='Alipay'"/>
<img src="/static/images/alipay_sign.png" uib-tooltip="AlipayOnline" ng-if="trade.channel=='AlipayOnline'"/>
<img src="/static/images/jd_sign.png" uib-tooltip="JD Pay" ng-if="trade.channel=='jd'"/>
<img src="/static/images/hf_sign.png" uib-tooltip="HF Pay" ng-if="trade.channel=='hf'"/>
{{trade.order_id}}
</td>
<td>
{{trade.total_amount|currency:trade.currency+' '}}
<a ng-if="trade.refund_fee" class="text-danger" role="button"
ng-click="showRefundLog(trade.order_id)">(-{{trade.refund_fee}})</a>
</td>
<td ng-bind="trade.display_amount|currency:trade.currency"></td>
<td ng-bind="trade.clearing_amount|currency:'AUD '"></td>
<td ng-bind="trade.exchange_rate"></td>
<td ng-bind="trade.status|tradeStatus"></td>
<td ng-bind="trade.create_time"></td>
<td ng-bind="trade.gateway|tradeGateway"></td>
<td> <td>
<a role="button" class="text-bold" ng-click="showTradeDetail(trade)" title="Detail"> <input type="checkbox" ng-click="switchValid(permission)" ng-model="permission.is_valid">
<i class="fa fa-list-alt"></i>
</a>
<a role="button" ng-if="trade.status>=5 && trade.confirm_time!=null && trade.clearing_status<2 && ('do_refund'|withFunc)"
class="text-bold text-danger"
ng-click="newRefund(trade.order_id)" title="Refund">
<i class="fa fa-undo"></i>
</a>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
<uib-pagination ng-if="tradeLogs.length"
class="pagination"
total-items="pagination.totalCount"
boundary-links="true"
ng-model="pagination.page"
items-per-page="pagination.limit"
max-size="10"
ng-change="loadTradeLogs()"
previous-text="&lsaquo;"
next-text="&rsaquo;"
first-text="&laquo;"
last-text="&raquo;"></uib-pagination>
<div class="col-xs-12">Total Records:{{pagination.totalCount}};Total Pages:{{pagination.totalPages}}</div>
</div> </div>
</div> </div>
Loading…
Cancel
Save