Browse Source

商家端限时折扣设置商品选择新增商品所属店铺显示、商品名称搜索

multiwx
dy-hu 7 months ago
parent
commit
9fbbb7f275
  1. 4
      cereshop-business/src/main/java/com/shop/cereshop/business/controller/ShopDiscountController.java
  2. 2
      cereshop-business/src/main/java/com/shop/cereshop/business/dao/tool/CereShopDiscountDAO.java
  3. 2
      cereshop-business/src/main/java/com/shop/cereshop/business/service/tool/CereShopDiscountService.java
  4. 20
      cereshop-business/src/main/java/com/shop/cereshop/business/service/tool/impl/CereShopDiscountServiceImpl.java
  5. 14
      cereshop-business/src/main/resources/mybatis/mapper/tool/CereShopDiscountDAO.xml

4
cereshop-business/src/main/java/com/shop/cereshop/business/controller/ShopDiscountController.java

@ -160,10 +160,10 @@ public class ShopDiscountController {
*/
@PostMapping(value = "getProducts")
@ApiOperation(value = "选择商品查询")
public Result<Page<ToolProduct>> getProducts(@RequestBody ToolProductParam param, HttpServletRequest request) throws CoBusinessException{
public Result<Page<ToolProduct>> getProducts(@RequestBody ToolProductNewParam param, HttpServletRequest request) throws CoBusinessException{
//获取当前登录账户
CerePlatformBusinessUser user = (CerePlatformBusinessUser) request.getAttribute("user");
param.setShopId(user.getBusinessId());
param.setBusinessId(user.getBusinessId());
Page page=cereShopDiscountService.getProducts(param);
return new Result(page);
}

2
cereshop-business/src/main/java/com/shop/cereshop/business/dao/tool/CereShopDiscountDAO.java

@ -35,7 +35,7 @@ public interface CereShopDiscountDAO extends BaseMapper<CereShopDiscount> {
List<ShopDiscount> getAll(ShopDiscountGetAllParam param);
List<ToolProduct> getProducts(@Param("shopId") Long shopId, @Param("shopDiscountId") Long shopDiscountId);
List<ToolProduct> getProducts(@Param("shopId") Long shopId, @Param("shopDiscountId") Long shopDiscountId, @Param("searchContent") String searchContent);
List<CouponProduct> findDataProducts(@Param("shopDiscountId") Long shopDiscountId,@Param("shopId") Long shopId);

2
cereshop-business/src/main/java/com/shop/cereshop/business/service/tool/CereShopDiscountService.java

@ -29,7 +29,7 @@ public interface CereShopDiscountService {
Page getAll(ShopDiscountGetAllParam param) throws CoBusinessException;
Page getProducts(ToolProductParam param) throws CoBusinessException;
Page getProducts(ToolProductNewParam param) throws CoBusinessException;
ShopDiscountData getData(ShopDiscountGetByIdParam param, Long shopId) throws CoBusinessException;

20
cereshop-business/src/main/java/com/shop/cereshop/business/service/tool/impl/CereShopDiscountServiceImpl.java

@ -5,6 +5,7 @@
*/
package com.shop.cereshop.business.service.tool.impl;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.shop.cereshop.business.dao.tool.CereShopDiscountDAO;
@ -17,6 +18,7 @@ import com.shop.cereshop.business.service.order.CereShopOrderService;
import com.shop.cereshop.business.service.platformtool.CerePlatformDiscountService;
import com.shop.cereshop.business.service.platformtool.CerePlatformSeckillService;
import com.shop.cereshop.business.service.redis.CereRedisKeyServcice;
import com.shop.cereshop.business.service.shop.CerePlatformShopService;
import com.shop.cereshop.business.service.tool.CereShopDiscountDetailService;
import com.shop.cereshop.business.service.tool.CereShopDiscountService;
import com.shop.cereshop.commons.constant.CoReturnFormat;
@ -26,6 +28,7 @@ import com.shop.cereshop.commons.constant.StringEnum;
import com.shop.cereshop.commons.domain.business.CerePlatformBusinessUser;
import com.shop.cereshop.commons.domain.common.Page;
import com.shop.cereshop.commons.domain.order.CereShopOrder;
import com.shop.cereshop.commons.domain.shop.CerePlatformShop;
import com.shop.cereshop.commons.domain.tool.CereShopDiscount;
import com.shop.cereshop.commons.domain.tool.CereShopDiscountDetail;
import com.shop.cereshop.commons.exception.CoBusinessException;
@ -73,6 +76,9 @@ public class CereShopDiscountServiceImpl implements CereShopDiscountService{
@Autowired
private ProjectInvokeUtil projectInvokeUtil;
@Autowired
private CerePlatformShopService platformShopService;
@Override
@Transactional(isolation= Isolation.DEFAULT,propagation= Propagation.REQUIRED,rollbackFor = {CoBusinessException.class, Exception.class})
public void save(ShopDiscountSaveParam param, CerePlatformBusinessUser user) throws CoBusinessException,Exception {
@ -389,9 +395,19 @@ public class CereShopDiscountServiceImpl implements CereShopDiscountService{
}
@Override
public Page getProducts(ToolProductParam param) throws CoBusinessException {
public Page getProducts(ToolProductNewParam param) throws CoBusinessException {
PageHelper.startPage(param.getPage(),param.getPageSize());
List<ToolProduct> list=cereShopDiscountDAO.getProducts(param.getShopId(), param.getActivityId());
List<ToolProduct> list=cereShopDiscountDAO.getProducts(param.getBusinessId(), param.getActivityId(), param.getSearchContent());
for (ToolProduct toolProduct : list) {
try {
CerePlatformShop platformShop = platformShopService.getById(toolProduct.getShopId());
if (ObjectUtils.isNotEmpty(platformShop)){
toolProduct.setShopName(platformShop.getShopName());
}
} catch (CoBusinessException e) {
e.printStackTrace();
}
}
PageInfo<ToolProduct> pageInfo=new PageInfo<>(list);
Page page=new Page(pageInfo.getList(),pageInfo.getTotal());
return page;

14
cereshop-business/src/main/resources/mybatis/mapper/tool/CereShopDiscountDAO.xml

@ -265,6 +265,7 @@
resultType="com.shop.cereshop.business.page.tool.ToolProduct">
SELECT a.product_id,
b.product_name,
b.shop_id,
a.original_price,
a.price,
<if test="shopDiscountId != null">
@ -289,32 +290,35 @@
LEFT JOIN cere_product_classify d ON b.classify_id = d.classify_id
LEFT JOIN (SELECT GROUP_CONCAT(sku_value) `value`, sku_id FROM cere_sku_name GROUP BY sku_id) e
ON a.sku_id = e.sku_id
where b.shop_id = #{shopId}
where b.shop_id in (select shop_id from cere_platform_shop where business_id = #{shopId})
and b.shelve_state = 1
and a.product_id NOT in (SELECT a.product_id
FROM cere_shop_group_work_detail a
LEFT JOIN cere_shop_group_work b ON a.shop_group_work_id = b.shop_group_work_id
where b.shop_id = #{shopId}
where b.shop_id in (select shop_id from cere_platform_shop where business_id = #{shopId})
and b.state=1)
and a.product_id NOT in (SELECT a.product_id
FROM cere_shop_seckill_detail a
LEFT JOIN cere_shop_seckill b ON a.shop_seckill_id = b.shop_seckill_id
where b.shop_id = #{shopId}
where b.shop_id in (select shop_id from cere_platform_shop where business_id = #{shopId})
and b.state=1)
and a.product_id NOT in (SELECT a.product_id
FROM cere_sign_product a
LEFT JOIN cere_activity_sign b ON a.sign_id = b.sign_id
LEFT JOIN cere_platform_seckill c
ON b.activity_id = c.seckill_id and b.sign_type = 2
where b.shop_id = #{shopId}
where b.shop_id in (select shop_id from cere_platform_shop where business_id = #{shopId})
and c.state=3)
and a.product_id NOT in (SELECT a.product_id
FROM cere_sign_product a
LEFT JOIN cere_activity_sign b ON a.sign_id = b.sign_id
LEFT JOIN cere_platform_discount c
ON b.activity_id = c.discount_id and b.sign_type = 3
where b.shop_id = #{shopId}
where b.shop_id in (select shop_id from cere_platform_shop where business_id = #{shopId})
and c.state=3)
<if test="searchContent != null">
and b.product_name like concat('%',#{searchContent},'%')
</if>
</select>
<select id="findDataProducts" parameterType="java.lang.Object"

Loading…
Cancel
Save