Commit 96070b5a by guojuxing

license查询调整:实时查询,不在冗余

parent eb9edc06
......@@ -16,6 +16,7 @@ import com.gic.enterprise.response.EnterpriseServiceResponse;
import com.gic.enterprise.service.CustomStoreApiService;
import com.gic.enterprise.service.EnterpriseApiService;
import com.gic.enterprise.service.WmStoreSyncLogApiService;
import com.gic.enterprise.utils.LicenseUtils;
import com.gic.mq.sdk.GicMQClient;
import com.gic.redis.data.util.RedisUtil;
import com.gic.search.business.api.constant.enums.OperateEnum;
......@@ -174,8 +175,14 @@ public class StoreApiServiceImpl implements StoreApiService {
if (storeDTO.getStoreId() == null) {
ServiceResponse<List<EnterpriseLicenseDTO>> listEnterpriseLicense = this.enterpriseApiService.listEnterpriseLicense(storeDTO.getEnterpriseId());
if(listEnterpriseLicense.isSuccess() && CollectionUtils.isNotEmpty(listEnterpriseLicense.getResult())){
if(listEnterpriseLicense.getResult().size()== 4){
storeDTO.setLicense(listEnterpriseLicense.getResult().get(3).getUpperLimit());
boolean hasStoreLicense = listEnterpriseLicense.getResult()
.stream()
.anyMatch(e -> LicenseUtils.STORE_LICENSE_CODE.equals(e.getLicenseCode()));
if(hasStoreLicense){
Integer storeLicenseNum = listEnterpriseLicense.getResult().stream()
.filter(e -> LicenseUtils.STORE_LICENSE_CODE.equals(e.getLicenseCode()))
.collect(Collectors.toList()).get(0).getUpperLimit();
storeDTO.setLicense(storeLicenseNum);
}
}
Integer id = storeService.save(storeDTO);
......@@ -270,9 +277,14 @@ public class StoreApiServiceImpl implements StoreApiService {
public ServiceResponse<Void> tranOverFlow(Integer enterpriseId, String storeIds) {
ServiceResponse<List<EnterpriseLicenseDTO>> listEnterpriseLicense = this.enterpriseApiService.listEnterpriseLicense(enterpriseId);
if (listEnterpriseLicense.isSuccess() && CollectionUtils.isNotEmpty(listEnterpriseLicense.getResult())) {
if (listEnterpriseLicense.getResult().size() == 4) {
boolean hasStoreLicense = listEnterpriseLicense.getResult()
.stream()
.anyMatch(e -> LicenseUtils.STORE_LICENSE_CODE.equals(e.getLicenseCode()));
if (hasStoreLicense) {
Integer currCount = this.storeService.countByOverflowStatus(enterpriseId, 0);
Integer upperLimit = listEnterpriseLicense.getResult().get(3).getUpperLimit();
Integer upperLimit = listEnterpriseLicense.getResult().stream()
.filter(e -> LicenseUtils.STORE_LICENSE_CODE.equals(e.getLicenseCode()))
.collect(Collectors.toList()).get(0).getUpperLimit();
// 剩余数量
int remainingCount = upperLimit - currCount;
if (storeIds.split(",").length > remainingCount) {
......
......@@ -17,6 +17,7 @@ import com.gic.enterprise.response.EnterpriseRestResponse;
import com.gic.enterprise.service.DownloadReportApiService;
import com.gic.enterprise.service.EnterpriseApiService;
import com.gic.enterprise.service.QrCodeApiService;
import com.gic.enterprise.utils.LicenseUtils;
import com.gic.enterprise.utils.ResultControllerUtils;
import com.gic.enterprise.utils.UserDetailUtils;
import com.gic.log.api.service.LogApiService;
......@@ -283,9 +284,15 @@ public class StoreController extends DownloadUtils {
Integer enterpriseId = UserDetailUtils.getUserDetail().getEnterpriseId();
ServiceResponse<List<EnterpriseLicenseDTO>> listEnterpriseLicense = this.enterpriseApiService.listEnterpriseLicense(enterpriseId);
if (listEnterpriseLicense.isSuccess() && CollectionUtils.isNotEmpty(listEnterpriseLicense.getResult())) {
if (listEnterpriseLicense.getResult().size() == 4) {
boolean hasStoreLicense = listEnterpriseLicense.getResult()
.stream()
.anyMatch(e -> LicenseUtils.STORE_LICENSE_CODE.equals(e.getLicenseCode()));
if (hasStoreLicense) {
Integer storeLicenseNum = listEnterpriseLicense.getResult().stream()
.filter(e -> LicenseUtils.STORE_LICENSE_CODE.equals(e.getLicenseCode()))
.collect(Collectors.toList()).get(0).getUpperLimit();
Integer result = this.storeApiService.countByOverflowStatus(enterpriseId).getResult();
return RestResponse.success(listEnterpriseLicense.getResult().get(3).getUpperLimit() - result);
return RestResponse.success(storeLicenseNum - result);
}
}
return RestResponse.success();
......
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