Commit f2839e37 by zhiwj

Merge branch 'developer' of…

Merge branch 'developer' of http://115.159.76.241/base_platform_enterprise/gic-data-cloud into developer
parents a318b800 75534d3e
...@@ -60,7 +60,7 @@ public class StoreSearchUtils { ...@@ -60,7 +60,7 @@ public class StoreSearchUtils {
ServiceResponse<DataAuthDTO> response = this.dataAuthApiService.ggetDataAuthByUserId(enterpriseId, userId); ServiceResponse<DataAuthDTO> response = this.dataAuthApiService.ggetDataAuthByUserId(enterpriseId, userId);
DataAuthDTO dataAuthDTO = response.getResult() == null ? new DataAuthDTO() : response.getResult(); DataAuthDTO dataAuthDTO = response.getResult() == null ? new DataAuthDTO() : response.getResult();
if(StringUtils.isBlank(searchJson)){ if(StringUtils.isBlank(searchJson)){
return dataAuthDTO.getNoOwnerStore(); return 0;
} }
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);
...@@ -72,8 +72,10 @@ public class StoreSearchUtils { ...@@ -72,8 +72,10 @@ public class StoreSearchUtils {
} }
public List<Integer> storeSearch(Integer userId, Integer enterpriseId, String searchJson){ public List<Integer> storeSearch(Integer userId, Integer enterpriseId, String searchJson){
log.info("storeSearchParams:{},{},{}", userId, enterpriseId, searchJson);
String key = "1:" + enterpriseId + ":" + userId +":" + (StringUtils.isNotBlank(searchJson) ? searchJson.hashCode() : "searchJSON".hashCode()); String key = "1:" + enterpriseId + ":" + userId +":" + (StringUtils.isNotBlank(searchJson) ? searchJson.hashCode() : "searchJSON".hashCode());
StoreAuth storeAuth = this.dataAuthUtils.getStoreAuth(userId, enterpriseId); StoreAuth storeAuth = this.dataAuthUtils.getStoreAuth(userId, enterpriseId);
log.info("storeAuth:{}", JSON.toJSONString(storeAuth));
if(!storeAuth.isHasAuth()){ if(!storeAuth.isHasAuth()){
ArrayList<Integer> list = new ArrayList<>(); ArrayList<Integer> list = new ArrayList<>();
list.add(0); list.add(0);
...@@ -110,13 +112,14 @@ public class StoreSearchUtils { ...@@ -110,13 +112,14 @@ public class StoreSearchUtils {
} }
} }
ServiceResponse<Page<StoreDTO>> pageServiceResponse = this.storeApiService.listStore(storeSearchDTO, 1, 20000); ServiceResponse<Page<StoreDTO>> pageServiceResponse = this.storeApiService.listStore(storeSearchDTO, 1, 20000);
if(pageServiceResponse.isSuccess() && pageServiceResponse.getResult() != null){ log.info("storeResule:{}", JSON.toJSONString(pageServiceResponse));
if(pageServiceResponse.isSuccess() && pageServiceResponse.getResult() != null && CollectionUtils.isNotEmpty(pageServiceResponse.getResult().getResult())){
List<StoreDTO> storeDTOList = pageServiceResponse.getResult().getResult(); List<StoreDTO> storeDTOList = pageServiceResponse.getResult().getResult();
List<Integer> storeInfoIdList = storeDTOList.stream().map(storeDTO -> storeDTO.getStoreInfoId()).collect(Collectors.toList()); List<Integer> storeInfoIdList = storeDTOList.stream().map(storeDTO -> storeDTO.getStoreInfoId()).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(storeAuth.getStoreInfoIdList())){ if(CollectionUtils.isNotEmpty(storeAuth.getStoreInfoIdList())){
resultList = storeInfoIdList.stream().filter(s -> { resultList = storeInfoIdList.stream().filter(s -> {
for (Integer storeInfoId : storeAuth.getStoreInfoIdList()) { for (Integer storeInfoId : storeAuth.getStoreInfoIdList()) {
if (s.intValue() == storeInfoId.intValue()) { if (s != null && s.intValue() == storeInfoId.intValue()) {
return true; return true;
} }
} }
...@@ -138,6 +141,7 @@ public class StoreSearchUtils { ...@@ -138,6 +141,7 @@ public class StoreSearchUtils {
public List<String> onLineStoreSearch(Integer userId, Integer enterpriseId, String searchJson){ public List<String> onLineStoreSearch(Integer userId, Integer enterpriseId, String searchJson){
OnLineAuth onlineStoreAuth = this.dataAuthUtils.getOnlineStore(userId, enterpriseId); OnLineAuth onlineStoreAuth = this.dataAuthUtils.getOnlineStore(userId, enterpriseId);
log.info("onlineStoreAuth:{}", JSON.toJSONString(onlineStoreAuth));
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
if(onlineStoreAuth.isHasAuth()){ if(onlineStoreAuth.isHasAuth()){
this.getOnlineStoreIds(searchJson, onlineStoreAuth, list, StoreChannelEnum.GICMALL.getChannel(), userId, enterpriseId); this.getOnlineStoreIds(searchJson, onlineStoreAuth, list, StoreChannelEnum.GICMALL.getChannel(), userId, enterpriseId);
...@@ -255,14 +259,16 @@ public class StoreSearchUtils { ...@@ -255,14 +259,16 @@ public class StoreSearchUtils {
} }
} }
} else { } else {
onlineStoreAuth.getList().stream().forEach(s -> { if(CollectionUtils.isNotEmpty(onlineStoreAuth.getList())){
if(s.getChannel().intValue() == channel.intValue()){ onlineStoreAuth.getList().stream().forEach(s -> {
if(CollectionUtils.isNotEmpty(s.getStoreIdList())){ if(s.getChannel() != null && s.getChannel().intValue() == channel.intValue()){
RedisUtil.setCache(key, 1, 10l, TimeUnit.MINUTES); if(CollectionUtils.isNotEmpty(s.getStoreIdList())){
list.addAll(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