Commit b02cd32f by 陶光胜

字段调整

parent f483941b
...@@ -96,12 +96,14 @@ public class StoreSearchUtils { ...@@ -96,12 +96,14 @@ public class StoreSearchUtils {
if(StringUtils.isNotBlank(searchJson)){ if(StringUtils.isNotBlank(searchJson)){
JSONObject json = JSON.parseObject(searchJson); JSONObject json = JSON.parseObject(searchJson);
StoreSearchQo storeSearchQo = json.getObject(StoreChannelEnum.OFFLINE.getChannel().toString(), StoreSearchQo.class); StoreSearchQo storeSearchQo = json.getObject(StoreChannelEnum.OFFLINE.getChannel().toString(), StoreSearchQo.class);
StoreSearchDTO storeSearchDTO = new StoreSearchDTO();
if(storeSearchQo.getAll() == 1){ if(storeSearchQo.getAll() == 1){
resultList = storeAuth.getStoreInfoIdList(); storeSearchDTO.setStoreInfoIds(StringUtils.join(storeAuth.getStoreInfoIdList().toArray(), " "));
}else { }else {
StoreSearchDTO storeSearchDTO = new StoreSearchDTO(); if(StringUtils.isNotBlank(storeSearchQo.getStoreIds())){
storeSearchDTO.setStoreInfoIds(storeSearchQo.getStoreIds().replaceAll(",", " "));
}
storeSearchDTO.setEnterpriseId(enterpriseId); storeSearchDTO.setEnterpriseId(enterpriseId);
storeSearchDTO.setStoreInfoIds(StringUtils.isBlank(storeSearchQo.getStoreIds()) ? null : storeSearchQo.getStoreIds().replaceAll(",", " "));
storeSearchDTO.setStoreGroupIds(StringUtils.isBlank(storeSearchQo.getStoreGroupIds()) ? null : storeSearchQo.getStoreGroupIds().replaceAll(",", " ")); storeSearchDTO.setStoreGroupIds(StringUtils.isBlank(storeSearchQo.getStoreGroupIds()) ? null : storeSearchQo.getStoreGroupIds().replaceAll(",", " "));
storeSearchDTO.setRegionIds(StringUtils.isBlank(storeSearchQo.getRegion()) ? null : storeSearchQo.getRegion().replaceAll(",", " ")); storeSearchDTO.setRegionIds(StringUtils.isBlank(storeSearchQo.getRegion()) ? null : storeSearchQo.getRegion().replaceAll(",", " "));
storeSearchDTO.setStoreTypes(StringUtils.isBlank(storeSearchQo.getStoreType()) ? null :storeSearchQo.getStoreType().replaceAll(",", " ")); storeSearchDTO.setStoreTypes(StringUtils.isBlank(storeSearchQo.getStoreType()) ? null :storeSearchQo.getStoreType().replaceAll(",", " "));
...@@ -295,42 +297,21 @@ public class StoreSearchUtils { ...@@ -295,42 +297,21 @@ public class StoreSearchUtils {
StoreSearchQo searchQo = JSON.parseObject(searchJson).getObject(channel.toString(), StoreSearchQo.class); StoreSearchQo searchQo = JSON.parseObject(searchJson).getObject(channel.toString(), StoreSearchQo.class);
log.info("getOnlineStoreIds:{},{}", searchJson, JSON.toJSONString(searchQo)); log.info("getOnlineStoreIds:{},{}", searchJson, JSON.toJSONString(searchQo));
if(searchQo != null){ if(searchQo != null){
if(searchQo.getAll() != 1){ //todo if(searchQo.getAll() != 1){ //不是所有线上门店
if(StringUtils.isNotBlank(searchQo.getStoreGroupIds())){ if(StringUtils.isNotBlank(searchQo.getStoreGroupIds())){
//资源类型 List<String> filter = filter(channel, searchQo, enterpriseId, key, Arrays.asList(searchQo.getStoreGroupIds().split(",")));
//店招品牌 list.addAll(filter);
List<String> onLineStoreList = new ArrayList<>(); }
if(StoreChannelEnum.WMMALL.getChannel().equals(channel)){ } else {
List<WmStoreDTO> wmStoreDTOList = this.wmStoreApiService.listWmStore(Arrays.asList(searchQo.getStoreGroupIds().split(",")), null).getResult(); onlineStoreAuth.getList().stream().forEach(s -> {
onLineStoreList = wmStoreDTOList.stream().filter(wmStoreDTO -> { if(s.getChannel() != null && s.getChannel().intValue() == channel.intValue()){
boolean resourceFlag = true; if(CollectionUtils.isNotEmpty(s.getStoreIdList())){
if(StringUtils.isNotBlank(searchQo.getResourceType())){
if("1".equals(searchQo.getResourceType())){ //自有资源
if(enterpriseId.equals(wmStoreDTO.getEnterpriseId())){
resourceFlag = true;
}
}
if("2".equals(searchQo.getStoreBrand())){ //共享资源
if(!enterpriseId.equals(wmStoreDTO.getEnterpriseId())){
resourceFlag = true;
}
}
}
boolean brandFlag = true;
if(StringUtils.isNotBlank(searchQo.getStoreBrand())){
List<String> strings = Arrays.asList(searchQo.getStoreBrand().split(","));
if(strings.contains(wmStoreDTO.getStoreBrandId().toString())){
brandFlag = true;
}
}
return resourceFlag || brandFlag;
}).map(wmStoreDTO -> wmStoreDTO.getWmMallStoreId().toString()).collect(Collectors.toList());
list.addAll(onLineStoreList);
if(CollectionUtils.isNotEmpty(onLineStoreList)){
RedisUtil.setCache(key, 1, 10L, TimeUnit.MINUTES); RedisUtil.setCache(key, 1, 10L, TimeUnit.MINUTES);
List<String> filter = filter(channel, searchQo, enterpriseId, key, s.getStoreIdList());
list.addAll(filter);
} }
} }
} });
} }
} }
} else { } else {
...@@ -347,4 +328,37 @@ public class StoreSearchUtils { ...@@ -347,4 +328,37 @@ public class StoreSearchUtils {
} }
} }
private List<String> filter(Integer channel, StoreSearchQo searchQo, Integer enterpriseId, String key, List<String> onLineStoreIdList){
if(StoreChannelEnum.WMMALL.getChannel().equals(channel)){
List<WmStoreDTO> wmStoreDTOList = this.wmStoreApiService.listWmStore(onLineStoreIdList, null).getResult();
List<String> onLineStoreList = wmStoreDTOList.stream().filter(wmStoreDTO -> {
boolean resourceFlag = true;
if(StringUtils.isNotBlank(searchQo.getResourceType())){
if("1".equals(searchQo.getResourceType())){ //自有资源
if(enterpriseId.equals(wmStoreDTO.getEnterpriseId())){
resourceFlag = true;
}
}
if("2".equals(searchQo.getStoreBrand())){ //共享资源
if(!enterpriseId.equals(wmStoreDTO.getEnterpriseId())){
resourceFlag = true;
}
}
}
boolean brandFlag = true;
if(StringUtils.isNotBlank(searchQo.getStoreBrand())){
List<String> strings = Arrays.asList(searchQo.getStoreBrand().split(","));
if(strings.contains(wmStoreDTO.getStoreBrandId().toString())){
brandFlag = true;
}
}
return resourceFlag || brandFlag;
}).map(wmStoreDTO -> wmStoreDTO.getWmMallStoreId().toString()).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(onLineStoreList)){
RedisUtil.setCache(key, 1, 10L, TimeUnit.MINUTES);
}
return onLineStoreList;
}
}
} }
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