Browse Source

商家端拼团活动设置商品选择新增商品所属店铺显示、商品名称搜索

multiwx
dy-hu 10 months ago
parent
commit
2cec6a9210
  1. 4
      cereshop-business/src/main/java/com/shop/cereshop/business/controller/ShopGroupWorkController.java
  2. 2
      cereshop-business/src/main/java/com/shop/cereshop/business/dao/tool/CereShopGroupWorkDAO.java
  3. 2
      cereshop-business/src/main/java/com/shop/cereshop/business/service/tool/CereShopGroupWorkService.java
  4. 20
      cereshop-business/src/main/java/com/shop/cereshop/business/service/tool/impl/CereShopGroupWorkServiceImpl.java
  5. 14
      cereshop-business/src/main/resources/mybatis/mapper/tool/CereShopGroupWorkDAO.xml

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

@ -164,10 +164,10 @@ public class ShopGroupWorkController {
*/
@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=cereShopGroupWorkService.getProducts(param);
return new Result(page);
}

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

@ -32,7 +32,7 @@ public interface CereShopGroupWorkDAO extends BaseMapper<CereShopGroupWork> {
ShopGroupWorkUDetail getById(@Param("shopGroupWorkId") Long shopGroupWorkId);
List<ToolProduct> getProducts(@Param("shopId") Long shopId, @Param("shopGroupWorkId") Long shopGroupWorkId);
List<ToolProduct> getProducts(@Param("shopId") Long shopId, @Param("shopGroupWorkId") Long shopGroupWorkId, @Param("searchContent") String searchContent);
List<ShopGroupWork> getAll(ShopGroupWorkGetAllParam param);

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

@ -27,7 +27,7 @@ public interface CereShopGroupWorkService {
ShopGroupWorkUDetail getById(Long shopGroupWorkId) throws CoBusinessException;
Page getProducts(ToolProductParam param) throws CoBusinessException;
Page getProducts(ToolProductNewParam param) throws CoBusinessException;
Page getAll(ShopGroupWorkGetAllParam param) throws CoBusinessException;

20
cereshop-business/src/main/java/com/shop/cereshop/business/service/tool/impl/CereShopGroupWorkServiceImpl.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.CereShopGroupWorkDAO;
@ -19,6 +20,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.CereShopGroupWorkDetailService;
import com.shop.cereshop.business.service.tool.CereShopGroupWorkService;
import com.shop.cereshop.commons.constant.CoReturnFormat;
@ -28,6 +30,7 @@ import com.shop.cereshop.commons.constant.StringEnum;
import com.shop.cereshop.commons.domain.business.CerePlatformBusinessUser;
import com.shop.cereshop.commons.domain.collage.CereCollageOrder;
import com.shop.cereshop.commons.domain.common.Page;
import com.shop.cereshop.commons.domain.shop.CerePlatformShop;
import com.shop.cereshop.commons.domain.tool.CereShopGroupWork;
import com.shop.cereshop.commons.domain.tool.CereShopGroupWorkDetail;
import com.shop.cereshop.commons.exception.CoBusinessException;
@ -81,6 +84,9 @@ public class CereShopGroupWorkServiceImpl implements CereShopGroupWorkService {
@Autowired
private ProjectInvokeUtil projectInvokeUtil;
@Autowired
private CerePlatformShopService platformShopService;
@Override
@Transactional(isolation= Isolation.DEFAULT,propagation= Propagation.REQUIRED,rollbackFor = {CoBusinessException.class, Exception.class})
public void save(ShopGroupWorkSaveParam param, CerePlatformBusinessUser user) throws CoBusinessException,Exception {
@ -382,9 +388,19 @@ public class CereShopGroupWorkServiceImpl implements CereShopGroupWorkService {
}
@Override
public Page getProducts(ToolProductParam param) throws CoBusinessException {
public Page getProducts(ToolProductNewParam param) throws CoBusinessException {
PageHelper.startPage(param.getPage(),param.getPageSize());
List<ToolProduct> list=cereShopGroupWorkDAO.getProducts(param.getShopId(), param.getActivityId());
List<ToolProduct> list=cereShopGroupWorkDAO.getProducts(param.getBusinessId(), param.getActivityId(), param.getSearchContent());
list.forEach(toolProduct -> {
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/CereShopGroupWorkDAO.xml

@ -248,6 +248,7 @@
resultType="com.shop.cereshop.business.page.tool.ToolProduct">
SELECT a.product_id,
b.product_name,
b.shop_id,
a.price,
a.original_price,
<if test="shopGroupWorkId != null">
@ -272,32 +273,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_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_shop_discount_detail a
LEFT JOIN cere_shop_discount b ON a.shop_discount_id = b.shop_discount_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="getAll" parameterType="com.shop.cereshop.business.param.tool.ShopGroupWorkGetAllParam"

Loading…
Cancel
Save