add 商户进件 商户编码检测

master
luoyang 5 years ago
parent a6aff4eece
commit b9d8612dc7

@ -13,7 +13,7 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jib-maven-plugin.version>1.1.2</jib-maven-plugin.version> <jib-maven-plugin.version>1.1.2</jib-maven-plugin.version>
<docker-image.version>1.1.10</docker-image.version> <docker-image.version>1.1.11</docker-image.version>
</properties> </properties>
<dependencies> <dependencies>

@ -45,6 +45,8 @@ public interface ClientManager {
String initMerchantCode(); String initMerchantCode();
boolean getMerchantIsValid(String clientMoniker);
@Transactional @Transactional
JSONObject registerClient(String clientMoniker, ClientRegisterInfo registery, JSONObject manager); JSONObject registerClient(String clientMoniker, ClientRegisterInfo registery, JSONObject manager);

@ -633,12 +633,20 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Override @Override
public String initMerchantCode() { public String initMerchantCode() {
String code = RandomStringUtils.randomAlphanumeric(4).toUpperCase(); String code = RandomStringUtils.randomAlphanumeric(4).toUpperCase();
if (clientMapper.getPartnercode(code) > 0) { if (!getMerchantIsValid(code)) {
return initMerchantCode(); return initMerchantCode();
} }
return code; return code;
} }
@Override
public boolean getMerchantIsValid(String clientMoniker) {
if (clientMapper.getPartnercode(clientMoniker) > 0) {
return false;
}
return true;
}
@Override @Override
@Transactional @Transactional
public JSONObject registerClient(String clientMoniker, ClientRegisterInfo registery, JSONObject manager) { public JSONObject registerClient(String clientMoniker, ClientRegisterInfo registery, JSONObject manager) {

@ -54,6 +54,11 @@ public class PartnerManageController {
return clientManager.initMerchantCode(); return clientManager.initMerchantCode();
} }
@RequestMapping(value = "/init/check_code_isvalid", method = RequestMethod.GET)
public boolean getMerchantIsValid(@RequestParam String clientMoniker) {
return clientManager.getMerchantIsValid(clientMoniker);
}
@RequestMapping(method = RequestMethod.POST) @RequestMapping(method = RequestMethod.POST)
@RequireManager(role = {ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.OPERATOR}) @RequireManager(role = {ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.OPERATOR})
public JSONObject registerPartner(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @RequestBody @Valid ClientRegisterInfo registery, public JSONObject registerPartner(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @RequestBody @Valid ClientRegisterInfo registery,

@ -371,6 +371,8 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.initMerchantCode = function () { $scope.initMerchantCode = function () {
$http.get('/sys/partners/init/merchant_code').then(function (response) { $http.get('/sys/partners/init/merchant_code').then(function (response) {
$scope.partner.client_moniker = response.data; $scope.partner.client_moniker = response.data;
$scope.merchantCodeChecked = true;
$scope.merchantIsValid = true;
}); });
}; };
$scope.initMerchantCode(); $scope.initMerchantCode();
@ -437,6 +439,8 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.clean_days = angular.copy(clean_days_map); $scope.clean_days = angular.copy(clean_days_map);
$scope.bd_citys = angular.copy(bd_city_map); $scope.bd_citys = angular.copy(bd_city_map);
$scope.params = {textType: 'all', org_name: 'ALL'}; $scope.params = {textType: 'all', org_name: 'ALL'};
$scope.merchantIsValid = false;
$scope.merchantCodeChecked = false;
function remove(arr, val) { function remove(arr, val) {
if (angular.isArray(arr)) { if (angular.isArray(arr)) {
@ -526,6 +530,17 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
// $scope.t2city_map = angular.copy(t2city_map); // $scope.t2city_map = angular.copy(t2city_map);
$scope.timezones = timezone.configs(); $scope.timezones = timezone.configs();
$scope.checkMerchantCodeIsValid = function (code) {
if (code.length != 4) {
$scope.merchantCodeChecked = false;
$scope.merchantIsValid = false;
return;
}
$http.get('/sys/partners/init/check_code_isvalid',{params:{clientMoniker:code}}).then(function (response) {
$scope.merchantIsValid = response.data;
$scope.merchantCodeChecked = true;
});
};
$scope.save = function (form) { $scope.save = function (form) {
if (form.$invalid) { if (form.$invalid) {
angular.forEach(form, function (item, key) { angular.forEach(form, function (item, key) {

@ -40,8 +40,12 @@
type="text" type="text"
name="client_moniker" name="client_moniker"
id="short-id-input" required maxlength="4" id="short-id-input" required maxlength="4"
ng-pattern="/^[a-zA-Z0-9]+$/" readonly> ng-pattern="/^[a-zA-Z0-9]+$/" ng-change="checkMerchantCodeIsValid(partner.client_moniker)">
<a style="display: inline-block" role="button" ng-click="initMerchantCode()"><i class="fa fa-refresh" title="Refreshes the partner code"></i></a> <a style="display: inline-block" role="button" ng-click="initMerchantCode()"><i class="fa fa-refresh" title="Refreshes the partner code"></i></a>
<span ng-if="merchantCodeChecked">
<i ng-if="merchantIsValid" class="fa fa-check-square-o check-i" aria-hidden="true" style="float: none;padding-left: 20px"></i>
<i ng-if="!merchantIsValid" class="text-danger fa fa-close" style="float: none;padding-left: 20px"></i>
</span>
<p class="small text-info">No further changeable!</p> <p class="small text-info">No further changeable!</p>
<div ng-messages="partnerForm.client_moniker.$error" <div ng-messages="partnerForm.client_moniker.$error"
ng-if="partnerForm.client_moniker.$dirty"> ng-if="partnerForm.client_moniker.$dirty">

Loading…
Cancel
Save