Browse Source

分类商品获取分页业务修改调整

multiwx
dy-hu 2 months ago
parent
commit
fc12b902cd
  1. 3
      cereshop-app/src/main/java/com/shop/cereshop/app/page/classify/Classify.java
  2. 12
      cereshop-app/src/main/java/com/shop/cereshop/app/service/order/placeOrderTemplate/PlaceOrderTemplate.java
  3. 4
      cereshop-app/src/main/java/com/shop/cereshop/app/service/product/impl/CereProductClassifyServiceImpl.java
  4. 8
      cereshop-app/src/main/resources/mybatis/mapper/product/CereProductClassifyDAO.xml

3
cereshop-app/src/main/java/com/shop/cereshop/app/page/classify/Classify.java

@ -52,6 +52,9 @@ public class Classify {
@ApiModelProperty(value = "图片")
private String classifyImage;
@ApiModelProperty(value = "分类层级名称")
private String classifyHierarchy;
/**
* 子节点
*/

12
cereshop-app/src/main/java/com/shop/cereshop/app/service/order/placeOrderTemplate/PlaceOrderTemplate.java

@ -618,13 +618,17 @@ public abstract class PlaceOrderTemplate {
Long shopCouponId = cereBuyerShopCoupon.getShopCouponId();
total = BigDecimal.ZERO;
Long shopId = param.getShops().stream().filter(o->o.getId() != null && o.getId().equals(cereBuyerShopCoupon.getId())).map(OrderProductParam::getShopId).findAny().orElse(0L);
List<ProductSku> skuList = param.getShops().stream().filter(o->o.getShopId().equals(shopId)).findFirst().get().getSkus();
Optional<OrderProductParam> productParam = param.getShops().stream().filter(o->o.getShopId().equals(shopId)).findFirst();
int priceCount = 0;
for (ProductSku sku:skuList) {
if (sku.getPriceId() != null && sku.getPriceId() > 0) {
priceCount++;
if (productParam.isPresent()){
List<ProductSku> skuList = productParam.get().getSkus();
for (ProductSku sku:skuList) {
if (sku.getPriceId() != null && sku.getPriceId() > 0) {
priceCount++;
}
}
}
List<CartSku> curShopSkuList = map.values().stream().filter(obj -> obj.getShopId().equals(shopId)).collect(Collectors.toList());
List<CartSku> useCurCouponSkuList = curShopSkuList.stream().filter(obj -> obj.getBuyerShopCouponId() != null && obj.getBuyerShopCouponId().equals(shopCouponId)).collect(Collectors.toList());

4
cereshop-app/src/main/java/com/shop/cereshop/app/service/product/impl/CereProductClassifyServiceImpl.java

@ -135,15 +135,15 @@ public class CereProductClassifyServiceImpl implements CereProductClassifyServic
@Override
public Page getClaasifyProducts(ClassifyProductParam param, CereBuyerUser user) throws CoBusinessException {
PageHelper.startPage(param.getPage(),param.getPageSize());
if (user != null) {
param.setBuyerUserId(user.getBuyerUserId());
}
param.setProject(ContextUtil.getProject());
PageHelper.startPage(param.getPage(),param.getPageSize());
List<Product> list=cereProductClassifyDAO.getClaasifyProducts(param);
if(!EmptyUtils.isEmpty(list)){
//可能会存在重复商品元素去重处理
list = list.stream().filter(distinctByKey(Product::getProductId)).collect(Collectors.toList());
//list = list.stream().filter(distinctByKey(Product::getProductId)).collect(Collectors.toList());
list.forEach(a -> {
//查询付款人数
a.setUsers(cerePlatformShopservice.findPayUsers(a.getProductId()));

8
cereshop-app/src/main/resources/mybatis/mapper/product/CereProductClassifyDAO.xml

@ -171,7 +171,7 @@
</select>
<select id="getFirstClassify" parameterType="java.lang.Object" resultType="com.shop.cereshop.app.page.classify.Classify">
SELECT classify_id,classify_name,classify_image from cere_product_classify
SELECT classify_id,classify_name,classify_image,classify_hierarchy from cere_product_classify
where 1=1 AND project=#{project}
<if test="classifyId!=null">
and classify_pid=#{classifyId}
@ -182,15 +182,15 @@
</select>
<select id="findThreeClassify" parameterType="java.lang.Object" resultType="com.shop.cereshop.app.page.classify.Classify">
SELECT classify_id,classify_pid,classify_name,classify_image from cere_product_classify where classify_level=3 AND project=#{project}
SELECT classify_id,classify_pid,classify_name,classify_image,classify_hierarchy from cere_product_classify where classify_level=3 AND project=#{project}
</select>
<select id="getClaasifyProducts" parameterType="com.shop.cereshop.app.param.classify.ClassifyProductParam" resultType="com.shop.cereshop.app.page.index.Product">
SELECT
SELECT DISTINCT
a.product_id,
a.shop_id,
d.shop_name,
d.shop_logo,
a.product_id,
a.product_name,
c.product_image image,
b.sku_id,

Loading…
Cancel
Save