commit
1bab6653b6
@ -1,13 +0,0 @@
|
||||
package au.com.royalpay.payment.manage.dev.core;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
/**
|
||||
* Created by yuan on 2017/9/18.
|
||||
*/
|
||||
public interface CommonSubMerchantIdService {
|
||||
|
||||
void save(JSONObject record);
|
||||
|
||||
void disable(String sub_merchant_id);
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
package au.com.royalpay.payment.manage.dev.core.impl;
|
||||
|
||||
import au.com.royalpay.payment.channels.wechat.config.WeChatPayConfig;
|
||||
import au.com.royalpay.payment.channels.wechat.runtime.MpPaymentApi;
|
||||
import au.com.royalpay.payment.manage.dev.core.CommonSubMerchantIdService;
|
||||
import au.com.royalpay.payment.manage.mappers.payment.CommonSubMerchantIdMapper;
|
||||
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Service
|
||||
public class CommonSubMerchantIdServiceImpl implements CommonSubMerchantIdService {
|
||||
|
||||
@Resource
|
||||
private CommonSubMerchantIdMapper commonSubMerchantIdMapper;
|
||||
|
||||
@Resource
|
||||
private MpPaymentApi mpPaymentApi;
|
||||
@Override
|
||||
public void save(JSONObject record) {
|
||||
JSONObject sub_merchant_id = commonSubMerchantIdMapper.find(record.getString("sub_merchant_id"));
|
||||
if(sub_merchant_id!=null){
|
||||
throw new BadRequestException("当前商户号已经添加,请重新输入");
|
||||
}
|
||||
WeChatPayConfig.Merchant availableMerchant = mpPaymentApi.determineMerchant(record.getString("sub_merchant_id"));
|
||||
if(availableMerchant == null){
|
||||
throw new BadRequestException("未检索到对应的商户号,请验证子商户号是否正确");
|
||||
}
|
||||
record.put("merchant_id",availableMerchant.getMerchantId());
|
||||
commonSubMerchantIdMapper.save(record);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disable(String sub_merchant_id) {
|
||||
JSONObject record = new JSONObject();
|
||||
record.put("sub_merchant_id",sub_merchant_id);
|
||||
record.put("is_valid",false);
|
||||
commonSubMerchantIdMapper.update(record);
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package au.com.royalpay.payment.manage.mappers.client;
|
||||
|
||||
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 com.github.miemiedev.mybatis.paginator.domain.PageBounds;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@AutoMapper(tablename = "cli_sub_merchant_id", pkName = "sub_merchant_id")
|
||||
public interface ClientSubMerchantIdMapper {
|
||||
@AutoSql(type = SqlType.SELECT)
|
||||
List<JSONObject> listSubMerchantId(PageBounds pageBounds);
|
||||
|
||||
@AutoSql(type = SqlType.INSERT)
|
||||
void save(JSONObject subMerchantId);
|
||||
|
||||
@AutoSql(type = SqlType.UPDATE)
|
||||
void update(JSONObject subMerchantId);
|
||||
|
||||
@AutoSql(type = SqlType.DELETE)
|
||||
void delete(@Param("sub_merchant_id") String sub_merchant_id);
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package au.com.royalpay.payment.manage.merchantid.core;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by yuan on 2018/4/24.
|
||||
*/
|
||||
public interface MerchantIdManageService {
|
||||
Map<String,List<JSONObject>> listSubMerchantId(JSONObject manager);
|
||||
|
||||
void generateClientsSunMerchantId();
|
||||
|
||||
JSONObject listNotTradeSubMerchantId(JSONObject manager);
|
||||
|
||||
List<JSONObject> showClientMoniker(JSONObject manager,String sub_merchant_id);
|
||||
|
||||
List<JSONObject> showNotTradeClientMoniker(JSONObject manager,String sub_merchant_id);
|
||||
|
||||
void save(JSONObject record);
|
||||
|
||||
void disable(String sub_merchant_id);
|
||||
}
|
@ -0,0 +1,138 @@
|
||||
package au.com.royalpay.payment.manage.merchantid.core.impl;
|
||||
|
||||
import au.com.royalpay.payment.channels.wechat.config.WeChatPayConfig;
|
||||
import au.com.royalpay.payment.channels.wechat.runtime.MpPaymentApi;
|
||||
import au.com.royalpay.payment.manage.analysis.mappers.ClientAnalysisMapper;
|
||||
import au.com.royalpay.payment.manage.mappers.client.ClientSubMerchantIdMapper;
|
||||
import au.com.royalpay.payment.manage.mappers.payment.CommonSubMerchantIdMapper;
|
||||
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
|
||||
import au.com.royalpay.payment.manage.merchantid.core.MerchantIdManageService;
|
||||
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
|
||||
import au.com.royalpay.payment.tools.env.SysConfigManager;
|
||||
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.miemiedev.mybatis.paginator.domain.Order;
|
||||
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Created by yuan on 2018/4/24.
|
||||
*/
|
||||
@Service
|
||||
public class MerchantIdManageServiceImpl implements MerchantIdManageService {
|
||||
@Autowired
|
||||
private ClientMapper clientMapper;
|
||||
|
||||
@Autowired
|
||||
private SysConfigManager sysConfigManager;
|
||||
|
||||
@Autowired
|
||||
private ClientAnalysisMapper clientAnalysisMapper;
|
||||
|
||||
@Autowired
|
||||
private ClientSubMerchantIdMapper clientSubMerchantIdMapper;
|
||||
|
||||
@Resource
|
||||
private CommonSubMerchantIdMapper commonSubMerchantIdMapper;
|
||||
|
||||
@Resource
|
||||
private MpPaymentApi mpPaymentApi;
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, List<JSONObject>> listSubMerchantId(JSONObject manager) {
|
||||
List<JSONObject> clients = clientMapper.listSubMerchantId();
|
||||
return getClientMap(clients);
|
||||
}
|
||||
@Override
|
||||
public JSONObject listNotTradeSubMerchantId(JSONObject manager) {
|
||||
List<JSONObject> clients = clientSubMerchantIdMapper.listSubMerchantId(new PageBounds(Order.formString("create_time.desc")));
|
||||
Map<String, List<JSONObject>> merchantIdMap = clients.stream().filter(t->t.containsKey("merchant_id")).filter(t->t.containsKey("sub_merchant_id")).collect(Collectors.groupingBy(t->t.getString("merchant_id")));
|
||||
JSONObject returnJason = new JSONObject();
|
||||
returnJason.put("merchant_id_map",merchantIdMap);
|
||||
returnJason.put("refresh_time",clients.size()>0?clients.get(0).getDate("create_time"):"");
|
||||
return returnJason;
|
||||
}
|
||||
@Override
|
||||
public void generateClientsSunMerchantId() {
|
||||
String tempSubMerchantIds = sysConfigManager.getSysConfig().getString("temp_sub_mch_id");
|
||||
List<JSONObject> clients = clientAnalysisMapper.notTradeSubMerchantId();
|
||||
List<JSONObject> clientSubMerchantId = clientSubMerchantIdMapper.listSubMerchantId(new PageBounds(Order.formString("create_time.desc")));
|
||||
Map<String, JSONObject> subMerchantIdMapFromDB = new HashMap<>();
|
||||
for (JSONObject id : clientSubMerchantId) {
|
||||
subMerchantIdMapFromDB.put(id.getString("sub_merchant_id"), id);
|
||||
}
|
||||
for (JSONObject client: clients) {
|
||||
String subMerchantId = client.getString("sub_merchant_id");
|
||||
if (subMerchantId != null && tempSubMerchantIds != null && tempSubMerchantIds.contains(subMerchantId)) {
|
||||
client.put("temp_sub_merchant", true);
|
||||
}
|
||||
String id = client.getString("sub_merchant_id");
|
||||
client.put("create_time",new Date());
|
||||
if (subMerchantIdMapFromDB.containsKey(id)) {
|
||||
subMerchantIdMapFromDB.remove(id);
|
||||
clientSubMerchantIdMapper.update(client);
|
||||
} else {
|
||||
clientSubMerchantIdMapper.save(client);
|
||||
}
|
||||
}
|
||||
for (String id : subMerchantIdMapFromDB.keySet()) {
|
||||
clientSubMerchantIdMapper.delete(id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> showClientMoniker(JSONObject manager,String sub_merchant_id) {
|
||||
return clientMapper.listBySubMerchantId(sub_merchant_id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> showNotTradeClientMoniker(JSONObject manager, String sub_merchant_id) {
|
||||
return clientAnalysisMapper.listNotTradeClients(sub_merchant_id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(JSONObject record) {
|
||||
JSONObject sub_merchant_id = commonSubMerchantIdMapper.find(record.getString("sub_merchant_id"));
|
||||
if(sub_merchant_id!=null){
|
||||
throw new BadRequestException("当前商户号已经添加,请重新输入");
|
||||
}
|
||||
WeChatPayConfig.Merchant availableMerchant = mpPaymentApi.determineMerchant(record.getString("sub_merchant_id"));
|
||||
if(availableMerchant == null){
|
||||
throw new BadRequestException("未检索到对应的商户号,请验证子商户号是否正确");
|
||||
}
|
||||
record.put("merchant_id",availableMerchant.getMerchantId());
|
||||
commonSubMerchantIdMapper.save(record);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disable(String sub_merchant_id) {
|
||||
JSONObject record = new JSONObject();
|
||||
record.put("sub_merchant_id",sub_merchant_id);
|
||||
record.put("is_valid",false);
|
||||
record.put("update_time",new Date());
|
||||
commonSubMerchantIdMapper.update(record);
|
||||
}
|
||||
|
||||
private Map<String, List<JSONObject>> getClientMap(List<JSONObject> clients){
|
||||
String tempSubMerchantIds = sysConfigManager.getSysConfig().getString("temp_sub_mch_id");
|
||||
for (JSONObject client: clients) {
|
||||
String subMerchantId = client.getString("sub_merchant_id");
|
||||
if (subMerchantId != null && tempSubMerchantIds != null && tempSubMerchantIds.contains(subMerchantId)) {
|
||||
client.put("temp_sub_merchant", true);
|
||||
}
|
||||
}
|
||||
Map<String, List<JSONObject>> clientsMap = clients.stream().filter(t->t.containsKey("merchant_id")).filter(t->t.containsKey("sub_merchant_id")).collect(Collectors.groupingBy(t->t.getString("merchant_id")));
|
||||
return clientsMap;
|
||||
}
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package au.com.royalpay.payment.manage.merchantid.web;
|
||||
|
||||
import au.com.royalpay.payment.manage.mappers.payment.CommonSubMerchantIdMapper;
|
||||
import au.com.royalpay.payment.manage.merchantid.core.MerchantIdManageService;
|
||||
|
||||
import au.com.royalpay.payment.manage.permission.manager.RequireManager;
|
||||
import au.com.royalpay.payment.tools.CommonConsts;
|
||||
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.miemiedev.mybatis.paginator.domain.Order;
|
||||
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/sys/merchant_id")
|
||||
public class MerchantIdManageController {
|
||||
|
||||
@Resource
|
||||
private MerchantIdManageService merchantIdManageService;
|
||||
|
||||
@Resource
|
||||
private CommonSubMerchantIdMapper commonSubMerchantIdMapper;
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET)
|
||||
@RequireManager(role = {ManagerRole.OPERATOR})
|
||||
public Map<String,List<JSONObject>> listSubMerchantId(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
|
||||
return merchantIdManageService.listSubMerchantId(manager);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET,value = "/trade")
|
||||
@RequireManager(role = {ManagerRole.OPERATOR})
|
||||
public JSONObject listNotTradeSubMerchantId(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
|
||||
return merchantIdManageService.listNotTradeSubMerchantId(manager);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST,value = "/refresh")
|
||||
@RequireManager(role = {ManagerRole.OPERATOR})
|
||||
public void refreshClientsByTraded(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
|
||||
merchantIdManageService.generateClientsSunMerchantId();
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET,value = "/{sub_merchant_id}")
|
||||
@RequireManager(role = {ManagerRole.OPERATOR})
|
||||
public List<JSONObject> showClientMoniker(@PathVariable() String sub_merchant_id,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
|
||||
return merchantIdManageService.showClientMoniker(manager,sub_merchant_id);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET,value = "/not_trade/{sub_merchant_id}")
|
||||
@RequireManager(role = {ManagerRole.OPERATOR})
|
||||
public List<JSONObject> showNotTradeClientMoniker(@PathVariable() String sub_merchant_id,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
|
||||
return merchantIdManageService.showNotTradeClientMoniker(manager,sub_merchant_id);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/common_sub_merchant_id", method = RequestMethod.GET)
|
||||
@RequireManager(role = {ManagerRole.OPERATOR})
|
||||
public List<JSONObject> listCommonSubMerchantId(@RequestParam(required = false) String sub_merchant_id, @RequestParam(defaultValue = "true") boolean is_valid) {
|
||||
return commonSubMerchantIdMapper.list(is_valid,sub_merchant_id,new PageBounds(Order.formString("create_time.desc")));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/common_sub_merchant_id/{sub_merchant_id}", method = RequestMethod.POST)
|
||||
@RequireManager(role = {ManagerRole.OPERATOR})
|
||||
public void addCommonSubMerchantId(@PathVariable String sub_merchant_id,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
|
||||
JSONObject record = new JSONObject();
|
||||
record.put("sub_merchant_id",sub_merchant_id);
|
||||
record.put("operator",manager.getString("display_name"));
|
||||
record.put("create_time",new Date());
|
||||
merchantIdManageService.save(record);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/common_sub_merchant_id/{sub_merchant_id}", method = RequestMethod.PUT)
|
||||
@RequireManager(role = {ManagerRole.OPERATOR})
|
||||
public void disableCommonSubMerchantId(@PathVariable String sub_merchant_id) {
|
||||
merchantIdManageService.disable(sub_merchant_id);
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package au.com.royalpay.payment.manage.task;
|
||||
|
||||
import au.com.royalpay.payment.manage.merchantid.core.MerchantIdManageService;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Component
|
||||
@ConditionalOnProperty(value = "app.run-tasks", havingValue = "true")
|
||||
public class SubMerchantIdTaskManager {
|
||||
@Resource
|
||||
private MerchantIdManageService merchantIdManageService;
|
||||
@Scheduled(cron = "0 0 4 * * ?")
|
||||
public void analysisDashboard(){
|
||||
merchantIdManageService.generateClientsSunMerchantId();
|
||||
}
|
||||
}
|
@ -1,88 +0,0 @@
|
||||
<section class="content-header">
|
||||
<h1>Sub Merchant ID</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li>
|
||||
<i class="fa fa-cog"></i> Basic Config
|
||||
</li>
|
||||
<li><a ui-sref="^">Dev Tools</a></li>
|
||||
<li class="active">Sub Merchant ID</li>
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="box-solid">
|
||||
<div class="box box-warning">
|
||||
<div class="box-header">
|
||||
<div class="form-inline">
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="sub_merchant_id-search">Sub Merchant Id</label>
|
||||
<input class="form-control" id="sub_merchant_id-search" ng-model="params.sub_merchant_id">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button class="btn btn-primary" type="button" ng-click="loadSubMerchantId(1)"><i
|
||||
class="fa fa-search"></i></button>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
||||
<a role="button" class="btn btn-info pull-right" ng-click="save()"
|
||||
title="New Activity">
|
||||
<i class="fa fa-plus"></i>
|
||||
New
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title">Common Sub Merchant ID List</h3>
|
||||
</div>
|
||||
|
||||
<div class="box-body no-padding table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Sub Merchat ID</th>
|
||||
<th>Merchat ID</th>
|
||||
<th>Operation</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="merchantId in subMerchantIdList">
|
||||
<td ng-bind="merchantId.sub_merchant_id"></td>
|
||||
<td ng-bind="merchantId.merchant_id"></td>
|
||||
<td ng-click="disable(merchantId.sub_merchant_id)">
|
||||
<i class="text-danger fa fa-close ng-scope" ng-if="!act.is_valid"></i>
|
||||
</td>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="box-footer" ng-if="subMerchantIdList.length">
|
||||
<uib-pagination class="pagination"
|
||||
total-items="pagination.totalCount"
|
||||
boundary-links="true"
|
||||
ng-model="pagination.page"
|
||||
items-per-page="pagination.limit"
|
||||
max-size="10"
|
||||
ng-change="loadSubMerchantId()"
|
||||
previous-text="‹"
|
||||
next-text="›"
|
||||
first-text="«"
|
||||
last-text="»"></uib-pagination>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">Total Records:{{pagination.totalCount}};Total Pages:{{pagination.totalPages}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,130 @@
|
||||
define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootSwitch', 'ngFileUpload', 'uiSelect'], function (angular) {
|
||||
'use strict';
|
||||
var app = angular.module('merchantIdManage', ['ui.bootstrap', 'ui.router', 'frapontillo.bootstrap-switch', 'ngFileUpload', 'ui.select']);
|
||||
app.config(['$stateProvider', function ($stateProvider) {
|
||||
$stateProvider.state('merchant_id_manage', {
|
||||
url: '/merchant_id/manage',
|
||||
templateUrl: '/static/payment/merchantid/templates/merchant_id_manage.html',
|
||||
controller: 'merchantIdManageCtrl',
|
||||
data: {label: '商户号列表'}
|
||||
})
|
||||
}]);
|
||||
app.controller('merchantIdManageCtrl', ['$scope', '$state', '$http', '$uibModal', 'commonDialog', function ($scope, $state, $http,$uibModal,commonDialog) {
|
||||
$scope.pagination = {};
|
||||
$scope.params = {};
|
||||
$scope.isCollapsed = true;
|
||||
|
||||
$scope.loadClient = function () {
|
||||
$scope.client_loading = true;
|
||||
$http.get('/sys/merchant_id').then(function (resp) {
|
||||
$scope.clientsMap = resp.data;
|
||||
$scope.client_loading = false;
|
||||
});
|
||||
};
|
||||
$scope.loadClient();
|
||||
$scope.loadNotTradeClient = function () {
|
||||
$http.get('/sys/merchant_id/trade').then(function (resp) {
|
||||
$scope.notTradeClientsMap = resp.data.merchant_id_map;
|
||||
$scope.refresh_time = resp.data.refresh_time;
|
||||
$scope.disable_button = false;
|
||||
});
|
||||
};
|
||||
$scope.loadNotTradeClient();
|
||||
|
||||
$scope.loadTempSubMerchantId = function () {
|
||||
var params = angular.copy($scope.params);
|
||||
if(!params.sub_merchant_id){
|
||||
delete params.sub_merchant_id;
|
||||
}
|
||||
$http.get('/sys/merchant_id/common_sub_merchant_id',{params: params}).then(function (resp) {
|
||||
$scope.subMerchantIdList= resp.data;
|
||||
});
|
||||
};
|
||||
$scope.loadTempSubMerchantId();
|
||||
$scope.showClient = function (sub_merchant_id) {
|
||||
$uibModal.open({
|
||||
templateUrl: '/static/payment/merchantid/templates/client_sub_merchant_id.html',
|
||||
controller: 'showClientsCtrl',
|
||||
resolve: {
|
||||
clients: ['$http', function ($http) {
|
||||
return $http.get('/sys/merchant_id/'+sub_merchant_id);
|
||||
}]
|
||||
},
|
||||
size: 'sm'
|
||||
})
|
||||
};
|
||||
|
||||
$scope.showNotTradeClient = function (sub_merchant_id) {
|
||||
$uibModal.open({
|
||||
templateUrl: '/static/payment/merchantid/templates/client_sub_merchant_id.html',
|
||||
controller: 'showNotTradeClientsCtrl',
|
||||
resolve: {
|
||||
clients: ['$http', function ($http) {
|
||||
return $http.get('/sys/merchant_id/not_trade/'+sub_merchant_id);
|
||||
}]
|
||||
},
|
||||
size: 'sm'
|
||||
})
|
||||
};
|
||||
$scope.refresh = function () {
|
||||
$scope.disable_button = true;
|
||||
$http.post('/sys/merchant_id/refresh').then(function (resp) {
|
||||
$scope.loadNotTradeClient();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.save = function () {
|
||||
$uibModal.open({
|
||||
templateUrl: '/static/payment/merchantid/templates/new_common_sub_merchant_id.html',
|
||||
controller: 'newCommonSubMerchantIdCtrl'
|
||||
}).result.then(function () {
|
||||
$scope.loadTempSubMerchantId()
|
||||
})
|
||||
}
|
||||
$scope.disable = function (sub_merchant_id) {
|
||||
$http.put('/sys/merchant_id/common_sub_merchant_id/'+sub_merchant_id).then(function (resp) {
|
||||
commonDialog.alert({title: 'Success', content: 'Success', type: 'success'});
|
||||
$scope.loadTempSubMerchantId();
|
||||
},function (resp) {
|
||||
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}]);
|
||||
|
||||
app.controller('showClientsCtrl', ['$scope', '$http','clients', function ($scope, $http,clients) {
|
||||
$scope.clients = clients.data;
|
||||
}]);
|
||||
app.controller('showNotTradeClientsCtrl', ['$scope', '$http','clients', function ($scope, $http,clients) {
|
||||
$scope.clients = clients.data;
|
||||
}]);
|
||||
app.controller('newCommonSubMerchantIdCtrl', ['$scope', '$http','commonDialog','$state', function ($scope, $http,commonDialog,$state) {
|
||||
$scope.params = {};
|
||||
$scope.saveSubMerchantId = function () {
|
||||
var params = angular.copy($scope.params);
|
||||
$http.post('/sys/merchant_id/common_sub_merchant_id/'+params.sub_merchant_id).then(function () {
|
||||
$scope.$close();
|
||||
commonDialog.alert({title: 'Success', content: '保存成功', type: 'success'});
|
||||
},function (resp) {
|
||||
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
|
||||
});
|
||||
};
|
||||
}]);
|
||||
|
||||
app.filter('choose_merchant_id', function () {
|
||||
return function (value) {
|
||||
switch (value + '') {
|
||||
case '1307485301':
|
||||
return '1307485301(Tunnel Show1)';
|
||||
case '1431999902':
|
||||
return '1431999902(Tunnel Show2)';
|
||||
case '1487387142':
|
||||
return '1487387142(NAP)';
|
||||
case '':
|
||||
return ''
|
||||
}
|
||||
}
|
||||
});
|
||||
return app;
|
||||
});
|
@ -0,0 +1,11 @@
|
||||
<div class="modal-header">
|
||||
<h4>Clients</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div>
|
||||
<a ng-repeat="client in clients"
|
||||
ui-sref="partners.detail({clientMoniker:client.client_moniker})">
|
||||
{{client.client_moniker}},
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,131 @@
|
||||
<style>
|
||||
.cursor {
|
||||
cursor: pointer;
|
||||
}
|
||||
.div-display{
|
||||
display: none;
|
||||
}
|
||||
|
||||
</style>
|
||||
<div ui-view>
|
||||
<section class="content-header">
|
||||
<h1>Merchant Id Manage</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li>
|
||||
<i class="fa fa-sitemap"></i> Payment
|
||||
</li>
|
||||
<li class="active">Merchant Id Manage</li>
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
<div class="content">
|
||||
<div class="box box-warning">
|
||||
<div class="box-body">
|
||||
<uib-tabset>
|
||||
<uib-tab heading="商户号列表">
|
||||
<loadingbar ng-if="client_loading"></loadingbar>
|
||||
<div class="col-sm-12 col-xs-12">
|
||||
<div style="margin-top: 5px">
|
||||
<div class="list-group col-sm-12 col-xs-12" ng-repeat="(key,clients) in clientsMap">
|
||||
<a class="list-group-item active col-sm-12 col-xs-12">
|
||||
{{key|choose_merchant_id}}
|
||||
<span href="#" class="small-box-footer cursor pull-right" ng-click="isCollapsed = !isCollapsed">更多 <i class="fa fa-arrow-circle-right"></i></span>
|
||||
</a>
|
||||
<a class="list-group-item col-sm-2 col-xs-6 cursor"
|
||||
ng-repeat="client in clients | orderBy:'client_count':true"
|
||||
ng--click="showClient(client.sub_merchant_id);" ng-if="$index<60">
|
||||
<span>
|
||||
{{client.sub_merchant_id}} <i class="fa fa-clock-o text-danger"
|
||||
title="Using temp Sub Merchant ID"
|
||||
ng-if="client.temp_sub_merchant"></i></span>
|
||||
<span class="badge" aria-hidden="true" title="show detail">{{client.client_count}}</span>
|
||||
</a>
|
||||
|
||||
<a class="list-group-item col-sm-2 col-xs-6 cursor" ng-class="{'div-display':isCollapsed}"
|
||||
ng-repeat="client in clients | orderBy:'client_count':true"
|
||||
ng--click="showClient(client.sub_merchant_id);" ng-if="$index>59">
|
||||
<span>
|
||||
{{client.sub_merchant_id}} <i class="fa fa-clock-o text-danger"
|
||||
title="Using temp Sub Merchant ID"
|
||||
ng-if="client.temp_sub_merchant"></i></span>
|
||||
<span class="badge" aria-hidden="true" title="show detail">{{client.client_count}}</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</uib-tab>
|
||||
<uib-tab heading="三十天未交易商户号">
|
||||
<div class="box-body">
|
||||
<div class="col-sm-12 col-xs-12" style="padding-right: 30px;margin-bottom: 5px">
|
||||
<div class="pull-right">
|
||||
<span ng-if="refresh_time">
|
||||
<span>上次刷新时间:</span><span><em><b>{{refresh_time}}</b></em></span>
|
||||
</span>
|
||||
<a role="button" class="btn btn-primary" title="refresh" ng-click="refresh()" ng-class="{disabled:disable_button}">
|
||||
<i class="glyphicon glyphicon-refresh"
|
||||
title="refresh"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12 col-xs-12">
|
||||
<loadingbar ng-if="disable_button"></loadingbar>
|
||||
<div>
|
||||
<div class="list-group col-sm-12 col-xs-12"
|
||||
ng-repeat="(key,clients) in notTradeClientsMap">
|
||||
<a class="list-group-item active col-sm-12 col-xs-12">
|
||||
{{key|choose_merchant_id}}
|
||||
</a>
|
||||
<a class="list-group-item col-sm-2 col-xs-6 cursor"
|
||||
ng-repeat="client in clients | orderBy:'client_count':true"
|
||||
ng--click="showNotTradeClient(client.sub_merchant_id)">
|
||||
<span>{{client.sub_merchant_id}} <i class="fa fa-clock-o text-danger"
|
||||
title="Temp Sub Merchant ID"
|
||||
ng-if="client.temp_sub_merchant"></i></span>
|
||||
<span class="badge" aria-hidden="true" title="show detail">{{client.client_count}}</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</uib-tab>
|
||||
<uib-tab heading="通用子商户号">
|
||||
<div class="box-body table-responsive">
|
||||
<div class="col-sm-12 col-xs-6">
|
||||
<a role="button" class="btn btn-primary pull-right" title="Add Sub Merchant Id" ng-click="save()">
|
||||
<i class="fa fa-plus"></i>
|
||||
Add
|
||||
</a>
|
||||
</div>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Merchant Id</th>
|
||||
<th>Sub Merchant Id</th>
|
||||
<th>Operator</th>
|
||||
<th>Create Time</th>
|
||||
<th>Operation</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="client in subMerchantIdList">
|
||||
<td ng-bind="client.merchant_id"></td>
|
||||
<td>
|
||||
{{client.sub_merchant_id}}
|
||||
<i class="fa fa-clock-o text-danger"
|
||||
title="Temp Sub Merchant ID"></i>
|
||||
</td>
|
||||
<td ng-bind="client.operator"></td>
|
||||
<td ng-bind="client.create_time"></td>
|
||||
<td>
|
||||
<a class="text-bold text-danger" role="button" ng-click="disable(client.sub_merchant_id)">Disable</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</uib-tab>
|
||||
</uib-tabset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in new issue