diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/controller/ShopCouponController.java b/cereshop-business/src/main/java/com/shop/cereshop/business/controller/ShopCouponController.java index a41fb4e..6e07143 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/controller/ShopCouponController.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/controller/ShopCouponController.java @@ -7,11 +7,13 @@ package com.shop.cereshop.business.controller; import com.shop.cereshop.business.annotation.NoRepeatSubmit; import com.shop.cereshop.business.annotation.NoRepeatWebLog; +import com.shop.cereshop.business.page.shop.Shop; import com.shop.cereshop.business.page.tool.ShopCoupon; import com.shop.cereshop.business.page.tool.ShopCouponData; import com.shop.cereshop.business.page.tool.ShopCouponDetail; import com.shop.cereshop.business.page.tool.ToolProduct; import com.shop.cereshop.business.param.tool.*; +import com.shop.cereshop.business.service.shop.CerePlatformShopService; import com.shop.cereshop.business.service.tool.CereShopCouponService; import com.shop.cereshop.commons.domain.business.CerePlatformBusinessUser; import com.shop.cereshop.commons.domain.common.Page; @@ -26,6 +28,7 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; +import java.util.stream.Collectors; /** * 店铺优惠券管理 @@ -42,6 +45,9 @@ public class ShopCouponController { @Autowired private CereShopCouponService cereShopCouponService; + @Autowired + private CerePlatformShopService shopService; + /** * 新增满减券/折扣券 * @param param @@ -152,10 +158,11 @@ public class ShopCouponController { */ @PostMapping(value = "getProducts") @ApiOperation(value = "选择商品查询") - public Result> getProducts(@RequestBody ToolProductParam param, HttpServletRequest request) throws CoBusinessException{ + public Result> getProducts(@RequestBody ToolProductNewParam param, HttpServletRequest request) throws CoBusinessException{ //获取当前登录账户 CerePlatformBusinessUser user = (CerePlatformBusinessUser) request.getAttribute("user"); - param.setShopId(user.getBusinessId()); + shopService.selectAll(user.getBusinessId()); + param.setShopIds(shopService.selectAll(user.getBusinessId()).stream().map(Shop::getShopId).collect(Collectors.toList())); Page page=cereShopCouponService.getProducts(param); return new Result(page); } diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/dao/tool/CereShopCouponDAO.java b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/tool/CereShopCouponDAO.java index d52a09e..b004576 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/dao/tool/CereShopCouponDAO.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/tool/CereShopCouponDAO.java @@ -70,4 +70,8 @@ public interface CereShopCouponDAO extends BaseMapper { List findDataProductsLimitProducts(@Param("shopCouponId") Long shopCouponId, @Param("orderIdList") List orderIdList); + + List getProductsNew(@Param("shopIds") List shopIds, + @Param("shopCouponId") Long shopCouponId, + @Param("queryType") Integer queryType); } diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/param/tool/ToolProductNewParam.java b/cereshop-business/src/main/java/com/shop/cereshop/business/param/tool/ToolProductNewParam.java new file mode 100644 index 0000000..3ae30ff --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/param/tool/ToolProductNewParam.java @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2017-2021 + * All rights reserved, Designed By 深圳中科鑫智科技有限公司 + * Copyright authorization contact 18814114118 + */ +package com.shop.cereshop.business.param.tool; + +import com.shop.cereshop.commons.domain.common.PageParam; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * 营销活动选择商品请求参数 + */ +@Data +@ApiModel(value = "ToolProductParam", description = "营销活动选择商品请求参数") +public class ToolProductNewParam extends PageParam { + + /** + * 店铺id集合 + */ + @ApiModelProperty(value = "店铺id集合") + private List shopIds; + + /** + * 活动id + */ + @ApiModelProperty(value = "活动id") + private Long activityId; + + /** + * 查询类型 2-指定商品可用 3-指定商品不可用 + */ + @ApiModelProperty(value = "查询类型") + private Integer queryType; + + +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/param/tool/ToolProductParam.java b/cereshop-business/src/main/java/com/shop/cereshop/business/param/tool/ToolProductParam.java index f2e9ef6..aeaf4e5 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/param/tool/ToolProductParam.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/param/tool/ToolProductParam.java @@ -34,4 +34,6 @@ public class ToolProductParam extends PageParam { */ @ApiModelProperty(value = "查询类型") private Integer queryType; + + } diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/tool/CereShopCouponService.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/tool/CereShopCouponService.java index 3d327fa..856d12a 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/service/tool/CereShopCouponService.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/tool/CereShopCouponService.java @@ -30,7 +30,7 @@ public interface CereShopCouponService { void stop(Long shopCouponId, CerePlatformBusinessUser user) throws CoBusinessException; - Page getProducts(ToolProductParam param) throws CoBusinessException; + Page getProducts(ToolProductNewParam param) throws CoBusinessException; List selectCoupon(OperateCouponParam param) throws CoBusinessException; diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/tool/impl/CereShopCouponServiceImpl.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/tool/impl/CereShopCouponServiceImpl.java index f5b8b8a..5229cb0 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/service/tool/impl/CereShopCouponServiceImpl.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/tool/impl/CereShopCouponServiceImpl.java @@ -394,9 +394,9 @@ public class CereShopCouponServiceImpl implements CereShopCouponService { } @Override - public Page getProducts(ToolProductParam param) throws CoBusinessException { + public Page getProducts(ToolProductNewParam param) throws CoBusinessException { PageHelper.startPage(param.getPage(),param.getPageSize()); - List list=cereShopCouponDAO.getProducts(param.getShopId(), param.getActivityId(), param.getQueryType()); + List list=cereShopCouponDAO.getProductsNew(param.getShopIds(), param.getActivityId(), param.getQueryType()); PageInfo pageInfo=new PageInfo<>(list); Page page=new Page(pageInfo.getList(),pageInfo.getTotal()); return page; diff --git a/cereshop-business/src/main/resources/mybatis/mapper/tool/CereShopCouponDAO.xml b/cereshop-business/src/main/resources/mybatis/mapper/tool/CereShopCouponDAO.xml index e5f575c..c7aab6e 100644 --- a/cereshop-business/src/main/resources/mybatis/mapper/tool/CereShopCouponDAO.xml +++ b/cereshop-business/src/main/resources/mybatis/mapper/tool/CereShopCouponDAO.xml @@ -182,6 +182,36 @@ + +