|
@@ -5,7 +5,7 @@ import com.caimei365.commodity.mapper.ShopMapper;
|
|
|
import com.caimei365.commodity.model.ResponseJson;
|
|
|
import com.caimei365.commodity.model.search.ProductListVo;
|
|
|
import com.caimei365.commodity.model.vo.PaginationVo;
|
|
|
-import com.caimei365.commodity.model.vo.ProductShopVO;
|
|
|
+import com.caimei365.commodity.model.vo.ProductItemVo;
|
|
|
import com.caimei365.commodity.model.vo.PromotionsVo;
|
|
|
import com.caimei365.commodity.service.ShopService;
|
|
|
import com.caimei365.commodity.utils.ImageUtils;
|
|
@@ -82,72 +82,30 @@ public class ShopServiceImpl implements ShopService {
|
|
|
* @param tinyTypeId 三级级分类Id
|
|
|
* @param pageNum 页码
|
|
|
* @param pageSize 每页数量
|
|
|
- * @return PageInfo<ProductShopVO>
|
|
|
+ * @return Map<String, Object>
|
|
|
*/
|
|
|
@Override
|
|
|
- public ResponseJson<PageInfo<ProductShopVO>> getShopProducts(Integer shopId, String name, String productCode, Integer validFlag, Integer featuredFlag, Integer typeSort, Integer bigTypeId, Integer smallTypeId, Integer tinyTypeId, int pageNum, int pageSize) {
|
|
|
+ public ResponseJson<Map<String, Object>> getShopProducts(Integer shopId, String name, String productCode, Integer validFlag, Integer featuredFlag, Integer typeSort, Integer bigTypeId, Integer smallTypeId, Integer tinyTypeId, int pageNum, int pageSize) {
|
|
|
if (null == shopId) {
|
|
|
return ResponseJson.error("参数异常:缺少供应商Id", null);
|
|
|
}
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
|
- List<ProductShopVO> productList = shopMapper.getShopProductsSelect(shopId, name, productCode, validFlag, featuredFlag, typeSort, bigTypeId, smallTypeId, tinyTypeId);
|
|
|
-// if (null != productList && productList.size() > 0) {
|
|
|
-// for (ProductShopVO product : productList) {
|
|
|
-// product.setMainImage(ImageUtils.getImageURL("product", product.getMainImage(), 0, domain));
|
|
|
-// String typeName = shopMapper.getTypeName(product.getBigTypeId(), product.getSmallTypeId(), product.getTinyTypeId());
|
|
|
-// product.setTypeName(typeName);
|
|
|
-// //店铺促销
|
|
|
-// PromotionsVo promotions = promotionsDao.getSupplierPromotionsBySupplierId(product.getShopID());
|
|
|
-// if (promotions == null) {
|
|
|
-// promotions = promotionsDao.getProductPromotionsByProductId(product.getProductID());
|
|
|
-// }
|
|
|
-// if (null != promotions) {
|
|
|
-// List<CartItem> productGifts = null;
|
|
|
-// List<CartItem> promotionsProduct = null;
|
|
|
-// if (2 == promotions.getMode()) {
|
|
|
-// //满减商品
|
|
|
-// promotionsProduct = promotionsDao.findPromotionsProduct(promotions.getId());
|
|
|
-// } else if (3 == promotions.getMode()) {
|
|
|
-// //满赠商品
|
|
|
-// promotionsProduct = promotionsDao.findPromotionsProduct(promotions.getId());
|
|
|
-// productGifts = promotionsDao.getProductGifts(promotions.getId());
|
|
|
-// }
|
|
|
-// //促销商品
|
|
|
-// if (null != promotionsProduct && promotionsProduct.size() > 0) {
|
|
|
-// promotionsProduct.forEach(p -> {
|
|
|
-// if (p != null) {
|
|
|
-// p.setImage(ImageUtils.getImageURL("product", p.getImage(), 0, domain));
|
|
|
-// }
|
|
|
-// });
|
|
|
-// promotions.setProductList(promotionsProduct);
|
|
|
-// }
|
|
|
-// //促销赠品
|
|
|
-// if (null != productGifts && productGifts.size() > 0) {
|
|
|
-// productGifts.forEach(p -> {
|
|
|
-// p.setImage(ImageUtils.getImageURL("product", p.getImage(), 0, domain));
|
|
|
-// });
|
|
|
-// promotions.setGiftList(productGifts);
|
|
|
-// }
|
|
|
-// product.setPromotions(promotions);
|
|
|
-// } else if ("1".equals(product.getLadderPriceFlag())) {
|
|
|
-// //启用阶梯价格
|
|
|
-// sellerProductService.getLadderPrice(product);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// PaginationVo<ProductShopVO> productPage = new PaginationVo<>(productList);
|
|
|
-// map.put("productPage", productPage);
|
|
|
-// List<ProductShopVO> mainProduct = supplierDao.findMainProduct(product.getShopID());
|
|
|
-// //主推商品数量
|
|
|
-// int featuredNum = 0;
|
|
|
-// if (null != mainProduct) {
|
|
|
-// featuredNum = mainProduct.size();
|
|
|
-// }
|
|
|
-// map.put("featuredNum", featuredNum);
|
|
|
-// return ResponseJson.success(map);
|
|
|
-
|
|
|
- return null;
|
|
|
-
|
|
|
+ List<ProductItemVo> productList = shopMapper.getShopProductsSelect(shopId, name, productCode, validFlag, featuredFlag, typeSort, bigTypeId, smallTypeId, tinyTypeId);
|
|
|
+ if (null != productList && productList.size() > 0) {
|
|
|
+ for (ProductItemVo product : productList) {
|
|
|
+ product.setMainImage(ImageUtils.getImageURL("product", product.getMainImage(), 0, domain));
|
|
|
+ String typeName = shopMapper.getTypeName(product.getBigTypeId(), product.getSmallTypeId(), product.getTinyTypeId());
|
|
|
+ product.setTypeName(typeName);
|
|
|
+ // 设置商品价格
|
|
|
+ Integer userId = shopMapper.getUserIdByshopId(shopId);
|
|
|
+ priceUtilService.setItemPriceByUserId(product, userId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ PaginationVo<ProductItemVo> productPage = new PaginationVo<>(productList);
|
|
|
+ map.put("productPage", productPage);
|
|
|
+ int featuredNum = shopMapper.getMainProductsCount(shopId);
|
|
|
+ map.put("featuredNum", featuredNum);
|
|
|
+ return ResponseJson.success(map);
|
|
|
}
|
|
|
}
|