From 6c752a3e0b6d5521586167d6ab6ced7ca43ceb61 Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Thu, 5 Jul 2018 14:09:20 +0800 Subject: [PATCH] add client permission page --- .../web/SysPermissionClientController.java | 12 +- ... => SysPermissionClientModulesMapper.java} | 4 +- ...va => PermissionClientModulesService.java} | 2 +- ...og.java => PermissionClientModuleLog.java} | 4 +- ...> PermissionClientModulesServiceImpl.java} | 28 +-- ...l => SysPermissionClientModulesMapper.xml} | 2 +- .../static/payment/partner/partner-manage.js | 16 +- .../partner/templates/partner_detail.html | 4 +- .../partner/templates/partner_permission.html | 216 +----------------- 9 files changed, 42 insertions(+), 246 deletions(-) rename src/main/java/au/com/royalpay/payment/manage/mappers/system/{SysPermissionClientMoudulesMapper.java => SysPermissionClientModulesMapper.java} (88%) rename src/main/java/au/com/royalpay/payment/manage/system/core/{PermissionClientMoudulesService.java => PermissionClientModulesService.java} (87%) rename src/main/java/au/com/royalpay/payment/manage/system/core/beans/{PermissionClientMouduleLog.java => PermissionClientModuleLog.java} (95%) rename src/main/java/au/com/royalpay/payment/manage/system/core/impl/{PermissionClientMoudulesServiceImpl.java => PermissionClientModulesServiceImpl.java} (74%) rename src/main/resources/au/com/royalpay/payment/manage/mappers/system/{SysPermissionClientMoudulesMapper.xml => SysPermissionClientModulesMapper.xml} (91%) diff --git a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/web/SysPermissionClientController.java b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/web/SysPermissionClientController.java index f89b3d8d6..dd311283e 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/web/SysPermissionClientController.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/web/SysPermissionClientController.java @@ -1,10 +1,8 @@ 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.permission.manager.ManagerMapping; -import au.com.royalpay.payment.manage.system.core.PermissionClientMoudulesService; +import au.com.royalpay.payment.manage.system.core.PermissionClientModulesService; import au.com.royalpay.payment.tools.CommonConsts; -import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import com.alibaba.fastjson.JSONObject; @@ -24,20 +22,20 @@ import javax.annotation.Resource; * Created by yixian on 2017-02-28. */ @RestController -@ManagerMapping(role = ManagerRole.ADMIN, value = "/sys/permission") +@RequestMapping( value = "/sys/permission") public class SysPermissionClientController { @Resource - private PermissionClientMoudulesService permissionClientMoudulesService; + private PermissionClientModulesService permissionClientModulesService; @RequestMapping(value = "/list", method = RequestMethod.GET) public List list(@RequestParam String client_moniker) { - return permissionClientMoudulesService.listByClientMoniker(client_moniker); + return permissionClientModulesService.listByClientMoniker(client_moniker); } @RequestMapping(value = "/{id}", method = RequestMethod.POST) 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); } } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientMoudulesMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientModulesMapper.java similarity index 88% rename from src/main/java/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientMoudulesMapper.java rename to src/main/java/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientModulesMapper.java index 510f92e29..0ac02f6f7 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientMoudulesMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientModulesMapper.java @@ -13,8 +13,8 @@ import cn.yixblog.support.mybatis.autosql.annotations.SqlType; /** * Created by yixian on 2017-02-28. */ -@AutoMapper(tablename = "sys_permission_client_moudules", pkName = "id") -public interface SysPermissionClientMoudulesMapper { +@AutoMapper(tablename = "sys_permission_client_modules", pkName = "id") +public interface SysPermissionClientModulesMapper { @AutoSql(type = SqlType.INSERT) void save(JSONObject module); diff --git a/src/main/java/au/com/royalpay/payment/manage/system/core/PermissionClientMoudulesService.java b/src/main/java/au/com/royalpay/payment/manage/system/core/PermissionClientModulesService.java similarity index 87% rename from src/main/java/au/com/royalpay/payment/manage/system/core/PermissionClientMoudulesService.java rename to src/main/java/au/com/royalpay/payment/manage/system/core/PermissionClientModulesService.java index 3251b4962..7022633c4 100644 --- a/src/main/java/au/com/royalpay/payment/manage/system/core/PermissionClientMoudulesService.java +++ b/src/main/java/au/com/royalpay/payment/manage/system/core/PermissionClientModulesService.java @@ -9,7 +9,7 @@ import java.util.List; * @author kira * @date 2018/7/4 */ -public interface PermissionClientMoudulesService { +public interface PermissionClientModulesService { void save(JSONObject record); diff --git a/src/main/java/au/com/royalpay/payment/manage/system/core/beans/PermissionClientMouduleLog.java b/src/main/java/au/com/royalpay/payment/manage/system/core/beans/PermissionClientModuleLog.java similarity index 95% rename from src/main/java/au/com/royalpay/payment/manage/system/core/beans/PermissionClientMouduleLog.java rename to src/main/java/au/com/royalpay/payment/manage/system/core/beans/PermissionClientModuleLog.java index e83e0789c..7ad83a373 100644 --- a/src/main/java/au/com/royalpay/payment/manage/system/core/beans/PermissionClientMouduleLog.java +++ b/src/main/java/au/com/royalpay/payment/manage/system/core/beans/PermissionClientModuleLog.java @@ -10,8 +10,8 @@ import java.util.Date; * @author kira * @date 2018/7/4 */ -@Document(collection = "permission_client_moudule_log") -public class PermissionClientMouduleLog { +@Document(collection = "permission_client_module_log") +public class PermissionClientModuleLog { private long id; private int clientId; diff --git a/src/main/java/au/com/royalpay/payment/manage/system/core/impl/PermissionClientMoudulesServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/system/core/impl/PermissionClientModulesServiceImpl.java similarity index 74% rename from src/main/java/au/com/royalpay/payment/manage/system/core/impl/PermissionClientMoudulesServiceImpl.java rename to src/main/java/au/com/royalpay/payment/manage/system/core/impl/PermissionClientModulesServiceImpl.java index 5b82cf032..d43cae9af 100644 --- a/src/main/java/au/com/royalpay/payment/manage/system/core/impl/PermissionClientMoudulesServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/system/core/impl/PermissionClientModulesServiceImpl.java @@ -1,8 +1,8 @@ package au.com.royalpay.payment.manage.system.core.impl; -import au.com.royalpay.payment.manage.mappers.system.SysPermissionClientMoudulesMapper; -import au.com.royalpay.payment.manage.system.core.PermissionClientMoudulesService; -import au.com.royalpay.payment.manage.system.core.beans.PermissionClientMouduleLog; +import au.com.royalpay.payment.manage.mappers.system.SysPermissionClientModulesMapper; +import au.com.royalpay.payment.manage.system.core.PermissionClientModulesService; +import au.com.royalpay.payment.manage.system.core.beans.PermissionClientModuleLog; import au.com.royalpay.payment.tools.exceptions.NotFoundException; import au.com.royalpay.payment.tools.utils.id.IdUtil; @@ -25,10 +25,10 @@ import javax.annotation.Resource; * @date 2018/7/4 */ @Service -public class PermissionClientMoudulesServiceImpl implements PermissionClientMoudulesService { +public class PermissionClientModulesServiceImpl implements PermissionClientModulesService { @Resource - private SysPermissionClientMoudulesMapper permissionClientMoudulesMapper; + private SysPermissionClientModulesMapper permissionClientModulesMapper; @Resource private MongoTemplate mongoTemplate; @@ -37,37 +37,37 @@ public class PermissionClientMoudulesServiceImpl implements PermissionClientMoud @Override public void save(JSONObject record) { record.put("id",IdUtil.getId()); - permissionClientMoudulesMapper.save(record); + permissionClientModulesMapper.save(record); } @Override public List listByClientId(int clientId) { - return permissionClientMoudulesMapper.listByClientId(clientId); + return permissionClientModulesMapper.listByClientId(clientId); } @Override - @Cacheable(value = ":system:client_permission:", key = "#moniker") + @Cacheable(value = ":system:client_permission:", key = "#clientMoniker") public List listByClientMoniker(String clientMoniker) { - return permissionClientMoudulesMapper.listByClientMoniker(clientMoniker); + return permissionClientModulesMapper.listByClientMoniker(clientMoniker); } @Override public void switchValid(Long id, boolean isValid, JSONObject account) { - JSONObject record = permissionClientMoudulesMapper.find(id); + JSONObject record = permissionClientModulesMapper.find(id); 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(); updateRecord.put("is_valid", isValid); - updateRecord.put("id", record.getLong("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) { modifyData.remove("id"); - PermissionClientMouduleLog mongoRecord = new PermissionClientMouduleLog(); + PermissionClientModuleLog mongoRecord = new PermissionClientModuleLog(); mongoRecord.setBusiness(business); mongoRecord.setClientId(oldRecord.getIntValue("client_id")); mongoRecord.setClientMoniker(oldRecord.getString("client_moniker")); diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientMoudulesMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientModulesMapper.xml similarity index 91% rename from src/main/resources/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientMoudulesMapper.xml rename to src/main/resources/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientModulesMapper.xml index 9a1f328b9..393d1fec8 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientMoudulesMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientModulesMapper.xml @@ -1,6 +1,6 @@ - + SELECT f.*, diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index e99ddef01..c64e6f703 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -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) { - $scope.partner = {client_moniker:clientMoniker}; + app.controller('permissionClientCtrl', ['$scope', '$http', '$uibModal', '$state', '$filter', 'commonDialog', function ($scope, $http, $uibModal, $state, $filter, commonDialog) { + $scope.clientPermission = {client_moniker:$scope.partner.client_moniker}; $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; }, function (resp) { commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) }); }; - $scope.switchValid = function (id,valid) { - $scope.partner.isValid = valid; - $http.post('/sys/permission/'+id,$scope.partner).then(function (resp) { + $scope.loadPermissionList(1); + $scope.switchValid = function (permission) { + $scope.clientPermission.isValid = permission.is_valid; + var params = angular.copy($scope.clientPermission); + $http.post('/sys/permission/'+permission.id,params).then(function (resp) { },function (resp) { commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) }) }; + }]); diff --git a/src/main/ui/static/payment/partner/templates/partner_detail.html b/src/main/ui/static/payment/partner/templates/partner_detail.html index 85151dee3..9aeb551e1 100644 --- a/src/main/ui/static/payment/partner/templates/partner_detail.html +++ b/src/main/ui/static/payment/partner/templates/partner_detail.html @@ -253,8 +253,8 @@
  • Wechat Merchant Id Applicaitons
  • -
  • - Wechat Merchant Id Applicaitons +
  • + Permissions
  • diff --git a/src/main/ui/static/payment/partner/templates/partner_permission.html b/src/main/ui/static/payment/partner/templates/partner_permission.html index 0d5c69752..a3ee87088 100644 --- a/src/main/ui/static/payment/partner/templates/partner_permission.html +++ b/src/main/ui/static/payment/partner/templates/partner_permission.html @@ -1,229 +1,23 @@ -
    -
    -
    -
    - -
    - -
    -
    -
    - - -
    - -
    - -
    -

    - All | - Wechat Pay | - Alipay | - AlipayOnline | - BestPay | - JDpay | - HFpay -

    -
    -
    -
    - -
    -
    -
    - -
    - ~ -
    - -
    - -
    - Today -
    -
    - Yesterday -
    - - - -
    - -
    - -
    -
    - -
    -

    - All - -

    -
    -
    - -
    -
    -
    -

    Orders - (Found {{pagination.totalCount}} orders and {{analysis.order_count}} transactions worth of {{analysis.paid_fee|currency:'AUD'}}) - Pre Authorization: -

    +

    Permissions

    - - - - - - - - - - + - - - - - - - - - - + +
    Client Order IDOrder IDAmountInput AmountAUD AmountExchange RateStatusCreate TimeGatewayModule Name Operation
    - - - - - - - - {{trade.order_id}} - - {{trade.total_amount|currency:trade.currency+' '}} - (-{{trade.refund_fee}}) -
    - - - - - - +
    - -
    Total Records:{{pagination.totalCount}};Total Pages:{{pagination.totalPages}}
    \ No newline at end of file