Commit fa1ebe2c by 陶光胜

门店控件查询

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