Commit 98621776 authored by 廖旭伟's avatar 廖旭伟

测试bug修改

parent bdbc8cb4
...@@ -85,7 +85,7 @@ public class ProductApiController extends AbstractBaseController<ProductReq>{ ...@@ -85,7 +85,7 @@ public class ProductApiController extends AbstractBaseController<ProductReq>{
query.setCategoryId(String.valueOf(productReq.getCategoryId())); query.setCategoryId(String.valueOf(productReq.getCategoryId()));
} }
query.setHot(productReq.getHot()); query.setHot(productReq.getHot());
query.setOrderColList(Arrays.asList(new OrderCol("createTime", OrderCol.DESCENDING))); query.setOrderColList(Arrays.asList(new OrderCol("publishTime", OrderCol.DESCENDING)));
Result<ProductEntity> result = productService.find(query, pageInfo, context); Result<ProductEntity> result = productService.find(query, pageInfo, context);
List<ProductEntity> collect = result.getList().stream().map(item -> { List<ProductEntity> collect = result.getList().stream().map(item -> {
ProductEntity productEntity = new ProductEntity(); ProductEntity productEntity = new ProductEntity();
......
...@@ -139,16 +139,19 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao, ...@@ -139,16 +139,19 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao,
public List<ProductEntity> getProductEntitiesByCompanyId(ProductEntity entity, List<CompanyProductEntity> companyProducList) { public List<ProductEntity> getProductEntitiesByCompanyId(ProductEntity entity, List<CompanyProductEntity> companyProducList) {
List<ProductEntity> productList = new ArrayList<>(); List<ProductEntity> productList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(companyProducList)){ if(CollectionUtils.isNotEmpty(companyProducList)){
List<ProductEntity> finalProductList = productList;
companyProducList.forEach(item->{ companyProducList.forEach(item->{
ProductEntity productEntity = this.getCache(item.getProductId().toString()); ProductEntity productEntity = this.getCache(item.getProductId().toString());
if (!ObjectUtils.isEmpty(productEntity)) { if (!ObjectUtils.isEmpty(productEntity)) {
productEntity.setCompanyId(entity.getCompanyId()); productEntity.setCompanyId(entity.getCompanyId());
String categoryIds = productCategoryService.find(new ProductCategoryQuery().productId(item.getId())).stream().map(i -> i.getCategoryId().toString()).collect(Collectors.joining(",")); String categoryIds = productCategoryService.find(new ProductCategoryQuery().productId(item.getId())).stream().map(i -> i.getCategoryId().toString()).collect(Collectors.joining(","));
productEntity.setCategoryId(categoryIds); productEntity.setCategoryId(categoryIds);
productList.add(productEntity); finalProductList.add(productEntity);
} }
}); });
} }
productList = productList.stream().sorted(Comparator.comparing(ProductEntity::getPublishTime).reversed())
.collect(Collectors.toList());
return productList; return productList;
} }
......
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