|
@@ -18,6 +18,7 @@ import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.concurrent.atomic.AtomicReference;
|
|
|
|
|
|
/**
|
|
|
* Description
|
|
@@ -108,18 +109,8 @@ public class SellerServiceImpl implements SellerService {
|
|
|
PaginationVo<ProductItemVo> productItemVoPaginationVo = new PaginationVo<>(productList);
|
|
|
if (combinationId != null) {
|
|
|
List<Integer> productIdList = sellerMapper.findProductList(combinationId);
|
|
|
- List<Integer> p = new ArrayList<>();
|
|
|
- p.add(productId);
|
|
|
- List<ProductItemVo> pd = sellerMapper.getProductList(p);
|
|
|
- ProductItemVo productItemVo = new ProductItemVo();
|
|
|
- if (pd != null && pd.size() > 0) {
|
|
|
- productItemVo = pd.get(0);
|
|
|
- }
|
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
|
productList = sellerMapper.getProductList(productIdList);
|
|
|
- //本商品设置首位
|
|
|
- productList.remove(productItemVo);
|
|
|
- productList.add(0, productItemVo);
|
|
|
Integer userIdentity = shopMapper.getUserIdentityById(userId);
|
|
|
// 如果非会员身份剔除会员可见商品
|
|
|
if (userIdentity != null) {
|
|
@@ -127,13 +118,20 @@ public class SellerServiceImpl implements SellerService {
|
|
|
productList.removeIf(c -> "1".equals(c.getVisibility()));
|
|
|
}
|
|
|
}
|
|
|
+ AtomicReference<ProductItemVo> item = new AtomicReference<>(new ProductItemVo());
|
|
|
productList.forEach(product -> {
|
|
|
// 设置商品主图及价格
|
|
|
priceUtilService.setProductDetails(userId, product);
|
|
|
//优惠券标识
|
|
|
Boolean couponsLogo = pageService.setCouponsLogo(userId, product.getProductId(), source);
|
|
|
product.setCouponsLogo(couponsLogo);
|
|
|
+ if (productId.equals(product.getProductId())) {
|
|
|
+ item.set(product);
|
|
|
+ }
|
|
|
});
|
|
|
+ //本商品设置首位
|
|
|
+ productList.removeIf(productItemVo -> productItemVo.getProductId().equals(productId));
|
|
|
+ productList.add(0, item.get());
|
|
|
productItemVoPaginationVo = new PaginationVo<>(productList);
|
|
|
}
|
|
|
return ResponseJson.success(productItemVoPaginationVo);
|