[Y] 商户编码添加默认值(6位数字字母组合)且不可修改

master
“sunn” 7 years ago
parent d98624f2ce
commit e134c27257

@ -72,4 +72,7 @@ public interface ClientMapper {
List<String> listCityClientIds(@Param("city") String city, @Param("date") Date date);
List<String> listClientByCleanDays(@Param("clean_days") int clean_days);
@AutoSql(type = SqlType.SELECT)
int getPartnercode(@Param("codes") String codes);
}

@ -13,7 +13,7 @@ import javax.validation.constraints.Pattern;
public class ClientRegisterInfo {
@JSONField(name = "client_moniker")
@NotEmpty(message = "error.payment.valid.param_missing")
@Pattern(regexp = "^[a-zA-Z0-9]{4}$", message = "Parameter error(partner code):Only letters or numbers are allowed")
@Pattern(regexp = "^[a-zA-Z0-9]{6}$", message = "Parameter error(partner code):Only letters or numbers are allowed")
private String clientMoniker;
@NotEmpty(message = "error.payment.valid.param_missing")
@JSONField(name = "company_name")

@ -264,4 +264,6 @@ public interface ClientManager {
void validRefundPwd(JSONObject account, String pwd);
void setWeekendDelay(int clientId, boolean delay);
String initMerchantCode();
}

@ -2084,6 +2084,16 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
clientMapper.update(clientUpdate);
}
@Override
public String initMerchantCode() {
String code = RandomStringUtils.randomAlphanumeric(6).toUpperCase();
if (clientMapper.getPartnercode(code) > 0) {
return initMerchantCode();
}
return code;
}
@Override
public void setClientQRCodePaySurCharge(String clientMoniker, boolean paySurcharge) {
JSONObject client = getClientInfoByMoniker(clientMoniker);

@ -482,4 +482,8 @@ public class PartnerManageController {
public void localMerchantPermission(@PathVariable String clientMoniker, @RequestBody JSONObject pass, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.switchPermission(manager, clientMoniker, "local_merchant", pass.getBooleanValue("allow"));
}
@RequestMapping(value = "/init/merchant_code", method = RequestMethod.GET)
public String initMerchantCode() {
return clientManager.initMerchantCode();
}
}

@ -272,4 +272,7 @@
<select id="listClientByCleanDays" resultType="java.lang.String">
SELECT client_id FROM sys_clients WHERE is_valid = 1 and clean_days = #{clean_days}
</select>
<select id="getPartnercode" resultType="int">
SELECT count(1) FROM sys_clients where client_moniker=#{codes};
</select>
</mapper>

@ -40,7 +40,12 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}).state('partners.new', {
url: '/new',
templateUrl: '/static/payment/partner/templates/add_partner.html',
controller: 'addPartnerCtrl'
controller: 'addPartnerCtrl',
resolve: {
merchant_code: ['$http', function ($http) {
return $http.get('/sys/partners/init/merchant_code');
}]
}
}).state('partners.detail', {
url: '/{clientMoniker}/detail',
templateUrl: '/static/payment/partner/templates/partner_detail.html',
@ -224,6 +229,9 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}
$scope.partner.company_phone_c = 61;
$scope.partner.contact_phone_c = 61;
$http.get('/sys/partners/init/merchant_code').then(function (response) {
$scope.partner.client_moniker = response.data;
});
function remove(arr, val) {
if (angular.isArray(arr)) {
@ -1241,6 +1249,10 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
controller: 'partnerNewSubPartnerDialogCtrl',
size: 'lg',
resolve: {
merchant_code: ['$http', function ($http) {
return $http.get('/sys/partners/init/merchant_code');
}],
clientMoniker: function () {
return $scope.partner.client_moniker;
}
@ -1534,6 +1546,9 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
app.controller('partnerNewSubPartnerDialogCtrl', ['$rootScope', '$scope', '$http', '$state', 'Upload', 'commonDialog', 'timezone',
'clientMoniker', 'industryMap', 'businessStructuresMap', 'stateMap', 'countryMap',
function ($rootScope, $scope, $http, $state, Upload, commonDialog, timezone, clientMoniker, industryMap, businessStructuresMap, stateMap, countryMap) {
$http.get('/sys/partners/init/merchant_code').then(function (response) {
$scope.partner.client_moniker = response.data;
});
if ($scope.partner_application) {
$scope.partner = angular.copy($scope.partner_application);
delete $rootScope.partner_application;

@ -27,8 +27,7 @@
ng-model="partner.client_moniker"
type="text"
name="client_moniker"
id="short-id-input" required maxlength="4"
ng-pattern="/^[a-zA-Z0-9]+$/">
id="short-id-input" readonly>
<p class="small text-info">No further changeable!</p>
<div ng-messages="partnerForm.client_moniker.$error"
ng-if="partnerForm.client_moniker.$dirty">

@ -20,7 +20,7 @@
<input class="form-control text-uppercase" ng-model="partner.client_moniker"
type="text"
name="client_moniker"
id="short-id-input" required maxlength="4" ng-pattern="/^[a-zA-Z0-9]+$/">
id="short-id-input" readonly>
<p class="small text-info">No further changeable!</p>
<div ng-messages="partnerForm.client_moniker.$error"
ng-if="partnerForm.client_moniker.$dirty">

Loading…
Cancel
Save