|
@@ -11,6 +11,7 @@ import com.caimei365.commodity.model.vo.ProductItemVo;
|
|
|
import com.caimei365.commodity.service.PageService;
|
|
|
import com.caimei365.commodity.service.SellerService;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -27,6 +28,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
|
|
* @date : 2021/4/23
|
|
|
*/
|
|
|
@Service
|
|
|
+@Slf4j
|
|
|
public class SellerServiceImpl implements SellerService {
|
|
|
@Value("${caimei.wwwDomain}")
|
|
|
private String domain;
|
|
@@ -109,8 +111,18 @@ 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) {
|
|
@@ -118,20 +130,13 @@ 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);
|