Commit fa1ebe2c by 陶光胜

门店控件查询

parent c3451283
......@@ -118,9 +118,8 @@ public class StoreSearchUtils {
StoreAuth storeAuth = this.dataAuthUtils.getStoreAuth(userId, enterpriseId);
log.info("storeAuth:{}", JSON.toJSONString(storeAuth));
if(!storeAuth.isHasAuth()){
ArrayList<Integer> list = new ArrayList<>();
list.add(0);
return list;
resultList.add(0);
return resultList;
}
if(StringUtils.isNotBlank(searchJson)){
JSONObject json = JSON.parseObject(searchJson);
......@@ -129,65 +128,65 @@ public class StoreSearchUtils {
if(storeSearchQo.getAll() == 1){
storeSearchDTO.setStoreInfoIds(StringUtils.join(storeAuth.getStoreInfoIdList().toArray(), " "));
}else {
if(StringUtils.isNotBlank(storeSearchQo.getStoreIds())){
storeSearchDTO.setStoreInfoIds(storeSearchQo.getStoreIds().replaceAll(",", " "));
if (StringUtils.isNotBlank(storeSearchQo.getStoreIds())) {
storeSearchDTO.setStoreInfoIds(storeSearchQo.getStoreIds().replaceAll(",", " "));
}
storeSearchDTO.setEnterpriseId(enterpriseId);
storeSearchDTO.setStoreGroupIds(StringUtils.isBlank(storeSearchQo.getStoreGroupIds()) ? null : storeSearchQo.getStoreGroupIds().replaceAll(",", " "));
storeSearchDTO.setRegionIds(StringUtils.isBlank(storeSearchQo.getRegion()) ? null : storeSearchQo.getRegion().replaceAll(",", " "));
storeSearchDTO.setStoreTypes(StringUtils.isBlank(storeSearchQo.getStoreType()) ? null :storeSearchQo.getStoreType().replaceAll(",", " "));
storeSearchDTO.setStoreStatuss(StringUtils.isBlank(storeSearchQo.getStoreStatus()) ? null :storeSearchQo.getStoreStatus().replaceAll(",", " "));
storeSearchDTO.setRealStatuss(StringUtils.isBlank(storeSearchQo.getErpStatus()) ? null :storeSearchQo.getErpStatus().replaceAll(",", " "));
storeSearchDTO.setStoreTags(StringUtils.isBlank(storeSearchQo.getStoreTag()) ? null :storeSearchQo.getStoreTag().replaceAll(",", " "));
storeSearchDTO.setStoreBrandIds(StringUtils.isBlank(storeSearchQo.getStoreBrand()) ? null :storeSearchQo.getStoreBrand().replaceAll(",", " "));
String resourceType = storeSearchQo.getResourceType();
Integer ownType = null;
if(StringUtils.isNotBlank(resourceType)){
if("1".equals(resourceType)){
ownType = 0;
}
if("2".equals(resourceType)){
ownType = 1;
}
}
storeSearchDTO.setEnterpriseId(enterpriseId);
storeSearchDTO.setStoreGroupIds(StringUtils.isBlank(storeSearchQo.getStoreGroupIds()) ? null : storeSearchQo.getStoreGroupIds().replaceAll(",", " "));
storeSearchDTO.setRegionIds(StringUtils.isBlank(storeSearchQo.getRegion()) ? null : storeSearchQo.getRegion().replaceAll(",", " "));
storeSearchDTO.setStoreTypes(StringUtils.isBlank(storeSearchQo.getStoreType()) ? null :storeSearchQo.getStoreType().replaceAll(",", " "));
storeSearchDTO.setStoreStatuss(StringUtils.isBlank(storeSearchQo.getStoreStatus()) ? null :storeSearchQo.getStoreStatus().replaceAll(",", " "));
storeSearchDTO.setRealStatuss(StringUtils.isBlank(storeSearchQo.getErpStatus()) ? null :storeSearchQo.getErpStatus().replaceAll(",", " "));
storeSearchDTO.setStoreTags(StringUtils.isBlank(storeSearchQo.getStoreTag()) ? null :storeSearchQo.getStoreTag().replaceAll(",", " "));
storeSearchDTO.setStoreBrandIds(StringUtils.isBlank(storeSearchQo.getStoreBrand()) ? null :storeSearchQo.getStoreBrand().replaceAll(",", " "));
String resourceType = storeSearchQo.getResourceType();
Integer ownType = null;
if(StringUtils.isNotBlank(resourceType)){
if("1".equals(resourceType)){
ownType = 0;
}
if(storeSearchQo.getAttentionStore() == 1){
List<AttentionStoreDTO> result = this.storeAttentionApiService.pageStoreAttention(userId, enterpriseId, 1, Integer.MAX_VALUE).getResult().getResult();
List<Integer> list = result.stream().filter(t -> {
if(t.getStoreId() != null){
if("2".equals(resourceType)){
ownType = 1;
}
}
if(storeSearchQo.getAttentionStore() == 1){
List<AttentionStoreDTO> result = this.storeAttentionApiService.pageStoreAttention(userId, enterpriseId, 1, Integer.MAX_VALUE).getResult().getResult();
List<Integer> list = result.stream().filter(t -> {
if(t.getStoreId() != null){
return true;
}else {
return false;
}
}).map(dto -> dto.getStoreId()).collect(Collectors.toList());
String storeInfoIds = StringUtils.join(list, " ");
storeSearchDTO.setStoreInfoIds(StringUtils.isNotBlank(storeSearchDTO.getStoreInfoIds()) ? storeSearchDTO.getStoreInfoIds()+" "+ storeInfoIds : storeInfoIds);
}
ServiceResponse<Page<StoreDTO>> pageServiceResponse = this.storeApiService.listStore(storeSearchDTO, 1, 20000);
if(pageServiceResponse.isSuccess() && pageServiceResponse.getResult() != null && CollectionUtils.isNotEmpty(pageServiceResponse.getResult().getResult())){
List<StoreDTO> storeDTOList = pageServiceResponse.getResult().getResult();
Integer finalOwnType = ownType;
List<Integer> storeInfoIdList = storeDTOList.stream().filter(storeDTO -> {
if(finalOwnType != null){ //按资源类型进行过滤
if(storeDTO.getOwnType().equals(finalOwnType)){
return true;
}else {
return false;
return false;
}
}).map(dto -> dto.getStoreId()).collect(Collectors.toList());
String storeInfoIds = StringUtils.join(list, " ");
storeSearchDTO.setStoreInfoIds(StringUtils.isNotBlank(storeSearchDTO.getStoreInfoIds()) ? storeSearchDTO.getStoreInfoIds()+" "+ storeInfoIds : storeInfoIds);
}
ServiceResponse<Page<StoreDTO>> pageServiceResponse = this.storeApiService.listStore(storeSearchDTO, 1, 20000);
if(pageServiceResponse.isSuccess() && pageServiceResponse.getResult() != null && CollectionUtils.isNotEmpty(pageServiceResponse.getResult().getResult())){
List<StoreDTO> storeDTOList = pageServiceResponse.getResult().getResult();
Integer finalOwnType = ownType;
List<Integer> storeInfoIdList = storeDTOList.stream().filter(storeDTO -> {
if(finalOwnType != null){ //按资源类型进行过滤
if(storeDTO.getOwnType().equals(finalOwnType)){
}
return true;
}).map(storeDTO -> storeDTO.getStoreInfoId()).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(storeAuth.getStoreInfoIdList())){
resultList = storeInfoIdList.stream().filter(s -> {
for (Integer storeInfoId : storeAuth.getStoreInfoIdList()) { //按权限门店进行过滤
if (s != null && s.intValue() == storeInfoId.intValue()) {
return true;
}else {
return false;
}
}
return true;
}).map(storeDTO -> storeDTO.getStoreInfoId()).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(storeAuth.getStoreInfoIdList())){
resultList = storeInfoIdList.stream().filter(s -> {
for (Integer storeInfoId : storeAuth.getStoreInfoIdList()) { //按权限门店进行过滤
if (s != null && s.intValue() == storeInfoId.intValue()) {
return true;
}
}
return false;
}).collect(Collectors.toList());
} else {
resultList = storeInfoIdList;
}
return false;
}).collect(Collectors.toList());
} else {
resultList = storeInfoIdList;
}
}
} else {
......@@ -207,7 +206,7 @@ public class StoreSearchUtils {
List<String> list = new ArrayList<>();
int flag = dealSearchJson(searchJson);
if(flag == 1){
list.add("0");
list.add("noauth");
return list;
}
OnLineAuth onlineStoreAuth = this.dataAuthUtils.getOnlineStore(userId, enterpriseId);
......@@ -217,7 +216,7 @@ public class StoreSearchUtils {
this.getOnlineStoreIds(searchJson, onlineStoreAuth, list, StoreChannelEnum.WMMALL.getChannel(), userId, enterpriseId);
this.getOnlineStoreIds(searchJson, onlineStoreAuth, list, StoreChannelEnum.TIANMAO.getChannel(), userId, enterpriseId);
}else {
list.add("0");
list.add("noauth");
}
return list;
}
......
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