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,14 +297,41 @@ public class StoreSearchUtils { ...@@ -295,14 +297,41 @@ 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<>(); }
} else {
onlineStoreAuth.getList().stream().forEach(s -> {
if(s.getChannel() != null && s.getChannel().intValue() == channel.intValue()){
if(CollectionUtils.isNotEmpty(s.getStoreIdList())){
RedisUtil.setCache(key, 1, 10L, TimeUnit.MINUTES);
List<String> filter = filter(channel, searchQo, enterpriseId, key, s.getStoreIdList());
list.addAll(filter);
}
}
});
}
}
} else {
if(CollectionUtils.isNotEmpty(onlineStoreAuth.getList())){
onlineStoreAuth.getList().stream().forEach(s -> {
if(s.getChannel() != null && s.getChannel().intValue() == channel.intValue()){
if(CollectionUtils.isNotEmpty(s.getStoreIdList())){
RedisUtil.setCache(key, 1, 10L, TimeUnit.MINUTES);
list.addAll(s.getStoreIdList());
}
}
});
}
}
}
private List<String> filter(Integer channel, StoreSearchQo searchQo, Integer enterpriseId, String key, List<String> onLineStoreIdList){
if(StoreChannelEnum.WMMALL.getChannel().equals(channel)){ if(StoreChannelEnum.WMMALL.getChannel().equals(channel)){
List<WmStoreDTO> wmStoreDTOList = this.wmStoreApiService.listWmStore(Arrays.asList(searchQo.getStoreGroupIds().split(",")), null).getResult(); List<WmStoreDTO> wmStoreDTOList = this.wmStoreApiService.listWmStore(onLineStoreIdList, null).getResult();
onLineStoreList = wmStoreDTOList.stream().filter(wmStoreDTO -> { List<String> onLineStoreList = wmStoreDTOList.stream().filter(wmStoreDTO -> {
boolean resourceFlag = true; boolean resourceFlag = true;
if(StringUtils.isNotBlank(searchQo.getResourceType())){ if(StringUtils.isNotBlank(searchQo.getResourceType())){
if("1".equals(searchQo.getResourceType())){ //自有资源 if("1".equals(searchQo.getResourceType())){ //自有资源
...@@ -325,25 +354,10 @@ public class StoreSearchUtils { ...@@ -325,25 +354,10 @@ public class StoreSearchUtils {
} }
return resourceFlag || brandFlag; return resourceFlag || brandFlag;
}).map(wmStoreDTO -> wmStoreDTO.getWmMallStoreId().toString()).collect(Collectors.toList()); }).map(wmStoreDTO -> wmStoreDTO.getWmMallStoreId().toString()).collect(Collectors.toList());
list.addAll(onLineStoreList);
if(CollectionUtils.isNotEmpty(onLineStoreList)){ if(CollectionUtils.isNotEmpty(onLineStoreList)){
RedisUtil.setCache(key, 1, 10L, TimeUnit.MINUTES); RedisUtil.setCache(key, 1, 10L, TimeUnit.MINUTES);
} }
} return onLineStoreList;
}
}
}
} else {
if(CollectionUtils.isNotEmpty(onlineStoreAuth.getList())){
onlineStoreAuth.getList().stream().forEach(s -> {
if(s.getChannel() != null && s.getChannel().intValue() == channel.intValue()){
if(CollectionUtils.isNotEmpty(s.getStoreIdList())){
RedisUtil.setCache(key, 1, 10L, TimeUnit.MINUTES);
list.addAll(s.getStoreIdList());
}
}
});
}
} }
} }
......
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