add 商户编码自动生成,可刷新

master
luoyang 5 years ago
parent 8aebba2f38
commit 37266365d3

@ -122,4 +122,6 @@ public interface ClientMapper {
List<JSONObject> createClientsByGroup(@Param("start_date") Date start_date,@Param("end_date") Date end_date,@Param("start_date_month") Date start_date_month);
List<JSONObject> clientPayTypeInfoByClientIdRange(@Param("begin") int begin, @Param("end") int end);
int getPartnercode(@Param("codes") String codes);
}

@ -43,6 +43,8 @@ public interface ClientManager {
List<JSONObject> listPartners(JSONObject manager, PartnerQuery query);
String initMerchantCode();
@Transactional
JSONObject registerClient(String clientMoniker, ClientRegisterInfo registery, JSONObject manager);

@ -630,6 +630,15 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
return clientMapper.listPartnerSelection(params, new PageBounds(Order.formString("create_time.desc")));
}
@Override
public String initMerchantCode() {
String code = RandomStringUtils.randomAlphanumeric(4).toUpperCase();
if (clientMapper.getPartnercode(code) > 0) {
return initMerchantCode();
}
return code;
}
@Override
@Transactional
public JSONObject registerClient(String clientMoniker, ClientRegisterInfo registery, JSONObject manager) {

@ -48,6 +48,12 @@ public class PartnerManageController {
return clientManager.listPartners(manager, query);
}
@RequestMapping(value = "/init/merchant_code", method = RequestMethod.GET)
public String initMerchantCode() {
return clientManager.initMerchantCode();
}
@RequestMapping(method = RequestMethod.POST)
@RequireManager(role = {ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.OPERATOR})
public JSONObject registerPartner(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @RequestBody @Valid ClientRegisterInfo registery,

@ -645,4 +645,8 @@
AND p.client_id >= #{begin}
AND p.client_id &lt; #{end}
</select>
<select id="getPartnercode" resultType="int">
SELECT count(1) FROM sys_clients where client_moniker=#{codes};
</select>
</mapper>

@ -368,6 +368,12 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
} else {
$scope.partner = {timezone: 'Australia/Melbourne'};
}
$scope.initMerchantCode = function () {
$http.get('/sys/partners/init/merchant_code').then(function (response) {
$scope.partner.client_moniker = response.data;
});
};
$scope.initMerchantCode();
$scope.partner.company_phone_c = 61;
$scope.partner.contact_phone_c = 61;
$scope.partner.client_pay_type = [];

@ -35,11 +35,13 @@
Numbers)</label>
<div class="col-sm-8">
<input class="form-control text-uppercase"
style="display: inline-block;width:20%"
ng-model="partner.client_moniker"
type="text"
name="client_moniker"
id="short-id-input" required maxlength="4"
ng-pattern="/^[a-zA-Z0-9]+$/">
ng-pattern="/^[a-zA-Z0-9]+$/" readonly>
<a style="display: inline-block" role="button" ng-click="initMerchantCode()"><i class="fa fa-refresh" title="Refreshes the partner code"></i></a>
<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