Commit 08cb86d9 authored by 廖旭伟's avatar 廖旭伟

修改测试bug

parent 06abac86
...@@ -72,6 +72,7 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao, ...@@ -72,6 +72,7 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao,
if (!ObjectUtils.isEmpty(entity.getCategoryId()) && ObjectUtils.isEmpty(entity.getCompanyId())) { if (!ObjectUtils.isEmpty(entity.getCategoryId()) && ObjectUtils.isEmpty(entity.getCompanyId())) {
Result<ProductCategoryEntity> productCategoryResult = productCategoryService.find(new ProductCategoryQuery().categoryId(Long.parseLong(entity.getCategoryId())), pageInfo, context); Result<ProductCategoryEntity> productCategoryResult = productCategoryService.find(new ProductCategoryQuery().categoryId(Long.parseLong(entity.getCategoryId())), pageInfo, context);
List<ProductEntity> productList = getProductEntitiesByCategory(entity, productCategoryResult); List<ProductEntity> productList = getProductEntitiesByCategory(entity, productCategoryResult);
productList = productList.stream().filter(Objects::nonNull).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(hot)) { if (!ObjectUtils.isEmpty(hot)) {
//过滤热门与非热门 //过滤热门与非热门
productList = productList.stream().filter(f -> f.getHot() == hot).collect(Collectors.toList()); productList = productList.stream().filter(f -> f.getHot() == hot).collect(Collectors.toList());
...@@ -88,6 +89,7 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao, ...@@ -88,6 +89,7 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao,
Result<CompanyProductEntity> companyProductEntityResult = companyProductService.find(new CompanyProductQuery().companyId(Long.parseLong(entity.getCompanyId())), pageInfo, context); Result<CompanyProductEntity> companyProductEntityResult = companyProductService.find(new CompanyProductQuery().companyId(Long.parseLong(entity.getCompanyId())), pageInfo, context);
List<CompanyProductEntity> companyProducList = companyProductEntityResult.getList(); List<CompanyProductEntity> companyProducList = companyProductEntityResult.getList();
List<ProductEntity> productList = getProductEntitiesByCompanyId(entity, companyProducList); List<ProductEntity> productList = getProductEntitiesByCompanyId(entity, companyProducList);
productList = productList.stream().filter(Objects::nonNull).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(hot)) { if (!ObjectUtils.isEmpty(hot)) {
//过滤热门与非热门 //过滤热门与非热门
productList = productList.stream().filter(f -> f.getHot() == hot).collect(Collectors.toList()); productList = productList.stream().filter(f -> f.getHot() == hot).collect(Collectors.toList());
...@@ -109,6 +111,7 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao, ...@@ -109,6 +111,7 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao,
//求2个list的交集 //求2个list的交集
List<ProductEntity> collect = CollUtil.intersection(productCategoryList, productCompanyList).stream().collect(Collectors.toList()); List<ProductEntity> collect = CollUtil.intersection(productCategoryList, productCompanyList).stream().collect(Collectors.toList());
collect = collect.stream().filter(Objects::nonNull).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(hot)) { if (!ObjectUtils.isEmpty(hot)) {
//过滤热门与非热门 //过滤热门与非热门
collect = collect.stream().filter(f -> f.getHot() == hot).collect(Collectors.toList()); collect = collect.stream().filter(f -> f.getHot() == hot).collect(Collectors.toList());
...@@ -158,6 +161,7 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao, ...@@ -158,6 +161,7 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao,
} }
}); });
} }
productList = productList.stream().filter(Objects::nonNull).collect(Collectors.toList());
productList = productList.stream().filter(f -> f.getShelves() == 1).collect(Collectors.toList()); productList = productList.stream().filter(f -> f.getShelves() == 1).collect(Collectors.toList());
productList = productList.stream().sorted(Comparator.comparing(ProductEntity::getPublishTime).reversed()) productList = productList.stream().sorted(Comparator.comparing(ProductEntity::getPublishTime).reversed())
.collect(Collectors.toList()); .collect(Collectors.toList());
......
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