Commit 454ec291 by zhiwj

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

parents 9b98e136 24529580
......@@ -29,6 +29,12 @@ public class StoreSearchDTO implements Serializable {
private Integer completeStatus;
private List<Integer> storeResourceList;
private Integer erpStatus;
private String storeGroupIds;
private String regionIds;
private String storeTypes;
private String storeStatuss;
private String erpStatuss;
private String storeTags;
public Integer getStoreGroupId() {
return storeGroupId;
......@@ -232,4 +238,52 @@ public class StoreSearchDTO implements Serializable {
this.erpStatus = erpStatus;
return this;
}
public String getStoreGroupIds() {
return storeGroupIds;
}
public void setStoreGroupIds(String storeGroupIds) {
this.storeGroupIds = storeGroupIds;
}
public String getRegionIds() {
return regionIds;
}
public void setRegionIds(String regionIds) {
this.regionIds = regionIds;
}
public String getStoreTypes() {
return storeTypes;
}
public void setStoreTypes(String storeTypes) {
this.storeTypes = storeTypes;
}
public String getStoreStatuss() {
return storeStatuss;
}
public void setStoreStatuss(String storeStatuss) {
this.storeStatuss = storeStatuss;
}
public String getErpStatuss() {
return erpStatuss;
}
public void setErpStatuss(String erpStatuss) {
this.erpStatuss = erpStatuss;
}
public String getStoreTags() {
return storeTags;
}
public void setStoreTags(String storeTags) {
this.storeTags = storeTags;
}
}
......@@ -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) {
......@@ -779,6 +791,7 @@ public class StoreApiServiceImpl implements StoreApiService {
storeSearchDTO.setLongitude(coupApplyStoreSearchDTO.getLongitude());
storeSearchDTO.setLatitude(coupApplyStoreSearchDTO.getLatitude());
storeSearchDTO.setCityId(coupApplyStoreSearchDTO.getCityId());
storeSearchDTO.setStoreResourceList(coupApplyStoreSearchDTO.getStoreWidgetIdList());
if(coupApplyStoreSearchDTO.getStoreWidgetId() != null){
storeSearchDTO.setStoreResource(Long.valueOf(storeWidgetId+""));
}
......@@ -1531,6 +1544,39 @@ public class StoreApiServiceImpl implements StoreApiService {
json = QueryConditionAssemblyUtil.createSimpleQueryNode(StoreESFieldsEnum.LOCATION.getField(), OperateEnum.OPERATE_LOCATION, storeSearchDTO.getLatitude()+","+storeSearchDTO.getLongitude());
jsonObjectList.add(json);
}
if(StringUtils.isNotBlank(storeSearchDTO.getStoreGroupIds())){
json = QueryConditionAssemblyUtil.createSimpleQueryNode(StoreESFieldsEnum.STOREGROUPIDLIST.getField(), OperateEnum.OPERATE_ARR_CONTAIN, storeSearchDTO.getStoreGroupIds());
jsonObjectList.add(json);
}
if(StringUtils.isNotBlank(storeSearchDTO.getRegionIds())){
json = QueryConditionAssemblyUtil.createSimpleQueryNode(StoreESFieldsEnum.REGIONID.getField(), OperateEnum.OPERATE_ARR_CONTAIN, storeSearchDTO.getRegionIds());
jsonObjectList.add(json);
}
if(StringUtils.isNotBlank(storeSearchDTO.getStoreTypes())){
json = QueryConditionAssemblyUtil.createSimpleQueryNode(StoreESFieldsEnum.STORETYPE.getField(), OperateEnum.OPERATE_ARR_CONTAIN, storeSearchDTO.getStoreTypes());
jsonObjectList.add(json);
}
if(StringUtils.isNotBlank(storeSearchDTO.getStoreStatuss())){
json = QueryConditionAssemblyUtil.createSimpleQueryNode(StoreESFieldsEnum.STATUS.getField(), OperateEnum.OPERATE_ARR_CONTAIN, storeSearchDTO.getStoreStatuss());
jsonObjectList.add(json);
}
if(StringUtils.isNotBlank(storeSearchDTO.getErpStatuss())){
json = QueryConditionAssemblyUtil.createSimpleQueryNode(StoreESFieldsEnum.ERPSTATUS.getField(), OperateEnum.OPERATE_ARR_CONTAIN, storeSearchDTO.getErpStatuss());
jsonObjectList.add(json);
}
if(StringUtils.isNotBlank(storeSearchDTO.getStoreTags())){
String[] arr = storeSearchDTO.getStoreTags().split(",");
List<TabStoreTag> storeTags = this.storeTagService.listByEnterprise(storeSearchDTO.getEnterpriseId());
storeTags.stream().filter(tag -> {
for (String s : arr) {
if (tag.getStoreTagId().intValue() == Integer.valueOf(s)) {
return true;
}
}
return false;
}).map(tag -> storeSearchDTO.getStoreResourceList().add(tag.getStoreTagId()));
}
String storeWidgetJSON = this.buildStoreWidgetJSON(storeSearchDTO.getStoreResource() == null ? null : storeSearchDTO.getStoreResource().intValue(), json, jsonObjectList);
/*****如果存在没有门店权限的门店控件id,直接返回*****/
if (StringUtils.isNotBlank(storeWidgetJSON)) {
......
......@@ -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