diff --git a/pom.xml b/pom.xml index f4271e834..6e23517f4 100644 --- a/pom.xml +++ b/pom.xml @@ -24,6 +24,7 @@ au.com.royalpay.payment payment-core + 1.1.6 au.com.royalpay.payment diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientIncrementalMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientIncrementalMapper.java new file mode 100644 index 000000000..8ba1c6a5f --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientIncrementalMapper.java @@ -0,0 +1,36 @@ +package au.com.royalpay.payment.manage.mappers.system; + +import cn.yixblog.support.mybatis.autosql.annotations.AdvanceSelect; +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 org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator; + +import java.util.List; + +/** + * @Author DuLingLing + * @create 2019/11/13 0013 14:49 + */ +@AutoMapper(tablename = "sys_client_incremental", pkName = "incremental_id", keyGenerator = Jdbc3KeyGenerator.class) +public interface ClientIncrementalMapper { + + /** + * 获取商户所有增值渠道信息 + * @param clientId + * @return + */ + @AutoSql(type = SqlType.SELECT) + List findAllByclientMoniker(@Param("client_id") int clientId); + + @AutoSql(type = SqlType.SELECT) + JSONObject findByClinetIdAndChannel(@Param("client_id")int clinet_id, @Param("channel")String channel); + + @AutoSql(type = SqlType.INSERT) + void save(JSONObject saveIncrementalService); + + @AutoSql(type = SqlType.UPDATE) + void update(JSONObject saveIncrementalService); +} diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java index 17bbd4737..10968500a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java @@ -475,4 +475,26 @@ public interface ClientManager { JSONObject getClientInfoByAggree(JSONObject account); JSONObject getComplianceFilesForBD(JSONObject account); + + /** + * 获取商户所有增值服务 + * + * @param clientMoniker + * @return + */ + JSONObject partnerIncrementalService(String clientMoniker); + + /** + * 保存/修改增值服务配置 + * @param clientMoniker + * @param incrementalService + */ + void changePartnerIncrementalService(String clientMoniker, JSONObject incrementalService,JSONObject manager); + + /** + * 禁用/启用增值服务 + * @param clientMoniker + * @param incrementalService + */ + void changeSwitchIncrementalService(String clientMoniker, JSONObject incrementalService,JSONObject manager); } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index e58eae0a9..676b9adb7 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -17,6 +17,7 @@ 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.surcharge.IncrementalChannel; 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; @@ -105,6 +106,7 @@ import org.springframework.ui.Model; import org.springframework.util.Assert; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.multipart.MultipartFile; import org.thymeleaf.context.Context; import org.thymeleaf.spring5.SpringTemplateEngine; @@ -162,6 +164,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid private StringRedisTemplate stringRedisTemplate; @Resource private ClientComplianceApply clientComplianceApply; + @Resource + private ClientIncrementalMapper clientIncrementalMapper; @Value("${app.redis.prefix}") private String redisPrefix; @@ -5891,4 +5895,76 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid return key; } + public JSONObject partnerIncrementalService(String clientMoniker){ + JSONObject client = clientMapper.findClientByMoniker(clientMoniker); + if(client==null){ + throw new InvalidShortIdException(); + } + List service = clientIncrementalMapper.findAllByclientMoniker(client.getInteger("client_id")); + List incrementalChannels = new ArrayList<>(); + for (IncrementalChannel e : IncrementalChannel.values()) { + boolean exist = false; + for(JSONObject s : service){ + exist = e.getChannel().equals(s.getString("channel")); + if(exist){ + break; + } + } + if(!exist){ + incrementalChannels.add(e.getChannel()); + } + } + incrementalChannels.remove("system"); + return new JSONObject(){{ + put("all_service",service); + put("incremental_channel",incrementalChannels); + }}; + } + + public void changePartnerIncrementalService(String clientMoniker, JSONObject incrementalService,JSONObject manager){ + JSONObject client = clientMapper.findClientByMoniker(clientMoniker); + if(client==null){ + throw new InvalidShortIdException(); + } + JSONObject existIncrementalService = clientIncrementalMapper.findByClinetIdAndChannel(client.getInteger("client_id"),incrementalService.getString("channel")); + JSONObject saveIncrementalService = new JSONObject(); + if(existIncrementalService==null){ + saveIncrementalService.put("incremental_id",UUID.randomUUID().toString()); + saveIncrementalService.put("channel",incrementalService.getString("channel")); + saveIncrementalService.put("create_time",new Date()); + saveIncrementalService.put("update_time",new Date()); + saveIncrementalService.put("is_valid",1); + }else{ + saveIncrementalService.put("incremental_id",incrementalService.getString("incremental_id")); + saveIncrementalService.put("update_time",new Date()); + } + saveIncrementalService.put("client_id",client.getInteger("client_id")); + saveIncrementalService.put("operator",manager.getString("display_name")); + saveIncrementalService.put("incremental_mode",incrementalService.getInteger("incremental_mode")); + saveIncrementalService.put("incremental_rate_value",incrementalService.getInteger("incremental_mode")==1?incrementalService.getString("incremental_rate_value"):0); + saveIncrementalService.put("total_incremental_amount",incrementalService.getInteger("incremental_mode")!=1?incrementalService.getString("total_incremental_amount"):0); + if(existIncrementalService==null){ + clientIncrementalMapper.save(saveIncrementalService); + }else{ + clientIncrementalMapper.update(saveIncrementalService); + } + + } + + public void changeSwitchIncrementalService(String clientMoniker, JSONObject incrementalService, JSONObject manager){ + JSONObject client = clientMapper.findClientByMoniker(clientMoniker); + if(client==null){ + throw new InvalidShortIdException(); + } + JSONObject existIncrementalService = clientIncrementalMapper.findByClinetIdAndChannel(client.getInteger("client_id"),incrementalService.getString("channel")); + if(existIncrementalService==null){ + throw new BadRequestException("Incremental service is not exist"); + } + + existIncrementalService.put("update_time",new Date()); + existIncrementalService.put("incremental_id",incrementalService.getString("incremental_id")); + existIncrementalService.put("is_valid",incrementalService.getInteger("is_valid")); + existIncrementalService.put("operator",manager.getString("display_name")); + clientIncrementalMapper.update(existIncrementalService); + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java index d88feea7e..6e56ad12f 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java @@ -809,4 +809,34 @@ public class PartnerManageController { public void switchPartnerCBChannelConfig(@PathVariable String clientMoniker, @PathVariable String channelKey, @RequestBody JSONObject channel) { clientManager.partnerCBChannelConfig(clientMoniker, channelKey, channel.getString("channel_id")); } + + /** + * 获取商户所有增值服务 + * @param clientMoniker + * @return + */ + @ManagerMapping(value = "/{clientMoniker}/incremental_service", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR}) + public JSONObject getClientIncrementalService(@PathVariable String clientMoniker){ + return clientManager.partnerIncrementalService(clientMoniker); + } + + /** + * 保存/修改增值服务配置 + * @param clientMoniker + * @param incrementalService + */ + @ManagerMapping(value = "/{clientMoniker}/incremental_service", method = RequestMethod.POST, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR}) + public void updateClientIncrementalService(@PathVariable("clientMoniker") String clientMoniker,@RequestBody JSONObject incrementalService, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager){ + clientManager.changePartnerIncrementalService(clientMoniker,incrementalService,manager); + } + + /** + * 禁用/启用增值服务 + * @param clientMoniker + * @param incrementalService + */ + @ManagerMapping(value = "/{clientMoniker}/incremental_service/status", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR}) + public void switchClientIncrementalService(@PathVariable("clientMoniker") String clientMoniker,@RequestBody JSONObject incrementalService, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager){ + clientManager.changeSwitchIncrementalService(clientMoniker,incrementalService,manager); + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerViewController.java b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerViewController.java index 188fd1031..0f11c4479 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerViewController.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerViewController.java @@ -602,4 +602,16 @@ public class PartnerViewController { public void deleteAuthFiles(@PathVariable String fileId, @ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account) { clientManager.deleteAuthFiles(fileId); } + + /** + * 获取商户所有增值服务 + * @param clientMoniker + * @return + */ + @PartnerMapping(value = "/{clientMoniker}/incremental_service", method = RequestMethod.GET, roles = {PartnerRole.ADMIN, PartnerRole.MANAGER}) + @ResponseBody + public JSONObject getClientIncrementalService(@PathVariable String clientMoniker){ + return clientManager.partnerIncrementalService(clientMoniker); + } + } diff --git a/src/main/ui/index.html b/src/main/ui/index.html index c36725df8..826a7ec1e 100644 --- a/src/main/ui/index.html +++ b/src/main/ui/index.html @@ -1035,6 +1035,10 @@ margin-bottom: 10%;"/> +
  • + R Service +
  • + diff --git a/src/main/ui/static/boot/index-boot.js b/src/main/ui/static/boot/index-boot.js index c0dba0173..63d340672 100644 --- a/src/main/ui/static/boot/index-boot.js +++ b/src/main/ui/static/boot/index-boot.js @@ -78,7 +78,8 @@ var modules = [ {path: 'static/payment/surchargeaccount/partner-surcharge-account', module: 'surchargeAccountApp', roles: [1,2,3]}, {path: 'static/integralmall/coupon_cancellation', module: 'couponCancellation', roles: [1,2]}, {path: 'static/invoice/invoice_assistant', module: 'partnerInvoice', roles: [1]}, - {path: 'static/payment/billqrcode/bill-qrcode-manage', module: 'billQrCodeManagement', roles: [1,2,3]} + {path: 'static/payment/billqrcode/bill-qrcode-manage', module: 'billQrCodeManagement', roles: [1,2,3]}, + {path: 'static/incrementalService/partner-incremental-service', module: 'partnerIncrementalService', roles: [1,2,3]} ]; require(['angular', 'jquery'], function (angular, $) { diff --git a/src/main/ui/static/images/yangmatou.jpg b/src/main/ui/static/images/yangmatou.jpg new file mode 100644 index 000000000..90e55f643 Binary files /dev/null and b/src/main/ui/static/images/yangmatou.jpg differ diff --git a/src/main/ui/static/incrementalService/partner-incremental-service.js b/src/main/ui/static/incrementalService/partner-incremental-service.js new file mode 100644 index 000000000..31039d31c --- /dev/null +++ b/src/main/ui/static/incrementalService/partner-incremental-service.js @@ -0,0 +1,46 @@ +define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) { + 'use strict'; + var app = angular.module('partnerIncrementalService', ['ui.bootstrap', 'ui.router']); + app.config(['$stateProvider', function ($stateProvider) { + $stateProvider.state('partnerIncrementalService', { + url: '/partner_incremental_service', + templateUrl: '/static/incrementalService/templates/partner_incremental_service.html', + controller: 'partnerIncrementalServiceCtrl', + resolve:{ + partner:['$http',function($http){ + return $http.get('/client/partner_info'); + }] + } + }).state('partnerIncrementalServiceInfo', { + url: '/partner_incremental_service_info', + templateUrl: '/static/incrementalService/templates/partner_incremental_service_info.html', + controller: 'partnerIncrementalServiceInfoCtrl', + params:{ + service:null, + partner:null + } + }); + }]); + app.controller('partnerIncrementalServiceCtrl', ['$scope', '$http', '$state', 'partner', function ($scope, $http, $state, partner) { + $scope.serviceAll = []; + $scope.channelOptions = []; + $scope.clientInfo = angular.copy(partner.data); + $scope.initDate = function(){ + $http.get("/client/partner_info/"+$scope.clientInfo.client_moniker+"/incremental_service").then(function (res) { + $scope.serviceAll = res.data.all_service; + $scope.serviceAll.forEach(function(service){ + service.logo_url = '/static/images/'+service.channel+'.jpg' + }) + $scope.channelOptions = res.data.incremental_channel; + }) + } + $scope.initDate(); + $scope.queryServiceInfo = function(service){ + $state.go('partnerIncrementalServiceInfo', {service: service,partner:$scope.clientInfo}); + } + }]); + app.controller('partnerIncrementalServiceInfoCtrl',['$scope', '$http', '$state','$stateParams',function($scope,$http,$state,$stateParams){ + debugger + }]); + return app; +}); diff --git a/src/main/ui/static/incrementalService/templates/partner_incremental_service.html b/src/main/ui/static/incrementalService/templates/partner_incremental_service.html new file mode 100644 index 000000000..7bc4bb1ec --- /dev/null +++ b/src/main/ui/static/incrementalService/templates/partner_incremental_service.html @@ -0,0 +1,20 @@ +
    +

    {{serviceAll.length>0?'已开通增值服务':'您尚未开通任何增值服务'}}

    +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/src/main/ui/static/incrementalService/templates/partner_incremental_service_info.html b/src/main/ui/static/incrementalService/templates/partner_incremental_service_info.html new file mode 100644 index 000000000..566549bdf --- /dev/null +++ b/src/main/ui/static/incrementalService/templates/partner_incremental_service_info.html @@ -0,0 +1,10 @@ + + + + + Title + + + + + \ No newline at end of file diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index 7021bc4e5..571f4e043 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -197,6 +197,10 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter url: '/permission_client', templateUrl: 'static/payment/partner/templates/partner_permission.html', controller: 'permissionClientCtrl' + }).state('partners.detail.incremental_service', { + url: '/incremental_service', + templateUrl: 'static/payment/partner/templates/incremental_service.html', + controller: 'incrementalServiceCtrl' }); }]); app.controller('partnerListCtrl', ['$scope', '$sce', '$http', '$filter', '$uibModal', 'businessStructuresMap', 'industryMap', 'stateMap', 'sectorMap', 'countryMap', @@ -5186,6 +5190,123 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }; }]); + app.controller('incrementalServiceCtrl',['$scope', '$http', '$uibModal', '$state', '$filter', 'commonDialog',function($scope, $http, $uibModal, $state, $filter, commonDialog){ + $scope.serviceAll = {}; + $scope.channelOptions=[]; + $scope.initData = function(){ + $http.get('/sys/partners/' + $scope.partner.client_moniker+'/incremental_service').then(function(res){ + $scope.serviceAll = res.data.all_service; + $scope.serviceAll.forEach(function(service){ + service.logo_url = '/static/images/'+service.channel+'.jpg' + }) + $scope.channelOptions=res.data.incremental_channel; + }) + } + $scope.initData(); + $scope.newServiceChannelDialog = function (){ + $uibModal.open({ + templateUrl: '/static/payment/partner/templates/incremental_service_dialog.html', + controller: 'incrementalServiceDialogCtrl', + resolve: { + params: function(){ + return { + isCreate:true, + clientMoniker:$scope.partner.client_moniker, + channelOptions:$scope.channelOptions, + serviceChannel:null + } + } + } + }).result.then(function () { + $scope.initData(); + }); + } + $scope.editServiceChannelDialog = function (serviceChannel){ + $uibModal.open({ + templateUrl: '/static/payment/partner/templates/incremental_service_dialog.html', + controller: 'incrementalServiceDialogCtrl', + resolve: { + params: function(){ + return { + isCreate:false, + clientMoniker:$scope.partner.client_moniker, + channelOptions:$scope.channelOptions, + serviceChannel:serviceChannel + } + } + } + }).result.then(function () { + $scope.initData(); + }); + } + $scope.updateStatus = function(service){ + commonDialog.confirm({ + title: 'Update '+service.channel+ ' Incremental Service Status', + content: 'Are you sure update ' + service.channel + ' status?', + choises: [ + {label: 'Submit', className: 'btn-success', key: 1}, + {label: 'Cancel', className: 'btn-warning', key: 0, dismiss: true} + ] + }).then(function (choice) { + if (choice == 1) { + service.is_valid = !service.is_valid; + $http.put('/sys/partners/'+$scope.partner.client_moniker+'/incremental_service/status',service).then(function(res){ + commonDialog.alert({ + title: 'Success', + content: 'Update Service Successful!', + type: 'success' + }); + $scope.initData(); + },function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + $scope.initData(); + }) + } + }) + + } + }]); + app.controller('incrementalServiceDialogCtrl',['$scope','$http','params','commonDialog',function($scope ,$http,params,commonDialog){ + $scope.model ={}; + $scope.ctrl = {sending: false}; + $scope.isCreate = true; + $scope.initData =function(){ + $scope.isCreate = angular.copy(params.isCreate); + if($scope.isCreate ){ + $scope.model.incremental_mode = "1" + $scope.model.channel= angular.copy(params.channelOptions[0]) + $scope.model.channelOptions= angular.copy(params.channelOptions) + }else{ + $scope.model = angular.copy(params.serviceChannel); + $scope.model.incremental_mode = $scope.model.incremental_mode.toString() + } + } + $scope.initData(); + $scope.save = function(form){ + if (form.$invalid) { + angular.forEach(form, function (item, key) { + if (key.indexOf('$') < 0) { + item.$dirty = true; + } + }); + return; + } + $scope.ctrl.sending = true; + $http.post('/sys/partners/'+params.clientMoniker+'/incremental_service',$scope.model).then(function(res){ + commonDialog.alert({ + title: 'Success', + content: $scope.isCreate?'Create':'Update'+' Service Successful!', + type: 'success' + }); + $scope.ctrl.sending = false; + $scope.$close(); + },function (resp) { + $scope.ctrl.sending = false; + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) + + } + }]) app.filter('bdOrg', function () { diff --git a/src/main/ui/static/payment/partner/templates/incremental_service.html b/src/main/ui/static/payment/partner/templates/incremental_service.html new file mode 100644 index 000000000..764ee448b --- /dev/null +++ b/src/main/ui/static/payment/partner/templates/incremental_service.html @@ -0,0 +1,38 @@ +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    LogoChannelModeRate ValueTotal AmountOperatorCreate TimeUpdate TimeOperation
    {{service.channel}}{{service.incremental_mode==1?'固定手续费':'固定金额扣款' }}{{service.incremental_rate_value!=null?service.incremental_rate_value+'%':'-'}}{{service.total_incremental_amount}}{{service.operator}}{{service.create_time}}{{service.update_time}} + | + {{service.is_valid?'Disabled':'Enable'}} +
    +
    +
    +
    diff --git a/src/main/ui/static/payment/partner/templates/incremental_service_dialog.html b/src/main/ui/static/payment/partner/templates/incremental_service_dialog.html new file mode 100644 index 000000000..2dd5e9ec9 --- /dev/null +++ b/src/main/ui/static/payment/partner/templates/incremental_service_dialog.html @@ -0,0 +1,68 @@ + + + \ No newline at end of file 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 42063210f..d0c9800e6 100644 --- a/src/main/ui/static/payment/partner/templates/partner_detail.html +++ b/src/main/ui/static/payment/partner/templates/partner_detail.html @@ -295,6 +295,9 @@
  • Permissions
  • +
  • + Incremental Service +