Commit e97f4e89 by zhiwj

Merge branch 'developer' of http://115.159.76.241/base_platform_enterprise/gic-store into developer

# Conflicts:
#	gic-store-service/src/main/java/com/gic/store/service/outer/impl/StoreApiServiceImpl.java
parents 713bca0c 50fd329d
......@@ -245,18 +245,28 @@ public class StoreApiServiceImpl implements StoreApiService {
@Override
public ServiceResponse<Integer> saveStoreForOrder(Integer enterpriseId, String storeCode, String storeName, Integer regionId, String orderNum) {
return saveStoreForOrder(enterpriseId, storeCode, storeName, regionId, orderNum, null);
}
@Override
public ServiceResponse<Integer> saveStoreForOrder(Integer enterpriseId, String storeCode, String storeName, Integer regionId, String orderNum, Integer storeBrandId) {
ServiceResponse<List<EnterpriseLicenseDTO>> listEnterpriseLicense = this.enterpriseApiService.listEnterpriseLicense(enterpriseId);
Integer storeLicenseNum = 0;
if(listEnterpriseLicense.isSuccess() && CollectionUtils.isNotEmpty(listEnterpriseLicense.getResult())){
boolean hasStoreLicense = listEnterpriseLicense.getResult()
.stream()
.anyMatch(e -> LicenseUtils.STORE_LICENSE_CODE.equals(e.getLicenseCode()));
if(hasStoreLicense){
storeLicenseNum = listEnterpriseLicense.getResult().stream()
.filter(e -> LicenseUtils.STORE_LICENSE_CODE.equals(e.getLicenseCode()))
.collect(Collectors.toList()).get(0).getUpperLimit();
}
}
Integer count = this.storeService.countByStoreName(enterpriseId, null, null);
if(count >= storeLicenseNum){
return ServiceResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "门店license超出限制");
}
StoreDTO storeDTO = new StoreDTO();
storeDTO.setEnterpriseId(enterpriseId);
storeDTO.setStoreCode(storeCode);
storeDTO.setStoreName(storeName);
storeDTO.setRegionId(regionId);
storeDTO.setCreateType(CreateTypeEnum.ORDER.getCode());
storeDTO.setStoreBrands(storeBrandId.toString());
ServiceResponse<StoreDTO> response = this.saveOrUpdate(storeDTO);
if(response.isSuccess()){
return ServiceResponse.success(response.getResult().getStoreInfoId());
......@@ -266,11 +276,22 @@ public class StoreApiServiceImpl implements StoreApiService {
@Override
public ServiceResponse<Integer> saveStoreForPosMember(Integer enterpriseId, String storeCode, String storeName, Integer regionId, String cardNO) {
return saveStoreForPosMember(enterpriseId, storeCode, storeName, regionId, cardNO, null);
}
@Override
public ServiceResponse<Integer> saveStoreForPosMember(Integer enterpriseId, String storeCode, String storeName, Integer regionId, String cardNO, Integer storeBrandId) {
ServiceResponse<List<EnterpriseLicenseDTO>> listEnterpriseLicense = this.enterpriseApiService.listEnterpriseLicense(enterpriseId);
Integer storeLicenseNum = 0;
if(listEnterpriseLicense.isSuccess() && CollectionUtils.isNotEmpty(listEnterpriseLicense.getResult())){
boolean hasStoreLicense = listEnterpriseLicense.getResult()
.stream()
.anyMatch(e -> LicenseUtils.STORE_LICENSE_CODE.equals(e.getLicenseCode()));
if(hasStoreLicense){
storeLicenseNum = listEnterpriseLicense.getResult().stream()
.filter(e -> LicenseUtils.STORE_LICENSE_CODE.equals(e.getLicenseCode()))
.collect(Collectors.toList()).get(0).getUpperLimit();
}
}
Integer count = this.storeService.countByStoreName(enterpriseId, null, null);
if(count >= storeLicenseNum){
return ServiceResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "门店license超出限制");
}
StoreDTO storeDTO = new StoreDTO();
storeDTO.setEnterpriseId(enterpriseId);
storeDTO.setStoreCode(storeCode);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment